Exemplo n.º 1
0
<?php

ini_set('memory_limit', -1);
$autoloader = (include_once "vendor/autoload.php");
if (!$autoloader) {
    echo "\n\n  vendor/autoload.php could not be found. Did you run `php composer.phar install`?\n\n";
    exit;
}
$sierra = new Sierra('sierra-db.your.edu', 'db_user', 'db_pass');
$timestamp = time() - 1 * 24 * 60 * 60;
// yesterday
$location = 'data';
$results = $sierra->exportRecordsModifiedAfter($timestamp, $location);
Exemplo n.º 2
0
 function placeHold()
 {
     global $interface;
     global $configArray;
     global $user;
     global $logger;
     //TODO: Clean this up so there is only ever one id.
     if (isset($_REQUEST['recordId'])) {
         $recordId = $_REQUEST['recordId'];
     } else {
         $recordId = $_REQUEST['id'];
     }
     $interface->assign('id', $recordId);
     //Get title information for the record.
     $holding = $this->catalog->getHolding($recordId);
     if (PEAR_Singleton::isError($holding)) {
         PEAR_Singleton::raiseError($holding);
     }
     $interface->assign('holding', $holding);
     if (isset($_REQUEST['autologout'])) {
         $_SESSION['autologout'] = true;
     }
     $showMessage = false;
     $type = isset($_REQUEST['holdType']) ? $_REQUEST['holdType'] : '';
     if (isset($_POST['submit']) || $type == 'recall' || $type == 'update' || $type == 'hold') {
         if (isset($_REQUEST['username']) && isset($_REQUEST['password'])) {
             //Log the user in
             $user = UserAccount::login();
         }
         if ($user) {
             //The user is already logged in
             $barcodeProperty = $configArray['Catalog']['barcodeProperty'];
             $return = $this->catalog->placeHold($recordId, $user->{$barcodeProperty}, '', $type);
             $interface->assign('result', $return['result']);
             $message = $return['message'];
             $interface->assign('message', $message);
             $showMessage = true;
         } else {
             $message = 'Incorrect Patron Information';
             $interface->assign('message', $message);
             $interface->assign('focusElementId', 'username');
             $showMessage = true;
         }
     } else {
         //Get the referrer so we can go back there.
         if (isset($_SERVER['HTTP_REFERER'])) {
             $referer = $_SERVER['HTTP_REFERER'];
             $_SESSION['hold_referrer'] = $referer;
         }
         //Showing place hold form.
         if ($user) {
             $profile = $this->catalog->getMyProfile($user);
             $interface->assign('profile', $profile);
             //Get information to show a warning if the user does not have sufficient holds
             require_once ROOT_DIR . '/Drivers/marmot_inc/PType.php';
             $maxHolds = -1;
             //Determine if we should show a warning
             $ptype = new PType();
             $ptype->pType = $user->patronType;
             if ($ptype->find(true)) {
                 $maxHolds = $ptype->maxHolds;
             }
             $currentHolds = $profile['numHolds'];
             if ($maxHolds != -1 && $currentHolds + 1 > $maxHolds) {
                 $interface->assign('showOverHoldLimit', true);
                 $interface->assign('maxHolds', $maxHolds);
                 $interface->assign('currentHolds', $currentHolds);
             }
             global $locationSingleton;
             //Get the list of pickup branch locations for display in the user interface.
             $locations = $locationSingleton->getPickupBranches($profile, $profile['homeLocationId']);
             $interface->assign('pickupLocations', $locations);
             //set focus to the submit button if the user is logged in since the campus will be correct most of the time.
             $interface->assign('focusElementId', 'submit');
         } else {
             //set focus to the username field by default.
             $interface->assign('focusElementId', 'username');
         }
         global $library;
         $patronHomeBranch = Library::getPatronHomeLibrary();
         if ($patronHomeBranch != null) {
             if ($patronHomeBranch->defaultNotNeededAfterDays > 0) {
                 $interface->assign('defaultNotNeededAfterDays', date('m/d/Y', time() + $patronHomeBranch->defaultNotNeededAfterDays * 60 * 60 * 24));
             } else {
                 $interface->assign('defaultNotNeededAfterDays', '');
             }
             $interface->assign('showHoldCancelDate', $patronHomeBranch->showHoldCancelDate);
         } else {
             if ($library) {
                 //Show the hold cancellation date for now.  It may be hidden later when the user logs in.
                 if ($library->defaultNotNeededAfterDays > 0) {
                     $interface->assign('defaultNotNeededAfterDays', date('m/d/Y', time() + $library->defaultNotNeededAfterDays * 60 * 60 * 24));
                 } else {
                     $interface->assign('defaultNotNeededAfterDays', '');
                 }
                 $interface->assign('showHoldCancelDate', $library->showHoldCancelDate);
             } else {
                 //Show the hold cancellation date for now.  It may be hidden later when the user logs in.
                 $interface->assign('showHoldCancelDate', 1);
                 $interface->assign('defaultNotNeededAfterDays', '');
             }
         }
         $activeLibrary = Library::getActiveLibrary();
         if ($activeLibrary != null) {
             $interface->assign('holdDisclaimer', $activeLibrary->holdDisclaimer);
         } else {
             //Show the hold cancellation date for now.  It may be hidden later when the user logs in.
             $interface->assign('holdDisclaimer', '');
         }
     }
     $record = RecordDriverFactory::initRecordDriverById('ils:' . $_GET['id']);
     if ($record) {
         $interface->assign('record', $record);
     } else {
         PEAR_Singleton::raiseError('Cannot find record ' . $_GET['id']);
     }
     $interface->assign('id', $_GET['id']);
     if ($showMessage && isset($return)) {
         $hold_message_data = array('successful' => $return['result'] == true ? 'all' : 'none', 'error' => isset($return['error']) ? $return['error'] : '', 'titles' => array($return), 'campus' => $_REQUEST['campus']);
         //Check to see if there are item level holds that need follow-up by the user
         if (isset($return['items']) && count($return['items']) > 0) {
             $hold_message_data['showItemForm'] = true;
             $hold_message_data['items'] = $return['items'];
         }
         $_SESSION['hold_message'] = $hold_message_data;
         if (isset($_SESSION['hold_referrer'])) {
             $logger->log('Hold Referrer is set, redirecting to there. location ' . $_SESSION['hold_referrer'], PEAR_LOG_INFO);
             if ($_REQUEST['type'] != 'recall' && $_REQUEST['type'] != 'cancel' && $_REQUEST['type'] != 'update') {
                 header("Location: " . $_SESSION['hold_referrer']);
             } else {
                 //Redirect for hold cancellation or update
                 $section = isset($_REQUEST['section']) ? $_REQUEST['section'] : 'unavailable';
                 header("Location: " . '/MyResearch/Holds?section=' . $section);
             }
             if (!isset($hold_message_data['showItemForm']) || $hold_message_data['showItemForm'] == false) {
                 unset($_SESSION['hold_referrer']);
                 if (isset($_SESSION['autologout'])) {
                     unset($_SESSION['autologout']);
                     UserAccount::softLogout();
                 }
             }
         } else {
             $logger->log('No referrer set, but there is a message to show, go to the main holds page', PEAR_LOG_INFO);
             header("Location: " . '/MyResearch/Holds');
             die;
         }
     } else {
         //$logger->log('placeHold finished, do not need to show a message', PEAR_LOG_INFO);
         $interface->setPageTitle('Request an Item');
         $interface->assign('subTemplate', 'hold.tpl');
         $interface->setTemplate('hold.tpl');
         $interface->display('layout.tpl', 'RecordHold' . $_GET['id']);
     }
 }
