| 1 |
<?php |
|---|
| 2 |
|
|---|
| 3 |
|
|---|
| 4 |
|
|---|
| 5 |
|
|---|
| 6 |
|
|---|
| 7 |
|
|---|
| 8 |
|
|---|
| 9 |
|
|---|
| 10 |
|
|---|
| 11 |
|
|---|
| 12 |
|
|---|
| 13 |
|
|---|
| 14 |
|
|---|
| 15 |
|
|---|
| 16 |
|
|---|
| 17 |
|
|---|
| 18 |
|
|---|
| 19 |
|
|---|
| 20 |
|
|---|
| 21 |
|
|---|
| 22 |
|
|---|
| 23 |
|
|---|
| 24 |
|
|---|
| 25 |
|
|---|
| 26 |
|
|---|
| 27 |
|
|---|
| 28 |
|
|---|
| 29 |
|
|---|
| 30 |
|
|---|
| 31 |
|
|---|
| 32 |
|
|---|
| 33 |
|
|---|
| 34 |
|
|---|
| 35 |
|
|---|
| 36 |
|
|---|
| 37 |
|
|---|
| 38 |
|
|---|
| 39 |
|
|---|
| 40 |
|
|---|
| 41 |
|
|---|
| 42 |
|
|---|
| 43 |
|
|---|
| 44 |
|
|---|
| 45 |
|
|---|
| 46 |
|
|---|
| 47 |
|
|---|
| 48 |
|
|---|
| 49 |
|
|---|
| 50 |
|
|---|
| 51 |
require_once(dirname(__FILE__) . '/include/common.php'); |
|---|
| 52 |
|
|---|
| 53 |
require_once('classes/MainUI.php'); |
|---|
| 54 |
require_once('classes/Network.php'); |
|---|
| 55 |
require_once('classes/Node.php'); |
|---|
| 56 |
require_once('classes/User.php'); |
|---|
| 57 |
require_once('classes/Server.php'); |
|---|
| 58 |
$smarty = SmartyWifidog::getObject(); |
|---|
| 59 |
|
|---|
| 60 |
$currentUser = User::getCurrentUser(); |
|---|
| 61 |
|
|---|
| 62 |
|
|---|
| 63 |
if (!defined("GMAPS_HOTSPOTS_MAP_ENABLED") || (defined("GMAPS_HOTSPOTS_MAP_ENABLED") && GMAPS_HOTSPOTS_MAP_ENABLED == false)) { |
|---|
| 64 |
header("Location: hotspot_status.php"); |
|---|
| 65 |
exit(); |
|---|
| 66 |
} |
|---|
| 67 |
|
|---|
| 68 |
|
|---|
| 69 |
|
|---|
| 70 |
|
|---|
| 71 |
|
|---|
| 72 |
|
|---|
| 73 |
|
|---|
| 74 |
|
|---|
| 75 |
|
|---|
| 76 |
$smarty->assign('sectionMAINCONTENT', false); |
|---|
| 77 |
|
|---|
| 78 |
|
|---|
| 79 |
$smarty->assign('DEPRECATEDisSuperAdmin', false); |
|---|
| 80 |
$smarty->assign('selectNetworkUI', null); |
|---|
| 81 |
|
|---|
| 82 |
|
|---|
| 83 |
|
|---|
| 84 |
|
|---|
| 85 |
|
|---|
| 86 |
|
|---|
| 87 |
|
|---|
| 88 |
|
|---|
| 89 |
$smarty->assign('DEPRECATEDisSuperAdmin', $currentUser && $currentUser->DEPRECATEDisSuperAdmin()); |
|---|
| 90 |
|
|---|
| 91 |
|
|---|
| 92 |
|
|---|
| 93 |
|
|---|
| 94 |
|
|---|
| 95 |
|
|---|
| 96 |
if(!$vhost=VirtualHost::getCurrentVirtualHost()) { |
|---|
| 97 |
throw new Exception(_("Unable to get the google API key, because I couldn't find a vhost matching the current hostname")); |
|---|
| 98 |
} |
|---|
| 99 |
$html_headers = "<script src='http://maps.google.com/maps?file=api&v=2&&key=" . $vhost->getGoogleAPIKey() . "' type='text/javascript'></script>"; |
|---|
| 100 |
$html_headers .= "<script src='js/hotspots_status_map.js' type='text/javascript'></script>"; |
|---|
| 101 |
|
|---|
| 102 |
$html = null; |
|---|
| 103 |
|
|---|
| 104 |
|
|---|
| 105 |
|
|---|
| 106 |
|
|---|
| 107 |
|
|---|
| 108 |
$smarty->assign('sectionMAINCONTENT', true); |
|---|
| 109 |
|
|---|
| 110 |
|
|---|
| 111 |
$preSelectedObject = (!empty($_REQUEST['network_map']) ? Network::getObject($_REQUEST['network_map']) : Network::getCurrentNetwork()); |
|---|
| 112 |
$selectNetworkUI = Network::getSelectUI('network_map', array('preSelectedObject' => $preSelectedObject)); |
|---|
| 113 |
$smarty->assign('selectNetworkUI', $selectNetworkUI . (count(Network::getAllNetworks()) > 1 ? '<input class="submit" type="submit" name="submit" value="' . _("Change network") . '">' : "")); |
|---|
| 114 |
|
|---|
| 115 |
|
|---|
| 116 |
$html_body = $smarty->fetch("templates/sites/hotspots_map.tpl"); |
|---|
| 117 |
|
|---|
| 118 |
|
|---|
| 119 |
|
|---|
| 120 |
|
|---|
| 121 |
|
|---|
| 122 |
|
|---|
| 123 |
if (!empty($_REQUEST['network_map'])) { |
|---|
| 124 |
$network = Network::getObject($_REQUEST['network_map']); |
|---|
| 125 |
} else { |
|---|
| 126 |
$network = Network::getCurrentNetwork(); |
|---|
| 127 |
} |
|---|
| 128 |
|
|---|
| 129 |
$gis_data = $network->getGisLocation(); |
|---|
| 130 |
|
|---|
| 131 |
|
|---|
| 132 |
$script = "<script type=\"text/javascript\">//<![CDATA[\n"; |
|---|
| 133 |
$script .= " function toggleOverlay(name)\n"; |
|---|
| 134 |
$script .= " {\n"; |
|---|
| 135 |
$script .= " o = document.getElementById('map_postalcode_overlay');\n"; |
|---|
| 136 |
$script .= " if (o != undefined) {\n"; |
|---|
| 137 |
$script .= " if (o.style.display == 'block') {\n"; |
|---|
| 138 |
$script .= " o.style.display = 'none';\n"; |
|---|
| 139 |
$script .= " } else {\n"; |
|---|
| 140 |
$script .= " o.style.display = 'block';\n"; |
|---|
| 141 |
$script .= " }\n"; |
|---|
| 142 |
$script .= " }\n"; |
|---|
| 143 |
$script .= " }\n"; |
|---|
| 144 |
$script .= " translations = new HotspotsMapTranslations('" . addcslashes(_("Sorry, your browser does not support Google Maps."), "'") . "', '" . addcslashes(_("Homepage"), "'") . "', '" . addcslashes(_("Show me on the map"), "'") . "', '" . addcslashes(_("Loading, please wait..."), "'") . "');\n"; |
|---|
| 145 |
$script .= " hotspots_map = new HotspotsMap('map_frame', 'hotspots_map', translations, '" . COMMON_IMAGES_URL . "');\n"; |
|---|
| 146 |
$script .= " hotspots_map.setXmlSourceUrl('" . GMAPS_XML_SOURCE_URL . "');\n"; |
|---|
| 147 |
$script .= " hotspots_map.setHotspotsInfoList('map_hotspots_list');\n"; |
|---|
| 148 |
$script .= " hotspots_map.setInitialPosition(" . $gis_data->getLatitude() . ", " . $gis_data->getLongitude() . ", " . $gis_data->getAltitude() . ");\n"; |
|---|
| 149 |
$script .= " hotspots_map.setMapType(" . $network->getGisMapType() . ");\n"; |
|---|
| 150 |
$script .= " hotspots_map.redraw();\n"; |
|---|
| 151 |
$script .= "//]]>\n"; |
|---|
| 152 |
$script .= "</script>\n"; |
|---|
| 153 |
|
|---|
| 154 |
|
|---|
| 155 |
|
|---|
| 156 |
|
|---|
| 157 |
$ui = MainUI::getObject(); |
|---|
| 158 |
$ui->setTitle(_("Hotspots status map")); |
|---|
| 159 |
$ui->appendHtmlHeadContent($html_headers); |
|---|
| 160 |
$ui->addContent('left_area_middle', $html); |
|---|
| 161 |
$ui->addContent('main_area_middle', $html_body); |
|---|
| 162 |
$ui->addFooterScript($script); |
|---|
| 163 |
$ui->display(); |
|---|
| 164 |
|
|---|
| 165 |
|
|---|
| 166 |
|
|---|
| 167 |
|
|---|
| 168 |
|
|---|
| 169 |
|
|---|
| 170 |
|
|---|
| 171 |
|
|---|
| 172 |
|
|---|
| 173 |
?> |
|---|