Exemplo n.º 1
0
/*     |_|  \_\___|\___|\__|\__,_|___/ |____| /_/      */
/*                                                     */
/*                Date: 04/10/2015 17:41               */
/*                 All right reserved                  */
/*-----------------------------------------------------*/
use MealBooker\model\Location;
use MealBooker\models\dao\CourseDao;
use MealBooker\models\dao\DessertDao;
use MealBooker\models\dao\DrinkDao;
use MealBooker\models\dao\LocationDao;
use MealBooker\models\dao\TimeFrameDao;
$courseDao = new CourseDao($em);
$drinkDao = new DrinkDao($em);
$dessertDao = new DessertDao($em);
$timeFrameDao = new TimeFrameDao($em);
$locationDao = new LocationDao($em);
//prepare new value
$mealCart = new stdClass();
$mealCart->cart = [];
//get value from cookie if cookie already set
if (isset($_SESSION['mealCart'])) {
    $mealCart = json_decode($_SESSION['mealCart']);
}
//add new value in cookie
if ($_POST && isset($_POST['course']) && isset($_POST['ts'])) {
    //search for doubloon
    $found = false;
    foreach ($mealCart->cart as $stockedMeal) {
        if ($stockedMeal->id == $_POST['ts']) {
            $found = true;
        }
Exemplo n.º 2
0
<?php

/*-----------------------------------------------------*/
/*      _____           _               ___   ___      */
/*     |  __ \         | |             |__ \ / _ \     */
/*     | |__) |___  ___| |_ _   _ ___     ) | (_) |    */
/*     |  _  // _ \/ __| __| | | / __|   / / \__, |    */
/*     | | \ \  __/ (__| |_| |_| \__ \  / /_   / /     */
/*     |_|  \_\___|\___|\__|\__,_|___/ |____| /_/      */
/*                                                     */
/*                Date: 15/10/2015 23:55               */
/*                 All right reserved                  */
/*-----------------------------------------------------*/
use MealBooker\models\dao\LocationDao;
$localDao = new LocationDao($em);
?>
<div class="row">

    <table class="table table-striped">
        <thead>
        <tr>
            <th>#</th>
            <th>Libellé</th>
            <th>Statut</th>
            <th>Action</th>
        </tr>
        </thead>
        <tbody>
        <?php 
// @var $location Location
foreach ($localDao->getAll() as $location) {
Exemplo n.º 3
0
/*     | |__) |___  ___| |_ _   _ ___     ) | (_) |    */
/*     |  _  // _ \/ __| __| | | / __|   / / \__, |    */
/*     | | \ \  __/ (__| |_| |_| \__ \  / /_   / /     */
/*     |_|  \_\___|\___|\__|\__,_|___/ |____| /_/      */
/*                                                     */
/*                Date: 15/10/2015 23:55               */
/*                 All right reserved                  */
/*-----------------------------------------------------*/
use MealBooker\manager\SecurityManager;
use MealBooker\model\Location;
use MealBooker\model\TimeFrame;
use MealBooker\models\dao\LocationDao;
if (!SecurityManager::get()->getCurrentUser($_SESSION)->isAdmin()) {
    header('Location:' . WEB_PATH);
}
$locationDao = new LocationDao($em);
//save mode
if (isset($_POST['name']) && isset($_POST['id']) && isset($_POST['state'])) {
    // @var Location
    $location = $locationDao->getByPrimaryKey($_POST['id']);
    if ($location == null) {
        $location = new Location();
    }
    $location->setName($_POST['name']);
    $location->setStatus($_POST['state']);
    $locationDao->save($location);
    header('Location:' . WEB_PATH . '?page=admin&tab=location');
}
//view Mode
if (isset($_GET['id'])) {
    $location = $locationDao->getByPrimaryKey($_GET['id']);
Exemplo n.º 4
0
use MealBooker\manager\SecurityManager;
use MealBooker\model\Location;
use MealBooker\model\Meal;
use MealBooker\model\MealOrder;
use MealBooker\models\dao\CourseDao;
use MealBooker\models\dao\DessertDao;
use MealBooker\models\dao\DrinkDao;
use MealBooker\models\dao\LocationDao;
use MealBooker\models\dao\MealDao;
use MealBooker\models\dao\OrderDao;
use MealBooker\models\dao\TimeFrameDao;
$courseDao = new CourseDao($em);
$drinkDao = new DrinkDao($em);
$dessertDao = new DessertDao($em);
$timeFrameDao = new TimeFrameDao($em);
$locationDao = new LocationDao($em);
$orderDao = new OrderDao($em);
$mealDao = new MealDao($em);
//if no cart or not logged in
if (!isset($_SESSION['mealCart']) || !isset($_POST['location'])) {
    header('Location : ' . WEB_PATH);
    exit;
}
$mealCart = json_decode($_SESSION['mealCart']);
if (sizeof($mealCart->cart) > 0) {
    $order = new MealOrder();
    $order->setUser(SecurityManager::get()->getCurrentUser($_SESSION));
    //set time fram if provide
    //$timeframe = $timeFrameDao->getByPrimaryKey($_POST['timeframe']);
    //if ($timeframe != null)
    //    $order->setTimeFrame($timeframe);