/** * @return array */ public function getOptionsForSearch() { $guest = Objects::getGuestList(['guest' => $this->getTextLineSite(1455), 'guests' => $this->getTextLineSite(1456)]); $params['cities'] = $this->getCityListForSearch(); $params['guest'] = $guest; $params['current_date'] = date('d-m-Y'); return $params; }
/** * * @return array */ public function getOptions($data) { /* @var $websiteSearchService \DDD\Service\Website\Search */ $websiteSearchService = $this->getServiceLocator()->get('service_website_search'); $diffHours = $websiteSearchService->getDiffHoursForDate(); $options['current_date'] = Helper::getCurrenctDateByTimezone($data['city_data']['timezone'], 'd-m-Y', $diffHours); $router = $this->getServiceLocator()->get('router'); $url = $router->assemble([], ['name' => 'search']); $options['url'] = $url; $guest = Objects::getGuestList(['guest' => $this->getTextLineSite(1455), 'guests' => $this->getTextLineSite(1456)]); $options['guest'] = $guest; return $options; }
public function getApartment($cityApartel) { $cityApartel = explode('--', $cityApartel); if (!isset($cityApartel[1]) || !ClassicValidator::checkApartmentTitle($cityApartel[0]) || !ClassicValidator::checkApartmentTitle($cityApartel[1])) { return false; } $apartel = $otherParams['apartel'] = $cityApartel[0]; $city = $cityApartel[1]; $generalDao = $this->getApartmentGeneralDao(); $descrDao = $this->getDescriptionDao(); $roomDao = $this->getRoomDao(); $officeDao = new \DDD\Dao\Office\OfficeManager($this->getServiceLocator()); $furnitureDao = $this->getFurnitureDao(); $apartmentAmenitiesDao = $this->getAmenitiesDao(); $buildingFacilitiesDao = $this->getFacilitiesDao(); $general = $generalDao->getApartmentGeneralBySlug($apartel, Helper::urlForSearch($city, TRUE)); if (!$general) { return false; } //change currency $userCurrency = $this->getCurrencySite(); if ($userCurrency != $general['code']) { $currencyResult = $this->currencyConvert($general['price_avg'], $userCurrency, $general['code']); $general['price_avg'] = $currencyResult[0]; $general['symbol'] = $currencyResult[1]; } //images $imgDomain = DomainConstants::IMG_DOMAIN_NAME; $imgPath = Website::IMAGES_PATH; $images = []; $checkHasImage = false; foreach ($general as $key => $img) { if (strpos($key, 'img') !== false && $img) { $original = Helper::getImgByWith($img); $smallImg = Helper::getImgByWith($img, WebSite::IMG_WIDTH_AMARTMENT_SMALL); $bigImg = Helper::getImgByWith($img, WebSite::IMG_WIDTH_AMARTMENT_BIG); if ($original && $bigImg && $smallImg) { $checkHasImage = true; $images[] = ['domain' => $imgDomain, 'big' => $bigImg, 'small' => $smallImg, 'orig' => $original]; } } } if (!$checkHasImage) { $noImg = Constants::VERSION . 'img/no_image.png'; $images[] = ['domain' => $noImg, 'big' => $noImg, 'small' => $noImg, 'orig' => $noImg]; } $otherParams['images'] = $images; //video if (isset($general['video']) && $general['video']) { $video = Helper::getVideoUrl($general['video']); if ($video) { $otherParams['video'] = ['video_screen' => $video, 'src' => $general['video']]; } } //facilities $tempFacilitiesData = $buildingFacilitiesDao->getApartmentBuildingFacilities($general['aprtment_id']); $facilities = []; foreach ($tempFacilitiesData as $tempFacility) { $facilities[$tempFacility->getFacilityName()] = $tempFacility->getFacilityTextlineId(); } unset($tempFacilitiesData); //amenities $tempAmenitiesData = $apartmentAmenitiesDao->getApartmentAmenities($general['aprtment_id']); $amenities = []; foreach ($tempAmenitiesData as $tempAmenity) { $amenities[$tempAmenity->getAmenityName()] = $tempAmenity->getAmenityTextlineId(); } unset($tempAmenitiesData); if (isset($facilities['Parking']) && $facilities['Parking']) { $otherParams['parking'] = true; } if (isset($amenitiesData['Free Wifi']) && $amenitiesData['Free Wifi']) { $otherParams['internet'] = true; } //furniture $furnitureData = $furnitureDao->getFurnitureLits($general['aprtment_id']); $otherParams['furnitures'] = $furnitureData; /* @var $websiteSearchService \DDD\Service\Website\Search */ $websiteSearchService = $this->getServiceLocator()->get('service_website_search'); $diffHours = $websiteSearchService->getDiffHoursForDate(); $otherParams['current'] = Helper::getCurrenctDateByTimezone($general['timezone'], 'd-m-Y', $diffHours); $general['city_name'] = $general['city_name']; $general['city_slug'] = $general['city_slug']; $otherParams['guestList'] = Objects::getGuestList(['guest' => $this->getTextLineSite(1455), 'guests' => $this->getTextLineSite(1456)], true); $params = ['general' => $general, 'amenities' => $amenities, 'facilities' => $facilities, 'otherParams' => $otherParams]; return $params; }