Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
0.00% |
0 / 14 |
|
0.00% |
0 / 5 |
CRAP | |
0.00% |
0 / 1 |
AuthorController | |
0.00% |
0 / 14 |
|
0.00% |
0 / 5 |
42 | |
0.00% |
0 / 1 |
facetListAction | |
0.00% |
0 / 2 |
|
0.00% |
0 / 1 |
2 | |||
resultsAction | |
0.00% |
0 / 3 |
|
0.00% |
0 / 1 |
2 | |||
searchAction | |
0.00% |
0 / 4 |
|
0.00% |
0 / 1 |
2 | |||
homeAction | |
0.00% |
0 / 3 |
|
0.00% |
0 / 1 |
6 | |||
resultScrollerActive | |
0.00% |
0 / 2 |
|
0.00% |
0 / 1 |
2 |
1 | <?php |
2 | |
3 | /** |
4 | * Author Search Controller |
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 Controller |
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\Controller; |
31 | |
32 | /** |
33 | * Author Search Options |
34 | * |
35 | * @category VuFind |
36 | * @package Controller |
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 AuthorController extends AbstractSearch |
42 | { |
43 | /** |
44 | * Returns a list of all items associated with one facet for the lightbox |
45 | * |
46 | * Parameters: |
47 | * facet The facet to retrieve |
48 | * searchParams Facet search params from $results->getUrlQuery()->getParams() |
49 | * |
50 | * @return mixed |
51 | */ |
52 | public function facetListAction() |
53 | { |
54 | $this->searchClassId = 'SolrAuthor'; |
55 | return parent::facetListAction(); |
56 | } |
57 | |
58 | /** |
59 | * Sets the configuration for displaying author results |
60 | * |
61 | * @return mixed |
62 | */ |
63 | public function resultsAction() |
64 | { |
65 | $this->searchClassId = 'SolrAuthor'; |
66 | |
67 | // Save author searches if next_prev_navigation is enabled - otherwise |
68 | // there are wacky results when trying to page through results (the |
69 | // next/prev links only appear for records which were included in the |
70 | // results for the previous keyword search, and the next/prev links will |
71 | // iterate you through that search). |
72 | $this->saveToHistory = $this->resultScrollerActive(); |
73 | |
74 | return parent::resultsAction(); |
75 | } |
76 | |
77 | /** |
78 | * Sets the configuration for performing an author search |
79 | * |
80 | * @return mixed |
81 | */ |
82 | public function searchAction() |
83 | { |
84 | $this->searchClassId = 'SolrAuthorFacets'; |
85 | $this->saveToHistory = false; |
86 | $this->rememberSearch = false; |
87 | return parent::resultsAction(); |
88 | } |
89 | |
90 | /** |
91 | * Displays the proper page for a search action |
92 | * |
93 | * @return mixed |
94 | */ |
95 | public function homeAction() |
96 | { |
97 | // If an author was requested, forward to the results page; otherwise, |
98 | // display the search form: |
99 | $author = $this->params()->fromQuery('author'); |
100 | return !empty($author) |
101 | ? $this->forwardTo('Author', 'Results') : parent::homeAction(); |
102 | } |
103 | |
104 | /** |
105 | * Is the result scroller active? |
106 | * |
107 | * @return bool |
108 | */ |
109 | protected function resultScrollerActive() |
110 | { |
111 | $config = $this->getService(\VuFind\Config\PluginManager::class)->get('config'); |
112 | return $config->Record->next_prev_navigation ?? false; |
113 | } |
114 | } |