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 $tpl->set('task', $tpl->get('task_new')) ?>
38            <?php include 'task_form.php' ?>
39        <?php elseif ($tpl->get('thread')->state == 'closed'): ?>
40            <div class="plugin__bez_status_label">
41            <span class="icon icon_green">
42                <?php echo inlineSVG(DOKU_PLUGIN . 'bez/images/tick.svg') ?>
43            </span>
44                <?php printf($tpl->getLang('user_closed_issue'),
45                             '<strong>' . $tpl->user_name($tpl->get('thread')->closed_by) . '</strong>',
46                             $tpl->date_fuzzy_age($tpl->get('thread')->close_date)) ?>
47            </div>
48        <?php elseif ($tpl->get('thread')->state == 'rejected'): ?>
49                <div class="plugin__bez_status_label">
50            <span class="icon icon_red">
51                <?php echo inlineSVG(DOKU_PLUGIN . 'bez/images/close.svg') ?>
52            </span>
53                    <?php printf($tpl->getLang('user_rejected_issue'),
54                                 '<strong>' . $tpl->user_name($tpl->get('thread')->closed_by) . '</strong>',
55                                 $tpl->date_fuzzy_age($tpl->get('thread')->close_date)) ?>
56                </div>
57        <?php endif ?>
58
59
60<?php if (	!(strpos($tpl->param('action'), 'task') === 0) &&
61            $tpl->param('action') != 'commcause_edit' &&
62            !(in_array($tpl->get('thread')->state, array('closed', 'rejected')) &&
63                $tpl->get('thread')->acl_of('state') < BEZ_PERMISSION_CHANGE)): ?>
64
65    <?php include 'commcause_form.php' ?>
66
67    <br>
68    <?php if ($tpl->get('thread')->count_opened_nopreventive_tasks() > 0): ?>
69        <div class="info"><?php echo $tpl->getLang('issue_unclosed_tasks' . $tpl->get('lang_suffix')) ?></div>
70    <?php endif ?>
71    <?php if ($tpl->get('thread')->state == 'proposal'): ?>
72        <div class="info"><?php echo $tpl->getLang('issue_is_proposal' . $tpl->get('lang_suffix')) ?></div>
73    <?php endif ?>
74    <?php if ($tpl->get('causes_without_tasks')): ?>
75        <div class="info"><?php echo $tpl->getLang('cause_without_task') ?></div>
76    <?php endif ?>
77    <?php if ($tpl->get('thread')->state == 'opened' && $tpl->get('thread')->task_count == 0): ?>
78        <div class="info"><?php echo $tpl->getLang('issue_no_tasks' . $tpl->get('lang_suffix')) ?></div>
79    <?php endif ?>
80<?php endif ?>
81
82
83</div>
84<div class="bez_right_col">
85
86<div class="bez_box">
87<h2><?php echo $tpl->getLang('comment_last_activity') ?></h2>
88
89<?php echo $tpl->datetime($tpl->get('thread')->last_activity_date) ?>
90
91
92</div>
93
94<div class="bez_box bez_subscribe_box">
95<h2><?php echo $tpl->getLang('norifications') ?></h2>
96<?php if ($tpl->get('thread')->is_subscribent()): ?>
97	<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>
98	<p><?php echo $tpl->getLang('subscribed_info' . $tpl->get('lang_suffix')) ?></p>
99<?php else: ?>
100	<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>
101	<p><?php echo $tpl->getLang('not_subscribed_info' . $tpl->get('lang_suffix')) ?></p>
102<?php endif ?>
103
104</div>
105
106<div class="bez_box">
107<h2><?php echo $tpl->getLang('comment_participants') ?></h2>
108<ul id="issue_participants">
109<?php foreach ($tpl->get('thread')->get_participants() as $participant): ?>
110	<li>
111        <?php if ($tpl->get('thread')->user_is_coordinator() &&
112                  $tpl->get('thread')->can_add_participants() &&
113                  $participant['coordinator'] == '0' && $participant['task_assignee'] == '0'): ?>
114            <a href="<?php echo $tpl->url('thread', 'id', $tpl->get('thread')->id, 'action', 'participant_remove', 'user_id', $participant['user_id']) ?>"
115               class="participant_remove">
116                <span class="bez_awesome">
117				    &#xf00d;
118			    </span>
119            </a>
120        <?php endif ?>
121        <a href="<?php echo $tpl->mailto($tpl->user_email($participant['user_id']),
122		'#'.$tpl->get('thread')->id.' '.$tpl->get('thread')->title,
123		$tpl->url('thread', 'id', $tpl->get('thread')->id)) ?>"  title="<?php echo $participant['user_id'] ?>">
124		<span class="bez_name"><?php echo $tpl->user_name($participant['user_id']) ?></span>
125		<span class="bez_icons">
126		<?php if($participant['original_poster']): ?>
127			<span class="bez_awesome"
128				title="<?php echo $tpl->getLang('reporter') ?>">
129				&#xf058;
130			</span>
131		<?php endif ?>
132		<?php if($participant['coordinator']): ?>
133			<span class="bez_awesome"
134				title="<?php echo $tpl->getLang('coordinator') ?>">
135				&#xf0e3;
136			</span>
137		<?php endif ?>
138		<?php if($participant['task_assignee']): ?>
139			<span class="bez_awesome"
140				title="<?php echo $tpl->getLang('executor') ?>">
141				&#xf073;
142			</span>
143		<?php endif ?>
144		<?php if($participant['commentator']): ?>
145			<span class="bez_awesome"
146				title="<?php echo $tpl->getLang('commentator') ?>">
147				&#xf27a;
148			</span>
149		<?php endif ?>
150		<?php if($participant['subscribent']): ?>
151			<span class="bez_awesome"
152				title="<?php echo $tpl->getLang('subscribent') ?>">
153				&#xf0e0;
154			</span>
155		<?php endif ?>
156		</span>
157	</a>
158    </li>
159<?php endforeach ?>
160</ul>
161
162<?php if (	$tpl->get('thread')->user_is_coordinator() &&
163            $tpl->get('thread')->can_add_participants()): ?>
164    <h2><?php echo $tpl->getLang('issue_invite_header') ?></h2>
165    <form action="<?php echo $tpl->url('thread', 'id', $tpl->get('thread')->id, 'action', 'invite') ?>" method="post" id="bez_invite_users_form">
166    <div id="bez_invite_users" class="ui-widget">
167        <select name="client">
168            <option value="">--- <?php echo $tpl->getLang('select') ?> ---</option>
169            <?php foreach (array_diff_key($tpl->get('users'), $tpl->get('thread')->get_participants('subscribent')) as $user_id => $ignore): ?>
170                <option value="<?php echo $user_id ?>"><?php echo $tpl->user_name($user_id) ?></option>
171            <?php endforeach ?>
172        </select>
173    </div>
174    <button class="bez_subscribe_button"><?php echo $tpl->getLang('issue_invite_button') ?></button>
175    </form>
176<?php endif ?>
177
178
179</div>
180
181
182</div>
183
184