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.

43 lines
1.6 KiB

​
​
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. $ZIZI = new SQLite_DB( '/srv/www/web/lib/controller/data/reports.db');
  7. $DS = $DTS;
  8. $DE = $DS + 86400; // -> 1 Day
  9. $QS ="SELECT DISTINCT `node_id` FROM `events` WHERE `ts` >= {$DS} AND `ts` <= {$DE}";
  10. $NDD = $ZIZI->Query( $QS );
  11. $lulu = true;
  12. $E = "]}";
  13. $NONO = array();
  14. foreach( $NDD as $NID ){
  15. $id = intval( $NID['node_id'] );
  16. $QS = "SELECT `name` FROM `nodes` WHERE `id`={$id}";
  17. $R = $DATABASE->Query( $QS );
  18. $Name = $R[0]['name'];
  19. if( $lulu ) {
  20. $S = "{ text: '{$Name}', leaf: false, expanded: true, children:[";
  21. $lulu = false;
  22. } else {
  23. $S = "{ text: '{$Name}', leaf: false, expanded: false, children:[";
  24. };
  25. $QS = "SELECT `ts`, `id` FROM `events` WHERE `node_id`={$id} AND `ts` >= {$DS} AND `ts` <= {$DE} AND ( `evt_type`=52 ) ORDER BY `ts`, `ts_ms`";
  26. //echo $QS;
  27. //exit();
  28. $JJJ = $ZIZI->Query( $QS );
  29. $JIGA = array();
  30. foreach( $JJJ as $J ){
  31. $TM = date( "H:i:s", $J['ts'] );
  32. $JIGA[] = "{ text: '{$TM}', leaf: true, ts: {$J['ts']}, nid: {$id} }";
  33. };
  34. $NONO[] = $S . implode( ",", $JIGA ) . $E;
  35. //echo "{expanded: true, children: [{ text: 'Menu Option 1', leaf: false, expanded: true, children:[{ text: '14:53', leaf: true }] },{ text: 'Menu Option 2', leaf: true },{ text: 'Menu Option 3', leaf: true}]}";
  36. };
  37. echo "{expanded: true, children: [".implode(",", $NONO )."]}";
  38. } else {
  39. echo "[]";
  40. };
  41. } else {
  42. header('location: /');
  43. };
  44. ?>