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.

30 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. $TY = intval( $_POST['TYP'] );
  8. if( $TY ){
  9. $QS = "SELECT `cam`.*, `no`.`enable` FROM `cameras` `cam` LEFT JOIN `nodes` `no` ON( `no`.`aux_id`=`cam`.`id` AND `no`.`type`=`cam`.`type`) WHERE `cam`.`status` = 3";
  10. } else {
  11. $QS = "SELECT `cam`.*, `no`.`enable` FROM `cameras` `cam` LEFT JOIN `nodes` `no` ON( `no`.`aux_id`=`cam`.`id` AND `no`.`type`=`cam`.`type`) WHERE `cam`.`status` < 3";
  12. };
  13. $Result = $DATABASE->Query( $QS, false );
  14. if( count( $Result ) ){
  15. $CamPart = array();
  16. foreach( $Result as $R ){
  17. $CamPart[] = '{ xtype: \'panel\', boder: false, frame: false, html: \'<a class="sideInfo_item" id="UART_'.(($R['enable']==0)?'N':'O').'" onclick="editCamera('.$R['id'].','.$TY.');">'.urldecode($R['name']).'['.$R['hardware'].']</a>\'}';
  18. };
  19. $Data['status']='ok';
  20. $Data['cameras'] = '['.implode( ',', $CamPart ) .']';
  21. } else {
  22. $Data['status']='na';
  23. };
  24. $Data['messages'] = ob_get_clean();
  25. echo json_encode( $Data );
  26. } else {
  27. header('location: /');
  28. };
  29. ?>