public function __invoke($options = array()) { $render = array_key_exists('render', $options) ? $options['render'] : true; $searchService = $this->getServiceLocator()->get('service_website_search'); $options = $searchService->getOptions(); $request = $this->getServiceLocator()->get('request'); $getParams = $request->getQuery(); $setParams = []; if (isset($getParams['city']) && ClassicValidator::checkCityName($getParams['city'])) { $setParams['city_url'] = $getParams['city']; $city = Helper::urlForSearch($getParams['city']); // $setParams['city'] = ; if (isset($getParams['guest'])) { $setParams['guest'] = $getParams['guest']; } $date = $searchService->getFixedDate($getParams); $setParams['arrival'] = $date['arrival']; $setParams['departure'] = $date['departure']; } $vm = new ViewModel(['options' => $options, 'setParams' => $setParams]); $vm->setTemplate($this->viewTemplate); return $render ? $this->getView()->render($vm) : $vm; }
/** * @param array $data * @return string */ private function filterReservationData($data) { $currentDate = date('Y-m-d'); $cityDao = new City($this->getServiceLocator(), 'ArrayObject'); if (isset($data['city']) && ClassicValidator::checkCityName($data['city'])) { $cityResp = $cityDao->getCityByName(Helper::urlForSearch($data['city'])); if ($cityResp) { /* @var $websiteSearchService \DDD\Service\Website\Search */ $websiteSearchService = $this->getServiceLocator()->get('service_website_search'); $diffHours = $websiteSearchService->getDiffHoursForDate(); $currentDate = Helper::getCurrenctDateByTimezone($cityResp['timezone'], 'd-m-Y', $diffHours); } } if (!isset($data['city']) || !ClassicValidator::checkCityName($data['city']) || !isset($data['apartment']) || !ClassicValidator::checkApartmentTitle($data['apartment']) || !isset($data['guest']) || !is_numeric($data['guest']) || !isset($data['apartment_id']) || !is_numeric($data['apartment_id']) || !isset($data['arrival']) || !ClassicValidator::validateDate($data['arrival'], 'd M Y') || !isset($data['departure']) || !ClassicValidator::validateDate($data['departure'], 'd M Y') || strtotime($data['arrival']) >= strtotime($data['departure']) || strtotime($currentDate) - strtotime($data['arrival']) > 129600 || !isset($data['rate-for-booking']) || !is_numeric($data['rate-for-booking']) || isset($data['apartel_id']) && !is_numeric($data['apartel_id'])) { return false; } return true; }
/** * @param int $cityId * @param string $poiSlug * @return boolean */ public function getPoiData($cityId, $poiSlug) { if (!$poiSlug || !ClassicValidator::checkCityName($poiSlug)) { return false; } /* @var $poiDao \DDD\Dao\Geolocation\Poi */ $poiDao = $this->getPoiDao(); $poi = $poiDao->getPoiDataBySlug($cityId, Helper::urlForSearch($poiSlug, TRUE)); if ($poi) { $poi['img'] = Helper::getImgByWith('/locations/' . $poi['detail_id'] . '/' . $poi['cover_image'], WebSite::IMG_WIDTH_LOCATION_BIG); } return $poi; }
/** * * @param string $controller * @param string $action * @param string $routeParam * @param ArrayObject $getQuery * @return boolean */ public function getBreadcrumbParams($controller = false, $action = false, $routeParam = false, $getQuery = false) { $noSecureDomain = '//' . \Library\Constants\DomainConstants::WS_DOMAIN_NAME; if (!$controller || !$action) { return false; } $controller = strtolower($controller); $action = strtolower($action); $controller = str_replace('website\\controller\\', '', $controller); $params[] = ['name' => $this->getTextline(1449), 'url' => '/']; switch ($controller) { case 'search': $params[] = ['name' => $this->getTextline(1322), 'url' => '/location']; if ($cityName = $this->getNameFromQuery($getQuery, 'city')) { $params[] = ['name' => $cityName, 'url' => '']; } break; case 'apartment': $apartmentTitle = isset($routeParam['apartmentTitle']) ? $routeParam['apartmentTitle'] : ''; $cityProvince = $provinceUrl = $apartment = $cityName = ''; if ($apartmentTitle) { $cityParams = explode('--', $apartmentTitle); $cityUrl = $cityParams[1]; $apartmentName = $cityParams[0]; $generalDao = new General($this->getServiceLocator(), 'ArrayObject'); $generalResult = $generalDao->getBreadcrupDataByCityApartment($apartmentName, Helper::urlForSearch($cityUrl)); if ($generalResult) { $provinceUrl = $generalResult['prov_name']; $cityName = $generalResult['city_name']; $apartment = $generalResult['name']; } $cityProvince = $cityUrl . '--' . Helper::urlForSite($provinceUrl); } $params[] = ['name' => $this->getTextline(865), 'url' => '/location']; if ($cityName) { $params[] = ['name' => $cityName, 'url' => '/location/' . $cityProvince]; } if ($apartment) { $params[] = ['name' => $apartment . ' ' . $this->getTextline(1418), 'url' => '']; } break; case 'aboutus': if ($action == 'index') { $params[] = ['name' => $this->getTextline(1440), 'url' => '']; } elseif ($action == 'privacy-policy') { $params[] = ['name' => $this->getTextline(1371), 'url' => '']; } elseif ($action == 'terms-and-conditions') { $params[] = ['name' => $this->getTextline(1373), 'url' => '']; } break; case 'contactus': $params[] = ['name' => $this->getTextline(1353), 'url' => '']; break; case 'faq': $params[] = ['name' => $this->getTextline(1379), 'url' => '']; break; case 'location': if ($action == 'index') { $params[] = ['name' => $this->getTextline(1320), 'url' => '']; } else { $params[] = ['name' => $this->getTextline(1320), 'url' => '/location']; $cityProvince = isset($routeParam['cityProvince']) ? $routeParam['cityProvince'] : ''; $locationService = $this->getServiceLocator()->get('service_website_location'); $cityResponse = $locationService->getCityByProvincCity($cityProvince); $city = isset($cityResponse['city_data']['city_name']) ? $cityResponse['city_data']['city_name'] : ''; if (isset($routeParam['poi'])) { $params[] = ['name' => $city, 'url' => '/location/' . $cityProvince]; $params[] = ['name' => $this->getNameFromRoute($routeParam['poi'], 0), 'url' => '']; } else { $params[] = ['name' => $city, 'url' => '']; } } break; case 'blog': if ($action == 'index') { $params[] = ['name' => $this->getTextline(1331), 'url' => '']; } else { $blogTitel = isset($routeParam['article']) ? $routeParam['article'] : ''; $params[] = ['name' => $this->getTextline(1331), 'url' => '/blog']; $params[] = ['name' => $this->getNameFromRoute($blogTitel, 0), 'url' => '']; } break; case 'news': if ($action == 'index') { $params[] = ['name' => $this->getTextline(1417), 'url' => '']; } else { $blogTitel = isset($routeParam['article']) ? $routeParam['article'] : ''; $params[] = ['name' => $this->getTextline(1417), 'url' => '/news']; $params[] = ['name' => $this->getNameFromRoute($blogTitel, 0), 'url' => '']; } break; case 'jobs': if ($action == 'index') { $params[] = ['name' => $this->getTextline(1488), 'url' => '']; } else { $announcementTitle = isset($routeParam['slug']) ? $this->getNameFromRoute($routeParam['slug'], 0) : ''; $params[] = ['name' => $this->getTextline(1488), 'url' => '/jobs']; $params[] = ['name' => $this->getNameFromRoute($announcementTitle, 0), 'url' => '']; } } foreach ($params as &$param) { //if secure change to www if (isset($param['url']) && $param['url'] != '') { $param['url'] = $noSecureDomain . $param['url']; } } return $params; }
/** * @param array $data * @return string */ public function filterQueryData($data) { $currentDate = date('Y-m-d'); $cityDao = new City($this->getServiceLocator(), 'ArrayObject'); if (!isset($data['city'])) { $pageSlugExp = explode('--', $data['slug']); $citySlug = $pageSlugExp[1]; } else { $citySlug = $data['city']; } if (isset($citySlug) && ClassicValidator::checkCityName($citySlug)) { $cityResp = $cityDao->getCityBySlug(Helper::urlForSearch($citySlug, TRUE)); if ($cityResp) { /* @var $websiteSearchService \DDD\Service\Website\Search */ $websiteSearchService = $this->getServiceLocator()->get('service_website_search'); $diffHours = $websiteSearchService->getDiffHoursForDate(); $currentDate = Helper::getCurrenctDateByTimezone($cityResp['timezone'], 'd-m-Y', $diffHours); } } if (!isset($data['arrival']) || !ClassicValidator::validateDate($data['arrival']) || !isset($data['departure']) || !ClassicValidator::validateDate($data['departure']) || strtotime($data['arrival']) < strtotime($currentDate) || strtotime($data['arrival']) >= strtotime($data['departure'])) { return false; } return true; }