You are here

function user_import_add_file_form in User Import 7.2

Same name and namespace in other branches
  1. 8 user_import.admin.inc \user_import_add_file_form()
  2. 5.2 user_import.module \user_import_add_file_form()
  3. 5 user_import.module \user_import_add_file_form()
  4. 6.4 user_import.admin.inc \user_import_add_file_form()
  5. 6.2 user_import.admin.inc \user_import_add_file_form()
  6. 7 user_import.admin.inc \user_import_add_file_form()
1 call to user_import_add_file_form()
user_import_add_form in ./user_import.admin.inc
Start new import. Form to select file.

File

./user_import.admin.inc, line 769
Provide administration configuration pages to import users.

Code

function user_import_add_file_form(&$form, $ftp_files = NULL) {
  $form['browser'] = array(
    '#type' => 'fieldset',
    '#title' => t('Browser Upload'),
    '#collapsible' => TRUE,
    '#description' => t("Upload a CSV file."),
  );
  if (function_exists('file_upload_max_size')) {
    $file_size = t('Maximum file size: @size.', array(
      '@size' => format_size(file_upload_max_size()),
    ));
  }
  $form['browser']['file_upload'] = array(
    '#type' => 'file',
    '#title' => t('CSV File'),
    '#size' => 40,
    '#description' => check_plain(t('Select the CSV file to be imported.') . ' ' . $file_size),
  );
  if (!empty($ftp_files)) {
    $form['ftp'] = array(
      '#type' => 'fieldset',
      '#title' => t('FTP Upload'),
      '#collapsible' => TRUE,
      '#collapsed' => TRUE,
      '#description' => t("Any files uploaded to the 'user_import' directory using FTP can be selected for import here. Useful if the import file is too large for upload via the browser."),
    );
    $form['ftp']['file_ftp'] = array(
      '#type' => 'radios',
      '#title' => t('Files'),
      '#default_value' => '0',
      '#options' => $ftp_files,
    );

    // reload the page to show any files that have been added by FTP
    $form['ftp']['scan'] = array(
      '#type' => 'submit',
      '#value' => t('Check for new files'),
      '#validate' => array(),
      '#submit' => array(),
    );
  }
  return;
}