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.

63 lines
2.1 KiB

​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  1. <?php
  2. require_once('../ajax_asm.php');
  3. if( $CUser->Data['id'] > 1 ){
  4. if( $CUser->Data['access'] > 5 ){
  5. if( isset( $_POST['STY'] ) ){
  6. $SelectionType = intval( $_POST['STY'] );
  7. } else {
  8. $SelectionType = 0;
  9. };
  10. switch( $SelectionType ){
  11. case 0: {
  12. // Complete Clear History
  13. $ZIZI = new SQLite_DB( $SYSPath . '/lib/controller/data/reports.db');
  14. $QS = "DELETE FROM `events_2_videos`";
  15. $QS = "DELETE FROM `events_2_pictures`";
  16. $QS = "DELETE FROM `events`";
  17. $QS = "DELETE FROM `videos`";
  18. $QS = "DELETE FROM `pictures`";
  19. $CMD = `rm -R -f {$SYSPath}/lib/controller/data/videos/*`;
  20. break;
  21. };
  22. case 1:{
  23. // Clear One Date
  24. };
  25. case 2:{
  26. // Clear One Event
  27. $BID = intval( $_POST['BID'] );
  28. $EID = intval( $_POST['EID'] );
  29. };
  30. };
  31. if( $BID ){
  32. $QS = "SELECT * FROM nodes";
  33. $result = $DATABASE->Query( $QS, false );
  34. $NodeNames = array();
  35. foreach( $result as $R ) $NodeNames[$R['id']] = $R['name'];
  36. $QS = "SELECT `events`.*, `events_2_videos`.* FROM `events` LEFT JOIN `events_2_videos` ON( `events`.`id` = `events_2_videos`.`evt_id` ) WHERE `id` >= {$BID} AND `id`<={$EID} ORDER BY `ts` ASC, `ts_ms` ASC";
  37. //$LREC = array_reverse( $ZIZI->Query( $QS ) );
  38. $LREC = $ZIZI->Query( $QS );
  39. $Data['log'] = array();
  40. foreach( $LREC as $REC ){
  41. $CR['id'] = intval( $REC['id'] );
  42. $CR['node_id'] = intval( $REC['node_id'] );
  43. $CR['node_name'] = $NodeNames[$CR['node_id']];
  44. $CR['ts'] = intval( $REC['ts'] );
  45. $CR['ms'] = intval( $REC['ts_ms'] );
  46. $CR['dts'] = date( "H:i:s.{$CR['ms']}", $CR['ts'] );
  47. $CR['type'] = intval( $REC['evt_type'] );
  48. $CR['range'] = sprintf( "%0.2f", floatval( $REC['range'] ));
  49. $CR['az'] = sprintf( "%0.2f", floatval( $REC['azimuth'] ));
  50. $CR['el'] = sprintf( "%0.2f", floatval( $REC['elevation'] ));
  51. $CR['r'] = intval( $REC['range_digital'] );
  52. $CR['width'] = intval( $REC['area'] );
  53. $CR['video_id'] = intval( $REC['video_id'] );
  54. $Data['log'][] = $CR;
  55. };
  56. echo json_encode( $Data );
  57. exit();
  58. };
  59. };
  60. };
  61. header('location: /');
  62. ?>