示例#1
0
		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());
        }
示例#2
0
<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;
$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