You are here

weather_es.module in Weather_es 6.2

Shows weather data of Spain (by AEMET)

The module is compatible with Drupal 6.x

@author José Mª Sirvent y Pablo López

File

weather_es.module
View source
<?php

/*
 * Weather_es shows the weather forecast of 8112 cities of Spain using the AEMET web information.
 * Copyright (C) 2008 José Mª Sirvent <drupal@hykrion.com>
 *
 * This file is part of the Drupal weather_es module.
 * It is based on the Weather module which was written in 2006 by
 * Tobias Toedter <t.toedter@gmx.net> and on the multipage_form_example.module,v 1.9
 * written by davereid.
 *
 * Weather_es is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * Weather_es is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with Weather_es; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 */

/**
 * @file
 * Shows weather data of Spain (by AEMET)
 *
 * The module is compatible with Drupal 6.x
 *
 * @author José Mª Sirvent y Pablo López
 */

// Include the parser for AEMET data
require_once drupal_get_path('module', 'weather_es') . '/weather_es_parser.inc';

/**
 * Implementation of hook_help().
 */
function weather_es_help($page, $arg) {
  switch ($page) {
    case 'admin/modules#description':
      return t('Spanish forecast by AEMET.');
    case 'admin/settings/weather_es':
      return t('<p>Here you can create a configuration with one or more locations or delete a location from your configuration.</p>');
  }
}

/**
 * Implementation of hook_perm().
 */
function weather_es_perm() {
  return array(
    'administer custom weather_es block',
  );
}

/**
 * Implementation of hook_menu().
 */
function weather_es_menu() {
  global $user;
  $items['admin/settings/weather_es'] = array(
    'title' => 'Weather_es',
    'description' => 'Configure the system weather_es block.',
    'page callback' => 'weather_es_main',
    'page arguments' => array(
      0,
    ),
    'access arguments' => array(
      'administer site configuration',
    ),
    'type' => MENU_NORMAL_ITEM,
  );
  $items['admin/settings/weather_es/edit'] = array(
    'title' => 'Weather_es',
    'description' => 'Configure the system weather_es block',
    'page callback' => 'drupal_get_form',
    'page arguments' => array(
      'weather_es_configuration_form',
      0,
    ),
    'access arguments' => array(
      'administer site configuration',
    ),
    'type' => MENU_CALLBACK,
  );
  $items['admin/settings/weather_es/delete'] = array(
    'title' => 'Delete a location',
    'description' => 'Delete a location from the system weather_es block',
    'page callback' => 'drupal_get_form',
    'page arguments' => array(
      'weather_es_confirm_delete_form',
      0,
    ),
    'access arguments' => array(
      'administer site configuration',
    ),
    'type' => MENU_CALLBACK,
  );
  $items['user/%/weather_es'] = array(
    'title' => 'My weather_es',
    'description' => 'Configure your custom weather_es block.',
    'page callback' => 'weather_es_main',
    'page arguments' => array(
      1,
    ),
    'access arguments' => array(
      'administer custom weather_es block',
    ),
    'type' => MENU_LOCAL_TASK,
  );
  $items['user/%/weather_es/edit'] = array(
    'title' => 'Edit my weather_es',
    'description' => 'Configure your custom weather_es block',
    'page callback' => 'drupal_get_form',
    'page arguments' => array(
      'weather_es_configuration_form',
      1,
    ),
    'access arguments' => array(
      'administer custom weather_es block',
    ),
    'type' => MENU_CALLBACK,
  );
  $items['user/%/weather_es/delete'] = array(
    'title' => 'Delete a location from my weather_es',
    'description' => 'Delete a location from my weather_es block',
    'page callback' => 'drupal_get_form',
    'page arguments' => array(
      'weather_es_confirm_delete_form',
      1,
    ),
    'access arguments' => array(
      'administer custom weather_es block',
    ),
    'type' => MENU_CALLBACK,
  );
  $items['weather_es/reload'] = array(
    'page callback' => 'reload_weather_es_block',
    'access arguments' => array(
      'access content',
    ),
    'type' => MENU_CALLBACK,
  );
  return $items;
}
function reload_weather_es_block() {
  print block_weather_es_contents($_POST['which_block'], $_POST['weather_es_page']);
}

