<?php

require_once $_SERVER['DOCUMENT_ROOT'] . "/model/restaurant.php";
$restaurant = new Restaurant();
print_r($restaurant->deleteRestaurant($_POST['id']));
?>

            exit;
        }
        $action = $_POST['action'];
        if ($action != 'deleterestaurant') {
            header("Location: logout");
            exit;
        }
        if (!isset($_POST['id'])) {
            header("Location: restaurants");
            exit;
        }
        $restaurantid = $_POST['id'];
        try {
            $restaurant = Restaurant::get($restaurantid, $userid);
            $restaurantname = $restaurant->getProperty('name');
            Restaurant::deleteRestaurant($restaurantid, $userid);
            $formmessage = 'Restaurant "' . $restaurantname . '" deleted.';
            $formmessageclass = 'green';
            break;
        } catch (Exception $e) {
            $formmessage = $e->getMessage();
            trigger_error($formmessage);
            $formmessageclass = 'red';
            break;
        }
    } else {
        header("Location: logout");
        exit;
    }
} while (1 == 0);
include "common/sessionmessage.php";