You are here

function weather_get_places_xml in Weather 5.6

Return all places with their ICAO codes for a given country.

This function is used to generate an XML output of the places, to be used from helper.js for updating the places selection box after the country has been changed.

1 string reference to 'weather_get_places_xml'
weather_menu in ./weather.module
Implementation of hook_menu().

File

./weather.module, line 859
Display <acronym title="METeorological Aerodrome Report">METAR</acronym> weather data from anywhere in the world

Code

function weather_get_places_xml($country = 'Germany') {

  // Include the ICAO codes
  require_once drupal_get_path('module', 'weather') . '/icao_codes.inc';
  $places = _weather_get_places($country);
  header('Content-type: text/xml; charset=utf-8');
  echo "<?xml version=\"1.0\"?>\n";
  echo "<places>\n";
  foreach ($places as $icao => $name) {
    echo "<place icao=\"{$icao}\">" . htmlspecialchars($name) . "</place>\n";
  }
  echo "</places>\n";
}