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>
110        <?php if ($tpl->get('thread')->user_is_coordinator() &&
111                  $tpl->get('thread')->can_add_participants() &&
112                  $participant['coordinator'] == '0' && $participant['task_assignee'] == '0'): ?>
113            <a href="<?php echo $tpl->url('thread', 'id', $tpl->get('thread')->id, 'action', 'participant_remove', 'user_id', $participant['user_id']) ?>"
114               class="participant_remove">
115                <span class="bez_awesome">
116				    &#xf00d;
117			    </span>
118            </a>
119        <?php endif ?>
120        <a href="<?php echo $tpl->mailto($tpl->user_email($participant['user_id']),
121		'#'.$tpl->get('thread')->id.' '.$tpl->get('thread')->title,
122		$tpl->url('thread', 'id', $tpl->get('thread')->id)) ?>"  title="<?php echo $participant['user_id'] ?>">
123		<span class="bez_name"><?php echo $tpl->user_name($participant['user_id']) ?></span>
124		<span class="bez_icons">
125		<?php if($participant['original_poster']): ?>
126			<span class="bez_awesome"
127				title="<?php echo $tpl->getLang('reporter') ?>">
128				&#xf058;
129			</span>
130		<?php endif ?>
131		<?php if($participant['coordinator']): ?>
132			<span class="bez_awesome"
133				title="<?php echo $tpl->getLang('coordinator') ?>">
134				&#xf0e3;
135			</span>
136		<?php endif ?>
137		<?php if($participant['task_assignee']): ?>
138			<span class="bez_awesome"
139				title="<?php echo $tpl->getLang('executor') ?>">
140				&#xf073;
141			</span>
142		<?php endif ?>
143		<?php if($participant['commentator']): ?>
144			<span class="bez_awesome"
145				title="<?php echo $tpl->getLang('commentator') ?>">
146				&#xf27a;
147			</span>
148		<?php endif ?>
149		<?php if($participant['subscribent']): ?>
150			<span class="bez_awesome"
151				title="<?php echo $tpl->getLang('subscribent') ?>">
152				&#xf0e0;
153			</span>
154		<?php endif ?>
155		</span>
156	</a>
157    </li>
158<?php endforeach ?>
159</ul>
160
161<?php if (	$tpl->get('thread')->user_is_coordinator() &&
162            $tpl->get('thread')->can_add_participants()): ?>
163    <h2><?php echo $tpl->getLang('issue_invite_header') ?></h2>
164    <form action="<?php echo $tpl->url('thread', 'id', $tpl->get('thread')->id, 'action', 'invite') ?>" method="post" id="bez_invite_users_form">
165    <div id="bez_invite_users" class="ui-widget">
166        <select name="client">
167            <option value="">--- <?php echo $tpl->getLang('select') ?> ---</option>
168            <?php foreach (array_diff_key($tpl->get('users'), $tpl->get('thread')->get_participants('subscribent')) as $user_id => $ignore): ?>
169                <option value="<?php echo $user_id ?>"><?php echo $tpl->user_name($user_id) ?></option>
170            <?php endforeach ?>
171        </select>
172    </div>
173    <button class="bez_subscribe_button"><?php echo $tpl->getLang('issue_invite_button') ?></button>
174    </form>
175<?php endif ?>
176
177
178</div>
179
180
181</div>
182
183