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.
|
|
<?php require_once('../ajax_asm.php'); function getNodeName( $NID ){ global $DATABASE; $EID = intval( $NID ); if( $EID ){ $QS = "SELECT name FROM nodes WHERE id={$EID}"; $RV = $DATABASE->Query( $QS ); if( count( $RV ) ){ return $RV[0]['name']; }; return '-NoName-'; } else { return 'Argus Server'; }; }; if( $CUser->Data['id'] > 1 ){ $Data = array(); $GID = intval($_POST['SITE']); $QS = "SELECT * FROM events_cloud ORDER BY id DESC LIMIT 20"; $Result = $DATABASE->Query( $QS, false ); date_default_timezone_set('UTC'); //foreach( array_reverse ( $Result ) as $CD ){
foreach( $Result as $CD ){ $cnode['has_target'] = false; $cnode['has_geo'] = false; switch( intval( $CD['evt_type'] ) ){ case 0:// NoInit case 1:// Ready case 2:// Alarm case 3:// Command case 4:// Key case 5:// Joystick continue; break; case 6:// STUDY $cnode['event']='Device Enters Into Study Mode'; break; case 7:// BUSY $cnode['event']='Device Is BUSY'; break; case 8:// FLIP $cnode['event']='Flip Complete'; break; case 9:// SCAN $cnode['event']='Scan Complete'; break; case 10:// Target 1D case 11:// Target 3DW case 12:// Target 3DB case 13:// Target 2DW case 14:// Target 2DB $cnode['event']='Target'; $cnode['data'] = sprintf("AZ: %0.2f El: %0.2f R: %0.2f", floatval($CD['azimuth']), floatval($CD['elevation']), floatval($CD['range'])); $cnode['has_target'] = true; $cnode['has_geo'] = true; break; case 15:// Capture Start case 16:// Capture End case 17:// Capture Done case 18:// Mission Begin case 19:// Cancel Action case 20:// Fly To case 21:// WayPoint case 22:// Dest Reached case 23:// Jaming Begin case 24:// Jamer On case 25:// Jamer Off case 26:// Target Locked case 27:// Intercept Begin case 28:// Intercept OK case 29:// Intercept NOK case 20:// Mission End case 31:// Landed case 32:// FH Busy case 33:// Camera DM case 34:// Error default: continue; break; }; $cnode['id'] = intval( $CD['id'] ); $uts = intval($CD['ts']); $cnode['date'] = date( "m.d.y", $uts ); $cnode['time'] = date( "H:m:s", $uts ); $cnode['device'] = getNodeName( $CD['node_id'] ); $Data[] = $cnode; }; $RA['log']=$Data; $RA['totalCount'] = count( $Data ); echo json_encode( $RA ); } else { header('location: /'); };?>
|