$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)"; } else { $restaurantListTitle = "Your search found " . $totalCount . ($totalCount > 1 ? " restaurants" : " restaurant"); }
</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> <div> <ul class="nav navbar-nav navbar-right"> <li class="dropdown"><a class="dropdown-toggle" data-toggle="dropdown" href="#"> Register <span class="caret"></span></a> <ul class="dropdown-menu"> <li><a href="#UserRegister">User</a></li> <li><a href="#RestaurantRegister">Restaurant</a></li> </ul> </li>