Exemplo n.º 3
0
<?php

ini_set('display_errors', true);
error_reporting(E_ALL & ~E_DEPRECATED);
require_once 'bootstrap.php';
require_once ROOT_DIR . '/Drivers/Sierra.php';
$driver = new Sierra();
/*$bibData = $driver->getBib('1341330');
print_r($bibData);

$marcData = $driver->getMarc('1341330');
print_r($marcData);*/
//Load a particular item
/*$itemData = $driver->getItemInfo('1341330');
print_r($itemData);*/
//Load items for a bib
/*$itemData = $driver->getItemsForBib('3924426');
print_r($itemData);*/
//Load items for a magazine
echo "<h2>Items for climbing magazine</h2>";
$itemData = $driver->getItemsForBib('1075325');
print_r($itemData);
//Load bibs changed since a specific date
echo "<h2>Bibs Added since 3-1-2014</h2>";
$bibsCreated = $driver->getBibsCreatedSince('2014-03-01T00:00:00Z');
echo 'Found ' . count($bibsCreated) . ' records.<br/>';
echo implode(", ", $bibsCreated);
//Load bibs changed since a specific date
echo "<h2>Bibs Changed since 4-1-2014</h2>";
$bibsChanged = $driver->getBibsChangedSince('2014-04-01T00:00:00Z');
echo 'Found ' . count($bibsChanged) . ' records.<br/>';