function theme_yr_verdata_pressure in Yr Weatherdata 6.2
Same name and namespace in other branches
- 7 yr_verdata.module \theme_yr_verdata_pressure()
Function for generating the pressure value for one forecast period.
Parameters
$vars: The pressure property from the loaded xml object. Attributes are 'value' and 'unit'.
Return value
Returns a pressure value in the unit specified in yr_verdata preferences.
1 theme call to theme_yr_verdata_pressure()
- yr_verdata_generate_forecastboxes in ./
yr_verdata.module - Function for generating one or more forecast boxes for given periods.
File
- ./
yr_verdata.module, line 824 - yr_verdata.module This file contains the code for getting the forecast from yr.no and displaying it on a Drupal site.
Code
function theme_yr_verdata_pressure($vars) {
$torr = bcdiv($vars['pressure']['value'], 1.333, 3);
$pressure = array(
'hPa' => $vars['pressure']['value'],
'psi' => bcdiv($vars['pressure']['value'], 68.94799999999999, 2),
'torr' => $torr,
'inHg' => bcdiv($torr, 25.4, 2),
'bar' => bcdiv($vars['pressure']['value'], 1000, 4),
);
$unit = variable_get('yr_verdata_press_unit', 'hPa');
$output = t('Pressure: @value @unit', array(
'@value' => $pressure[$unit],
'@unit' => $unit,
));
return $output;
}