/**
 * Main weather_es_page
 */
function weather_es_main($wuid) {

  // Table header
  $header = array(
    array(
      'data' => t('City'),
      'field' => 'city',
    ),
    array(
      'data' => t('Operation'),
    ),
  );
  $path = _weather_es_redirect($wuid);
  $rows = array();
  $sql = "SELECT * FROM {weather_es_config} wec WHERE wec.uid = %d";
  $result = db_query(db_rewrite_sql($sql), $wuid);
  while ($row = db_fetch_array($result)) {

    // delete the '/' caracter from the city name (Spanish/one_of_the_other_3_official_languages) and replace it with '-'
    $pos = strpos($row['cit_nam'], '/');
    if ($pos != 0) {
      $row['cit_nam'] = str_replace('/', '-', $row['cit_nam']);
    }
    $rows[] = array(
      'cit_nam' => $row['cit_nam'],
      l(t('delete'), $path . '/delete/' . $row['cod_pro'] . $row['cod_loc'] . '/' . $row['cit_nam']),
    );
  }
  if (count($rows) == 0) {
    $rows[] = array(
      array(
        'data' => '<em>' . t('There are currently no locations.') . '</em>',
        'colspan' => 4,
      ),
    );
  }
  $output = theme('table', $header, $rows);

  // Create a new location
  $output .= '<p>' . l(t('Create a new configuration or add a new location to an exisiting configuration.'), $path . '/edit') . '</p>';
  return $output;
}

/**
 * Show a configuration page for a custom weather_es block
 */
function weather_es_configuration_form($form_state, $wuid) {
  if (!isset($form_state['values'])) {
    $step = 1;
  }
  else {
    $step = $form_state['values']['step'] + 1;
  }
  $form['step'] = array(
    '#type' => 'value',
    '#value' => $step,
  );
  switch ($step) {
    case 1:

      // Page 1
      $form['provincia'] = array(
        '#type' => 'fieldset',
        '#title' => t('Select a province'),
        '#collapsible' => TRUE,
        '#collapsed' => FALSE,
        '#tree' => TRUE,
      );
      $form['provincia']['seleccionada'] = array(
        '#type' => 'select',
        '#title' => t('Province'),
        '#default_value' => 00,
        '#options' => _weather_es_provincies(),
        '#description' => t('Province of the city'),
      );
      break;
    case 2:

      // Show page 2
      $form['poblacion'] = array(
        '#type' => 'fieldset',
        '#title' => t('Select a city'),
        '#collapsible' => TRUE,
        '#collapsed' => FALSE,
        '#tree' => TRUE,
      );
      $form['poblacion']['seleccionada'] = array(
        '#type' => 'select',
        '#title' => t('City'),
        '#options' => _weather_es_cities($form_state['values']['provincia']['seleccionada']),
        '#description' => t('City to show the forecast'),
      );
      $form['idioma'] = array(
        '#type' => 'radios',
        '#title' => t('Languages'),
        '#options' => array(
          'es' => t('Spanish'),
          'ca' => t('Catalan'),
          'eu' => t('Euskera'),
          'gl' => t('Galician'),
          'en' => t('English'),
          'fr' => t('French'),
        ),
        '#description' => t('Choose the language you will see the weather data.'),
        '#default_value' => 'es',
      );
      $form['save'] = array(
        '#type' => 'submit',
        '#value' => t('Save configuration'),
      );
      $form['add'] = array(
        '#type' => 'submit',
        '#value' => t('Add new location'),
      );
      $form['wuid'] = array(
        '#type' => 'value',
        '#value' => $wuid,
      );
      break;
  }
  $form['next'] = array(
    '#type' => 'button',
    '#value' => t('Next'),
  );

  // Hide the button at last step
  if ($step >= 2) {
    $form['next'] = array(
      '#type' => 'hidden',
    );
  }
  return $form;
}

