You are here

function import_info_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_info_page()
1 call to import_info_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 488
Administrative page for adding MERCI bucket/resource content types and items.

Code

function import_info_page() {
  drupal_set_title('MERCI import');
  $output = "<ol>\n";
  $output .= "<li>Use this script to import MERCI bucket/resource content types and items.</li>";
  $output .= "<li>Before doing anything, backup your database. This process will change your database and its values.</li>\n";
  $output .= "<li>Check below for the format and data structure of the CSV files you'll need for the import.</li>\n";
  $output .= "<li>Use the example files <em>content_types.csv</em> and <em>items.csv</em> (found in the same location as this file) for reference when constructing custom CSV files for import. They can also be used to load in a small amount of test data to demo the module.</li>\n";
  $output .= "<li>Make sure this file is placed in the root of your Drupal installation (the same directory that index.php is in) and <a href=\"merci_import.php?op=selection\">run the import script</a>. <strong>Don't import your data twice as it will cause problems!</strong></li>\n";
  $output .= "</ol>\n";
  $output .= "<h3>CSV file data structure and format</h3>\n";
  $output .= "<p>There are two types of data that can be imported -- bucket/resource content types, and bucket/resource item nodes.  Each type uses it's own CSV file, with the data structures listed below.  The CSV file format is as follows:</p>\n";
  $output .= "<ul>\n";
  $output .= "<li>Commas as field delimiters.</li>\n";
  $output .= "<li>All text fields surrounded by double quotes.</li>\n";
  $output .= "<li>Backslash character used for escaping.</li>\n";
  $output .= "</ul>\n";
  $output .= "<h4>Data structure for bucket/resource content types</h4>\n";
  $output .= "<p>The following data fields must be ordered left to right exactly as they appear below. There should be no column labels in the final CSV file, only data:</p>\n";
  $output .= "<ul>\n";
  $output .= "<li>type (text): Machine-readable name of the content type -- letters, numbers, and underscores only.</li>\n";
  $output .= "<li>name (text): Human-readable name of the content type.</li>\n";
  $output .= "<li>description (text): Longer description for the content type.</li>\n";
  $output .= "<li>help (text): Text that will appear above the node creation form for this content type.</li>\n";
  $output .= "<li>type_setting (text): The MERCI type.  Valid values: resource|bucket</li>\n";
  $output .= "<li>max_hours_per_reservation (integer): The maximum hours that the content type can be reserved.</li>\n";
  $output .= "<li>allow_overnight (integer): Boolean indicating if reservations are allowed overnight.  Valid values: 0|1</li>\n";
  $output .= "<li>allow_weekends (integer): Boolean indicating if reservations are allowed on weekends.  Valid values: 0|1</li>\n";
  $output .= "<li>late_fee_per_hour (float): Per hour late fee -- should be a dollar amount with no \$ sign.</li>\n";
  $output .= "<li>rate_per_hour (float): Per hour fee -- should be a dollar amount with no \$ sign.</li>\n";
  $output .= "<li>fee_free_hours (integer): Number of hours the content type can be used at no cost.</li>\n";
  $output .= "<li>status (integer): The status of the content type.  Valid values: 1 (active) | 2 (inactive)</li>\n";
  $output .= "<li>spare_items (integer): Number of bucket items that should never be reserved -- valid only for bucket content types.</li>\n";
  $output .= "</ul>\n";
  $output .= "<h4>Data structure for bucket/resource item nodes</h4>\n";
  $output .= "<p>The following data fields must be ordered left to right exactly as they appear below. There should be no column labels in the final CSV file, only data:</p>\n";
  $output .= "<ul>\n";
  $output .= "<li>type (text): Machine-readable name of the content type this item should belong to.</li>\n";
  $output .= "<li>title (text): The name of the item.</li>\n";
  $output .= "<li>body (text): A longer description of the item.</li>\n";
  $output .= "<li>default_availability (integer): The reservatioin availability of the item.  Valid values: 1 (available) | 2 (unavailable) | 3 (strictly available) | 4 (strictly unavailable)</li>\n";
  $output .= "<li>late_fee_per_hour (float): Per hour late fee -- should be a dollar amount with no \$ sign.</li>\n";
  $output .= "<li>rate_per_hour (float): Per hour fee -- should be a dollar amount with no \$ sign.</li>\n";
  $output .= "<li>fee_free_hours (integer): Number of hours the content type can be used at no cost.</li>\n";
  $output .= "</ul>\n";
  return $output;
}