/** * count the number of leisures for every search category and displays it */ public function quickSearchAction() { $searchCats = explode(',', $this->settings['quickSearch']['searchCategories']); //DebugUtility::debugInPopUpWindow($searchCats, 'Searchkategorien'); $quickSearch = array(); foreach ($searchCats as $cat) { $cat = trim($cat); if (array_key_exists($cat, $this->mapSearchCategoriesToRepository)) { $repository = $this->mapSearchCategoriesToRepository[$cat]; $item = new \stdClass(); $item->name = $cat; $elements = $repository->findAll(); $item->options = array(); foreach ($elements as $elem) { $option = new \stdClass(); if ($cat == "Ferienzeiten") { // DebugUtility::debugInPopUpWindow($elem, 'Ferienzeiten'); } $option->name = $elem->getName(); $option->uid = $elem->getUid(); $option->leisureProperty = CategoryMapper::getLeisurePropertiesFromSearchCategory($cat); if ($cat == "Ferienzeiten") { $queryResult = $this->leisureRepository->findBy($option->leisureProperty, $elem->getUid()); } else { $queryResult = $this->leisureRepository->findBy($option->leisureProperty, $elem); } $option->number = $queryResult->count(); $item->options[] = $option; } $quickSearch[] = $item; } else { //wrong setting in Typoscript } } //DebugUtility::debug($quickSearch, "Quicksearch"); $this->view->assign('categories', $quickSearch); $this->view->assign('settings', $this->settings); }
protected function initSearchValues($searchArgs) { if (!empty($searchArgs['category']) && !empty($searchArgs['property'])) { $this->category = array('leisureProperty' => CategoryMapper::getLeisurePropertiesFromSearchCategory($searchArgs['category']), 'value' => $searchArgs['property']); } else { $this->category = array(); } unset($searchArgs['category']); unset($searchArgs['property']); $exclude = array('priceFrom', 'priceTo', 'startDate', 'endDate'); foreach ($searchArgs as $key => $val) { if (!in_array($key, $exclude)) { $this->ands[$key] = $val; } } }