Пример #1
0
 /**
  * Assign necessary Smarty variables and return a template name to
  * load in order to display core metadata (the details shown in the
  * top portion of the record view pages, above the tabs).
  *
  * @return string Name of Smarty template file to display.
  * @access public
  */
 public function getCoreMetadata()
 {
     global $interface;
     parent::getCoreMetadata();
     $interface->assign('coreAbstracts', $this->getAbstracts());
     return 'RecordDrivers/Qdc/core.tpl';
 }
 /**
  * Get the item's place of publication.
  *
  * @access  protected
  * @return  array
  */
 protected function getPlacesOfPublication()
 {
     // Not currently stored in the Solr index
     if ($this->marcRecord) {
         return $this->getFieldArray('260');
     } else {
         if (isset($this->eContentRecord)) {
             return array($this->eContentRecord->publishLocation);
         } else {
             return parent::getPlacesOfPublication();
         }
     }
 }
Пример #3
0
 public function __construct($record)
 {
     // Call the parent's constructor...
     parent::__construct($record);
 }
Пример #4
0
 /**
  * Get an array of all series names containing the record.  Array entries may
  * be either the name string, or an associative array with 'name' and 'number'
  * keys.
  *
  * @access  protected
  * @return  array
  */
 protected function getSeries()
 {
     $matches = array();
     // First check the 440, 800 and 830 fields for series information:
     $primaryFields = array('440' => array('a', 'p'), '800' => array('a', 'b', 'c', 'd', 'f', 'p', 'q', 't'), '830' => array('a', 'p'));
     $matches = $this->getSeriesFromMARC($primaryFields);
     if (!empty($matches)) {
         return $matches;
     }
     // Now check 490 and display it only if 440/800/830 were empty:
     $secondaryFields = array('490' => array('a'));
     $matches = $this->getSeriesFromMARC($secondaryFields);
     if (!empty($matches)) {
         return $matches;
     }
     // Still no results found?  Resort to the Solr-based method just in case!
     return parent::getSeries();
 }
Пример #5
0
 /**
  * Overload the IndexRecord method to include other references from MARC field 787.
  *
  * @return string Name of Smarty template file to display.
  * @access public
  */
 public function getCoreMetadata()
 {
     global $configArray;
     global $interface;
     $interface->assign('coreOtherLinks', $this->getOtherLinks());
     $interface->assign('coreUniformTitles', $this->getUniformTitles());
     // Call the parent method:
     return parent::getCoreMetadata();
 }
Пример #6
0
 /**
  * Assign necessary Smarty variables and return a template name for the current
  * view to load in order to display a summary of the item suitable for use in
  * search results.
  *
  * @param string $view The current view.
  * @param boolean $useUnscopedHoldingsSummary Whether or not the $result should show an unscoped holdings summary.
  *
  * @return string      Name of Smarty template file to display.
  * @access public
  */
 public function getSearchResult($view = 'list', $useUnscopedHoldingsSummary = false)
 {
     global $interface;
     // MARC results work just like index results, except that we want to
     // enable the AJAX status display since we assume that MARC records
     // come from the ILS:
     $template = parent::getSearchResult($view, $useUnscopedHoldingsSummary);
     $interface->assign('summAjaxStatus', true);
     return $template;
 }
Пример #7
0
 /**
  * Get an array of physical descriptions of the item.
  *
  * @return array
  * @access protected
  */
 protected function getPhysicalDescriptions()
 {
     $physDesc = parent::getPhysicalDescriptions();
     if (isset($this->fields['material'])) {
         $physDesc = array_merge($physDesc, $this->fields['material']);
     }
     return $physDesc;
 }
Пример #8
0
 /**
  * Return image rights.
  *
  * @return mixed array with keys:
  *   'copyright'  Copyright (e.g. 'CC BY 4.0') (optional)
  *   'description Human readable description (array)
  *   'link'       Link to copyright info
  *   or false if the record contains no images
  * @access protected
  */
 public function getImageRights()
 {
     global $configArray;
     if (!count($this->getAllImages())) {
         return false;
     }
     $rights = array();
     if ($type = $this->getAccessRestrictionsType()) {
         $rights['copyright'] = $type['copyright'];
         if (isset($type['link'])) {
             $rights['link'] = $type['link'];
         }
     }
     $desc = $this->getAccessRestrictions();
     if ($desc && count($desc)) {
         $description = array();
         foreach ($desc as $p) {
             $description[] = (string) $p;
         }
         $rights['description'] = $description;
     }
     return isset($rights['copyright']) || isset($rights['description']) ? $rights : parent::getImageRights();
 }
