-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstats.php
81 lines (76 loc) · 3.4 KB
/
stats.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
72
73
74
75
76
77
78
79
80
81
<?php
require_once('init.php');
$isHome = False;
$isStats = True;
?>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Setlist Scrobbler | Stats</title>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.min.css">
<link rel="stylesheet" href="css/main.css">
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/js/bootstrap.min.js"></script>
</head>
<body>
<?php require_once('header.php') ?>
<div class="container">
<h2 class="page-subheader">Stats</h2>
<p><b><?=$oDatabase->getActiveUserCount()?></b> active users have scrobbled <b><?=$oDatabase->getEventCount()?></b> events.</p>
<h2 class="page-subheader">Hall of Fame</h2>
<div class="table-responsive">
<table class="table table-striped table-bordered">
<thead>
<tr>
<th></th>
<th>User</th>
<th>Events Scrobbled</th>
</tr>
</thead>
<tbody>
<?php
$aUsers = $oDatabase->getUserEventCounts();
$position = 1;
foreach ($aUsers as $aUser) {
$username = $aUser['user_name'];
print('<tr>');
print('<td>' . $position++ . '</td>' );
print('<td><a target="_blank" href="http://www.last.fm/user/' . $username . '">' . $username . '</a></td>' );
print('<td>' . $aUser['event_count'] . '</td>');
print('</tr>');
}
?>
</tbody>
</table>
</div>
<h2 class="page-subheader">Events of Fame</h2>
<div class="table-responsive">
<table class="table table-striped table-bordered">
<thead>
<tr>
<th></th>
<th>User</th>
<th>Events Scrobbled</th>
</tr>
</thead>
<tbody>
<?php
$aEvents = $oDatabase->getTopEvents();
$position = 1;
foreach ($aEvents as $aEvent) {
$oEvent = Event::getInfo($aEvent['event_id']);
print('<tr>');
print('<td>' . $position++ . '</td>' );
print('<td><a target="_blank" href="' . $oEvent->getUrl() . '">' . $oEvent->getName() . '</a></td>' );
print('<td>' . $oEvent['event_count'] . '</td>');
print('</tr>');
}
?>
</tbody>
</table>
</div>
</div>
<?php require_once('footer.php') ?>
</body>
</html>