function library_admin_action_submit in Library 6
Same name and namespace in other branches
- 5.2 library.admin.inc \library_admin_action_submit()
- 6.2 library.admin.inc \library_admin_action_submit()
- 7 library.admin.inc \library_admin_action_submit()
Menu callback: Edit Library Action.
See also
library_admin_action_validate()
theme_library_admin_new_action()
1 string reference to 'library_admin_action_submit'
- library_admin_action in ./
library.admin.inc - Menu callback: Edit Library Action.
File
- ./
library.admin.inc, line 342 - Administrative settings for the library module
Code
function library_admin_action_submit($form, &$form_state) {
if ($form_state['values']['op'] == t('Save action')) {
db_query("UPDATE {library_actions} SET name = '%s', status_change = %d WHERE aid = %d", check_plain($form_state['values']['name']), $form_state['values']['status_change'], $form_state['values']['aid']);
drupal_set_message(t('The action has been renamed.'));
}
elseif ($form_state['values']['op'] == t('Delete action')) {
db_query('DELETE FROM {library_actions} WHERE aid = %d', $form_state['values']['aid']);
db_query('DELETE FROM {library_transactions} WHERE action_aid = %d', $form_state['values']['aid']);
$available_display = variable_get('library_links_display_available', array());
$unavailable_display = variable_get('library_links_display_unavailable', array());
$reference_display = variable_get('library_links_display_reference', array());
$key = array_search($form_state['values']['aid'], $available_display);
if ($key !== FALSE) {
unset($available_display[$key]);
variable_set('library_links_display_available', $available_display);
}
$key2 = array_search($form_state['values']['aid'], $unavailable_display);
if ($key2 !== FALSE) {
unset($unavailable_display[$key2]);
variable_set('library_links_display_unavailable', $unavailable_display);
}
$key3 = array_search($form_state['values']['aid'], $reference_display);
if ($key3 !== FALSE) {
unset($reference_display[$key3]);
variable_set('library_links_display_reference', $reference_display);
}
drupal_set_message(t('The action has been deleted.'));
}
elseif ($form_state['values']['op'] == t('Add action')) {
db_query("INSERT INTO {library_actions} (name, status_change) VALUES ('%s', %d)", check_plain($form_state['values']['name']), $form_state['values']['status_change']);
drupal_set_message(t('The action has been added.'));
}
$form_state['redirect'] = 'admin/settings/library/actions';
return;
}