You are here

function node_import_list_files_form in Node import 6

1 string reference to 'node_import_list_files_form'
node_import_menu in ./node_import.module
Implementation of hook_menu().

File

./node_import.admin.inc, line 48

Code

function node_import_list_files_form(&$form_state) {
  $form = array();
  $files = node_import_list_files(TRUE);
  $form['files'] = array(
    '#type' => 'item',
    '#theme' => 'node_import_file_select',
  );
  if (!empty($files)) {
    $form['files']['fid'] = array(
      '#type' => 'checkboxes',
      '#options' => node_import_extract_property($files, 'filename'),
    );
    foreach ($files as $fid => $file) {
      $file_owner = user_load(array(
        'uid' => $file->uid,
      ));
      $form['files'][$fid] = array(
        'filename' => array(
          '#value' => $file->filename,
        ),
        'filepath' => array(
          '#value' => $file->filepath,
        ),
        'filesize' => array(
          '#value' => format_size($file->filesize),
        ),
        'timestamp' => array(
          '#value' => format_date($file->timestamp, 'small'),
        ),
        'uid' => array(
          '#value' => $file->uid == 0 ? t('Public FTPd file') : theme('username', $file_owner),
        ),
      );
    }
  }
  $form['buttons'] = array(
    'delete_button' => array(
      '#type' => 'submit',
      '#value' => t('Delete selected files'),
      '#submit' => array(
        'node_import_list_files_form_submit_delete',
      ),
      '#disabled' => empty($files),
    ),
  );
  $form['#attributes'] = array(
    'enctype' => 'multipart/form-data',
  );
  $form['upload'] = array(
    '#type' => 'fieldset',
    '#title' => t('Upload file'),
    '#description' => t('<strong>The file you are uploading must be in UTF8 encoding.</strong>'),
    '#collapsible' => TRUE,
    '#collapsed' => !empty($files),
  );
  $form['upload']['file_upload'] = array(
    '#type' => 'file',
  );
  $form['upload']['file_upload_button'] = array(
    '#type' => 'submit',
    '#value' => t('Upload file'),
    '#submit' => array(
      'node_import_add_form_submit_upload_file',
    ),
  );
  return $form;
}