|
|
|
|
|
|
|
|
namespace backend\controllers; |
|
|
namespace backend\controllers; |
|
|
|
|
|
|
|
|
use common\models\User ; |
|
|
use common\models\User ; |
|
|
|
|
|
use common\models\Producer ; |
|
|
|
|
|
use backend\models\MailForm ; |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
* UserController implements the CRUD actions for User model. |
|
|
* UserController implements the CRUD actions for User model. |
|
|
|
|
|
|
|
|
if($idPointSale) { |
|
|
if($idPointSale) { |
|
|
$pointSale = PointSale::findOne(['id' => $idPointSale]) ; |
|
|
$pointSale = PointSale::findOne(['id' => $idPointSale]) ; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
$mailForm = new MailForm() ; |
|
|
|
|
|
if ($mailForm->load(Yii::$app->request->post()) && $mailForm->validate()) { |
|
|
|
|
|
$resultSendEmail = $mailForm->sendEmail($users) ; |
|
|
|
|
|
if($resultSendEmail) { |
|
|
|
|
|
Yii::$app->getSession()->setFlash('success', 'Votre email a bien été envoyé.'); |
|
|
|
|
|
} |
|
|
|
|
|
else { |
|
|
|
|
|
Yii::$app->getSession()->setFlash('error', 'Un problème est survenu lors de l\'envoi de votre email.'); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
return $this->redirect(['mail','idPointSale' => $idPointSale]); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
return $this->render('emails', [ |
|
|
return $this->render('emails', [ |
|
|
'usersArray' => $usersArray, |
|
|
'usersArray' => $usersArray, |
|
|
'pointsSaleArray' => $pointsSaleArray, |
|
|
'pointsSaleArray' => $pointsSaleArray, |
|
|
'pointSale' => $pointSale |
|
|
|
|
|
|
|
|
'pointSale' => $pointSale, |
|
|
|
|
|
'mailForm' => $mailForm, |
|
|
]); |
|
|
]); |
|
|
} |
|
|
} |
|
|
|
|
|
|