当前位置: 首页>>代码示例>>PHP>>正文


PHP Location::getSearchLocation方法代码示例

本文整理汇总了PHP中Location::getSearchLocation方法的典型用法代码示例。如果您正苦于以下问题:PHP Location::getSearchLocation方法的具体用法?PHP Location::getSearchLocation怎么用?PHP Location::getSearchLocation使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Location的用法示例。


在下文中一共展示了Location::getSearchLocation方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
             }
         }
     }
 }
开发者ID:victorfcm,项目名称:VuFind-Plus,代码行数:29,代码来源:ExternalEContentDriver.php

示例2: 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;
                     }
                 }
             }
         }
     }
 }
开发者ID:bryandease,项目名称:VuFind-Plus,代码行数:34,代码来源:EContentDriver.php

示例3: getSearchLibrary

 static function getSearchLibrary($searchSource = null)
 {
     if (is_null($searchSource)) {
         global $searchSource;
         if (strpos($searchSource, 'library') === 0) {
             $trimmedSearchSource = str_replace('library', '', $searchSource);
             require_once ROOT_DIR . '/Drivers/marmot_inc/LibrarySearchSource.php';
             $librarySearchSource = new LibrarySearchSource();
             $librarySearchSource->id = $trimmedSearchSource;
             if ($librarySearchSource->find(true)) {
                 $searchSource = $librarySearchSource;
             }
         }
     }
     if (!array_key_exists($searchSource, Library::$searchLibrary)) {
         if (is_object($searchSource)) {
             $scopingSetting = $searchSource->catalogScoping;
         } else {
             $scopingSetting = $searchSource;
         }
         if ($scopingSetting == 'local' || $scopingSetting == 'econtent' || $scopingSetting == 'library' || $scopingSetting == 'location') {
             Library::$searchLibrary[$searchSource] = Library::getActiveLibrary();
         } else {
             if ($scopingSetting == 'marmot' || $scopingSetting == 'unscoped') {
                 Library::$searchLibrary[$searchSource] = null;
             } else {
                 $location = Location::getSearchLocation();
                 if (is_null($location)) {
                     //Check to see if we have a library for the subdomain
                     $library = new Library();
                     $library->subdomain = $scopingSetting;
                     $library->find();
                     if ($library->N > 0) {
                         $library->fetch();
                         return clone $library;
                     }
                     Library::$searchLibrary[$searchSource] = null;
                 } else {
                     Library::$searchLibrary[$searchSource] = self::getLibraryForLocation($location->locationId);
                 }
             }
         }
     }
     return Library::$searchLibrary[$searchSource];
 }
开发者ID:victorfcm,项目名称:VuFind-Plus,代码行数:45,代码来源:Library.php

示例4: 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.
//.........这里部分代码省略.........
开发者ID:victorfcm,项目名称:VuFind-Plus,代码行数:101,代码来源:BaseEContentDriver.php

示例5: 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';
    }
}
开发者ID:victorfcm,项目名称:VuFind-Plus,代码行数:71,代码来源:bootstrap.php

示例6: getMillenniumScope

 public function getMillenniumScope()
 {
     if (isset($_REQUEST['useUnscopedHoldingsSummary'])) {
         return $this->getDefaultScope();
     }
     $searchLibrary = Library::getSearchLibrary();
     $searchLocation = Location::getSearchLocation();
     $branchScope = '';
     //Load the holding label for the branch where the user is physically.
     if (!is_null($searchLocation)) {
         if ($searchLocation->useScope && $searchLocation->restrictSearchByLocation) {
             $branchScope = $searchLocation->scope;
         }
     }
     if (strlen($branchScope)) {
         return $branchScope;
     } else {
         if (isset($searchLibrary) && $searchLibrary->useScope && $searchLibrary->restrictSearchByLibrary) {
             return $searchLibrary->scope;
         } else {
             return $this->getDefaultScope();
         }
     }
 }
开发者ID:bryandease,项目名称:VuFind-Plus,代码行数:24,代码来源:Millennium.php

示例7: search


//.........这里部分代码省略.........
             }
         }
     } 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);
     } else {
         if ($filter == null) {
开发者ID:bryandease,项目名称:VuFind-Plus,代码行数:67,代码来源:Solr.php

示例8: 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";
//.........这里部分代码省略.........
开发者ID:victorfcm,项目名称:VuFind-Plus,代码行数:101,代码来源:MarcRecord.php

示例9: 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);
 }
开发者ID:victorfcm,项目名称:VuFind-Plus,代码行数:87,代码来源:TopFacets.php

示例10: 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;
             }
         }
     }
 }
开发者ID:victorfcm,项目名称:VuFind-Plus,代码行数:32,代码来源:RestrictedEContentDriver.php


注:本文中的Location::getSearchLocation方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。