You are here

function ldap_servers_admin_enable_disable_submit in Lightweight Directory Access Protocol (LDAP) 7

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

Submit hook for the LDAP server delete page.

File

ldap_servers/ldap_servers.admin.inc, line 234
Defines functions for administrative interface for servers

Code

function ldap_servers_admin_enable_disable_submit($form, &$form_state) {
  $values = $form_state['values'];
  $sid = $values['sid'];
  $status = $values['action'] == 'enable' ? 1 : 0;
  if ($values['confirm'] && $sid) {
    $form_state['redirect'] = LDAP_SERVERS_MENU_BASE_PATH . '/servers';
    $ldap_server = new LdapServerAdmin($sid);
    $ldap_server->status = $status;
    $ldap_server
      ->save('edit');
    $tokens = array(
      '%name' => $values['name'],
      '!sid' => $sid,
      '!action' => t($values['action']) . 'd',
    );
    drupal_set_message(t('LDAP Server Configuration %name (server id = !sid) has been !action.', $tokens));
    $message = t('LDAP Server !action: %name (sid = !sid) ', $tokens);
    watchdog('ldap', $message);
  }
}