<?php //index.php use DrankProject\Exceptions\VoorraadLeegException; use DrankProject\Business\DrankenService; require_once "Bootstrap.php"; require_once "Libraries/Twig/AutoLoader.php"; $drankSvc = new DrankenService(); $drankenLijst = $drankSvc->getDrankenOverzicht(); session_start(); if (isset($_GET["bedrag"])) { $_SESSION["totaal"] += $_GET["bedrag"]; } $wissel = ""; if (!isset($_GET["keuze"])) { } else { $check = $drankSvc->checkTotaalIngegeven($_SESSION["totaal"], $_GET["keuze"]); if ($check) { $wissel = $drankSvc->berekenWissel($_SESSION["totaal"], $_GET["keuze"]); try { $drankSvc->updateVoorraad($_GET["keuze"]); $_SESSION["totaal"] = 0; } catch (VoorraadLeegException $ex) { header("location: index.php?error=voorraadleeg"); exit(0); } } if (!isset($_GET["error"])) { $errorVoorraad = false; } else { if (isset($_GET["error"]) && $_GET["error"] == "voorraadleeg") {
<?php //use DrankProject\Exceptions\VoorraadLeegException; use DrankProject\Business\DrankenService; //use DrankProject\Business\MuntenService; require_once "Bootstrap.php"; require_once "Libraries/Twig/AutoLoader.php"; $drankSvc = new DrankenService(); $drankenLijst = $drankSvc->getDrankenOverzicht(); if (isset($_GET["action"]) && $_GET["action"] == "voegtoe") { $bijvullen = true; if (isset($_GET["artikel"])) { try { $drankSvc->voegDrankToe($_GET["artikel"], $_POST["aantalBijvullen"]); header("location:bijvullen.php"); exit(0); } catch (AantalTeHoogException $ex) { header("location:bijvullen.php?error=tehoog"); exit(0); } } } else { $bijvullen = false; } if (isset($_GET["error"]) && $_GET["error"] == "tehoog") { $errorTeHoog = true; } else { $errorTeHoog = false; } $view = $twig->render("Bijvullen.twig", array("drankenLijst" => $drankenLijst, "bijvullen" => $bijvullen, "errorTeHoog" => $errorTeHoog)); print $view;
<?php //test.php use DrankProject\Business\DrankenService; require_once "Bootstrap.php"; $drankSvc = new DrankenService(); $drankenLijst = $drankSvc->getRestVoorraad(6); print "<pre>"; print_r($drankenLijst); print "</pre>"; /*u<?php //test.php se DrankProject\Data\DrankDAO; require_once("Bootstrap.php"); $dao = new DrankDAO(); $lijst = $dao->getAll(); print("<pre>"); var_dump($lijst); print("</pre>");*/