예제 #1
0
$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);
$timeMessage = null;
$from = NULL;
$to = null;
if (!empty($oprHours)) {
    $oprHours = $oprHours[0];
    date_default_timezone_set("America/Los_Angeles");
    $today = getdate();
    switch ($today["weekday"]) {
        case "Monday":
            $from = $oprHours["monday_from"];
            $to = $oprHours["monday_to"];
            break;
        case "Tuesday":
예제 #2
0
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
     */
    if (isset($_POST['image_type'])) {
        switch ($_POST['image_type']) {
            case 'profile':
                if (is_uploaded_file($_FILES['profile-image']['tmp_name'])) {