xref: /plugin/bez/tpl/task_box.php (revision 60c2063d146ee3f9fbe85de8801c33f2a5bd12ed)
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 echo $this->id('issue', 'id', $template['issue']->id) ?>#z<?php echo $template['task']->id ?>"
94			 class="bez_delete_button bez_link_button">
95				<?php echo $bezlang['cancel'] ?>
96		</a>
97	</form>
98<?php else: ?>
99	<?php if ($template['task']->state === '2'): ?>
100		<h3><?php echo $bezlang['reason'] ?></h3>
101		<?php echo $template['task']->reason_cache ?>
102	<?php elseif ($template['task']->state === '1'): ?>
103		<h3><?php echo $bezlang['evaluation'] ?></h3>
104		<?php echo $template['task']->reason_cache ?>
105	<?php endif ?>
106	<div class="bez_buttons">
107		<?php if (	$template['task']->state === '0' &&
108					$template['task']->get_level() >= 10): ?>
109			<a class="bds_inline_button"
110				href="?id=<?php
111					if ($nparams['bez'] === 'issue') {
112						echo $helper->id('issue', 'id', $template['issue']->id, 'tid', $template['task']->id, 'action', 'task_change_state', 'state', '1');
113					} else {
114						echo $helper->id('task', 'tid', $template['task']->id, 'action', 'task_change_state', 'state', '1');
115					}
116				?>#z<?php echo $template['task']->id ?>">
117<?php echo $bezlang['task_do'] ?>
118			</a>
119			<a class="bds_inline_button"
120				href="?id=<?php
121					if ($nparams['bez'] === 'issue') {
122						echo $helper->id('issue', 'id', $template['issue']->id, 'tid', $template['task']->id, 'action', 'task_change_state', 'state', '2');
123					} else {
124						echo $helper->id('task', 'tid', $template['task']->id, 'action', 'task_change_state', 'state', '2');
125					}
126				?>#z<?php echo $template['task']->id ?>">
127<?php echo $bezlang['task_reject'] ?>
128			</a>
129		<?php elseif ($template['task']->get_level() >= 10): ?>
130			<a class="bds_inline_button"
131					href="?id=<?php
132						if ($nparams['bez'] === 'issue') {
133							echo $helper->id('issue', 'id', $template['issue']->id, 'tid', $template['task']->id, 'action', 'task_reopen');
134						} else {
135							echo $helper->id('task', 'tid', $template['task']->id, 'action', 'task_reopen');
136						}
137					?>">
138<?php echo $bezlang['task_reopen'] ?>
139				</a>
140		<?php endif ?>
141
142		<?php if($template['task']->get_level() >= 15 || $template['task']->reporter === $template['task']->get_user()): ?>
143				<a class="bds_inline_button"
144					href="?id=<?php
145						if ($nparams['bez'] === 'issue') {
146							echo $helper->id('issue', 'id', $template['issue']->id, 'tid', $template['task']->id, 'action', 'task_edit');
147						} else {
148							echo $helper->id('task', 'tid', $template['task']->id, 'action', 'task_edit');
149						}
150					?>#z_">
151<?php echo $bezlang['edit'] ?>
152				</a>
153		<?php endif ?>
154
155		<a class="bds_inline_button" href="
156		<?php echo $helper->mailto($this->model->users->get_user_email($template['task']->executor),
157		$bezlang['task'].': #z'.$template['task']->id.' '.lcfirst($template['task']->action_string),
158        DOKU_URL . 'doku.php?id='.$this->id('task', 'tid', $template['task']->id)) ?>">
159<?php echo $bezlang['send_mail'] ?>
160		</a>
161
162		<?php if ($template['task']->tasktype != NULL && $template['task']->get_level() >= 5): ?>
163			<a class="bds_inline_button"
164					href="?id=<?php echo $this->id('task_form', 'duplicate', $template['task']->id, 'tasktype', $template['task']->tasktype) ?>">
165<?php echo $bezlang['duplicate'] ?>
166			</a>
167		<?php endif ?>
168	</div>
169<?php endif ?>
170
171</div>
172
173