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