Exemplo n.º 1
0
 function getAllRooms()
 {
     $userData = $_SESSION['userData'];
     $orderBy = "";
     $this->searchParams = array();
     $this->searchParams["orderBy"] = $userData->orderBy;
     $this->searchParams["keyword"] = $userData->keyword;
     $this->searchParams["orderBy"] = $userData->orderBy;
     $this->searchParams["adults"] = $userData->adults;
     $this->searchParams["voucher"] = $userData->voucher;
     $this->searchParams["startDate"] = $userData->start_date;
     $this->searchParams["endDate"] = $userData->end_date;
     $this->searchParams["languageTag"] = JRequest::getVar('_lang');
     $this->searchParams["city"] = JRequest::getVar('city');
     $this->searchParams["showAll"] = JRequest::getVar('showAll');
     $this->searchParams["adults"] = $userData->adults;
     $this->searchParams["children"] = $userData->children;
     $this->searchParams["type"] = JRequest::getVar('jhotelreservation_type');
     $orderByPrice = false;
     if ($userData->orderBy == 'lowest_hotel_price asc' || $userData->orderBy == 'starting_price_offers asc') {
         $orderByPrice = true;
     }
     if (!isset($userData->noDates)) {
         $userData->noDates = 0;
     }
     $this->searchParams["no-dates"] = $userData->noDates;
     $roomQuery = $this->getSearchQuery($this->searchParams);
     $db = JFactory::getDBO();
     $db->setQuery($roomQuery, $this->getState('limitstart'), $this->getState('limit'));
     $rooms = $db->loadObjectList();
     $rooms = HotelService::getAllRooms($rooms, $userData->start_date, $userData->end_date, $userData->adults, $userData->children, $orderByPrice);
     BookingService::setRoomAvailability($rooms, $userData->reservedItems, $this->getState('hotel.id'), $userData->start_date, $userData->end_date);
     return $rooms;
 }