You are here

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

Same name and namespace in other branches
  1. 6.2 import/merci_import.php \import_data()

Perform one import and store the results which will later be displayed on the finished page.

Parameters

$module: The module whose import will be run.

$number: The import number to run.

Return value

TRUE if the import was finished. Otherwise, FALSE.

1 call to import_data()
import_do_imports in import/merci_import.php
Perform imports for one second or until finished.

File

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

Code

function import_data($module, $number) {
  $function = "merci_import_{$number}";
  $ret = $function();

  // Assume the import finished unless the import results indicate otherwise.
  $finished = 1;
  if (isset($ret['#finished'])) {
    $finished = $ret['#finished'];
    unset($ret['#finished']);
  }

  // Save the query and results for display by import_finished_page().
  if (!isset($_SESSION['import_results'])) {
    $_SESSION['import_results'] = array();
  }
  if (!isset($_SESSION['import_results'][$module])) {
    $_SESSION['import_results'][$module] = array();
  }
  if (!isset($_SESSION['import_results'][$module][$number])) {
    $_SESSION['import_results'][$module][$number] = array();
  }
  $_SESSION['import_results'][$module][$number] = array_merge($_SESSION['import_results'][$module][$number], $ret);
  return $finished;
}