function downloadMarc() { $id = $_REQUEST['id']; $econtentRecord = new EContentRecord(); $econtentRecord->id = $id; $econtentRecord->find(true); $marcData = MarcLoader::loadEContentMarcRecord($econtentRecord); header('Content-Description: File Transfer'); header('Content-Type: application/octet-stream'); header("Content-Disposition: attachment; filename={$econtentRecord->ilsId}.mrc"); header('Content-Transfer-Encoding: binary'); header('Expires: 0'); header('Cache-Control: must-revalidate'); header('Pragma: public'); header('Content-Length: ' . strlen($marcData->toRaw())); ob_clean(); flush(); echo $marcData->toRaw(); }
static function loadDescription($eContentRecord) { global $interface; global $configArray; global $library; global $timer; $marc = MarcLoader::loadEContentMarcRecord($eContentRecord); $descriptionArray = array(); //Load the description if (strlen($eContentRecord->description) > 0) { $descriptionArray['description'] = EcontentRecord_Description::trimDescription($eContentRecord->description); } else { //TODO: Check syndetics for eContent $descriptionArray['description'] = "Description Not Provided"; } //Load publisher $descriptionArray['publisher'] = $eContentRecord->publisher; if ($descriptionArray) { return $descriptionArray; } }
static function loadDescription($eContentRecord, $forSummary = false) { $descriptionArray = array(); //Load the description if (strlen($eContentRecord->description) > 0) { $descriptionArray['description'] = EcontentRecord_Description::trimDescription($eContentRecord->description); } else { $marc = MarcLoader::loadEContentMarcRecord($eContentRecord); require_once ROOT_DIR . '/services/Record/Description.php'; global $library; $allowExternalDescription = true; if (isset($library) && $library->preferSyndeticsSummary == 0) { $allowExternalDescription = false; } if ($forSummary) { $allowExternalDescription = false; } $descriptionArray = Record_Description::loadDescriptionFromMarc($marc, $allowExternalDescription); } //Load publisher $descriptionArray['publisher'] = $eContentRecord->publisher; return $descriptionArray; }
public function setDataObject($eContentRecord) { $this->eContentRecord = $eContentRecord; $this->marcRecord = MarcLoader::loadEContentMarcRecord($eContentRecord); }
function launch() { global $interface; global $timer; global $configArray; global $user; //Enable and disable functionality based on library settings global $library; global $locationSingleton; // Setup Search Engine Connection $class = $configArray['Index']['engine']; $url = $configArray['Index']['url']; $this->db = new $class($url); if (isset($_REQUEST['searchId'])) { $_SESSION['searchId'] = $_REQUEST['searchId']; $interface->assign('searchId', $_SESSION['searchId']); } else { if (isset($_SESSION['searchId'])) { $interface->assign('searchId', $_SESSION['searchId']); } } $location = $locationSingleton->getActiveLocation(); $showCopiesLineInHoldingsSummary = true; if ($library && $library->showCopiesLineInHoldingsSummary == 0) { $showCopiesLineInHoldingsSummary = false; } $interface->assign('showCopiesLineInHoldingsSummary', $showCopiesLineInHoldingsSummary); $timer->logTime('Configure UI for library and location'); $interface->assign('overDriveVersion', isset($configArray['OverDrive']['interfaceVersion']) ? $configArray['OverDrive']['interfaceVersion'] : 1); $timer->logTime('Loaded Comments'); $eContentRecord = new EContentRecord(); $this->id = strip_tags($_REQUEST['id']); $eContentRecord->id = $this->id; if (!$eContentRecord->find(true)) { //TODO: display record not found error } else { $this->recordDriver = new EcontentRecordDriver(); $this->recordDriver->setDataObject($eContentRecord); if ($configArray['Catalog']['ils'] == 'Millennium' || $configArray['Catalog']['ils'] == 'Sierra') { if (isset($eContentRecord->ilsId) && strlen($eContentRecord->ilsId) > 0) { $interface->assign('classicId', substr($eContentRecord->ilsId, 1, strlen($eContentRecord->ilsId) - 2)); $interface->assign('classicUrl', $configArray['Catalog']['linking_url']); } } $this->isbn = $eContentRecord->getIsbn(); if (is_array($this->isbn)) { if (count($this->isbn) > 0) { $this->isbn = $this->isbn[0]; } else { $this->isbn = ""; } } $this->issn = $eContentRecord->getPropertyArray('issn'); if (is_array($this->issn)) { if (count($this->issn) > 0) { $this->issn = $this->issn[0]; } else { $this->issn = ""; } } $interface->assign('additionalAuthorsList', $eContentRecord->getPropertyArray('author2')); $interface->assign('lccnList', $eContentRecord->getPropertyArray('lccn')); $interface->assign('isbnList', $eContentRecord->getPropertyArray('isbn')); $interface->assign('isbn', $eContentRecord->getIsbn()); $interface->assign('isbn10', $eContentRecord->getIsbn10()); $interface->assign('issnList', $eContentRecord->getPropertyArray('issn')); $interface->assign('upcList', $eContentRecord->getPropertyArray('upc')); $interface->assign('seriesList', $eContentRecord->getPropertyArray('series')); $interface->assign('topicList', $eContentRecord->getPropertyArray('topic')); $interface->assign('genreList', $eContentRecord->getPropertyArray('genre')); $interface->assign('regionList', $eContentRecord->getPropertyArray('region')); $interface->assign('eraList', $eContentRecord->getPropertyArray('era')); $interface->assign('eContentRecord', $eContentRecord); $interface->assign('cleanDescription', strip_tags($eContentRecord->description, '<p><br><b><i><em><strong>')); $interface->assign('id', $eContentRecord->id); require_once ROOT_DIR . '/sys/eContent/EContentRating.php'; $eContentRating = new EContentRating(); $eContentRating->recordId = $eContentRecord->id; $interface->assign('ratingData', $eContentRating->getRatingData($user, false)); //Determine the cover to use $bookCoverUrl = $configArray['Site']['coverUrl'] . "/bookcover.php?id={$eContentRecord->id}&econtent=true&issn={$eContentRecord->getIssn()}&isn={$eContentRecord->getIsbn()}&size=large&upc={$eContentRecord->getUpc()}&category=" . urlencode($eContentRecord->format_category()) . "&format=" . urlencode($eContentRecord->getFirstFormat()); $interface->assign('bookCoverUrl', $bookCoverUrl); if (isset($_REQUEST['detail'])) { $detail = strip_tags($_REQUEST['detail']); $interface->assign('defaultDetailsTab', $detail); } // Find Similar Records $similar = $this->db->getMoreLikeThis('econtentRecord' . $eContentRecord->id); $timer->logTime('Got More Like This'); //Load the citations $this->loadCitation($eContentRecord); // Retrieve User Search History $interface->assign('lastsearch', isset($_SESSION['lastSearchURL']) ? $_SESSION['lastSearchURL'] : false); //Get Next/Previous Links $searchSource = isset($_REQUEST['searchSource']) ? $_REQUEST['searchSource'] : 'local'; $searchObject = SearchObjectFactory::initSearchObject(); $searchObject->init($searchSource); $searchObject->getNextPrevLinks(); //Load notes if any $marcRecord = MarcLoader::loadEContentMarcRecord($eContentRecord); if ($marcRecord) { $tableOfContents = array(); $marcFields505 = $marcRecord->getFields('505'); if ($marcFields505) { $tableOfContents = $this->processTableOfContentsFields($marcFields505); } $notes = array(); /*$marcFields500 = $marcRecord->getFields('500'); $marcFields504 = $marcRecord->getFields('504'); $marcFields511 = $marcRecord->getFields('511'); $marcFields518 = $marcRecord->getFields('518'); $marcFields520 = $marcRecord->getFields('520'); if ($marcFields500 || $marcFields504 || $marcFields505 || $marcFields511 || $marcFields518 || $marcFields520){ $allFields = array_merge($marcFields500, $marcFields504, $marcFields511, $marcFields518, $marcFields520); $notes = $this->processNoteFields($allFields); }*/ if (isset($library) && $library->showTableOfContentsTab == 0 || count($tableOfContents) == 0) { $notes = array_merge($notes, $tableOfContents); } else { $interface->assign('tableOfContents', $tableOfContents); } if (isset($library) && strlen($library->notesTabName) > 0) { $interface->assign('notesTabName', $library->notesTabName); } else { $interface->assign('notesTabName', 'Notes'); } $additionalNotesFields = array('520' => 'Description', '500' => 'General Note', '504' => 'Bibliography', '511' => 'Participants/Performers', '518' => 'Date/Time and Place of Event', '310' => 'Current Publication Frequency', '321' => 'Former Publication Frequency', '351' => 'Organization & arrangement of materials', '362' => 'Dates of publication and/or sequential designation', '501' => '"With"', '502' => 'Dissertation', '506' => 'Restrictions on Access', '507' => 'Scale for Graphic Material', '508' => 'Creation/Production Credits', '510' => 'Citation/References', '513' => 'Type of Report an Period Covered', '515' => 'Numbering Peculiarities', '521' => 'Target Audience', '522' => 'Geographic Coverage', '525' => 'Supplement', '526' => 'Study Program Information', '530' => 'Additional Physical Form', '533' => 'Reproduction', '534' => 'Original Version', '536' => 'Funding Information', '538' => 'System Details', '545' => 'Biographical or Historical Data', '546' => 'Language', '547' => 'Former Title Complexity', '550' => 'Issuing Body', '555' => 'Cumulative Index/Finding Aids', '556' => 'Information About Documentation', '561' => 'Ownership and Custodial History', '563' => 'Binding Information', '580' => 'Linking Entry Complexity', '581' => 'Publications About Described Materials', '586' => 'Awards', '590' => 'Local note', '599' => 'Differentiable Local note'); foreach ($additionalNotesFields as $tag => $label) { $marcFields = $marcRecord->getFields($tag); foreach ($marcFields as $marcField) { $noteText = array(); foreach ($marcField->getSubFields() as $subfield) { $noteText[] = $subfield->getData(); } $note = implode(',', $noteText); if (strlen($note) > 0) { $notes[] = "<dt>{$label}</dt><dd>" . $note . '</dd>'; } } } if (count($notes) > 0) { $interface->assign('notes', $notes); } } //Load subjects if ($marcRecord) { if (isset($configArray['Content']['subjectFieldsToShow'])) { $subjectFieldsToShow = $configArray['Content']['subjectFieldsToShow']; $subjectFields = explode(',', $subjectFieldsToShow); $subjects = array(); $standardSubjects = array(); $bisacSubjects = array(); $oclcFastSubjects = array(); foreach ($subjectFields as $subjectField) { /** @var File_MARC_Data_Field[] $marcFields */ $marcFields = $marcRecord->getFields($subjectField); if ($marcFields) { foreach ($marcFields as $marcField) { $searchSubject = ""; $subject = array(); //Determine the type of the subject $type = 'standard'; $subjectSource = $marcField->getSubfield('2'); if ($subjectSource != null) { if (preg_match('/bisac/i', $subjectSource->getData())) { $type = 'bisac'; } elseif (preg_match('/fast/i', $subjectSource->getData())) { $type = 'fast'; } } foreach ($marcField->getSubFields() as $subField) { /** @var File_MARC_Subfield $subField */ if ($subField->getCode() != '2' && $subField->getCode() != '0') { $subFieldData = $subField->getData(); if ($type == 'bisac' && $subField->getCode() == 'a') { $subFieldData = ucwords(strtolower($subFieldData)); } $searchSubject .= " " . $subFieldData; $subject[] = array('search' => trim($searchSubject), 'title' => $subFieldData); } } if ($type == 'bisac') { $bisacSubjects[] = $subject; $subjects[] = $subject; } elseif ($type == 'fast') { //Suppress fast subjects by default $oclcFastSubjects[] = $subject; } else { $subjects[] = $subject; $standardSubjects[] = $subject; } } } $interface->assign('subjects', $subjects); $interface->assign('standardSubjects', $standardSubjects); $interface->assign('bisacSubjects', $bisacSubjects); $interface->assign('oclcFastSubjects', $oclcFastSubjects); } } } else { $rawSubjects = $eContentRecord->getPropertyArray('subject'); $subjects = array(); foreach ($rawSubjects as $subject) { $explodedSubjects = explode(' -- ', $subject); $searchSubject = ""; $subject = array(); foreach ($explodedSubjects as $tmpSubject) { $searchSubject .= $tmpSubject . ' '; $subject[] = array('search' => trim($searchSubject), 'title' => $tmpSubject); } $subjects[] = $subject; } $interface->assign('subjects', $subjects); } $this->loadReviews($eContentRecord); if (isset($_REQUEST['subsection'])) { $subsection = $_REQUEST['subsection']; if ($subsection == 'Description') { $interface->assign('extendedMetadata', $this->recordDriver->getExtendedMetadata()); $interface->assign('subTemplate', 'view-description.tpl'); } elseif ($subsection == 'Reviews') { $interface->assign('subTemplate', 'view-reviews.tpl'); } } //Build the actual view $interface->setTemplate('view.tpl'); $interface->setPageTitle($eContentRecord->title); //Load Staff Details $interface->assign('staffDetails', $this->recordDriver->getStaffView($eContentRecord)); // Display Page $interface->display('layout.tpl'); } }
public function getStaffView($eContentRecord) { global $interface; $marcRecord = MarcLoader::loadEContentMarcRecord($eContentRecord); if ($marcRecord != null) { $interface->assign('marcRecord', $marcRecord); return 'RecordDrivers/Marc/staff.tpl'; } else { return null; } }
private function getCoverFromMarc($marcRecord = null) { $this->log("Looking for picture as part of 856 tag.", PEAR_LOG_INFO); if ($marcRecord == null) { $this->initDatabaseConnection(); //Process the marc record require_once ROOT_DIR . '/sys/MarcLoader.php'; if ($this->isEContent) { $epubFile = new EContentRecord(); $epubFile->id = $this->id; if ($epubFile->find(true)) { $marcRecord = MarcLoader::loadEContentMarcRecord($epubFile); } else { $marcRecord = false; } } elseif ($this->type == 'ils') { $marcRecord = MarcLoader::loadMarcRecordByILSId($this->id); } } if (!$marcRecord) { return false; } //Get the 856 tags $marcFields = $marcRecord->getFields('856'); if ($marcFields) { /** @var File_MARC_Data_Field $marcField */ foreach ($marcFields as $marcField) { //Check to see if this is a cover to use for VuFind if ($marcField->getSubfield('2') && strcasecmp(trim($marcField->getSubfield('2')->getData()), 'Vufind_Image') == 0) { if ($marcField->getSubfield('3') && (strcasecmp(trim($marcField->getSubfield('3')->getData()), 'Cover Image') == 0 || strcasecmp(trim($marcField->getSubfield('3')->getData()), 'CoverImage') == 0)) { //Can use either subfield f or subfield u if ($marcField->getSubfield('f')) { //Just references the file, add the original directory $filename = $this->bookCoverPath . '/original/' . trim($marcField->getSubfield('f')->getData()); if ($this->processImageURL($filename, true)) { //We got a successful match return true; } } elseif ($marcField->getSubfield('u')) { //Full url to the image if ($this->processImageURL(trim($marcField->getSubfield('u')->getData()), true)) { //We got a successful match return true; } } } } } } //Check the 690 field to see if this is a seed catalog entry $marcFields = $marcRecord->getFields('690'); if ($marcFields) { $this->log("Found 690 field", PEAR_LOG_INFO); foreach ($marcFields as $marcField) { if ($marcField->getSubfield('a')) { $this->log("Found 690a subfield", PEAR_LOG_INFO); $subfield_a = $marcField->getSubfield('a')->getData(); if (preg_match('/seed library.*/i', $subfield_a, $matches)) { $this->log("Title is a seed library title", PEAR_LOG_INFO); $filename = "interface/themes/responsive/images/seed_library_logo.jpg"; if ($this->processImageURL($filename, true)) { return true; } } } else { //no image link available on this link } } } $marcFields = $marcRecord->getFields('590'); if ($marcFields) { $this->log("Found 590 field", PEAR_LOG_INFO); foreach ($marcFields as $marcField) { if ($marcField->getSubfield('a')) { $this->log("Found 590a subfield", PEAR_LOG_INFO); $subfield_a = $marcField->getSubfield('a')->getData(); if (preg_match('/Colorado State Government Documents online.*/i', $subfield_a, $matches)) { $this->log("Title is a Colorado state gov doc", PEAR_LOG_INFO); $filename = "interface/themes/responsive/images/state_flag_of_colorado.png"; if ($this->processImageURL($filename, true)) { return true; } } } else { //no image link available on this link } } } return false; }