/**
 * Validate the form.
 */
function weather_es_configuration_form_validate($form, &$form_state) {
  switch ($form_state['values']['step']) {
    case 1:
      if ($form_state['values']['provincia']['seleccionada'] == 0) {
        form_set_error('seleccionada', t('You must select a valid province.'));
      }
      else {
        $form_state['rebuild'] = TRUE;

        // Changes between Drupal-6.x-1.3 and Drupal-6.x-1.4. See http://drupal.org/node/302240
        $form_state['submitted'] = TRUE;
      }
      break;
    case 2:
      if (strlen($form_state['values']['poblacion']['seleccionada']) != 5 or !in_array($form_state['values']['idioma'], array(
        'es',
        'ca',
        'gl',
        'eu',
        'en',
        'fr',
      ))) {
        form_set_error('seleccionada', t('You must select a valid city and a valid language.'));
      }
      else {
        $form_state['rebuild'] = FALSE;
      }
      break;
    default:
      $form_state['rebuild'] = FALSE;
  }
}

/**
 * Handle the submission of the custom weather_es block.
 */
function weather_es_configuration_form_submit($form, &$form_state) {

  // Wait until last step

  /*
  if ($form_state['values']['step'] < 2) {
    //$form_state['rebuild'] = TRUE;

    return;
  }
  */
  unset($form_state['rebuild']);
  $cod_pro = substr($form_state['values']['poblacion']['seleccionada'], 0, 2);
  $cod_loc = substr($form_state['values']['poblacion']['seleccionada'], 2, 4);

  //$cit_nam = $localidades[$form_state['values']['poblacion']['seleccionada']];
  $localidades = _weather_es_cities($cod_pro);

  // Get data from AEMET.
  $aemet = _weather_es_aemet($form_state['values']['wuid'], $form_state['values']['poblacion']['seleccionada'], $form_state['values']['idioma'], $localidades[$form_state['values']['poblacion']['seleccionada']]);
  if ($aemet != -1) {

    // Save a new user configuration or rewrite an existing one
    if ($_POST['op'] == t('Save configuration')) {

      // Conection OK, delete previous user configuration
      $sql = "DELETE FROM {weather_es_config} WHERE uid = %d";
      db_query($sql, $form_state['values']['wuid']);
    }

    // Avoid add a city already in the user configuration
    if (!db_result(db_query("SELECT COUNT(*) FROM {weather_es_config} WHERE uid = %d AND cod_pro = %d AND cod_loc = %d", $wuid, $cod_pro, $cod_loc))) {

      // Save config data
      weather_es_save_config($form_state['values']['wuid'], $cod_pro, $cod_loc, $localidades[$form_state['values']['poblacion']['seleccionada']], $form_state['values']['idioma'], $aemet);
    }

    // Delete the previous city data and save the new one
    db_query("DELETE FROM {weather_es_data} WHERE cod_pro = %d AND cod_loc = %d", $cod_pro, $cod_loc);

    // Save the data
    weather_es_save_data($cod_pro, $cod_loc, $aemet);
    drupal_set_message(t('Config save for: %city.', array(
      '%city' => $localidades[$form_state['values']['poblacion']['seleccionada']],
    )));
  }
  else {

    // The connection with AEMET has failt, try in 10'
    db_query("UPDATE {weather_es_config} SET pro_act = %d WHERE uid = %d AND cod_pro = %d AND cod_loc = %d", time() + 10 * 60, $form_state['values']['wuid'], $cod_pro, $cod_loc);
    drupal_set_message(t('The connection with AEMET has failt.'));
  }

  // Redirect the user
  $path = _weather_es_redirect($form_state['values']['wuid']);
  drupal_goto($path);
}

