You are here

function ldapauth_admin_export_form in LDAP integration 6

Export server settings form.

Parameters

$sid: The server id.

1 string reference to 'ldapauth_admin_export_form'
ldapauth_menu in ./ldapauth.module
Implements hook_menu().

File

./ldapauth.admin.inc, line 722
Module admin page callbacks.

Code

function ldapauth_admin_export_form($form_state, $sid) {
  drupal_set_title(t('Export setting for server %description', array(
    '%description' => $sid->name,
  )));

  // Get export code with Ctools.
  ctools_include('export');
  $export = ctools_export_object('ldapauth', $sid);

  //              $ldapserver->sid   =    ' 1  '    ;
  //  preg_replace('/\$ldapserver->sid\s*=\s*\'\d+\'\s*\;\s*\n/', '', $export);
  $export = "<?php\n{$export}return serialize(\$ldapserver);\n?>";
  $lines = substr_count($export, "\n");

  // Create the export code textarea.
  $form = array(
    'info' => array(
      '#type' => 'markup',
      '#value' => t('Copy the export text below and paste it into another ldapauth site using the import server tab.'),
    ),
    'export' => array(
      '#type' => 'textarea',
      '#title' => t('Server settings'),
      '#rows' => $lines,
      '#default_value' => $export,
    ),
  );
  return $form;
}