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;
|
2019-07-18 13:44:19 +02:00
|
|
|
use TYPO3\CMS\Extbase\Mvc\Controller\ActionController;
|
2021-01-07 08:58:03 +01:00
|
|
|
use Wrm\Events\Domain\Model\Dto\EventDemand;
|
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
|
|
|
|
|
|
|
class EventController extends ActionController
|
|
|
|
{
|
|
|
|
/**
|
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
|
|
|
|
2021-01-12 14:34:13 +01:00
|
|
|
public function __construct(
|
|
|
|
EventRepository $eventRepository,
|
|
|
|
DataProcessingForModels $dataProcessing,
|
|
|
|
EventDemandFactory $demandFactory
|
|
|
|
) {
|
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;
|
2021-01-11 09:20:51 +01:00
|
|
|
}
|
|
|
|
|
2019-07-18 13:44:19 +02:00
|
|
|
protected function 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
|
|
|
{
|
|
|
|
$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
|
|
|
}
|