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.

64 lines
2.1 KiB

​
​
4 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. $Y = date("Y", $DTS );
  7. $M = date("m", $DTS );
  8. $D = date("d", $DTS );
  9. $DS = date("Y/m/d", $DTS );
  10. $NONO = '';
  11. $MUMU = new SQLite_DB( '/srv/www/web/lib/controller/data/reports/stat.db' );
  12. $QS = "SELECT * FROM `days` WHERE `year`={$Y} AND `month`={$M} AND `day`={$D}";
  13. $LOLO = $MUMU->Query( $QS );
  14. $S = 0;
  15. $V = 0;
  16. $E = 0;
  17. if( count( $LOLO ) ){
  18. $S = intval( $LOLO[0]['session_count'] );
  19. $V = intval( $LOLO[0]['videos_count'] );
  20. $E = intval( $LOLO[0]['evt_count'] );
  21. $ZIZI = new SQLite_DB( '/srv/www/web/lib/controller/data/reports/' . $DS . '/report.db' );
  22. $QS = "SELECT `id`, `ts`, `evt_type` FROM `events` WHERE ( `evt_type`=52 OR `evt_type`=53 OR `evt_type`=54 )";
  23. $NDD = $ZIZI->Query( $QS );
  24. if( count( $NDD ) ){
  25. $st_ignore = true;
  26. $DH = 0;
  27. $JIGA = array();
  28. foreach( $NDD as $N ){
  29. if( $st_ignore && $N['evt_type']!=52 ) continue;
  30. if( $st_ignore && $N['evt_type']==52 ) $st_ignore = false;
  31. if( $N['evt_type']==52 ) {
  32. $DH = 0;
  33. $BID = intval( $N['id'] );
  34. $BTM = date( "H:i:s", $N['ts'] );
  35. } else {
  36. $DH = 1;
  37. $EID = intval( $N['id'] );
  38. };
  39. if( $DH == 1 ){
  40. $JIGA[] = "{ text: '{$BTM}', leaf: true, bid: {$BID}, eid: {$EID} }";
  41. };
  42. };
  43. if( $DH == 0 ){
  44. //Ongoing Event goes next day - must catch up
  45. $QS = "SELECT `id`, `ts`, `evt_type` FROM `events` WHERE `id` > {$BID} AND ( `evt_type`=53 OR `evt_type`=54 ) LIMIT 1";
  46. $NDD = $ZIZI->Query( $QS );
  47. if( count( $NDD ) ){
  48. $EID = intval( $NDD[0]['id'] );
  49. } else {
  50. $EID = 1000000000;//Infinity
  51. };
  52. $JIGA[] = "{ text: '{$BTM}', leaf: true, bid: {$BID}, eid: {$EID} }";
  53. };
  54. $NONO = "{ text: 'Events', leaf: false, expanded: true, children:[". implode( ",", $JIGA ) . "]}";
  55. };
  56. };
  57. echo "{expanded: true, children: [". $NONO ."], sessions:{$S}, events:{$E}, videos:{$V} }";
  58. } else {
  59. echo "[]";
  60. };
  61. } else {
  62. header('location: /');
  63. };
  64. ?>