// // ext is your protected.extensions folder // gmaps means the subfolder name under your protected.extensions folder // Yii::import('ext.gmap.*'); $gMap = new EGMap(); $gMap->zoom = 10; $mapTypeControlOptions = array( 'position'=> EGMapControlPosition::LEFT_BOTTOM, 'style'=>EGMap::MAPTYPECONTROL_STYLE_DROPDOWN_MENU ); $gMap->mapTypeControlOptions= $mapTypeControlOptions; $gMap->setCenter(39.721089311812094, 2.91165944519042); // Create GMapInfoWindows $info_window_a = new EGMapInfoWindow('<div>I am a marker with custom image!</div>'); $info_window_b = new EGMapInfoWindow('Hey! I am a marker with label!'); $icon = new EGMapMarkerImage("http://google-maps-icons.googlecode.com/files/gazstation.png"); $icon->setSize(32, 37); $icon->setAnchor(16, 16.5); $icon->setOrigin(0, 0); // Create marker $marker = new EGMapMarker(39.721089311812094, 2.91165944519042, array('title' => 'Marker With Custom Image','icon'=>$icon)); $marker->addHtmlInfoWindow($info_window_a); $gMap->addMarker($marker);
} }); } </script> <?php Yii::import('ext.gmaps.*'); ?> <?php $gMap = new EGMap(); $gMap->setWidth(625); $gMap->setHeight(350); $gMap->zoom = 14; $gMap->setOptions(array('zoomControl' => true, 'scaleControl' => true, 'disableDefaultUI' => true, 'panControl' => true, 'draggable' => true, 'scrollwheel' => true)); if ($property->latitude && $property->longitude) { $marker = new EGMapMarker($property->latitude, $property->longitude); $gMap->addMarker($marker); $gMap->setCenter($property->latitude, $property->longitude); } elseif ($propertyAddress['country']) { $country = $gMap->geocode($propertyAddress['city'] . "," . $propertyAddress['state'] . "," . $propertyAddress['country']); if ($country) { if ($country->getLat() && $country->getLng()) { $marker = new EGMapMarker($country->getLat(), $country->getLng()); $gMap->addMarker($marker); $gMap->setCenter($country->getLat(), $country->getLng()); } } } $gMap->renderMap(); ?> </div> <div id="localityInfo"> <div class="amentiesMarg2">
public function prepareMap($id, $size = 'medium') { if ($pg === false) { // missing place_geometry // TO DO: Fix this later return false; } $center = new stdClass(); Yii::import('ext.gmap.*'); $gMap = new EGMap(); $gMap->setJsName('map_region'); switch ($size) { case 'small': $gMap->width = '200'; $gMap->height = '200'; $gMap->zoom = 13; $gMap->mapTypeControl = false; break; default: $gMap->width = '300'; $gMap->height = '300'; $gMap->zoom = 13; } $gMap->setCenter($center->lat, $center->lon); $coords = PlaceGeometry::model()->string_to_coords($pg['region']); if (count($coords) > 1) { $polygon = new EGMapPolygon($coords); $gMap->addPolygon($polygon); } else { // Create marker with label $marker = new EGMapMarkerWithLabel($center->lat, $center->lon, array('title' => 'Here!')); $gMap->addMarker($marker); } return $gMap; }
} }); } </script> <?php Yii::import('ext.gmaps.*'); $gMap = new EGMap(); $gMap->setWidth(625); $gMap->setHeight(350); $gMap->zoom = 12; $gMap->setOptions(array('zoomControl' => false, 'scaleControl' => false, 'disableDefaultUI' => true, 'panControl' => false, 'draggable' => false, 'scrollwheel' => false)); if ($projectAddress['country']) { $country = $gMap->geocode($projectAddress['city'] . "," . $projectAddress['state'] . "," . $projectAddress['country']); if ($country) { if ($country->getLat() && $country->getLng()) { $gMap->setCenter($country->getLat(), $country->getLng()); } } } $gMap->renderMap(); ?> </div> <div id="localityInfo"> <div class="amentiesMarg2"> <div class="brwntxt">Distance From Key Facilities:</div> <div class="amentCont2"> <ul> <li><img style="vertical-align: middle;" src="images/icons/icon-hospital.png" title="Hospital" alt="Hospital"> Hospital: 0 km</li>
<div class="col-md-6"> <?php $this->widget('booster.widgets.TbCarousel', array('items' => array(array('image' => Yii::app()->request->baseUrl . '/images/carousel/slide-1.jpg'), array('image' => Yii::app()->request->baseUrl . '/images/carousel/slide-2.jpg'), array('image' => Yii::app()->request->baseUrl . '/images/carousel/slide-3.jpg')))); ?> </div> <div class="col-md-6"> <?php Yii::import('application.extensions.EGMAP.*'); $gMap = new EGMap(); $gMap->setJsName('test_map'); $gMap->width = '100%'; $gMap->height = 300; $gMap->zoom = 11; $gMap->setCenter(39.737827146489174, 3.2830574338912477); $info_box = new EGMapInfoBox('<div style="color:#fff;border: 1px solid black; margin-top: 8px; background: #000; padding: 5px;">I am a marker with info box!</div>'); $info_box->pixelOffset = new EGMapSize('0', '-140'); $info_box->maxWidth = 0; $info_box->boxStyle = array('width' => '"280px"', 'height' => '"120px"', 'background' => '"url(http://google-maps-utility-library-v3.googlecode.com/svn/tags/infobox/1.1.9/examples/tipbox.gif) no-repeat"'); $info_box->closeBoxMargin = '"10px 2px 2px 2px"'; $info_box->infoBoxClearance = new EGMapSize(1, 1); $info_box->enableEventPropagation = '"floatPane"'; $marker = new EGMapMarker(39.721089311812094, 2.91165944519042, array('title' => 'Marker With Info Box')); $marker->addHtmlInfoBox($info_box); $gMap->addMarker($marker); $gMap->renderMap(); ?> </div> <div class="col-md-6">
$gMap->zoom = 3; $gMap->disableDefaultUI = true; $gMap->scrollwheel = false; $gMap->scaleControl = false; $gMap->navigationControl = false; $gMap->streetViewControl = false; $gMap->overviewMapControl = false; $gMap->panControl = false; $gMap->zoomControl = true; $gMap->zoomControlOptions = array('style' => 'google.maps.ZoomControlStyle.SMALL'); $gMap->styles = 1; $gMap->setWidth(100, '%'); $gMap->setHeight(390); $mapTypeControlOptions = array(); // $gMap->mapTypeControlOptions= $mapTypeControlOptions; $gMap->setCenter(58.0201, 55.954); $icon = new EGMapMarkerImage("/img/map-icon.png"); $icon->setSize(28, 28); $icon->setAnchor(14, 14); $icon->setOrigin(0, 0); // Create GMapInfoWindows //$info_window_a = new EGMapInfoWindow('<div>Москва</div>'); $cities = Cities::model()->findAll(); if ($cities) { foreach ($cities as $city) { $info_box = new EGMapInfoBox('<div class="infoBox"><div class="infoBoxInner"><span>' . $city->city . '</span></div></div>'); // set the properties $info_box->pixelOffset = new EGMapSize('-55', '15'); $info_box->maxWidth = 0; $info_box->boxStyle = array('width' => '"186px"', 'height' => '"107px"'); $info_box->closeBoxUrl = '""';
protected function renderPopupMap() { $gMap = new EGMap(); $gMap->setJsName('hgeomap'); $gMap->addGlobalVariable('hgmarker'); $gMap->width = isset($this->popupOptions['mapWidth']) ? $this->popupOptions['mapWidth'] : '100%'; $gMap->height = isset($this->popupOptions['mapHeight']) ? $this->popupOptions['mapHeight'] : '600px'; $gMap->zoom = 6; $gMap->setCenter($this->latitude, $this->longitude); $gMap->addEvent(new EGMapEvent('click', 'function(e){panToMap(geomap,e.latLng,hgeomap);}', false)); $gMap->appendMapTo('#popup-map'); $this->popupOptions['width'] = isset($this->popupOptions['width']) ? $this->popupOptions['width'] : '800px'; $afterInit = array('hgmarker = new google.maps.Marker({ position: hgeomap.getCenter(), map: hgeomap, draggable: true });', 'google.maps.event.addListener(hgmarker, "dragend", function(e) { panToMap(geomap,e.latLng,hgeomap); });', '$("#open-big-map").click(function(e){ e.preventDefault(); $("#hgeomap").dialog({resizable:false,title:"Location",width:"' . $this->popupOptions['width'] . '"}); google.maps.event.trigger(hgeomap, "resize"); hgeomap.setCenter(geomap.getCenter()); return false; });'); echo CHtml::openTag('div', array('id' => 'hgeomap', 'style' => 'display:none')); if (isset($this->popupOptions['searchBox']) && $this->popupOptions['searchBox']) { $this->renderAddressSearchBox('hgeoaddress'); } if (!is_array($this->afterInitEvents)) { $this->afterInitEvents = array($this->afterInitEvents); } $gMap->renderMap(array_merge($this->afterInitEvents, $afterInit)); echo '<div id="popup-map" ></div>'; echo CHtml::closeTag('div'); }
Yii::import('ext.gmap.*'); $gMap = new EGMap(); $gMap->zoom = 17; $gMap->disableDefaultUI = true; $gMap->scrollwheel = false; $gMap->scaleControl = false; $gMap->navigationControl = false; $gMap->streetViewControl = false; $gMap->overviewMapControl = false; $gMap->panControl = false; $gMap->zoomControl = true; $gMap->zoomControlOptions = array('style' => 'google.maps.ZoomControlStyle.SMALL'); $gMap->styles = 2; $gMap->setWidth(100, '%'); $gMap->setHeight(100, '%'); $gMap->setCenter(55.834324, 37.626285); $icon = new EGMapMarkerImage("/img/map-icon.png"); $icon->setSize(28, 28); $icon->setAnchor(14, 14); $icon->setOrigin(0, 0); $info_window_a = new EGMapInfoWindow('<div>ВДНХ, павильон №57</div>'); $marker = new EGMapMarker(55.834324, 37.626285, array('title' => 'ВДНХ, павильон №57', 'icon' => $icon)); $marker->addHtmlInfoWindow($info_window_a); //$marker->addHtmlInfoBox($info_box); $gMap->addMarker($marker); $gMap->appendMapTo('#map_canvas'); $gMap->renderMap(); ?> <div id="con-vdnh" onclick="$('#map_canvas,#vdnh').toggleClass('vis-no');"> ВДНХ, павильон №57 </div>