예제 #1
0
 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');
 }
예제 #2
0
 function launch()
 {
     global $interface;
     $goDeeperOptions = GoDeeperData::getGoDeeperOptions($this->isbn, $this->upc, true);
     $interface->assign('options', $goDeeperOptions['options']);
     if (isset($goDeeperOptions['defaultOption'])) {
         $defaultData = GoDeeperData::getHtmlData($goDeeperOptions['defaultOption'], 'Record', $this->isbn, $this->upc);
         $interface->assign('defaultGoDeeperData', $defaultData);
     }
     if (isset($_GET['lightbox'])) {
         $interface->assign('title', translate("Additional information about this title"));
         echo $interface->fetch('Record/goDeeper.tpl');
     } else {
         $interface->setPageTitle(translate('Go Deeper'));
         $interface->assign('subTemplate', 'goDeeper.tpl');
         $interface->setTemplate('view.tpl');
     }
 }
예제 #3
0
 function getEnrichmentData()
 {
     require_once ROOT_DIR . '/services/Record/Enrichment.php';
     $record = $this->loadSolrRecord($_GET['id']);
     $isbn = isset($record['isbn']) ? ISBN::normalizeISBN($record['isbn'][0]) : null;
     //Need to trim the isbn to make sure there isn't descriptive text.
     $upc = isset($record['upc']) ? $record['upc'][0] : null;
     $enrichmentData = Record_Enrichment::loadEnrichment($isbn);
     //Load go deeper options
     require_once ROOT_DIR . '/Drivers/marmot_inc/GoDeeperData.php';
     $goDeeperOptions = GoDeeperData::getGoDeeperOptions($isbn, $upc, false);
     return array('enrichment' => $enrichmentData, 'goDeeper' => $goDeeperOptions);
 }
예제 #4
0
 function GetEnrichmentInfo()
 {
     require_once ROOT_DIR . '/services/EcontentRecord/Enrichment.php';
     global $configArray;
     global $library;
     $isbn = $_REQUEST['isbn'];
     $upc = $_REQUEST['upc'];
     $id = $_REQUEST['id'];
     $enrichmentData = EcontentRecord_Enrichment::loadEnrichment($isbn);
     global $interface;
     $interface->assign('id', $id);
     $interface->assign('enrichment', $enrichmentData);
     $interface->assign('enrichment', $enrichmentData);
     $showSimilarTitles = false;
     if (isset($enrichmentData['novelist']) && isset($enrichmentData['novelist']['similarTitles']) && is_array($enrichmentData['novelist']['similarTitles']) && count($enrichmentData['novelist']['similarTitles']) > 0) {
         foreach ($enrichmentData['novelist']['similarTitles'] as $title) {
             if ($title['recordId'] != -1) {
                 $showSimilarTitles = true;
                 break;
             }
         }
     }
     if (isset($library) && $library->showSimilarTitles == 0) {
         $interface->assign('showSimilarTitles', false);
     } else {
         $interface->assign('showSimilarTitles', $showSimilarTitles);
     }
     if (isset($library) && $library->showSimilarAuthors == 0) {
         $interface->assign('showSimilarAuthors', false);
     } else {
         $interface->assign('showSimilarAuthors', true);
     }
     //Process series data
     $titles = array();
     if (!isset($enrichmentData['novelist']['series']) || count($enrichmentData['novelist']['series']) == 0) {
         $interface->assign('seriesInfo', json_encode(array('titles' => $titles, 'currentIndex' => 0)));
     } else {
         foreach ($enrichmentData['novelist']['series'] as $record) {
             $isbn = $record['isbn'];
             if (strpos($isbn, ' ') > 0) {
                 $isbn = substr($isbn, 0, strpos($isbn, ' '));
             }
             $cover = $configArray['Site']['coverUrl'] . "/bookcover.php?size=medium&isn=" . $isbn;
             if (isset($record['id'])) {
                 $cover .= "&id=" . $record['id'];
             }
             if (isset($record['upc'])) {
                 $cover .= "&upc=" . $record['upc'];
             }
             if (isset($record['format_category'])) {
                 $cover .= "&category=" . $record['format_category'][0];
             }
             $titles[] = array('id' => isset($record['id']) ? $record['id'] : '', 'image' => $cover, 'title' => $record['title'], 'author' => $record['author']);
         }
         foreach ($titles as $key => $rawData) {
             if ($rawData['id']) {
                 if (strpos($rawData['id'], 'econtentRecord') === 0) {
                     $shortId = str_replace('econtentRecord', '', $rawData['id']);
                     $formattedTitle = "<div id=\"scrollerTitleSeries{$key}\" class=\"scrollerTitle\">" . '<a href="' . $configArray['Site']['path'] . "/EcontentRecord/" . $shortId . '" id="descriptionTrigger' . $shortId . '">' . "<img src=\"{$rawData['image']}\" class=\"scrollerTitleCover\" alt=\"{$rawData['title']} Cover\"/>" . "</a></div>" . "<div id='descriptionPlaceholder{$shortId}' style='display:none'></div>";
                 } else {
                     $shortId = str_replace('.', '', $rawData['id']);
                     $formattedTitle = "<div id=\"scrollerTitleSeries{$key}\" class=\"scrollerTitle\">" . '<a href="' . $configArray['Site']['path'] . "/Record/" . $rawData['id'] . '" id="descriptionTrigger' . $shortId . '">' . "<img src=\"{$rawData['image']}\" class=\"scrollerTitleCover\" alt=\"{$rawData['title']} Cover\"/>" . "</a></div>" . "<div id='descriptionPlaceholder{$shortId}' style='display:none'></div>";
                 }
             } else {
                 $formattedTitle = "<div id=\"scrollerTitleSeries{$key}\" class=\"scrollerTitle\">" . "<img src=\"{$rawData['image']}\" class=\"scrollerTitleCover\" alt=\"{$rawData['title']} Cover\"/>" . "</div>";
             }
             $rawData['formattedTitle'] = $formattedTitle;
             $titles[$key] = $rawData;
         }
         $seriesInfo = array('titles' => $titles, 'currentIndex' => $enrichmentData['novelist']['seriesDefaultIndex']);
         $interface->assign('seriesInfo', json_encode($seriesInfo));
     }
     //Load go deeper options
     if (isset($library) && $library->showGoDeeper == 0) {
         $interface->assign('showGoDeeper', false);
     } else {
         require_once ROOT_DIR . '/Drivers/marmot_inc/GoDeeperData.php';
         $goDeeperOptions = GoDeeperData::getGoDeeperOptions($isbn, $upc);
         if (count($goDeeperOptions['options']) == 0) {
             $interface->assign('showGoDeeper', false);
         } else {
             $interface->assign('showGoDeeper', true);
         }
     }
     return $interface->fetch('Record/ajax-enrichment.tpl');
 }
