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


PHP Library::getDefaultFacets方法代码示例

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


在下文中一共展示了Library::getDefaultFacets方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: __construct

 public function __construct($searchObject, $params)
 {
     global $library;
     global $configArray;
     // Save the basic parameters:
     $this->searchObject = $searchObject;
     // Parse the additional parameters:
     $params = explode(':', $params);
     $section = empty($params[0]) ? 'ResultsTop' : $params[0];
     $iniFile = isset($params[1]) ? $params[1] : 'facets';
     // Load the desired facet information:
     $searchLibrary = Library::getActiveLibrary();
     $searchLocation = Location::getActiveLocation();
     $config = getExtraConfigArray($iniFile);
     if ($searchObject->getSearchType() == 'genealogy') {
         $this->mainFacets = array();
     } else {
         $searchLibrary = Library::getActiveLibrary();
         $searchLocation = Location::getActiveLocation();
         $userLocation = Location::getUserHomeLocation();
         $hasSearchLibraryFacets = $searchLibrary != null && count($searchLibrary->facets) > 0;
         $hasSearchLocationFacets = $searchLocation != null && count($searchLocation->facets) > 0;
         if ($hasSearchLocationFacets) {
             $facets = $searchLocation->facets;
         } elseif ($hasSearchLibraryFacets) {
             $facets = $searchLibrary->facets;
         } else {
             $facets = Library::getDefaultFacets();
         }
         foreach ($facets as $facet) {
             if ($facet->showAboveResults == 1) {
                 $facetName = $facet->facetName;
                 if (isset($searchLibrary)) {
                     if ($facet->facetName == 'availability_toggle' && $configArray['Index']['enableDetailedAvailability']) {
                         $facetName = 'availability_toggle_' . $searchLibrary->subdomain;
                     }
                 }
                 if (isset($userLocation)) {
                     if ($facet->facetName == 'availability_toggle' && $configArray['Index']['enableDetailedAvailability']) {
                         $facetName = 'availability_toggle_' . $userLocation->code;
                     }
                 }
                 if (isset($searchLocation)) {
                     if ($facet->facetName == 'availability_toggle' && $configArray['Index']['enableDetailedAvailability']) {
                         $facetName = 'availability_toggle_' . $searchLocation->code;
                     }
                 }
                 $this->facets[$facetName] = $facet->displayName;
                 $this->facetSettings[$facetName] = $facet;
             }
         }
     }
     // Load other relevant settings:
     $this->baseSettings = array('rows' => $config['Results_Settings']['top_rows'], 'cols' => $config['Results_Settings']['top_cols']);
 }
开发者ID:bryandease,项目名称:VuFind-Plus,代码行数:55,代码来源:TopFacets.php

示例2: __construct

 public function __construct($searchObject, $params)
 {
     global $configArray;
     // Save the basic parameters:
     /** @var SearchObject_Solr|SearchObject_Base searchObject */
     $this->searchObject = $searchObject;
     // Parse the additional parameters:
     $params = explode(':', $params);
     $iniFile = isset($params[1]) ? $params[1] : 'facets';
     // Load the desired facet information:
     $config = getExtraConfigArray($iniFile);
     if ($this->searchObject->getSearchType() == 'genealogy') {
         $this->mainFacets = array();
     } else {
         $searchLibrary = Library::getActiveLibrary();
         global $locationSingleton;
         $searchLocation = $locationSingleton->getActiveLocation();
         $userLocation = Location::getUserHomeLocation();
         $hasSearchLibraryFacets = $searchLibrary != null && count($searchLibrary->facets) > 0;
         $hasSearchLocationFacets = $searchLocation != null && count($searchLocation->facets) > 0;
         if ($hasSearchLocationFacets) {
             $facets = $searchLocation->facets;
         } elseif ($hasSearchLibraryFacets) {
             $facets = $searchLibrary->facets;
         } else {
             $facets = Library::getDefaultFacets();
         }
         global $solrScope;
         foreach ($facets as $facet) {
             if ($facet->showAboveResults == 1) {
                 $facetName = $facet->facetName;
                 if ($solrScope) {
                     if ($facet->facetName == 'availability_toggle' && $configArray['Index']['enableDetailedAvailability']) {
                         $facetName = 'availability_toggle_' . $solrScope;
                     } else {
                         if ($facet->facetName == 'format_category' && $configArray['Index']['enableDetailedFormats']) {
                             $facetName = 'format_category_' . $solrScope;
                         }
                     }
                 }
                 $this->facets[$facetName] = $facet->displayName;
                 $this->facetSettings[$facetName] = $facet;
                 if (!$solrScope && $facet->facetName == 'availability_toggle') {
                     //Don't do availability toggles in the global scope.
                     //TODO: Base this off the default scope (i.e. mercury/responsive).
                     unset($this->facets[$facetName]);
                     unset($this->facetSettings[$facetName]);
                 }
             }
         }
     }
     // Load other relevant settings:
     $this->baseSettings = array('rows' => $config['Results_Settings']['top_rows'], 'cols' => $config['Results_Settings']['top_cols']);
 }
