1
|
|
|
<?php |
2
|
|
|
namespace ApacheSolrForTypo3\Solr\Report; |
3
|
|
|
|
4
|
|
|
/*************************************************************** |
5
|
|
|
* Copyright notice |
6
|
|
|
* |
7
|
|
|
* (c) 2017 Timo Hund <[email protected]> |
8
|
|
|
* All rights reserved |
9
|
|
|
* |
10
|
|
|
* This script is part of the TYPO3 project. The TYPO3 project is |
11
|
|
|
* free software; you can redistribute it and/or modify |
12
|
|
|
* it under the terms of the GNU General Public License as published by |
13
|
|
|
* the Free Software Foundation; either version 2 of the License, or |
14
|
|
|
* (at your option) any later version. |
15
|
|
|
* |
16
|
|
|
* The GNU General Public License can be found at |
17
|
|
|
* http://www.gnu.org/copyleft/gpl.html. |
18
|
|
|
* |
19
|
|
|
* This script is distributed in the hope that it will be useful, |
20
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
21
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
22
|
|
|
* GNU General Public License for more details. |
23
|
|
|
* |
24
|
|
|
* This copyright notice MUST APPEAR in all copies of the script! |
25
|
|
|
***************************************************************/ |
26
|
|
|
|
27
|
|
|
use TYPO3\CMS\Fluid\View\StandaloneView; |
28
|
|
|
use TYPO3\CMS\Core\Utility\GeneralUtility; |
29
|
|
|
use TYPO3\CMS\Reports\StatusProviderInterface; |
30
|
|
|
|
31
|
|
|
/** |
32
|
|
|
* Provides shared functionality for all Solr reports. |
33
|
|
|
* |
34
|
|
|
* @author Timo Hund <[email protected]> |
35
|
|
|
*/ |
36
|
|
|
abstract class AbstractSolrStatus implements StatusProviderInterface |
37
|
|
|
{ |
38
|
|
|
/** |
39
|
|
|
* Assigns variables to the fluid StandaloneView and renders the view. |
40
|
|
|
* |
41
|
|
|
* @param string $templateFilename |
42
|
|
|
* @param array $variables |
43
|
|
|
* @return string |
44
|
|
|
*/ |
45
|
5 |
|
protected function getRenderedReport($templateFilename = '', $variables = []) |
46
|
|
|
{ |
47
|
5 |
|
$templatePath = 'EXT:solr/Resources/Private/Templates/Backend/Reports/' . $templateFilename; |
48
|
5 |
|
$standaloneView = $this->getFluidStandaloneViewWithTemplate($templatePath); |
49
|
5 |
|
$standaloneView->assignMultiple($variables); |
50
|
|
|
|
51
|
5 |
|
return $standaloneView->render(); |
52
|
|
|
} |
53
|
|
|
|
54
|
|
|
/** |
55
|
|
|
* Initializes a StandaloneView with a template and returns it. |
56
|
|
|
* |
57
|
|
|
* @param string $templatePath |
58
|
|
|
* @return StandaloneView |
59
|
|
|
*/ |
60
|
5 |
|
private function getFluidStandaloneViewWithTemplate($templatePath = '') |
61
|
|
|
{ |
62
|
5 |
|
$standaloneView = GeneralUtility::makeInstance(StandaloneView::class); |
63
|
5 |
|
$standaloneView->setTemplatePathAndFilename(GeneralUtility::getFileAbsFileName($templatePath)); |
64
|
|
|
|
65
|
5 |
|
return $standaloneView; |
66
|
|
|
} |
67
|
|
|
|
68
|
|
|
/** |
69
|
|
|
* Returns the status of an extension or (sub)system |
70
|
|
|
* |
71
|
|
|
* @return array An array of \TYPO3\CMS\Reports\Status objects |
72
|
|
|
*/ |
73
|
|
|
abstract public function getStatus(); |
74
|
|
|
} |
75
|
|
|
|