xref: /plugin/bez/tpl/task_box.php (revision ef159648ef3ff6e0d9504925f53e30d9aa2bbff5)
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
86        <?php if ($template['state'] === '1'): ?>
87            <label style="display:block;margin-bottom:5px;"><input type="checkbox" name="no_evaluation" id="no_evaluation" /> <?php echo $bezlang['no_evaluation'] ?></label>
88        <?php endif ?>
89
90		<div class="bez_reason_toolbar"></div>
91		<textarea name="reason" id="reason" data-validation="required"><?php echo $value['reason'] ?></textarea>
92		<br>
93		<?php if ($template['state'] === '2'): ?>
94			<input type="submit" value="<?php echo $bezlang['task_reject'] ?>">
95		<?php else: ?>
96			<input type="submit" value="<?php echo $bezlang['task_do'] ?>">
97		<?php endif ?>
98		<a href="?id=<?php
99            if ($nparams['bez'] === 'issue') {
100                echo $this->id('issue', 'id', $template['issue']->id).'#z'.$template['task']->id;
101            } else {
102                echo $this->id('task', 'tid', $template['task']->id);
103            }
104        ?>"
105			 class="bez_delete_button bez_link_button">
106				<?php echo $bezlang['cancel'] ?>
107		</a>
108	</form>
109<?php else: ?>
110	<?php if ($template['task']->state === '2'): ?>
111		<h3><?php echo $bezlang['reason'] ?></h3>
112		<?php echo $template['task']->reason_cache ?>
113	<?php elseif ($template['task']->state === '1' && $template['task']->reason != ''): ?>
114		<h3><?php echo $bezlang['evaluation'] ?></h3>
115		<?php echo $template['task']->reason_cache ?>
116	<?php endif ?>
117	<div class="bez_buttons">
118		<?php if (	$template['task']->state === '0' &&
119					$template['task']->get_level() >= 10): ?>
120			<a class="bds_inline_button"
121				href="?id=<?php
122					if ($nparams['bez'] === 'issue') {
123						echo $helper->id('issue', 'id', $template['issue']->id, 'tid', $template['task']->id, 'action', 'task_change_state', 'state', '1');
124					} else {
125						echo $helper->id('task', 'tid', $template['task']->id, 'action', 'task_change_state', 'state', '1');
126					}
127				?>#z<?php echo $template['task']->id ?>">
128<?php echo $bezlang['task_do'] ?>
129			</a>
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_change_state', 'state', '2');
134					} else {
135						echo $helper->id('task', 'tid', $template['task']->id, 'action', 'task_change_state', 'state', '2');
136					}
137				?>#z<?php echo $template['task']->id ?>">
138<?php echo $bezlang['task_reject'] ?>
139			</a>
140		<?php elseif ((!isset($template['issue']) || $template['issue']->state === '0') &&
141                      $template['task']->get_level() >= 10): ?>
142			<a class="bds_inline_button"
143					href="?id=<?php
144						if ($nparams['bez'] === 'issue') {
145							echo $helper->id('issue', 'id', $template['issue']->id, 'tid', $template['task']->id, 'action', 'task_reopen');
146						} else {
147							echo $helper->id('task', 'tid', $template['task']->id, 'action', 'task_reopen');
148						}
149					?>">
150<?php echo $bezlang['task_reopen'] ?>
151				</a>
152		<?php endif ?>
153
154		<?php if ( (!isset($template['issue']) || $template['issue']->state === '0') &&
155                  ($template['task']->get_level() >= 15 ||
156                   $template['task']->reporter === $template['task']->get_user())): ?>
157				<a class="bds_inline_button"
158					href="?id=<?php
159						if ($nparams['bez'] === 'issue') {
160							echo $helper->id('issue', 'id', $template['issue']->id, 'tid', $template['task']->id, 'action', 'task_edit');
161						} else {
162							echo $helper->id('task', 'tid', $template['task']->id, 'action', 'task_edit');
163						}
164					?>#z_">
165<?php echo $bezlang['edit'] ?>
166				</a>
167		<?php endif ?>
168
169		<a class="bds_inline_button" href="
170		<?php echo $helper->mailto($this->model->users->get_user_email($template['task']->executor),
171		$bezlang['task'].': #z'.$template['task']->id.' '.lcfirst($template['task']->action_string),
172        DOKU_URL . 'doku.php?id='.$this->id('task', 'tid', $template['task']->id)) ?>">
173<?php echo $bezlang['send_mail'] ?>
174		</a>
175
176		<?php if ($template['task']->tasktype != NULL && $template['task']->get_level() >= 5): ?>
177			<a class="bds_inline_button"
178					href="?id=<?php echo $this->id('task_form', 'duplicate', $template['task']->id, 'tasktype', $template['task']->tasktype) ?>">
179<?php echo $bezlang['duplicate'] ?>
180			</a>
181		<?php endif ?>
182	</div>
183<?php endif ?>
184
185</div>
186
187