function _weather_get_image in Weather 5
Same name and namespace in other branches
- 5.6 weather.module \_weather_get_image()
- 6.5 weather.module \_weather_get_image()
1 call to _weather_get_image()
- theme_weather in ./weather.module
- Custom theme function for the weather block output
File
- ./weather.module, line 182
- Display <acronym title="METeorological Aerodrome Report">METAR</acronym>
weather data from anywhere in the world
Code
function _weather_get_image($metar) {
if (!isset($metar['condition_text'])) {
$name = 'nodata';
}
else {
if ($metar['condition_text'] == 'no-significant-clouds') {
$metar['condition_text'] = 'few';
}
$day_night = _weather_sunrise_sunset($metar);
$name = $day_night . '-' . $metar['condition_text'];
if (isset($metar['phenomena']['rain'])) {
$rain = $metar['phenomena']['rain'];
}
else {
if (isset($metar['phenomena']['drizzle'])) {
$rain = $metar['phenomena']['drizzle'];
}
}
if (isset($rain)) {
if ($rain['#light']) {
$name .= '-light-rain';
}
else {
if ($rain['#heavy']) {
$name .= '-heavy-rain';
}
else {
$name .= '-moderate-rain';
}
}
}
}
$image['filename'] .= base_path() . drupal_get_path('module', 'weather') . '/images/' . $name . '.png';
$image['alt_text'] = $name;
return $image;
}