示例#1
0
 function launch()
 {
     global $interface;
     $id = $_GET['id'];
     $interface->assign('id', $id);
     $this->eContentRecord = new EContentRecord();
     $this->eContentRecord->id = $_GET['id'];
     $this->eContentRecord->find(true);
     $recordDriver = new EcontentRecordDriver();
     $recordDriver->setDataObject($this->eContentRecord);
     $interface->assign('sourceUrl', $this->eContentRecord->sourceUrl);
     $interface->assign('source', $this->eContentRecord->source);
     $interface->setPageTitle(translate('Copies') . ': ' . $recordDriver->getBreadcrumb());
     $driver = new EContentDriver();
     $holdings = $driver->getHolding($id);
     $showEContentNotes = false;
     foreach ($holdings as $holding) {
         if (strlen($holding->notes) > 0) {
             $showEContentNotes = true;
         }
     }
     $interface->assign('showEContentNotes', $showEContentNotes);
     $interface->assign('holdings', $holdings);
     //Load status summary
     $result = $driver->getStatusSummary($id, $holdings);
     if (PEAR_Singleton::isError($result)) {
         PEAR_Singleton::raiseError($result);
     }
     $holdingData->holdingsSummary = $result;
     $interface->assign('subTemplate', 'view-holdings.tpl');
     $interface->setTemplate('view-alt.tpl');
     // Display Page
     $interface->display('layout.tpl');
 }
示例#2
0
 function sendSMS()
 {
     global $configArray;
     global $interface;
     // Get Holdings
     $driver = new EContentDriver();
     $id = strip_tags($_REQUEST['id']);
     $eContentRecord = new EContentRecord();
     $eContentRecord->id = $id;
     $eContentRecord->find(true);
     $holdings = $driver->getHolding($id);
     $holdingsSummary = $driver->getStatusSummary($id, $holdings);
     if (PEAR_Singleton::isError($holdingsSummary)) {
         return $holdingsSummary;
     }
     if ($holdingsSummary['status']) {
         $interface->assign('status', $holdingsSummary['status']);
     }
     $interface->assign('title', $eContentRecord->title);
     $interface->assign('author', $eContentRecord->author);
     $interface->assign('recordID', $_GET['id']);
     $message = $interface->fetch('Emails/eContent-sms.tpl');
     return $this->sms->text($_REQUEST['provider'], $_REQUEST['to'], $configArray['Site']['email'], $message);
 }
示例#3
0
 function available_at()
 {
     //Check to see if the item is checked out or if it has available holds
     if ($this->status == 'active') {
         require_once ROOT_DIR . '/Drivers/EContentDriver.php';
         if ($this->source == 'Freegal') {
             return array('Freegal');
         } else {
             $driver = new EContentDriver();
             $holdings = $driver->getHolding($this->id);
             $statusSummary = $driver->getStatusSummary($this->id, $holdings);
             if ($statusSummary['availableCopies'] > 0) {
                 return $this->building();
             } else {
                 return array();
             }
         }
     } else {
         return array();
     }
 }
示例#4
0
 function getItemAvailability()
 {
     global $timer;
     global $configArray;
     $itemData = array();
     //Load basic information
     $this->id = $_GET['id'];
     $itemData['id'] = $this->id;
     // Setup Search Engine Connection
     $class = $configArray['Index']['engine'];
     $url = $configArray['Index']['url'];
     $this->db = new $class($url);
     if ($configArray['System']['debugSolr']) {
         $this->db->debug = true;
     }
     // Retrieve Full Marc Record
     if (!($record = $this->db->getRecord($this->id))) {
         PEAR_Singleton::raiseError(new PEAR_Error('Record Does Not Exist'));
     }
     $this->record = $record;
     if ($record['recordtype'] == 'econtentRecord') {
         require_once ROOT_DIR . '/sys/eContent/EContentRecord.php';
         $eContentRecord = new EContentRecord();
         $eContentRecord->id = substr($record['id'], strlen('econtentRecord'));
         if (!$eContentRecord->find(true)) {
             $itemData['error'] = 'Cannot load eContent Record for id ' . $record['id'];
         } else {
             require_once ROOT_DIR . '/Drivers/EContentDriver.php';
             $driver = new EContentDriver();
             $itemData['holdings'] = $driver->getHolding($eContentRecord->id);
         }
     } else {
         $this->recordDriver = RecordDriverFactory::initRecordDriver($record);
         $timer->logTime('Initialized the Record Driver');
         //Load Holdings
         $itemData['holdings'] = Record_Holdings::loadHoldings($this->id);
         $timer->logTime('Loaded Holdings');
     }
     return $itemData;
 }
