xref: /plugin/bez/tpl/threads.php (revision ff14b1073c2dab2f863cab3b8baf8b1a01f7993a)
1<?php /* @var \dokuwiki\plugin\bez\meta\Tpl $tpl */ ?>
2
3<?php if ($tpl->static_acl('thread', 'id') >= BEZ_PERMISSION_CHANGE): ?>
4    <a href="<?php echo $tpl->url('thread_report') ?>" class="bez_start_button" id="bez_report_issue_button">
5        <?php echo $tpl->getLang('report_issue') ?>
6    </a>
7<?php endif ?>
8
9<br /><br />
10
11<div class="bez_filter_form">
12<form action="<?php echo $tpl->url('threads') ?>" method="post">
13	<label><?php echo $tpl->getLang('state') ?>:
14		<select name="state">
15			<option <?php if ($tpl->value('state') === '-all') echo 'selected' ?>
16				value="-all">--- <?php echo $tpl->getLang('all') ?> ---</option>
17		<?php foreach (\dokuwiki\plugin\bez\mdl\Thread::get_states() as $state): ?>
18			<option <?php if ($tpl->value('state') === $state) echo 'selected' ?>
19				value="<?php echo $state ?>"><?php echo $tpl->getLang('state_' . $state) ?></option>
20		<?php endforeach ?>
21		</select>
22	</label>
23
24	<label><?php echo $tpl->getLang('just_type') ?>:
25		<select name="label_id">
26			<option <?php if ($tpl->value('label_id') === '-all') echo 'selected' ?>
27				value="-all">--- <?php echo $tpl->getLang('all') ?> ---</option>
28			<option <?php if ($tpl->value('label_id') === '-none') echo 'selected' ?>
29			value="-none">--- <?php echo $tpl->getLang('issue_type_no_specified') ?> ---</option>
30		<?php foreach ($tpl->get('labels') as $label): ?>
31			<option <?php if ($tpl->value('label_id') === $label->id) echo 'selected' ?>
32				value="<?php echo $label->id ?>"><?php echo $label->name ?></option>
33		<?php endforeach ?>
34		</select>
35	</label>
36
37	<label><?php echo $tpl->getLang('coordinator') ?>:
38		<select name="coordinator">
39			<option <?php if ($tpl->value('coordinator') === '-all') echo 'selected' ?>
40				value="-all">--- <?php echo $tpl->getLang('all') ?> ---</option>
41			<option <?php if ($tpl->value('coordinator') === '-none') echo 'selected' ?>
42				value="-none">--- <?php echo $tpl->getLang('none') ?> ---</option>
43		<optgroup label="<?php echo $tpl->getLang('users') ?>">
44			<?php foreach ($tpl->get('users') as $nick => $name): ?>
45				<option <?php if ($tpl->value('coordinator') === $nick) echo 'selected' ?>
46					value="<?php echo $nick ?>"><?php echo $name ?></option>
47			<?php endforeach ?>
48	</optgroup>
49	<optgroup label="<?php echo $tpl->getLang('groups') ?>">
50		<?php foreach ($tpl->get('groups') as $name): ?>
51			<?php $group = "@$name" ?>
52			<option <?php if ($tpl->value('coordinator') === $group) echo 'selected' ?>
53				value="<?php echo $group ?>"><?php echo $group ?></option>
54		<?php endforeach ?>
55	</optgroup>
56	</select>
57	</label>
58
59	<label><?php echo $tpl->getLang('title') ?>:
60		<input name="title" value="<?php echo $tpl->value('title') ?>" />
61	</label>
62
63
64	<label><?php echo $tpl->getLang('year') ?>:
65		<select name="year">
66			<option <?php if ($tpl->value('year') === '-all') echo 'selected' ?>
67				value="-all">--- <?php echo $tpl->getLang('all') ?> ---</option>
68		<?php foreach ($tpl->get('years') as $year): ?>
69			<option <?php if ($tpl->value('year') === $year) echo 'selected' ?>
70				value="<?php echo $year ?>"><?php echo $year ?></option>
71		<?php endforeach ?>
72		</select>
73	</label>
74	<label><?php echo $tpl->getLang('sort_by_open_date') ?>:
75			<input type="checkbox" name="sort_open"
76			<?php if ($tpl->value('sort_open') === 'on') echo 'checked="checked"' ?>>
77	</label>
78	<label><input type="submit" value="<?php echo $tpl->getLang('filter') ?>" /></label>
79</form>
80</div>
81
82<table class="bez bez_sumarise">
83	<tr>
84		<th><?php echo $tpl->getLang('id') ?></th>
85		<th><?php echo $tpl->getLang('state') ?></th>
86		<th><?php echo $tpl->getLang('type') ?></th>
87		<th><?php echo $tpl->getLang('title')?></th>
88		<th><?php echo $tpl->getLang('coordinator') ?></th>
89		<th><?php echo $tpl->getLang('date') ?></th>
90		<th><?php echo $tpl->getLang('last_mod_date') ?></th>
91		<th><?php echo $tpl->getLang('closed') ?></th>
92		<th><?php echo $tpl->getLang('cost') ?></th>
93		<th><?php echo $tpl->getLang('closed_tasks') ?></th>
94	</tr>
95    <?php $count = 0 ?>
96    <?php $total_cost = 0.0 ?>
97	<?php foreach ($tpl->get('threads') as $thread): ?>
98        <?php $count += 1 ?>
99        <?php $total_cost += (float) $thread->task_sum_cost ?>
100
101		<tr class="pr<?php echo $thread->state == 'opened' ? 'None' : '-1' ?>">
102			<td>
103				<a href="<?php echo $tpl->url('thread', 'id', $thread->id) ?>">
104                    #<?php echo $thread->id ?>
105                </a>
106			</td>
107			<td>
108			<?php echo $tpl->getLang('state_'.$thread->state) ?>
109			</td>
110			<td>
111				<?php if ($thread->label_name === NULL): ?>
112					<i style="color: #777"><?php echo $tpl->getLang('issue_type_no_specified') ?></i>
113				<?php else: ?>
114					<?php echo $thread->label_name ?>
115				<?php endif ?>
116			</td>
117			<td><?php echo $thread->title ?></td>
118			<td>
119                <?php if ($thread->coordinator === NULL): ?>
120                    <i style="color: #777"><?php echo $tpl->getLang('none') ?></i>
121                <?php else: ?>
122                    <?php echo $tpl->user_name($thread->coordinator) ?>
123                <?php endif ?>
124            </td>
125            <td>
126                <?php echo $tpl->date($thread->create_date) ?>
127            </td>
128            <td>
129                <?php echo $tpl->date($thread->last_activity_date) ?>
130            </td>
131			<td>
132				<?php if ($thread->close_date === NULL): ?>
133					<em>---</em>
134				<?php else: ?>
135					<?php echo $tpl->date($thread->close_date) ?><br />
136					<?php $s = $tpl->getLang('report_priority').': ' .
137                        $tpl->date_diff_days($tpl->get('thread')->create_date,
138                                             $tpl->get('thread')->close_date, '%a') ?>
139					<?php echo str_replace(' ', '&nbsp;', $s) ?>
140				<?php endif ?>
141			</td>
142			<td>
143				<?php if ($thread->task_sum_cost === NULL): ?>
144					<em>---</em>
145				<?php else: ?>
146					<?php echo $thread->task_sum_cost ?>
147				<?php endif ?>
148			</td>
149			<td>
150		<a href="<?php echo $tpl->url('tasks', 'issue', $thread->id, 'state', 0) ?>">
151				<?php echo $thread->task_count_closed ?>
152		</a>
153			/
154		<a href="<?php echo $tpl->url('tasks', 'issue', $thread->id) ?>">
155				<?php echo $thread->task_count ?>
156		</a>
157			</td>
158		</tr>
159	<?php endforeach ?>
160	<tr>
161		<th><?php echo $tpl->getLang('report_total') ?></th>
162		<td colspan="6"><?php echo $count ?></td>
163		<td colspan="3"><?php echo $total_cost ?></td>
164	</tr>
165</table>
166