1
|
|
|
<?php |
2
|
|
|
/** |
3
|
|
|
* (c) Kitodo. Key to digital objects e.V. <[email protected]> |
4
|
|
|
* |
5
|
|
|
* This file is part of the Kitodo and TYPO3 projects. |
6
|
|
|
* |
7
|
|
|
* @license GNU General Public License version 3 or later. |
8
|
|
|
* For the full copyright and license information, please read the |
9
|
|
|
* LICENSE.txt file that was distributed with this source code. |
10
|
|
|
*/ |
11
|
|
|
|
12
|
|
|
namespace Kitodo\Dlf\Controller; |
13
|
|
|
|
14
|
|
|
use Kitodo\Dlf\Domain\Model\Metadata; |
15
|
|
|
use TYPO3\CMS\Core\Utility\GeneralUtility; |
16
|
|
|
use Kitodo\Dlf\Domain\Repository\MetadataRepository; |
17
|
|
|
|
18
|
|
|
/** |
19
|
|
|
* Plugin 'List View' for the 'dlf' extension |
20
|
|
|
* |
21
|
|
|
* @author Sebastian Meyer <[email protected]> |
22
|
|
|
* @author Henrik Lochmann <[email protected]> |
23
|
|
|
* @author Frank Ulrich Weber <[email protected]> |
24
|
|
|
* @package TYPO3 |
25
|
|
|
* @subpackage dlf |
26
|
|
|
* @access public |
27
|
|
|
*/ |
28
|
|
|
class ListViewController extends AbstractController |
29
|
|
|
{ |
30
|
|
|
|
31
|
|
|
/** |
32
|
|
|
* @var MetadataRepository |
33
|
|
|
*/ |
34
|
|
|
protected $metadataRepository; |
35
|
|
|
|
36
|
|
|
/** |
37
|
|
|
* @param MetadataRepository $metadataRepository |
38
|
|
|
*/ |
39
|
|
|
public function injectMetadataRepository(MetadataRepository $metadataRepository) |
40
|
|
|
{ |
41
|
|
|
$this->metadataRepository = $metadataRepository; |
42
|
|
|
} |
43
|
|
|
|
44
|
|
|
/** |
45
|
|
|
* The main method of the plugin |
46
|
|
|
* |
47
|
|
|
* @return void |
48
|
|
|
*/ |
49
|
|
|
public function mainAction() |
50
|
|
|
{ |
51
|
|
|
$searchRequestData = GeneralUtility::_GPmerged('tx_dlf_search'); |
52
|
|
|
|
53
|
|
|
$searchParams = $searchRequestData['searchParameter']; |
54
|
|
|
$widgetPage = $searchRequestData['widgetPage']; |
55
|
|
|
// solrcore is configured in search plugin and must be passed by parameter |
56
|
|
|
$this->settings['solrcore'] = $searchRequestData['solrcore']; |
57
|
|
|
|
58
|
|
|
// get all sortable metadata records |
59
|
|
|
$sortableMetadata = $this->metadataRepository->findByIsSortable(true); |
|
|
|
|
60
|
|
|
|
61
|
|
|
// get all metadata records to be shown in results |
62
|
|
|
$listedMetadata = $this->metadataRepository->findByIsListed(true); |
|
|
|
|
63
|
|
|
|
64
|
|
|
if (is_array($searchParams) && !empty($searchParams)) { |
65
|
|
|
$solrResults = $this->documentRepository->findSolrByCollection('', $this->settings, $searchParams, $listedMetadata); |
|
|
|
|
66
|
|
|
} |
67
|
|
|
|
68
|
|
|
$documents = $solrResults['documents'] ? : []; |
|
|
|
|
69
|
|
|
//$this->view->assign('metadata', $sortableMetadata); |
70
|
|
|
$this->view->assign('documents', $documents); |
71
|
|
|
$this->view->assign('widgetPage', $widgetPage); |
72
|
|
|
$this->view->assign('lastSearch', $searchParams); |
73
|
|
|
|
74
|
|
|
$this->view->assign('listedMetadata', $listedMetadata); |
75
|
|
|
$this->view->assign('sortableMetadata', $sortableMetadata); |
76
|
|
|
} |
77
|
|
|
} |
78
|
|
|
|