Web Interface For Lite Argus Control modules
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.

101 lines
3.5 KiB

​
​
4 years ago
3 years ago
3 years ago
​
​
​
3 years ago
​
​
​
​
3 years ago
​
​
​
​
​
​
​
​
3 years ago
3 years ago
​
​
​
​
3 years ago
​
​
​
​
​
​
​
​
​
​
​
3 years ago
​
3 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
3 years ago
​
​
​
​
​
​
​
​
​
3 years ago
​
​
​
​
3 years ago
​
​
​
​
​
​
​
3 years ago
​
4 years ago
​
​
​
​
​
  1. <?php
  2. require_once('../ajax_asm.php');
  3. if( $CUser->Data['id'] > 1 ){
  4. $DTS = intval( $_POST['DTS'] );
  5. if( $DTS ){
  6. $TZ = new DateTimeZone( date_default_timezone_get() );
  7. $DT = new DateTime("now", $TZ );
  8. $DIDI = $TZ->getOffset( $DT );
  9. $Data['tz_offset']=$DIDI;
  10. $DTS += $DIDI;
  11. $Y = date("Y", $DTS );
  12. $M = date("m", $DTS );
  13. $D = date("d", $DTS );
  14. $DS = date("Y/m/d", $DTS );
  15. $NONO = '';
  16. $MUMU = new SQLite_DB( $SYSPath . '/lib/controller/data/reports/stat.db' );
  17. $QS = "SELECT * FROM `days` WHERE `year`={$Y} AND `month`={$M} AND `day`={$D}";
  18. $LOLO = $MUMU->Query( $QS );
  19. $S = 0;
  20. $V = 0;
  21. $E = 0;
  22. if( count( $LOLO ) ){
  23. $S = intval( $LOLO[0]['session_count'] );
  24. $V = intval( $LOLO[0]['videos_count'] );
  25. $E = intval( $LOLO[0]['evt_count'] );
  26. $ZIZI = new SQLite_DB( $SYSPath . '/lib/controller/data/reports/' . $DS . '/report.db' );
  27. $QS = "SELECT `id`, `ts`, `evt_type` FROM `events` WHERE ( `evt_type`=52 OR `evt_type`=53 OR `evt_type`=54 )";
  28. $NDD = $ZIZI->Query( $QS );
  29. if( count( $NDD ) ){
  30. $st_ignore = true;
  31. $DH = 0;
  32. $BID = 0;
  33. $EID = 0;
  34. $BTM = 0;
  35. $JIGA = array();
  36. foreach( $NDD as $N ){
  37. if( $st_ignore && $N['evt_type']!=52 ) continue;
  38. if( $st_ignore && $N['evt_type']==52 ) $st_ignore = false;
  39. if( $N['evt_type']==52 ) {
  40. $DH = 0;
  41. $BID = intval( $N['id'] );
  42. $BTM = date( "H:i:s", $N['ts'] );
  43. } else {
  44. $DH = 1;
  45. $EID = intval( $N['id'] );
  46. };
  47. if( $st_ignore == false && $DH == 1 ){
  48. $JIGA[] = "{ text: '{$BTM}', leaf: true, bid: {$BID}, eid: {$EID} }";
  49. };
  50. };
  51. if( $DH == 0 ){
  52. //Ongoing Event goes next day - must catch up
  53. $QS = "SELECT `id`, `ts`, `evt_type` FROM `events` WHERE `id` > {$BID} AND ( `evt_type`=53 OR `evt_type`=54 ) LIMIT 1";
  54. $NDD = $ZIZI->Query( $QS );
  55. if( count( $NDD ) ){
  56. $EID = intval( $NDD[0]['id'] );
  57. } else {
  58. $EID = 1000000000;//Infinity
  59. };
  60. $JIGA[] = "{ text: '{$BTM}', leaf: true, bid: {$BID}, eid: {$EID} }";
  61. };
  62. if( count( $JIGA ) ){
  63. $NONO = "{ text: 'Sessions', leaf: false, expanded: true, children:[". implode( ",", $JIGA ) . "]}";
  64. } else {
  65. $NONO = "{ text: 'No Sessions', leaf: true }";
  66. };
  67. };
  68. $QS = "SELECT DISTINCT `ts`/3600 AS JUJA FROM `events`";
  69. $NDD = $ZIZI->Query( $QS );
  70. if( count( $NDD ) ){
  71. $st_ignore = true;
  72. $DH = 0;
  73. $SIGA = array();
  74. foreach( $NDD as $N ){
  75. $BTS = intval($N['JUJA'])*3600;
  76. $DADA = date( "H:i", $BTS );
  77. $ETS = $BTS+3600;
  78. $BID = 0;
  79. $EID = 0;
  80. $QS="SELECT `id` FROM `events` WHERE `ts`>({$BTS}-1) LIMIT 1";
  81. $KK = $ZIZI->Query( $QS );
  82. if( count( $KK ) ) $BID = $KK[0]['id'];
  83. $QS="SELECT `id` FROM `events` WHERE `ts`<({$ETS}-1) ORDER BY `id` DESC LIMIT 1";
  84. $KK = $ZIZI->Query( $QS );
  85. if( count( $KK ) ) $EID = $KK[0]['id']; else $EID = $BID;
  86. if( $BID && $EID ){
  87. $SIGA[] = "{ text: '{$DADA}', leaf: true, bid: {$BID}, eid: {$EID} }";
  88. };
  89. };
  90. $EVEVE = "{ text: 'Events by Hours', leaf: false, expanded: true, children:[". implode( ",", $SIGA ) . "]}";
  91. };
  92. };
  93. if( $NONO=='' ) $NONO = "{ text: 'No Sessions', leaf: true }";
  94. if( $EVEVE=='' ) $EVEVE = "{ text: 'No Events', leaf: true }";
  95. echo "{tz_off: {$DIDI}, base_path: '{$DS}', expanded: true, children: [{$NONO},{$EVEVE}], sessions:{$S}, events:{$E}, videos:{$V} }";
  96. } else {
  97. echo "[]";
  98. };
  99. } else {
  100. header('location: /');
  101. };
  102. ?>