index.php 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170
  1. <?php
  2. if (cfr('CUSTMAP')) {
  3. $altCfg = $ubillingConfig->getAlter();
  4. if ($altCfg['CUSTMAP_ENABLED']) {
  5. $custmaps = new CustomMaps();
  6. // new custom map creation
  7. if (wf_CheckPost(array('newmapname'))) {
  8. if (cfr('CUSTMAPEDIT')) {
  9. $custmaps->mapCreate($_POST['newmapname']);
  10. rcms_redirect('?module=custmaps');
  11. } else {
  12. show_error(__('Permission denied'));
  13. }
  14. }
  15. //custom map deletion
  16. if (wf_CheckGet(array('deletemap'))) {
  17. if (cfr('CUSTMAPEDIT')) {
  18. $custmaps->mapDelete($_GET['deletemap']);
  19. rcms_redirect('?module=custmaps');
  20. } else {
  21. show_error(__('Permission denied'));
  22. }
  23. }
  24. //editing existing custom map name
  25. if (wf_CheckPost(array('editmapid', 'editmapname'))) {
  26. if (cfr('CUSTMAPEDIT')) {
  27. $custmaps->mapEdit($_POST['editmapid'], $_POST['editmapname']);
  28. rcms_redirect('?module=custmaps');
  29. } else {
  30. show_error(__('Permission denied'));
  31. }
  32. }
  33. //creating new map item
  34. if (wf_CheckPost(array('newitemgeo', 'newitemtype'))) {
  35. if (wf_CheckGet(array('showmap'))) {
  36. if (cfr('CUSTMAPEDIT')) {
  37. $custmaps->itemCreate($_GET['showmap'], $_POST['newitemtype'], $_POST['newitemgeo'], $_POST['newitemname'], $_POST['newitemlocation']);
  38. rcms_redirect('?module=custmaps&showmap=' . $_GET['showmap'] . '&mapedit=true');
  39. } else {
  40. show_error(__('Permission denied'));
  41. }
  42. }
  43. }
  44. //deleting map item
  45. if (wf_CheckGet(array('deleteitem'))) {
  46. if (cfr('CUSTMAPEDIT')) {
  47. $deleteResult = $custmaps->itemDelete($_GET['deleteitem']);
  48. rcms_redirect('?module=custmaps&showitems=' . $deleteResult);
  49. } else {
  50. show_error(__('Permission denied'));
  51. }
  52. }
  53. //items upload as KML
  54. if (wf_CheckPost(array('itemsUploadTypes'))) {
  55. $custmaps->catchFileUpload();
  56. }
  57. if (!wf_CheckGet(array('showmap'))) {
  58. if (!wf_CheckGet(array('showitems'))) {
  59. if (!wf_CheckGet(array('edititem'))) {
  60. //render existing custom maps list
  61. show_window(__('Available custom maps'), $custmaps->renderMapList());
  62. zb_BillingStats(true);
  63. } else {
  64. $editItemId = $_GET['edititem'];
  65. //editing item
  66. if (wf_CheckPost(array('edititemid', 'edititemtype'))) {
  67. if (cfr('CUSTMAPEDIT')) {
  68. $custmaps->itemEdit($editItemId, $_POST['edititemtype'], $_POST['edititemgeo'], $_POST['edititemname'], $_POST['edititemlocation']);
  69. rcms_redirect('?module=custmaps&edititem=' . $editItemId);
  70. } else {
  71. show_error(__('Permission denied'));
  72. }
  73. }
  74. //show item edit form
  75. show_window(__('Edit'), $custmaps->itemEditForm($editItemId));
  76. //photostorage link
  77. if ($altCfg['PHOTOSTORAGE_ENABLED']) {
  78. $imageControl = wf_Link('?module=photostorage&scope=CUSTMAPSITEMS&itemid=' . $editItemId . '&mode=list', wf_img('skins/photostorage.png') . ' ' . __('Upload images'), false, 'ubButton');
  79. show_window('', $imageControl);
  80. }
  81. //additional comments
  82. if ($altCfg['ADCOMMENTS_ENABLED']) {
  83. $adcomments = new ADcomments('CUSTMAPITEMS');
  84. show_window(__('Additional comments'), $adcomments->renderComments($editItemId));
  85. }
  86. }
  87. } else {
  88. if (!wf_CheckGet(array('duplicates'))) {
  89. //render items list json data in background
  90. if (wf_CheckGet(array('ajax'))) {
  91. $custmaps->renderItemsListJsonData($_GET['showitems']);
  92. }
  93. //render map items list container
  94. show_window(__('Objects') . ': ' . $custmaps->mapGetName($_GET['showitems']), $custmaps->renderItemsListFast($_GET['showitems']));
  95. } else {
  96. //show duplicate map objects
  97. show_window(__('Show duplicates') . ': ' . $custmaps->mapGetName($_GET['showitems']), $custmaps->renderItemDuplicateList($_GET['showitems']));
  98. }
  99. }
  100. } else {
  101. $mapId = $_GET['showmap'];
  102. $placemarks = '';
  103. //additional centering and zoom
  104. if (wf_CheckGet(array('locateitem', 'zoom'))) {
  105. $custmaps->setCenter($_GET['locateitem']);
  106. $custmaps->setZoom($_GET['zoom']);
  107. $searchRadius = 30;
  108. $placemarks.=$custmaps->mapAddCircle($_GET['locateitem'], $searchRadius, __('Search area radius') . ' ' . $searchRadius . ' ' . __('meters'), __('Search area'));
  109. }
  110. $placemarks.= $custmaps->mapGetPlacemarks($mapId);
  111. //custom map layers processing
  112. if (wf_CheckGet(array('cl'))) {
  113. if (!empty($_GET['cl'])) {
  114. $custLayers = explode('z', $_GET['cl']);
  115. if (!empty($custLayers)) {
  116. foreach ($custLayers as $eachCustLayerId) {
  117. if (!empty($eachCustLayerId)) {
  118. $placemarks.=$custmaps->mapGetPlacemarks($eachCustLayerId);
  119. }
  120. }
  121. }
  122. }
  123. }
  124. if (wf_CheckGet(array('layers'))) {
  125. $layers = $_GET['layers'];
  126. //switches layer
  127. if (ispos($layers, 'sw')) {
  128. $placemarks.=sm_MapDrawSwitches();
  129. }
  130. //switches uplinks layer
  131. if (ispos($layers, 'ul')) {
  132. $placemarks.=sm_MapDrawSwitchUplinks();
  133. }
  134. //builds layer
  135. if (ispos($layers, 'bs')) {
  136. $placemarks.=um_MapDrawBuilds();
  137. }
  138. }
  139. if (wf_CheckGet(array('mapedit', 'showmap'))) {
  140. $editor = $custmaps->mapLocationEditor();
  141. } else {
  142. $editor = '';
  143. }
  144. show_window($custmaps->mapGetName($mapId), $custmaps->mapInit($placemarks, $editor));
  145. }
  146. } else {
  147. show_error(__('This module is disabled'));
  148. }
  149. } else {
  150. show_error(__('Access denied'));
  151. }
  152. ?>