function weather_custom_block_form_submit in Weather 5.6
Same name and namespace in other branches
- 5 weather.module \weather_custom_block_form_submit()
- 6.5 weather.module \weather_custom_block_form_submit()
Handle the submission of the custom weather block
File
- ./
weather.module, line 764 - Display <acronym title="METeorological Aerodrome Report">METAR</acronym> weather data from anywhere in the world
Code
function weather_custom_block_form_submit($form_id, $form_values) {
// delete the previous entry
$sql = "DELETE FROM {weather_config} WHERE uid=%d AND cid=%d";
db_query($sql, $form_values['uid'], $form_values['cid']);
// insert the new configuration values into the DB
$sql = "INSERT INTO {weather_config}\n (uid, cid, icao, real_name, units, settings, weight)\n VALUES(%d, %d, '%s', '%s', '%s', '%s', %d)";
db_query($sql, $form_values['uid'], $form_values['cid'], strtoupper($form_values['icao']), $form_values['real_name'], serialize($form_values['units']), serialize($form_values['settings']), $form_values['weight']);
if ($form_values['uid'] == WEATHER_DEFAULT_BLOCK) {
drupal_set_message(t('The default configuration has been saved.'));
}
else {
drupal_set_message(t('The location has been saved.'));
}
if ($form_values['uid'] == WEATHER_SYSTEM_BLOCK or $form_values['uid'] == WEATHER_DEFAULT_BLOCK) {
// go back to the administration of the system weather block
drupal_goto('admin/settings/weather');
}
else {
drupal_goto('user/' . $form_values['uid'] . '/weather');
}
}