Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
0.00% |
0 / 21 |
|
0.00% |
0 / 4 |
CRAP | |
0.00% |
0 / 1 |
Options | |
0.00% |
0 / 21 |
|
0.00% |
0 / 4 |
110 | |
0.00% |
0 / 1 |
__construct | |
0.00% |
0 / 18 |
|
0.00% |
0 / 1 |
42 | |||
getAdvancedSearchAction | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
6 | |||
getSearchAction | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
getRecommendationSettings | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 |
1 | <?php |
2 | |
3 | /** |
4 | * Tags aspect of the Search Multi-class (Options) |
5 | * |
6 | * PHP version 8 |
7 | * |
8 | * Copyright (C) Villanova University 2010. |
9 | * |
10 | * This program is free software; you can redistribute it and/or modify |
11 | * it under the terms of the GNU General Public License version 2, |
12 | * as published by the Free Software Foundation. |
13 | * |
14 | * This program is distributed in the hope that it will be useful, |
15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
17 | * GNU General Public License for more details. |
18 | * |
19 | * You should have received a copy of the GNU General Public License |
20 | * along with this program; if not, write to the Free Software |
21 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
22 | * |
23 | * @category VuFind |
24 | * @package Search_Tags |
25 | * @author Demian Katz <demian.katz@villanova.edu> |
26 | * @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License |
27 | * @link https://vufind.org Main Site |
28 | */ |
29 | |
30 | namespace VuFind\Search\Tags; |
31 | |
32 | /** |
33 | * Search Tags Options |
34 | * |
35 | * @category VuFind |
36 | * @package Search_Tags |
37 | * @author Demian Katz <demian.katz@villanova.edu> |
38 | * @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License |
39 | * @link https://vufind.org Main Site |
40 | */ |
41 | class Options extends \VuFind\Search\Base\Options |
42 | { |
43 | /** |
44 | * Should we load Solr search options for a more integrated search experience |
45 | * or omit them to prevent confusion in multi-backend environments? |
46 | * |
47 | * @var bool |
48 | */ |
49 | protected $useSolrSearchOptions = false; |
50 | |
51 | /** |
52 | * Constructor |
53 | * |
54 | * @param \VuFind\Config\PluginManager $configLoader Config loader |
55 | */ |
56 | public function __construct(\VuFind\Config\PluginManager $configLoader) |
57 | { |
58 | parent::__construct($configLoader); |
59 | $config = $configLoader->get($this->mainIni); |
60 | if ( |
61 | isset($config->Social->show_solr_options_in_tag_search) |
62 | && $config->Social->show_solr_options_in_tag_search |
63 | ) { |
64 | $this->useSolrSearchOptions = true; |
65 | } |
66 | $searchSettings = $this->useSolrSearchOptions |
67 | ? $configLoader->get($this->searchIni) : null; |
68 | if (isset($searchSettings->Basic_Searches)) { |
69 | foreach ($searchSettings->Basic_Searches as $key => $value) { |
70 | $this->basicHandlers[$key] = $value; |
71 | } |
72 | } else { |
73 | $this->basicHandlers = ['tag' => 'Tag']; |
74 | } |
75 | $this->defaultHandler = 'tag'; |
76 | $this->defaultSort = 'title'; |
77 | $this->sortOptions = [ |
78 | 'title' => 'sort_title', 'author' => 'sort_author', |
79 | 'year DESC' => 'sort_year', 'year' => 'sort_year asc', |
80 | ]; |
81 | // Load autocomplete preferences: |
82 | $this->configureAutocomplete($searchSettings); |
83 | } |
84 | |
85 | /** |
86 | * Return the route name of the action used for performing advanced searches. |
87 | * Returns false if the feature is not supported. |
88 | * |
89 | * @return string|bool |
90 | */ |
91 | public function getAdvancedSearchAction() |
92 | { |
93 | return $this->useSolrSearchOptions ? 'search-advanced' : null; |
94 | } |
95 | |
96 | /** |
97 | * Return the route name for the search results action. |
98 | * |
99 | * @return string |
100 | */ |
101 | public function getSearchAction() |
102 | { |
103 | return 'search-results'; |
104 | } |
105 | |
106 | /** |
107 | * Load all recommendation settings from the relevant ini file. Returns an |
108 | * associative array where the key is the location of the recommendations (top |
109 | * or side) and the value is the settings found in the file (which may be either |
110 | * a single string or an array of strings). |
111 | * |
112 | * @param string $handler Name of handler for which to load specific settings. |
113 | * |
114 | * @return array associative: location (top/side/etc.) => search settings |
115 | */ |
116 | public function getRecommendationSettings($handler = null) |
117 | { |
118 | // No recommendation modules in tag view currently: |
119 | return []; |
120 | } |
121 | } |