xref: /plugin/bez/tpl/tasks.php (revision addc91ee3302cfabdbe6588b98874f0b355a06f3)
1<?php /* @var \dokuwiki\plugin\bez\meta\Tpl $tpl */ ?>
2<?php if ($tpl->acl('task', 'id') >= BEZ_PERMISSION_CHANGE): ?>
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="pr<?php echo $task->priority ?>" data-bez-row-id="<?php echo $task->id ?>">
156		<td>
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		</td>
162		<td>
163			<?php echo lcfirst($tpl->getLang('task_' . $task->state)) ?>
164			<?php if ($task->plan_date < date('%Y-%m-%d')): ?>
165			(<?php echo lcfirst($tpl->getLang('task_outdated')) ?>)
166			<?php endif ?>
167		</td>
168		<td>
169			<?php if ($task->task_program_id == ''): ?>
170				<em>---</em>
171			<?php else: ?>
172				<?php echo $task->task_program_name ?>
173			<?php endif ?>
174		</td>
175		<td>
176			<div style="max-width:200px;max-height:60px;overflow:hidden;">
177			<?php echo $task->content_html ?>
178			</div>
179			 <a class="bez_show_single_desc" href="#">(...)</a>
180			</td>
181		<td><?php echo $tpl->user_name($task->assignee) ?></td>
182
183		<td>
184        <?php echo $task->plan_date ?>
185        <?php if ($task->state == 'opened'): ?>
186            (<?php echo $tpl->date_diff_days($task->plan_date) ?>)
187        <?php endif ?>
188        <?php if ($task->all_day_event == '0'): ?>
189            <?php echo $task->start_time ?>&nbsp;-&nbsp;<?php echo $task->finish_time ?>
190        <?php endif ?>
191		</td>
192
193		<td>
194			<?php if ($task->cost == ''): ?>
195				<em>---</em>
196			<?php else: ?>
197				<?php echo $task->cost ?>
198			<?php endif ?>
199		</td>
200
201		<td>
202			<?php if ($task->state == 'opened'): ?>
203				<em>---</em>
204			<?php else: ?>
205				<?php echo $tpl->date($task->close_date) ?>
206			<?php endif ?>
207		</td>
208		<td>
209			<?php if ($task->start_time == ''): ?>
210				<em>---</em>
211			<?php else: ?>
212                <?php echo $hours ?>
213			<?php endif ?>
214		</td>
215		</tr>
216		<tr class="bez_desc_row task<?php echo $task->id ?>">
217			<td colspan="10">
218				<?php echo $task->content_html ?>
219			</td>
220		</tr>
221	<?php endforeach ?>
222	<tr>
223		<th><?php echo $tpl->getLang('report_total') ?></th>
224		<td colspan="5"><?php echo $count ?></td>
225		<td colspan="2"><?php echo $total_cost ?></td>
226		<td colspan="1"><?php echo $tpl->float_to_time($total_hours) ?></td>
227	</tr>
228</table>
229</div>
230