2019-07-18 13:44:19 +02:00
|
|
|
<?php
|
2021-01-07 08:50:43 +01:00
|
|
|
|
2019-07-18 13:44:19 +02:00
|
|
|
namespace Wrm\Events\Controller;
|
|
|
|
|
2021-01-11 09:20:51 +01:00
|
|
|
use TYPO3\CMS\Extbase\Annotation as Extbase;
|
2023-11-29 10:36:59 +01:00
|
|
|
use Wrm\Events\Frontend\MetaInformation\EventMetaInformationInterface;
|
2021-01-12 14:34:13 +01:00
|
|
|
use Wrm\Events\Domain\Model\Dto\EventDemandFactory;
|
2021-01-07 08:58:03 +01:00
|
|
|
use Wrm\Events\Domain\Model\Event;
|
|
|
|
use Wrm\Events\Domain\Repository\EventRepository;
|
2021-01-11 09:20:51 +01:00
|
|
|
use Wrm\Events\Service\DataProcessingForModels;
|
2019-07-18 13:44:19 +02:00
|
|
|
|
2021-06-16 11:19:11 +02:00
|
|
|
class EventController extends AbstractController
|
2019-07-18 13:44:19 +02:00
|
|
|
{
|
|
|
|
/**
|
2021-01-12 14:34:13 +01:00
|
|
|
* @var EventRepository
|
2019-07-18 13:44:19 +02:00
|
|
|
*/
|
2021-01-12 14:34:13 +01:00
|
|
|
protected $eventRepository;
|
2019-07-18 13:44:19 +02:00
|
|
|
|
2021-01-11 09:20:51 +01:00
|
|
|
/**
|
|
|
|
* @var DataProcessingForModels
|
|
|
|
*/
|
|
|
|
protected $dataProcessing;
|
|
|
|
|
2019-07-18 13:44:19 +02:00
|
|
|
/**
|
2021-01-12 14:34:13 +01:00
|
|
|
* @var EventDemandFactory
|
2019-07-18 13:44:19 +02:00
|
|
|
*/
|
2021-01-12 14:34:13 +01:00
|
|
|
protected $demandFactory;
|
2019-07-18 13:44:19 +02:00
|
|
|
|
2023-11-29 10:36:59 +01:00
|
|
|
/**
|
|
|
|
* @var EventMetaInformationInterface
|
|
|
|
*/
|
|
|
|
protected $metaInformationService;
|
|
|
|
|
2021-01-12 14:34:13 +01:00
|
|
|
public function __construct(
|
|
|
|
EventRepository $eventRepository,
|
|
|
|
DataProcessingForModels $dataProcessing,
|
2023-11-29 10:36:59 +01:00
|
|
|
EventDemandFactory $demandFactory,
|
|
|
|
EventMetaInformationInterface $metaInformationService
|
2021-01-12 14:34:13 +01:00
|
|
|
) {
|
2019-07-18 13:44:19 +02:00
|
|
|
$this->eventRepository = $eventRepository;
|
2021-01-11 09:20:51 +01:00
|
|
|
$this->dataProcessing = $dataProcessing;
|
2021-01-12 14:34:13 +01:00
|
|
|
$this->demandFactory = $demandFactory;
|
2023-11-29 10:36:59 +01:00
|
|
|
$this->metaInformationService = $metaInformationService;
|
2021-01-11 09:20:51 +01:00
|
|
|
}
|
|
|
|
|
2021-09-07 09:52:14 +02:00
|
|
|
protected function initializeAction(): void
|
2019-07-18 13:44:19 +02:00
|
|
|
{
|
2023-06-19 10:13:26 +02:00
|
|
|
parent::initializeAction();
|
|
|
|
|
2021-01-11 09:20:51 +01:00
|
|
|
$this->dataProcessing->setConfigurationManager($this->configurationManager);
|
2019-07-18 13:44:19 +02:00
|
|
|
}
|
|
|
|
|
2021-01-12 14:34:13 +01:00
|
|
|
public function listAction(): void
|
2019-07-18 13:44:19 +02:00
|
|
|
{
|
2021-01-12 14:34:13 +01:00
|
|
|
$demand = $this->demandFactory->fromSettings($this->settings);
|
2019-07-18 13:44:19 +02:00
|
|
|
$events = $this->eventRepository->findByDemand($demand);
|
|
|
|
$this->view->assign('events', $events);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2021-01-11 09:20:51 +01:00
|
|
|
* @Extbase\IgnoreValidation("event")
|
2019-07-18 13:44:19 +02:00
|
|
|
*/
|
2021-01-12 14:34:13 +01:00
|
|
|
public function showAction(Event $event): void
|
2019-07-18 13:44:19 +02:00
|
|
|
{
|
2023-11-29 10:36:59 +01:00
|
|
|
$this->metaInformationService->setEvent($event);
|
2019-07-18 13:44:19 +02:00
|
|
|
$this->view->assign('event', $event);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2021-01-12 14:34:13 +01:00
|
|
|
* @deprecated Use listAction instead and configure settings properly.
|
|
|
|
* Use Settings or something else to switch between list and teaser rendering.
|
2019-07-18 13:44:19 +02:00
|
|
|
*/
|
2021-01-12 14:34:13 +01:00
|
|
|
public function teaserAction(): void
|
2019-07-18 13:44:19 +02:00
|
|
|
{
|
2021-01-12 14:34:13 +01:00
|
|
|
$this->view->assignMultiple([
|
|
|
|
'events' => $this->eventRepository->findByUids($this->settings['eventUids']),
|
|
|
|
]);
|
2019-07-18 13:44:19 +02:00
|
|
|
}
|
|
|
|
|
2021-01-12 14:34:13 +01:00
|
|
|
public function searchAction(string $search = ''): void
|
2019-08-14 17:22:01 +02:00
|
|
|
{
|
|
|
|
$this->view->assign('search', $search);
|
|
|
|
$this->view->assign('events', $this->eventRepository->findSearchWord($search));
|
|
|
|
}
|
2019-07-18 13:44:19 +02:00
|
|
|
}
|