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.

44 lines
1.3 KiB

​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
5 months ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  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. case 11:
  26. case 12:
  27. $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>\'}';
  28. break;
  29. default:
  30. $ModPart[] = '{ xtype: \'panel\', boder: false, frame: false, html: \'<a align="center" style="padding: 5px; color: black; background-color: grey;">'.$R['device'].'</a>\'}';
  31. };
  32. };
  33. $Data['status']='ok';
  34. $Data['modules'] = '['.implode( ',', $ModPart ) .']';
  35. } else {
  36. $Data['status']='na';
  37. };
  38. $Data['messages'] = ob_get_clean();
  39. echo json_encode( $Data );
  40. } else {
  41. header('location: /');
  42. };
  43. ?>