function launch() { global $interface; $id = $_REQUEST['id']; $eContentRecord = new EContentRecord(); $eContentRecord->id = $id; $eContentRecord->find(true); $goDeeperOptions = GoDeeperData::getGoDeeperOptions($eContentRecord->getIsbn(), $eContentRecord->upc, true); $interface->assign('options', $goDeeperOptions['options']); if (isset($goDeeperOptions['defaultOption'])) { $defaultData = GoDeeperData::getHtmlData($goDeeperOptions['defaultOption'], 'eContentRecord', $eContentRecord->getIsbn(), $eContentRecord->upc); $interface->assign('defaultGoDeeperData', $defaultData); } $interface->assign('title', translate("Additional information about this title")); echo $interface->fetch('Record/goDeeper.tpl'); }
function launch() { global $configArray; global $interface; global $user; //Build the actual view $interface->setTemplate('../Record/view-series.tpl'); $eContentRecord = new EContentRecord(); $id = strip_tags($_REQUEST['id']); $eContentRecord->id = $id; $eContentRecord->find(true); require_once 'Enrichment.php'; $enrichment = new EcontentRecord_Enrichment(); $enrichmentData = $enrichment->loadEnrichment($eContentRecord->getIsbn()); $seriesTitle = ''; $seriesAuthors = array(); $seriesTitles = array(); $resourceList = array(); if (isset($enrichmentData['novelist']) && isset($enrichmentData['novelist']['series'])) { $seriesTitles = $enrichmentData['novelist']['series']; //Loading the series title is not reliable. Do not try to load it. if (isset($seriesTitles) && is_array($seriesTitles)) { foreach ($seriesTitles as $title) { if (isset($title['series']) && strlen($title['series']) > 0 && !isset($seriesTitle)) { $seriesTitle = $title['series']; $interface->assign('seriesTitle', $seriesTitle); } if (isset($title['author'])) { $seriesAuthors[$title['author']] = $title['author']; } if ($title['libraryOwned']) { $record = RecordDriverFactory::initRecordDriver($title); $resourceList[] = $interface->fetch($record->getSearchResult($user, null, false)); } else { $interface->assign('record', $title); $resourceList[] = $interface->fetch('RecordDrivers/Index/nonowned_result.tpl'); } } } } $interface->assign('seriesAuthors', $seriesAuthors); $interface->assign('recordSet', $seriesTitles); $interface->assign('resourceList', $resourceList); $interface->assign('recordStart', 1); $interface->assign('recordEnd', count($seriesTitles)); $interface->assign('recordCount', count($seriesTitles)); $interface->setPageTitle($seriesTitle); // Display Page $interface->display('layout.tpl'); }
/** * 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); }
function getOtherEditions() { global $interface; global $analytics; $id = $_REQUEST['id']; $isEContent = $_REQUEST['isEContent']; if ($isEContent == 'true') { require_once ROOT_DIR . '/sys/eContent/EContentRecord.php'; $econtentRecord = new EContentRecord(); $econtentRecord->id = $id; if ($econtentRecord->find(true)) { $otherEditions = OtherEditionHandler::getEditions($econtentRecord->id, $econtentRecord->getIsbn(), $econtentRecord->getIssn(), 10); } else { $error = "Sorry we couldn't find that record in the catalog."; } } else { $resource = new Resource(); $resource->record_id = $id; $resource->source = 'VuFind'; $solrId = $id; if ($resource->find(true)) { $otherEditions = OtherEditionHandler::getEditions($solrId, $resource->isbn, null, 10); } else { $error = "Sorry we couldn't find that record in the catalog."; } } if (isset($otherEditions)) { //Get resource for each edition $editionResources = array(); if (is_array($otherEditions)) { foreach ($otherEditions as $edition) { /** @var Resource $editionResource */ $editionResource = new Resource(); if (preg_match('/econtentRecord(\\d+)/', $edition['id'], $matches)) { $editionResource->source = 'eContent'; $editionResource->record_id = trim($matches[1]); } else { $editionResource->record_id = $edition['id']; $editionResource->source = 'VuFind'; } if ($editionResource->find(true)) { $editionResources[] = $editionResource; } else { $logger = new Logger(); $logger->log("Could not find resource {$editionResource->source} {$editionResource->record_id} - {$edition['id']}", PEAR_LOG_DEBUG); } } $analytics->addEvent('Enrichment', 'Other Editions', count($otherEditions)); } else { $analytics->addEvent('Enrichment', 'Other Editions Error'); } $interface->assign('otherEditions', $editionResources); $interface->assign('popupTitle', 'Other Editions'); $interface->assign('popupTemplate', 'Resource/otherEditions.tpl'); echo $interface->fetch('popup-wrapper.tpl'); } elseif (isset($error)) { $analytics->addEvent('Enrichment', 'Other Editions Error', $error); echo $error; } else { echo "There are no other editions for this title currently in the catalog."; $analytics->addEvent('Enrichment', 'Other Editions', 0, 'No Other ISBNs'); } }
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; }
function launch() { global $configArray; global $interface; global $user; //Enable and disable functionality based on library settings global $library; global $locationSingleton; $location = $locationSingleton->getActiveLocation(); if (isset($library)) { if ($location != null) { $interface->assign('showHoldButton', $location->showHoldButton == 1 && $library->showHoldButton == 1 ? 1 : 0); } else { $interface->assign('showHoldButton', $library->showHoldButton); } $interface->assign('showTagging', $library->showTagging); $interface->assign('showRatings', $library->showRatings); $interface->assign('showComments', $library->showComments); $interface->assign('showFavorites', $library->showFavorites); } else { if ($location != null) { $interface->assign('showHoldButton', $location->showHoldButton); } else { $interface->assign('showHoldButton', 1); } $interface->assign('showTagging', 1); $interface->assign('showRatings', 1); $interface->assign('showComments', 1); $interface->assign('showFavorites', 1); } //Build the actual view $interface->setTemplate('../Record/view-series.tpl'); $eContentRecord = new EContentRecord(); $this->id = strip_tags($_REQUEST['id']); $eContentRecord->id = $this->id; $eContentRecord->find(true); require_once 'Enrichment.php'; $enrichment = new EcontentRecord_Enrichment(); $enrichmentData = $enrichment->loadEnrichment($eContentRecord->getIsbn()); $seriesTitle = ''; $seriesAuthors = array(); $seriesTitles = array(); $resourceList = array(); if (isset($enrichmentData['novelist'])) { $seriesTitles = $enrichmentData['novelist']['series']; //Loading the series title is not reliable. Do not try to load it. if (isset($seriesTitles) && is_array($seriesTitles)) { foreach ($seriesTitles as $key => $title) { if (isset($title['series']) && strlen($title['series']) > 0 && !isset($seriesTitle)) { $seriesTitle = $title['series']; $interface->assign('seriesTitle', $seriesTitle); } if (isset($title['author'])) { $seriesAuthors[$title['author']] = $title['author']; } if ($title['libraryOwned']) { $record = RecordDriverFactory::initRecordDriver($title); $resourceList[] = $interface->fetch($record->getSearchResult($user, null, false)); } else { $interface->assign('record', $title); $resourceList[] = $interface->fetch('RecordDrivers/Index/nonowned_result.tpl'); } } } } $interface->assign('seriesAuthors', $seriesAuthors); $interface->assign('recordSet', $seriesTitles); $interface->assign('resourceList', $resourceList); $interface->assign('recordStart', 1); $interface->assign('recordEnd', count($seriesTitles)); $interface->assign('recordCount', count($seriesTitles)); $interface->setPageTitle($seriesTitle); // Display Page $interface->display('layout.tpl'); }
function launch() { global $configArray; global $interface; global $user; // 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; } //Enable and disable functionality based on library settings global $library; global $locationSingleton; $location = $locationSingleton->getActiveLocation(); if (isset($library)) { if ($location != null) { $interface->assign('showHoldButton', $location->showHoldButton == 1 && $library->showHoldButton == 1 ? 1 : 0); } else { $interface->assign('showHoldButton', $library->showHoldButton); } $interface->assign('showTagging', $library->showTagging); $interface->assign('showRatings', $library->showRatings); $interface->assign('showComments', $library->showComments); $interface->assign('showFavorites', $library->showFavorites); } else { if ($location != null) { $interface->assign('showHoldButton', $location->showHoldButton); } else { $interface->assign('showHoldButton', 1); } $interface->assign('showTagging', 1); $interface->assign('showRatings', 1); $interface->assign('showComments', 1); $interface->assign('showFavorites', 1); } //Build the actual view $interface->setTemplate('../Record/view-series.tpl'); $eContentRecord = new EContentRecord(); $this->id = strip_tags($_REQUEST['id']); $eContentRecord->id = $this->id; $eContentRecord->find(true); $similar = $this->db->getMoreLikeThis2($eContentRecord->getSolrId()); // Send the similar items to the template; if there is only one, we need // to force it to be an array or things will not display correctly. if (isset($similar) && count($similar['response']['docs']) > 0) { $this->similarTitles = $similar['response']['docs']; } else { $this->similarTitles = array(); } $resourceList = array(); $curIndex = 0; $groupingTerms = array(); if (isset($this->similarTitles) && is_array($this->similarTitles)) { foreach ($this->similarTitles as $title) { $groupingTerm = $title['grouping_term']; if (array_key_exists($groupingTerm, $groupingTerms)) { continue; } $groupingTerms[$groupingTerm] = $groupingTerm; $interface->assign('resultIndex', ++$curIndex); $record = RecordDriverFactory::initRecordDriver($title); $resourceList[] = $interface->fetch($record->getSearchResult($user, null, false)); } } $interface->assign('recordSet', $this->similarTitles); $interface->assign('resourceList', $resourceList); $interface->assign('recordStart', 1); $interface->assign('recordEnd', count($resourceList)); $interface->assign('recordCount', count($resourceList)); $novelist = NovelistFactory::getNovelist(); $enrichment = $novelist->loadEnrichment($eContentRecord->getIsbn()); $interface->assign('enrichment', $enrichment); $interface->assign('id', $this->id); //Build the actual view $interface->setTemplate('view-similar.tpl'); $interface->setPageTitle('Similar to ' . $eContentRecord->title); $interface->assign('eContentRecord', $eContentRecord); // Display Page $interface->display('layout.tpl'); }