コード例 #1
0
ファイル: EGMap.php プロジェクト: Aplay/myhistorypark_site
 /**
  * @param EGMapMarker $marker a marker to be put on the map
  * @since 2011-01-11 added support for global infowindow
  * @since 2011-01-22 added support for EGMapMarkerWithLabel plugin
  * @since 2011-01-23 fixed info window shared
  */
 public function addMarker(EGMapMarker $marker)
 {
     if (null === $this->resources->itemAt('markers')) {
         $this->resources->add('markers', new CTypedList('EGMapMarker'));
     }
     if ($marker->getHtmlInfoWindow() && $marker->htmlInfoWindowShared() && !$this->getGlobalVariable($this->getJsName() . '_info_window')) {
         $this->addGlobalVariable($this->getJsName() . '_info_window', 'null');
     }
     if ($marker->getHtmlInfoBox() && $marker->htmlInfoBoxShared() && !$this->getGlobalVariable($this->getJsName() . '_info_box')) {
         $this->addGlobalVariable($this->getJsName() . '_info_box', 'null');
         $this->resources->add('infobox_config', $marker->getHtmlInfoBox()->getEncodedOptions());
         $this->registerPlugin('EGMapInfoBox');
     }
     if ($marker instanceof EGMapMarkerWithLabel && !$this->pluginRegistered('EGMapMarkerWithLabel')) {
         $this->registerPlugin('EGMapMarkerWithLabel');
     }
     $this->resources->itemAt('markers')->add($marker);
 }