You are here

function ldap_servers_admin_delete 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_delete()
  2. 7.2 ldap_servers/ldap_servers.admin.inc \ldap_servers_admin_delete()

Implements the LDAP server delete page.

Parameters

$form_state: A form state array.

$sid: A LDAP server ID.

Return value

The form structure.

1 string reference to 'ldap_servers_admin_delete'
ldap_servers_menu in ldap_servers/ldap_servers.module

File

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

Code

function ldap_servers_admin_delete($form, &$form_state, $op = NULL, $sid = NULL) {
  if ($sid && ($ldap_server = ldap_servers_get_servers($sid, 'all', TRUE))) {

    // array()
    $variables = array(
      'ldap_server' => $ldap_server,
      'actions' => FALSE,
      'type' => 'detail',
    );
    $form['#prefix'] = '<div>' . theme('ldap_servers_server', $variables) . '</div>';
    $form['sid'] = array(
      '#type' => 'hidden',
      '#value' => $sid,
    );
    $form['name'] = array(
      '#type' => 'hidden',
      '#value' => $ldap_server->name,
    );
    $warnings = module_invoke_all('ldap_server_in_use', $sid, $ldap_server->name);
    if (count($warnings)) {
      drupal_set_message(join("<br/>", array_values($warnings)), 'error');
      drupal_goto(LDAP_SERVERS_MENU_BASE_PATH . '/servers/list');
    }
    else {
      return confirm_form($form, 'Delete Confirmation Form', LDAP_SERVERS_MENU_BASE_PATH . '/servers/list', '<p>' . t('Are you sure you want to delete the LDAP server named <em><strong>%name</strong></em> ?', array(
        '%name' => $ldap_server->name,
      )) . '</p><p>' . t('This action cannot be undone.') . '</p>', t('Delete'), t('Cancel'));
    }
  }
  drupal_goto(LDAP_SERVERS_MENU_BASE_PATH . '/servers/list');
}