xref: /plugin/bez/tpl/threads.php (revision 6f38077355681f273cc9db672efab6fff436baea)
1<?php /* @var \dokuwiki\plugin\bez\meta\Tpl $tpl */ ?>
2
3<?php if ($tpl->factory('thread')->permission() >= BEZ_TABLE_PERMISSION_INSERT): ?>
4    <a href="<?php echo $tpl->url('thread_report', 'type', $tpl->action() == 'projects' ? 'project' : 'issue') ?>" class="bez_start_button" id="bez_report_issue_button">
5        <?php echo $tpl->getLang('report_' . $tpl->action()) ?>
6    </a>
7<?php endif ?>
8
9<br /><br />
10
11<div class="bez_filter_form">
12<form action="<?php echo $tpl->url($tpl->action()) ?>" method="post">
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('state') ?>:
35		<select name="state">
36			<option <?php if ($tpl->value('state') === '-all') echo 'selected' ?>
37				value="-all">--- <?php echo $tpl->getLang('all') ?> ---</option>
38		<?php foreach (\dokuwiki\plugin\bez\mdl\Thread::get_states() as $state): ?>
39			<option <?php if ($tpl->value('state') === $state) echo 'selected' ?>
40				value="<?php echo $state ?>"><?php echo $tpl->getLang('state_' . $state) ?></option>
41		<?php endforeach ?>
42		</select>
43	</label>
44    <?php if ($tpl->action() != 'projects'): ?>
45        <label><?php echo $tpl->getLang('just_type') ?>:
46            <select name="label_id">
47                <option <?php if ($tpl->value('label_id') === '-all') echo 'selected' ?>
48                    value="-all">--- <?php echo $tpl->getLang('all') ?> ---</option>
49                <option <?php if ($tpl->value('label_id') === '-none') echo 'selected' ?>
50                value="-none">--- <?php echo $tpl->getLang('issue_type_no_specified') ?> ---</option>
51            <?php foreach ($tpl->get('labels') as $label): ?>
52                <option <?php if ($tpl->value('label_id') === $label->id) echo 'selected' ?>
53                    value="<?php echo $label->id ?>"><?php echo $label->name ?></option>
54            <?php endforeach ?>
55            </select>
56        </label>
57    <?php endif ?>
58
59	<label><?php echo $tpl->getLang('coordinator') ?>:
60		<select name="coordinator">
61			<option <?php if ($tpl->value('coordinator') === '-all') echo 'selected' ?>
62				value="-all">--- <?php echo $tpl->getLang('all') ?> ---</option>
63			<option <?php if ($tpl->value('coordinator') === '-none') echo 'selected' ?>
64				value="-none">--- <?php echo $tpl->getLang('none') ?> ---</option>
65		<optgroup label="<?php echo $tpl->getLang('users') ?>">
66			<?php foreach ($tpl->get('users') as $nick => $name): ?>
67				<option <?php if ($tpl->value('coordinator') === $nick) echo 'selected' ?>
68					value="<?php echo $nick ?>"><?php echo $name ?></option>
69			<?php endforeach ?>
70	</optgroup>
71	<optgroup label="<?php echo $tpl->getLang('groups') ?>">
72		<?php foreach ($tpl->get('groups') as $name): ?>
73			<?php $group = "@$name" ?>
74			<option <?php if ($tpl->value('coordinator') === $group) echo 'selected' ?>
75				value="<?php echo $group ?>"><?php echo $group ?></option>
76		<?php endforeach ?>
77	</optgroup>
78	</select>
79	</label>
80
81	<label><?php echo $tpl->getLang('title') ?>:
82		<input name="title" value="<?php echo $tpl->value('title') ?>" />
83	</label>
84
85
86	<label><?php echo $tpl->getLang('year') ?>:
87		<select name="year">
88			<option <?php if ($tpl->value('year') === '-all') echo 'selected' ?>
89				value="-all">--- <?php echo $tpl->getLang('all') ?> ---</option>
90		<?php foreach ($tpl->get('years') as $year): ?>
91			<option <?php if ($tpl->value('year') === $year) echo 'selected' ?>
92				value="<?php echo $year ?>"><?php echo $year ?></option>
93		<?php endforeach ?>
94		</select>
95	</label>
96
97	<label><?php echo $tpl->getLang('sort_by_open_date') ?>:
98			<input type="checkbox" name="sort_open"
99			<?php if ($tpl->value('sort_open') === 'on') echo 'checked="checked"' ?>>
100	</label>
101	<label><input type="submit" value="<?php echo $tpl->getLang('filter') ?>" /></label>
102</form>
103</div>
104
105<table class="bez bez_sumarise">
106	<tr>
107		<th><?php echo $tpl->getLang('id') ?></th>
108		<th><?php echo $tpl->getLang('state') ?></th>
109        <?php if ($tpl->action() != 'projects'): ?>
110		    <th><?php echo $tpl->getLang('type') ?></th>
111        <?php endif ?>
112		<th><?php echo $tpl->getLang('title')?></th>
113		<th><?php echo $tpl->getLang('coordinator') ?></th>
114		<th><?php echo $tpl->getLang('date') ?></th>
115		<th><?php echo $tpl->getLang('last_mod_date') ?></th>
116		<th><?php echo $tpl->getLang('closed') ?></th>
117		<th><?php echo $tpl->getLang('cost') ?></th>
118		<th><?php echo $tpl->getLang('closed_tasks') ?></th>
119	</tr>
120    <?php $count = 0 ?>
121    <?php $total_cost = 0.0 ?>
122	<?php foreach ($tpl->get('threads') as $thread): ?>
123        <?php if ($thread->acl_of('id') < BEZ_PERMISSION_VIEW) continue ?>
124        <?php $count += 1 ?>
125        <?php $total_cost += (float) $thread->task_sum_cost ?>
126		<tr class="<?php
127            if ($thread->state == 'opened') {
128                echo 'priority_' . $thread->priority;
129            } elseif ($thread->state == 'proposal') {
130                echo 'priority_';
131            }
132        ?>">
133			<td style="white-space: nowrap">
134                <a href="<?php echo $tpl->url('thread', 'id', $thread->id) ?>">#<?php echo $thread->id ?></a>
135                <?php if($thread->private == '1'): ?>
136                    <?php echo inlineSVG(DOKU_PLUGIN . 'bez/images/lock-small.svg') ?>
137                <?php endif ?>
138			</td>
139			<td>
140			<?php echo $tpl->getLang('state_'.$thread->state) ?>
141			</td>
142            <?php if ($tpl->action() != 'projects'): ?>
143                <td>
144                    <?php if ($thread->label_name === NULL): ?>
145                        <i style="color: #777"><?php echo $tpl->getLang('issue_type_no_specified') ?></i>
146                    <?php else: ?>
147                        <?php echo $thread->label_name ?>
148                    <?php endif ?>
149                </td>
150            <?php endif ?>
151			<td><?php echo $thread->title ?></td>
152			<td>
153                <?php if ($thread->coordinator === NULL): ?>
154                    <i style="color: #777"><?php echo $tpl->getLang('none') ?></i>
155                <?php else: ?>
156                    <?php echo $tpl->user_name($thread->coordinator) ?>
157                <?php endif ?>
158            </td>
159            <td>
160                <?php echo $tpl->date($thread->create_date) ?>
161            </td>
162            <td>
163                <?php echo $tpl->date($thread->last_activity_date) ?>
164            </td>
165			<td>
166				<?php if ($thread->close_date === NULL): ?>
167					<em>---</em>
168				<?php else: ?>
169					<?php echo $tpl->date($thread->close_date) ?><br />
170					<?php $s = $tpl->getLang('report_priority').': ' .
171                        $tpl->date_diff_days($thread->create_date, $thread->close_date, '%a') ?>
172					<?php echo str_replace(' ', '&nbsp;', $s) ?>
173				<?php endif ?>
174			</td>
175			<td>
176				<?php if ($thread->task_sum_cost === NULL): ?>
177					<em>---</em>
178				<?php else: ?>
179					<?php echo $thread->task_sum_cost ?>
180				<?php endif ?>
181			</td>
182			<td>
183                <?php echo $thread->task_count_closed ?> / <?php echo $thread->task_count ?>
184
185			</td>
186		</tr>
187	<?php endforeach ?>
188	<tr>
189		<th><?php echo $tpl->getLang('report_total') ?></th>
190		<td colspan="7"><?php echo $count ?></td>
191		<td colspan="3"><?php echo $total_cost ?></td>
192	</tr>
193</table>
194