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