xref: /plugin/bez/tpl/task_box.php (revision aa89e6f87daa9b559eea182b8567d772dfa4ce7f)
1<a name="z<?php echo $template['task']->id ?>"></a>
2<div id="z<?php echo $template['task']->id ?>"
3	class="bds_block task <?php $template['task']->state_string($template['task']->state)	?>">
4
5<div class="bez_timebox">
6	<span><strong><?php echo $bezlang['open'] ?>:</strong> <?php echo $helper->time2date($template['task']->date) ?></span>
7
8	<?php if ($template['task']->state !== '0'): ?>
9		<span>
10			<strong><?php echo $bezlang[$template['task']->state_string()] ?>:</strong>
11			<?php echo $helper->time2date($template['task']->close_date) ?>
12		</span>
13		<span>
14			<strong><?php echo $bezlang['report_priority'] ?>: </strong>
15			<?php echo $helper->days((int)$template['task']->close_date - (int)$template['task']->date) ?>
16		</span>
17	<?php endif ?>
18</div>
19
20<h2>
21	<a href="?id=<?php echo $this->id('task', 'tid', $template['task']->id) ?>">
22		#z<?php echo $template['task']->id ?>
23	</a>
24	<?php echo lcfirst($bezlang[$template['task']->action_string($template['task']->action)]) ?>
25	(<?php echo lcfirst($bezlang[$template['task']->state_string($template['task']->state)]) ?>)
26</h2>
27
28<?php
29	$cost_colspan = 1;
30	$task_type_colspan = 1;
31	$plan_date_colspan = 1;
32	$finish_time_colspan = 1;
33
34	if ($template['task']->cost == '' && $template['task']->all_day_event == '1') {
35		$plan_date_colspan = 3;
36	} elseif ($template['task']->cost == '' && $template['task']->all_day_event == '0') {
37		/*leave default*/
38	} elseif ($template['task']->cost != '' && $template['task']->all_day_event == '1') {
39		$plan_date_colspan = 4;
40	} elseif ($template['task']->cost != '' && $template['task']->all_day_event == '0') {
41		$finish_time_colspan = 2;
42	}
43
44	$td_with_colspan = function($colspan) {
45		if ($colspan === 1) {
46			echo '<td>';
47		} else {
48			echo '<td colspan="'.$colspan.'">';
49		}
50	}
51?>
52
53<table>
54<tr>
55		<td>
56			<strong><?php echo $bezlang['executor'] ?>:</strong>
57			<?php echo $this->model->users->get_user_full_name($template['task']->executor) ?>
58		</td>
59
60		<td>
61			<strong><?php echo $bezlang['reporter'] ?>:</strong>
62			<?php echo $this->model->users->get_user_full_name($template['task']->reporter) ?>
63		</td>
64
65		<?php if ($template['task']->tasktype_string != ''): ?>
66			<?php echo $td_with_colspan($task_type_colspan) ?>
67				<strong><?php echo $bezlang['task_type'] ?>:</strong>
68				<?php echo $template['task']->tasktype_string ?>
69			</td>
70		<?php endif ?>
71
72		<?php if ($template['task']->cost != ''): ?>
73			<?php echo $td_with_colspan($cost_colspan) ?>
74				<strong><?php echo $bezlang['cost'] ?>:</strong>
75				<?php echo $template['task']->cost ?>
76			</td>
77		<?php endif ?>
78</tr>
79
80<tr>
81	<?php echo $td_with_colspan($plan_date_colspan) ?>
82		<strong><?php echo $bezlang['plan_date'] ?>:</strong>
83		<?php echo $template['task']->plan_date ?>
84	</td>
85
86	<?php if ($template['task']->all_day_event == '0'): ?>
87		<td><strong><?php echo $bezlang['start_time'] ?>:</strong>
88		<?php echo $template['task']->start_time ?></td>
89		<?php echo $td_with_colspan($finish_time_colspan) ?>
90		<strong><?php echo $bezlang['finish_time'] ?>:</strong>
91		<?php echo $template['task']->finish_time ?></td>
92	<?php endif ?>
93
94</tr>
95
96</table>
97
98<?php echo $template['task']->task_cache ?>
99
100<?php if (	$template['action'] === 'task_change_state' &&
101			$template['tid'] === $template['task']->id): ?>
102	<a name="form"></a>
103	<?php if ($template['state'] === '2'): ?>
104		<h3><?php echo $bezlang['reason'] ?></h3>
105	<?php else: ?>
106		<h3><?php echo $bezlang['evaluation'] ?></h3>
107	<?php endif ?>
108	<?php $id = $this->id('issue', 'id', $template['issue']->id, 'action', $template['action'], 'tid', $template['tid'], 'state', $template['state']) ?>
109	<form class="bez_form" action="?id=<?php echo $id ?>" method="POST">
110		<input type="hidden" name="id" value="<?php echo $id ?>">
111		<div class="bez_reason_toolbar"></div>
112		<textarea name="reason" id="reason" data-validation="required"><?php echo $value['reason'] ?></textarea>
113		<br>
114		<?php if ($template['state'] === '2'): ?>
115			<input type="submit" value="<?php echo $bezlang['task_reject'] ?>">
116		<?php else: ?>
117			<input type="submit" value="<?php echo $bezlang['task_do'] ?>">
118		<?php endif ?>
119		<a href="?id=<?php echo $this->id('issue', 'id', $template['issue']->id) ?>#z<?php echo $template['task']->id ?>"
120			 class="bez_delete_button bez_link_button">
121				<?php echo $bezlang['cancel'] ?>
122		</a>
123	</form>
124<?php else: ?>
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'): ?>
129		<h3><?php echo $bezlang['evaluation'] ?></h3>
130		<?php echo $template['task']->reason_cache ?>
131	<?php endif ?>
132	<div class="bez_buttons">
133		<?php if (	$template['task']->state === '0' &&
134					$template['task']->get_level() >= 10): ?>
135			<a class="bds_inline_button"
136				href="?id=<?php
137					if (isset($template['issue'])) {
138						echo $helper->id('issue', 'id', $template['issue']->id, 'tid', $template['task']->id, 'action', 'task_change_state', 'state', '1');
139					} else {
140						echo $helper->id('task', 'tid', $template['task']->id, 'state', '1');
141					}
142				?>#z<?php echo $template['task']->id ?>">
143<?php echo $bezlang['task_do'] ?>
144			</a>
145			<a class="bds_inline_button"
146				href="?id=<?php
147					if (isset($template['issue'])) {
148						echo $helper->id('issue', 'id', $template['issue']->id, 'tid', $template['task']->id, 'action', 'task_change_state', 'state', '2');
149					} else {
150						echo $helper->id('task', 'tid', $template['task']->id, 'state', '2');
151					}
152				?>#z<?php echo $template['task']->id ?>">
153<?php echo $bezlang['task_reject'] ?>
154			</a>
155		<?php elseif ($template['task']->get_level() >= 10): ?>
156			<a class="bds_inline_button"
157					href="?id=<?php
158						if (isset($template['issue'])) {
159							echo $helper->id('issue', 'id', $template['issue']->id, 'tid', $template['task']->id, 'action', 'task_reopen');
160						} else {
161							echo $helper->id('task', 'tid', $template['task']->id, 'action', 'reopen');
162						}
163					?>">
164<?php echo $bezlang['task_reopen'] ?>
165				</a>
166		<?php endif ?>
167
168		<?php if($template['task']->get_level() >= 15 || $template['task']->reporter === $template['task']->get_user()): ?>
169				<a class="bds_inline_button"
170					href="?id=<?php
171						if (isset($template['issue'])) {
172							echo $helper->id('issue', 'id', $template['issue']->id, 'tid', $template['task']->id, 'action', 'task_edit');
173						} else {
174							echo $helper->id('task_form', 'tid', $template['task']->id, 'action', 'edit');
175						}
176					?>#z_">
177<?php echo $bezlang['edit'] ?>
178				</a>
179		<?php endif ?>
180
181		<a class="bds_inline_button" href="
182		<?php echo $helper->mailto($this->model->users->get_user_email($template['task']->executor),
183		$bezlang['task'].': #z'.$template['task']->id.' '.lcfirst($bezlang[$template['task']->action_string($template['task']->action)]),
184		$template['task']->issue != '' ?
185			DOKU_URL . 'doku.php?id='.$this->id('issue_task', 'id', $template['task']->issue, 'tid', $template['task']->id)
186			: DOKU_URL . 'doku.php?id='.$this->id('show_task', 'tid', $template['task']->id)) ?>">
187<?php echo $bezlang['send_mail'] ?>
188		</a>
189
190		<?php if ($template['task']->tasktype != NULL && $template['task']->get_level() >= 5): ?>
191			<a class="bds_inline_button"
192					href="?id=<?php echo $this->id('task_form', 'duplicate', $template['task']->id, 'tasktype', $template['task']->tasktype) ?>">
193<?php echo $bezlang['duplicate'] ?>
194			</a>
195		<?php endif ?>
196	</div>
197<?php endif ?>
198
199</div>
200
201