index.php 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. <?php
  2. if (cfr('SWITCHMAP')) {
  3. $altercfg = $ubillingConfig->getAlter();
  4. if ($altercfg['SWYMAP_ENABLED']) {
  5. $ymconf = $ubillingConfig->getYmaps();
  6. $ym_center = $ymconf['CENTER'];
  7. $ym_zoom = $ymconf['ZOOM'];
  8. $ym_type = $ymconf['TYPE'];
  9. $ym_lang = $ymconf['LANG'];
  10. $area = '';
  11. $locator = '';
  12. //wysiwyg switch placement
  13. if (ubRouting::checkPost(array('switchplacing', 'placecoords'))) {
  14. if (cfr('SWITCHESEDIT')) {
  15. $switchid = ubRouting::post('switchplacing', 'int');
  16. $placegeo = ubRouting::post('placecoords', 'mres');
  17. simple_update_field('switches', 'geo', $placegeo, "WHERE `id`='" . $switchid . "'");
  18. log_register('SWITCH CHANGE [' . $switchid . ']' . ' GEO ' . $placegeo);
  19. ubRouting::nav('?module=switchmap&locfinder=true');
  20. } else {
  21. show_error(__('Access denied'));
  22. }
  23. }
  24. //show map container
  25. sm_ShowMapContainer();
  26. //collect switches geolocation data
  27. if (!ubRouting::checkGet('coverage')) {
  28. $placemarks = sm_MapDrawSwitches();
  29. //uplinks display mode
  30. if ((ubRouting::checkGet('showuplinks')) and (!ubRouting::checkGet('traceid'))) {
  31. $placemarks .= sm_MapDrawSwitchUplinks();
  32. }
  33. } else {
  34. $placemarks = sm_MapDrawSwitchesCoverage();
  35. }
  36. //setting custom zoom and map center if need to find device
  37. if (ubRouting::checkGet(('finddevice'))) {
  38. $ym_zoom = $ymconf['FINDING_ZOOM'];
  39. $ym_center = ubRouting::get('finddevice', 'vf');
  40. if ($ymconf['FINDING_CIRCLE']) {
  41. $radius = 30;
  42. $area = sm_MapAddCircle($ym_center, $radius, __('Search area radius') . ' ' . $radius . ' ' . __('meters'), __('Search area'));
  43. } else {
  44. $area = '';
  45. }
  46. //uplinks display mode
  47. if (ubRouting::checkGet('showuplinks')) {
  48. $traceLinks = (ubRouting::checkGet('traceid')) ? ubRouting::get('traceid','int') : '';
  49. $placemarks .= sm_MapDrawSwitchUplinks($traceLinks);
  50. }
  51. }
  52. if (wf_CheckGet(array('locfinder'))) {
  53. $locator = sm_MapLocationFinder();
  54. }
  55. show_window('', generic_MapInit($ym_center, $ym_zoom, $ym_type, $placemarks.$area, $locator, $ym_lang));
  56. } else {
  57. show_error(__('This module is disabled'));
  58. }
  59. } else {
  60. show_error(__('Access denied'));
  61. }