Exemple #1
0
use MealBooker\models\dao\DessertDao;
use MealBooker\models\dao\DrinkDao;
use MealBooker\models\dao\OrderDao;
use MealBooker\models\dao\TimeFrameDao;
use MealBooker\utils\Utils;
$courseDao = new CourseDao($em);
$drinkDao = new DrinkDao($em);
$dessertDao = new DessertDao($em);
$timeFrameDao = new TimeFrameDao($em);
$MealOrderDao = new OrderDao($em);
//if no ID go to home
if (!isset($_GET['courseID'])) {
    header("location:" . WEB_PATH);
}
/** @var $course  Course */
$course = $courseDao->getByPrimaryKey($_GET['courseID']);
$message = null;
//if no course found go to home
if ($course == null) {
    header("location:" . WEB_PATH);
}
$orderEnable = true;
if (!Utils::isOrderEnable()) {
    //check time
    $message = "Réservations non disponibles de 18h à 7h du matin";
    $orderEnable = false;
}
?>
<script type="text/javascript">
    $(document).on('click', '#mealForm input[type="submit"]', function (e) {
        e.preventDefault();
Exemple #2
0
                <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 : "-";
        ?>
                        </td>
                        <td>
                            <a href="<?php 
        WEB_PATH;
 $order->setUser(SecurityManager::get()->getCurrentUser($_SESSION));
 //set time fram if provide
 //$timeframe = $timeFrameDao->getByPrimaryKey($_POST['timeframe']);
 //if ($timeframe != null)
 //    $order->setTimeFrame($timeframe);
 //set location
 $location = $locationDao->getByPrimaryKey($_POST['location']);
 if ($location != null) {
     $order->setLocation($location);
 }
 //fill order with meal
 $mealArray = array();
 foreach ($mealCart->cart as $mealStub) {
     $drink = $drinkDao->getByPrimaryKey($mealStub->drink);
     $dessert = $dessertDao->getByPrimaryKey($mealStub->dessert);
     $course = $courseDao->getByPrimaryKey($mealStub->course);
     if ($drink != null && $course != null) {
         $meal = new Meal();
         $meal->setBookingId($mealStub->id);
         if ($drink != null) {
             $meal->setDrink($drink);
         }
         if ($dessert != null) {
             $meal->setDessert($dessert);
         }
         $meal->setCourse($course);
         $meal->setOrder($order);
         array_push($mealArray, $meal);
     }
 }
 $order->setMeals($mealArray);
Exemple #4
0
/*                                                     */
/*                Date: 15/10/2015 23:55               */
/*                 All right reserved                  */
/*-----------------------------------------------------*/
use MealBooker\manager\SecurityManager;
use MealBooker\model\Course;
use MealBooker\models\dao\CourseDao;
if (!SecurityManager::get()->getCurrentUser($_SESSION)->isAdmin()) {
    header('Location:' . WEB_PATH);
}
$courseDao = new CourseDao($em);
$error = null;
$info = null;
//save mode
if (isset($_POST['name']) && isset($_POST['desc']) && isset($_POST['shortDesc']) && isset($_POST['id']) && isset($_POST['state'])) {
    $course = $courseDao->getByPrimaryKey($_POST['id']);
    if ($course == null) {
        $course = new Course();
    }
    $course->setName($_POST['name']);
    $course->setShortDescription($_POST['shortDesc']);
    $course->setDescription($_POST['desc']);
    $course->setStatus($_POST['state']);
    if (isset($_POST['nb'])) {
        $course->setNbPerDay($_POST['nb']);
    }
    $courseDao->save($course);
    if (isset($_FILES['img']) && $_FILES['img']['size'] > 0) {
        try {
            $uploaddir = FILE_DIR . "course/";
            $uploadfile = $uploaddir . basename($_FILES['img']['name']);
Exemple #5
0
                    <th><?php 
    echo $tf->getStart();
    ?>
</th>
                    <?php 
}
?>
            </tr>
            </thead>
            <tbody>
            <?php 
foreach ($courses as $course => $courseData) {
    ?>
                <tr>
                    <td><?php 
    echo $courseDao->getByPrimaryKey($course);
    ?>
</td>
                    <?php 
    foreach ($courseData as $tf => $val) {
        ?>
                        <td><?php 
        echo $val;
        ?>
</td>
                        <?php 
    }
    ?>
                </tr>
                <?php 
}