Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
0.00% |
0 / 23 |
|
0.00% |
0 / 3 |
CRAP | |
0.00% |
0 / 1 |
Options | |
0.00% |
0 / 23 |
|
0.00% |
0 / 3 |
210 | |
0.00% |
0 / 1 |
__construct | |
0.00% |
0 / 21 |
|
0.00% |
0 / 1 |
156 | |||
getSearchAction | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
getAdvancedSearchAction | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 |
1 | <?php |
2 | |
3 | /** |
4 | * WorldCat Search Options |
5 | * |
6 | * PHP version 8 |
7 | * |
8 | * Copyright (C) Villanova University 2011. |
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_WorldCat |
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 Page |
28 | */ |
29 | |
30 | namespace VuFind\Search\WorldCat; |
31 | |
32 | use function count; |
33 | |
34 | /** |
35 | * WorldCat Search Options |
36 | * |
37 | * @category VuFind |
38 | * @package Search_WorldCat |
39 | * @author Demian Katz <demian.katz@villanova.edu> |
40 | * @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License |
41 | * @link https://vufind.org Main Page |
42 | */ |
43 | class Options extends \VuFind\Search\Base\Options |
44 | { |
45 | /** |
46 | * Constructor |
47 | * |
48 | * @param \VuFind\Config\PluginManager $configLoader Config loader |
49 | */ |
50 | public function __construct(\VuFind\Config\PluginManager $configLoader) |
51 | { |
52 | parent::__construct($configLoader); |
53 | $this->searchIni = $this->facetsIni = 'WorldCat'; |
54 | |
55 | // Load the configuration file: |
56 | $searchSettings = $configLoader->get($this->searchIni); |
57 | |
58 | // Search handler setup: |
59 | $this->defaultHandler = 'srw.kw'; |
60 | if (isset($searchSettings->Basic_Searches)) { |
61 | foreach ($searchSettings->Basic_Searches as $key => $value) { |
62 | $this->basicHandlers[$key] = $value; |
63 | } |
64 | } |
65 | if (isset($searchSettings->Advanced_Searches)) { |
66 | foreach ($searchSettings->Advanced_Searches as $key => $value) { |
67 | $this->advancedHandlers[$key] = $value; |
68 | } |
69 | } |
70 | |
71 | // Load sort preferences: |
72 | if (isset($searchSettings->Sorting)) { |
73 | foreach ($searchSettings->Sorting as $key => $value) { |
74 | $this->sortOptions[$key] = $value; |
75 | } |
76 | } |
77 | if (isset($searchSettings->General->default_sort)) { |
78 | $this->defaultSort = $searchSettings->General->default_sort; |
79 | } |
80 | if ( |
81 | isset($searchSettings->DefaultSortingByType) |
82 | && count($searchSettings->DefaultSortingByType) > 0 |
83 | ) { |
84 | foreach ($searchSettings->DefaultSortingByType as $key => $val) { |
85 | $this->defaultSortByHandler[$key] = $val; |
86 | } |
87 | } |
88 | // Load list view for result (controls AJAX embedding vs. linking) |
89 | if (isset($searchSettings->List->view)) { |
90 | $this->listviewOption = $searchSettings->List->view; |
91 | } |
92 | } |
93 | |
94 | /** |
95 | * Return the route name for the search results action. |
96 | * |
97 | * @return string |
98 | */ |
99 | public function getSearchAction() |
100 | { |
101 | return 'worldcat-search'; |
102 | } |
103 | |
104 | /** |
105 | * Return the route name of the action used for performing advanced searches. |
106 | * Returns false if the feature is not supported. |
107 | * |
108 | * @return string|bool |
109 | */ |
110 | public function getAdvancedSearchAction() |
111 | { |
112 | return 'worldcat-advanced'; |
113 | } |
114 | } |