BackendController::indexAction()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 19
Code Lines 13

Duplication

Lines 0
Ratio 0 %

Importance

Changes 12
Bugs 1 Features 0
Metric Value
dl 0
loc 19
rs 9.4285
c 12
b 1
f 0
cc 2
eloc 13
nc 2
nop 0
1
<?php
2
3
/**
4
 * Class BackendController
5
 */
6
7
namespace HDNET\OnpageIntegration\Controller;
8
9
use HDNET\OnpageIntegration\Exception\UnavailableAccessDataException;
10
use HDNET\OnpageIntegration\Utility\TitleUtility;
11
use TYPO3\CMS\Core\Cache\CacheManager;
12
use TYPO3\CMS\Core\Utility\GeneralUtility;
13
use TYPO3\CMS\Extbase\Mvc\Controller\ActionController;
14
15
/**
16
 * Class BackendController
17
 */
18
class BackendController extends ActionController
19
{
20
21
    /**
22
     * @var \HDNET\OnpageIntegration\Loader\ApiResultLoader
23
     * @inject
24
     */
25
    protected $loader;
26
27
    /**
28
     * @var \HDNET\OnpageIntegration\Provider\MetaDataProvider
29
     * @inject
30
     */
31
    protected $metaDataProvider;
32
33
    /**
34
     * @var \HDNET\OnpageIntegration\Domain\Repository\ConfigurationRepository
35
     * @inject
36
     */
37
    protected $configurationRepository;
38
39
    /**
40
     * @var \HDNET\OnpageIntegration\Service\OnPageService
41
     * @inject
42
     */
43
    protected $onpPageService;
44
45
    /**
46
     * Load all filter options and show them on the index page
47
     */
48
    public function indexAction()
49
    {
50
        /** @var CacheManager $cacheManager */
51
        $cacheManager = GeneralUtility::makeInstance(CacheManager::class);
52
        $cache = $cacheManager->getCache('onpage_extension');
53
54
        try {
55
            $this->view->assignMultiple([
56
                'lastCrawl'         => $this->loader->load('zoom_lastcrawl'),
57
                'lastCrawlDate'     => $cache->get('lastCrawlDate'),
58
                'seoMetaData'       => $this->metaDataProvider->getMetaData('seoaspects'),
59
                'contentMetaData'   => $this->metaDataProvider->getMetaData('contentaspects'),
60
                'technicalMetaData' => $this->metaDataProvider->getMetaData('technicalaspects'),
61
                'moduleName'        => 'Zoom Module'
62
            ]);
63
        } catch (UnavailableAccessDataException $e) {
64
            return "Bitte tragen Sie Ihre Zugangsdaten ein.";
65
        }
66
    }
67
68
    /**
69
     * Show the details of an api call
70
     *
71
     * @param string $section
72
     * @param string $call
73
     */
74
    public function detailAction($section, $call)
75
    {
76
        $metaDataResult = $this->metaDataProvider->getMetaData($section);
77
78
        $showTableKey = $metaDataResult[$call]['show'];
79
        // todo fix
80
        if (!$showTableKey) {
81
            $showTableKey = [];
82
        }
83
84
        $apiCallTable = 'zoom_' . $section . '_' . $call . '_table';
85
        $this->view->assignMultiple([
86
            'moduleCategory' => $metaDataResult[$call]['description'],
87
            'table'      => $this->onpPageService->showColumns($apiCallTable, $showTableKey),
88
        ]);
89
    }
90
91
    /**
92
     * Empty Keyword Page
93
     */
94
    public function keywordAction()
95
    {
96
        $this->view->assignMultiple([
97
            'moduleName' => 'Keyword'
98
        ]);
99
    }
100
}
101