|
|
@@ -5,8 +5,10 @@ namespace Opentalent\OtStats\Controller;
|
|
|
use Opentalent\OtCore\Controller\SelectedSiteController;
|
|
|
use Opentalent\OtCore\Logging\OtLogger;
|
|
|
use Opentalent\OtStats\Domain\Repository\MatomoWebsiteRepository;
|
|
|
+use Psr\Http\Message\ResponseInterface;
|
|
|
use TYPO3\CMS\Core\Messaging\AbstractMessage;
|
|
|
use TYPO3\CMS\Core\Utility\GeneralUtility;
|
|
|
+use TYPO3\CMS\Extbase\Http\ForwardResponse;
|
|
|
use TYPO3\CMS\Extbase\Mvc\Exception\StopActionException;
|
|
|
use TYPO3\CMS\Extbase\Object\ObjectManager;
|
|
|
|
|
|
@@ -26,10 +28,10 @@ class OtStatsController extends SelectedSiteController {
|
|
|
* Index action (default action)
|
|
|
* Displays the customizer page on the backend
|
|
|
*/
|
|
|
- public function indexAction() {
|
|
|
+ public function indexAction(): ResponseInterface {
|
|
|
$matomoId = $this->currentWebsite['matomo_site_id'];
|
|
|
if ($matomoId == null) {
|
|
|
- $this->forward('askForActivationConfirmation');
|
|
|
+ return new ForwardResponse('askForActivationConfirmation');
|
|
|
}
|
|
|
$this->view->assign('matomoSiteId', (int)$matomoId);
|
|
|
$this->view->assign('matomoToken', self::MATOMO_TOKEN);
|
|
|
@@ -38,26 +40,29 @@ class OtStatsController extends SelectedSiteController {
|
|
|
// Default interval
|
|
|
$period = $args['period'] ?? 'month';
|
|
|
$this->view->assign('period', $period);
|
|
|
-
|
|
|
+ return $this->htmlResponse();
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* Display a confirmation page before enabling the stats module
|
|
|
*/
|
|
|
- public function askForActivationConfirmationAction() {}
|
|
|
+ public function askForActivationConfirmationAction(): ResponseInterface {
|
|
|
+ return $this->htmlResponse();
|
|
|
+ }
|
|
|
|
|
|
/**
|
|
|
* Display a confirmation page before disabling the stats module
|
|
|
*/
|
|
|
- public function askForDeactivationConfirmationAction() {
|
|
|
+ public function askForDeactivationConfirmationAction(): ResponseInterface {
|
|
|
$this->view->assign('rootUid', $this->currentRootUid);
|
|
|
+ return $this->htmlResponse();
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* Creates a matomo site record if none exists and
|
|
|
* save its id
|
|
|
*/
|
|
|
- public function enableStatsAction() {
|
|
|
+ public function enableStatsAction(): ResponseInterface {
|
|
|
$matomoRepository = GeneralUtility::makeInstance(ObjectManager::class)->get(MatomoWebsiteRepository::class);
|
|
|
|
|
|
try {
|
|
|
@@ -72,9 +77,9 @@ class OtStatsController extends SelectedSiteController {
|
|
|
'',
|
|
|
AbstractMessage::ERROR
|
|
|
);
|
|
|
- $this->forward('askForActivationConfirmation');
|
|
|
+ return new ForwardResponse('askForActivationConfirmation');
|
|
|
}
|
|
|
- $this->forward('index');
|
|
|
+ return new ForwardResponse('index');
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
@@ -85,7 +90,7 @@ class OtStatsController extends SelectedSiteController {
|
|
|
* confirmation page.
|
|
|
* @throws StopActionException
|
|
|
*/
|
|
|
- public function disableStatsAction(int $rootUid) {
|
|
|
+ public function disableStatsAction(int $rootUid): ResponseInterface {
|
|
|
|
|
|
$matomoRepository = GeneralUtility::makeInstance(ObjectManager::class)->get(MatomoWebsiteRepository::class);
|
|
|
|
|
|
@@ -101,6 +106,6 @@ class OtStatsController extends SelectedSiteController {
|
|
|
AbstractMessage::ERROR
|
|
|
);
|
|
|
}
|
|
|
- $this->forward('askForActivationConfirmation');
|
|
|
+ return new ForwardResponse('askForActivationConfirmation');
|
|
|
}
|
|
|
}
|