예제 #5
0
 function getEnrichmentInfo()
 {
     global $configArray;
     global $interface;
     require_once ROOT_DIR . '/RecordDrivers/GroupedWorkDriver.php';
     $id = $_REQUEST['id'];
     $recordDriver = new GroupedWorkDriver($id);
     $enrichmentResult = array();
     $enrichmentData = $recordDriver->loadEnrichment();
     //Process series data
     $titles = array();
     if (!isset($enrichmentData['novelist']->seriesTitles) || count($enrichmentData['novelist']->seriesTitles) == 0) {
         $enrichmentResult['seriesInfo'] = array('titles' => $titles, 'currentIndex' => 0);
     } else {
         foreach ($enrichmentData['novelist']->seriesTitles as $key => $record) {
             $titles[] = $this->getScrollerTitle($record, $key, 'Series');
         }
         $seriesInfo = array('titles' => $titles, 'currentIndex' => $enrichmentData['novelist']->seriesDefaultIndex);
         $enrichmentResult['seriesInfo'] = $seriesInfo;
     }
     //Process other data from novelist
     if (isset($enrichmentData['novelist']) && isset($enrichmentData['novelist']->similarTitles)) {
         $interface->assign('similarTitles', $enrichmentData['novelist']->similarTitles);
         $enrichmentResult['similarTitlesNovelist'] = $interface->fetch('GroupedWork/similarTitlesNovelist.tpl');
     }
     if (isset($enrichmentData['novelist']) && isset($enrichmentData['novelist']->authors)) {
         $interface->assign('similarAuthors', $enrichmentData['novelist']->authors);
         $enrichmentResult['similarAuthorsNovelist'] = $interface->fetch('GroupedWork/similarAuthorsNovelist.tpl');
     }
     if (isset($enrichmentData['novelist']) && isset($enrichmentData['novelist']->similarSeries)) {
         $interface->assign('similarSeries', $enrichmentData['novelist']->similarSeries);
         $enrichmentResult['similarSeriesNovelist'] = $interface->fetch('GroupedWork/similarSeriesNovelist.tpl');
     }
     //Load Similar titles (from Solr)
     $class = $configArray['Index']['engine'];
     $url = $configArray['Index']['url'];
     /** @var Solr $db */
     $db = new $class($url);
     $db->disableScoping();
     $similar = $db->getMoreLikeThis2($id);
     // 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) {
         $similarTitles = array();
         foreach ($similar['response']['docs'] as $key => $similarTitle) {
             $similarTitleDriver = new GroupedWorkDriver($similarTitle);
             $similarTitles[] = $similarTitleDriver->getScrollerTitle($key, 'MoreLikeThis');
         }
         $similarTitlesInfo = array('titles' => $similarTitles, 'currentIndex' => 0);
         $enrichmentResult['similarTitles'] = $similarTitlesInfo;
     }
     //Load go deeper options
     //TODO: Additional go deeper options
     if (isset($library) && $library->showGoDeeper == 0) {
         $enrichmentResult['showGoDeeper'] = false;
     } else {
         require_once ROOT_DIR . '/Drivers/marmot_inc/GoDeeperData.php';
         $goDeeperOptions = GoDeeperData::getGoDeeperOptions($recordDriver->getCleanISBN(), $recordDriver->getCleanUPC());
         if (count($goDeeperOptions['options']) == 0) {
             $enrichmentResult['showGoDeeper'] = false;
         } else {
             $enrichmentResult['showGoDeeper'] = true;
             $enrichmentResult['goDeeperOptions'] = $goDeeperOptions['options'];
         }
     }
     //Related data
     $enrichmentResult['relatedContent'] = $interface->fetch('Record/relatedContent.tpl');
     return json_encode($enrichmentResult);
 }