-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathstats.php
More file actions
91 lines (83 loc) · 2.08 KB
/
stats.php
File metadata and controls
91 lines (83 loc) · 2.08 KB
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
82
83
84
85
86
87
88
89
90
91
<?php
include_once 'jukebox-common.php';
$pluginName = 'jukebox';
$songCounts = convertAndGetSettings($pluginName . "-counts");
ksort($songCounts);
?>
<head>
<meta http-equiv="refresh" content="30">
<style>
.table {
width: 100%;
max-width: 100%;
margin-bottom: 1rem;
background-color: transparent;
}
.table-bordered {
border: 1px solid #dee2e6;
}
.table td,
.table th {
padding: 0.75rem;
vertical-align: top;
border-top: 1px solid #dee2e6;
}
.table-bordered td,
.table-bordered th {
border: 1px solid #dee2e6;
}
.table thead th {
vertical-align: bottom;
border-bottom: 2px solid #dee2e6;
}
</style>
</head>
<body>
<p>What is your most popular song being played.</p>
<table class="table table-bordered">
<thead>
<tr>
<th>Song Name</th>
<th>Played</th>
</tr>
</thead>
<tbody>
<?php foreach ($songCounts as $count) { ?>
<tr>
<td><?php echo $count['name']; ?></td>
<td><?php echo $count['count']; ?></td>
</tr>
<?php } ?>
</tbody>
</table>
<input id="clear_stats" class="buttons" value="Clear Stats">
<script>
$(function() {
$("#clear_stats").on("click", function(e) {
e.preventDefault();
var stats = [];
$.ajax({
type: "POST",
url: 'plugin.php?plugin=fpp-jukebox&page=other.php&command=clear_stats&nopage=1',
dataType: 'json',
async: false,
data: JSON.stringify(stats),
processData: false,
contentType: 'application/json',
success: function(data) {
$.jGrowl('Stats cleared', {
themeState: 'success'
});
setTimeout(function() {
location.reload();
}, 3000);
},
error: function() {
$('#save').prop('disabled', false);
DialogError('Error', "ERROR: There was an error in saving your details, please try again!");
}
});
});
});
</script>
</body>