示例#5
0
 function GetHoldingsInfo()
 {
     global $interface;
     global $configArray;
     $interface->assign('showOtherEditionsPopup', $configArray['Content']['showOtherEditionsPopup']);
     $id = strip_tags($_REQUEST['id']);
     $interface->assign('id', $id);
     //Load holdings information from the driver
     require_once ROOT_DIR . '/Drivers/EContentDriver.php';
     require_once ROOT_DIR . '/sys/eContent/EContentRecord.php';
     $driver = new EContentDriver();
     //Get any items that are stored for the record
     $eContentRecord = new EContentRecord();
     $eContentRecord->id = $id;
     $eContentRecord->find(true);
     /** @var EContentItem[] $holdings */
     $holdings = $driver->getHolding($id);
     $showEContentNotes = false;
     foreach ($holdings as $holding) {
         if (strlen($holding->notes) > 0) {
             $showEContentNotes = true;
         }
     }
     $interface->assign('record', $eContentRecord);
     $availability = $driver->getScopedAvailability($eContentRecord);
     $interface->assign('availability', $availability['mine']);
     $interface->assign('availabilityOther', $availability['other']);
     $showAvailability = true;
     $showAvailabilityOther = true;
     if ($eContentRecord->accessType == 'external' && strcasecmp($eContentRecord->source, 'OverDrive') != 0) {
         $showAvailability = false;
         $showAvailabilityOther = false;
     }
     $interface->assign('showAvailability', $showAvailability);
     $interface->assign('showAvailabilityOther', $showAvailabilityOther);
     $interface->assign('source', $eContentRecord->source);
     $interface->assign('accessType', $eContentRecord->accessType);
     $interface->assign('showEContentNotes', $showEContentNotes);
     if ($eContentRecord->getIsbn() == null || strlen($eContentRecord->getIsbn()) == 0) {
         $interface->assign('showOtherEditionsPopup', false);
     }
     $showOverDriveConsole = false;
     $showAdobeDigitalEditions = false;
     foreach ($holdings as $item) {
         if (strcasecmp($item->getSource(), 'overdrive') == 0) {
             if (in_array($item->externalFormatId, array('ebook-epub-adobe', 'ebook-pdf-adobe'))) {
                 $showAdobeDigitalEditions = true;
             } else {
                 if (in_array($item->externalFormatId, array('video-wmv', 'music-wma', 'music-wma', 'audiobook-wma', 'audiobook-mp3'))) {
                     $showOverDriveConsole = true;
                 }
             }
         } else {
             if (in_array($item->item_type, array('epub', 'pdf'))) {
                 $showAdobeDigitalEditions = true;
             }
         }
     }
     $interface->assign('showOverDriveConsole', $showOverDriveConsole);
     $interface->assign('showAdobeDigitalEditions', $showAdobeDigitalEditions);
     $interface->assign('holdings', $holdings);
     //Load status summary
     $result = $driver->getStatusSummary($id, $holdings);
     if (PEAR_Singleton::isError($result)) {
         PEAR_Singleton::raiseError($result);
     }
     $interface->assign('holdingsSummary', $result);
     return $interface->fetch('EcontentRecord/ajax-holdings.tpl');
 }
示例#6
0
 function getItemAvailability()
 {
     global $timer;
     global $configArray;
     $itemData = array();
     //Load basic information
     $this->id = $_GET['id'];
     $itemData['id'] = $this->id;
     // Setup Search Engine Connection
     $class = $configArray['Index']['engine'];
     $url = $configArray['Index']['url'];
     $this->db = new $class($url);
     // Retrieve Full Marc Record
     disableErrorHandler();
     $record = $this->db->getRecord($this->id);
     enableErrorHandler();
     if ($record == false) {
         $marcRecord = new MarcRecord($this->id);
         if ($marcRecord->isValid()) {
             $itemData['holdings'] = Record_Holdings::loadHoldings($this->id);
             $timer->logTime('Loaded Holdings');
         } else {
             $itemData['error'] = 'Cannot load Record for id ' . $record['id'];
         }
     } else {
         $this->record = $record;
         if ($record['recordtype'] == 'econtentRecord') {
             require_once ROOT_DIR . '/sys/eContent/EContentRecord.php';
             $eContentRecord = new EContentRecord();
             $eContentRecord->id = substr($record['id'], strlen('econtentRecord'));
             if (!$eContentRecord->find(true)) {
                 $itemData['error'] = 'Cannot load eContent Record for id ' . $record['id'];
             } else {
                 require_once ROOT_DIR . '/Drivers/EContentDriver.php';
                 $driver = new EContentDriver();
                 $itemData['holdings'] = $driver->getHolding($eContentRecord->id);
             }
         } else {
             $this->recordDriver = RecordDriverFactory::initRecordDriver($record);
             $timer->logTime('Initialized the Record Driver');
             //Load Holdings
             $itemData['holdings'] = Record_Holdings::loadHoldings($this->id);
             $timer->logTime('Loaded Holdings');
         }
     }
     return $itemData;
 }