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'); }