/**
 * Confirmation page before deleting a location
 */
function weather_es_confirm_delete_form($form, $wuid, $cit_cod, $cit_nam) {
  $path = _weather_es_redirect($wuid);
  $form = array();
  $form['wuid'] = array(
    '#type' => 'value',
    '#value' => $wuid,
  );
  $form['cit_cod'] = array(
    '#type' => 'hidden',
    '#value' => $cit_cod,
  );
  $form['path'] = array(
    '#type' => 'value',
    '#value' => $path,
  );
  return confirm_form($form, t('Are you sure you want to delete the location %name?', array(
    '%name' => $cit_nam,
  )), '' . $path, t('This action cannot be undone.'), t('Delete'), t('Cancel'));
}

/**
 * Handle the deletion of a location
 */
function weather_es_confirm_delete_form_submit($form, &$form_state) {

  // delete the entry
  $sql = "DELETE FROM {weather_es_config} WHERE uid = %d AND cod_pro = %d AND cod_loc = %d";
  db_query($sql, $form_state['values']['wuid'], substr($form_state['values']['cit_cod'], 0, 2), substr($form_state['values']['cit_cod'], 2, 4));
  drupal_set_message(t('The location has been deleted.'));
  $path = $form_state['values']['path'];
  $form_state['redirect'] = $path;
}

/**
 * Implementation of hook_block().
 */
function weather_es_block($op = 'list', $delta = 0, $edit = array()) {
  switch ($op) {
    case 'list':
      $blocks[0]['info'] = t('Weather_es: system-wide');
      $blocks[1]['info'] = t('Weather_es: custom user');
      return $blocks;
    case 'configure':
      return $form;
    case 'view':
    default:
      drupal_add_js(drupal_get_path('module', 'weather_es') . '/js/weather_es.js');
      if ($delta == 0 and user_access('access content')) {

        // Show the system weather_es block
        $title = t('System weather');
        $content = weather_es_first_load(0);
      }
      else {
        if ($delta == 1 and user_access('administer custom weather_es block')) {

          // Show the user weather_es block
          $title = t('User weather');
          $content = weather_es_first_load(1);
        }
      }
      $block['subject'] = $title;
      $block['content'] = $content;
      return $block;
  }
}

/**
 * Show the weather_es contents
 */
