You are here

function yr_verdata_delete_confirm_submit in Yr Weatherdata 7

Same name and namespace in other branches
  1. 6.2 yr_verdata.admin.inc \yr_verdata_delete_confirm_submit()
  2. 7.3 yr_verdata.admin.inc \yr_verdata_delete_confirm_submit()

Submit handler for the delete location form.

File

./yr_verdata.admin.inc, line 342
This file contains the functions for the admin interface for yr_verdata.

Code

function yr_verdata_delete_confirm_submit($form, &$form_state) {

  // The user wanted this location gone. Delete it from the database.
  $query = db_delete('yr_verdata')
    ->condition('yid', $form_state['values']['yid'])
    ->execute();

  // Clean out the stored xml file.
  file_unmanaged_delete($form_state['values']['filename']);

  // Flush the cache. We flush all of yr_verdata's cached stuff,
  // for simplicity. Maybe I'm just being lazy, but it's late...
  cache_clear_all('yr_verdata', 'cache', TRUE);

  // Redirect.
  drupal_set_message(t('The location was deleted.'));
  drupal_goto('forecast');
}