You are here

function ldap_query_admin_enable_disable_submit in Lightweight Directory Access Protocol (LDAP) 7.2

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

Submit hook for the LDAP server delete page.

File

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

Code

function ldap_query_admin_enable_disable_submit($form, &$form_state) {
  $values = $form_state['values'];
  $qid = $values['qid'];
  $status = $values['action'] == 'enable' ? 1 : 0;
  if ($values['confirm'] && $qid) {
    $form_state['redirect'] = LDAP_QUERY_MENU_BASE_PATH . '/query';
    $ldap_query = new LdapQueryAdmin($qid);
    $ldap_query->status = $status;
    $ldap_query
      ->save('edit');
    $tokens = [
      '%name' => $values['name'],
      '!qid' => $qid,
      '!action' => t($values['action']) . 'd',
    ];
    drupal_set_message(t('LDAP Query Configuration %name (query id = !qid) has been !action.', $tokens));
    $message = t('LDAP Query !action: %name (qid = !qid) ', $tokens);
    watchdog('ldap_query', $message);
  }
}