Exemplo n.º 1
0
require_once __DIR__ . '/../../models/OperationHours_model.php';
require_once __DIR__ . '/../../models/Event_model.php';
require_once __DIR__ . '/../../controllers/Reservation_controller.php';
require_once __DIR__ . '/../../models/User_model.php';
$reservation;
if (!isset($reservation)) {
    $reservation = new Reservation_controller();
}
//sanitize $_POST array
$_POST = filter_input_array(INPUT_POST);
if ($_POST) {
    $reservationArray = $reservation->add();
}
$restaurantDb = new Restaurant_model();
$resId = array_key_exists('resid', $_GET) ? htmlspecialchars($_GET['resid']) : 0;
$restaurant = $restaurantDb->findRestaurantById($resId);
if (empty($restaurant)) {
    echo '<h1>Restaurant with $resId=' . $resId . ' does not exist </h1>';
    return;
}
$resName = $restaurant['name'];
$foodCategory = $restaurant['food_category_name'];
$description = $restaurant['description'];
$menu = base64_encode($restaurant['menu']);
$address = $restaurant['address'];
$phone = $restaurant['phone_no'];
//        $imgArray = $db->getRestaurantImages($resId);
$eventModel = new Event_model();
$events = $eventModel->getEventsByRestaurantId($resId);
$operatingHoursModel = new OperationHours_model();
$oprHours = $operatingHoursModel->getOperatingHoursByRestaurantId($resId);
Exemplo n.º 2
0
if (!isset($_SESSION)) {
    session_start();
}
require_once 'Controller.php';
require_once __DIR__ . '/../models/Restaurant_model.php';
require_once __DIR__ . '/../models/Owner_model.php';
require_once __DIR__ . '/../models/Event_model.php';
require_once __DIR__ . '/../models/Hostess_model.php';
require_once __DIR__ . '/../models/Login_model.php';
require_once __DIR__ . '/../models/OperationHours_model.php';
$username = $_SESSION['username'];
$ownerDb = new Owner_model();
$ownerInfo = $ownerDb->getOwnerInfo($username);
$resId = intval($ownerInfo['restaurant_id']);
$restaurantDb = new Restaurant_model();
$restaurantInfo = $restaurantDb->findRestaurantById($resId);
$restaurantImages = $restaurantDb->getRestaurantImages($resId);
$imageCount = count($restaurantImages) >= 4 ? 4 : count($restaurantImages);
//total number of images for the restaurant in multimedia table
$foodCategory = $restaurantDb->getFoodCategories();
$reviewArray = $restaurantDb->getRestaurantReviews($resId);
$oprDb = new OperationHours_model();
$oprHours = $oprDb->getOperatingHoursByRestaurantId($resId);
$eventDb = new Event_model();
$eventArray = $eventDb->getEventsByRestaurantId($resId);
$hostessDb = new Hostess_model();
$hostessArray = $hostessDb->getHostessByRestaurantId($resId);
$loginDb = new Login_model();
$existingUsernames = $loginDb->getAllUsernames();
if (!empty($oprHours)) {
    $oprHours = $oprHours[0];