function block_weather_es_contents($which_block, $page = 1) {
  global $user;
  $sql = "SELECT * FROM {weather_es_config} wec WHERE wec.uid = %d";

  // Block 0 is about the site, 1 is about the user
  if ($which_block == 0) {
    $usrcnfresult = db_query(db_rewrite_sql($sql), 0);
  }
  else {
    $usrcnfresult = db_query(db_rewrite_sql($sql), $user->uid);
  }
  $content .= '<div id="weather_es_container-' . $which_block . '" class="weather_es_container">';
  while ($usrcnf = db_fetch_object($usrcnfresult)) {

    // Update ancient data
    if ($usrcnf->pro_act < time()) {
      if ($which_block == 0) {
        $wuid = 0;
      }
      else {
        $wuid = $usrcnf->uid;
      }
      $ciudad = $usrcnf->cod_pro . $usrcnf->cod_loc;
      $aemet = _weather_es_aemet($wuid, $usrcnf->cod_pro . $usrcnf->cod_loc, $usrcnf->lan, $usrcnf->cit_nam);
      if ($aemet != -1) {

        // Delete the previous city data and save the new one
        db_query("DELETE FROM {weather_es_data} WHERE cod_pro = %d AND cod_loc = %d", $usrcnf->cod_pro, $usrcnf->cod_loc);
        weather_es_save_data($usrcnf->cod_pro, $usrcnf->cod_loc, $aemet);

        // Next connection to AEMET in 4h
        db_query("UPDATE {weather_es_config} SET pro_act = %d WHERE uid = %d AND cod_pro = %d AND cod_loc = %d", time() + 4 * 3600, $wuid, $usrcnf->cod_pro, $usrcnf->cod_loc);
      }
      else {

        // The connection with AEMET has failt, try in 10'
        db_query("UPDATE {weather_es_config} SET pro_act = %d WHERE uid = %d AND cod_pro = %d AND cod_loc = %d", time() + 10 * 60, $wuid, $cod_pro, $cod_loc);
      }
    }
    $content .= '<strong>' . check_markup($usrcnf->cit_nam) . '</strong>';
    $content .= t('<small><strong>Weather forecast by AEMET.</strong></small>');
    $sql = "SELECT * FROM {weather_es_data} wed WHERE cod_pro = %d AND wed.cod_loc = %d ORDER BY wed.did ASC";
    $result = db_query_range(db_rewrite_sql($sql), $usrcnf->cod_pro, $usrcnf->cod_loc, 2 * ($page - 1), 2);

    // Show the data by the theme
    while ($data = db_fetch_object($result)) {
      $content .= theme('weather_es', $data, $usrcnf);
    }
  }
  return $content .= '</div>';
}
function weather_es_first_load($which_block) {
  $contents = block_weather_es_contents($which_block, 1);
  if (strlen($contents) > 0) {
    return '<div id="test-ajax-' . $which_block . '">' . $contents . '</div>' . weather_es_pager($which_block);
  }
  else {
    return '';
  }
}
function weather_es_pager($which_block) {
  return ' <div class="item-list"><ul class="pager">
    <li class="pager-item weather_es_pager-' . $which_block . '"><a class="active weather_es" id="weather_es_pager-' . $which_block . '-1" href="javascript:void(0)" rel="1">1</a></li>
    <li class="pager-item weather_es_pager-' . $which_block . '"><a class="active weather_es" id="weather_es_pager-' . $which_block . '-2" href="javascript:void(0)" rel="2" >2</a></li>
    <li class="pager-item weather_es_pager-' . $which_block . '"><a class="active weather_es" id="weather_es_pager-' . $which_block . '-3" href="javascript:void(0)" rel="3" >3</a></li>
    <li class="pager-item weather_es_pager-' . $which_block . '"><a class="active weather_es" id="weather_es_pager-' . $which_block . '-4" href="javascript:void(0)" rel="4" >4</a></li>
    </ul></div>';
}

/**
 * Save the config data
 */
function weather_es_save_config($wuid, $cod_pro, $cod_loc, $cit_nam, $lan, $aemet) {

  // Is there snow info?
  $snow = FALSE;
  for ($i = 0; $i < sizeof($aemet[2]); $i++) {
    if (preg_match('#\\(m\\)#', $aemet[2][$i])) {
      $snow = TRUE;
    }
  }
  if ($snow) {
    db_query("INSERT INTO {weather_es_config} (uid, cod_pro, cod_loc, cit_nam, lan, pro_act, sky, rain, snow, tmax, tmin, win_dir, win_spd, iv, rsk)\n    VALUES(%d, %d, %d, '%s', '%s', %d, '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s')", $wuid, $cod_pro, $cod_loc, $cit_nam, $lan, time() + 4 * 3600, $aemet[2][0], $aemet[2][1], $aemet[2][2], $aemet[2][3], $aemet[2][4], $aemet[2][5], $aemet[2][6], $aemet[2][7], $aemet[2][8]);
  }
  else {
    db_query("INSERT INTO {weather_es_config} (uid, cod_pro, cod_loc, cit_nam, lan, pro_act, sky, rain, tmax, tmin, win_dir, win_spd, iv, rsk)\n    VALUES(%d, %d, %d, '%s', '%s', %d, '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s')", $wuid, $cod_pro, $cod_loc, $cit_nam, $lan, time() + 4 * 3600, $aemet[2][0], $aemet[2][1], $aemet[2][2], $aemet[2][3], $aemet[2][4], $aemet[2][5], $aemet[2][6], $aemet[2][7]);
  }
}

