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'); }