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