xref: /plugin/bez/tpl/task_box.php (revision 04f149d41a7c6906705e80eaa0bcf17c6364c10e)
1<?php if ($template['task']->issue == ''): ?>
2    <div class="bez_comments">
3    <div class="bez_left_col">
4<?php endif ?>
5
6<a name="z<?php echo $template['task']->id ?>"></a>
7<div id="z<?php echo $template['task']->id ?>"
8	class="bds_block task <?php $template['task']->state_string	?>
9    <?php if (  $template['action'] === 'task_edit_metadata' &&
10            $template['tid'] === $template['task']->id) echo 'bez_metadata_edit_warn' ?>">
11
12<?php if (  $template['action'] === 'task_edit_metadata' &&
13            $template['tid'] === $template['task']->id): ?>
14    <?php
15        if ($nparams['bez'] === 'issue') {
16            $id = $this->id('issue', 'id', $template['issue']->id, 'action', $template['action'], 'tid', $template['tid']);
17        } else {
18             $id = $this->id('task', 'tid', $template['tid'], 'action', $template['action']);
19        }
20    ?>
21    <h1 style="color: #f00; border-color: #f00;"><?php echo $bezlang['metadata_edit_header'] ?></h1>
22	<form class="bez_metaform" action="?id=<?php echo $id ?>" method="POST">
23<?php endif ?>
24
25<div class="bez_timebox">
26    <span>
27    <?php if (  $template['action'] === 'task_edit_metadata' &&
28            $template['tid'] === $template['task']->id &&
29            $template['task']->acl_of('date') >= BEZ_PERMISSION_CHANGE): ?>
30            <label><strong><?php echo $bezlang['open'] ?>:</strong> <input name="date" style="width:90px;" data-validation="required,date" value="<?php echo $value['date'] ?>" class="date start" /></label>
31    <?php else: ?>
32        <strong><?php echo $bezlang['open'] ?>:</strong> <?php echo $helper->time2date($template['task']->date) ?>
33    <?php endif ?>
34    </span>
35
36	<?php if ($template['task']->state !== '0'): ?>
37
38        <span>
39        <?php if (  $template['action'] === 'task_edit_metadata' &&
40                $template['tid'] === $template['task']->id &&
41                $template['task']->acl_of('close_date') >= BEZ_PERMISSION_CHANGE): ?>
42                <label><strong><?php echo $template['task']->state_string ?>:</strong> <input name="close_date" style="width:90px;" data-validation="required,date" value="<?php echo $value['close_date'] ?>" class="date end" /></label>
43        <?php else: ?>
44
45                <strong><?php echo $template['task']->state_string ?>:</strong>
46                <?php echo $helper->time2date($template['task']->close_date) ?>
47
48        <?php endif ?>
49        </span>
50
51		<span>
52			<strong><?php echo $bezlang['report_priority'] ?>: </strong>
53			<?php echo $helper->days((int)$template['task']->close_date - (int)$template['task']->date) ?>
54		</span>
55	<?php endif ?>
56</div>
57
58<h2>
59	<a href="?id=<?php echo $this->id('task', 'tid', $template['task']->id) ?>">
60		#z<?php echo $template['task']->id ?>
61	</a>
62	<?php echo lcfirst($template['task']->action_string) ?>
63	(<?php echo lcfirst($template['task']->state_string) ?>)
64</h2>
65
66<table class="bez_box_data_table">
67<tr>
68    <th><?php echo $bezlang['reporter'] ?>:</th>
69    <td>
70        <?php if (  $template['action'] === 'task_edit_metadata' &&
71            $template['tid'] === $template['task']->id &&
72            $template['task']->acl_of('reporter') >= BEZ_PERMISSION_CHANGE): ?>
73
74            <select name="reporter" id="reporter" data-validation="required">
75                <option value="">--- <?php echo $bezlang['select'] ?>---</option>
76                <?php foreach ($template['users'] as $nick => $name): ?>
77                    <option <?php if ($value['reporter'] === $nick) echo 'selected' ?>
78                     value="<?php echo $nick ?>"><?php echo $name ?></option>
79                <?php endforeach ?>
80            </select>
81        <?php else: ?>
82            <?php echo $this->model->users->get_user_full_name($template['task']->reporter) ?>
83        <?php endif ?>
84    </td>
85
86    <th><?php echo $bezlang['executor'] ?>:</th>
87    <td><?php echo $this->model->users->get_user_full_name($template['task']->executor) ?></td>
88</tr>
89
90<tr>
91    <th style="white-space: nowrap;"><?php echo $bezlang['plan_date'] ?>:</th>
92    <td>
93        <?php echo $template['task']->plan_date ?><?php if ($template['task']->all_day_event === '0'): ?>,
94            <?php echo $template['task']->start_time ?> - <?php echo $template['task']->finish_time ?>
95        <?php endif ?>
96    </td>
97
98    <th><?php echo $bezlang['task_type'] ?>:</th>
99    <td>
100    <?php if ($template['task']->tasktype_string == ''): ?>
101        ---
102    <?php else: ?>
103        <?php echo $template['task']->tasktype_string ?>
104    <?php endif ?>
105    </td>
106</tr>
107
108<tr>
109    <th><?php echo $bezlang['cost'] ?>:</th>
110    <td colspan="3">
111    <?php if ($template['task']->cost === ''): ?>
112        ---
113    <?php else: ?>
114        <?php echo $template['task']->cost ?>
115    <?php endif ?>
116    </td>
117</tr>
118
119</table>
120
121<?php echo $template['task']->task_cache ?>
122
123<?php if (	$template['action'] !== 'task_change_state' ||
124			$template['tid'] !== $template['task']->id): ?>
125	<?php if ($template['task']->state === '2'): ?>
126		<h3><?php echo $bezlang['reason'] ?></h3>
127		<?php echo $template['task']->reason_cache ?>
128	<?php elseif ($template['task']->state === '1' && $template['task']->reason != ''): ?>
129		<h3><?php echo $bezlang['evaluation'] ?></h3>
130		<?php echo $template['task']->reason_cache ?>
131	<?php endif ?>
132<?php endif ?>
133
134<?php if (	$template['action'] === 'task_change_state' &&
135			$template['tid'] === $template['task']->id): ?>
136	<a name="form"></a>
137	<?php if ($template['state'] === '2'): ?>
138		<h3><?php echo $bezlang['reason'] ?></h3>
139	<?php else: ?>
140		<h3><?php echo $bezlang['evaluation'] ?></h3>
141	<?php endif ?>
142    <?php
143        if ($nparams['bez'] === 'issue') {
144            $id = $this->id('issue', 'id', $template['issue']->id, 'action', $template['action'], 'tid', $template['tid'], 'state', $template['state']);
145        } else {
146             $id = $this->id('task', 'tid', $template['tid'], 'action', $template['action'], 'state', $template['state']);
147        }
148    ?>
149	<form class="bez_form" action="?id=<?php echo $id ?>" method="POST">
150		<input type="hidden" name="id" value="<?php echo $id ?>">
151
152        <?php if ($template['state'] === '1'): ?>
153            <label style="display:block;margin-bottom:5px;"><input type="checkbox" name="no_evaluation" id="no_evaluation" /> <?php echo $bezlang['no_evaluation'] ?></label>
154        <?php endif ?>
155
156		<div class="bez_reason_toolbar"></div>
157		<textarea name="reason" id="reason" data-validation="required"><?php echo $value['reason'] ?></textarea>
158		<br>
159		<?php if ($template['state'] === '2'): ?>
160			<input type="submit" value="<?php echo $bezlang['task_reject'] ?>">
161		<?php else: ?>
162			<input type="submit" value="<?php echo $bezlang['task_do'] ?>">
163		<?php endif ?>
164		<a href="?id=<?php
165            if ($nparams['bez'] === 'issue') {
166                echo $this->id('issue', 'id', $template['issue']->id).'#z'.$template['task']->id;
167            } else {
168                echo $this->id('task', 'tid', $template['task']->id);
169            }
170        ?>"
171			 class="bez_delete_button bez_link_button">
172				<?php echo $bezlang['cancel'] ?>
173		</a>
174	</form>
175<?php elseif (  $template['action'] === 'task_edit_metadata' &&
176                $template['tid'] === $template['task']->id): ?>
177        <input type="submit" value="<?php echo $bezlang['save'] ?>">&nbsp;&nbsp;
178		<a href="?id=<?php
179            if ($nparams['bez'] === 'issue') {
180                echo $this->id('issue', 'id', $template['issue']->id).'#z'.$template['task']->id;
181            } else {
182                echo $this->id('task', 'tid', $template['task']->id);
183            }
184        ?>"
185			 class="bez_delete_button bez_link_button">
186				<?php echo $bezlang['cancel'] ?>
187		</a>
188    </form>
189<?php else: ?>
190	<div class="bez_buttons">
191        <?php if (count($template['task']->changable_fields(
192                    $template['task']->get_meta_fields()
193                )) > 0): ?>
194            <a class="bds_inline_button_noborder" style="float:left;"
195				href="?id=<?php
196					if ($nparams['bez'] === 'issue') {
197						echo $helper->id('issue', 'id', $template['issue']->id, 'tid', $template['task']->id, 'action', 'task_edit_metadata');
198					} else {
199						echo $helper->id('task', 'tid', $template['task']->id, 'action', 'task_edit_metadata');
200					}
201				?>#z<?php echo $template['task']->id ?>">
202				<?php echo $bezlang['edit_metadata'] ?>
203			</a>
204        <?php endif ?>
205
206		<?php if (	$template['task']->state === '0' &&
207					$template['task']->acl_of('state') >= BEZ_PERMISSION_CHANGE): ?>
208			<a class="bds_inline_button"
209				href="?id=<?php
210					if ($nparams['bez'] === 'issue') {
211						echo $helper->id('issue', 'id', $template['issue']->id, 'tid', $template['task']->id, 'action', 'task_change_state', 'state', '1');
212					} else {
213						echo $helper->id('task', 'tid', $template['task']->id, 'action', 'task_change_state', 'state', '1');
214					}
215				?>#z<?php echo $template['task']->id ?>">
216<?php echo $bezlang['task_do'] ?>
217			</a>
218			<a class="bds_inline_button"
219				href="?id=<?php
220					if ($nparams['bez'] === 'issue') {
221						echo $helper->id('issue', 'id', $template['issue']->id, 'tid', $template['task']->id, 'action', 'task_change_state', 'state', '2');
222					} else {
223						echo $helper->id('task', 'tid', $template['task']->id, 'action', 'task_change_state', 'state', '2');
224					}
225				?>#z<?php echo $template['task']->id ?>">
226<?php echo $bezlang['task_reject'] ?>
227			</a>
228		<?php elseif (  $template['task']->state !== '0' &&
229                        $template['task']->acl_of('state') >= BEZ_PERMISSION_CHANGE): ?>
230			<a class="bds_inline_button"
231					href="?id=<?php
232						if ($nparams['bez'] === 'issue') {
233							echo $helper->id('issue', 'id', $template['issue']->id, 'tid', $template['task']->id, 'action', 'task_reopen');
234						} else {
235							echo $helper->id('task', 'tid', $template['task']->id, 'action', 'task_reopen');
236						}
237					?>">
238<?php echo $bezlang['task_reopen'] ?>
239				</a>
240		<?php endif ?>
241
242		<?php if (count($template['task']->changable_fields()) > 0): ?>
243				<a class="bds_inline_button"
244					href="?id=<?php
245						if ($nparams['bez'] === 'issue') {
246							echo $helper->id('issue', 'id', $template['issue']->id, 'tid', $template['task']->id, 'action', 'task_edit');
247						} else {
248							echo $helper->id('task', 'tid', $template['task']->id, 'action', 'task_edit');
249						}
250					?>#z_">
251<?php echo $bezlang['edit'] ?>
252				</a>
253		<?php endif ?>
254
255		<a class="bds_inline_button" href="
256		<?php echo $helper->mailto($this->model->users->get_user_email($template['task']->executor),
257		$bezlang['task'].': #z'.$template['task']->id.' '.lcfirst($template['task']->action_string),
258        DOKU_URL . 'doku.php?id='.$this->id('task', 'tid', $template['task']->id)) ?>">
259<?php echo $bezlang['send_mail'] ?>
260		</a>
261
262		<?php if ($template['task']->tasktype !== '' &&
263                  $this->model->acl->get_level() >= BEZ_AUTH_USER): ?>
264			<a class="bds_inline_button"
265					href="?id=<?php echo $this->id('task_form', 'duplicate', $template['task']->id, 'tasktype', $template['task']->tasktype) ?>">
266<?php echo $bezlang['duplicate'] ?>
267			</a>
268		<?php endif ?>
269	</div>
270<?php endif ?>
271
272</div>
273
274<?php if ($template['task']->issue == ''): ?>
275</div>
276
277<div class="bez_right_col" style="position:relative; top: -15px;">
278
279<div class="bez_box bez_subscribe_box">
280<h2><?php echo $bezlang['norifications'] ?></h2>
281<?php if ($template['task']->is_subscribent()): ?>
282	<a href="?id=<?php echo $this->id('task', 'tid', $template['task']->id, 'action', 'unsubscribe') ?>" class="bez_subscribe_button"><span class="bez_awesome">&#xf1f6;</span>&nbsp;&nbsp;<?php echo $bezlang['unsubscribe'] ?></a>
283	<p><?php echo $bezlang['subscribed_info'] ?></p>
284<?php else: ?>
285	<a href="?id=<?php echo $this->id('task', 'tid', $template['task']->id, 'action', 'subscribe') ?>" class="bez_subscribe_button"><span class="bez_awesome">&#xf0f3;</span>&nbsp;&nbsp;<?php echo $bezlang['subscribe'] ?></a>
286	<p><?php echo $bezlang['not_subscribed_info'] ?></p>
287<?php endif ?>
288
289</div>
290
291<div class="bez_box">
292<h2><?php echo $bezlang['comment_participants'] ?></h2>
293<ul id="issue_participants">
294<?php foreach ($template['task']->get_participants() as $nick => $participant): ?>
295	<li><a href="<?php echo $helper->mailto($this->model->users->get_user_email($nick),
296		$bezlang['task'].': #z'.$template['task']->id,
297		DOKU_URL . 'doku.php?id='.$this->id('task', 'tid', $template['task']->id)) ?>"  title="<?php echo $nick ?>">
298		<span class="bez_name"><?php echo $participant ?></span>
299		<span class="bez_icons">
300		<?php if($template['task']->reporter === $nick): ?>
301			<span class="bez_awesome"
302				title="<?php echo $bezlang['reporter'] ?>">
303				&#xf058;
304			</span>
305		<?php endif ?>
306		<?php if($template['task']->executor === $nick): ?>
307			<span class="bez_awesome"
308				title="<?php echo $bezlang['executor'] ?>">
309				&#xf073;
310			</span>
311		<?php endif ?>
312        <?php if($template['task']->is_subscribent($nick)): ?>
313            <span class="bez_awesome"
314                title="<?php echo $bezlang['subscribent'] ?>">
315                &#xf0e0;
316            </span>
317        <?php endif ?>
318		</span>
319	</a></li>
320<?php endforeach ?>
321</ul>
322
323<?php if ($template['task']->acl_of('subscribents') >= BEZ_PERMISSION_CHANGE): ?>
324    <h2><?php echo $bezlang['issue_invite_header'] ?></h2>
325    <form action="?id=<?php echo $this->id('task', 'tid', $template['task']->id, 'action', 'invite') ?>" method="post" id="bez_invite_users_form">
326    <div id="bez_invite_users" class="ui-widget">
327        <select name="client">
328            <option value="">--- <?php echo $bezlang['select'] ?> ---</option>
329            <?php foreach ($template['users_to_invite'] as $nick => $name): ?>
330                <option value="<?php echo $nick ?>"><?php echo $name ?></option>
331            <?php endforeach ?>
332        </select>
333    </div>
334    <button class="bez_subscribe_button"><?php echo $bezlang['issue_invite_button'] ?></button>
335    </form>
336<?php endif ?>
337
338
339</div>
340
341
342</div>
343
344</div>
345
346<?php endif ?>
347