xref: /plugin/bez/tpl/task_box.php (revision 8c9d5139dfb491d4d76393f5da7d48e831694539)
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
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 $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($template['task']->action_string) ?>
25	(<?php echo lcfirst($template['task']->state_string) ?>)
26</h2>
27
28<?php
29    $top_row = array(
30        '<strong>'.$bezlang['executor'].': </strong>' .
31        $this->model->users->get_user_full_name($template['task']->executor),
32
33        '<strong>'.$bezlang['reporter'].': </strong>' .
34        $this->model->users->get_user_full_name($template['task']->reporter)
35    );
36
37    if ($template['task']->tasktype_string != '') {
38        $top_row[] =
39            '<strong>'.$bezlang['task_type'].': </strong>' .
40            $template['task']->tasktype_string;
41    }
42
43	if ($template['task']->cost != '') {
44        $top_row[] =
45            '<strong>'.$bezlang['cost'].': </strong>' .
46            $template['task']->cost;
47    }
48
49    //BOTTOM ROW
50    $bottom_row = array(
51        '<strong>'.$bezlang['plan_date'].': </strong>' .
52        $template['task']->plan_date
53    );
54
55	if ($template['task']->all_day_event == '0') {
56        $bottom_row[] =
57            '<strong>'.$bezlang['start_time'].': </strong>' .
58            $template['task']->start_time;
59        $bottom_row[] =
60            '<strong>'.$bezlang['finish_time'].': </strong>' .
61            $template['task']->finish_time;
62	}
63    echo bez_html_irrtable(array(), $top_row, $bottom_row);
64?>
65
66<?php echo $template['task']->task_cache ?>
67
68<?php if (	$template['action'] === 'task_change_state' &&
69			$template['tid'] === $template['task']->id): ?>
70	<a name="form"></a>
71	<?php if ($template['state'] === '2'): ?>
72		<h3><?php echo $bezlang['reason'] ?></h3>
73	<?php else: ?>
74		<h3><?php echo $bezlang['evaluation'] ?></h3>
75	<?php endif ?>
76    <?php
77        if ($nparams['bez'] === 'issue') {
78            $id = $this->id('issue', 'id', $template['issue']->id, 'action', $template['action'], 'tid', $template['tid'], 'state', $template['state']);
79        } else {
80             $id = $this->id('task', 'tid', $template['tid'], 'action', $template['action'], 'state', $template['state']);
81        }
82    ?>
83	<form class="bez_form" action="?id=<?php echo $id ?>" method="POST">
84		<input type="hidden" name="id" value="<?php echo $id ?>">
85		<div class="bez_reason_toolbar"></div>
86		<textarea name="reason" id="reason" data-validation="required"><?php echo $value['reason'] ?></textarea>
87		<br>
88		<?php if ($template['state'] === '2'): ?>
89			<input type="submit" value="<?php echo $bezlang['task_reject'] ?>">
90		<?php else: ?>
91			<input type="submit" value="<?php echo $bezlang['task_do'] ?>">
92		<?php endif ?>
93		<a href="?id=<?php
94            if ($template['action'] === 'issue') {
95                echo $this->id('issue', 'id', $template['issue']->id).'#z'.$template['task']->id;
96            } else {
97                echo $this->id('task', 'tid', $template['task']->id);
98            }
99        ?>"
100			 class="bez_delete_button bez_link_button">
101				<?php echo $bezlang['cancel'] ?>
102		</a>
103	</form>
104<?php else: ?>
105	<?php if ($template['task']->state === '2'): ?>
106		<h3><?php echo $bezlang['reason'] ?></h3>
107		<?php echo $template['task']->reason_cache ?>
108	<?php elseif ($template['task']->state === '1'): ?>
109		<h3><?php echo $bezlang['evaluation'] ?></h3>
110		<?php echo $template['task']->reason_cache ?>
111	<?php endif ?>
112	<div class="bez_buttons">
113		<?php if (	$template['task']->state === '0' &&
114					$template['task']->get_level() >= 10): ?>
115			<a class="bds_inline_button"
116				href="?id=<?php
117					if ($nparams['bez'] === 'issue') {
118						echo $helper->id('issue', 'id', $template['issue']->id, 'tid', $template['task']->id, 'action', 'task_change_state', 'state', '1');
119					} else {
120						echo $helper->id('task', 'tid', $template['task']->id, 'action', 'task_change_state', 'state', '1');
121					}
122				?>#z<?php echo $template['task']->id ?>">
123<?php echo $bezlang['task_do'] ?>
124			</a>
125			<a class="bds_inline_button"
126				href="?id=<?php
127					if ($nparams['bez'] === 'issue') {
128						echo $helper->id('issue', 'id', $template['issue']->id, 'tid', $template['task']->id, 'action', 'task_change_state', 'state', '2');
129					} else {
130						echo $helper->id('task', 'tid', $template['task']->id, 'action', 'task_change_state', 'state', '2');
131					}
132				?>#z<?php echo $template['task']->id ?>">
133<?php echo $bezlang['task_reject'] ?>
134			</a>
135		<?php elseif ($template['task']->get_level() >= 10): ?>
136			<a class="bds_inline_button"
137					href="?id=<?php
138						if ($nparams['bez'] === 'issue') {
139							echo $helper->id('issue', 'id', $template['issue']->id, 'tid', $template['task']->id, 'action', 'task_reopen');
140						} else {
141							echo $helper->id('task', 'tid', $template['task']->id, 'action', 'task_reopen');
142						}
143					?>">
144<?php echo $bezlang['task_reopen'] ?>
145				</a>
146		<?php endif ?>
147
148		<?php if($template['task']->get_level() >= 15 || $template['task']->reporter === $template['task']->get_user()): ?>
149				<a class="bds_inline_button"
150					href="?id=<?php
151						if ($nparams['bez'] === 'issue') {
152							echo $helper->id('issue', 'id', $template['issue']->id, 'tid', $template['task']->id, 'action', 'task_edit');
153						} else {
154							echo $helper->id('task', 'tid', $template['task']->id, 'action', 'task_edit');
155						}
156					?>#z_">
157<?php echo $bezlang['edit'] ?>
158				</a>
159		<?php endif ?>
160
161		<a class="bds_inline_button" href="
162		<?php echo $helper->mailto($this->model->users->get_user_email($template['task']->executor),
163		$bezlang['task'].': #z'.$template['task']->id.' '.lcfirst($template['task']->action_string),
164        DOKU_URL . 'doku.php?id='.$this->id('task', 'tid', $template['task']->id)) ?>">
165<?php echo $bezlang['send_mail'] ?>
166		</a>
167
168		<?php if ($template['task']->tasktype != NULL && $template['task']->get_level() >= 5): ?>
169			<a class="bds_inline_button"
170					href="?id=<?php echo $this->id('task_form', 'duplicate', $template['task']->id, 'tasktype', $template['task']->tasktype) ?>">
171<?php echo $bezlang['duplicate'] ?>
172			</a>
173		<?php endif ?>
174	</div>
175<?php endif ?>
176
177</div>
178
179