xref: /plugin/bez/tpl/task.php (revision 919e4830ecc9857410249d11b1533c0e8be5756a)
1<a name="z<?php echo $task['id'] ?>"></a>
2<div id="z<?php echo $task['id'] ?>" class="task
3	<?php
4		switch($task['state']) {
5			case $bezlang['task_opened']:
6				echo 'opened';
7				break;
8			case $bezlang['task_done']:
9				echo 'closed';
10				break;
11			case $bezlang['task_rejected']:
12				echo 'rejected';
13				break;
14		}
15	?>">
16
17<div class="bez_timebox">
18	<span><strong><?php echo $bezlang['open'] ?>:</strong> <?php echo $helper->time2date($task['date']) ?></span>
19	<?php if ($task['state'] != $bezlang['task_opened']): ?>
20		<span>
21			<strong><?php echo $task['state']?>:</strong>
22			<?php echo $helper->time2date($task['close_date']) ?>
23		</span>
24			<span>
25		<strong><?php echo $bezlang['report_priority'] ?>: </strong>
26		<?php echo $helper->days((int)$task['close_date'] - (int)$task['date']) ?>
27	</span>
28	<?php endif ?>
29</div>
30
31<h2>
32	<a href="?id=<?php echo $this->id('issue_task', 'id', $template['issue']['id'], 'tid', $task['id']) ?>">
33		#z<?php echo $task['id'] ?>
34	</a>
35	<?php echo lcfirst($task['action']) ?>
36	(<?php echo lcfirst($task['state']) ?>)
37</h2>
38
39
40<?php
41//count colspan
42$top_colspan = 0;
43$bottom_colspan = 0;
44
45$top_columns = 1;
46if ($task['tasktype'] != '')
47	$top_columns++;
48
49if ($task['cost'] != 0)
50	$top_columns++;
51
52
53
54if (isset($nparams['plan']))
55	$bottom_columns = 4;
56else if ($task['plan_date'] != '') {
57	$bottom_columns = 1;
58	if ($task['all_day_event'] == '0')
59		$bottom_columns = 3;
60} else
61	//w celu wyzerowania górnego colspana
62	$top_columns = 3;
63
64if ($top_columns > $bottom_columns)
65	$bottom_colspan = $top_columns - $bottom_columns + 1;
66elseif ($top_columns < $bottom_columns)
67	$top_colspan = $bottom_columns - $top_columns + 1;
68
69$colspan1 = 0;
70$colspan2 = 0;
71$colspan3 = 0;
72
73if ($task['cost'] != 0)
74	$colspan3 = $top_colspan;
75else if ($task['tasktype'] != '')
76	$colspan2 = $top_colspan;
77else
78	$colspan1 = $top_colspan;
79
80$colspan4 = 0;
81$colspan5 = 0;
82if ($task['all_day_event'] == '0')
83	$colspan5 = $bottom_colspan;
84else
85	$colspan4 = $bottom_colspan;
86
87?>
88<table>
89<tr>
90		<td colspan="<?php echo $colspan1 ?>">
91			<strong><?php echo $bezlang['executor'] ?>:</strong>
92			<?php echo $task['executor'] ?>
93		</td>
94
95		<?php if ($task['tasktype'] != ''): ?>
96			<td colspan="<?php echo $colspan2 ?>">
97				<strong><?php echo $bezlang['task_type'] ?>:</strong>
98				<?php echo $task['tasktype'] ?>
99			</td>
100		<?php endif ?>
101
102		<?php if ($task['cost'] != 0): ?>
103			<td colspan="<?php echo $colspan3 ?>">
104				<strong><?php echo $bezlang['cost'] ?>:</strong>
105				<?php echo $task['cost'] ?>
106			</td>
107		<?php endif ?>
108</tr>
109
110<?php if ($task['plan_date'] != '' && !isset($nparams['plan'])): ?>
111<tr>
112	<td colspan="<?php echo $colspan4 ?>"><strong><?php echo $bezlang['plan_date'] ?>:</strong>
113	<?php echo $task['plan_date'] ?></td>
114	<?php if ($task['all_day_event'] == '0'): ?>
115		<td><strong><?php echo $bezlang['start_time'] ?>:</strong>
116		<?php echo $task['start_time'] ?></td>
117		<td colspan="<?php echo $colspan5 ?>"><strong><?php echo $bezlang['finish_time'] ?>:</strong>
118		<?php echo $task['finish_time'] ?></td>
119	<?php endif ?>
120</tr>
121<?php endif ?>
122
123<?php if (isset($nparams['plan'])): ?>
124<tr>
125<form action="?id=<?php echo $helper->nparams_to_id($this->action, $nparams) ?>:action:save_plan" method="post">
126	<td><strong><?php echo $bezlang['plan_date'] ?>:</strong>
127	<input name="plan_date" style="width:70px;" value="<?php echo $value['plan_date'] ?>"/><label><input type="checkbox" name="all_day_event" value="1"
128	<?php if (isset($value['all_day_event']) && $value['all_day_event'] != 0): ?>
129		checked
130	<?php endif ?> /> <?php echo $bezlang['all_day_event'] ?></label></td>
131	<td><strong><?php echo $bezlang['start_time'] ?>:</strong>
132	<input name="start_time" style="width:50px;" class="bez_timepicker" value="<?php echo $value['start_time'] ?>"/>
133	</td>
134	<td><strong><?php echo $bezlang['finish_time'] ?>:</strong>
135	<input name="finish_time" style="width:50px;" class="bez_timepicker" value="<?php echo $value['finish_time'] ?>" />
136	<td><input type="submit" value="<?php echo $bezlang['save'] ?>" />
137	<a href="?id=<?php echo $helper->nparams_to_id($this->action, array_diff_key($nparams, array('plan'=>''))); ?>"
138			 class="bez_delete_button bez_link_button">
139				<?php echo $bezlang['cancel'] ?>
140		</a></td>
141</form>
142</tr>
143
144<?php endif ?>
145</table>
146
147<?php echo $task['task'] ?>
148
149<?php if (isset($nparams['state'])): ?>
150	<a name="form"></a>
151	<?php if ($nparams['state'] == 2): ?>
152		<h3><?php echo $bezlang['reason'] ?></h3>
153	<?php else: ?>
154		<h3><?php echo $bezlang['evaluation'] ?></h3>
155	<?php endif ?>
156	<form class="bez_form bez_task_form" action="?id=<?php echo $helper->nparams_to_id($this->action, $nparams) ?>:action:update" method="POST">
157		<textarea name="reason" id="reason"><?php echo $value['reason'] ?></textarea>
158		<br>
159		<?php if ($nparams['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 echo $helper->nparams_to_id($this->action, array_diff_key($nparams, array('state'=>''))); ?>"
165			 class="bez_delete_button bez_link_button">
166				<?php echo $bezlang['cancel'] ?>
167		</a>
168	</form>
169<?php else: ?>
170	<?php if ($task['raw_state'] == 2): ?>
171		<h3><?php echo $bezlang['reason'] ?></h3>
172	<?php elseif ($task['raw_state'] == 1): ?>
173		<h3><?php echo $bezlang['evaluation'] ?></h3>
174	<?php endif ?>
175	<?php echo $task['reason'] ?>
176<?php endif ?>
177
178
179
180<?php if (!isset($nparams['state']) && !isset($nparams['plan'])): ?>
181<div class="bez_buttons">
182<?php if ($task['plan_date'] != ''): ?>
183		<a class="bds_inline_button"
184		href="?id=<?php echo $helper->id('icalendar', 'tid', $task['id']) ?>">
185		��  <?php echo $bezlang['download_in_icalendar'] ?>
186	</a>
187<?php endif ?>
188	<?php if ($task['raw_state'] == 0): ?>
189		<?php if($task['executor_nick'] == $INFO['client'] || $helper->user_coordinator($template['issue']['id'])): ?>
190
191			<a class="bds_inline_button"
192				href="?id=<?php
193				 	if(!isset($template['issue']))
194						echo $helper->id('show_task', 'tid', $task['id'], 'plan', 'plan');
195					elseif (isset($nparams['cid']))
196						echo $helper->id('issue_cause_task', 'id', $template['issue']['id'], 'cid', $cause['id'], 'tid', $task['id'], 'plan', 'plan');
197					else
198						echo $helper->id('issue_task', 'id', $template['issue']['id'], 'tid', $task['id'], 'plan', 'plan');
199				?>#form">
200<?php echo $bezlang['task_plan'] ?>
201			</a>
202
203			<a class="bds_inline_button"
204				href="?id=<?php
205					if(!isset($template['issue']))
206						echo $helper->id('show_task', 'tid', $task['id'], 'state', '1');
207					elseif (isset($nparams['cid']))
208						echo $helper->id('issue_cause_task', 'id', $template['issue']['id'], 'cid', $cause['id'], 'tid', $task['id'], 'state', '1');
209					else
210						echo $helper->id('issue_task', 'id', $template['issue']['id'], 'tid', $task['id'], 'state', '1');
211				?>#form">
212<?php echo $bezlang['task_do'] ?>
213			</a>
214			<a class="bds_inline_button"
215				href="?id=<?php
216					if(!isset($template['issue']))
217						echo $helper->id('show_task', 'tid', $task['id'], 'state', '2');
218					elseif (isset($nparams['cid']))
219						echo $helper->id('issue_cause_task', 'id', $template['issue']['id'], 'cid', $cause['id'], 'tid', $task['id'], 'state', '2');
220					else
221						echo $helper->id('issue_task', 'id', $template['issue']['id'], 'tid', $task['id'], 'state', '2');
222				?>#form">
223<?php echo $bezlang['task_reject'] ?>
224			</a>
225		<?php endif ?>
226	<?php endif ?>
227	<?php if($helper->user_coordinator($template['issue']['id'])): ?>
228		<?php if(isset($template['issue'])): ?>
229			<a class="bds_inline_button"
230				href="?id=<?php echo $this->id('task_form', 'id', $template['issue']['id'], 'cid', $cause[id], 'tid', $task['id']) ?>">
231<?php echo $bezlang['edit'] ?>
232			</a>
233		<?php else: ?>
234			<a class="bds_inline_button"
235				href="?id=<?php echo $this->id('task_form_plan', 'tid', $task['id']) ?>">
236<?php echo $bezlang['edit'] ?>
237			</a>
238		<?php endif ?>
239	<?php endif ?>
240
241	<a class="bds_inline_button" href="
242	<?php echo $helper->mailto($task['executor_email'],
243	$bezlang['task'].': #'.$task['issue'].' '.$template['issue']['title'].' | #z'.$task['id'].' '.$task['action'],
244	isset($template['issue']) ?
245		DOKU_URL . 'doku.php?id='.$this->id('issue_task', 'id', $template['issue']['id'], 'tid', $task['id'])
246		: DOKU_URL . 'doku.php?id='.$this->id('show_task', 'tid', $task['id'])) ?>">
247<?php echo $bezlang['send_mail'] ?>
248	</a>
249
250		<a class="bds_inline_button"
251				href="?id=<?php echo $this->id('task_report', 'duplicate', $task['id']) ?>">
252<?php echo $bezlang['duplicate'] ?>
253			</a>
254
255</div>
256<?php endif ?>
257
258</div>
259
260