Example #1
0
    $userName = explode(" ", $userInfo['name']);
    $userNameFirst = $userName[0];
    if (sizeof($userName) > 1) {
        $userNameLast = $userName[1];
    } else {
        $userNameLast = " ";
    }
}
if (!isset($db)) {
    $db = new Restaurant_model();
}
if (empty($foodCategoryArray)) {
    $foodCategoryArray = $db->getFoodCategories();
}
if (!isset($reservation)) {
    $reservation = new Reservation_controller();
}
if ($_POST) {
    $reservationArray = $reservation->add();
}
if ($_GET) {
    $nameAddCat = empty($_GET['searchText']) ? '%' : htmlspecialchars($_GET['searchText']);
    $currentPage = isset($_GET['pgnum']) ? htmlspecialchars($_GET['pgnum']) : 1;
    $totalCount = $db->findRestaurantsCount($nameAddCat);
    $restaurant_array = $db->findRestaurantsLimitOffset($nameAddCat, N_PER_PAGE, ($currentPage - 1) * N_PER_PAGE);
    //        var_dump($totalCount);
    //        echo '<br>';
    //        var_dump($restaurant_array);
    //        exit();
    if ($nameAddCat == '%') {
        $restaurantListTitle = "All Restaurants (" . $totalCount . " total)";
Example #2
0
                }

                if (time === null || time === "") {
                    alert("Time must be filled out.");
                    return false;
                }
            }
        </script>
    </head>
    <body>
        <?php 
$res = __DIR__ . '/../../controllers/Reservation_controller.php';
require_once $res;
$res2 = __DIR__ . '/../../models/Reservation_model.php';
require_once $res2;
$reservation = new Reservation_controller();
if (!isset($db)) {
    $db = new Reservation_model();
}
if (empty($restaurantNameArray)) {
    $restaurantNameArray = $reservation->getRestaurantNamesAll();
}
if ($_POST) {
    $reservation->add();
}
?>
        <nav class ="navbar navbar-default">
            <div class ="container-fluid">
                <div class ="navbar-header">
                    <a class="navbar-brand" href="index.php">TableMe</a>
                </div>