/** * AddressBook * * @copyright (c) AddressBook Development Team * @license GNU/GPL - http://www.gnu.org/copyleft/gpl.html * @package AddressBook */ function smarty_function_AddressShowGmap($params, &$smarty) { $dom = ZLanguage::getModuleDomain('AddressBook'); $assign = isset($params['assign']) ? $params['assign'] : null; $directions = ''; if (isset($params['directions'])) { $directions = '<a href="http://maps.google.com/maps?f=d&daddr=' . $params['lat_long']; if (isset($params['zoomlevel'])) { $directions .= '&z=' . $params['zoomlevel']; } $directions .= '" target="_blank">' . __('Get directions to this location', $dom) . '</a>'; } if (!empty($directions)) { $directions = '<div>' . $directions . '</div>'; } include_once 'modules/AddressBook/lib/vendor/GMaps/GoogleMapV3.php'; $map_id = 'googlemap'; if (isset($params['mapid'])) { $map_id .= $params['mapid']; } $app_id = 'ZikulaAddressBook'; $map = new GoogleMapAPI($map_id, $app_id); if (isset($params['maptype'])) { $map->setMapType($params['maptype']); // hybrid, satellite, terrain, roadmap } if (isset($params['zoomlevel'])) { $map->setZoomLevel($params['zoomlevel']); } $map->setTypeControlsStyle('dropdown'); $map->setWidth(isset($params['width']) && $params['width'] ? $params['width'] : '100%'); $map->setHeight(isset($params['height']) && $params['height'] ? $params['height'] : '400px'); // handle one (center) point if (isset($params['lat_long'])) { $arrLatLong = explode(',', $params['lat_long']); $map->setCenterCoords($arrLatLong[1], $arrLatLong[0]); $map->addMarkerByCoords($arrLatLong[1], $arrLatLong[0], $params['title'], $params['html'], $params['tooltip'], $params['icon'], $params['iconshadow']); } // API key if (isset($params['api_key'])) { $map->setApiKey($params['api_key']); } // handle array of points if (isset($params['points'])) { foreach ($params['points'] as $point) { $arrLatLong = explode(',', $point['lat_long']); $map->addMarkerByCoords($arrLatLong[1], $arrLatLong[0], $point['title'], $point['html'], $point['tooltip'], $point['icon'], $point['iconshadow']); } } // load the map $map->enableOnLoad(); if ($assign) { $result = $map->getHeaderJS() . $map->getMapJS() . $directions . $map->printMap() . $map->printOnLoad(); $smarty->assign($assign, $result); } else { PageUtil::addVar('rawtext', $map->getHeaderJS()); PageUtil::addVar('rawtext', $map->getMapJS()); return $directions . $map->printMap() . $map->printOnLoad(); } }
function testMap() { $MAP_OBJECT = new GoogleMapAPI(); $MAP_OBJECT->_minify_js = isset($_REQUEST["min"]) ? FALSE : TRUE; $MAP_OBJECT->setDSN(${$wpdb}->get_results("SELECT * from wp_NBDonation where {$table} like '%{$input}%' and Type in('{$org}','Both');")); $MAP_OBJECT->addMarkerByCoords(-104.988, 39.755, "Marker Title", "Marker Description"); $MAP_OBJECT->addMarkerByCoords(-118.243, 34.0522, "Marker2 Title", "Marker2 Description"); ?> <html> <head> <?php echo $MAP_OBJECT->getHeaderJS(); echo $MAP_OBJECT->getMapJS(); ?> </head> <body> <?php echo $MAP_OBJECT->printOnLoad(); echo $MAP_OBJECT->printMap(); echo $MAP_OBJECT->printSidebar(); ?> </body> </html> <?php }
/** * Output the header JS */ function googlemap_js() { require_once dirname(__FILE__) . '/GoogleMap/GoogleMap.php'; require_once dirname(__FILE__) . '/GoogleMap/JSMin.php'; global $MAP_OBJECT, $_zp_current_image, $_zp_current_album; $MAP_OBJECT = new GoogleMapAPI(); $MAP_OBJECT->setLocale(substr(getOption('locale'), 0, 2)); echo $MAP_OBJECT->getHeaderJS() . "\n"; ?> <style type="text/css"> <!-- .hidden_map { position: absolute; left: -50000px; } --> </style> <?php }
$MAP_OBJECT->addMarkerByCoords(-74.06247999999999, 4.52917, "Marker Title", "Marker Description"); $MAP_OBJECT->addMarkerByCoords(-74.09260999999999, 4.74825, "Marker Title", "Marker Description"); $MAP_OBJECT->addMarkerByCoords(-74.062, 4.7436695, "Marker Title", "Marker Description"); $MAP_OBJECT->addMarkerByCoords(-74.03258, 4.75828, "Marker Title", "Marker Description"); $MAP_OBJECT->addMarkerByCoords(-74.04254, 4.7584942, "Marker Title", "Marker Description"); $MAP_OBJECT->addMarkerByCoords(-74.0629, 4.628454, "Marker Title", "Marker Description"); $MAP_OBJECT->addMarkerByCoords(-74.092249, 4.78249, "Marker Title", "Marker Description"); $MAP_OBJECT->addMarkerByCoords(-74.05428999999999, 4.59249, "Marker Title", "Marker Description"); $MAP_OBJECT->addMarkerByCoords(-74.092249, 4.78249, "Marker Title", "Marker Description"); $MAP_OBJECT->addMarkerByCoords(-74.05428999999999, 4.59249, "Marker Title", "Marker Description"); ?> <html> <head> <?php echo $MAP_OBJECT->getHeaderJS(); echo $MAP_OBJECT->getMapJS(); ?> </head> <body> <?php echo $MAP_OBJECT->printOnLoad(); ?> <?php echo $MAP_OBJECT->printMap(); ?> </body> </html>
<?php include_once("GoogleMap.php"); include_once("JSMin.php"); $MAP_OBJECT = new GoogleMapAPI(); $MAP_OBJECT->_minify_js = isset($_REQUEST["min"])?FALSE:TRUE; ?> <html> <head> <?=$MAP_OBJECT->getHeaderJS();?> <?=$MAP_OBJECT->getMapJS();?> </head> <body> <?=$MAP_OBJECT->printOnLoad();?> <?=$MAP_OBJECT->printMap();?> <?=$MAP_OBJECT->printSidebar();?> </body> </html>