/* |_| \_\___|\___|\__|\__,_|___/ |____| /_/ */ /* */ /* Date: 15/10/2015 23:55 */ /* All right reserved */ /*-----------------------------------------------------*/ use MealBooker\manager\SecurityManager; use MealBooker\model\Course; use MealBooker\model\Drink; use MealBooker\models\dao\DrinkDao; if (!SecurityManager::get()->getCurrentUser($_SESSION)->isAdmin()) { header('Location:' . WEB_PATH); } $drinkDao = new DrinkDao($em); //save mode if (isset($_POST['name']) && isset($_POST['desc']) && isset($_POST['id']) && isset($_POST['state'])) { $drink = $drinkDao->getByPrimaryKey($_POST['id']); if ($drink == null) { $drink = new Drink(); } $drink->setName($_POST['name']); $drink->setDescription($_POST['desc']); $drink->setStatus($_POST['state']); $drinkDao->save($drink); header('Location:' . WEB_PATH . '?page=admin&tab=drink'); } //view Mode if (isset($_GET['id'])) { $drink = $drinkDao->getByPrimaryKey($_GET['id']); if ($drink == null) { header('Location:' . WEB_PATH); }
Mes commandes </h2> <table class="table table-striped"> <thead> <tr> <th>Plats</th> <th>Boissons</th> <th>Desserts</th> <th>Actions</th> </tr> </thead> <tbody> <?php if (sizeof($mealCart->cart) > 0) { foreach ($mealCart->cart as $meal) { $drink = $drinkDao->getByPrimaryKey($meal->drink); $dessert = $dessertDao->getByPrimaryKey($meal->dessert); ?> <tr> <td> <?php echo $courseDao->getByPrimaryKey($meal->course); ?> </td> <td> <?php echo $drink != null ? $drink : "-"; ?> </td> <td> <?php
<th><?php echo $tf->getStart(); ?> </th> <?php } ?> </tr> </thead> <tbody> <?php foreach ($drinks as $drink => $drinkData) { ?> <tr> <td><?php echo $drinkDao->getByPrimaryKey($drink); ?> </td> <?php foreach ($drinkData as $tf => $val) { ?> <td><?php echo $val; ?> </td> <?php } ?> </tr> <?php }