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.

31 lines
1.2 KiB

​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  1. <?php
  2. require_once('../ajax_asm.php');
  3. ob_start();
  4. $UID = intval( $CUser->Data['id'] );
  5. $ACCESS = intval( $CUser->Data['access'] );
  6. if( $UID > 1 ){
  7. $QS = "SELECT `sen`.*, `no`.`enable`, `no`.`name` FROM `lrf_sensors` `sen` LEFT JOIN `nodes` `no` ON( `no`.`aux_id`=`sen`.`id` AND `no`.`type`=`sen`.`type`)";
  8. $Result = $DATABASE->Query( $QS, false );
  9. if( count( $Result ) ){
  10. $SenPart = array();
  11. foreach( $Result as $R ){
  12. switch( $R['type'] ){
  13. case 1: $HWT = 'ALS ' . $R['max_range'] . ' meters'; break;
  14. case 2: $HWT = 'LFS ' . $R['max_range'] . ' meters'; break;
  15. case 3: $HWT = 'PLS200 ' . $R['max_range'] . ' meters'; break;
  16. case 4: $HWT = 'PLS360 ' . $R['max_range'] . ' meters'; break;
  17. };
  18. $SenPart[] = '{ xtype: \'panel\', boder: false, frame: false, html: \'<a class="sideInfo_item" id="UART_'.(($R['enable']==0)?'N':'O').'" onclick="editSensorHW('.$R['id'].');">'.urldecode($R['name']).'['.$HWT.']</a>\'}';
  19. };
  20. $Data['status']='ok';
  21. $Data['sensors'] = '['.implode( ',', $SenPart ) .']';
  22. } else {
  23. $Data['status']='na';
  24. };
  25. $Data['messages'] = ob_get_clean();
  26. echo json_encode( $Data );
  27. } else {
  28. header('location: /');
  29. };
  30. ?>