xref: /plugin/bez/tpl/task_box.php (revision c45b82bd7652392a33a65dbf693208bcdf28ad29)
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_task_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<?php
62    $top_row = array(
63        '<strong>'.$bezlang['executor'].': </strong>' .
64        $this->model->users->get_user_full_name($template['task']->executor)
65    );
66    if (  $template['action'] === 'task_edit_metadata' &&
67            $template['tid'] === $template['task']->id &&
68            $template['task']->acl_of('reporter') >= BEZ_PERMISSION_CHANGE) {
69
70        $row  = '<strong>'.$bezlang['reporter'].': </strong>';
71        $row .= '<select name="reporter" id="reporter" data-validation="required">';
72		$row .=	'	<option value="">--- '.$bezlang['select'].' ---</option>';
73		foreach ($template['users'] as $nick => $name) {
74            $row .=	'<option';
75            if ($value['reporter'] === $nick) {
76                $row .= ' selected ';
77            }
78            $row .= ' value="'.$nick.'">'.$name.'</option>';
79        }
80		$row .= '</select>';
81
82        $top_row[] = $row;
83    } else {
84      $top_row[] = '<strong>'.$bezlang['reporter'].': </strong>' .
85        $this->model->users->get_user_full_name($template['task']->reporter);
86    }
87
88
89
90    if ($template['task']->tasktype_string != '') {
91        $top_row[] =
92            '<strong>'.$bezlang['task_type'].': </strong>' .
93            $template['task']->tasktype_string;
94    }
95
96	if ($template['task']->cost != '') {
97        $top_row[] =
98            '<strong>'.$bezlang['cost'].': </strong>' .
99            $template['task']->cost;
100    }
101
102    //BOTTOM ROW
103    $bottom_row = array(
104        '<strong>'.$bezlang['plan_date'].': </strong>' .
105        $template['task']->plan_date
106    );
107
108	if ($template['task']->all_day_event == '0') {
109        $bottom_row[] =
110            '<strong>'.$bezlang['start_time'].': </strong>' .
111            $template['task']->start_time;
112        $bottom_row[] =
113            '<strong>'.$bezlang['finish_time'].': </strong>' .
114            $template['task']->finish_time;
115	}
116    echo bez_html_irrtable(array(), $top_row, $bottom_row);
117?>
118
119<?php echo $template['task']->task_cache ?>
120
121<?php if (	$template['action'] !== 'task_change_state' ||
122			$template['tid'] !== $template['task']->id): ?>
123	<?php if ($template['task']->state === '2'): ?>
124		<h3><?php echo $bezlang['reason'] ?></h3>
125		<?php echo $template['task']->reason_cache ?>
126	<?php elseif ($template['task']->state === '1' && $template['task']->reason != ''): ?>
127		<h3><?php echo $bezlang['evaluation'] ?></h3>
128		<?php echo $template['task']->reason_cache ?>
129	<?php endif ?>
130<?php endif ?>
131
132<?php if (	$template['action'] === 'task_change_state' &&
133			$template['tid'] === $template['task']->id): ?>
134	<a name="form"></a>
135	<?php if ($template['state'] === '2'): ?>
136		<h3><?php echo $bezlang['reason'] ?></h3>
137	<?php else: ?>
138		<h3><?php echo $bezlang['evaluation'] ?></h3>
139	<?php endif ?>
140    <?php
141        if ($nparams['bez'] === 'issue') {
142            $id = $this->id('issue', 'id', $template['issue']->id, 'action', $template['action'], 'tid', $template['tid'], 'state', $template['state']);
143        } else {
144             $id = $this->id('task', 'tid', $template['tid'], 'action', $template['action'], 'state', $template['state']);
145        }
146    ?>
147	<form class="bez_form" action="?id=<?php echo $id ?>" method="POST">
148		<input type="hidden" name="id" value="<?php echo $id ?>">
149
150        <?php if ($template['state'] === '1'): ?>
151            <label style="display:block;margin-bottom:5px;"><input type="checkbox" name="no_evaluation" id="no_evaluation" /> <?php echo $bezlang['no_evaluation'] ?></label>
152        <?php endif ?>
153
154		<div class="bez_reason_toolbar"></div>
155		<textarea name="reason" id="reason" data-validation="required"><?php echo $value['reason'] ?></textarea>
156		<br>
157		<?php if ($template['state'] === '2'): ?>
158			<input type="submit" value="<?php echo $bezlang['task_reject'] ?>">
159		<?php else: ?>
160			<input type="submit" value="<?php echo $bezlang['task_do'] ?>">
161		<?php endif ?>
162		<a href="?id=<?php
163            if ($nparams['bez'] === 'issue') {
164                echo $this->id('issue', 'id', $template['issue']->id).'#z'.$template['task']->id;
165            } else {
166                echo $this->id('task', 'tid', $template['task']->id);
167            }
168        ?>"
169			 class="bez_delete_button bez_link_button">
170				<?php echo $bezlang['cancel'] ?>
171		</a>
172	</form>
173<?php elseif (  $template['action'] === 'task_edit_metadata' &&
174                $template['tid'] === $template['task']->id): ?>
175        <input type="submit" value="<?php echo $bezlang['save'] ?>">&nbsp;&nbsp;
176		<a href="?id=<?php
177            if ($nparams['bez'] === 'issue') {
178                echo $this->id('issue', 'id', $template['issue']->id).'#z'.$template['task']->id;
179            } else {
180                echo $this->id('task', 'tid', $template['task']->id);
181            }
182        ?>"
183			 class="bez_delete_button bez_link_button">
184				<?php echo $bezlang['cancel'] ?>
185		</a>
186    </form>
187<?php else: ?>
188	<div class="bez_buttons">
189        <?php if (count($template['task']->changable_fields(
190                    $template['task']->get_meta_fields()
191                )) > 0): ?>
192            <a class="bds_inline_button_noborder" style="float:left;"
193				href="?id=<?php
194					if ($nparams['bez'] === 'issue') {
195						echo $helper->id('issue', 'id', $template['issue']->id, 'tid', $template['task']->id, 'action', 'task_edit_metadata');
196					} else {
197						echo $helper->id('task', 'tid', $template['task']->id, 'action', 'task_edit_metadata');
198					}
199				?>#z<?php echo $template['task']->id ?>">
200				<?php echo $bezlang['edit_metadata'] ?>
201			</a>
202        <?php endif ?>
203
204		<?php if (	$template['task']->state === '0' &&
205					$template['task']->acl_of('state') >= BEZ_PERMISSION_CHANGE): ?>
206			<a class="bds_inline_button"
207				href="?id=<?php
208					if ($nparams['bez'] === 'issue') {
209						echo $helper->id('issue', 'id', $template['issue']->id, 'tid', $template['task']->id, 'action', 'task_change_state', 'state', '1');
210					} else {
211						echo $helper->id('task', 'tid', $template['task']->id, 'action', 'task_change_state', 'state', '1');
212					}
213				?>#z<?php echo $template['task']->id ?>">
214<?php echo $bezlang['task_do'] ?>
215			</a>
216			<a class="bds_inline_button"
217				href="?id=<?php
218					if ($nparams['bez'] === 'issue') {
219						echo $helper->id('issue', 'id', $template['issue']->id, 'tid', $template['task']->id, 'action', 'task_change_state', 'state', '2');
220					} else {
221						echo $helper->id('task', 'tid', $template['task']->id, 'action', 'task_change_state', 'state', '2');
222					}
223				?>#z<?php echo $template['task']->id ?>">
224<?php echo $bezlang['task_reject'] ?>
225			</a>
226		<?php elseif (  $template['task']->state !== '0' &&
227                        $template['task']->acl_of('state') >= BEZ_PERMISSION_CHANGE): ?>
228			<a class="bds_inline_button"
229					href="?id=<?php
230						if ($nparams['bez'] === 'issue') {
231							echo $helper->id('issue', 'id', $template['issue']->id, 'tid', $template['task']->id, 'action', 'task_reopen');
232						} else {
233							echo $helper->id('task', 'tid', $template['task']->id, 'action', 'task_reopen');
234						}
235					?>">
236<?php echo $bezlang['task_reopen'] ?>
237				</a>
238		<?php endif ?>
239
240		<?php if (count($template['task']->changable_fields()) > 0): ?>
241				<a class="bds_inline_button"
242					href="?id=<?php
243						if ($nparams['bez'] === 'issue') {
244							echo $helper->id('issue', 'id', $template['issue']->id, 'tid', $template['task']->id, 'action', 'task_edit');
245						} else {
246							echo $helper->id('task', 'tid', $template['task']->id, 'action', 'task_edit');
247						}
248					?>#z_">
249<?php echo $bezlang['edit'] ?>
250				</a>
251		<?php endif ?>
252
253		<a class="bds_inline_button" href="
254		<?php echo $helper->mailto($this->model->users->get_user_email($template['task']->executor),
255		$bezlang['task'].': #z'.$template['task']->id.' '.lcfirst($template['task']->action_string),
256        DOKU_URL . 'doku.php?id='.$this->id('task', 'tid', $template['task']->id)) ?>">
257<?php echo $bezlang['send_mail'] ?>
258		</a>
259
260		<?php if ($template['task']->tasktype !== '' &&
261                  $this->model->acl->get_level() >= BEZ_AUTH_USER): ?>
262			<a class="bds_inline_button"
263					href="?id=<?php echo $this->id('task_form', 'duplicate', $template['task']->id, 'tasktype', $template['task']->tasktype) ?>">
264<?php echo $bezlang['duplicate'] ?>
265			</a>
266		<?php endif ?>
267	</div>
268<?php endif ?>
269
270</div>
271
272