You are here

function import_import_page in MERCI (Manage Equipment Reservations, Checkout and Inventory) 6

Same name and namespace in other branches
  1. 6.2 import/merci_import.php \import_import_page()
1 call to import_import_page()
merci_import.php in import/merci_import.php
Administrative page for adding MERCI bucket/resource content types and items.

File

import/merci_import.php, line 284
Administrative page for adding MERCI bucket/resource content types and items.

Code

function import_import_page() {

  // Set the installed version so imports start at the correct place.
  $_SESSION['import_remaining'][] = array(
    'module' => 'merci',
    'version' => 1,
  );
  $_SESSION['import_remaining'][] = array(
    'module' => 'merci',
    'version' => 2,
  );

  // Upload the files.
  if ($content_types_file = file_save_upload('content_types_file', array(), FALSE, FILE_EXISTS_REPLACE)) {
    $_SESSION['content_types_file'] = $content_types_file->filepath;
  }
  else {
    $_SESSION['content_types_file'] = FALSE;
  }
  if ($items_file = file_save_upload('items_file', array(), FALSE, FILE_EXISTS_REPLACE)) {
    $_SESSION['items_file'] = $items_file->filepath;
  }
  else {
    $_SESSION['items_file'] = FALSE;
  }

  // Keep track of total number of imports
  if (isset($_SESSION['import_remaining'])) {
    $_SESSION['import_total'] = count($_SESSION['import_remaining']);
  }
  if ($_POST['has_js']) {
    return import_progress_page();
  }
  else {
    return import_progress_page_nojs();
  }
}