xref: /plugin/bez/tpl/threads.php (revision 038c5d4a6a969d879580f53f12ade1bfabd5474f)
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="pr<?php
127            if ($thread->state != 'opened') {
128                echo '-1';
129            } elseif($thread->priority != '') {
130                echo $thread->priority;
131            } else {
132                echo 'None';
133            }
134        ?>">
135			<td>
136				<a href="<?php echo $tpl->url('thread', 'id', $thread->id) ?>">
137                    #<?php echo $thread->id ?>
138                </a>
139			</td>
140			<td>
141			<?php echo $tpl->getLang('state_'.$thread->state) ?>
142			</td>
143            <?php if ($tpl->action() != 'projects'): ?>
144                <td>
145                    <?php if ($thread->label_name === NULL): ?>
146                        <i style="color: #777"><?php echo $tpl->getLang('issue_type_no_specified') ?></i>
147                    <?php else: ?>
148                        <?php echo $thread->label_name ?>
149                    <?php endif ?>
150                </td>
151            <?php endif ?>
152			<td><?php echo $thread->title ?></td>
153			<td>
154                <?php if ($thread->coordinator === NULL): ?>
155                    <i style="color: #777"><?php echo $tpl->getLang('none') ?></i>
156                <?php else: ?>
157                    <?php echo $tpl->user_name($thread->coordinator) ?>
158                <?php endif ?>
159            </td>
160            <td>
161                <?php echo $tpl->date($thread->create_date) ?>
162            </td>
163            <td>
164                <?php echo $tpl->date($thread->last_activity_date) ?>
165            </td>
166			<td>
167				<?php if ($thread->close_date === NULL): ?>
168					<em>---</em>
169				<?php else: ?>
170					<?php echo $tpl->date($thread->close_date) ?><br />
171					<?php $s = $tpl->getLang('report_priority').': ' .
172                        $tpl->date_diff_days($thread->create_date, $thread->close_date, '%a') ?>
173					<?php echo str_replace(' ', '&nbsp;', $s) ?>
174				<?php endif ?>
175			</td>
176			<td>
177				<?php if ($thread->task_sum_cost === NULL): ?>
178					<em>---</em>
179				<?php else: ?>
180					<?php echo $thread->task_sum_cost ?>
181				<?php endif ?>
182			</td>
183			<td>
184                <?php echo $thread->task_count_closed ?> / <?php echo $thread->task_count ?>
185
186			</td>
187		</tr>
188	<?php endforeach ?>
189	<tr>
190		<th><?php echo $tpl->getLang('report_total') ?></th>
191		<td colspan="7"><?php echo $count ?></td>
192		<td colspan="3"><?php echo $total_cost ?></td>
193	</tr>
194</table>
195