You are here

function users_export_form in Users Export 7

Same name and namespace in other branches
  1. 7.2 includes/users_export.admin.inc \users_export_form()

Form builder. Configure my_module.

See also

system_settings_form()

Related topics

1 string reference to 'users_export_form'
users_export_menu in ./users_export.module
Implements hook_menu().

File

./users_export.admin.inc, line 19
Administration page callbacks for the users_export module.

Code

function users_export_form() {
  drupal_add_js(drupal_get_path('module', 'users_export') . '/users_export.js');
  $form = array();
  $type = variable_get('users_export_type', '.csv');
  $form['users_export_type'] = array(
    '#type' => 'select',
    '#title' => t('File format'),
    '#default_value' => $type,
    '#options' => array(
      '.csv' => t('Comma Separated (.csv)'),
      '.txt' => t('Tab Delimited (.txt)'),
      '.xls' => t('Excel (.xls)'),
    ),
  );

  //$form['options'] = array(

  //  '#type' => 'fieldset',
  //  '#title' => t('Options'),
  //  '#collapsible' => FALSE,

  //);

  //

  //$form['options']['field_end'] = array(

  //  '#type' => 'textfield',
  //  '#title' => t('Fields terminated by'),
  //  '#default_value' => ',',
  //  '#required' => TRUE,

  //);

  //

  //$form['options']['field_wrap'] = array(

  //  '#type' => 'textfield',
  //  '#title' => t('Fields enclosed by'),
  //  '#default_value' => '"',
  //  '#required' => TRUE,

  //);

  //

  //$form['options']['field_escape'] = array(

  //  '#type' => 'textfield',
  //  '#title' => t('Fields escaped by'),
  //  '#default_value' => '\\',
  //  '#required' => TRUE,

  //);

  //

  //$form['options']['line_end'] = array(

  //  '#type' => 'textfield',
  //  '#title' => t('Lines terminated by'),
  //  '#default_value' => '\n',
  //  '#required' => TRUE,

  //);

  //
  $form['options']['users_export_header'] = array(
    '#type' => 'checkbox',
    '#title' => t('Put fields names in the first row'),
    '#default_value' => variable_get('users_export_header', TRUE),
  );
  $default = variable_get('users_export_filename', strtolower(preg_replace('/\\W+/', '_', variable_get('site_name', 'users_export')) . '_users'));
  $form['users_export_filename'] = array(
    '#type' => 'textfield',
    '#title' => t('Filename to save as'),
    '#default_value' => $default,
    '#required' => TRUE,
    '#field_suffix' => $type,
  );
  $form['extension'] = array(
    '#type' => 'hidden',
    '#value' => $type,
  );
  $form['submit'] = array(
    '#type' => 'submit',
    '#value' => t('Download File'),
  );
  return $form;
}