|
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 Psr\Http\Message\ResponseInterface; |
|
15
|
|
|
use TYPO3\CMS\Extbase\Utility\LocalizationUtility; |
|
16
|
|
|
|
|
17
|
|
|
/** |
|
18
|
|
|
* Controller class for the plugin 'Statistics'. |
|
19
|
|
|
* |
|
20
|
|
|
* @package TYPO3 |
|
21
|
|
|
* @subpackage dlf |
|
22
|
|
|
* |
|
23
|
|
|
* @access public |
|
24
|
|
|
*/ |
|
25
|
|
|
class StatisticsController extends AbstractController |
|
26
|
|
|
{ |
|
27
|
|
|
/** |
|
28
|
|
|
* The main method of the plugin |
|
29
|
|
|
* |
|
30
|
|
|
* @access public |
|
31
|
|
|
* |
|
32
|
|
|
* @return ResponseInterface the response |
|
33
|
|
|
*/ |
|
34
|
|
|
public function mainAction(): ResponseInterface |
|
35
|
|
|
{ |
|
36
|
|
|
$foundNumbers = $this->documentRepository->getStatisticsForSelectedCollection($this->settings); |
|
37
|
|
|
|
|
38
|
|
|
// Set replacements. |
|
39
|
|
|
$args['###TITLES###'] = $foundNumbers['titles'] . ' ' . htmlspecialchars( |
|
40
|
|
|
LocalizationUtility::translate( |
|
|
|
|
|
|
41
|
|
|
($foundNumbers['titles'] > 1 ? 'titles' : 'title'), 'dlf' |
|
42
|
|
|
) |
|
43
|
|
|
); |
|
44
|
|
|
|
|
45
|
|
|
$args['###VOLUMES###'] = $foundNumbers['volumes'] . ' ' . htmlspecialchars( |
|
46
|
|
|
LocalizationUtility::translate( |
|
47
|
|
|
($foundNumbers['volumes'] > 1 ? 'volumes' : 'volume'), 'dlf' |
|
48
|
|
|
) |
|
49
|
|
|
); |
|
50
|
|
|
|
|
51
|
|
|
// Apply replacements. |
|
52
|
|
|
$content = $this->settings['description']; |
|
53
|
|
|
foreach ($args as $key => $value) { |
|
54
|
|
|
$content = str_replace($key, $value, $content); |
|
55
|
|
|
} |
|
56
|
|
|
|
|
57
|
|
|
$this->view->assign('content', $content); |
|
58
|
|
|
|
|
59
|
|
|
return $this->htmlResponse(); |
|
60
|
|
|
} |
|
61
|
|
|
} |
|
62
|
|
|
|