-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgloryhall.php
63 lines (49 loc) · 1.57 KB
/
gloryhall.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
<?
require_once dirname(__FILE__) . '/lib/access.php';
if (!accessTest()) {
Header('Location: /index.php?code=69');
exit(0);
}
require_once dirname(__FILE__) . '/classes/User.php';
require_once dirname(__FILE__) . '/classes/Leaderboard.php';
$data = Leaderboard::getGloryHall();
$upper_bracket = array();
$middle_bracket = array();
$lower_bracket = array();
$maxCount = max(array_column($data, 'count'));
$minCount = min(array_column($data, 'count'));
foreach ($data as $item) {
if ($item['count'] == $maxCount) {
$upper_bracket[] = $item;
} elseif ($item['count'] == $minCount) {
$lower_bracket[] = $item;
} else {
$middle_bracket[] = $item;
}
}
function compile_row($item) {
return $item['user']->getSNnbsp() . " " . str_repeat("🏆", $item['count']);
}
?><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<? include dirname(__FILE__) . '/templates/head.php'; ?>
<body>
<div class="container">
<? include 'templates/menu.php'; ?>
<div class="row" style="margin-top: 100px; margin-bottom: 100px">
<div class="span6 offset3">
<? foreach ($upper_bracket as $item) { ?>
<h1><?= compile_row($item) ?></h1>
<? } ?>
<? foreach ($middle_bracket as $item) { ?>
<h2><?= compile_row($item) ?></h2>
<? } ?>
<? foreach ($lower_bracket as $item) { ?>
<h3><?= compile_row($item) ?></h3>
<? } ?>
</div>
</div>
</div>
<? include dirname(__FILE__) . '/templates/bottom.php'; ?>
</body>
</html>