Example #1
0
/*     | | \ \  __/ (__| |_| |_| \__ \  / /_   / /     */
/*     |_|  \_\___|\___|\__|\__,_|___/ |____| /_/      */
/*                                                     */
/*                Date: 15/10/2015 23:55               */
/*                 All right reserved                  */
/*-----------------------------------------------------*/
use MealBooker\manager\SecurityManager;
use MealBooker\model\Dessert;
use MealBooker\models\dao\DessertDao;
if (!SecurityManager::get()->getCurrentUser($_SESSION)->isAdmin()) {
    header('Location:' . WEB_PATH);
}
$dessertDao = new DessertDao($em);
//save mode
if (isset($_POST['name']) && isset($_POST['desc']) && isset($_POST['id']) && isset($_POST['state'])) {
    $dessert = $dessertDao->getByPrimaryKey($_POST['id']);
    if ($dessert == null) {
        $dessert = new Dessert();
    }
    $dessert->setName($_POST['name']);
    $dessert->setDescription($_POST['desc']);
    $dessert->setStatus($_POST['state']);
    $dessertDao->save($dessert);
    header('Location:' . WEB_PATH . '?page=admin&tab=dessert');
}
//view Mode
if (isset($_GET['id'])) {
    $dessert = $dessertDao->getByPrimaryKey($_GET['id']);
    if ($dessert == null) {
        header('Location:' . WEB_PATH);
    }
Example #2
0
        </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 
        echo $dessert != null ? $dessert : "-";
Example #3
0
                    <th><?php 
    echo $tf->getStart();
    ?>
</th>
                    <?php 
}
?>
            </tr>
            </thead>
            <tbody>
            <?php 
foreach ($desserts as $dessert => $dessertData) {
    ?>
                <tr>
                    <td><?php 
    echo $dessertDao->getByPrimaryKey($dessert);
    ?>
</td>
                    <?php 
    foreach ($dessertData as $tf => $val) {
        ?>
                        <td><?php 
        echo $val;
        ?>
</td>
                        <?php 
    }
    ?>
                </tr>
                <?php 
}