<?php /** * EGmap3 Yii extension example view file. * * You can copy this file or its contents into your Yii * application for testing. * */ Yii::import('ext.jquery-gmap.*'); $gmap = new EGmap3Widget(); $gmap->setSize(600, 400); // base options $options = array('scaleControl' => true, 'streetViewControl' => false, 'zoom' => 1, 'center' => array(0, 0), 'mapTypeId' => EGmap3MapTypeId::HYBRID, 'mapTypeControlOptions' => array('style' => EGmap3MapTypeControlStyle::DROPDOWN_MENU, 'position' => EGmap3ControlPosition::TOP_CENTER), 'zoomControlOptions' => array('style' => EGmap3ZoomControlStyle::SMALL, 'position' => EGmap3ControlPosition::BOTTOM_CENTER)); $gmap->setOptions($options); $marker = new EGmap3Marker(array('title' => 'hello')); $marker->address = 'Jacksonville, FL'; //$marker->latLng = array(18.466465, -66.118292); //$marker->centerOnMap(); //$marker->setMapZoom(8); $gmap->add($marker); $polyOptions = array('fillColor' => 'yellow', 'strokeColor' => 'red'); $rectangleOptions = array_merge($polyOptions, array('bounds' => array(40, -72, 42, -76))); $rectangle = new EGmap3Rectangle($rectangleOptions); //$rectangle->centerOnMap(); $gmap->add($rectangle); $polygon = new EGmap3Polygon($polyOptions); $polygon->paths = array(array(18.466465, -66.118292), array(32.321384, -64.75736999999999), array(25.774252, -80.190262), array(25.774252, -80.190262)); //$polygon->centerOnMap(); $gmap->add($polygon); $polyline = new EGmap3Polyline(array('strokeColor' => 'orange'));
<?php /** * EGmap3 Yii extension example view file. * * You can copy this file or its contents into your Yii * application for testing. * */ Yii::import('ext.jquery-gmap.*'); // init widget $gmap = new EGmap3Widget(); $gmap->setSize(600, 400); // base options for map $options = array('zoom' => 12, 'center' => array('41.850033', '-87.650052'), 'mapTypeId' => EGmap3MapTypeId::ROADMAP, 'mapTypeControlOptions' => array('mapTypeIds' => array(EGmap3MapTypeId::ROADMAP, 'style1', 'style2'))); $gmap->setOptions($options); // init the styled map, specify ID to match mapTypeIds above $styledMap1 = new EGmap3StyledMap('style1', array('name' => 'Style 1')); // add a map style $styledMap1->addStyle(array('featureType' => 'road.highway', 'elementType' => 'geometry', 'stylers' => array('hue' => '#ff0022', 'saturation' => 60, 'lightness' => -20))); // add and set the map $gmap->add($styledMap1); // Styled Map 2 ... $styledMap2 = new EGmap3StyledMap('style2', array('name' => 'Style 2')); $styledMap2->addStyle(array('featureType' => 'road.highway', 'elementType' => 'geometry', 'stylers' => array('hue' => '#ff0022', 'saturation' => 60, 'lightness' => -20))); $styledMap2->addStyle(array('featureType' => 'road.arterial', 'elementType' => 'geometry', 'stylers' => array(array('saturation' => 30, 'lightness' => -40), array('hue' => '#2200ff', 'visibility' => 'simplified')))); $styledMap2->addStyle(array('featureType' => 'road.local', 'elementType' => 'all', 'stylers' => array('hue' => '#f6ff00', 'saturation' => 50, 'gamma' => 0.7, 'visibility' => 'simplified'))); // specify to only add the map and not activate it $styledMap2->doNotSet(); $gmap->add($styledMap2); // render the map
echo $form->error($model, 'pincode'); ?> </li> </ul> </fieldset> <fieldset><legend>Property Location</legend> <ul> <li><span><label>Selected Location</label></span> <span id="location-map"> <?php Yii::import('ext.jquery-gmap.*'); ?> <?php $gmap = new EGmap3Widget(); $gmap->setSize('300', '200'); $gmap->setOptions(array('zoom' => 6, 'center' => $locationPosition, 'draggable' => false, 'panControl' => false, 'minZoom' => 8, 'width' => '300px', 'height' => '200px')); // add a marker $marker = new EGmap3Marker(array('title' => 'Updateable marker', 'draggable' => true)); $marker->latLng = $locationPosition; $marker->centerOnMap(); // $marker->address = '10 Downing St, Westminster, London SW1A 2, UK'; $js = "function(marker, event, data){\n var map = \$(this).gmap3('get'),\n \t\t infowindow = \$(this).gmap3({action:'get', name:'infowindow'}); \n\t\t if (infowindow){\n\t\t\t infowindow.open(map, marker);\n\t\t\t infowindow.setContent(data);\n\t\t } else {\n\t\t\t \$('#Property_latitude').val(marker.getPosition().lat());\n\t \t\t \t\$('#Property_longitude').val(marker.getPosition().lng());\n\t\t }\n\t\t}"; $marker->addEvent('click', $js); $marker->addEvent('drag', $js); $marker->addEvent('dragend', $js); $marker->addEvent('position_changed', $js); $gmap->add($marker); // tell the gmap to update the marker from the Address model fields. $gmap->updateMarkerAddressFromModel($model, array('address', 'address2', 'city', 'zip', 'state', 'country'), array());
<?php /** * EGmap3 Yii extension example view file. * * You can copy this file or its contents into your Yii * application for testing. * */ Yii::import('ext.jquery-gmap.*'); $gmap = new EGmap3Widget(); $gmap->setSize(600, 400); // base options $options = array('scaleControl' => true, 'streetViewControl' => false, 'zoom' => 9, 'center' => array(0, 0), 'mapTypeId' => EGmap3MapTypeId::HYBRID, 'mapTypeControlOptions' => array('style' => EGmap3MapTypeControlStyle::DROPDOWN_MENU, 'position' => EGmap3ControlPosition::TOP_CENTER)); $gmap->setOptions($options); // marker with custom icon $marker = new EGmap3Marker(array('title' => 'hello', 'icon' => array('url' => 'http://google-maps-icons.googlecode.com/files/dolphins.png', 'anchor' => array('x' => 1, 'y' => 36)))); // set marker position by address $marker->address = 'Jacksonville, FL'; // data associated with the marker $marker->data = 'test data !'; // add a Javascript event on marker click $js = "function(marker, event, data){\n var map = \$(this).gmap3('get'),\n infowindow = \$(this).gmap3({action:'get', name:'infowindow'});\n if (infowindow){\n infowindow.open(map, marker);\n infowindow.setContent(data);\n } else {\n \$(this).gmap3({action:'addinfowindow', anchor:marker, options:{content: data}});\n }\n}"; $marker->addEvent('click', $js); // center the map on the marker $marker->centerOnMap(); $gmap->add($marker); $gmap->renderMap();
echo $form->hiddenField($model, 'country_caption', array('value' => '1', 'id' => 'country_caption')); ?> <?php echo $form->hiddenField($model, 'country_short', array('value' => '1', 'id' => 'country_short')); ?> <?php echo $form->hiddenField($model, 'latitude', array('value' => '1', 'id' => 'latitude')); ?> <?php echo $form->hiddenField($model, 'longitude', array('value' => '1', 'id' => 'longitude')); ?> <?php Yii::import('ext.jquery-gmap.*'); $gmap = new EGmap3Widget(); $gmap->setSize(600, 400); // base options $options = array('scaleControl' => true, 'streetViewControl' => false, 'zoom' => 10, 'mapTypeId' => EGmap3MapTypeId::HYBRID, 'mapTypeControlOptions' => array('style' => EGmap3MapTypeControlStyle::DROPDOWN_MENU, 'position' => EGmap3ControlPosition::TOP_CENTER), 'zoomControlOptions' => array('style' => EGmap3ZoomControlStyle::SMALL, 'position' => EGmap3ControlPosition::BOTTOM_CENTER)); $gmap->setOptions($options); $gmap->renderMap(); ?> </div> <!-- <p class="note">Fields with <span class="required">*</span> are required.</p> <div class="row"> ?php echo $form->labelEx($model,'type_id'); ?> ?php echo $form->dropDownList($model,'type_id', CHtml::listData(XataType::model()->findAll(),//'parent IS NULL'), 'id',