Copyright 2009-2016 Horde LLC (http://www.horde.org/) See the enclosed file COPYING for license information (LGPL). If you did not receive this file, see http://www.horde.org/licenses/lgpl21.
Since: 2.12.0
Author: Michael J Rubinsky (mrubinsk@horde.org)
Author: Michael Slusarz (slusarz@horde.org)
Example #1
0
 /**
  * Initialize a HordeMap.
  *
  * @deprecated  Call Horde_Core_HordeMap::init() instead.
  *
  * @param array $params
  */
 public static function initMap(array $params = array())
 {
     Horde_Core_HordeMap::init($params);
 }
Example #2
0
 /**
  */
 protected function _content()
 {
     // Set the requested units.
     $this->_weather->units = $this->_params['units'];
     $view = $GLOBALS['injector']->getInstance('Horde_View');
     if (!empty($this->_refreshParams) && !empty($this->_refreshParams->location)) {
         $location = $this->_refreshParams->location;
         $view->instance = '';
     } else {
         $view->instance = hash('md5', mt_rand());
         $GLOBALS['injector']->getInstance('Horde_Core_Factory_Imple')->create('WeatherLocationAutoCompleter', array('id' => 'location' . $view->instance, 'instance' => $view->instance));
         $view->requested_location = $this->_params['location'];
         $location = $this->_params['location'];
     }
     $view->units = $this->_weather->getUnits($this->_weather->units);
     $view->params = $this->_params;
     $view->link = $this->_weather->link;
     $view->title = $this->_weather->title;
     if ($this->_weather->logo) {
         $view->logo = $this->_weather->logo;
     }
     // Test location
     try {
         $view->location = $this->_weather->searchLocations($location);
     } catch (Horde_Service_Weather_Exception $e) {
         return $e->getMessage();
     }
     try {
         $view->forecast = $this->_weather->getForecast($view->location->code, $this->_params['days']);
         $view->station = $this->_weather->getStation();
         $view->current = $this->_weather->getCurrentConditions($view->location->code);
         // @todo: Add link to put alert text in redbox.
         $view->alerts = $this->_weather->getAlerts($view->location->code);
         $view->radar = $this->_weather->getRadarImageUrl($location);
     } catch (Horde_Service_Weather_Exception $e) {
         return $e->getMessage();
     }
     if (!empty($this->_params['showMap']) && !empty($view->instance)) {
         $view->map = true;
         $GLOBALS['page_output']->addScriptFile('weatherblockmap.js', 'horde');
         Horde_Core_HordeMap::init(array('providers' => array('owm', 'osm')));
         $GLOBALS['page_output']->addInlineScript(array('WeatherBlockMap.initializeMap("' . $view->instance . '", { lat: "' . $view->location->lat . '", lon: "' . $view->location->lon . '"});$("weathermaplayer_' . $view->instance . '").show();'), true);
     }
     if (!empty($view->instance)) {
         return $view->render('block/weather');
     } else {
         return $view->render('block/weather_content');
     }
 }