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.

40 lines
1.2 KiB

​
​
3 years ago
​
​
​
​
​
​
​
​
3 years ago
3 years ago
​
​
​
3 years ago
​
​
​
​
​
​
​
​
3 years ago
​
​
​
​
​
​
​
​
​
​
  1. <?php
  2. require_once('../ajax_asm.php');
  3. if( $CUser->Data['id'] > 1 ){
  4. if( isset( $_POST['DID'] ) ){
  5. $NID = intval( $_POST['DID'] );
  6. $QS = "SELECT * FROM `lrf_detection_width_tables` WHERE `aux_id`={$NID} ORDER BY `range_k`";
  7. $RR = $DATABASE->Query( $QS );
  8. if( count( $RR ) ){
  9. $QS = "SELECT `max_range` FROM `lrf_sensors` WHERE `id`={$NID}";
  10. $ZZ = $DATABASE->Query( $QS );
  11. $MR = floatval( $ZZ[0]['max_range'] );
  12. $Data['totalCount'] = count( $RR );
  13. $Data['rows'] = array();
  14. $PR = array();
  15. foreach( $RR as $R ){
  16. $CC[0] = intval( $R['id'] );
  17. $CC[1] = intval( $R['width_k'] );
  18. $CC[2] = intval( $R['range_k'] );
  19. $CC[3] = intval( ( $MR * $CC[2] ) / 100.0 );
  20. if( count( $PR )){
  21. $ZZ = array();
  22. $ZZ[0] = $PR[0];
  23. $ZZ[1] = $PR[1];
  24. $ZZ[2] = $PR[2] . '-' . $CC[2];
  25. $ZZ[3] = $PR[3] . '-' . $CC[3];
  26. $Data['rows'][] = $ZZ;
  27. };
  28. $PR = $CC;
  29. };
  30. $ZZ[0] = $PR[0];
  31. $ZZ[1] = $PR[1];
  32. $ZZ[2] = $PR[2] . '-100';
  33. $ZZ[3] = $PR[3] . '-' . $MR;
  34. $Data['rows'][] = $ZZ;
  35. echo json_encode( $Data );
  36. } else {
  37. echo "{ 'totalCount': 0, 'rows':[] }";
  38. };
  39. };
  40. };
  41. ?>