xref: /plugin/bez/tpl/tasks.php (revision e09b232ffd94bc38ec04930c9ddc745874b0ba41)
1<?php /* @var \dokuwiki\plugin\bez\meta\Tpl $tpl */ ?>
2<?php if ($tpl->factory('task')->permission() >= BEZ_TABLE_PERMISSION_INSERT): ?>
3    <a href="<?php echo $tpl->url('task_form') ?>" class="bez_start_button" id="bez_report_task_button">
4        <?php echo $tpl->getLang('add_task') ?>
5    </a>
6<?php endif ?>
7
8<br /><br />
9
10<div class="bez_filter_form">
11<form action="<?php echo $tpl->url('tasks') ?>" method="POST">
12
13
14<label><?php echo $tpl->getLang('reporter') ?>:
15    <select name="original_poster">
16        <option <?php if ($tpl->value('original_poster') == '-all') echo 'selected' ?>
17                value="-all">--- <?php echo $tpl->getLang('all') ?> ---</option>
18        <optgroup label="<?php echo $tpl->getLang('users') ?>">
19            <?php foreach ($tpl->get('users') as $nick => $name): ?>
20                <option <?php if ($tpl->value('original_poster') == $nick) echo 'selected' ?>
21                        value="<?php echo $nick ?>"><?php echo $name ?></option>
22            <?php endforeach ?>
23        </optgroup>
24        <optgroup label="<?php echo $tpl->getLang('groups') ?>">
25            <?php foreach ($tpl->get('groups') as $name): ?>
26                <?php $group = "@$name" ?>
27                <option <?php if ($tpl->value('original_poster') == $group) echo 'selected' ?>
28                        value="<?php echo $group ?>"><?php echo $group ?></option>
29            <?php endforeach ?>
30        </optgroup>
31    </select>
32</label>
33
34<label><?php echo $tpl->getLang('class') ?>:
35	<select name="type">
36		<option <?php if ($tpl->value('type') == '-all') echo 'selected' ?>
37			value="-all">--- <?php echo $tpl->getLang('all') ?> ---</option>
38	<?php foreach (\dokuwiki\plugin\bez\mdl\Task::get_types() as $type): ?>
39		<option <?php if ($tpl->value('type') == $type) echo 'selected' ?>
40			value="<?php echo $type ?>"><?php echo $tpl->getLang('task_type_' . $type) ?></option>
41	<?php endforeach ?>
42	</select>
43</label>
44
45<label><?php echo $tpl->getLang('state') ?>:
46	<select name="state">
47		<option <?php if ($tpl->value('state') == '-all') echo 'selected' ?>
48			value="-all">--- <?php echo $tpl->getLang('all') ?> ---</option>
49	<?php foreach (\dokuwiki\plugin\bez\mdl\Task::get_states() as $state): ?>
50		<option <?php if ($tpl->value('state') == $state) echo 'selected' ?>
51			value="<?php echo $state ?>"><?php echo lcfirst($tpl->getLang('task_' . $state)) ?></option>
52	<?php endforeach ?>
53	</select>
54</label>
55
56<label><?php echo $tpl->getLang('task_type') ?>:
57	<select name="task_program_id">
58		<option <?php if ($tpl->value('task_program_id') == '-all') echo 'selected' ?>
59			value="-all">--- <?php echo $tpl->getLang('all') ?> ---</option>
60		<option <?php if ($tpl->value('task_program_id') == '-none') echo 'selected' ?>
61			value="-none">-- <?php echo $tpl->getLang('none') ?> --</option>
62	<?php foreach ($tpl->get('task_programs') as $task_program): ?>
63		<option <?php if ($tpl->value('task_program_id') == $task_program->id) echo 'selected' ?>
64			value="<?php echo $task_program->id ?>"><?php echo $task_program->name ?></option>
65	<?php endforeach ?>
66	</select>
67</label>
68
69<label><?php echo $tpl->getLang('executor') ?>:
70    <select name="assignee">
71        <option <?php if ($tpl->value('assignee') == '-all') echo 'selected' ?>
72                value="-all">--- <?php echo $tpl->getLang('all') ?> ---</option>
73        <optgroup label="<?php echo $tpl->getLang('users') ?>">
74            <?php foreach ($tpl->get('users') as $nick => $name): ?>
75                <option <?php if ($tpl->value('assignee') == $nick) echo 'selected' ?>
76                        value="<?php echo $nick ?>"><?php echo $name ?></option>
77            <?php endforeach ?>
78        </optgroup>
79        <optgroup label="<?php echo $tpl->getLang('groups') ?>">
80            <?php foreach ($tpl->get('groups') as $name): ?>
81                <?php $group = "@$name" ?>
82                <option <?php if ($tpl->value('assignee') == $group) echo 'selected' ?>
83                        value="<?php echo $group ?>"><?php echo $group ?></option>
84            <?php endforeach ?>
85        </optgroup>
86    </select>
87</label>
88
89
90<label><?php echo $tpl->getLang('description') ?>:
91	<input name="content" value="<?php echo $tpl->value('content') ?>" />
92</label>
93
94
95<div class="time_filter">
96	<label>
97		<select name="date_type">
98			<option <?php if ($tpl->value('date_type') == 'plan_date') echo 'selected' ?>
99				value="plan_date"><?php echo $tpl->getLang('plan_date') ?></option>
100			<option <?php if ($tpl->value('date_type') == 'create_date') echo 'selected' ?>
101				value="create_date"><?php echo $tpl->getLang('open_date') ?></option>
102			<option <?php if ($tpl->value('date_type') == 'close_date') echo 'selected' ?>
103				value="close_date"><?php echo $tpl->getLang('close_date') ?></option>
104		</select>:
105	</label>
106	<label><?php echo $tpl->getLang('month') ?>:
107		<select name="month">
108			<option <?php if ($tpl->value('month') == '-all') echo 'selected' ?>
109				value="-all">--- <?php echo $tpl->getLang('all') ?> ---</option>
110		<?php foreach ($tpl->get('months') as $nr => $month): ?>
111			<option <?php if ($tpl->value('month') == $nr) echo 'selected' ?>
112				value="<?php echo $nr ?>"><?php echo $tpl->getLang($month) ?></option>
113		<?php endforeach ?>
114		</select>
115	</label>
116	<label><?php echo $tpl->getLang('year') ?>:
117		<select name="year">
118			<option <?php if ($tpl->value('year') == '-all') echo 'selected' ?>
119				value="-all">--- <?php echo $tpl->getLang('all') ?> ---</option>
120		<?php foreach ($tpl->get('years') as $year): ?>
121			<option <?php if ($tpl->value('year') == $year) echo 'selected' ?>
122				value="<?php echo $year ?>"><?php echo $year ?></option>
123		<?php endforeach ?>
124		</select>
125	</label>
126	<label><input type="submit" value="<?php echo $tpl->getLang('filter') ?>" /></label>
127</div>
128</form>
129</div>
130
131
132<table class="bez bez_sumarise">
133<tr>
134	<th><?php echo $tpl->getLang('id') ?></th>
135	<th><?php echo $tpl->getLang('state') ?></th>
136	<th><?php echo $tpl->getLang('task_type') ?></th>
137	<th><?php echo $tpl->getLang('description') ?></th>
138
139	<th><?php echo $tpl->getLang('executor') ?></th>
140	<th><?php echo $tpl->getLang('plan') ?></th>
141	<th><?php echo $tpl->getLang('cost') ?></th>
142
143	<th><?php echo $tpl->getLang('closed') ?></th>
144	<th><?php echo $tpl->getLang('hours_no') ?></th>
145
146</tr>
147<?php $count = 0 ?>
148<?php $total_cost = 0.0 ?>
149<?php $total_hours = 0.0 ?>
150<?php foreach ($tpl->get('tasks') as $task): ?>
151    <?php $count += 1 ?>
152    <?php $total_cost += (float) $task->cost ?>
153    <?php $hours = $tpl->date_diff_hours($task->start_time, $task->finish_time) ?>
154    <?php $total_hours += $tpl->time_to_float($hours) ?>
155	<tr class="priority_<?php echo $task->priority ?>" data-bez-row-id="<?php echo $task->id ?>">
156		<td style="white-space: nowrap">
157            <a href="<?php echo $tpl->url('task', 'tid', $task->id) ?>">
158               <?php if ($task->thread_id != '') echo '#'.$task->thread_id ?>
159		       #z<?php echo $task->id ?>
160	       </a>
161            <?php if($task->private == '1'): ?>
162                <?php echo inlineSVG(DOKU_PLUGIN . 'bez/images/lock-small.svg') ?>
163            <?php endif ?>
164		</td>
165		<td>
166			<?php echo lcfirst($tpl->getLang('task_' . $task->state)) ?>
167			<?php if ($task->plan_date < date('%Y-%m-%d')): ?>
168			(<?php echo lcfirst($tpl->getLang('task_outdated')) ?>)
169			<?php endif ?>
170		</td>
171		<td>
172			<?php if ($task->task_program_id == ''): ?>
173				<em>---</em>
174			<?php else: ?>
175				<?php echo $task->task_program_name ?>
176			<?php endif ?>
177		</td>
178		<td>
179			<div style="max-width:200px;max-height:60px;overflow:hidden;">
180			<?php echo $task->content_html ?>
181			</div>
182			 <a class="bez_show_single_desc" href="#">(...)</a>
183			</td>
184		<td><?php echo $tpl->user_name($task->assignee) ?></td>
185
186		<td>
187        <?php echo $task->plan_date ?>
188        <?php if ($task->state == 'opened'): ?>
189            (<?php echo $tpl->date_diff_days($task->plan_date) ?>)
190        <?php endif ?>
191        <?php if ($task->all_day_event == '0'): ?>
192            <?php echo $task->start_time ?>&nbsp;-&nbsp;<?php echo $task->finish_time ?>
193        <?php endif ?>
194		</td>
195
196		<td>
197			<?php if ($task->cost == ''): ?>
198				<em>---</em>
199			<?php else: ?>
200				<?php echo $task->cost ?>
201			<?php endif ?>
202		</td>
203
204		<td>
205			<?php if ($task->state == 'opened'): ?>
206				<em>---</em>
207			<?php else: ?>
208				<?php echo $tpl->date($task->close_date) ?>
209			<?php endif ?>
210		</td>
211		<td>
212			<?php if ($task->start_time == ''): ?>
213				<em>---</em>
214			<?php else: ?>
215                <?php echo $hours ?>
216			<?php endif ?>
217		</td>
218		</tr>
219		<tr class="bez_desc_row task<?php echo $task->id ?>">
220			<td colspan="10">
221				<?php echo $task->content_html ?>
222			</td>
223		</tr>
224	<?php endforeach ?>
225	<tr>
226		<th><?php echo $tpl->getLang('report_total') ?></th>
227		<td colspan="5"><?php echo $count ?></td>
228		<td colspan="2"><?php echo $total_cost ?></td>
229		<td colspan="1"><?php echo $tpl->float_to_time($total_hours) ?></td>
230	</tr>
231</table>
232</div>
233