Beispiel #1
0
<?php

require_once "../includes/initialize.php";
if (empty($_GET['id'])) {
    redirect_to('index.php');
}
$hotel = Hotel::find_by_id($_GET['id']);
if (!$hotel) {
    redirect_to('index.php');
}
$rule = Rules::find_hotel_rules($hotel->id);
$rooms = $hotel->rooms();
$photos = Photograph::find_by_hotel_id($hotel->id);
$city = City::find_by_id($hotel->city_id);
if ($session->is_logged_in()) {
    $user = User::find_by_id($session->user_id);
}
$five_hotels = Hotel::find_five_hotels($hotel->city_id);
$comments = $hotel->comments();
$last_comment = $hotel->last_comment($hotel->id);
?>
<!DOCTYPE html>
<html>
<head>
	<title>Bookingmc</title>
	<link rel="stylesheet" type="text/css" href="css/reset.css">
	<link rel="stylesheet" type="text/css" href="css/font-awesome.css">
	<link rel="stylesheet" type="text/css" href="css/demo.css">
	<link rel="stylesheet" type="text/css" href="css/flexslider.css">
	<link rel="stylesheet" type="text/css" href="css/bootstrap.min.css">
	<link rel="stylesheet" type="text/css" href="css/bootstrap-theme.min.css">
Beispiel #2
0
if ($rule) {
    $check_in = $rule->check_in;
    $check_out = $rule->check_out;
    $cancel = $rule->cancel;
    $pet = $rule->pet;
    $check = true;
} else {
    $check = false;
    $check_in = "";
    $check_out = "";
    $cancel = "";
    $pet = "";
}
if (isset($_POST['submit_short_info'])) {
    if (!empty(Rules::find_hotel_rules($hotel->id))) {
        $info = Rules::find_hotel_rules($hotel->id);
        if (empty($_POST['check_in']) || empty($_POST['check_out']) || empty($_POST['cancel']) || empty($_POST['pet'])) {
            $message = "you have to fill all the fields";
        } else {
            $info->hotel_id = $hotel->id;
            $info->check_in = $_POST['check_in'];
            $info->check_out = $_POST['check_out'];
            $info->cancel = $_POST['cancel'];
            $info->pet = $_POST['pet'];
            if ($info->update()) {
                $session->message("Successfully updated");
                redirect_to("more_info.php?id={$hotel->id}");
            } else {
                $session->message(join("<br>", $info->errors));
                redirect_to("more_info.php?id={$hotel->id}");
            }