You are here

function uif_import_form_submit in User Import Framework 7

Same name and namespace in other branches
  1. 6 uif.admin.inc \uif_import_form_submit()

Form submission handler.

File

./uif.admin.inc, line 140
Simple, extensible user import from a CSV file.

Code

function uif_import_form_submit($form, &$form_state) {
  $step = empty($form_state['storage']['step']) ? 1 : $form_state['storage']['step'];
  if (1 == $step) {
    $form_state['rebuild'] = TRUE;
    $form_state['storage']['notify'] = isset($form_state['values']['notify']) ? $form_state['values']['notify'] : FALSE;
    $form_state['storage']['field_delimiter'] = $form_state['values']['field_delimiter'];
    $form_state['storage']['value_delimiter'] = $form_state['values']['value_delimiter'];
    $preview_count = $form_state['values']['preview_count'];
    if ($preview_count) {
      $form_state['storage']['preview_count'] = $preview_count;
      $form_state['storage']['user_preview'] = theme('uif_preview_users', array(
        'data' => $form_state['storage']['data'],
        'limit' => $preview_count,
      ));
    }
    else {
      $step = 2;
    }
  }
  if (2 == $step) {
    $form_state['rebuild'] = TRUE;
    uif_batch_import_users($form_state);
  }
  $form_state['storage']['step'] = $step + 1;
}