You are here

function weather_es_save_config in Weather_es 5

Same name and namespace in other branches
  1. 6 weather_es.module \weather_es_save_config()
  2. 6.2 weather_es.module \weather_es_save_config()

Save the config data

1 call to weather_es_save_config()
weather_es_configuration_submit in ./weather_es.module
Handle the submission of the custom weather_es block.

File

./weather_es.module, line 460
Non-displayable characters.

Code

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]);
  }
}