Beispiel #1
0
 /**
  * Get econtent information for a title.
  *
  * @param EContentRecord $eContentRecord
  * @return array
  */
 private function setEcontentRecordInfoForList($eContentRecord)
 {
     global $configArray;
     return array('id' => 'econtentRecord' . $eContentRecord->id, 'image' => $configArray['Site']['coverUrl'] . "/bookcover.php?id=" . $eContentRecord->id . "&issn=" . $eContentRecord->getissn() . "&isn=" . $eContentRecord->getIsbn() . "&size=medium&upc=" . $eContentRecord->getUpc() . "&category=EMedia&econtent=true", 'large_image' => $configArray['Site']['coverUrl'] . "/bookcover.php?id=" . $eContentRecord->id . "&issn=" . $eContentRecord->getissn() . "&isn=" . $eContentRecord->getIsbn() . "&size=large&upc=" . $eContentRecord->getUpc() . "&category=EMedia&econtent=true", 'small_image' => $configArray['Site']['coverUrl'] . "/bookcover.php?id=" . $eContentRecord->id . "&issn=" . $eContentRecord->getissn() . "&isn=" . $eContentRecord->getIsbn() . "&size=small&upc=" . $eContentRecord->getUpc() . "&category=EMedia&econtent=true", 'title' => $eContentRecord->title, 'author' => $eContentRecord->author, 'description' => $eContentRecord->description, 'length' => '', 'publisher' => $eContentRecord->publisher, 'dateSaved' => $eContentRecord->date_added);
 }
Beispiel #2
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);
     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;
     $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
         global $user;
         $resource = new Resource();
         $resource->record_id = $this->id;
         $resource->source = 'VuFind';
         $ratingData = $resource->getRatingData($user);
         $itemData['ratingData'] = $ratingData;
         $timer->logTime('Got 5 star data');
     }
     return $itemData;
 }