Exemple #1
0
function updateHotelsStep_5()
{
    $room_control = new RoomControl();
    $rc_id = $_REQUEST['rc_id'];
    $rc_room_id = $_REQUEST['rc_room_type_id'];
    $rc_in_date = $_REQUEST['rc_in_date'];
    $rc_out_date = $_REQUEST['rc_out_date'];
    $rc_num_room = $_REQUEST['rc_num_of_rooms'];
    $room_control->setRcId($_REQUEST['rc_id']);
    $res1 = $room_control->getRoomControlData();
    if (count($res1) > 0) {
        $res = $room_control->editRoomController($rc_id, $rc_num_room);
    } else {
        $res = $room_control->getAllRoomDates($rc_in_date, $rc_out_date, $rc_room_id);
        $room_control->addRoomController($rc_in_date, $rc_out_date, $rc_room_id, $rc_num_room, $res);
    }
    //INFO: Log
    if ($res) {
        //$temp_room_control = array("Room_Id" => $rc_room_id, "Date_From" => $rc_in_date, "Date_to" => $rc_out_date, "No_of_Rooms" => $rc_num_room);
        //$TransactionLog = new TransactionLog($_REQUEST['hotel_id'], Libs::getKey('hotel_sections', 'Assign Room'), 'Insert', Sessions::getMemberId(), 'room_control', $temp_room_control, '');
        //$TransactionLog->log();
        //$temp_room_control = null;
    } else {
    }
    //INFO: Log//
    $complete = new ProfileCompletion();
    $complete->setHotelStepId($_REQUEST['hotel_step_id']);
    $complete->setHotelStep1(1);
    $complete->updateProfileCompletionStep('7');
    echo $_REQUEST['hotel_step_id'];
}
Exemple #2
0
        border-radius: 3px;
    }
</style>

<div class="hotel-check-rates-results-title" style="clear:both;"></div>
<div class="hotel-room-types-results-main-rows">
<?php 
$hotelRoomType->setRoomTypeHotelId($hotels_id);
$getRoomType_row = $hotelRoomType->getHotelRoomTypeFromHotelsId();
for ($k = 0; $k < count($getRoomType_row); $k++) {
    $hotelRoomType->extractor($getRoomType_row, $k);
    $no_of_rooms = 0;
    $all_dates_available = true;
    $rc_in_date = $_REQUEST['check_in_date'];
    $rc_out_date = $_REQUEST['check_out_date'];
    $room_control = new RoomControl();
    $_temp = $room_control->getAllRoomDates($rc_in_date, $rc_out_date, $hotelRoomType->roomTypeId());
    $number_array = array();
    for ($i = 0; $i < count($_temp); $i++) {
        $room_control->extractor($_temp, $i);
        if ($room_control->rcNumOfRooms() == 0) {
            $all_dates_available = false;
        }
        //$no_of_rooms = $no_of_rooms + $room_control->rcNumOfRooms();
        array_push($number_array, $room_control->rcNumOfRooms());
    }
    sort($number_array);
    $no_of_rooms = $number_array[0];
    if (!$all_dates_available) {
        $no_of_rooms = 0;
    }
function checkForCalendar()
{
    $roomControl = new RoomControl();
    $not_available_dates = array();
    $maxDate = $roomControl->getMaxAvailableDate($_REQUEST['hotel_id']);
    $rc_in_date = date("Y-m-d", time());
    $rc_out_date = date("Y-m-d", strtotime("+12 months"));
    if (count($maxDate) > 0) {
        if ($maxDate[0]['maxDate'] != "") {
            $rc_out_date = date("Y-m-d", strtotime($maxDate[0]['maxDate']));
        }
    }
    foreach (Common::createDateRangeArray($rc_in_date, $rc_out_date) as $k => $v) {
        $roomData = $roomControl->getAvailableRoomCountForHotelForDate($v, $_REQUEST['hotel_id']);
        $assignedRooms = $roomControl->getAssignedRoomCountForHotelForDate($v, $_REQUEST['hotel_id']);
        $checkInCheckOut = $roomControl->getIfCheckInOutAvailableForHotelForDate($v, $_REQUEST['hotel_id']);
        if (count($assignedRooms) > 0) {
            if ($assignedRooms[0]['num_of_rooms'] > 0) {
                $assignedRooms = $assignedRooms[0]['num_of_rooms'];
            } else {
                $assignedRooms = 0;
            }
        } else {
            $assignedRooms = 0;
        }
        if (count($checkInCheckOut) > 0) {
            if ($checkInCheckOut[0]['reservation_count'] > 1) {
                if ($checkInCheckOut[0]['reserved_rooms'] / $checkInCheckOut[0]['reservation_count'] < $assignedRooms) {
                    $checkInCheckOut = false;
                } else {
                    $checkInCheckOut = true;
                }
            } else {
                $checkInCheckOut = false;
            }
        } else {
            $checkInCheckOut = false;
        }
        if (count($roomData) > 0) {
            if ($roomData[0]['available_rooms'] > 0) {
                //array_push($not_available_dates, $v);
                $not_available_dates[$v] = $checkInCheckOut;
            }
        }
    }
    echo json_encode($not_available_dates);
}