POS_LAT = Yii::app()->params["pos_lat"]; $this->POS_LONG = Yii::app()->params["pos_long"]; $this->gMap = new EGMap(); $this->gMap->setAPIKey(Yii::app()->params["map_api_domain"], Yii::app()->params["map_api_key"]); $this->gMap->setWidth("100%"); $this->gMap->setHeight(550); $this->gMap->zoom = 18; $mapTypeControlOptions = array( 'position' => EGMapControlPosition::RIGHT_TOP, 'style' => EGMap::MAPTYPECONTROL_STYLE_HORIZONTAL_BAR ); $this->gMap->mapTypeId = EGMap::TYPE_HYBRID; $this->gMap->mapTypeControlOptions = $mapTypeControlOptions; $this->gMap->zoom = 18; $this->gMap->setCenter($this->POS_LAT, $this->POS_LONG); // Green icon for published standorte for marker. $this->publishedIcon = new EGMapMarkerImage(Html::imageUrl("map/marker_green_32.png")); $this->publishedIcon->setSize(32, 37); $this->publishedIcon->setAnchor(16, 16.5); $this->publishedIcon->setOrigin(0, 0); // Red icon for non-published standorte for marker. $this->notPublishedIcon = new EGMapMarkerImage(Html::imageUrl("map/marker_red_32.png")); $this->notPublishedIcon->setSize(32, 37); $this->notPublishedIcon->setAnchor(16, 16.5); $this->notPublishedIcon->setOrigin(0, 0); } public function addMarker(EGMapMarker $marker, $published) { $options = $marker->getOptions(); $newOptions = array_merge($options, array("icon"=>(($published) ? $this->publishedIcon : $this->notPublishedIcon))); $marker->setOptions($newOptions); $this->gMap->addMarker($marker); } public function render() { $this->gMap->renderMap(array(), Yii::app()->language); } }