/** * Render a map with only one location * * @param Model\Location $location * @return void */ public function showAction(Model\Location $location = null) { if ($location === null) { if ($this->settings['location']) { $location = $this->locationRepository->findByUid((int) $this->settings['location']); } } if ($location !== null) { /** @var Model\Location $center */ $center = $location; $center->setZoom($this->settings['zoom'] ? $this->settings['zoom'] : 15); $this->view->assign('center', $center); $this->view->assign('numberOfLocations', 1); $this->view->assign('locations', array($location)); } }
/** * Action responsible for rendering search, map and list partial * * @param Model\Constraint $search * @throws \BadFunctionCallException * @throws \TYPO3\CMS\Extbase\Persistence\Generic\Exception * @return void * @validate $search Evoweb.StoreFinder:Constraint */ public function mapAction(Model\Constraint $search = NULL) { $afterSearch = 0; if ($search !== NULL) { $search = $this->geocodeService->geocodeAddress($search); $center = $this->getCenter($search); $center = $this->setZoomLevel($center, $search); $this->view->assign('center', $center); $afterSearch = 1; $locations = $this->locationRepository->findByConstraint($search); // manual rewind needed because fluid doesnt do it $locations->rewind(); $this->view->assign('numberOfLocations', $locations->count()); $this->view->assign('locations', $locations); } elseif ($this->settings['singleLocationId']) { /** @var Model\Constraint $search */ $search = $this->objectManager->get('Evoweb\\StoreFinder\\Domain\\Model\\Constraint'); $center = $this->getCenter($search); $center = $this->setZoomLevel($center, $search); $this->view->assign('center', $center); $location = $this->locationRepository->findByUid($this->settings['singleLocationId']); $this->view->assign('numberOfLocations', is_object($location) ? 1 : 0); $this->view->assign('locations', array($location)); } else { /** @var Model\Constraint $search */ $search = $this->objectManager->get('Evoweb\\StoreFinder\\Domain\\Model\\Constraint'); if ($this->settings['showBeforeSearch'] & 2 && is_array($this->settings['defaultConstraint'])) { $search = $this->addDefaultConstraint($search); $search = $this->geocodeService->geocodeAddress($search); $center = $this->getCenter($search); $center = $this->setZoomLevel($center, $search); $this->view->assign('center', $center); if ($this->settings['showLocationsForDefaultConstraint']) { $locations = $this->locationRepository->findByConstraint($search); // manual rewind needed because fluid doesnt do it $locations->rewind(); $this->view->assign('numberOfLocations', $locations->count()); $this->view->assign('locations', $locations); } } } $this->addCategoryFilterToView(); $this->view->assign('afterSearch', $afterSearch); $this->view->assign('search', $search); $this->view->assign('static_info_tables', \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::isLoaded('static_info_tables') ? 1 : 0); }