xref: /plugin/bez/tpl/threads.php (revision de02284c1e90f3c0d8df29c1c019b3ef912eafd9)
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">
17			<option <?php if ($tpl->value('label') === '-all') echo 'selected' ?>
18				value="-all">--- <?php echo $tpl->getLang('all') ?> ---</option>
19			<option <?php if ($tpl->value('label') === '-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') === $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('issue', 'id', $issue->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 === NULL): ?>
103					<i style="color: #777"><?php echo $tpl->getLang('issue_type_no_specified') ?></i>
104				<?php else: ?>
105					<?php echo $thread->label ?>
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>--><?php //echo $issue->date_format('date') ?><!-- (--><?php //echo $issue->days_ago('date') ?><!--)</td>-->
117            <td>
118                <?php echo dformat(strtotime($thread->create_date)) ?> (<?php echo datetime_h(strtotime($thread->create_date)) ?>)
119            </td>
120            <td>
121<!--				--><?php //echo $issue->date_format('last_activity') ?><!-- (--><?php //echo $issue->days_ago('last_activity') ?><!--)-->
122                <?php echo dformat(strtotime($thread->last_activity_date)) ?> (<?php echo datetime_h(strtotime($thread->last_activity_date)) ?>)
123            </td>
124			<td>
125				<?php if ($thread->close_date === NULL): ?>
126					<em>---</em>
127				<?php else: ?>
128					<?php echo dformat(strtotime($thread->close_date)) ?><br />
129					<?php $s = $tpl->getLang('report_priority').': '.datetime_h(strtotime($thread->close_date)) ?>
130					<?php echo str_replace(' ', '&nbsp;', $s) ?>
131<!--                    --><?php //echo dformat(strtotime($thread->close_date)) ?>
132				<?php endif ?>
133			</td>
134			<td>
135				<?php if ($thread->task_sum_cost === NULL): ?>
136					<em>---</em>
137				<?php else: ?>
138					<?php echo $thread->task_sum_cost ?>
139				<?php endif ?>
140			</td>
141			<td>
142		<a href="<?php echo $tpl->url('tasks', 'issue', $thread->id, 'state', 0) ?>">
143				<?php echo $thread->task_count - $thread->task_count_open ?>
144		</a>
145			/
146		<a href="<?php echo $tpl->url('tasks', 'issue', $thread->id) ?>">
147				<?php echo $thread->task_count ?>
148		</a>
149			</td>
150		</tr>
151	<?php endforeach ?>
152	<tr>
153		<th><?php echo $tpl->getLang('report_total') ?></th>
154		<td colspan="6"><?php echo $count ?></td>
155		<td colspan="3"><?php echo $total_cost ?></td>
156	</tr>
157</table>
158</div>
159