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.

56 lines
2.4 KiB

​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  1. <?php
  2. require_once('../ajax_asm.php');
  3. if( $CUser->Data['id'] > 1 ){
  4. $STS = intval( $_POST['DTS'] );
  5. if( isset( $_POST['STT'] ) ){
  6. $STT = intval( $_POST['STT'] );
  7. } else $STT = 0;
  8. if( $STS ){
  9. //$TZ = new DateTimeZone( date_default_timezone_get() );
  10. //$DT = new DateTime("now", $TZ );
  11. //$DIDI = $TZ->getOffset( $DT );
  12. //$DTS += $DIDI;
  13. $ETS = $STS + 86400;
  14. //$Y = date("Y", $DTS );
  15. //$M = date("m", $DTS );
  16. //$D = date("d", $DTS );
  17. //$DS = date("Y/m/d", $DTS );
  18. $SECTIONS = array();
  19. $QS = "SELECT * FROM `metro_platforms` WHERE `station_id`={$STT} ORDER BY `index`";
  20. $JU = $DATABASE->Query( $QS );
  21. if( count($JU) ){
  22. foreach( $JU as $CP ){
  23. //$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`";
  24. $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`";
  25. $RR = $DATABASE->Query( $QS );
  26. $S = count( $RR );
  27. $V = 0;//intval( $RR[0]['v'] );
  28. $E = 0;//intval( $RR[0]['e'] );
  29. if( $S ){
  30. $JIGA = array();
  31. foreach( $RR as $R ){
  32. $V += intval( $R['vid_cnt']);
  33. $E += intval( $R['evt_cnt']);
  34. $QS = "SELECT `short` FROM `metro_tracks` WHERE `id`={$R['track_id']}";
  35. $ZD = $DATABASE->Query( $QS );
  36. $BTM = "[{$ZD[0]['short']}]&nbsp;".date( "H:i:s", $R['ts'] );
  37. $SID = intval( $R['id']);
  38. $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>";
  39. $JIGA[] = "{ id: 'tn_{$SID}', text: '{$BTM}', qtip: '{$LABEL}', iconCls: 'ses_stat_{$R['status']}', leaf: true, sid: {$SID} }";
  40. };
  41. if( count( $JIGA ) ){
  42. $SECTIONS[] = "{ text: '{$CP['name']}', cls: 'ses_stat_head', leaf: false, expanded: true, children:[". implode( ",", $JIGA ) . "]}";
  43. };
  44. };
  45. };
  46. echo "{expanded: true, children: [".implode(',',$SECTIONS )."], sessions:{$S}, events:{$E}, videos:{$V} }";
  47. } else {
  48. echo "[]";
  49. };
  50. } else {
  51. echo "[]";
  52. };
  53. } else {
  54. header('location: /');
  55. };
  56. ?>