You are here

function theme_yr_verdata_precip in Yr Weatherdata 7

Same name and namespace in other branches
  1. 6.2 yr_verdata.module \theme_yr_verdata_precip()

Function for generating the precipitation value for one forecast period.

Parameters

$vars: The precipitation property from the loaded xml object. Only needed attribute is 'value'.

Return value

Returns a precipitation value in the unit specified in yr_verdata preferences.

2 theme calls to theme_yr_verdata_precip()
yr_verdata_generate_forecastboxes in ./yr_verdata.module
Function for generating one or more forecast boxes for given periods.
yr_verdata_page_all in ./yr_verdata.module
Function for generating the main forecast page.

File

./yr_verdata.module, line 946
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_precip($vars) {
  $precipitation = array(
    'mm' => $vars['precip']['value'],
    'in' => bcdiv($vars['precip']['value'], 25.4, 2),
  );
  $unit = variable_get('yr_verdata_precip_unit', 'mm');
  $output = t('@value @unit precipitation', array(
    '@value' => $precipitation[$unit],
    '@unit' => $unit,
  ));
  return $output;
}