break; case 'add_room': $choice = filter_input(INPUT_POST, 'choice'); $room_nbr = filter_input(INPUT_POST, 'room_nbr'); // The user either pressed Add or Cancel. // If Add, then add the room. // Otherwise, just skip down to the list redraw. if ($choice == 'Add') { add_room($room_nbr); } $roomList = get_room_list(); include 'room_list.php'; break; case 'show_modify_room': $room_id = filter_input(INPUT_GET, 'room_id'); $room = get_room($room_id); $room_nbr = $room['rm_nbr']; include 'room_modify.php'; exit; break; case 'modify_room': $choice = filter_input(INPUT_POST, 'choice'); $room_nbr = filter_input(INPUT_POST, 'room_nbr'); $room_id = filter_input(INPUT_POST, 'room_id'); modify_room($room_id, $room_nbr); $roomList = get_room_list(); include 'room_list.php'; exit; break; case 'delete_room': $room_id = filter_input(INPUT_GET, 'room_id');
$error_msg .= "A capacity for the room is required. <BR>"; } if ($error_msg != "") { include "add_room.php"; exit; } else { add_room($rm_nbr, $rm_cap); } } } else { if ($action == "delete") { $id = filter_input(INPUT_GET, "id"); delete_room($id); } else { if ($action == "edit") { $rm = get_room(filter_input(INPUT_GET, "id")); include "edit_room.php"; exit; } else { if ($action == "edit_room") { $choice = filter_input(INPUT_POST, "choice"); $rm_nbr = filter_input(INPUT_POST, "rm_nbr"); $rm_cap = filter_input(INPUT_POST, "rm_cap"); $rm_id = filter_input(INPUT_POST, "rm_id"); if ($choice == "Make Changes") { $error_msg = ""; if (empty($rm_nbr)) { $error_msg .= "A room number is required. <BR>"; } if (empty($rm_cap)) { $error_msg .= "A capacity for the room is required <BR>";
/** * Retrieve all the reservation details by reservation id * @param $detailID [in] The reservation details ID * @param $details [in/out] reservation details array * @return 1 on success and 0 on fail */ function reservation_detail_byID($detailID, &$details) { global $conn; if (!$conn) { $conn = connect_Hotel_db(HOST, USER, PASS, DB, PORT); } if (!$conn) { return 0; } if (!$detailID) { return 0; } $details = array(); $sql = "SELECT id,reservation_id,roomid,roomtypeid,ratesid,quantity,`status` \n\t\t\tFROM reservation_details \n\t\t\tWHERE id=" . $detailID; //print $sql."<br/>"; $stmt = $conn->prepare($sql); $results = $stmt->execute(); while ($row = $stmt->fetch()) { $details['id'] = $row['id']; $details['reservation_id'] = $row['reservation_id']; $details['roomid'] = $row['roomid']; $details['ratesid'] = $row['ratesid']; $details['quantity'] = $row['quantity']; $details['roomno'] = get_roomno($row['roomid']); $details['status'] = $row['status']; if ($row['roomid']) { $room = array(); get_room($row['roomid'], $room); $details['roomtypeid'] = $room['roomtypeid']; $details['roomtype'] = get_roomtype($room['roomtypeid']); } else { $details['roomtypeid'] = $row['roomtypeid']; $details['roomtype'] = get_roomtype($row['roomtypeid']); } $details['ratecode'] = get_ratecode($row['ratesid']); } return sizeof($details); }