forked from benjamw/pentago
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstats.php
More file actions
42 lines (33 loc) · 1.46 KB
/
stats.php
File metadata and controls
42 lines (33 loc) · 1.46 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
<?php
require_once 'includes/inc.global.php';
$meta['title'] = 'Statistics';
$meta['head_data'] = '
<script type="text/javascript" src="scripts/stats.js">></script>
';
$hints = array(
'View '.GAME_NAME.' Player statistics.' ,
);
$contents = '';
// grab the wins and losses for the players
$list = GamePlayer::get_list(true);
$table_meta = array(
'sortable' => true ,
'no_data' => '<p>There are no player stats to show</p>' ,
'caption' => 'Player Stats' ,
'init_sort_column' => array(1 => 1) ,
);
$table_format = array(
array('Player', 'username') ,
array('<abbr title="Silver | Red | Total">Wins</abbr>', '[[[white_wins]]] | [[[black_wins]]] | [[[wins]]]') ,
array('<abbr title="Silver | Red | Total">Draws</abbr>', '[[[white_draws]]] | [[[black_draws]]] | [[[draws]]]') ,
array('<abbr title="Silver | Red | Total">Losses</abbr>', '[[[white_losses]]] | [[[black_losses]]] | [[[losses]]]') ,
array('Win-Loss', '###([[[wins]]] - [[[losses]]])', null, ' class="color"') ,
array('Win %', '###((0 != ([[[wins]]] + [[[losses]]])) ? perc([[[wins]]] / ([[[wins]]] + [[[losses]]]), 1) : 0)') ,
array('Last Online', '###date(Settings::read(\'long_date\'), strtotime(\'[[[last_online]]]\'))', null, ' class="date"') ,
);
$contents .= get_table($table_format, $list, $table_meta);
// TODO: possibly add game stats ???
echo get_header($meta);
echo get_item($contents, $hints, $meta['title']);
call($GLOBALS);
echo get_footer( );