Пример #9
0
 function getBasicItemInfo()
 {
     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
     if (!($record = $this->db->getRecord($this->id))) {
         PEAR_Singleton::raiseError(new PEAR_Error('Record Does Not Exist'));
     }
     $this->record = $record;
     $this->recordDriver = RecordDriverFactory::initRecordDriver($record);
     $timer->logTime('Initialized the Record Driver');
     // Process MARC Data
     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 {
             $itemData['isbn'] = $eContentRecord->getIsbn();
             $itemData['issn'] = $eContentRecord->getissn();
             $itemData['upc'] = $eContentRecord->getUpc();
             $itemData['issn'] = '';
             $itemData['title'] = $record['title'];
             $itemData['author'] = $eContentRecord->author;
             $itemData['publisher'] = $eContentRecord->publisher;
             $itemData['allIsbn'] = $eContentRecord->getPropertyArray('isbn');
             $itemData['allUpc'] = $eContentRecord->getPropertyArray('upc');
             $itemData['allIssn'] = $eContentRecord->getPropertyArray('issn');
             $itemData['format'] = $eContentRecord->format();
             $itemData['formatCategory'] = $eContentRecord->format_category();
             $itemData['language'] = $eContentRecord->language;
             $itemData['cover'] = $configArray['Site']['coverUrl'] . "/bookcover.php?id={$itemData['id']}&isbn={$itemData['isbn']}&issn={$itemData['issn']}&upc={$itemData['upc']}&category={$itemData['formatCategory']}&format={$itemData['format'][0]}&size=medium";
             $itemData['description'] = $eContentRecord->description;
             require_once ROOT_DIR . '/sys/eContent/EContentRating.php';
             $eContentRating = new EContentRating();
             $eContentRating->recordId = $eContentRecord->id;
             global $user;
             $itemData['ratingData'] = $eContentRating->getRatingData($user, false);
         }
     } else {
         require_once ROOT_DIR . '/sys/MarcLoader.php';
         $marcRecord = MarcLoader::loadMarcRecordFromRecord($record);
         if ($marcRecord) {
             $this->marcRecord = $marcRecord;
         } else {
             $itemData['error'] = 'Cannot Process MARC Record';
         }
         $timer->logTime('Processed the marc record');
         // Get ISBN for cover and review use
         if ($isbnFields = $this->marcRecord->getFields('020')) {
             //Use the first good ISBN we find.
             /** @var File_MARC_Data_Field $isbnField */
             foreach ($isbnFields as $isbnField) {
                 if ($isbnSubfield = $isbnField->getSubfield('a')) {
                     $this->isbn = trim($isbnSubfield->getData());
                     if ($pos = strpos($this->isbn, ' ')) {
                         $this->isbn = substr($this->isbn, 0, $pos);
                     }
                     if (strlen($this->isbn) < 10) {
                         $this->isbn = str_pad($this->isbn, 10, "0", STR_PAD_LEFT);
                     }
                     $itemData['isbn'] = $this->isbn;
                     break;
                 }
             }
         }
         /** @var File_MARC_Data_Field $upcField */
         if ($upcField = $this->marcRecord->getField('024')) {
             if ($upcSubField = $upcField->getSubfield('a')) {
                 $this->upc = trim($upcSubField->getData());
                 $itemData['upc'] = $this->upc;
             }
         }
         /** @var File_MARC_Data_Field $issnField */
         if ($issnField = $this->marcRecord->getField('022')) {
             if ($issnSubfield = $issnField->getSubfield('a')) {
                 $this->issn = trim($issnSubfield->getData());
                 if ($pos = strpos($this->issn, ' ')) {
                     $this->issn = substr($this->issn, 0, $pos);
                 }
                 $itemData['issn'] = $this->issn;
             }
         }
         $timer->logTime('Got UPC, ISBN, and ISSN');
         //Generate basic information from the marc file to make display easier.
         $itemData['title'] = $record['title'];
         $itemData['author'] = isset($record['author']) ? $record['author'] : (isset($record['author2']) ? $record['author2'][0] : '');
         $itemData['publisher'] = $record['publisher'];
         $itemData['allIsbn'] = $record['isbn'];
         $itemData['allUpc'] = $record['upc'];
         $itemData['allIssn'] = $record['issn'];
         $itemData['issn'] = $record['issn'];
         $itemData['format'] = isset($record['format']) ? $record['format'][0] : '';
         $itemData['formatCategory'] = $record['format_category'][0];
         $itemData['language'] = $record['language'];
         $itemData['cover'] = $configArray['Site']['path'] . "/bookcover.php?id={$itemData['id']}&issn={$itemData['issn']}&isbn={$itemData['isbn']}&upc={$itemData['upc']}&category={$itemData['formatCategory']}&format={$itemData['format'][0]}";
         //Retrieve description from MARC file
         $description = '';
         /** @var File_MARC_Data_Field $descriptionField */
         if ($descriptionField = $this->marcRecord->getField('520')) {
             if ($descriptionSubfield = $descriptionField->getSubfield('a')) {
                 $description = trim($descriptionSubfield->getData());
             }
         }
         $itemData['description'] = $description;
         //setup 5 star ratings
         $itemData['ratingData'] = $this->recordDriver->getRatingData();
         $timer->logTime('Got 5 star data');
     }
     return $itemData;
 }