public function toJs() { if (null !== $this->panel) { $this->panel = "document.getElementById('" . $this->panel . "')"; } if (count($this->options['polylineOptions'])) { $this->options['polylineOptions'] = CJavaScript::encode($this->options['polylineOptions']); } return 'var ' . $this->getJsName() . ' = new google.maps.DirectionsRenderer(' . EGMap::encode($this->options) . ');' . "\n"; }
/** * @return string Javascript code to return the Point */ public function toJs($map_js_name = 'map') { $markers = array(); if (count($this->markers)) { foreach ($this->markers as $m) { $markers[] = $m->getJsName(); } } $return = 'var ' . $this->getJsName() . '= new MarkerClusterer(' . $map_js_name . ',' . EGMap::encode($markers) . ',' . EGMap::encode($this->options) . ');'; return $return; }
function codeAddress(country,gMap) { geocoder = new google.maps.Geocoder(); geocoder.geocode( { 'address': country}, function(results, status) { if (status == google.maps.GeocoderStatus.OK) { lat = results[0].geometry.location; return results[0].geometry.location; } else { return ; } }); } </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());
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; }
/** * @param string $map_js_name * @return string Javascript code to create the marker * @author Fabrice Bernhard * @since 2009-08-21 * @since 2010-12-22 modified by Antonio Ramirez * @since 2011-01-08 modified by Antonio Ramirez * Removed EGMapMarkerImage conversion * @since 2011-01-11 included option for global info window * @since 2011-01-22 included different types of Marker Object support * EGMap::encode deprecates the use of optionsToJs * @since 2011-01-23 fixed logic bug * */ public function toJs($map_js_name = 'map') { $this->options['map'] = $map_js_name; $return = ''; if (null !== $this->info_window) { if ($this->info_window_shared) { $info_window_name = $map_js_name . '_info_window'; $this->addEvent(new EGMapEvent('click', 'if (' . $info_window_name . ') ' . $info_window_name . '.close();' . PHP_EOL . $info_window_name . ' = ' . $this->info_window->getJsName() . ';' . PHP_EOL . $this->info_window->getJsName() . ".open(" . $map_js_name . "," . $this->getJsName() . ");" . PHP_EOL)); } else { $this->addEvent(new EGMapEvent('click', $this->info_window->getJsName() . ".open(" . $map_js_name . "," . $this->getJsName() . ");" . PHP_EOL)); } $return .= $this->info_window->toJs(); } $return .= 'var ' . $this->getJsName() . ' = new ' . $this->marker_object . '(' . EGMap::encode($this->options) . ');' . PHP_EOL; foreach ($this->custom_properties as $attribute => $value) { $return .= $this->getJsName() . "." . $attribute . " = '" . $value . "';" . PHP_EOL; } foreach ($this->events as $event) { $return .= $event->getEventJs($this->getJsName()) . PHP_EOL; } return $return; }
/** * @param string $map_js_name * @return string Javascript code to create the marker * @author Fabrice Bernhard * @since 2009-08-21 * @since 2011-01-25 by Antonio Ramirez * Modified options encoding */ public function toJs($map_js_name = 'map') { $return = ''; $return .= $this->getJsName() . ' = new google.maps.InfoWindow(' . EGMap::encode($this->options) . ');' . PHP_EOL; foreach ($this->custom_properties as $attribute => $value) { $return .= 'var ' . $this->getJsName() . "." . $attribute . " = '" . $value . "';" . PHP_EOL; } foreach ($this->events as $event) { $return .= $event->getEventJs($this->getJsName()); } return $return; }
public function getEncodedOptions() { return EGMap::encode(parent::getOptions()); }
/** * @param string $map_js_name * @return string Javascript code to create the marker * @author Fabrice Bernhard * @since 2009-08-21 * @since 2010-12-22 modified by Antonio Ramirez * @since 2011-01-08 modified by Antonio Ramirez * Removed EGMapMarkerImage conversion * @since 2011-01-11 included option for global info window * @since 2011-01-22 included different types of Marker Object support * EGMap::encode deprecates the use of optionsToJs * @since 2011-01-23 fixed logic bug * @since 2011-10-12 added info_box plugin feature * */ public function toJs($map_js_name = 'map') { $this->options['map'] = $map_js_name; $return = ''; if (null !== $this->info_window || null !== $this->info_box) { if ($this->info_window_shared || $this->info_box_shared) { $info_window_name = $map_js_name . ($this->info_window_shared ? '_info_window' : '_info_box'); $content = $this->info_window ? $this->info_window->getContent() : $this->info_box->getContent(); $this->addEvent(new EGMapEvent('click', $info_window_name . '.setContent(' . $content . ');' . PHP_EOL . $info_window_name . '.open(' . $map_js_name . ',' . $this->getJsName() . ');' . PHP_EOL)); } else { $name = $this->info_window ? $this->info_window->getJsName() : $this->info_box->getJsName(); $this->addEvent(new EGMapEvent('click', $this->info_window->getJsName() . ".open(" . $map_js_name . "," . $this->getJsName() . ");" . PHP_EOL)); $return .= $this->info_window->toJs(); } } //$return .='var ' . $this->getJsName() . ' = new ' . $this->marker_object . '(' . EGMap::encode($this->options) . ');' . PHP_EOL; //refering to global whenever possible $return .= ' ' . $this->getJsName() . ' = new ' . $this->marker_object . '(' . EGMap::encode($this->options) . ');' . PHP_EOL; foreach ($this->custom_properties as $attribute => $value) { $return .= $this->getJsName() . "." . $attribute . " = '" . $value . "';" . PHP_EOL; } foreach ($this->events as $event) { $return .= $event->getEventJs($this->getJsName()) . PHP_EOL; } return $return; }
<section class="extPoset"> <div class="container-fluid"> <div class="row"> <div class="col-sx-12" id="ext_poset_line"> </div> </div> <div class="row"> <div class="col-xs-12 text-center f-28 uppercase m-t-30 m-b-20"> Выставка уже посетила </div> </div> <div class="row" style="margin-bottom:70px;"> <?php Yii::import('ext.gmap.*'); $gMap = new EGMap(); $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;
Han transcurrido más de 20 años desde que Havanatur comenzó en Chile a convertir sueños en realidades haciendo posible el reto de satisfacer y cumplir con las expectativas de los clientes en su motivación de viajar para conocer esa encantadora y fascinante isla caribeña, hoy convertida en uno de los destinos turísticos más importantes y atractivos del Caribe, dado la diversidad de sus entornos naturales, opciones e infraestructura a disposición del que la visita. </div> </div> <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);
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'); }
/** * * @return string js code to create the markerImage * @author Maxime Picaud * @since 4 sept. 2009 * @since 2011-01-22 modified by Antonio Ramirez * implemented EGMap support for object to * js translation */ public function toJs() { $params = array(); $params[] = '"' . $this->getUrl() . '"'; $params[] = EGMap::encode($this->size); $params[] = EGMap::encode($this->origin); $params[] = EGMap::encode($this->anchor); $return = 'new google.maps.MarkerImage(' . implode(',', $params) . ")"; return $return; }
<?php $themeUrl = Yii::app()->theme->baseUrl; Yii::app()->clientScript->registerScriptFile($themeUrl . '/plugins/circular-share/circular-menu.js', CClientScript::POS_END); Yii::app()->clientScript->registerCssFile($themeUrl . '/plugins/circular-share/skin-circular.css'); Yii::app()->clientScript->registerCssFile($themeUrl . '/css/contacts.css'); ?> <div id="map_canvas" class="vis-no"> <?php 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));
<?php // // 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);
/** * @return string Javascript code to return the Point */ public function toJs($map_js_name = 'map') { foreach (array('veilStyle', 'boxStyle', 'visualClass', 'visualType') as $key) { if (isset($this->options[$key])) { $this->options[$key] = CJavaScript::encode($this->options[$key]); } } $return = $map_js_name . '.enableKeyDragZoom(' . EGMap::encode($this->options) . ');'; if (count($this->events)) { $return .= 'var ' . $this->getJsName() . '=' . $map_js_name . '.getDragZoomObject();'; foreach ($this->events as $e) { $return .= $e->toJs($this->getJsName()); } } return $return; }
/** * Generate js code for direction * Inspired by the work of Vincent Guillon <*****@*****.**> * * @param string $map_js_name The google map js var name * @return $js_code The generated js to display direction * @author Antonio Ramirez * @since 2010-01-24 * */ public function toJs($map_js_name = 'map') { if (null === $this->renderer) { throw new CException(Yii::t('EGMap', 'No Renderer Service has been provided')); } $options = $this->getOptions(); $js_name = $this->getJsName(); // set map to renderer $this->renderer->map = $map_js_name; // Construct js code $js_code = ''; $js_code .= $this->renderer->toJs(); $js_code .= 'var ' . $js_name . ' = new google.maps.DirectionsService();' . "\n"; // building Request $js_code .= 'var ' . $js_name . 'Request = ' . EGMap::encode($this->options) . ';' . "\n"; $js_code .= $js_name . '.route(' . $js_name . 'Request, function(response, status)' . "\n"; $js_code .= '{' . "\n"; $js_code .= ' if (status == google.maps.DirectionsStatus.OK)' . "\n"; $js_code .= ' {' . "\n"; $js_code .= ' ' . $this->renderer->getJsName() . '.setDirections(response);' . "\n"; $js_code .= ' }' . "\n"; $js_code .= '});' . "\n"; return $js_code; }
function codeAddress(country,gMap) { geocoder = new google.maps.Geocoder(); geocoder.geocode( { 'address': country}, function(results, status) { if (status == google.maps.GeocoderStatus.OK) { lat = results[0].geometry.location; return results[0].geometry.location; } else { return ; } }); } </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>
/** * @param string $map_js_name * @return string Javascript code to create the rectangle * @author Antonio Ramirez */ public function toJs($map_js_name = 'map') { $this->options['map'] = $map_js_name; $return = ''; if (null !== $this->info_window) { if ($this->info_window_shared) { $info_window_name = $map_js_name . '_info_window'; $this->addEvent(new EGMapEvent('click', 'if (' . $info_window_name . ') ' . $info_window_name . '.close();' . PHP_EOL . $info_window_name . ' = ' . $this->info_window->getJsName() . ';' . PHP_EOL . $info_window_name . ".setPosition(" . $this->getCenterOfBounds()->toJs() . ");" . PHP_EOL . $info_window_name . ".open(" . $map_js_name . ");" . PHP_EOL)); } else { $this->addEvent(new EGMapEvent('click', $this->info_window->getJsName() . ".setPosition(" . $this->getCenterOfBounds()->toJs() . ");" . PHP_EOL . $this->info_window->getJsName() . ".open(" . $map_js_name . ");" . PHP_EOL)); } $return .= $this->info_window->toJs(); } $return .= 'var ' . $this->getJsName() . ' = new ' . $this->rectangle_object . '(' . EGMap::encode($this->options) . ');' . PHP_EOL; foreach ($this->events as $event) { $return .= $event->getEventJs($this->getJsName()) . PHP_EOL; } return $return; }
<?php /* @var $this LocationController */ /* @var $model Location */ /* @var $form CActiveForm */ ?> <div class="form"> <?php if ($model->region) { Yii::import('application.extensions.egmap.*'); Yii::app()->clientScript->registerCoreScript('jquery'); $map = new EGMap(); $map->setJsName('map'); $map->width = '100%'; $map->height = 470; $map->zoom = 8; $map->setCenter(39.737827146489174, 3.2830574338912477); $map->mapTypeControl = false; $map->panControl = false; $map->streetViewControl = false; $latitudeAttributeName = 'latitude'; $longitudeAttributeName = 'longitude'; $marker = new EGMapMarker($model->latitude, $model->longitude, array(), 'marker', array('dragevent' => new EGMapEvent('dragend', strtr('function(event){$("input[name=\\"{latName}\\"]").val(event.latLng.lat());$("input[name=\\"{lngName}\\"]").val(event.latLng.lng());}', array('{latName}' => CHtml::resolveName($model, $latitudeAttributeName), '{lngName}' => CHtml::resolveName($model, $longitudeAttributeName))), false, EGMapEvent::TYPE_EVENT_DEFAULT))); // the setter does not perform the special handling of 'title' that the constructor gets via setOptions(). $marker->title = "'{$model->name}'"; $marker->icon = new EGMapMarkerImage(Yii::app()->request->baseUrl . '/images/map-marker-blue.png'); $marker->icon->setSize(59, 54); $marker->icon->setAnchor(59 / 2, 54); $marker->draggable = true; $map->addMarker($marker);