-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgames.php
More file actions
61 lines (51 loc) · 1.25 KB
/
Copy pathgames.php
File metadata and controls
61 lines (51 loc) · 1.25 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
<?php
require_once __DIR__ . '/lib/config.php';
echo html::menu();
// Get filter vars.
$filter = get_timefilter(false);
$usefilter = false;
if (isset($filter['sql'])) {
$usefilter = true;
echo html::filter($filter);
}
// Define table columns.
$table['cols'] = ['Date',
'Winner',
'G+',
'G-',
'Loser'
];
// sELO or ELO?
if ($filter['col'] == 'season') {
$table['cols'][] = 'sELO';
$s_elo = true;
} else {
$table['cols'][] = 'ELO';
$s_elo = false;
}
// Build SQL.
$sql = "SELECT * FROM games ";
if ($usefilter) {
$sql .= $filter['sql'];
}
$sql .= " ORDER BY timestamp DESC";
$games = $DB->query($sql)->fetchAll();
// Table rows.
$table['rows'] = [];
foreach ($games as $game) {
$row = html::game_row($game, $s_elo);
$table['rows'][] = $row;
}
echo html::table($table);
?>
<a class="button add-button" href="./addgame.php"></a>
<a class="button remove-button" href="./removegame.php"></a>
<script>
$(document).ready(function() {
var dtOptions = <?php echo json_encode($datatables_config); ?>;
dtOptions.order = [[0, 'desc']];
dtOptions.language.info = '_TOTAL_ games';
$('#table').DataTable(dtOptions);
});
</script>
<?php echo html::footer();?>