function getAllCourses() { $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["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; $excursions = ExcursionsService::getHotelExcursions(HOTEL_COURSES, -1, $userData->start_date, $userData->end_date, null, null, $userData->adults, $userData->children); $this->_total = count($excursions); return $excursions; }
public function generateReservationSummary($reservationData, $checkAvailability = true) { //generate data for rooms $startDate = $reservationData->userData->start_date; $endDate = $reservationData->userData->end_date; $hotelId = $reservationData->userData->hotelId; $currency = $reservationData->userData->currency; $discountCode = $reservationData->userData->discount_code; $reservedItems = $reservationData->userData->reservedItems; $roomsPrices = array(); if (isset($reservationData->userData->room_prices)) { $roomsPrices = explode(",", $reservationData->userData->room_prices); } if (isset($reservationData->userData->roomCustomPrices)) { $roomsPrices = $reservationData->userData->roomCustomPrices; } //dmp($reservationData->userData->roomGuests); $selectedRooms = $this->getSelectedRooms($reservedItems, $roomsPrices, $hotelId, $startDate, $endDate, $reservationData->userData->roomGuests, $reservationData->userData->roomGuestsChildren, $discountCode, $checkAvailability, $reservationData->userData->confirmation_id); $roomsInfo = $this->getReservationDetailsRooms($reservationData->userData, $selectedRooms, $currency); BookingService::setRoomAvailability($selectedRooms, array(), $hotelId, $startDate, $endDate, $reservationData->userData->confirmation_id); $nrRooms = count($selectedRooms); $roomNotAvailable = array(); $showDiscounts = false; foreach ($selectedRooms as $room) { //dmp($room); if ($room->is_disabled) { $roomNotAvailable[] = $room; } //dmp($room->hasDiscounts); if ($room->hasDiscounts) { $showDiscounts = true; } } //exit; //generate extra options $extraOptionsInfo = null; $extraOptionIds = isset($reservationData->userData->extraOptionIds) ? $reservationData->userData->extraOptionIds : null; //dmp($extraOptionIds); $extraOptions = array(); if (is_array($extraOptionIds) && count($extraOptionIds) > 0) { foreach ($extraOptionIds as $key => $value) { if (strlen($value) > 1) { $extraOption = explode("|", $value); $extraOptions[$key] = $extraOption; } } } //micod //Mi código modificado para poder aceptar la cotización de niños en el pasaje aereo en Extras //------------------------------------------------------------------------------------------- //unset($_SESSION["ver"]); if (count($extraOptions, COUNT_RECURSIVE) == 17) { $_SESSION["extras"] = $extraOptions; //echo "<script> alert('TRUE'); </script>"; $verificar = true; } else { //echo "<script> alert('FALSE'); </script>"; $verificar = false; } //dmp($_SESSION["extras"]); //dmp($_SESSION["ver"]); $selectedExtraOptions = array(); if ($verificar == true) { if (isset($_SESSION["extras"]) && count($_SESSION["extras"]) > 0) { $selectedExtraOptions = ExtraOptionsService::getHotelExtraOptions($hotelId, $startDate, $endDate, $_SESSION["extras"], 0, 0); $extraOptionsInfo = $this->getReservationDetailsExtraOptions($selectedExtraOptions, $_SESSION["extras"], $nrRooms, $currency); /*if ($_SESSION["ver"] == false){ $_SESSION["ver"] = false; }else{ }*/ $_SESSION["ver"] = true; //echo "<script> alert('Entro en TRUE'); </script>"; } } if ($verificar == false) { if (isset($extraOptions) && count($extraOptions) > 0) { $selectedExtraOptions = ExtraOptionsService::getHotelExtraOptions($hotelId, $startDate, $endDate, $extraOptions, 0, 0); $extraOptionsInfo = $this->getReservationDetailsExtraOptions($selectedExtraOptions, $extraOptions, $nrRooms, $currency); //echo "<script> alert('Entro en FALSE'); </script>"; //$_SESSION["ver"] = false; if ($_SESSION["ver"] == true) { if (isset($_SESSION["extras"]) && count($_SESSION["extras"]) > 0) { $selectedExtraOptions = ExtraOptionsService::getHotelExtraOptions($hotelId, $startDate, $endDate, $_SESSION["extras"], 0, 0); $extraOptionsInfo = $this->getReservationDetailsExtraOptions($selectedExtraOptions, $_SESSION["extras"], $nrRooms, $currency); //echo "<script> alert('Entro en el que queríamos'); </script>"; //unset($_SESSION["ver"]); } } } } //------------------------------------------------------------------------------------------- //dmp($selectedExtraOptions); //generate course/excursions $excursionsInfo = null; $selectedExcursions = null; if ($reservationData->appSettings->enable_excursions && count($reservationData->userData->excursions) > 0) { $excursionData = $reservationData->userData->excursions; if (!is_array($reservationData->userData->excursions)) { $excursionData = explode(",", $reservationData->userData->excursions); } $selectedExcursions = ExcursionsService::getSelectedExcursions($excursionData, $reservedItems, $hotelId, $startDate, $endDate, $reservationData->userData->roomGuests, $reservationData->userData->roomGuestsChildren, $discountCode, $checkAvailability, $reservationData->userData->confirmation_id); $excursionsInfo = $this->getReservationDetailsExcursions($reservationData->userData, $selectedExcursions, $currency); } $costData = $this->getReservationCostData($selectedRooms); //LA CUOTA A PAGAR!!!!!!!! $guestDetails = array(); if (isset($reservationData->userData->guestDetails)) { $guestDetails = $reservationData->userData->guestDetails; } $taxes = TaxService::getTaxes($hotelId); $reservationDetails = $this->getReservationDetails($reservationData, $roomsInfo, $extraOptionsInfo, $excursionsInfo, $taxes, $guestDetails, $currency, $costData); $reservationDetails->rooms = $selectedRooms; $reservationDetails->roomsInfo = $roomsInfo; $reservationDetails->extraOptions = $selectedExtraOptions; $reservationDetails->extraOptionsInfo = $extraOptionsInfo; //dmp($extraOptions); $reservationDetails->roomNotAvailable = $roomNotAvailable; $reservationDetails->showDiscounts = $showDiscounts; $reservationDetails->costData = $costData; $reservationDetails->excursions = $selectedExcursions; $reservationDetails->excursionsInfo = $excursionsInfo; return $reservationDetails; }
static function getSelectedExcursions($reservedItems, $customPrices, $hotelId, $startDate, $endDate, $roomGuests, $roomGuestsChildren, $discountCode, $checkAvailability = true, $confirmationId = null) { $selectedExcursions = array(); if (count($reservedItems) > 0) { $excursionData = ExcursionsService::parseExcursions($reservedItems); $selectedExcursions = ExcursionsService::getHotelExcursions(-1, -1, $startDate, $endDate, $excursionData->excursionIds, $excursionData->nrBooked, null, $discountCode, $checkAvailability, $confirmationId); } ksort($selectedExcursions); return $selectedExcursions; }
function getCourses() { $userData = UserDataService::getUserData(); $excursions = ExcursionsService::getHotelExcursions(HOTEL_COURSES, $this->getState('hotel.id'), $userData->start_date, $userData->end_date, array(), $userData->adults, $userData->children); return $excursions; }
function generateCalendarData($year = 0, $month = 0) { $session = JFactory::getSession(); $userData = $_SESSION['userData']; $post = JRequest::get('post'); $get = JRequest::get('get'); if (!count($post)) { $post = $get; } if (!isset($post["hotel_id"])) { $post["hotel_id"] = JRequest::getInt('hotel_id'); } $year_start = $userData->year_start; $month_start = $userData->month_start; $day_start = 1; $year_end = $userData->year_end; $month_end = $userData->month_start; $day_end = date('t', mktime(0, 0, 0, $userData->month_start, 1, $userData->year_start)); //dmp($currentRoom); $adults = $userData->adults; $children = $userData->children; //dmp($userData); $post["guest_adult"] = $adults; $post["guest_child"] = $userData->children; if ($year != 0) { $post["year_start"] = $year; $post["year_end"] = $year; $year_start = $year; $year_end = $year; } if ($month != 0) { $post["month_start"] = $month; $post["month_end"] = $month; $month_start = $month; $month_end = $month; } $number_persons = $post["guest_adult"]; //dmp($post); $datasi = date("Y-m-d", mktime(0, 0, 0, $userData->month_start, $userData->day_start, $userData->year_start)); $dataei = date("Y-m-d", mktime(0, 0, 0, $userData->month_end, $userData->day_end, $userData->year_end)); $diff = abs(strtotime($dataei) - strtotime($datasi)); $years = floor($diff / (365 * 60 * 60 * 24)); $months = floor(($diff - $years * 365 * 60 * 60 * 24) / (30 * 60 * 60 * 24)); $initialNrDays = floor(($diff - $years * 365 * 60 * 60 * 24 - $months * 30 * 60 * 60 * 24) / (60 * 60 * 24)); //dmp($initialNrDays); $datas = date("Y-m-d", mktime(0, 0, 0, $month_start, $day_start, $year_start)); $datae = date("Y-m-d", mktime(0, 0, 0, $month_end, $day_end + 7, $year_end)); //echo $adults." "; //dmp($adults); /* dmp($year_start); dmp($month_start); dmp($datas); dmp($datae); */ //exit; $hotelId = -1; $excursions = ExcursionsService::getHotelExcursions(-1, $hotelId, $datas, $datae, null, null, $adults, $children); $bookingsDays = null; $hoteAvailability = null; $temporaryReservedRooms = null; $excursionCalendar = ExcursionsService::getExcursionCalendar($excursions, $initialNrDays, $adults, $children, $month_start, $year_start, $bookingsDays, $temporaryReservedRooms, $hoteAvailability); //dmp($excursionCalendar); //dmp($offersCalendar); return $excursionCalendar; }