xref: /plugin/bez/tpl/thread.php (revision fabf14f34d1866b0b586fe614e47ef917dde7100)
1<?php /* @var \dokuwiki\plugin\bez\meta\Tpl $tpl */ ?>
2<?php include "thread_box.php" ?>
3
4<div class="bez_comments">
5	<div class="bez_left_col">
6		<?php foreach ($tpl->get('timeline') as $entity): ?>
7            <?php if ($entity->get_table_name() == 'thread_comment'): ?>
8                <?php $tpl->set('thread_comment', $entity) ?>
9                <?php if (	$tpl->param('action') == 'commcause_edit' &&
10                            $tpl->param('kid') == $entity->id): ?>
11                    <?php include 'commcause_form.php' ?>
12                <?php else: ?>
13                    <?php include 'commcause_box.php' ?>
14                <?php endif ?>
15            <?php elseif($entity->get_table_name() == 'task'): ?>
16                <br>
17                <?php $tpl->set('task', $entity) ?>
18                <?php if (	$tpl->param('action') == 'task_edit' &&
19                    $tpl->param('tid') == $entity->id): ?>
20                    <?php include 'task_form.php' ?>
21                <?php else: ?>
22                    <?php include 'task_box.php' ?>
23                <?php endif ?>
24            <?php endif ?>
25		<?php endforeach ?>
26
27        <?php if ($tpl->param('action') == '' && $tpl->get('thread')->user_is_coordinator() && $tpl->get('thread')->can_add_tasks()): ?>
28            <div class="bez_second_lv_buttons" style="margin-top: 10px">
29                <a href="<?php echo $tpl->url('thread', 'id', $tpl->get('thread')->id, 'action', 'task_add') ?>#z_" class="bez_subscribe_button">
30                    <span class="bez_awesome">&#xf0fe;</span>&nbsp;&nbsp;<?php echo $tpl->getLang('correction_add') ?>
31                </a>
32            </div>
33        <?php elseif ($tpl->param('action') == 'task_add' && $tpl->param('kid') == ''): ?>
34            <br>
35            <?php include 'task_form.php' ?>
36        <?php elseif ($tpl->get('thread')->state == 'closed'): ?>
37            <div class="plugin__bez_status_label">
38            <span class="icon icon_green">
39                <?php echo inlineSVG(DOKU_PLUGIN . 'bez/images/tick.svg') ?>
40            </span>
41                <?php printf($tpl->getLang('user_closed_issue'),
42                             '<strong>' . $tpl->user_name($tpl->get('thread')->closed_by) . '</strong>',
43                             $tpl->date_fuzzy_age($tpl->get('thread')->close_date)) ?>
44            </div>
45        <?php elseif ($tpl->get('thread')->state == 'rejected'): ?>
46                <div class="plugin__bez_status_label">
47            <span class="icon icon_red">
48                <?php echo inlineSVG(DOKU_PLUGIN . 'bez/images/close.svg') ?>
49            </span>
50                    <?php printf($tpl->getLang('user_rejected_issue'),
51                                 '<strong>' . $tpl->user_name($tpl->get('thread')->closed_by) . '</strong>',
52                                 $tpl->date_fuzzy_age($tpl->get('thread')->close_date)) ?>
53                </div>
54        <?php endif ?>
55
56
57<?php if (	!(strpos($tpl->param('action'), 'task') === 0) &&
58            $tpl->param('action') != 'commcause_edit' &&
59            !(in_array($tpl->get('thread')->state, array('closed', 'rejected')) &&
60                $tpl->get('thread')->acl_of('state') < BEZ_PERMISSION_CHANGE)): ?>
61
62    <?php include 'commcause_form.php' ?>
63
64    <br>
65    <?php if ($tpl->get('thread')->task_count - $tpl->get('thread')->task_count_closed > 0): ?>
66        <div class="info"><?php echo $tpl->getLang('issue_unclosed_tasks' . $tpl->get('lang_suffix')) ?></div>
67    <?php endif ?>
68    <?php if ($tpl->get('thread')->state == 'proposal'): ?>
69        <div class="info"><?php echo $tpl->getLang('issue_is_proposal' . $tpl->get('lang_suffix')) ?></div>
70    <?php endif ?>
71    <?php if ($tpl->get('causes_without_tasks')): ?>
72        <div class="info"><?php echo $tpl->getLang('cause_without_task') ?></div>
73    <?php endif ?>
74    <?php if ($tpl->get('thread')->state == 'opened' && $tpl->get('thread')->task_count == 0): ?>
75        <div class="info"><?php echo $tpl->getLang('issue_no_tasks' . $tpl->get('lang_suffix')) ?></div>
76    <?php endif ?>
77<?php endif ?>
78
79
80</div>
81<div class="bez_right_col">
82
83<div class="bez_box">
84<h2><?php echo $tpl->getLang('comment_last_activity') ?></h2>
85
86<?php echo $tpl->datetime($tpl->get('thread')->last_activity_date) ?>
87
88
89</div>
90
91<div class="bez_box bez_subscribe_box">
92<h2><?php echo $tpl->getLang('norifications') ?></h2>
93<?php if ($tpl->get('thread')->is_subscribent()): ?>
94	<a href="<?php echo $tpl->url('thread', 'id', $tpl->get('thread')->id, 'action', 'unsubscribe') ?>" class="bez_subscribe_button"><span class="bez_awesome">&#xf1f6;</span>&nbsp;&nbsp;<?php echo $tpl->getLang('unsubscribe') ?></a>
95	<p><?php echo $tpl->getLang('subscribed_info' . $tpl->get('lang_suffix')) ?></p>
96<?php else: ?>
97	<a href="<?php echo $tpl->url('thread', 'id', $tpl->get('thread')->id, 'action', 'subscribe') ?>" class="bez_subscribe_button"><span class="bez_awesome">&#xf0f3;</span>&nbsp;&nbsp;<?php echo $tpl->getLang('subscribe') ?></a>
98	<p><?php echo $tpl->getLang('not_subscribed_info' . $tpl->get('lang_suffix')) ?></p>
99<?php endif ?>
100
101</div>
102
103<div class="bez_box">
104<h2><?php echo $tpl->getLang('comment_participants') ?></h2>
105<ul id="issue_participants">
106<?php foreach ($tpl->get('thread')->get_participants() as $participant): ?>
107	<li><a href="<?php echo $tpl->mailto($tpl->user_email($participant['user_id']),
108		'#'.$tpl->get('thread')->id.' '.$tpl->get('thread')->title,
109		$tpl->url('thread', 'id', $tpl->get('thread')->id)) ?>"  title="<?php echo $participant['user_id'] ?>">
110		<span class="bez_name"><?php echo $tpl->user_name($participant['user_id']) ?></span>
111		<span class="bez_icons">
112		<?php if($participant['original_poster']): ?>
113			<span class="bez_awesome"
114				title="<?php echo $tpl->getLang('reporter') ?>">
115				&#xf058;
116			</span>
117		<?php endif ?>
118		<?php if($participant['coordinator']): ?>
119			<span class="bez_awesome"
120				title="<?php echo $tpl->getLang('coordinator') ?>">
121				&#xf0e3;
122			</span>
123		<?php endif ?>
124		<?php if($participant['task_assignee']): ?>
125			<span class="bez_awesome"
126				title="<?php echo $tpl->getLang('executor') ?>">
127				&#xf073;
128			</span>
129		<?php endif ?>
130		<?php if($participant['commentator']): ?>
131			<span class="bez_awesome"
132				title="<?php echo $tpl->getLang('commentator') ?>">
133				&#xf27a;
134			</span>
135		<?php endif ?>
136		<?php if($participant['subscribent']): ?>
137			<span class="bez_awesome"
138				title="<?php echo $tpl->getLang('subscribent') ?>">
139				&#xf0e0;
140			</span>
141		<?php endif ?>
142		</span>
143	</a></li>
144<?php endforeach ?>
145</ul>
146
147<?php if (	$tpl->get('thread')->user_is_coordinator() &&
148            $tpl->get('thread')->can_add_participants()): ?>
149    <h2><?php echo $tpl->getLang('issue_invite_header') ?></h2>
150    <form action="<?php echo $tpl->url('thread', 'id', $tpl->get('thread')->id, 'action', 'invite') ?>" method="post" id="bez_invite_users_form">
151    <div id="bez_invite_users" class="ui-widget">
152        <select name="client">
153            <option value="">--- <?php echo $tpl->getLang('select') ?> ---</option>
154            <?php foreach (array_diff_key($tpl->get('users'), $tpl->get('thread')->get_participants('subscribent')) as $user_id => $ignore): ?>
155                <option value="<?php echo $user_id ?>"><?php echo $tpl->user_name($user_id) ?></option>
156            <?php endforeach ?>
157        </select>
158    </div>
159    <button class="bez_subscribe_button"><?php echo $tpl->getLang('issue_invite_button') ?></button>
160    </form>
161<?php endif ?>
162
163
164</div>
165
166
167</div>
168
169