You are here

function node_import_task_details in Node import 6

2 calls to node_import_task_details()
node_import_add_form in ./node_import.admin.inc
Creates a new import task by letting the user fill in a wizard.
node_import_view_form in ./node_import.admin.inc
View a task and its progress.

File

./node_import.admin.inc, line 745

Code

function node_import_task_details($values) {
  $form = array();
  if (isset($values['uid'])) {
    $user = user_load(array(
      'uid' => $values['uid'],
    ));
    $form[] = array(
      '#type' => 'item',
      '#title' => t('Created by'),
      '#value' => theme('username', $user),
    );
  }
  if (isset($values['created'])) {
    $form[] = array(
      '#type' => 'item',
      '#title' => t('Created on'),
      '#value' => format_date($values['created']),
    );
    $form[] = array(
      '#type' => 'item',
      '#title' => t('Last updated on'),
      '#value' => format_date($values['changed']),
    );
  }
  if (isset($values['fid'])) {
    $files = node_import_list_files();
    $file = $files[$values['fid']];
    $form[] = array(
      '#type' => 'item',
      '#title' => t('File'),
      '#value' => check_plain($file->filename),
      '#description' => check_plain($file->filepath) . ' (' . format_size($file->filesize) . ')',
    );
  }
  if (isset($values['file_options'])) {
    $rows = array();
    $rows[] = array(
      t('First row contains column names'),
      $values['has_headers'] ? t('Yes') : t('No'),
    );
    foreach (array(
      'record separator' => t('Record separator'),
      'field separator' => t('Field separator'),
      'text delimiter' => t('Text delimiter'),
      'escape character' => t('Escape character'),
    ) as $key => $title) {
      if ($values['file_options'][$key] === '') {
        $rows[] = array(
          $title,
          check_plain($values['file_options']['other ' . $key]),
        );
      }
      else {
        $stuff = node_import_format_options($key . 's');
        $rows[] = array(
          $title,
          $stuff[$values['file_options'][$key]],
        );
      }
    }
    $form[] = array(
      '#type' => 'item',
      '#title' => t('File options'),
      '#value' => theme('table', NULL, $rows),
    );
  }
  if (isset($values['samples'])) {
    $form[] = array(
      '#type' => 'item',
      '#title' => t('Sample data'),
      '#value' => theme('node_import_sample_data', $values['samples'], variable_get('node_import:length_of_samples', 200)),
    );
  }
  if (isset($values['type'])) {
    $type_titles = node_import_extract_property(node_import_types(), 'title');
    $form[] = array(
      '#type' => 'item',
      '#title' => t('Content type'),
      '#value' => $type_titles[$values['type']],
    );
  }
  if (isset($values['map'])) {

    //TODO: can we construct some reasonable status for this?
  }
  if (isset($values['defaults'])) {

    //TODO: can we construct some reasonable status for this?
  }
  if (isset($values['options'])) {

    //TODO: can we construct some reasonable status for this?
  }
  return $form;
}