Web UI for ARGUS server
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.

93 lines
2.4 KiB

​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
5 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  1. <?php
  2. require_once('../ajax_asm.php');
  3. function getNodeName( $NID ){
  4. global $DATABASE;
  5. $EID = intval( $NID );
  6. if( $EID ){
  7. $QS = "SELECT name FROM nodes WHERE id={$EID}";
  8. $RV = $DATABASE->Query( $QS );
  9. if( count( $RV ) ){
  10. return $RV[0]['name'];
  11. };
  12. return '-NoName-';
  13. } else {
  14. return 'Argus Server';
  15. };
  16. };
  17. if( $CUser->Data['id'] > 1 ){
  18. $Data = array();
  19. $GID = intval($_POST['SITE']);
  20. $QS = "SELECT * FROM events_cloud ORDER BY id DESC LIMIT 20";
  21. $Result = $DATABASE->Query( $QS, false );
  22. date_default_timezone_set('UTC');
  23. //foreach( array_reverse ( $Result ) as $CD ){
  24. foreach( $Result as $CD ){
  25. $cnode['has_target'] = false;
  26. $cnode['has_geo'] = false;
  27. switch( intval( $CD['evt_type'] ) ){
  28. case 0:// NoInit
  29. case 1:// Ready
  30. case 2:// Alarm
  31. case 3:// Command
  32. case 4:// Key
  33. case 5:// Joystick
  34. continue; break;
  35. case 6:// STUDY
  36. $cnode['event']='Device Enters Into Study Mode';
  37. break;
  38. case 7:// BUSY
  39. $cnode['event']='Device Is BUSY';
  40. break;
  41. case 8:// FLIP
  42. $cnode['event']='Flip Complete';
  43. break;
  44. case 9:// SCAN
  45. $cnode['event']='Scan Complete';
  46. break;
  47. case 10:// Target 1D
  48. case 11:// Target 3DW
  49. case 12:// Target 3DB
  50. case 13:// Target 2DW
  51. case 14:// Target 2DB
  52. $cnode['event']='Target';
  53. $cnode['data'] = sprintf("AZ: %0.2f El: %0.2f R: %0.2f", floatval($CD['azimuth']), floatval($CD['elevation']), floatval($CD['range']));
  54. $cnode['has_target'] = true;
  55. $cnode['has_geo'] = true;
  56. break;
  57. case 15:// Capture Start
  58. case 16:// Capture End
  59. case 17:// Capture Done
  60. case 18:// Mission Begin
  61. case 19:// Cancel Action
  62. case 20:// Fly To
  63. case 21:// WayPoint
  64. case 22:// Dest Reached
  65. case 23:// Jaming Begin
  66. case 24:// Jamer On
  67. case 25:// Jamer Off
  68. case 26:// Target Locked
  69. case 27:// Intercept Begin
  70. case 28:// Intercept OK
  71. case 29:// Intercept NOK
  72. case 20:// Mission End
  73. case 31:// Landed
  74. case 32:// FH Busy
  75. case 33:// Camera DM
  76. case 34:// Error
  77. default:
  78. continue;
  79. break;
  80. };
  81. $cnode['id'] = intval( $CD['id'] );
  82. $uts = intval($CD['ts']);
  83. $cnode['date'] = date( "m.d.y", $uts );
  84. $cnode['time'] = date( "H:m:s", $uts );
  85. $cnode['device'] = getNodeName( $CD['node_id'] );
  86. $Data[] = $cnode;
  87. };
  88. $RA['log']=$Data;
  89. $RA['totalCount'] = count( $Data );
  90. echo json_encode( $RA );
  91. } else {
  92. header('location: /');
  93. };
  94. ?>