request->getArguments(); $organizationId = (int) $this->settings['organizationId']; $searchParams = []; if($args['search-loc']) {https://www.qwant.com/?client=brz-moz&q=opentalent $searchParams['where'] = $args['search-loc']; } if($args['search-name']) { $searchParams['what'] = $args['search-name']; } if($args['search-datestart']) { $dateStart = \DateTime::createFromFormat('d/m/Y', $args['search-datestart']); $searchParams['datetimeStart'] = $dateStart->format('d-m-Y'); } if($args['search-dateend']) { $dateEnd = \DateTime::createFromFormat('d/m/Y', $args['search-dateend']); $searchParams['datetimeEnd'] = $dateEnd->format('d-m-Y'); } $allEvents = $this->eventRepository->searchBy($organizationId, $searchParams); if (empty($searchParams) && empty($allEvents)) { $this->forward('noEvents'); } $this->view->assign('allEvents', $allEvents); $this->view->assign('args', $args); $this->setTemplate('Index'); } /** @noinspection PhpUnused */ /** * action nextEventsAction * * @param int $eventId * @return void * @throws \TYPO3\CMS\Extbase\Mvc\Exception\StopActionException */ public function showAction($eventId, array $options = []) { $event = $this->eventRepository->findById($eventId); if ($event == null | $event->getOrganizationId() != $this->settings['organizationId']) { // The requested event does not exist, or is not an event of this organization unset($eventId); $this->forward('index'); } $this->view->assign('event', $event); $this->setTemplate('Show'); } /** @noinspection PhpUnused */ /** * action noEventsAction * Triggered if there are no events to show * * @return void * @throws \Exception */ public function noEventsAction(array $options = []) { $this->setTemplate('NoEvents'); } /** @noinspection PhpUnused */ /** * action nextEventsAction * * @param array $options * @return void * @throws \Exception */ public function previewAction(array $options = []) { // Get current settings $organizationId = (int) $this->settings['organizationId']; if (!$organizationId) { return; } // Parse options $limit = (int) ($options['eventsLimit'] ?? 5); $period = (int) ($options['eventsPeriod'] ?? 8); $fromDate = new \DateTime(); $toDate = null; if ($period > 0) { $nbDays = 7 * $period; $toDate = new \DateTime(); $interval = new \DateInterval('P' . $nbDays . 'D'); $toDate->add($interval); } if ($limit < 1) { $limit = 1; // $limit can not be lesser than 1 } if ($limit > 24) { $limit = 24; // $limit can not be higher than 24 } // Get next events of the structure $nextEvents = $this->eventRepository->findByOrganizationId($organizationId, $fromDate, $toDate, $limit); $this->view->assign('events', $nextEvents); if ((int) $this->settings['organizationIsNetwork'] == 1) { // Network: Get the next events of the parent structures $structuresEvents = $this->eventRepository->findChildrenByOrganizationId($organizationId, $fromDate, $toDate, $limit); $this->view->assign('structuresEvents', $structuresEvents); } else { // Simple structure: Get the next events of the parent structures $networkEvents = $this->eventRepository->findParentsByOrganizationId($organizationId, $fromDate, $toDate, $limit); $this->view->assign('networkEvents', $networkEvents); } $this->setTemplate('Preview'); } /** * @param \Opentalent\OtTemplating\Domain\Repository\EventRepository $eventRepository */ public function injectEventRepository(EventRepository $eventRepository) { $this->eventRepository = $eventRepository; } /** * @param \Opentalent\OtTemplating\Domain\Repository\OrganizationRepository $organizationRepository */ public function injectOrganizationRepository(OrganizationRepository $organizationRepository) { $this->organizationRepository = $organizationRepository; } }