Example #1
0
$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);
 
// Create marker with label
$marker = new EGMapMarkerWithLabel(39.821089311812094, 2.90165944519042, array('title' => 'Marker With Label'));
 
$label_options = array(
  'backgroundColor'=>'yellow',
Example #2
0
$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 = '""';
        //$info_box->closeBoxMargin = '"10px 2px 2px 2px"';