xref: /plugin/bez/tpl/activity_report.php (revision ff14b1073c2dab2f863cab3b8baf8b1a01f7993a)
1<h1 class="bez_report">
2<?php echo $tpl->getLang('activity_report') ?>
3</h1>
4
5<h2><?php echo $tpl->getLang('activity_in_issues') ?></h2>
6<table class="bez_sumarise">
7	<tr>
8		<th><?php echo $tpl->getLang('user') ?></th>
9		<th><?php echo $tpl->getLang('reporter') ?></th>
10		<th><?php echo $tpl->getLang('coordinator') ?></th>
11		<th><?php echo $tpl->getLang('commentator') ?></th>
12		<th><?php echo $tpl->getLang('executor') ?></th>
13		<th><?php echo $tpl->getLang('report_total') ?></th>
14	</tr>
15	<?php $reporter = 0 ?>
16	<?php $total_total = 0 ?>
17	<?php $commentator = 0 ?>
18	<?php $coordinator = 0 ?>
19	<?php $executor = 0 ?>
20	<?php foreach ($tpl->get('thread_involvement') as $involvement): ?>
21		<tr>
22			<td>
23                <?php echo $tpl->user_name($involvement['user_id']) ?>
24			</td>
25			<td><?php echo $involvement['SUM(original_poster)'] ?></td>
26			<td><?php echo $involvement['SUM(coordinator)'] ?></td>
27			<td><?php echo $involvement['SUM(commentator)'] ?></td>
28			<td><?php echo $involvement['SUM(task_assignee)'] ?></td>
29			<td><?php echo $involvement['COUNT(*)'] ?></td>
30		</tr>
31		<?php $reporter += $involvement['SUM(original_poster)'] ?>
32		<?php $coordinator += $involvement['SUM(coordinator)'] ?>
33        <?php $commentator += $involvement['SUM(commentator)'] ?>
34		<?php $executor += $involvement['SUM(task_assignee)'] ?>
35		<?php $total_total += $involvement['COUNT(*)'] ?>
36	<?php endforeach ?>
37	<tr>
38		<th><?php echo $tpl->getLang('report_total') ?></th>
39		<td><?php echo $reporter ?></td>
40		<td><?php echo $coordinator ?></td>
41        <td><?php echo $commentator ?></td>
42		<td><?php echo $executor ?></td>
43        <td><?php echo $total_total ?></td>
44	</tr>
45</table>
46<?php
47    if ($reporter !== 0) {
48        $kpi = $total_total/$reporter;
49    } else {
50        $kpi = 0;
51    }
52?>
53<p style="font-weight: bold">KPI = <?php echo sprintf("%.2f", $kpi) ?></p>
54
55
56<h2><?php echo $tpl->getLang('activity_in_tasks') ?></h2>
57<table class="bez_sumarise">
58	<tr>
59		<th><?php echo $tpl->getLang('user') ?></th>
60		<th><?php echo $tpl->getLang('reporter') ?></th>
61		<th><?php echo $tpl->getLang('commentator') ?></th>
62		<th><?php echo $tpl->getLang('executor') ?></th>
63		<th><?php echo $tpl->getLang('report_total') ?></th>
64	</tr>
65	<?php $reporter = 0 ?>
66	<?php $commentator = 0 ?>
67	<?php $executor = 0 ?>
68    <?php $total_total = 0 ?>
69	<?php foreach ($tpl->get('task_involvement') as $involvement): ?>
70		<tr>
71			<td>
72                <?php echo $tpl->user_name($involvement['user_id']) ?>
73			</td>
74			<td><?php echo $involvement['SUM(original_poster)'] ?></td>
75			<td><?php echo $involvement['SUM(commentator)'] ?></td>
76			<td><?php echo $involvement['SUM(assignee)'] ?></td>
77			<td><?php echo $involvement['COUNT(*)'] ?></td>
78			<?php $reporter += $involvement['SUM(original_poster)'] ?>
79			<?php $commentator += $involvement['SUM(commentator)'] ?>
80			<?php $executor += $involvement['SUM(assignee)'] ?>
81            <?php $total_total += $involvement['COUNT(*)'] ?>
82		</tr>
83	<?php endforeach ?>
84	<tr>
85		<th><?php echo $tpl->getLang('report_total') ?></th>
86		<td><?php echo $reporter ?></td>
87		<td><?php echo $commentator ?></td>
88		<td><?php echo $executor ?></td>
89		<td><?php echo $total_total ?></td>
90	</tr>
91</table>
92