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