You are here

function ldap_query_admin_delete_submit in Lightweight Directory Access Protocol (LDAP) 7

Same name and namespace in other branches
  1. 8.2 ldap_query/ldap_query.admin.inc \ldap_query_admin_delete_submit()
  2. 7.2 ldap_query/ldap_query.admin.inc \ldap_query_admin_delete_submit()

Submit handler for the LDAP server delete page.

File

ldap_query/ldap_query.admin.inc, line 160
Defines functions for administrative interface for servers

Code

function ldap_query_admin_delete_submit($form, &$form_state) {
  $values = $form_state['values'];
  $qid = $values['qid'];
  ldap_server_module_load_include('php', 'ldap_query', 'LdapQueryAdmin.class');
  $ldap_query = new LdapQueryAdmin($qid);
  if ($values['confirm'] && $qid) {
    if ($result = $ldap_query
      ->delete($qid)) {
      $tokens = array(
        '%name' => $ldap_query->name,
        '!qid' => $qid,
      );
      drupal_set_message(t('LDAP Server %name (query id = !qid) has been deleted.', $tokens), 'status');
      watchdog('ldap', 'LDAP Query deleted: %name (qid = !qid) ', $tokens);
    }
    else {
      drupal_set_message(t('LDAP Query delete failed.'), 'warning');
    }
  }
  else {
    drupal_set_message(t('LDAP Query delete cancelled.'), 'status');
  }
  ldap_query_cache_clear();
  drupal_goto(LDAP_QUERY_MENU_BASE_PATH . '/query/list');
}