summaryrefslogtreecommitdiff
path: root/protected/components
diff options
context:
space:
mode:
authorccwn <tzur@ccwn.org>2012-04-21 09:53:23 +0200
committerccwn <tzur@ccwn.org>2012-04-21 09:53:23 +0200
commit314328f527e8cae759d496f528a1472d7970c137 (patch)
tree39fd79cdc6e8dd4f9cf4b8b678fb69bff9188a47 /protected/components
parented8e4f88f2877c7bed09662291711b7165e7455f (diff)
Extension "EGMap" hinzugefügt
Wrapper für eigene Map hinzugefügt Marker-Icons hinzugefügt
Diffstat (limited to 'protected/components')
-rw-r--r--protected/components/Html.php23
-rw-r--r--protected/components/Map.php49
2 files changed, 72 insertions, 0 deletions
diff --git a/protected/components/Html.php b/protected/components/Html.php
new file mode 100644
index 0000000..c4a246c
--- /dev/null
+++ b/protected/components/Html.php
@@ -0,0 +1,23 @@
+<?php
+class Html extends CHtml
+{
+ /**
+ * Makes the given URL relative to the /image directory
+ */
+ public static function imageUrl($url) {
+ return Yii::app()->baseUrl.'/images/'.$url;
+ }
+ /**
+ * Makes the given URL relative to the /css directory
+ */
+ public static function cssUrl($url) {
+ return Yii::app()->baseUrl.'/css/'.$url;
+ }
+ /**
+ * Makes the given URL relative to the /js directory
+ */
+ public static function jsUrl($url) {
+ return Yii::app()->baseUrl.'/js/'.$url;
+ }
+}
+?> \ No newline at end of file
diff --git a/protected/components/Map.php b/protected/components/Map.php
new file mode 100644
index 0000000..77cb097
--- /dev/null
+++ b/protected/components/Map.php
@@ -0,0 +1,49 @@
+<?php
+class Map {
+ private $POS_LAT;
+ private $POS_LONG;
+ private $gMap;
+ private $publishedIcon;
+ private $notPublishedIcon;
+
+ public function __construct() {
+ $this->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(880);
+ $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);
+ }
+} \ No newline at end of file