xref: /plugin/bez/tpl/threads.php (revision 53df74e7ac5ae4234aac1fa716a33878a039026f)
1<?php /* @var \dokuwiki\plugin\bez\meta\Tpl $tpl */ ?>
2
3<?php if ($tpl->acl('thread', 'id') >= BEZ_PERMISSION_CHANGE): ?>
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('threads') ?>" 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
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
58	<label><?php echo $tpl->getLang('coordinator') ?>:
59		<select name="coordinator">
60			<option <?php if ($tpl->value('coordinator') === '-all') echo 'selected' ?>
61				value="-all">--- <?php echo $tpl->getLang('all') ?> ---</option>
62			<option <?php if ($tpl->value('coordinator') === '-none') echo 'selected' ?>
63				value="-none">--- <?php echo $tpl->getLang('none') ?> ---</option>
64		<optgroup label="<?php echo $tpl->getLang('users') ?>">
65			<?php foreach ($tpl->get('users') as $nick => $name): ?>
66				<option <?php if ($tpl->value('coordinator') === $nick) echo 'selected' ?>
67					value="<?php echo $nick ?>"><?php echo $name ?></option>
68			<?php endforeach ?>
69	</optgroup>
70	<optgroup label="<?php echo $tpl->getLang('groups') ?>">
71		<?php foreach ($tpl->get('groups') as $name): ?>
72			<?php $group = "@$name" ?>
73			<option <?php if ($tpl->value('coordinator') === $group) echo 'selected' ?>
74				value="<?php echo $group ?>"><?php echo $group ?></option>
75		<?php endforeach ?>
76	</optgroup>
77	</select>
78	</label>
79
80	<label><?php echo $tpl->getLang('title') ?>:
81		<input name="title" value="<?php echo $tpl->value('title') ?>" />
82	</label>
83
84
85	<label><?php echo $tpl->getLang('year') ?>:
86		<select name="year">
87			<option <?php if ($tpl->value('year') === '-all') echo 'selected' ?>
88				value="-all">--- <?php echo $tpl->getLang('all') ?> ---</option>
89		<?php foreach ($tpl->get('years') as $year): ?>
90			<option <?php if ($tpl->value('year') === $year) echo 'selected' ?>
91				value="<?php echo $year ?>"><?php echo $year ?></option>
92		<?php endforeach ?>
93		</select>
94	</label>
95
96	<label><?php echo $tpl->getLang('sort_by_open_date') ?>:
97			<input type="checkbox" name="sort_open"
98			<?php if ($tpl->value('sort_open') === 'on') echo 'checked="checked"' ?>>
99	</label>
100	<label><input type="submit" value="<?php echo $tpl->getLang('filter') ?>" /></label>
101</form>
102</div>
103
104<table class="bez bez_sumarise">
105	<tr>
106		<th><?php echo $tpl->getLang('id') ?></th>
107		<th><?php echo $tpl->getLang('state') ?></th>
108		<th><?php echo $tpl->getLang('type') ?></th>
109		<th><?php echo $tpl->getLang('title')?></th>
110		<th><?php echo $tpl->getLang('coordinator') ?></th>
111		<th><?php echo $tpl->getLang('date') ?></th>
112		<th><?php echo $tpl->getLang('last_mod_date') ?></th>
113		<th><?php echo $tpl->getLang('closed') ?></th>
114		<th><?php echo $tpl->getLang('cost') ?></th>
115		<th><?php echo $tpl->getLang('closed_tasks') ?></th>
116	</tr>
117    <?php $count = 0 ?>
118    <?php $total_cost = 0.0 ?>
119	<?php foreach ($tpl->get('threads') as $thread): ?>
120        <?php if ($thread->acl_of('id') < BEZ_PERMISSION_VIEW) continue ?>
121        <?php $count += 1 ?>
122        <?php $total_cost += (float) $thread->task_sum_cost ?>
123		<tr class="pr<?php
124            if ($thread->state != 'opened') {
125                echo '-1';
126            } elseif($thread->priority != '') {
127                echo $thread->priority;
128            } else {
129                echo 'None';
130            }
131        ?>">
132			<td>
133				<a href="<?php echo $tpl->url('thread', 'id', $thread->id) ?>">
134                    #<?php echo $thread->id ?>
135                </a>
136			</td>
137			<td>
138			<?php echo $tpl->getLang('state_'.$thread->state) ?>
139			</td>
140			<td>
141				<?php if ($thread->label_name === NULL): ?>
142					<i style="color: #777"><?php echo $tpl->getLang('issue_type_no_specified') ?></i>
143				<?php else: ?>
144					<?php echo $thread->label_name ?>
145				<?php endif ?>
146			</td>
147			<td><?php echo $thread->title ?></td>
148			<td>
149                <?php if ($thread->coordinator === NULL): ?>
150                    <i style="color: #777"><?php echo $tpl->getLang('none') ?></i>
151                <?php else: ?>
152                    <?php echo $tpl->user_name($thread->coordinator) ?>
153                <?php endif ?>
154            </td>
155            <td>
156                <?php echo $tpl->date($thread->create_date) ?>
157            </td>
158            <td>
159                <?php echo $tpl->date($thread->last_activity_date) ?>
160            </td>
161			<td>
162				<?php if ($thread->close_date === NULL): ?>
163					<em>---</em>
164				<?php else: ?>
165					<?php echo $tpl->date($thread->close_date) ?><br />
166					<?php $s = $tpl->getLang('report_priority').': ' .
167                        $tpl->date_diff_days($tpl->get('thread')->create_date,
168                                             $tpl->get('thread')->close_date, '%a') ?>
169					<?php echo str_replace(' ', '&nbsp;', $s) ?>
170				<?php endif ?>
171			</td>
172			<td>
173				<?php if ($thread->task_sum_cost === NULL): ?>
174					<em>---</em>
175				<?php else: ?>
176					<?php echo $thread->task_sum_cost ?>
177				<?php endif ?>
178			</td>
179			<td>
180                <?php echo $thread->task_count_closed ?> / <?php echo $thread->task_count ?>
181
182			</td>
183		</tr>
184	<?php endforeach ?>
185	<tr>
186		<th><?php echo $tpl->getLang('report_total') ?></th>
187		<td colspan="6"><?php echo $count ?></td>
188		<td colspan="3"><?php echo $total_cost ?></td>
189	</tr>
190</table>
191