| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667 |
- <?php
- namespace Opentalent\OtStats\Controller;
- use Opentalent\OtStats\Settings\StatsSettingsRepository;
- use Opentalent\OtCore\Page\OtPageRepository;
- use TYPO3\CMS\Core\Utility\GeneralUtility;
- use TYPO3\CMS\Extbase\Mvc\Controller\ActionController;
- /**
- * Controller for the OtStats backend submodule
- *
- * @author olivier.massot
- */
- class OtStatsController extends ActionController {
- /**
- * Index action (default action)
- * Displays the customizer page on the backend
- */
- public function indexAction() {
- // Get the selected page uid
- $pageId = (int) GeneralUtility::_GP('id');
- // Get the root page of the site
- $otPageRepository = GeneralUtility::makeInstance(OtPageRepository::class);
- $rootPage = $otPageRepository->getRootPageFor($pageId);
- $rootPageUid = (int)($rootPage['uid'] ?? 0);
- // If the current page is not a root page or a subpage of one, abort
- $pageSelected = ($rootPageUid !== null);
- $this->view->assign('pageSelected', (int)$pageSelected);
- if (!$pageSelected) {
- return;
- }
- $this->view->assign('rootPage', $rootPageUid);
- $statsSettingsRepository = GeneralUtility::makeInstance(StatsSettingsRepository::class);
- $matomoId = $statsSettingsRepository->getMatomoSiteId($rootPageUid);
- $statsActivated = ($matomoId !== null);
- $this->view->assign('statsActivated', (int)$statsActivated);
- if (!$statsActivated) {
- return;
- }
- $this->view->assign('matomoSiteId', (int)$matomoId);
- }
- /**
- * Creates a matomo site record if none exists and
- * save its id
- */
- public function enableStatsAction() {
- }
- /**
- * Disable the stats monitoring
- */
- public function disableStatsAction() {
- }
- }
|