public function findApartments($place, $divid) { $AF = new ApartmentFinder(); $GL = new GeoLocator(); $GM = new GoogleMap(); $apartments = $AF->locateApartments($place); foreach ($apartments as $apartment) { $locations[] = $GL->getLocations($apartment); } $GM->initialize(); $GM->drawLocations($locations); $GM->dispatch($divid); }
require_once dirname(dirname(dirname(__FILE__))) . '/functions.php'; if (getOption('gmap_sessions')) { zp_session_start(); } require_once dirname(dirname(__FILE__)) . '/GoogleMap.php'; header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT'); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/2002/REC-xhtml1-20020801/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="content-type" content="text/html; charset=<?php echo getOption('charset'); ?> " /> <?php GoogleMap::js(); ?> </head> <body> <?php if (getOption('gmap_sessions')) { $map_data = $_SESSION['GoogleMapVars']; } else { $param = base64_decode(str_replace(' ', '+', sanitize($_GET['map_data']))); if ($param) { if (function_exists('bzcompress')) { $data = bzdecompress($param); } else { $data = gzuncompress($param); } $map_data = sanitize(unserialize($data), 4);
/** *TO DO: this contains map related stuff... which should be removed * **/ public function index($action) { //Debug::show($action); //Debug::show($this->owner->isAjax); if ($this->isAjax) { //$data = DataObject::get_by_id('BusinessPage', (int)$action['ID']); return $this->renderWith('AjaxBusinessDetails'); } else { if ($this->canEdit()) { GoogleMap::setAddPointsToMap(true); GoogleMap::setAddDeleteMarkerButton("remove this location"); $this->addUpdateServerUrlDragend(); } else { GoogleMap::setAddPointsToMap(false); GoogleMap::setAddDeleteMarkerButton(""); } $this->addMap("showPagePointsMapXML"); return array(); } }
<?php defined('_JEXEC') or die('Restricted access'); if (!empty($data)) { require_once 'components/com_mapbds/views/mapbds/tmpl/map.class.php'; for ($i = 0; $i < count($data); $i++) { $listdata[$i]['id'] = $data[$i]['id']; $listdata[$i]['latitude'] = $data[$i]['kinh_do']; $listdata[$i]['longitude'] = $data[$i]['vi_do']; $listdata[$i]['icon'] = ''; } //--------------------------- $map = new GoogleMap('road', 15, $data[0]['kinh_do'], $data[0]['vi_do']); // width,height,zoom,maptype $map->Control('zoom-preview-scale-pan-street'); // zoom,pan,scale,preview,street $map->Condition('id>10000~landmark,id>20000~large_yellow,id>40000~buildings,id>80000~golf,id>90000~church'); //condition~icon,condtion~icon //$map->Layer('5260907'); $map->Marker($listdata); $map->Info('json.php', 'components/com_mapbds/views/mapbds/tmpl/info.html'); $map->Display("map2"); //--------------------------- if (empty($ajaxPaging)) { $ajaxPaging = ''; } ?> <div id="ajax_paging_bt_<?php echo $contentElementId; ?> " class="ajax_paging" style="">
public function loadGoogleMap() { $js = ''; $this->loadDefaults(); if (!self::$includes_are_done) { Requirements::themedCSS("googleMap"); Requirements::javascript(THIRDPARTY_DIR . "/jquery/jquery.js"); Requirements::javascript("googlemap/javascript/googleMapStatic.js"); Requirements::javascript("googlemap/javascript/loadAjaxInfoWindow.js"); Requirements::insertHeadTags('<style type="text/css">v\\:* {behavior:url(#default#VML);}</style>', "GoogleMapCustomHeadTag"); if (!$this->getShowStaticMapFirst()) { Requirements::javascript("http://maps.googleapis.com/maps/api/js?v=3.16&sensor=" . $this->showFalseOrTrue(self::$uses_sensor)); Requirements::javascript("googlemap/javascript/googleMaps.js"); $js .= 'var scriptsLoaded = true; jQuery(document).ready( function() { initiateGoogleMap();} );'; } else { $js .= 'var scriptsLoaded = false;'; Requirements::javascript('http://www.google.com/jsapi?key=' . Config::inst()->get("GoogleMap", "GoogleMapAPIKey")); // } $js .= 'var absoluteBaseURL = "' . Director::absoluteBaseURL() . '";'; $js .= $this->createJavascript(); Requirements::customScript($js, "GoogleMapCustomScript"); self::$includes_are_done = true; } }
function getGoogleMap() { if (!Config::get('googleMapEnabled') || empty($this->address) || empty($this->city) || empty($this->country)) { return false; } $googleMap = new GoogleMap(); $googleMap->setZoomLevel(15); $longAddress = $this->address . ', ' . $this->city . ', ' . $this->country; $map = $googleMap->getScriptCode(); try { try { if (!is_null($this->lat) && !is_null($this->lng)) { $googleMap->addGeoPoint($this->lat, $this->lng, $longAddress); } else { $point = $googleMap->addAddress($longAddress); if ($point !== false) { Model::factoryInstance('site')->updateByPk($point, $this->siteId); } } } catch (Google_Map_AddressNotFoundException $e) { try { // No valid points for google map then search by zipCode City $googleMap->addAddress($this->zipCode . ', ' . $this->city . ', ' . $this->country); } catch (Google_Map_AddressNotFound_Exception $e) { // No valid points for google map then search by country $googleMap->addAddress($this->country); $googleMap->setZoomLevel(12); } } $map .= $googleMap->getMapCode(); return $map; } catch (Google_Map_ServiceException $e) { // geolocalization is temporary disabled for this IP, try user mode $googleMap->setZoomLevel(Config::get('googleMapZoom')); $googleMap->setZoomLevel(15); $map .= $googleMap->getUserSideMapCode($this->address . ', ' . $this->city . ', ' . $this->country); return $map; } catch (Exception $e) { return ''; } }
" class="ajax_paging" style=""> <?php echo $ajaxPaging; ?> </div> <?php if (!empty($data)) { require_once 'components/com_mapbds/views/mapbds/tmpl/map.class.php'; for ($i = 0; $i < count($data); $i++) { $listdata[$i]['id'] = $data[$i]['id']; $listdata[$i]['latitude'] = $data[$i]['kinh_do']; $listdata[$i]['longitude'] = $data[$i]['vi_do']; $listdata[$i]['icon'] = ''; } //--------------------------- $map = new GoogleMap('road', 15, $data[0]['kinh_do'], $data[0]['vi_do']); // width,height,zoom,maptype $map->Control('zoom-scale-pan-street'); // zoom,pan,scale,preview,street //$map->Condition('id>10000~landmark,id>20000~large_yellow,id>40000~buildings,id>80000~golf,id>90000~church');//condition~icon,condtion~icon //$map->Layer('5260907'); $map->Marker(); $map->Info('json.php', 'components/com_mapbds/views/mapbds/tmpl/info.html'); $map->Display("map-mlbds"); //--------------------------- ?> <style> #map-mlbds{margin:0;padding:0} .footer-f,.onfooter{
public function showaroundmexml() { $lng = 0; $lat = 0; $excludeIDList = array(); if ($this->lng && $this->lat) { $lng = $this->lng; $lat = $this->lat; } elseif ($this->owner->ID) { $objects = GoogleMapLocationsObject::get()->filter(array("ParentID" => $this->owner->ID)); if ($count = $objects->count()) { foreach ($objects as $point) { $lng += $point->Longitude; $lat += $point->Latitude; $excludeIDList[] = $point->ID; } $lng = $lng / $count; $lat = $lat / $count; } } $classNameForParent = ''; if ($otherClass = $this->filter) { $classNameForParent = $otherClass; } if ($this->title) { $title = $this->title; } else { $title = "Closest to me"; } if ($lng && $lat) { $orderByRadius = GoogleMapLocationsObject::radiusDefinition($lng, $lat); $where = "(" . $orderByRadius . ") > 0 AND \"GoogleMapLocationsObject\".\"Latitude\" <> 0 AND \"GoogleMapLocationsObject\".\"Longitude\" <> 0"; if ($classNameForParent && !is_object($classNameForParent)) { $where .= " AND \"SiteTree_Live\".\"ClassName\" = '" . $classNameForParent . "'"; } if (count($excludeIDList)) { $where .= " AND \"GoogleMapLocationsObject\".\"ID\" NOT IN (" . implode(",", $excludeIDList) . ") "; } $join = "LEFT JOIN \"SiteTree_Live\" ON \"SiteTree_Live\".\"ID\" = \"GoogleMapLocationsObject\".\"ParentID\""; $objects = GoogleMapLocationsObject::get()->where($where)->sort($orderByRadius)->leftJoin("SiteTree_Live", "SiteTree_Live.ID = GoogleMapLocationsObject.ParentID")->limit(GoogleMap::get_number_shown_in_around_me()); if ($objects->count()) { return $this->makeXMLData(null, $objects, $title, Config::inst()->get("GoogleMap", "number_shown_in_around_me") . " closest points"); } else { return "no data 1"; //return false; } } return "no lng and lat"; }