开发者ID:victorfcm,项目名称:VuFind-Plus,代码行数:54,代码来源:TopFacets.php

示例3: resetFacetsToDefault

 function resetFacetsToDefault()
 {
     $library = new Library();
     $libraryId = $_REQUEST['id'];
     $library->libraryId = $libraryId;
     if ($library->find(true)) {
         $library->clearFacets();
         $defaultFacets = Library::getDefaultFacets($libraryId);
         $library->facets = $defaultFacets;
         $library->update();
         $_REQUEST['objectAction'] = 'edit';
     }
     $structure = $this->getObjectStructure();
     header("Location: /Admin/Libraries?objectAction=edit&id=" . $libraryId);
 }
开发者ID:victorfcm,项目名称:VuFind-Plus,代码行数:15,代码来源:Libraries.php

示例4: __construct

 public function __construct($searchObject, $params)
 {
     global $configArray;
     // Save the passed-in SearchObject:
     $this->searchObject = $searchObject;
     // Parse the additional settings:
     $params = explode(':', $params);
     $mainSection = empty($params[0]) ? 'Results' : $params[0];
     $checkboxSection = isset($params[1]) ? $params[1] : false;
     $iniName = isset($params[2]) ? $params[2] : 'facets';
     if ($searchObject->getSearchType() == 'genealogy') {
         $config = getExtraConfigArray($iniName);
         $this->mainFacets = isset($config[$mainSection]) ? $config[$mainSection] : array();
     } else {
         $searchLibrary = Library::getActiveLibrary();
         global $locationSingleton;
         $searchLocation = $locationSingleton->getActiveLocation();
         $userLocation = Location::getUserHomeLocation();
         $hasSearchLibraryFacets = $searchLibrary != null && count($searchLibrary->facets) > 0;
         $hasSearchLocationFacets = $searchLocation != null && count($searchLocation->facets) > 0;
         if ($hasSearchLocationFacets) {
             $facets = $searchLocation->facets;
         } elseif ($hasSearchLibraryFacets) {
             $facets = $searchLibrary->facets;
         } else {
             $facets = Library::getDefaultFacets();
         }
         $this->facetSettings = array();
         $this->mainFacets = array();
         foreach ($facets as $facet) {
             $facetName = $facet->facetName;
             //Adjust facet name for local scoping
             if (isset($searchLibrary)) {
                 if ($facet->facetName == 'time_since_added') {
                     $facetName = 'local_time_since_added_' . $searchLibrary->subdomain;
                 } elseif ($facet->facetName == 'itype') {
                     $facetName = 'itype_' . $searchLibrary->subdomain;
                 } elseif ($facet->facetName == 'detailed_location') {
                     $facetName = 'detailed_location_' . $searchLibrary->subdomain;
                 } elseif ($facet->facetName == 'availability_toggle' && $configArray['Index']['enableDetailedAvailability']) {
                     $facetName = 'availability_toggle_' . $searchLibrary->subdomain;
                 }
             }
             if (isset($userLocation)) {
                 if ($facet->facetName == 'availability_toggle' && $configArray['Index']['enableDetailedAvailability']) {
                     $facetName = 'availability_toggle_' . $userLocation->code;
                 }
             }
             if (isset($searchLocation)) {
                 if ($facet->facetName == 'time_since_added' && $searchLocation->restrictSearchByLocation) {
                     $facetName = 'local_time_since_added_' . $searchLocation->code;
                 } elseif ($facet->facetName == 'availability_toggle' && $configArray['Index']['enableDetailedAvailability']) {
                     $facetName = 'availability_toggle_' . $searchLocation->code;
                 }
             }
             //Figure out if the facet should be included
             if ($mainSection == 'Results') {
                 if ($facet->showInResults == 1 && $facet->showAboveResults == 0) {
                     $this->facetSettings[$facetName] = $facet;
                     $this->mainFacets[$facetName] = $facet->displayName;
                 } elseif ($facet->showInAdvancedSearch == 1 && $facet->showAboveResults == 0) {
                     $this->facetSettings[$facetName] = $facet->displayName;
                 }
             } elseif ($mainSection == 'Author') {
                 if ($facet->showInAuthorResults == 1 && $facet->showAboveResults == 0) {
                     $this->facetSettings[$facetName] = $facet;
                     $this->mainFacets[$facetName] = $facet->displayName;
                 }
             }
         }
     }
     $this->checkboxFacets = $checkboxSection && isset($config[$checkboxSection]) ? $config[$checkboxSection] : array();
 }
