online graphic
This commit is contained in:
parent
fc1cd2cb9a
commit
fd0cdfd843
@ -1,2 +1,7 @@
|
||||
<?php
|
||||
class api_mojotrollz extends \SYSTEM\API\api_system {}
|
||||
class api_mojotrollz extends \SYSTEM\API\api_system {
|
||||
|
||||
public static function call_stats(){
|
||||
$result = \DBD\ONLINE_STATS::QA(array('3600'));
|
||||
return \SYSTEM\LOG\JsonResult::toString($result);}
|
||||
}
|
||||
|
||||
@ -1,5 +1,7 @@
|
||||
<?php
|
||||
class realm {
|
||||
public static function status(){
|
||||
return shell_exec('/home/mojotrolls/mojo_zero/realm status 2>&1');}
|
||||
$res = shell_exec('/home/mojotrolls/mojo_zero/realm status 2>&1');
|
||||
$res == '1' ? new WOW_STATS_ONLINE() : new WOW_STATS_OFLINE();
|
||||
return $res == '1' ? '<status>on</status>' : '<status>off</status>';}
|
||||
}
|
||||
@ -1,5 +1,7 @@
|
||||
<?php
|
||||
class world {
|
||||
public static function status(){
|
||||
return shell_exec('/home/mojotrolls/mojo_zero/world status 2>&1');}
|
||||
$res = shell_exec('/home/mojotrolls/mojo_zero/world status 2>&1');
|
||||
$res == '1' ? new WOW_STATS_ONLINE() : new WOW_STATS_OFLINE();
|
||||
return $res == '1' ? '<status>on</status>' : '<status>off</status>';}
|
||||
}
|
||||
|
||||
@ -1,9 +1,8 @@
|
||||
<?php
|
||||
|
||||
//keep this
|
||||
require_once dirname(__FILE__).'/path/register_path_classes.php';
|
||||
require_once dirname(__FILE__).'/page/register_page_classes.php';
|
||||
require_once dirname(__FILE__).'/dbd/autoload.inc.php';
|
||||
require_once dirname(__FILE__).'/api/autoload.inc.php';
|
||||
require_once dirname(__FILE__).'/docu/autoload.inc.php';
|
||||
require_once dirname(__FILE__).'/files/autoload.inc.php';
|
||||
require_once dirname(__FILE__).'/files/autoload.inc.php';
|
||||
require_once dirname(__FILE__).'/log/autoload.inc.php';
|
||||
@ -1,6 +1,7 @@
|
||||
<?php
|
||||
\SYSTEM\autoload::registerFolder(dirname(__FILE__).'/db/','DBD');
|
||||
\SYSTEM\autoload::registerFolder(dirname(__FILE__).'/tbl/','DBD');
|
||||
\SYSTEM\autoload::registerFolder(dirname(__FILE__).'/qq/','DBD');
|
||||
//$autoload->registerFolder(dirname(__FILE__).'/tbl/definitions/','DBD\DEFINITIONS');
|
||||
//$autoload->registerFolder(dirname(__FILE__).'/tbl/data/','DBD\DATA');
|
||||
//$autoload->registerFolder(dirname(__FILE__).'/tbl/data_processed/','DBD\DATA_PROCESSED');
|
||||
18
mojotrollz/dbd/qq/ONLINE_STATS.php
Normal file
18
mojotrollz/dbd/qq/ONLINE_STATS.php
Normal file
@ -0,0 +1,18 @@
|
||||
<?php
|
||||
namespace DBD;
|
||||
|
||||
class ONLINE_STATS extends \SYSTEM\DB\QP {
|
||||
protected static function query(){
|
||||
return new \SYSTEM\DB\QQuery(get_class(),
|
||||
//pg
|
||||
'',
|
||||
//mys
|
||||
'SELECT DATE_FORMAT(FROM_UNIXTIME(UNIX_TIMESTAMP('.\SYSTEM\DBD\system_log::FIELD_TIME.') - MOD(UNIX_TIMESTAMP('.\SYSTEM\DBD\system_log::FIELD_TIME.'),?)),"%Y/%m/%d %H:%i:%s") as day,'
|
||||
.'sum(case when '.\SYSTEM\DBD\system_log::FIELD_CLASS.' = \'WOW_STATS_ONLINE\' then 1 else 0 end) online,'
|
||||
.'sum(case when '.\SYSTEM\DBD\system_log::FIELD_CLASS.' = \'WOW_STATS_OFLINE\' then 1 else 0 end) Ofline'
|
||||
.' FROM '.\SYSTEM\DBD\system_log::NAME_MYS
|
||||
.' GROUP BY day'
|
||||
.' ORDER BY day DESC'
|
||||
.' LIMIT 30;'
|
||||
);}}
|
||||
|
||||
2
mojotrollz/log/WOW_STATS_OFLINE.php
Normal file
2
mojotrollz/log/WOW_STATS_OFLINE.php
Normal file
@ -0,0 +1,2 @@
|
||||
<?php
|
||||
class WOW_STATS_OFLINE extends \SYSTEM\LOG\INFO {}
|
||||
2
mojotrollz/log/WOW_STATS_ONLINE.php
Normal file
2
mojotrollz/log/WOW_STATS_ONLINE.php
Normal file
@ -0,0 +1,2 @@
|
||||
<?php
|
||||
class WOW_STATS_ONLINE extends \SYSTEM\LOG\INFO {}
|
||||
6
mojotrollz/log/WOW_STATS_PLAYER.php
Normal file
6
mojotrollz/log/WOW_STATS_PLAYER.php
Normal file
@ -0,0 +1,6 @@
|
||||
<?php
|
||||
class WOW_STATS_PLAYER extends \SYSTEM\LOG\INFO {
|
||||
public function __construct($player_count){
|
||||
parent::__construct($player_count);}
|
||||
}
|
||||
|
||||
2
mojotrollz/log/autoload.inc.php
Normal file
2
mojotrollz/log/autoload.inc.php
Normal file
@ -0,0 +1,2 @@
|
||||
<?php
|
||||
SYSTEM\autoload::registerFolder(dirname(__FILE__),'');
|
||||
@ -8,7 +8,10 @@ class default_page extends SYSTEM\PAGE\Page {
|
||||
'<script type="text/javascript" language="JavaScript" src="'.SYSTEM\WEBPATH(new PLIB(),'jqbootstrapvalidation/jqBootstrapValidation.js').'"></script>'.
|
||||
'<script type="text/javascript" language="JavaScript" src="'.SYSTEM\WEBPATH(new PLIB(),'hashmask/jquery.sha1.js').'"></script>'.
|
||||
'<script type="text/javascript" language="JavaScript" src="'.SYSTEM\WEBPATH(new PLIB(),'hashmask/jquery.md5.js').'"></script>'.
|
||||
'<script src="https://www.google.com/jsapi" type="text/javascript"></script>'.
|
||||
'<script type="text/javascript">google.load("visualization", "1", {packages:["corechart"]});</script>'.
|
||||
'<script type="text/javascript" language="JavaScript" src="'.SYSTEM\WEBPATH(new PPAGE(),'default_page/js/wizard.js').'"></script>'.
|
||||
'<script type="text/javascript" language="JavaScript" src="'.SYSTEM\WEBPATH(new PPAGE(),'default_page/js/onlinegraphic.js').'"></script>'.
|
||||
'<script type="text/javascript" language="JavaScript" src="'.SYSTEM\WEBPATH(new PPAGE(),'wizard_details/js/wizard_details.js').'"></script>'.
|
||||
'<script type="text/javascript" language="JavaScript" src="'.SYSTEM\WEBPATH(new PPAGE(),'wizard_spawn/js/wizard_spawn.js').'"></script>';
|
||||
}
|
||||
|
||||
@ -27,4 +27,5 @@
|
||||
type="submit"
|
||||
id="login_submit">${basic_login}</button>
|
||||
</div>
|
||||
</form>
|
||||
</form>
|
||||
<div id="onlinestats"></div>
|
||||
22
mojotrollz/page/default_page/js/onlinegraphic.js
Normal file
22
mojotrollz/page/default_page/js/onlinegraphic.js
Normal file
@ -0,0 +1,22 @@
|
||||
function load_visualisation(id){
|
||||
$.getJSON('./api.php?call=stats',function(json){
|
||||
if(!json || json.status != true || !json.result){
|
||||
return;
|
||||
}
|
||||
json = json.result;
|
||||
var data = new google.visualization.DataTable();
|
||||
first = true;
|
||||
$.each(json[0], function(key, value){
|
||||
if(first){
|
||||
data.addColumn('datetime',key);
|
||||
first = false;
|
||||
} else {
|
||||
data.addColumn('number',key);
|
||||
}
|
||||
});
|
||||
$.each(json, function(key, value){first = true; data.addRow($.map(value, function(v) { if(first){first=false;return [new Date(v)];}else{return [(v == null || parseFloat(v) <= 0) ? 0 : parseFloat(v)];}}));});
|
||||
|
||||
var options = {title: id, backgroundColor: 'darkslategrey', aggregationTarget: 'category', selectionMode: 'multiple', curveType: 'function', /*focusTarget: 'category',*/ chartArea:{left:20,top:40}, interpolateNulls: false, height: "200"};
|
||||
new google.visualization.LineChart(document.getElementById(id)).draw(data, options);
|
||||
});
|
||||
}
|
||||
@ -22,6 +22,7 @@ $(document).ready(function() {
|
||||
$('#start a').click(function() {
|
||||
load_wizard_details();});
|
||||
|
||||
load_visualisation('onlinestats');
|
||||
});
|
||||
|
||||
function load_wizard_details(){
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user