public static function run() { if ($_SERVER["REQUEST_METHOD"] == "POST") { $map = new Map($_POST); MapView::show($map->getLocations()); } else { MapView::show(null); } }
public static function run() { $map = MapDatabase::getMapByName("europe"); if ($_SERVER["REQUEST_METHOD"] == "POST") { if (!isset($_POST["location"])) { MapView::show($map); } else { $location = $_POST["location"]; if (!($newMap = MapDatabase::getMapByName($location))) { MapView::show($map); } else { MapView::show($newMap); } } } else { MapView::show($map); } }
public static function run($map) { if (CookieController::cookieExists("session")) { if (($user = CookieController::readSessionCookie()) !== false) { $map; if ($_SERVER["REQUEST_METHOD"] == "POST") { $mapID = ""; $mapName = ""; $latLng = ""; if (isset($_POST["map-id"])) { $mapID = $_POST["map-id"]; } if (isset($_POST["map-name"])) { $mapName = $_POST["map-name"]; } if (isset($_POST["lat-lng"])) { $latLng = $_POST["lat-lng"]; } $map = new Map($mapID, $mapName, $latLng); if (empty($mapID)) { MapDatabase::addMap($map, $user->getID()); } else { MapDatabase::updateMap($map); } MapView::show($map); } else { if (isset($_GET["selection"])) { $mapID = $_GET["selection"]; $map = MapDatabase::getMap($mapID); } MapView::show($map); } } else { header("Location: home"); } } else { header("Location: home"); } }
<!DOCTYPE html> <html> <head> <title>MapView Tests</title> </head> <body> <h1>MapView Tests</h1> <h3>Should call MapView::show()</h3> <hr/> <?php include_once "../includer.php"; $map = new Map(null); $map->addLocation("Rome"); MapView::show($map->getLocations()); ?> </body> </html>