You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

57 lines
2.4 KiB

<?php
require_once('../ajax_asm.php');
if( $CUser->Data['id'] > 1 ){
$STS = intval( $_POST['DTS'] );
if( isset( $_POST['STT'] ) ){
$STT = intval( $_POST['STT'] );
} else $STT = 0;
if( $STS ){
//$TZ = new DateTimeZone( date_default_timezone_get() );
//$DT = new DateTime("now", $TZ );
//$DIDI = $TZ->getOffset( $DT );
//$DTS += $DIDI;
$ETS = $STS + 86400;
//$Y = date("Y", $DTS );
//$M = date("m", $DTS );
//$D = date("d", $DTS );
//$DS = date("Y/m/d", $DTS );
$SECTIONS = array();
$QS = "SELECT * FROM `metro_platforms` WHERE `station_id`={$STT} ORDER BY `index`";
$JU = $DATABASE->Query( $QS );
if( count($JU) ){
foreach( $JU as $CP ){
//$QS = "SELECT * FROM `sessions` WHERE `final`='Y' AND `track_id` IN (SELECT DISTINCT `id` FROM `metro_tracks` AND `platform_id` IN ( SELECT DISTINCT `id` FROM `metro_platforms` WHERE `station_id`={$STT} )) ORDER BY `ts`*1000+`ts_ms`";
$QS = "SELECT * FROM `sessions` WHERE `ts` >= {$STS} AND `ts` <= {$ETS} AND `final`='Y' AND `track_id` IN ( SELECT DISTINCT `id` FROM `metro_tracks` WHERE `platform_id`={$CP['id']}) ORDER BY `ts`*1000+`ts_ms`";
$RR = $DATABASE->Query( $QS );
$S = count( $RR );
$V = 0;//intval( $RR[0]['v'] );
$E = 0;//intval( $RR[0]['e'] );
if( $S ){
$JIGA = array();
foreach( $RR as $R ){
$V += intval( $R['vid_cnt']);
$E += intval( $R['evt_cnt']);
$QS = "SELECT `short` FROM `metro_tracks` WHERE `id`={$R['track_id']}";
$ZD = $DATABASE->Query( $QS );
$BTM = "[{$ZD[0]['short']}]&nbsp;".date( "H:i:s", $R['ts'] );
$SID = intval( $R['id']);
$LABEL = "<table><tr><td style=\"background-image: url(/style/wicons/046.png);background-size: 16px 16px;background-repeat: no-repeat;background-position: 6px 4px;\">&nbsp;<td>{$R['vid_cnt']}</td><td>{$R['evt_cnt']}</td></tr></table>";
$JIGA[] = "{ id: 'tn_{$SID}', text: '{$BTM}', qtip: '{$LABEL}', iconCls: 'ses_stat_{$R['status']}', leaf: true, sid: {$SID} }";
};
if( count( $JIGA ) ){
$SECTIONS[] = "{ text: '{$CP['name']}', cls: 'ses_stat_head', leaf: false, expanded: true, children:[". implode( ",", $JIGA ) . "]}";
};
};
};
echo "{expanded: true, children: [".implode(',',$SECTIONS )."], sessions:{$S}, events:{$E}, videos:{$V} }";
} else {
echo "[]";
};
} else {
echo "[]";
};
} else {
header('location: /');
};
?>