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.

42 lines
1.3 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 * FROM modules";
  8. $Result = $DATABASE->Query( $QS, false );
  9. if( count( $Result ) ){
  10. foreach( $Result as $R ){
  11. $QS = "SELECT * FROM module_types WHERE id={$R['type']}";
  12. $MOMO = $DATABASE->Query( $QS, false );
  13. $MOD = $MOMO[0];
  14. switch( $R['type'] ){
  15. case 1:
  16. case 2:
  17. case 3:
  18. case 4:
  19. case 5:
  20. case 6:
  21. case 7:
  22. case 8:
  23. case 9:
  24. case 10:
  25. $ModPart[] = '{ xtype: \'panel\', boder: false, frame: false, html: \'<a class="sideInfo_item" id="UART_'.(($R['enabled']==0)?'N':'O').'" onclick="editModule('.$R['id'].');">'.$Labels->GetLabel($MOD['name']).'</a>\'}';
  26. break;
  27. default:
  28. $ModPart[] = '{ xtype: \'panel\', boder: false, frame: false, html: \'<a align="center" style="padding: 5px; color: black; background-color: grey;">'.$R['device'].'</a>\'}';
  29. };
  30. };
  31. $Data['status']='ok';
  32. $Data['modules'] = '['.implode( ',', $ModPart ) .']';
  33. } else {
  34. $Data['status']='na';
  35. };
  36. $Data['messages'] = ob_get_clean();
  37. echo json_encode( $Data );
  38. } else {
  39. header('location: /');
  40. };
  41. ?>