, none */ /** * MapController */ class TravelPostController extends ActionController { use InjectMarkerRepositoryTrait; use InjectMapEntryRepositoryTrait; use InjectTravelAuthorRepositoryTrait; use InjectTravelPostRepositoryTrait; use InjectTravelCategoryRepositoryTrait; use InjectImageServiceTrait; private static $mapIcons = null; /** * * @param UriBuilder $uriBuilder * @param TemplateView $sourceView * @param type $arguments * @param type $actionName * @param type $controllerName * @return string */ static private function generateContent(UriBuilder $uriBuilder, TemplateView &$sourceView, $arguments = [], $actionName = 'popup', $controllerName = 'Map'): StandaloneView { $templatePath = $controllerName . '/' . ucfirst($actionName); $objectManager = GeneralUtility::makeInstance(ObjectManager::class); $templateRootPaths = $sourceView->getTemplateRootPaths(); $context = $objectManager->get(ControllerContext::class); $request = $objectManager->get(Request::class); $context->setRequest($request); $context->setUriBuilder($uriBuilder); /** * @var StandaloneView $view */ $view = $objectManager->get(StandaloneView::class); $view->setControllerContext($context); $view->setLayoutRootPaths($sourceView->getLayoutRootPaths()); $view->setTemplateRootPaths($templateRootPaths); $view->setPartialRootPaths($sourceView->getPartialRootPaths()); $view->setTemplate($templatePath); $arguments['today'] = (new \DateTime())->format('d.m.Y'); $view->assignMultiple($arguments); return $view; } private function setMapMarkerIcons() { if (self::$mapIcons === null) { self::$mapIcons = []; $markers = $this->markerRepository->findAll(); foreach ($markers as $marker) { if ($marker->getMapIcon() !== null) { self::$mapIcons[] = [ 'uid' => 'i-' . $marker->getUid(), 'icon' => $this->imageService->getImageUri($this->imageService->applyProcessingInstructions($this->imageService->getImage('', $marker->getMapIcon(), false), []), true) ]; } } } } /** * action timeline * * @return string|object|null|void */ public function timelineAction() { $args=[]; switch ((int) $this->settings['timelineType']) { case 2: $cats = explode(',', $this->settings['showCategories']); $travelPosts = $this->travelPostRepository->getFromCategoryUids($cats); break; case 3: $authorUids = explode(',', $this->settings['showAuthors']); $travelPosts = $this->travelPostRepository->getFromAuthorUids($authorUids); $args['authors'] = $this->travelAuthorRepository->getFromUids($authorUids); break; default: $travelPosts = $this->travelPostRepository->findAll(); break; } $args['posts'] = $travelPosts; $this->view->assignMultiple($args); } }