$overzicht[$key]['brood_naam'] = $broden->getNaam(); $overzicht[$key]['brood_prijs'] = $broden->getPrijs(); $overzicht[$key]['brood_image'] = $broden->getImage(); $overzicht[$key]['totaalBroodPrijs'] = $_SESSION['bestelling'][$key][$broden->getId()]['broodPrijs']; // echo "<pre>"; // print_r($_SESSION['bestelling'][$key][$bestelKey]); // echo "</pre>"; } /** * Getting 'Beleg' list */ if (is_array($bestelRegel)) { $totPrijs[$key] = 0; foreach ($bestelRegel as $belegKey => $belegRegel) { if (is_int($belegKey)) { $objBeleg = new BelegBusiness(); $belegen = $objBeleg->overzichtBelegById($belegKey); $eenBeleg = $belegen[0]; $overzicht[$key]['beleg'][] = $eenBeleg->getNaam(); $totPrijs[$key] = $totPrijs[$key] + $_SESSION['bestelling'][$key][$bestelKey][$belegKey]; // $_SESSION['bestelling'][$key][$bestelKey]['broodPrijs'] = $_SESSION['bestelling'][$key][$bestelKey]['broodPrijs'] + $_SESSION['bestelling'][$key][$bestelKey][$belegKey]; } unset($_SESSION['bestelling'][$key][$bestelKey]['sendButton']); // Removes 'sendButton' from session array } $_SESSION['bestelling'][$key]['sandwichPrijs'] = $totPrijs[$key] + $overzicht[$key]['brood_prijs']; $totaalBestellingPrijs = $_SESSION['bestelling'][$key]['sandwichPrijs'] * $_SESSION['bestelling'][$key]['aantal'] + $totaalBestellingPrijs; $overzicht[$key]['sandwichPrijs'] = $_SESSION['bestelling'][$key]['sandwichPrijs']; } } }
/** * todo: controle van broodje ID toevoegen, zodat bij een verkeerde ID naar index.php verwezen wordt. */ if (!empty($_GET['id'])) { /** * Connect with Doctrine. * Load ClassLoader to autoload classes. */ require_once 'Doctrine/Common/ClassLoader.php'; $classLoader = new ClassLoader("src"); $classLoader->register(); /** * Create 'Beleg' object from BelegBusiness class. * Get all 'Beleg' records from database. */ $obj = new BelegBusiness(); $belegen = $obj->overzichtBeleg(); $objBrood = new BroodBusiness(); $broden = $objBrood->overzichtBroodById($_GET['id']); /** * Connect to Twig. * Load beleg.twig file. * Send array $belegen and $_GET variable to beleg.twig. */ require_once "lib/Twig/Autoloader.php"; Twig_Autoloader::register(); $loader = new Twig_Loader_Filesystem("src/ProjectBrood/presentation"); $twig = new Twig_Environment($loader); $view = $twig->render("beleg.twig", array("self" => $_SERVER['REQUEST_URI'], "belegen" => $belegen, "brood_id" => $_GET['id'], "authorized" => $_SESSION['user']['authorized'], "brood_prijs" => $broden->getPrijs(), "totaalBestellingPrijs" => $_SESSION['totaalBestellingPrijs'])); print $view; } else {