Exemplo n.º 1
0
 /**
  * Constructor
  *
  * @access public
  */
 public function __construct()
 {
     global $configArray;
     global $user;
     global $interface;
     //$interface->caching = 1;
     // Setup Search Engine Connection
     $this->db = ConnectionManager::connectToIndex();
     // Connect to Database
     $this->catalog = ConnectionManager::connectToCatalog();
     // Set up object for formatting dates and times:
     $this->dateFormat = new VuFindDate();
     // Register Library Catalog Account
     if (isset($_POST['submit']) && !empty($_POST['submit'])) {
         if (isset($_POST['cat_username']) && isset($_POST['cat_password'])) {
             $username = $_POST['cat_username'];
             if (isset($_POST['login_target'])) {
                 $username = $_POST['login_target'] . '.' . $username;
             }
             $result = UserAccount::processCatalogLogin($username, $_POST['cat_password']);
             if ($result) {
                 $interface->assign('user', $user);
             } else {
                 $interface->assign('loginError', 'Invalid Patron Login');
             }
         }
     }
     // Retrieve the record from the index
     if (!($record = $this->db->getRecord($_REQUEST['id']))) {
         PEAR::raiseError(new PEAR_Error('Record Does Not Exist'));
     }
     $this->setRecord($_REQUEST['id'], $record);
 }
Exemplo n.º 2
0
 /**
  * Initialise shared settings
  *
  * @return void
  * @access public
  */
 public function init()
 {
     global $interface;
     // Initialise this Collection
     if (is_array($this->collections) && count($this->collections) == 1) {
         $collection = $this->collections[0];
         $this->id = $collection['id'];
         $this->collectionID = $collection['is_hierarchy_id'];
         $this->collectionTitle = $collection['is_hierarchy_title'];
         // Retrieve the record from the index
         if (!($record = $this->db->getRecord($this->id))) {
             PEAR::raiseError(new PEAR_Error('Record Does Not Exist'));
         }
         $this->recordDriver = RecordDriverFactory::initRecordDriver($record);
         $this->hasHierarchyTree = $this->recordDriver->hasHierarchyTree(false);
         //get the collection identefier for this record
         $this->collectionIdentifier = $this->recordDriver->getCollectionRecordIdentifier();
         // Get the records part of this collection
         $this->searchObject = SearchObjectFactory::initSearchObject("SolrCollection");
         // Set the searchobjects collection id to the collection id
         $this->searchObject->collectionID($this->collectionID);
         $this->searchObject->setCollectionField($this->collectionIdentifier);
         $this->searchObject->init();
     }
     // Register Library Catalog Account
     if (isset($_POST['submit']) && !empty($_POST['submit'])) {
         if (isset($_POST['cat_username']) && isset($_POST['cat_password'])) {
             $result = UserAccount::processCatalogLogin($_POST['cat_username'], $_POST['cat_password']);
             if ($result && !PEAR::isError($result)) {
                 $interface->assign('user', $user);
             } else {
                 $interface->assign('loginError', 'Invalid Patron Login');
             }
         }
     }
     // Get Messages
     $this->infoMsg = isset($_GET['infoMsg']) ? $_GET['infoMsg'] : false;
     $this->errorMsg = isset($_GET['errorMsg']) ? $_GET['errorMsg'] : false;
     // Set Messages
     $interface->assign('infoMsg', $this->infoMsg);
     $interface->assign('errorMsg', $this->errorMsg);
 }
Exemplo n.º 3
0
 /**
  * Constructor
  *
  * @param bool $skipLogin Set to true to bypass the default login requirement.
  *
  * @access public
  */
 public function __construct($skipLogin = false)
 {
     global $interface;
     global $configArray;
     global $user;
     if (!$skipLogin && !UserAccount::isLoggedIn()) {
         include_once 'Login.php';
         Login::launch();
         exit;
     }
     // Setup Search Engine Connection
     $this->db = ConnectionManager::connectToIndex();
     // Connect to Database
     $this->catalog = ConnectionManager::connectToCatalog();
     // Is Placing Holds allowed?
     $this->checkHolds = $this->catalog->checkFunction("Holds", null);
     // Is Cancelling Holds allowed?
     $this->cancelHolds = $this->catalog->checkFunction("cancelHolds", null);
     // Is Renewing Items allowed?
     $this->checkRenew = $this->catalog->checkFunction("Renewals", null);
     // Register Library Catalog Account
     if (isset($_POST['submit']) && !empty($_POST['submit']) && $this->catalog && isset($_POST['cat_username']) && isset($_POST['cat_password'])) {
         $username = $_POST['cat_username'];
         $password = $_POST['cat_password'];
         $loginTarget = isset($_POST['login_target']) ? $_POST['login_target'] : false;
         if ($loginTarget) {
             $username = "******";
         }
         if (UserAccount::processCatalogLogin($username, $password)) {
             $interface->assign('user', $user);
         } else {
             $interface->assign('loginError', 'Invalid Patron Login');
         }
     }
     // Assign Exporter Options
     $exportOptions = array();
     if ($configArray['BulkExport']['enabled']) {
         $options = explode(':', $configArray['BulkExport']['options']);
         foreach ($options as $option) {
             if ($configArray['Export'][$option] == true) {
                 $exportOptions[] = $option;
             }
         }
         $interface->assign('exportOptions', $exportOptions);
     }
     // Get Messages
     $this->infoMsg = isset($_GET['infoMsg']) ? $_GET['infoMsg'] : false;
     $this->errorMsg = isset($_GET['errorMsg']) ? $_GET['errorMsg'] : false;
     $this->showExport = isset($_GET['showExport']) ? $_GET['showExport'] : false;
     $this->followupUrl = false;
 }