/**
 * Save the data
 */
function weather_es_save_data($cod_pro, $cod_loc, $aemet) {

  // Delete the previous city data and save the new one
  db_query("DELETE FROM {weather_es_data} WHERE cod_pro = %d AND cod_loc = %d", $cod_pro, $cod_loc);

  // Save the data of the three first days
  // am
  if ($aemet[1][0] == 'am') {
    for ($i = 0; $i < 3; $i++) {
      db_query("INSERT INTO {weather_es_data} (cod_pro, cod_loc, day, ampm, sky_txt1, sky_img1, sky_txt2, sky_img2, rain, snow, tmax, tmin, win_dir1, win_spd1, win_dir2, win_spd2, iv_max, rsk)\n      VALUES(%d, %d, '%s', '%s', '%s', %d, '%s', %d, %d, '%s', %d, %d, '%s', %d, '%s', %d, %d, '%s')", $cod_pro, $cod_loc, $aemet[0][$i], $aemet[1][2 * $i], $aemet[4][2 * $i], $aemet[3][2 * $i], $aemet[4][2 * $i + 1], $aemet[3][2 * $i + 1], $aemet[5][$i], $aemet[6][$i], $aemet[7][$i], $aemet[8][$i], $aemet[9][2 * $i], $aemet[10][2 * $i], $aemet[9][2 * $i + 1], $aemet[10][2 * $i + 1], $aemet[11][$i], $aemet[12][$i]);
    }
  }
  else {
    db_query("INSERT INTO {weather_es_data} (cod_pro, cod_loc, day, ampm, sky_txt2, sky_img2, rain, snow, tmax, tmin, win_dir1, win_spd1, iv_max, rsk)\n    VALUES(%d, %d, '%s', '%s', '%s', %d, %d, '%s', %d, %d, '%s', %d, %d, '%s')", $cod_pro, $cod_loc, $aemet[0][0], $aemet[1][0], $aemet[4][0], $aemet[3][0], $aemet[5][0], $aemet[6][0], $aemet[7][0], $aemet[8][0], $aemet[9][0], $aemet[10][0], $aemet[11][0], $aemet[12][0]);
    for ($i = 1; $i < 3; $i++) {
      db_query("INSERT INTO {weather_es_data} (cod_pro, cod_loc, day, ampm, sky_txt1, sky_img1, sky_txt2, sky_img2, rain, snow, tmax, tmin, win_dir1, win_spd1, win_dir2, win_spd2, iv_max, rsk)\n      VALUES(%d, %d, '%s', '%s', '%s', %d, '%s', %d, %d, '%s', %d, %d, '%s', %d, '%s', %d, %d, '%s')", $cod_pro, $cod_loc, $aemet[0][$i], $aemet[1][2 * $i - 1], $aemet[4][2 * $i - 1], $aemet[3][2 * $i - 1], $aemet[4][2 * $i], $aemet[3][2 * $i], $aemet[5][$i], $aemet[6][$i], $aemet[7][$i], $aemet[8][$i], $aemet[9][2 * $i - 1], $aemet[10][2 * $i - 1], $aemet[9][2 * $i], $aemet[10][2 * $i], $aemet[11][$i], $aemet[12][$i]);
    }
  }

  // Rest of the week
  if ($aemet[1][0] == 'am') {
    $offset = 0;
  }
  else {
    $offset = -1;
  }
  for ($i = 3; $i < 7; $i++) {
    db_query("INSERT INTO {weather_es_data} (cod_pro, cod_loc, day, sky_txt1, sky_img1, rain, snow, tmax, tmin, win_dir1, win_spd1)\n    VALUES(%d, %d, '%s', '%s', %d, %d, '%s', %d, %d, '%s', %d)", $cod_pro, $cod_loc, $aemet[0][$i], $aemet[4][$i + 3 + $offset], $aemet[3][$i + 3 + $offset], $aemet[5][$i], $aemet[6][$i], $aemet[7][$i], $aemet[8][$i], $aemet[9][$i + 3 + $offset], $aemet[10][$i + 3 + $offset]);
  }
}

