本文整理汇总了PHP中Library::getSearchLibrary方法的典型用法代码示例。如果您正苦于以下问题:PHP Library::getSearchLibrary方法的具体用法?PHP Library::getSearchLibrary怎么用?PHP Library::getSearchLibrary使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Library
的用法示例。
在下文中一共展示了Library::getSearchLibrary方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: isValidForUser
function isValidForUser($locationCode, $eContentFieldData)
{
$sharing = $this->getSharing($locationCode, $eContentFieldData);
if ($sharing == 'shared') {
$searchLibrary = Library::getSearchLibrary();
if ($searchLibrary == null || $searchLibrary->econtentLocationsToInclude == 'all' || strlen($searchLibrary->econtentLocationsToInclude) == 0 || strpos($searchLibrary->econtentLocationsToInclude, $locationCode) !== FALSE) {
return true;
} else {
return false;
}
} else {
if ($sharing == 'library') {
$searchLibrary = Library::getSearchLibrary();
if ($searchLibrary == null || $searchLibrary->includeOutOfSystemExternalLinks || strlen($searchLibrary->ilsCode) > 0 && strpos($locationCode, $searchLibrary->ilsCode) === 0) {
return true;
} else {
return false;
}
} else {
$searchLibrary = Library::getSearchLibrary();
$searchLocation = Location::getSearchLocation();
if ($searchLibrary->includeOutOfSystemExternalLinks || strpos($locationCode, $searchLocation->code) === 0) {
return true;
} else {
return false;
}
}
}
}
示例2: isValidForUser
function isValidForUser($locationCode, $eContentFieldData)
{
$sharing = $this->getSharing($locationCode, $eContentFieldData);
if ($sharing == 'shared') {
return true;
} else {
if ($sharing == 'library') {
$searchLibrary = Library::getSearchLibrary();
if ($searchLibrary == null || strlen($searchLibrary->ilsCode) > 0 && strpos($locationCode, $searchLibrary->ilsCode) === 0) {
global $user;
if ($user) {
$patronHomeLibrary = Library::getPatronHomeLibrary();
return $patronHomeLibrary == null || strlen($patronHomeLibrary->ilsCode) > 0 && strpos($locationCode, $patronHomeLibrary->ilsCode) === 0;
} else {
return true;
}
} else {
return false;
}
} else {
//Just share with the specific location
$searchLocation = Location::getSearchLocation();
if (!$searchLocation) {
return true;
} elseif (strpos($locationCode, $searchLocation->code) === 0) {
return true;
} else {
return false;
}
}
}
}
示例3: getBrowseResults
public function getBrowseResults($browseType, $lookFor, $relativePage = 0, $resultsPerPage = 20)
{
global $configArray;
global $timer;
//Normalize the search term
$lookFor = strtolower($lookFor);
$results = array();
//Query to find the first record that matches the
if (!in_array($browseType, array('title', 'author', 'callnumber', 'subject'))) {
return array('success' => false, 'message' => "The browse type {$browseType} is not a valid browse type.");
}
$browseTable = $browseType . '_browse';
$browseField = 'sortValue';
mysql_select_db($configArray['Database']['database_vufind_dbname']);
global $librarySingleton;
global $locationSingleton;
$searchLibrary = Library::getSearchLibrary();
$libaryToBrowse = -1;
$scope = 0;
$scopeId = '';
if (isset($searchLibrary) && $searchLibrary->restrictSearchByLibrary) {
$libaryToBrowse = $searchLibrary->libraryId;
$scope = 1;
$scopeId = $searchLibrary->subdomain;
}
//Get the count of the rows in the database
if ($scope == 0) {
$scopingFilter = "scope = {$scope} and scopeId= -1";
} elseif ($scope = 1) {
$scopingFilter = "scope = 1 and scopeId={$libaryToBrowse}";
}
$query = "SELECT * FROM {$browseTable}_metadata WHERE {$scopingFilter}";
$result = mysql_query($query);
// @codeCoverageIgnoreStart
if ($result == FALSE) {
return array('success' => false, 'message' => "Sorry, unable to browse {$browseType} right now, please try again later.");
}
// @codeCoverageIgnoreEnd
$timer->logTime("Loaded metadata");
$metaData = mysql_fetch_assoc($result);
//echo("NumRows = {$metaData['numResults']}");
//Cleanup our look for value
$lookFor = strtolower($lookFor);
$lookFor = preg_replace('/\\W/', ' ', $lookFor);
$lookFor = preg_replace("/^(a|an|the|el|la)\\s/", '', $lookFor);
$lookFor = preg_replace('/\\s{2,}/', ' ', $lookFor);
return $this->loadBrowseItems($lookFor, $browseType, $browseTable, $scopingFilter, $scope, $scopeId, $relativePage, $resultsPerPage, $metaData);
}
示例4: launch
//.........这里部分代码省略.........
$location = $locationSingleton->getActiveLocation();
$showHoldButton = 1;
$showHoldButtonInSearchResults = 1;
$interface->assign('showNotInterested', false);
if (isset($library) && $location != null) {
$interface->assign('showFavorites', $library->showFavorites);
$interface->assign('showComments', $library->showComments);
$showHoldButton = $location->showHoldButton == 1 && $library->showHoldButton == 1 ? 1 : 0;
$showHoldButtonInSearchResults = $location->showHoldButton == 1 && $library->showHoldButtonInSearchResults == 1 ? 1 : 0;
} else {
if ($location != null) {
$interface->assign('showFavorites', 1);
$showHoldButton = $location->showHoldButton;
} else {
if (isset($library)) {
$interface->assign('showFavorites', $library->showFavorites);
$showHoldButton = $library->showHoldButton;
$showHoldButtonInSearchResults = $library->showHoldButtonInSearchResults;
$interface->assign('showComments', $library->showComments);
} else {
$interface->assign('showFavorites', 1);
$interface->assign('showComments', 1);
}
}
}
if ($showHoldButton == 0) {
$showHoldButtonInSearchResults = 0;
}
$interface->assign('showHoldButton', $showHoldButtonInSearchResults);
$interface->assign('page_body_style', 'sidebar_left');
$interface->assign('overDriveVersion', isset($configArray['OverDrive']['interfaceVersion']) ? $configArray['OverDrive']['interfaceVersion'] : 1);
//Check to see if we should show unscoped results
$enableUnscopedSearch = false;
$searchLibrary = Library::getSearchLibrary();
if ($searchLibrary != null && $searchLibrary->showMarmotResultsAtEndOfSearch) {
if (is_object($searchSource)) {
$enableUnscopedSearch = $searchSource->catalogScoping != 'unscoped';
$unscopedSearch = clone $searchObject;
} else {
$searchSources = new SearchSources();
$searchOptions = $searchSources->getSearchSources();
if (isset($searchOptions['marmot'])) {
$unscopedSearch = clone $searchObject;
$enableUnscopedSearch = true;
}
}
}
$enableProspectorIntegration = isset($configArray['Content']['Prospector']) ? $configArray['Content']['Prospector'] : false;
$showRatings = 1;
$showProspectorResultsAtEndOfSearch = true;
if (isset($library)) {
$enableProspectorIntegration = $library->enablePospectorIntegration == 1;
$showRatings = $library->showRatings;
$showProspectorResultsAtEndOfSearch = $library->showProspectorResultsAtEndOfSearch == 1;
}
$interface->assign('showRatings', $showRatings);
$numProspectorTitlesToLoad = 0;
$numUnscopedTitlesToLoad = 0;
// Save the ID of this search to the session so we can return to it easily:
$_SESSION['lastSearchId'] = $searchObject->getSearchId();
// Save the URL of this search to the session so we can return to it easily:
$_SESSION['lastSearchURL'] = $searchObject->renderSearchUrl();
if (is_object($searchSource)) {
$translatedSearch = $searchSource->label;
} else {
$allSearchSources = SearchSources::getSearchSources();
示例5: getLibraryScopingId
public function getLibraryScopingId()
{
//For econtent, we need to be more specific when restricting copies
//since patrons can't use copies that are only available to other libraries.
$searchLibrary = Library::getSearchLibrary();
$searchLocation = Location::getSearchLocation();
$activeLibrary = Library::getActiveLibrary();
$activeLocation = Location::getActiveLocation();
$homeLibrary = Library::getPatronHomeLibrary();
//Load the holding label for the branch where the user is physically.
if (!is_null($homeLibrary)) {
return $homeLibrary->includeOutOfSystemExternalLinks ? -1 : $homeLibrary->libraryId;
} else {
if (!is_null($activeLocation)) {
$activeLibrary = Library::getLibraryForLocation($activeLocation->locationId);
return $activeLibrary->includeOutOfSystemExternalLinks ? -1 : $activeLibrary->libraryId;
} else {
if (isset($activeLibrary)) {
return $activeLibrary->includeOutOfSystemExternalLinks ? -1 : $activeLibrary->libraryId;
} else {
if (!is_null($searchLocation)) {
$searchLibrary = Library::getLibraryForLocation($searchLibrary->locationId);
return $searchLibrary->includeOutOfSystemExternalLinks ? -1 : $searchLocation->libraryId;
} else {
if (isset($searchLibrary)) {
return $searchLibrary->includeOutOfSystemExternalLinks ? -1 : $searchLibrary->libraryId;
} else {
return -1;
}
}
}
}
}
}
示例6: getItemsFast
public function getItemsFast()
{
global $configArray;
if ($this->fastItems == null) {
$searchLibrary = Library::getSearchLibrary();
if ($searchLibrary) {
$libraryLocationCode = $searchLibrary->ilsCode;
}
$searchLocation = Location::getSearchLocation();
if ($searchLocation) {
$homeLocationCode = $searchLocation->code;
} else {
$homeLocation = Location::getUserHomeLocation();
if ($homeLocation) {
$homeLocationCode = $homeLocation->code;
}
}
$this->fastItems = array();
if ($this->itemsFromIndex) {
$this->fastItems = array();
foreach ($this->itemsFromIndex as $itemData) {
$isLocalItem = false;
$isLibraryItem = false;
if (array_key_exists('item', $itemData)) {
$itemId = $itemData['item'][0];
$locationCode = $itemData['item'][1];
$shelfLocation = mapValue('shelf_location', $locationCode);
$sharing = $itemData['item'][3];
$source = $itemData['item'][4];
$fileOrUrl = '';
if (count($itemData['item']) > 5) {
$fileOrUrl = $itemData['item'][5];
}
if (array_key_exists('scope', $itemData)) {
$isLocalItem = $itemData['scope'][1] == 'true';
$isLibraryItem = $itemData['scope'][2] == 'true';
}
} else {
$itemId = $itemData[1];
$locationCode = $itemData[2];
$shelfLocation = mapValue('shelf_location', $itemData[2]);
$sharing = $itemData[4];
$source = $itemData[5];
$fileOrUrl = '';
if (count($itemData) > 6) {
$fileOrUrl = $itemData[6];
}
$isLocalItem = isset($libraryLocationCode) && strlen($libraryLocationCode) > 0 && strpos($locationCode, $libraryLocationCode) === 0;
$isLibraryItem = isset($homeLocationCode) && strlen($homeLocationCode) > 0 && strpos($locationCode, $homeLocationCode) === 0;
}
$actions = $this->getActionsForItem($itemId, $fileOrUrl, null);
$libraryLabelObj = new Library();
$libraryLabelObj->whereAdd("'{$locationCode}' LIKE CONCAT(ilsCode, '%') and ilsCode <> ''");
$libraryLabelObj->selectAdd();
$libraryLabelObj->selectAdd('displayName');
if ($libraryLabelObj->find(true)) {
$libraryLabel = $libraryLabelObj->displayName;
} else {
$libraryLabel = $locationCode . ' Online';
}
//TODO: Get the correct number of available copies
$totalCopies = 1;
$this->fastItems[] = array('itemId' => $itemId, 'location' => $locationCode, 'callnumber' => '', 'availability' => $this->isItemAvailable($itemId, $totalCopies), 'holdable' => $this->isEContentHoldable($locationCode, $itemData), 'inLibraryUseOnly' => false, 'isLocalItem' => $isLocalItem, 'isLibraryItem' => $isLibraryItem, 'locationLabel' => 'Online', 'libraryLabel' => $libraryLabel, 'shelfLocation' => $shelfLocation, 'source' => 'Online ' . $source, 'sharing' => $sharing, 'actions' => $actions);
}
} else {
/** @var File_MARC_Data_Field[] $itemFields */
$itemFields = $this->getMarcRecord()->getFields('989');
foreach ($itemFields as $itemField) {
$locationCode = trim($itemField->getSubfield('d') != null ? $itemField->getSubfield('d')->getData() : '');
//Each item can have multiple item fields
/** @var File_MARC_Subfield[] $eContentFields */
$eContentFields = $itemField->getSubfields('w');
$itemId = $itemField->getSubfield('1')->getData();
$iType = $itemField->getSubfield($configArray['Reindex']['iTypeSubfield'])->getData();
foreach ($eContentFields as $eContentField) {
$eContentData = trim($eContentField->getData() != null ? $eContentField->getData() : '');
if ($eContentData && strpos($eContentData, ':') > 0) {
$eContentFieldData = explode(':', $eContentData);
$source = trim($eContentFieldData[0]);
$protectionType = strtolower(trim($eContentFieldData[1]));
$totalCopies = 1;
if ($this->isValidProtectionType($protectionType)) {
if ($this->isValidForUser($locationCode, $eContentFieldData)) {
$libraryLabelObj = new Library();
$libraryLabelObj->whereAdd("'{$locationCode}' LIKE CONCAT(ilsCode, '%') and ilsCode <> ''");
$libraryLabelObj->selectAdd();
$libraryLabelObj->selectAdd('displayName');
if ($libraryLabelObj->find(true)) {
$libraryLabel = $libraryLabelObj->displayName;
} else {
$libraryLabel = $locationCode . ' Online';
}
$locationLabelObj = new Location();
$locationLabelObj->whereAdd("'{$locationCode}' LIKE CONCAT(code, '%') and code <> ''");
if ($locationLabelObj->find(true)) {
$locationLabel = $locationLabelObj->displayName;
} else {
$locationLabel = $locationCode . ' Online';
}
//Get the file or url that is related to this item.
//.........这里部分代码省略.........
示例7: process
public function process()
{
global $interface;
//Get Facet settings for processing display
$interface->assign('checkboxFilters', $this->searchObject->getCheckboxFacets());
//Get applied facets
$filterList = $this->searchObject->getFilterList(true);
foreach ($filterList as $facetKey => $facet) {
//Remove any top facets since the removal links are displayed above results
if (strpos($facet[0]['field'], 'availability_toggle') === 0) {
unset($filterList[$facetKey]);
}
}
$interface->assign('filterList', $filterList);
//Process the side facet set to handle the Added In Last facet which we only want to be
//visible if there is not a value selected for the facet (makes it single select
$sideFacets = $this->searchObject->getFacetList($this->mainFacets);
$searchLibrary = Library::getSearchLibrary();
//Do additional processing of facets for non-genealogy searches
if ($this->searchObject->getSearchType() != 'genealogy') {
foreach ($sideFacets as $facetKey => $facet) {
$facetSetting = $this->facetSettings[$facetKey];
//Do special processing of facets
if (preg_match('/time_since_added/i', $facetKey)) {
$timeSinceAddedFacet = $this->updateTimeSinceAddedFacet($facet);
$sideFacets[$facetKey] = $timeSinceAddedFacet;
} elseif ($facetKey == 'rating_facet') {
$userRatingFacet = $this->updateUserRatingsFacet($facet);
$sideFacets[$facetKey] = $userRatingFacet;
} elseif ($facetKey == 'available_at') {
//Mangle the availability facets
$oldFacetValues = $sideFacets['available_at']['list'];
ksort($oldFacetValues);
$filters = $this->searchObject->getFilterList();
//print_r($filters);
$appliedAvailability = array();
foreach ($filters as $appliedFilters) {
foreach ($appliedFilters as $filter) {
if ($filter['field'] == 'available_at') {
$appliedAvailability[$filter['value']] = $filter['removalUrl'];
}
}
}
$availableAtFacets = array();
foreach ($oldFacetValues as $facetKey2 => $facetInfo) {
if (strlen($facetKey2) > 1) {
$sortIndicator = substr($facetKey2, 0, 1);
if ($sortIndicator >= '1' && $sortIndicator <= '4') {
$availableAtFacets[$facetKey2] = $facetInfo;
}
}
}
$includeAnyLocationFacet = $this->searchObject->getFacetSetting("Availability", "includeAnyLocationFacet");
$includeAnyLocationFacet = $includeAnyLocationFacet == '' || $includeAnyLocationFacet == 'true';
if ($searchLibrary) {
$includeAnyLocationFacet = $searchLibrary->showAvailableAtAnyLocation;
}
//print_r ("includeAnyLocationFacet = $includeAnyLocationFacet");
if ($includeAnyLocationFacet) {
$anyLocationLabel = $this->searchObject->getFacetSetting("Availability", "anyLocationLabel");
//print_r ("anyLocationLabel = $anyLocationLabel");
$availableAtFacets['*'] = array('value' => '*', 'display' => $anyLocationLabel == '' ? "Any Marmot Location" : $anyLocationLabel, 'count' => $this->searchObject->getResultTotal() - (isset($oldFacetValues['']['count']) ? $oldFacetValues['']['count'] : 0), 'url' => $this->searchObject->renderLinkWithFilter('available_at:*'), 'isApplied' => array_key_exists('*', $appliedAvailability), 'removalUrl' => array_key_exists('*', $appliedAvailability) ? $appliedAvailability['*'] : null);
}
$sideFacets['available_at']['list'] = $availableAtFacets;
} else {
//Do other handling of the display
if ($facetSetting->sortMode == 'alphabetically') {
asort($sideFacets[$facetKey]['list']);
}
if ($facetSetting->numEntriesToShowByDefault > 0) {
$sideFacets[$facetKey]['valuesToShow'] = $facetSetting->numEntriesToShowByDefault;
}
if ($facetSetting->showAsDropDown) {
$sideFacets[$facetKey]['showAsDropDown'] = $facetSetting->showAsDropDown;
}
if ($facetSetting->useMoreFacetPopup && count($sideFacets[$facetKey]['list']) > 12) {
$sideFacets[$facetKey]['showMoreFacetPopup'] = true;
$facetsList = $sideFacets[$facetKey]['list'];
$sideFacets[$facetKey]['list'] = array_slice($facetsList, 0, 5);
$sortedList = array();
foreach ($facetsList as $key => $value) {
$sortedList[strtolower($key)] = $value;
}
ksort($sortedList);
$sideFacets[$facetKey]['sortedList'] = $sortedList;
} else {
$sideFacets[$facetKey]['showMoreFacetPopup'] = false;
}
}
$sideFacets[$facetKey]['collapseByDefault'] = $facetSetting->collapseByDefault;
}
}
$interface->assign('sideFacetSet', $sideFacets);
}
示例8: loadSearchInformation
function loadSearchInformation()
{
//Determine the Search Source, need to do this always.
global $searchSource;
global $library;
global $interface;
$module = isset($_GET['module']) ? $_GET['module'] : null;
$module = preg_replace('/[^\\w]/', '', $module);
$searchSource = 'global';
if (isset($_GET['searchSource'])) {
$searchSource = $_GET['searchSource'];
$_REQUEST['searchSource'] = $searchSource;
//Update request since other check for it here
$_SESSION['searchSource'] = $searchSource;
//Update the session so we can remember what the user was doing last.
} else {
if (isset($_SESSION['searchSource'])) {
//Didn't get a source, use what the user was doing last
$searchSource = $_SESSION['searchSource'];
$_REQUEST['searchSource'] = $searchSource;
} else {
//Use a default search source
if ($module == 'Person') {
$searchSource = 'genealogy';
} else {
$searchSource = 'local';
}
$_REQUEST['searchSource'] = $searchSource;
}
}
$searchLibrary = Library::getSearchLibrary(null);
$searchLocation = Location::getSearchLocation(null);
//Based on the search source, determine the search scope and set a global variable
global $solrScope;
global $scopeType;
$solrScope = false;
$scopeType = '';
if ($searchSource == 'local' || $searchSource == 'econtent') {
$locationIsScoped = $searchLocation != null && ($searchLocation->restrictSearchByLocation || $searchLocation->econtentLocationsToInclude != 'all' || $searchLocation->useScope || !$searchLocation->enableOverdriveCollection || strlen($searchLocation->extraLocationCodesToInclude) > 0);
$libraryIsScoped = $searchLibrary != null && ($searchLibrary->restrictSearchByLibrary || $searchLibrary->econtentLocationsToInclude != 'all' || strlen($searchLibrary->pTypes) > 0 && $searchLibrary->pTypes != -1 || $searchLibrary->useScope || !$searchLibrary->enableOverdriveCollection);
if ($locationIsScoped && ($searchLocation->econtentLocationsToInclude != $searchLibrary->econtentLocationsToInclude && strlen($searchLocation->econtentLocationsToInclude) > 0 && $searchLocation->econtentLocationsToInclude != 'all' || $searchLocation->useScope && $searchLibrary->scope != $searchLocation->scope)) {
$solrScope = $searchLocation->code;
$scopeType = 'Location';
} else {
$solrScope = $searchLibrary->subdomain;
$scopeType = 'Library';
}
} elseif ($searchSource != 'marmot' && $searchSource != 'global') {
$solrScope = $searchSource;
$scopeType = 'Search Source';
}
$solrScope = trim($solrScope);
if (strlen($solrScope) == 0) {
$solrScope = false;
$scopeType = 'Unscoped';
}
$searchLibrary = Library::getSearchLibrary($searchSource);
$searchLocation = Location::getSearchLocation($searchSource);
global $millenniumScope;
if ($library) {
if ($searchLibrary) {
$millenniumScope = $searchLibrary->scope;
} elseif (isset($searchLocation)) {
MillenniumDriver::$scopingLocationCode = $searchLocation->code;
} else {
$millenniumScope = isset($configArray['OPAC']['defaultScope']) ? $configArray['OPAC']['defaultScope'] : '93';
}
} else {
$millenniumScope = isset($configArray['OPAC']['defaultScope']) ? $configArray['OPAC']['defaultScope'] : '93';
}
}
示例9: launch
//.........这里部分代码省略.........
// Some more variables
// Those we can construct AFTER the search is executed, but we need
// no matter whether there were any results
$interface->assign('qtime', round($searchObject->getQuerySpeed(), 2));
$interface->assign('spellingSuggestions', $searchObject->getSpellingSuggestions());
$interface->assign('lookfor', $displayQuery);
$interface->assign('searchType', $searchObject->getSearchType());
// Will assign null for an advanced search
$interface->assign('searchIndex', $searchObject->getSearchIndex());
// We'll need recommendations no matter how many results we found:
$interface->assign('topRecommendations', $searchObject->getRecommendationsTemplates('top'));
$interface->assign('sideRecommendations', $searchObject->getRecommendationsTemplates('side'));
// 'Finish' the search... complete timers and log search history.
$searchObject->close();
$interface->assign('time', round($searchObject->getTotalSpeed(), 2));
// Show the save/unsave code on screen
// The ID won't exist until after the search has been put in the search history
// so this needs to occur after the close() on the searchObject
$interface->assign('showSaved', true);
$interface->assign('savedSearch', $searchObject->isSavedSearch());
$interface->assign('searchId', $searchObject->getSearchId());
$currentPage = isset($_REQUEST['page']) ? $_REQUEST['page'] : 1;
$interface->assign('page', $currentPage);
//Enable and disable functionality based on library settings
//This must be done before we process each result
$interface->assign('showNotInterested', false);
$interface->assign('page_body_style', 'sidebar_left');
$interface->assign('overDriveVersion', isset($configArray['OverDrive']['interfaceVersion']) ? $configArray['OverDrive']['interfaceVersion'] : 1);
//Check to see if we should show unscoped results
global $solrScope;
$enableUnscopedSearch = false;
// fallback setting
if ($solrScope) {
$searchLibrary = Library::getSearchLibrary();
if ($searchLibrary != null && $searchLibrary->showMarmotResultsAtEndOfSearch) {
if (is_object($searchSource)) {
$enableUnscopedSearch = $searchSource->catalogScoping != 'unscoped';
$unscopedSearch = clone $searchObject;
} else {
$searchSources = new SearchSources();
$searchOptions = $searchSources->getSearchSources();
if (isset($searchOptions['marmot'])) {
//TODO: change name of search option to 'consortium'
$unscopedSearch = clone $searchObject;
$enableUnscopedSearch = true;
}
}
}
}
$showRatings = 1;
$enableProspectorIntegration = isset($configArray['Content']['Prospector']) ? $configArray['Content']['Prospector'] : false;
if (isset($library)) {
$enableProspectorIntegration = $library->enablePospectorIntegration == 1;
$showRatings = $library->showRatings;
}
if ($enableProspectorIntegration) {
$interface->assign('showProspectorLink', true);
$interface->assign('prospectorSavedSearchId', $searchObject->getSearchId());
} else {
$interface->assign('showProspectorLink', false);
}
$interface->assign('showRatings', $showRatings);
$numUnscopedTitlesToLoad = 0;
// Save the ID of this search to the session so we can return to it easily:
$_SESSION['lastSearchId'] = $searchObject->getSearchId();
// Save the URL of this search to the session so we can return to it easily:
示例10: getPType
/**
* returns the patron type identifier if a patron is logged in or if the patron
* is not logged in, it will return the default PType for the library domain.
* If a domain is not in use it will return -1.
*
* @return int
*/
public function getPType()
{
if ($this->pType == null) {
/** @var $user User */
global $user;
/** @var $locationSingleton Location */
global $locationSingleton;
$searchLocation = $locationSingleton->getSearchLocation();
$searchLibrary = Library::getSearchLibrary();
if (isset($user) && $user != false) {
$patronDump = $this->_getPatronDump($this->_getBarcode());
$this->pType = $patronDump['P_TYPE'];
} else {
if (isset($searchLocation) && $searchLocation->defaultPType > 0) {
$this->pType = $searchLocation->defaultPType;
} else {
if (isset($searchLibrary) && $searchLibrary->defaultPType > 0) {
$this->pType = $searchLibrary->defaultPType;
} else {
$this->pType = -1;
}
}
}
}
return $this->pType;
}
示例11: search
//.........这里部分代码省略.........
$options['q'] = "({$handler}:{$query})";
}
}
}
} else {
// Force boolean operators to uppercase if we are in a case-insensitive
// mode:
if (!$this->caseSensitiveBooleans) {
$query = SolrUtils::capitalizeBooleans($query);
}
// Process advanced search -- if a handler was specified, let's see
// if we can adapt the search to work with the appropriate fields.
if (!empty($handler)) {
$options['q'] = $this->_buildAdvancedQuery($handler, $query);
}
}
$timer->logTime("build query");
// Limit Fields
if ($fields) {
$options['fl'] = $fields;
} else {
// This should be an explicit list
$options['fl'] = '*,score';
}
if (is_object($this->searchSource)) {
$defaultFilters = preg_split('/\\r\\n/', $this->searchSource->defaultFilter);
foreach ($defaultFilters as $tmpFilter) {
$filter[] = $tmpFilter;
}
}
//Apply automatic boosting (only to biblio and econtent queries)
if (preg_match('/.*(biblio|econtent).*/i', $this->host)) {
//unset($options['qt']); //Force the query to never use dismax handling
$searchLibrary = Library::getSearchLibrary($this->searchSource);
//Boost items owned at our location
$searchLocation = Location::getSearchLocation($this->searchSource);
$boostFactors = $this->getBoostFactors($searchLibrary, $searchLocation);
if (isset($options['qt']) && $options['qt'] == 'dismax') {
//Boost by number of holdings
if (count($boostFactors) > 0) {
$options['bf'] = "sum(" . implode(',', $boostFactors) . ")";
}
//print ($options['bq']);
} else {
$baseQuery = $options['q'];
//Boost items in our system
if (count($boostFactors) > 0) {
$boost = "sum(" . implode(',', $boostFactors) . ")";
} else {
$boost = '';
}
$options['q'] = "{!boost b={$boost}} {$baseQuery}";
//echo ("Advanced Query " . $options['q']);
}
$timer->logTime("apply boosting");
$scopingFilters = $this->getScopingFilters($searchLibrary, $searchLocation);
$timer->logTime("apply filters based on location");
} else {
//Non book search (genealogy)
$scopingFilters = array();
}
if ($filter != null && $scopingFilters != null) {
if (!is_array($filter)) {
$filter = array($filter);
}
$filters = array_merge($filter, $scopingFilters);
示例12: getItemsFast
public function getItemsFast()
{
global $timer;
if ($this->fastItems == null || isset($_REQUEST['reload'])) {
$searchLibrary = Library::getSearchLibrary();
$extraLocations = '';
if ($searchLibrary) {
$libraryLocationCode = $searchLibrary->ilsCode;
}
$searchLocation = Location::getSearchLocation();
if ($searchLocation) {
$homeLocationCode = $searchLocation->code;
$extraLocations = $searchLocation->extraLocationCodesToInclude;
}
if ($this->itemsFromIndex) {
$this->fastItems = array();
foreach ($this->itemsFromIndex as $itemData) {
$isOrderItem = false;
$onOrderCopies = 0;
$status = null;
$groupedStatus = null;
$inLibraryUseOnly = false;
$isHoldable = true;
$isLocalItem = false;
$isLibraryItem = false;
if (array_key_exists('item', $itemData)) {
//New style with item, record, and scope information separated
$shelfLocation = $itemData['item'][7];
$locationCode = $itemData['item'][1];
$callNumber = $itemData['item'][2];
if (substr($itemData['item'][0], 0, 2) == '.o') {
$isOrderItem = true;
$onOrderCopies = $itemData['item'][7];
$available = false;
$shelfLocation = mapValue('shelf_location', $itemData['item'][1]);
} else {
$status = mapValue('item_status', $itemData['item'][6]);
$groupedStatus = mapValue('item_grouped_status', $itemData['item'][6]);
$available = $itemData['item'][3] == 'true';
$inLibraryUseOnly = $itemData['item'][4] == 'true';
}
//Don't use scoping section yet because it isn't ready for prime time.
/*if (array_key_exists('scope', $itemData) && count($itemData['scope']) > 0){
$isHoldable = $itemData['scope'][0] == 'true';
$isLocalItem = $itemData['scope'][1] == 'true';
$isLibraryItem = $itemData['scope'][2] == 'true';
}*/
if (!isset($libraryLocationCode) || $libraryLocationCode == '') {
$isLibraryItem = true;
} else {
$isLibraryItem = strpos($locationCode, $libraryLocationCode) === 0;
}
$isLocalItem = isset($homeLocationCode) && strlen($homeLocationCode) > 0 && strpos($locationCode, $homeLocationCode) === 0 || $extraLocations != '' && preg_match("/^{$extraLocations}\$/i", $locationCode);
} else {
//Old style where record and item information are combined
$shelfLocation = $itemData[2];
$locationCode = $itemData[2];
if (strpos($shelfLocation, ':') === false) {
$shelfLocation = mapValue('shelf_location', $itemData[2]);
} else {
$shelfLocationParts = explode(":", $shelfLocation);
$locationCode = $shelfLocationParts[0];
$branch = mapValue('shelf_location', $locationCode);
$shelfLocationTmp = mapValue('collection', $shelfLocationParts[1]);
$shelfLocation = $branch . ' ' . $shelfLocationTmp;
}
$callNumber = $itemData[3];
if (substr($itemData[1], 0, 2) == '.o') {
$isOrderItem = true;
$onOrderCopies = $itemData[8];
$available = false;
} else {
$status = mapValue('item_status', $itemData[7]);
$groupedStatus = mapValue('item_grouped_status', $itemData[7]);
$available = $itemData[4] == 'true';
$inLibraryUseOnly = $itemData[5] == 'true';
}
if (!isset($libraryLocationCode) || $libraryLocationCode == '') {
$isLibraryItem = true;
} else {
$isLibraryItem = strpos($locationCode, $libraryLocationCode) === 0;
}
$isLocalItem = isset($homeLocationCode) && strlen($homeLocationCode) > 0 && strpos($locationCode, $homeLocationCode) === 0 || $extraLocations != '' && preg_match("/^{$extraLocations}\$/i", $locationCode);
}
//Try to trim the courier code if any
if (preg_match('/(.*?)\\sC\\d{3}\\w{0,2}$/', $shelfLocation, $locationParts)) {
$shelfLocation = $locationParts[1];
}
//Determine the structure of the item data based on if it's an order record or not.
//TODO: This needs a better way of handling things because .o will only work for Sierra/Millennium systems
if ($isOrderItem) {
$groupedStatus = "On Order";
$callNumber = "ON ORDER";
$status = "On Order";
} else {
//This is a regular (physical) item
if ($status != null) {
if ($status == 'On Shelf' && $available != true) {
$status = 'Checked Out';
$groupedStatus = "Checked Out";
//.........这里部分代码省略.........
示例13: process
public function process()
{
global $interface;
// Grab the facet set -- note that we need to take advantage of the third
// parameter to getFacetList in order to pass down row and column
// information for inclusion in the final list.
$facetList = $this->searchObject->getFacetList($this->facets, false);
foreach ($facetList as $facetSetkey => $facetSet) {
if ($facetSet['label'] == 'Category' || $facetSet['label'] == 'Format Category') {
$validCategories = array('Books', 'eBook', 'Audio Books', 'eAudio', 'Music', 'Movies');
//add an image name for display in the template
foreach ($facetSet['list'] as $facetKey => $facet) {
if (in_array($facetKey, $validCategories)) {
$facet['imageName'] = strtolower(str_replace(' ', '', $facet['value'])) . ".png";
$facet['imageNameSelected'] = strtolower(str_replace(' ', '', $facet['value'])) . "_selected.png";
$facetSet['list'][$facetKey] = $facet;
} else {
unset($facetSet['list'][$facetKey]);
}
}
uksort($facetSet['list'], "format_category_comparator");
$facetList[$facetSetkey] = $facetSet;
} elseif (preg_match('/available/i', $facetSet['label'])) {
$numSelected = 0;
foreach ($facetSet['list'] as $facetKey => $facet) {
if ($facet['isApplied']) {
$numSelected++;
}
}
//If nothing is selected, select entire collection by default
$sortedFacetList = array();
$numTitlesWithNoValue = 0;
$numTitlesWithEntireCollection = 0;
$searchLibrary = Library::getSearchLibrary(null);
$searchLocation = Location::getSearchLocation(null);
if ($searchLocation) {
$superScopeLabel = $searchLocation->availabilityToggleLabelSuperScope;
$localLabel = $searchLocation->availabilityToggleLabelLocal;
$localLabel = str_ireplace('{display name}', $searchLocation->displayName, $localLabel);
$availableLabel = $searchLocation->availabilityToggleLabelAvailable;
$availableLabel = str_ireplace('{display name}', $searchLocation->displayName, $availableLabel);
} else {
$superScopeLabel = $searchLibrary->availabilityToggleLabelSuperScope;
$localLabel = $searchLibrary->availabilityToggleLabelLocal;
$localLabel = str_ireplace('{display name}', $searchLibrary->displayName, $localLabel);
$availableLabel = $searchLibrary->availabilityToggleLabelAvailable;
$availableLabel = str_ireplace('{display name}', $searchLibrary->displayName, $availableLabel);
}
foreach ($facetSet['list'] as $facet) {
if ($facet['value'] == 'Entire Collection') {
$includeButton = true;
$facet['value'] = $localLabel;
if (trim($localLabel) == '') {
$includeButton = false;
} else {
if ($searchLocation) {
$includeButton = !$searchLocation->restrictSearchByLocation;
} elseif ($searchLibrary) {
$includeButton = !$searchLibrary->restrictSearchByLibrary;
}
}
$numTitlesWithEntireCollection = $facet['count'];
if ($includeButton) {
$sortedFacetList[1] = $facet;
}
} elseif ($facet['value'] == '') {
$facet['isApplied'] = $facet['isApplied'] || $numSelected == 0;
$facet['value'] = $superScopeLabel;
$sortedFacetList[0] = $facet;
$numTitlesWithNoValue = $facet['count'];
break;
} else {
$facet['value'] = $availableLabel;
$sortedFacetList[2] = $facet;
}
}
if (isset($sortedFacetList[0])) {
$sortedFacetList[0]['count'] = $numTitlesWithEntireCollection + $numTitlesWithNoValue;
}
ksort($sortedFacetList);
$facetSet['list'] = $sortedFacetList;
$facetList[$facetSetkey] = $facetSet;
}
}
$interface->assign('topFacetSet', $facetList);
$interface->assign('topFacetSettings', $this->baseSettings);
}
示例14: getSortOptions
/**
* Return a list of valid sort options -- overrides the base class with
* custom behavior for Author/Search screen.
*
* @access public
* @return array Sort value => description array.
*/
protected function getSortOptions()
{
// Author/Search screen
if ($this->searchType == 'author' && $this->searchSubType == 'search') {
// It's important to remember here we are talking about on-screen
// sort values, not what is sent to Solr, since this screen
// is really using facet sorting.
return array('relevance' => 'sort_author_relevance', 'author' => 'sort_author_author');
}
// Everywhere else -- use normal default behavior
$sortOptions = parent::getSortOptions();
$searchLibrary = Library::getSearchLibrary($this->searchSource);
if ($searchLibrary == null) {
unset($sortOptions['callnumber_sort']);
}
return $sortOptions;
}