$userModel = new User_model(); $userInfo = $userModel->getUser($_SESSION['username']); $userEmail = $userInfo['email']; $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);
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]; } if ($_POST) { /* * For uploading images