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