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.
 
 
 
 

41 lines
1.2 KiB

<?php
require_once('../ajax_asm.php');
if( $CUser->Data['id'] > 1 ){
if( isset( $_POST['DID'] ) ){
$NID = intval( $_POST['DID'] );
$QS = "SELECT * FROM `lrf_detection_width_tables` WHERE `aux_id`={$NID} ORDER BY `range_k`";
$RR = $DATABASE->Query( $QS );
if( count( $RR ) ){
$QS = "SELECT `max_range` FROM `lrf_sensors` WHERE `id`={$NID}";
$ZZ = $DATABASE->Query( $QS );
$MR = floatval( $ZZ[0]['max_range'] );
$Data['totalCount'] = count( $RR );
$Data['rows'] = array();
$PR = array();
foreach( $RR as $R ){
$CC[0] = intval( $R['id'] );
$CC[1] = intval( $R['width_k'] );
$CC[2] = intval( $R['range_k'] );
$CC[3] = intval( ( $MR * $CC[2] ) / 100.0 );
if( count( $PR )){
$ZZ = array();
$ZZ[0] = $PR[0];
$ZZ[1] = $PR[1];
$ZZ[2] = $PR[2] . '-' . $CC[2];
$ZZ[3] = $PR[3] . '-' . $CC[3];
$Data['rows'][] = $ZZ;
};
$PR = $CC;
};
$ZZ[0] = $PR[0];
$ZZ[1] = $PR[1];
$ZZ[2] = $PR[2] . '-100';
$ZZ[3] = $PR[3] . '-' . $MR;
$Data['rows'][] = $ZZ;
echo json_encode( $Data );
} else {
echo "{ 'totalCount': 0, 'rows':[] }";
};
};
};
?>