You are here

function theme_weather in Weather 5

Same name and namespace in other branches
  1. 5.6 weather.module \theme_weather()

Custom theme function for the weather block output

1 theme call to theme_weather()
weather_block in ./weather.module
Generate HTML for the weather block

File

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

Code

function theme_weather($config, $metar) {
  $content .= '<p><strong>' . check_plain($config['real_name']) . '</strong></p>';
  $image = _weather_get_image($metar);
  $content .= '<div style="text-align:center;"><img src="';
  $content .= $image['filename'];
  $content .= '" alt="' . $image['alt_text'] . '" width="64" height="64" /></div>';
  $content .= '<ul><li>';
  $content .= _weather_format_condition($metar);
  $content .= '</li><li>';
  $content .= t('Temperature: !temperature', array(
    '!temperature' => _weather_format_temperature($metar['temperature'], $config['units']),
  ));
  $content .= '</li><li>';
  $content .= t('Wind: !wind', array(
    '!wind' => _weather_format_wind($metar['wind'], $config['units']),
  ));
  $content .= '</li><li>';
  $content .= t('Pressure: !pressure', array(
    '!pressure' => _weather_format_pressure($metar['pressure'], $config['units']),
  ));
  $content .= '</li><li>';
  $content .= t('Rel. Humidity: !rel_humidity', array(
    '!rel_humidity' => _weather_format_relative_humidity($metar['temperature'], $metar['dewpoint']),
  ));
  $content .= '</li><li>';
  $content .= t('Visibility: !visibility', array(
    '!visibility' => _weather_format_visibility($metar['visibility'], $config['units']),
  ));
  $content .= '</li></ul>';
  $content .= '<small>';
  $content .= t("Reported on:");
  $content .= '<br />' . format_date($metar['reported_on']);
  $content .= '</small>';
  return $content;
}