forked from RetroAchievements/RAWeb
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdeveloperstats.php
More file actions
146 lines (126 loc) · 3.98 KB
/
developerstats.php
File metadata and controls
146 lines (126 loc) · 3.98 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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
<?php
require_once('db.inc.php');
RA_ReadCookieCredentials( $user, $points, $truePoints, $unreadMessageCount, $permissions );
$playersOnlineCSV = file_get_contents( "./cronjobs/playersonline.log" );
$playersCSV = preg_split('/\n|\r\n?/', $playersOnlineCSV);
$hoursInADay = 24;
$numDays = 2;
$numDataPoints = 2 * $hoursInADay * $numDays; // 2 30segments * 24hrs * 2 days worth
//$playersOnlineArray = Array();
//for( $i = 0; $i < $numDataPoints; $i++ )
// $playersOnlineArray[] = $playersCSV[count($playersCSV)-($i+2)];
$staticData = getStaticData();
$errorCode = seekGET( 'e' );
$type = seekGET( 't', 0 );
RenderDocType();
?>
<head>
<!--Load the AJAX API-->
<script type="text/javascript" src="https://www.google.com/jsapi"></script>
<script type="text/javascript">
// Load the Visualization API and the piechart package.
//google.load('visualization', '1.0', {'packages':['corechart']});
// Set a callback to run when the Google Visualization API is loaded.
//google.setOnLoadCallback(drawCharts);
// Callback that creates and populates a data table,
// instantiates the pie chart, passes in the data and
// draws it.
// function drawCharts()
// {
// var dataTotalScore = new google.visualization.DataTable();
//
// // Declare columns
// dataTotalScore.addColumn('datetime', 'Time');
// dataTotalScore.addColumn('number', 'Players Online');
// dataTotalScore.addColumn('number', 'Players Online Yesterday');
//
// dataTotalScore.addRows([
// <?php
// $largestWonByCount = 0;
// $count = 0;
// $now = date("Y/m/d G:0:0");
// //error_log( $now );
//
// for( $i = 0; $i < $hoursInADay; $i++ )
// {
// $numPlayers = $playersOnlineArray[$i];
// $numPlayersYDay = $playersOnlineArray[$i+$hoursInADay];
//
// if( $i != 0 )
// echo ", ";
//
// $mins = $i * 30;
//
// $timestamp = strtotime("-$mins minutes", strtotime($now));
//
// $yr = date("Y", $timestamp);
// $month = date("m", $timestamp);
// $day = date("d", $timestamp);
// $hour = date("G", $timestamp);
// $min = date("i", $timestamp);
//
// echo "[ new Date($yr,$month,$day,$hour,$min), {v:$numPlayers, f:\"$numPlayers online\"}, {v:$numPlayersYDay, f:\"$numPlayersYDay online yesterday\"} ] ";
// }
// ?>
// ]);
//
// <?php //
// $numGridlines = $hoursInADay;
// ?>
//
// var optionsTotalScore = {
// backgroundColor: 'transparent',
// //title: 'Achievement Distribution',
// titleTextStyle: {color: '#186DEE'}, //cc9900
// //hAxis: {textStyle: {color: '#186DEE'}, gridlines:{count:24, color: '#334433'}, minorGridlines:{count:0}, format:'#', slantedTextAngle:90, maxAlternation:0 },
// hAxis: {textStyle: {color: '#186DEE'} },
// vAxis: {textStyle: {color: '#186DEE'}, viewWindow:{min:0}, format: '#' },
// legend: {position: 'none' },
// chartArea: {'width': '85%', 'height': '78%'},
// height: 260,
// colors: ['#cc9900'],
// pointSize: 3
// };
//
// function resize ()
// {
// chartScoreProgress = new google.visualization.AreaChart(document.getElementById('chart_usersonline'));
// chartScoreProgress.draw(dataTotalScore, optionsTotalScore);
//
// //google.visualization.events.addListener(chartScoreProgress, 'select', selectHandlerScoreProgress );
// }
//
// window.onload = resize();
// window.onresize = resize;
// }
</script>
<?php
RenderSharedHeader( $user );
RenderTitleTag( "Developer Stats", $user );
RenderGoogleTracking();
?>
</head>
<body>
<?php
RenderTitleBar( $user, $points, $truePoints, $unreadMessageCount, $errorCode );
RenderToolbar( $user, $permissions );
?>
<div id='mainpage'>
<div id='leftcontainer'>
<?php
RenderErrorCodeWarning( 'left', $errorCode );
RenderDeveloperStats( $user, $type );
echo "<h3>Users Online</h3>";
//echo "<div id='chart_usersonline'></div>";
?>
</div>
<div id='rightcontainer'>
<?php
RenderStaticDataComponent( $staticData );
RenderRecentlyUploadedComponent( 10 );
?>
</div>
</div>
<?php RenderFooter(); ?>
</body>
</html>