-
Notifications
You must be signed in to change notification settings - Fork 2
/
statistics.php
71 lines (48 loc) · 1.02 KB
/
statistics.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
<?php
require('app.php');
require('templates/header.php');
if(!in_array($User->rollnumber, array(11830, 9216))) {
echo '<div class="ui red segment"><h1>access denied, nerds only</h1></div>';
exit;
}
?>
<div class="ui red segment">
<h1>Statistics</h1>
</div>
<table class="ui celled striped table awards_table">
<thead>
<tr>
<th>Award</th>
<th>Nominated</th>
</tr>
</thead>
<tbody>
<?php
$awards = DB::query("SELECT * FROM awards");
foreach($awards as $award) {
$awardcount = DB::query("
SELECT *, COUNT(value) as value_count
FROM award_votes
WHERE award_id = %i
GROUP BY value
ORDER BY value_count DESC
LIMIT 10
", $award['id']);
?>
<tr>
<td><?=$award['award']?></td>
<td>
<?php
foreach($awardcount as $pupil) {
echo $pupil['value'] . " : " . $pupil['value_count'] . "<br/>";
}
?>
</td>
</tr>
<?php
}
?>
</tbody>
</table>
<?php
require('templates/footer.php');