You are here

function weather_es_modify_form in Weather_es 7

@author jmsirvent

Parameters

$form_state; int $wid: 0: site, user->uid; int $cit_cod; string $cit_name:

1 string reference to 'weather_es_modify_form'
weather_es_menu in ./weather_es.module
hook_menu

File

./weather_es.module, line 280

Code

function weather_es_modify_form($form, &$form_state, $wid, $cit_cod, $cit_nam) {

  // Get the user previous options
  $result = db_query("SELECT inf_typ FROM {weather_es_conf} WHERE wid = :wid AND cit_cod = :cod", array(
    ':wid' => $wid,
    ':cod' => $cit_cod,
  ))
    ->fetchField();
  $inf_typ = unserialize($result);
  $defaults = array();
  if (is_array($inf_typ)) {
    foreach ($inf_typ as $key => $value) {
      $defaults[$key] = $value;
    }
  }
  $form['informacion'] = array(
    '#type' => 'checkboxes',
    '#title' => t('What kind of information do you want to see?'),
    '#options' => array(
      'rain' => t('Rain probability'),
      'snow' => t('Snow level'),
      'sky' => t('Sky state'),
      'wind' => t('Wind direction and speed'),
      'gust' => t('Gust of wind'),
      'temperature' => t('Temperature'),
      'chill' => t('Chill'),
      'humidity' => t('Humidity'),
      'uv' => t('UV'),
    ),
    '#default_value' => $defaults,
  );
  $form['combo'] = array(
    '#type' => 'hidden',
    '#tree' => TRUE,
  );
  $form['combo']['ciudad'] = array(
    '#type' => 'hidden',
    '#value' => $cit_cod,
  );
  $form_state['storage']['wid'] = $wid;
  $form['#submit'] = array(
    'weather_es_form_submit',
  );
  $form['#validate'] = array(
    'weather_es_form_validate',
  );
  return confirm_form($form, t('Are you sure you want to modify the %name forecast information?', array(
    '%name' => $cit_nam,
  )), _weather_es_redirect($wid), t('This action cannot be undone.'), t('Change configuration'), t('Cancel'));
}