Documentation here.'; // Function that will handle the wizard-like behaviour function dispatch() { if (empty ($_GET['step'])) $step = 0; else $step = (int) $_GET['step']; // load the header $this->header(); switch ($step) { case 0 : $this->greet(); break; case 1 : $this->horizon_start(); break; case 2: $this->horizon_getrecords(); break; case 3: $this->ktnxbye(); break; } // load the footer $this->footer(); } function header() { echo '
'.__('Howdy! Start here to import records from a Horizon ILS system into Scriblio.').'
'; echo ''.__('This has not been tested much. Mileage may vary.').'
'; echo ''; if(!function_exists('mb_convert_encoding')){ echo ''.__('This PHP install does not support multibyte string functions, including mb_convert_encoding. Without that function, this importer can't convert the character encoding from records in the ILS into UTF-8. Accented characters will likely not import correctly.').'
'; } echo ''.__('All done.').'
'; echo ''.__('All Scriblio records have a 'sourceid,' a unique alphanumeric string that's used to avoid creating duplicate records and, in some installations, link back to the source system for current availability information.').'
'; echo ''.__('The sourceid is made up of two parts: the prefix that you assign, and the bib number from the iPAC. Theoretically, you chould gather records from 1,296 different systems, it's a big world.').'
'; echo ''; echo ''.__('Sorry, there has been an error.').'
'; echo 'Please complete all fields
'; return; } // save these settings so we can try them again later $prefs = get_option('scrib_horizonimporter'); $prefs['scrib_horizon-sourceprefix'] = strtolower(ereg_replace('[^a-z|A-Z|0-9]', '', $_POST['scrib_horizon-sourceprefix'])); stripslashes($_POST['scrib_horizon-sourceprefix']); $prefs['scrib_horizon-sourceipac'] = ereg_replace('[^a-z|A-Z|0-9|-|\.]', '', $_POST['scrib_horizon-sourceipac']); $prefs['scrib_horizon-record_start'] = (int) $_POST['scrib_horizon-record_start']; $prefs['scrib_horizon-record_end'] = (int) $_POST['scrib_horizon-record_end']; update_option('scrib_horizonimporter', $prefs); $interval = 50; if(!$prefs['scrib_horizon-record_end'] || ($prefs['scrib_horizon-record_end'] - $prefs['scrib_horizon-record_start'] < $interval)) $interval = $prefs['scrib_horizon-record_end'] - $prefs['scrib_horizon-record_start']; if($prefs['scrib_horizon-record_end'] - $prefs['scrib_horizon-record_start'] < 1) $interval = 1; ini_set('memory_limit', '1024M'); set_time_limit(0); ignore_user_abort(TRUE); error_reporting(E_ERROR); if(!empty($_POST['scrib_horizon-debug'])){ $host = $prefs['scrib_horizon-sourceipac']; $bibn = (int) $prefs['scrib_horizon-record_start']; echo ''; echo $this->horizon_get_record($host, $bibn, TRUE); echo '
'; $test_pancake = $this->horizon_parse_record($this->horizon_get_record($host, $bibn), $bibn); print_r($test_pancake); echo ''; echo '
Reading $interval records from {$prefs['scrib_horizon-sourceipac']}. Please be patient.