You are here

function theme_yr_verdata_information in Yr Weatherdata 7

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

Theme function for displaying the location information about a location on that location's main forecast page. Caching is done for the whole page, so we don't need to do it here.

Parameters

$information: The location with basic information about it.

Return value

Returns themed output with basic information for this location.

File

./yr_verdata.module, line 745
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_information($information) {
  $output = array();
  $output['location'] = array(
    '#markup' => $information['location'],
    '#prefix' => '<p class="yr-text">',
    '#suffix' => '</p>',
  );
  $output['lastupdate'] = array(
    '#markup' => $information['lastupdate'],
    '#prefix' => '<p class="yr-text">',
    '#suffix' => '</p>',
  );
  if (isset($information['sun']['never_rise'])) {
    $sun['txt'] = $information['sun']['never_rise'];
    $sun['class'] = 'yr-polarnight';
  }
  elseif (isset($information['sun']['never_set'])) {
    $sun['txt'] = $information['sun']['never_set'];
    $sun['class'] = 'yr-midnightsun';
  }
  else {
    $sun['txt'] = $information['sun']['rise'] . '<br />' . $information['sun']['set'];
    $sun['class'] = 'yr-sun';
  }
  $output['sun'] = array(
    '#markup' => $sun['txt'],
    '#prefix' => '<p class="yr-text ' . $sun['class'] . '">',
    '#suffix' => '</p>',
  );
  $output['links'] = array(
    '#theme' => 'item_list',
    '#items' => $information['links'],
    '#type' => 'ul',
  );
  $output['upcoming-forecast'] = array(
    '#prefix' => '<div id="yr-upcoming-forecast" class="yr-forecast-boxes clearfix">',
    '#suffix' => '</div>',
  );
  foreach ($information['upcoming-forecast'] as $key => $item) {
    $output['upcoming-forecast'][$key] = yr_verdata_forecastbox($item);
  }

  // Add a note about time.
  $output['timenote'] = array(
    '#markup' => t('All times are in local time, %timezone.', array(
      '%timezone' => $information['timezone'],
    )),
    '#prefix' => '<p class="yr-timezone-note">',
    '#suffix' => '</p>',
  );
  return drupal_render($output);
}