Return an array containing all available METAR locations/airports.
public getLocations ( ) : array | ||
return | array | An array of station information. Each entry contains: - icao: The ICAO identifier of the location. - name: The human readable name of the station. - country: The country the station is located in (if available). |
/** */ protected function _params() { // @todo Find a way to allow not loading the entire metar location // database in memory. I.e., allow entering free-form text like // the other weather block. try { $rows = $this->_weather->getLocations(); } catch (Horde_Exception $e) { // No data available. return; } $locations = array(); foreach ($rows as $row) { $locations[Horde_Nls_Translation::t(Horde_Nls::getCountryISO($row['country']))][$row['icao']] = sprintf('%s (%s, %s, %s)', $row['name'], !empty($row['municipality']) ? $row['municipality'] : '', $row['state'], $row['country']); } uksort($locations, 'strcoll'); return array('location' => array('type' => 'mlenum', 'name' => _("Location"), 'default' => 'KSFB', 'values' => $locations), 'units' => array('type' => 'enum', 'name' => _("Units"), 'default' => Horde_Service_Weather::UNITS_STANDARD, 'values' => array(Horde_Service_Weather::UNITS_STANDARD => _("Standard"), Horde_Service_Weather::UNITS_METRIC => _("Metric"))), 'knots' => array('type' => 'checkbox', 'name' => _("Wind speed in knots"), 'default' => 0), 'taf' => array('type' => 'checkbox', 'name' => _("Display forecast (TAF)"), 'default' => 0)); }