/**
 * Theme function for the weather_es block output ��MUY INTERESANTE VER user.module!!
 */
function weather_es_theme() {
  return array(
    'weather_es' => array(
      'template' => 'weather-es',
      'arguments' => array(
        'data' => NULL,
        'usrcnf' => NULL,
      ),
    ),
  );
}

/**
 * Preprocess the data
 */
function template_preprocess_weather_es(&$variables) {
  $variables['data']->day = filter_xss($variables['data']->day);
  $variables['data']->sky_txt1 = filter_xss($variables['data']->sky_txt1);
  $variables['usrcnf']->sky = filter_xss($variables['usrcnf']->sky);
  $variables['data']->ampm = filter_xss($variables['data']->ampm);
  $variables['data']->sky_img1 = filter_xss($variables['data']->sky_img1);
  $variables['data']->sky_txt2 = filter_xss($variables['data']->sky_txt2);
  $variables['data']->sky_img2 = filter_xss($variables['data']->sky_img2);
  $variables['usrcnf']->sky = filter_xss($variables['usrcnf']->sky);
  $variables['data']->rain = filter_xss($variables['data']->rain);
  $variables['usrcnf']->rain = filter_xss($variables['usrcnf']->rain);
  $variables['data']->snow = filter_xss($variables['data']->snow);
  $variables['usrcnf']->snow = filter_xss($variables['usrcnf']->snow);
  $variables['data']->tmax = filter_xss($variables['data']->tmax);
  $variables['usrcnf']->tmax = filter_xss($variables['usrcnf']->tmax);
  $variables['data']->tmin = filter_xss($variables['data']->tmin);
  $variables['usrcnf']->tmin = filter_xss($variables['usrcnf']->tmin);
  $variables['data']->win_dir1 = filter_xss($variables['data']->win_dir1);
  $variables['usrcnf']->win_dir1 = filter_xss($variables['usrcnf']->win_dir1);
  $variables['data']->win_dir2 = filter_xss($variables['data']->win_dir2);
  $variables['usrcnf']->win_dir2 = filter_xss($variables['usrcnf']->win_dir2);
  $variables['data']->win_spd1 = filter_xss($variables['data']->win_spd1);
  $variables['usrcnf']->win_spd1 = filter_xss($variables['usrcnf']->win_spd1);
  $variables['data']->win_spd2 = filter_xss($variables['data']->win_spd2);
  $variables['usrcnf']->win_spd2 = filter_xss($variables['usrcnf']->win_spd2);
  $variables['data']->iv_max = filter_xss($variables['data']->iv_max);
  $variables['usrcnf']->iv_max = filter_xss($variables['usrcnf']->iv_max);
  $variables['data']->rsk = filter_xss($variables['data']->rsk);
  $variables['usrcnf']->rsk = filter_xss($variables['usrcnf']->rsk);
}

Functions

Namesort descending Description
block_weather_es_contents Show the weather_es contents
reload_weather_es_block
template_preprocess_weather_es Preprocess the data
weather_es_block Implementation of hook_block().
weather_es_configuration_form Show a configuration page for a custom weather_es block
weather_es_configuration_form_submit Handle the submission of the custom weather_es block.
weather_es_configuration_form_validate Validate the form.
weather_es_confirm_delete_form Confirmation page before deleting a location
weather_es_confirm_delete_form_submit Handle the deletion of a location
weather_es_first_load
weather_es_help Implementation of hook_help().
weather_es_main Main weather_es_page
weather_es_menu Implementation of hook_menu().
weather_es_pager
weather_es_perm Implementation of hook_perm().
weather_es_save_config Save the config data
weather_es_save_data Save the data
weather_es_theme Theme function for the weather_es block output ��MUY INTERESANTE VER user.module!!