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.

48 lines
1.6 KiB

​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  1. <?php
  2. require_once('../ajax_asm.php');
  3. $UID = intval( $CUser->Data['id'] );
  4. $ACCESS = intval( $CUser->Data['access'] );
  5. $Data = array();
  6. if( $UID > 1 ){
  7. if( isset( $_POST['MID'] ) ){
  8. $MID = intval($_POST['MID']);
  9. $QS = "SELECT * FROM `location_maps` WHERE `id`={$MID}";
  10. $DDD = $DATABASE->Query( $QS );
  11. if( count( $DDD ) ){
  12. $Data = $DDD[0];
  13. } else {
  14. // Default Map - OpenStreetMap
  15. $Data['id']=0;
  16. $Data['type']=1;
  17. $Data['name']='__DEFAULT__';
  18. $Data['layer_url']='https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png';
  19. $Data['attribution']='&copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors';
  20. $Data['maxNativeZoom']=18;
  21. $Data['maxZoom']=24;
  22. };
  23. } else {
  24. $QS = "SELECT `map_id`, `local_binding` FROM `system_props` LIMIT 1";
  25. $DDD = $DATABASE->Query( $QS );
  26. $Data['selected_map'] = intval( $DDD[0]['map_id'] );
  27. $Data['local_binding'] = ( intval( $DDD[0]['local_binding'] ) > 0 );
  28. $QS = "SELECT * FROM `location_maps` WHERE `id`={$Data['selected_map']}";
  29. //$Data['maps'] = array();
  30. $R = $DATABASE->Query( $QS );
  31. if( count( $R ) ){
  32. $Data['maps']=$R[0];
  33. } else {
  34. // Default Map - OpenStreetMap
  35. $MD['id']=0;
  36. $MD['type']=1;
  37. $MD['name']='OpenStreetMap';
  38. $MD['layer_url']='https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png';
  39. $MD['attribution']='&copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors';
  40. $MD['maxNativeZoom']=18;
  41. $MD['maxZoom']=24;
  42. $Data['maps'] = $MD;
  43. };
  44. };
  45. } else {
  46. };
  47. echo json_encode( $Data );
  48. ?>