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

<?php
require_once('../ajax_asm.php');
if( $CUser->Data['id'] > 1 ){
if( $CUser->Data['access'] > 5 ){
if( isset( $_POST['STY'] ) ){
$SelectionType = intval( $_POST['STY'] );
} else {
$SelectionType = 0;
};
switch( $SelectionType ){
case 0: {
// Complete Clear History
$ZIZI = new SQLite_DB( $SYSPath . '/lib/controller/data/reports.db');
$QS = "DELETE FROM `events_2_videos`";
$QS = "DELETE FROM `events_2_pictures`";
$QS = "DELETE FROM `events`";
$QS = "DELETE FROM `videos`";
$QS = "DELETE FROM `pictures`";
$CMD = `rm -R -f {$SYSPath}/lib/controller/data/videos/*`;
break;
};
case 1:{
// Clear One Date
};
case 2:{
// Clear One Event
$BID = intval( $_POST['BID'] );
$EID = intval( $_POST['EID'] );
};
};
if( $BID ){
$QS = "SELECT * FROM nodes";
$result = $DATABASE->Query( $QS, false );
$NodeNames = array();
foreach( $result as $R ) $NodeNames[$R['id']] = $R['name'];
$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";
//$LREC = array_reverse( $ZIZI->Query( $QS ) );
$LREC = $ZIZI->Query( $QS );
$Data['log'] = array();
foreach( $LREC as $REC ){
$CR['id'] = intval( $REC['id'] );
$CR['node_id'] = intval( $REC['node_id'] );
$CR['node_name'] = $NodeNames[$CR['node_id']];
$CR['ts'] = intval( $REC['ts'] );
$CR['ms'] = intval( $REC['ts_ms'] );
$CR['dts'] = date( "H:i:s.{$CR['ms']}", $CR['ts'] );
$CR['type'] = intval( $REC['evt_type'] );
$CR['range'] = sprintf( "%0.2f", floatval( $REC['range'] ));
$CR['az'] = sprintf( "%0.2f", floatval( $REC['azimuth'] ));
$CR['el'] = sprintf( "%0.2f", floatval( $REC['elevation'] ));
$CR['r'] = intval( $REC['range_digital'] );
$CR['width'] = intval( $REC['area'] );
$CR['video_id'] = intval( $REC['video_id'] );
$Data['log'][] = $CR;
};
echo json_encode( $Data );
exit();
};
};
};
header('location: /');
?>