开发者ID:bryandease,项目名称:VuFind-Plus,代码行数:73,代码来源:SideFacets.php

示例5: initAdvancedFacets

 /**
  * Initialise the object for retrieving advanced
  *   search screen facet data from inside solr.
  *
  * @access  public
  * @return  boolean
  */
 public function initAdvancedFacets()
 {
     global $configArray;
     global $locationSingleton;
     // Call the standard initialization routine in the parent:
     parent::init();
     $searchLibrary = Library::getActiveLibrary();
     $searchLocation = $locationSingleton->getActiveLocation();
     /** @var Location $userLocation */
     $userLocation = Location::getUserHomeLocation();
     $hasSearchLibraryFacets = $searchLibrary != null && count($searchLibrary->facets) > 0;
     $hasSearchLocationFacets = $searchLocation != null && count($searchLocation->facets) > 0;
     if ($hasSearchLocationFacets) {
         $facets = $searchLocation->facets;
     } elseif ($hasSearchLibraryFacets) {
         $facets = $searchLibrary->facets;
     } else {
         $facets = Library::getDefaultFacets();
     }
     $this->facetConfig = array();
     foreach ($facets as $facet) {
         $facetName = $facet->facetName;
         //Adjust facet name for local scoping
         if (isset($searchLibrary)) {
             if ($facet->facetName == 'time_since_added') {
                 $facetName = 'local_time_since_added_' . $searchLibrary->subdomain;
             } elseif ($facet->facetName == 'itype') {
                 $facetName = 'itype_' . $searchLibrary->subdomain;
             } elseif ($facet->facetName == 'detailed_location') {
                 $facetName = 'detailed_location_' . $searchLibrary->subdomain;
             } elseif ($facet->facetName == 'availability_toggle' && $configArray['Index']['enableDetailedAvailability']) {
                 $facetName = 'availability_toggle_' . $searchLibrary->subdomain;
             }
         }
         if (isset($userLocation)) {
             if ($facet->facetName == 'availability_toggle' && $configArray['Index']['enableDetailedAvailability']) {
                 $facetName = 'availability_toggle_' . $userLocation->code;
             }
         }
         if (isset($searchLocation)) {
             if ($facet->facetName == 'time_since_added' && $searchLocation->restrictSearchByLocation) {
                 $facetName = 'local_time_since_added_' . $searchLocation->code;
             } elseif ($facet->facetName == 'availability_toggle' && $configArray['Index']['enableDetailedAvailability']) {
                 $facetName = 'availability_toggle_' . $searchLocation->code;
             }
         }
         if ($facet->showInAdvancedSearch) {
             $this->facetConfig[$facetName] = $facet->displayName;
         }
     }
     //********************
     $facetLimit = $this->getFacetSetting('Advanced_Settings', 'facet_limit');
     if (is_numeric($facetLimit)) {
         $this->facetLimit = $facetLimit;
     }
     // Spellcheck is not needed for facet data!
     $this->spellcheck = false;
     //********************
     // Basic Search logic
     $this->searchTerms[] = array('index' => $this->defaultIndex, 'lookfor' => "");
     return true;
 }
开发者ID:bryandease,项目名称:VuFind-Plus,代码行数:69,代码来源:Solr.php


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