You are here

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

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

Perform imports for the non-JS version and return the status page.

1 call to import_progress_page_nojs()
import_import_page in import/merci_import.php

File

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

Code

function import_progress_page_nojs() {
  drupal_set_title('Importing');
  $new_op = 'do_import_nojs';
  if ($_SERVER['REQUEST_METHOD'] == 'GET') {

    // Error handling: if PHP dies, it will output whatever is in the output
    // buffer, followed by the error message.
    ob_start();
    $fallback = '<p class="error">An unrecoverable error has occurred. You can find the error message below. It is advised to copy it to the clipboard for reference. Please continue to the <a href="merci_import.php?op=error">import summary</a>.</p>';
    print theme('maintenance_page', $fallback, FALSE, TRUE);
    list($percentage, $message) = import_do_imports();
    if ($percentage == 100) {
      $new_op = 'finished';
    }

    // Imports successful; remove fallback
    ob_end_clean();
  }
  else {

    // This is the first page so return some output immediately.
    $percentage = 0;
    $message = 'Starting import';
  }
  drupal_set_html_head('<meta http-equiv="Refresh" content="0; URL=merci_import.php?op=' . $new_op . '">');
  $output = theme('progress_bar', $percentage, $message);
  $output .= '<p>Importing the data will take a few seconds.</p>';

  // Note: do not output drupal_set_message()s until the summary page.
  print theme('maintenance_page', $output, FALSE);
  return NULL;
}