Esempio n. 1
0
    /**
     * send order confirmation mail
     * @param User $user
     * @param MealOrder $order
     * @return bool
     * @throws Exception
     */
    public static function sendOrderConfirmation($user, $order)
    {
        self::$mail->addAddress($user->getMail());
        self::$mail->Subject = 'Confirmation de votre commande Aurore traiteur';
        self::$mail->Body = '
        <table width="480px"  style"width:480px;">
            <tbody>
                <tr style="background: black;">
                    <td><img src="' . SERVER_URL . WEB_PATH . 'img/logo_mail.jpg"></td>
                </tr>
                <tr>
                    <td>
                        Bonjour,<br/>
                        <br />
                        Votre commande #' . sprintf("%04s", $order->getId()) . ' est valid&eacute;e,<br />
                        <br />
                        A bient&ocirc;t sur <a href="http://aurore-traiteur.fr">aurore-traiteur.fr</a>
                    </td>
                </tr>
            </tbody>
	    </table>';
        if (!self::$mail->send()) {
            throw new Exception("Message could not be sent - " . self::$mail->ErrorInfo);
        } else {
            return true;
        }
    }
Esempio n. 2
0
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);
    //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);