xref: /plugin/bez/tpl/task_box.php (revision a4d58c1b80c7e5302934910cec22fbac48223bb6)
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	?>
4    <?php if (  $template['action'] === 'task_edit_metadata' &&
5            $template['tid'] === $template['task']->id) echo 'bez_metadata_edit_warn' ?>">
6
7<?php if (  $template['action'] === 'task_edit_metadata' &&
8            $template['tid'] === $template['task']->id): ?>
9    <?php
10        if ($nparams['bez'] === 'issue') {
11            $id = $this->id('issue', 'id', $template['issue']->id, 'action', $template['action'], 'tid', $template['tid']);
12        } else {
13             $id = $this->id('task', 'tid', $template['tid'], 'action', $template['action']);
14        }
15    ?>
16    <h1 style="color: #f00; border-color: #f00;"><?php echo $bezlang['metadata_edit_header'] ?></h1>
17	<form class="bez_metaform" action="?id=<?php echo $id ?>" method="POST">
18<?php endif ?>
19
20<div class="bez_timebox">
21    <span>
22    <?php if (  $template['action'] === 'task_edit_metadata' &&
23            $template['tid'] === $template['task']->id &&
24            $template['task']->acl_of('date') >= BEZ_PERMISSION_CHANGE): ?>
25            <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>
26    <?php else: ?>
27        <strong><?php echo $bezlang['open'] ?>:</strong> <?php echo $helper->time2date($template['task']->date) ?>
28    <?php endif ?>
29    </span>
30
31	<?php if ($template['task']->state !== '0'): ?>
32
33        <span>
34        <?php if (  $template['action'] === 'task_edit_metadata' &&
35                $template['tid'] === $template['task']->id &&
36                $template['task']->acl_of('close_date') >= BEZ_PERMISSION_CHANGE): ?>
37                <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>
38        <?php else: ?>
39
40                <strong><?php echo $template['task']->state_string ?>:</strong>
41                <?php echo $helper->time2date($template['task']->close_date) ?>
42
43        <?php endif ?>
44        </span>
45
46		<span>
47			<strong><?php echo $bezlang['report_priority'] ?>: </strong>
48			<?php echo $helper->days((int)$template['task']->close_date - (int)$template['task']->date) ?>
49		</span>
50	<?php endif ?>
51</div>
52
53<h2>
54	<a href="?id=<?php echo $this->id('task', 'tid', $template['task']->id) ?>">
55		#z<?php echo $template['task']->id ?>
56	</a>
57	<?php echo lcfirst($template['task']->action_string) ?>
58	(<?php echo lcfirst($template['task']->state_string) ?>)
59</h2>
60
61<table class="bez_box_data_table">
62<tr>
63    <th><?php echo $bezlang['reporter'] ?>:</th>
64    <td>
65        <?php if (  $template['action'] === 'task_edit_metadata' &&
66            $template['tid'] === $template['task']->id &&
67            $template['task']->acl_of('reporter') >= BEZ_PERMISSION_CHANGE): ?>
68
69            <select name="reporter" id="reporter" data-validation="required">
70                <option value="">--- <?php echo $bezlang['select'] ?>---</option>
71                <?php foreach ($template['users'] as $nick => $name): ?>
72                    <option <?php if ($value['reporter'] === $nick) echo 'selected' ?>
73                     value="<?php echo $nick ?>"><?php echo $name ?></option>
74                <?php endforeach ?>
75            </select>
76        <?php else: ?>
77            <?php echo $this->model->users->get_user_full_name($template['task']->reporter) ?>
78        <?php endif ?>
79    </td>
80
81    <th><?php echo $bezlang['executor'] ?>:</th>
82    <td><?php echo $this->model->users->get_user_full_name($template['task']->executor) ?></td>
83</tr>
84
85<tr>
86    <th style="white-space: nowrap;"><?php echo $bezlang['plan_date'] ?>:</th>
87    <td>
88        <?php echo $template['task']->plan_date ?><?php if ($template['task']->all_day_event === '0'): ?>,
89            <?php echo $template['task']->start_time ?> - <?php echo $template['task']->finish_time ?>
90        <?php endif ?>
91    </td>
92
93    <th><?php echo $bezlang['task_type'] ?>:</th>
94    <td>
95    <?php if ($template['task']->tasktype_string == ''): ?>
96        ---
97    <?php else: ?>
98        <?php echo $template['task']->tasktype_string ?>
99    <?php endif ?>
100    </td>
101</tr>
102
103<tr>
104    <th><?php echo $bezlang['cost'] ?>:</th>
105    <td colspan="3">
106    <?php if ($template['task']->cost === ''): ?>
107        ---
108    <?php else: ?>
109        <?php echo $template['task']->cost ?>
110    <?php endif ?>
111    </td>
112</tr>
113
114</table>
115
116<?php echo $template['task']->task_cache ?>
117
118<?php if (	$template['action'] !== 'task_change_state' ||
119			$template['tid'] !== $template['task']->id): ?>
120	<?php if ($template['task']->state === '2'): ?>
121		<h3><?php echo $bezlang['reason'] ?></h3>
122		<?php echo $template['task']->reason_cache ?>
123	<?php elseif ($template['task']->state === '1' && $template['task']->reason != ''): ?>
124		<h3><?php echo $bezlang['evaluation'] ?></h3>
125		<?php echo $template['task']->reason_cache ?>
126	<?php endif ?>
127<?php endif ?>
128
129<?php if (	$template['action'] === 'task_change_state' &&
130			$template['tid'] === $template['task']->id): ?>
131	<a name="form"></a>
132	<?php if ($template['state'] === '2'): ?>
133		<h3><?php echo $bezlang['reason'] ?></h3>
134	<?php else: ?>
135		<h3><?php echo $bezlang['evaluation'] ?></h3>
136	<?php endif ?>
137    <?php
138        if ($nparams['bez'] === 'issue') {
139            $id = $this->id('issue', 'id', $template['issue']->id, 'action', $template['action'], 'tid', $template['tid'], 'state', $template['state']);
140        } else {
141             $id = $this->id('task', 'tid', $template['tid'], 'action', $template['action'], 'state', $template['state']);
142        }
143    ?>
144	<form class="bez_form" action="?id=<?php echo $id ?>" method="POST">
145		<input type="hidden" name="id" value="<?php echo $id ?>">
146
147        <?php if ($template['state'] === '1'): ?>
148            <label style="display:block;margin-bottom:5px;"><input type="checkbox" name="no_evaluation" id="no_evaluation" /> <?php echo $bezlang['no_evaluation'] ?></label>
149        <?php endif ?>
150
151		<div class="bez_reason_toolbar"></div>
152		<textarea name="reason" id="reason" data-validation="required"><?php echo $value['reason'] ?></textarea>
153		<br>
154		<?php if ($template['state'] === '2'): ?>
155			<input type="submit" value="<?php echo $bezlang['task_reject'] ?>">
156		<?php else: ?>
157			<input type="submit" value="<?php echo $bezlang['task_do'] ?>">
158		<?php endif ?>
159		<a href="?id=<?php
160            if ($nparams['bez'] === 'issue') {
161                echo $this->id('issue', 'id', $template['issue']->id).'#z'.$template['task']->id;
162            } else {
163                echo $this->id('task', 'tid', $template['task']->id);
164            }
165        ?>"
166			 class="bez_delete_button bez_link_button">
167				<?php echo $bezlang['cancel'] ?>
168		</a>
169	</form>
170<?php elseif (  $template['action'] === 'task_edit_metadata' &&
171                $template['tid'] === $template['task']->id): ?>
172        <input type="submit" value="<?php echo $bezlang['save'] ?>">&nbsp;&nbsp;
173		<a href="?id=<?php
174            if ($nparams['bez'] === 'issue') {
175                echo $this->id('issue', 'id', $template['issue']->id).'#z'.$template['task']->id;
176            } else {
177                echo $this->id('task', 'tid', $template['task']->id);
178            }
179        ?>"
180			 class="bez_delete_button bez_link_button">
181				<?php echo $bezlang['cancel'] ?>
182		</a>
183    </form>
184<?php else: ?>
185	<div class="bez_buttons">
186        <?php if (count($template['task']->changable_fields(
187                    $template['task']->get_meta_fields()
188                )) > 0): ?>
189            <a class="bds_inline_button_noborder" style="float:left;"
190				href="?id=<?php
191					if ($nparams['bez'] === 'issue') {
192						echo $helper->id('issue', 'id', $template['issue']->id, 'tid', $template['task']->id, 'action', 'task_edit_metadata');
193					} else {
194						echo $helper->id('task', 'tid', $template['task']->id, 'action', 'task_edit_metadata');
195					}
196				?>#z<?php echo $template['task']->id ?>">
197				<?php echo $bezlang['edit_metadata'] ?>
198			</a>
199        <?php endif ?>
200
201		<?php if (	$template['task']->state === '0' &&
202					$template['task']->acl_of('state') >= BEZ_PERMISSION_CHANGE): ?>
203			<a class="bds_inline_button"
204				href="?id=<?php
205					if ($nparams['bez'] === 'issue') {
206						echo $helper->id('issue', 'id', $template['issue']->id, 'tid', $template['task']->id, 'action', 'task_change_state', 'state', '1');
207					} else {
208						echo $helper->id('task', 'tid', $template['task']->id, 'action', 'task_change_state', 'state', '1');
209					}
210				?>#z<?php echo $template['task']->id ?>">
211<?php echo $bezlang['task_do'] ?>
212			</a>
213			<a class="bds_inline_button"
214				href="?id=<?php
215					if ($nparams['bez'] === 'issue') {
216						echo $helper->id('issue', 'id', $template['issue']->id, 'tid', $template['task']->id, 'action', 'task_change_state', 'state', '2');
217					} else {
218						echo $helper->id('task', 'tid', $template['task']->id, 'action', 'task_change_state', 'state', '2');
219					}
220				?>#z<?php echo $template['task']->id ?>">
221<?php echo $bezlang['task_reject'] ?>
222			</a>
223		<?php elseif (  $template['task']->state !== '0' &&
224                        $template['task']->acl_of('state') >= BEZ_PERMISSION_CHANGE): ?>
225			<a class="bds_inline_button"
226					href="?id=<?php
227						if ($nparams['bez'] === 'issue') {
228							echo $helper->id('issue', 'id', $template['issue']->id, 'tid', $template['task']->id, 'action', 'task_reopen');
229						} else {
230							echo $helper->id('task', 'tid', $template['task']->id, 'action', 'task_reopen');
231						}
232					?>">
233<?php echo $bezlang['task_reopen'] ?>
234				</a>
235		<?php endif ?>
236
237		<?php if (count($template['task']->changable_fields()) > 0): ?>
238				<a class="bds_inline_button"
239					href="?id=<?php
240						if ($nparams['bez'] === 'issue') {
241							echo $helper->id('issue', 'id', $template['issue']->id, 'tid', $template['task']->id, 'action', 'task_edit');
242						} else {
243							echo $helper->id('task', 'tid', $template['task']->id, 'action', 'task_edit');
244						}
245					?>#z_">
246<?php echo $bezlang['edit'] ?>
247				</a>
248		<?php endif ?>
249
250		<a class="bds_inline_button" href="
251		<?php echo $helper->mailto($this->model->users->get_user_email($template['task']->executor),
252		$bezlang['task'].': #z'.$template['task']->id.' '.lcfirst($template['task']->action_string),
253        DOKU_URL . 'doku.php?id='.$this->id('task', 'tid', $template['task']->id)) ?>">
254<?php echo $bezlang['send_mail'] ?>
255		</a>
256
257		<?php if ($template['task']->tasktype !== '' &&
258                  $this->model->acl->get_level() >= BEZ_AUTH_USER): ?>
259			<a class="bds_inline_button"
260					href="?id=<?php echo $this->id('task_form', 'duplicate', $template['task']->id, 'tasktype', $template['task']->tasktype) ?>">
261<?php echo $bezlang['duplicate'] ?>
262			</a>
263		<?php endif ?>
264	</div>
265<?php endif ?>
266
267</div>
268
269