door manager

This commit is contained in:
Schneider Roland
2022-05-04 19:41:18 +02:00
parent fb39d6599e
commit 946799a598
20 changed files with 8872 additions and 220 deletions

View File

@@ -12,7 +12,6 @@ use yii\filters\AccessControl;
use yii\web\Controller;
use yii\web\NotFoundHttpException;
use yii\filters\VerbFilter;
use yii\base\Object;
use backend\models\CustomerUpdate;
use backend\models\CustomerNewsLetterModel;
use yii\db\Query;
@@ -24,7 +23,7 @@ use yii\data\ActiveDataProvider;
class CustomerController extends \backend\controllers\BackendController
{
public function behaviors()
{
@@ -130,10 +129,10 @@ class CustomerController extends \backend\controllers\BackendController
public function actionCreate()
{
$model = new CustomerCreate();
$model->country = "Magyarország";
$model->id_user = Yii::$app->user->id;
if ($model->load(Yii::$app->request->post()) && $model->save()) {
return $this->redirect(['view', 'id' => $model->id_customer]);
@@ -157,9 +156,9 @@ class CustomerController extends \backend\controllers\BackendController
if (($model = CustomerUpdate::findOne($id)) == null) {
throw new NotFoundHttpException('The requested page does not exist.');
}
$model->birthdate= isset($model->birthdate ) ? Yii::$app->formatter->asDate($model->birthdate) :'';
if ($model->load(Yii::$app->request->post()) && $model->save()) {
return $this->redirect(['view', 'id' => $model->id_customer]);
@@ -198,24 +197,24 @@ class CustomerController extends \backend\controllers\BackendController
throw new NotFoundHttpException('The requested page does not exist.');
}
}
public function actionMail(){
$model = new CustomerNewsLetterModel();
$query = new Query();
$query->distinct();
$query->select([ 'email']);
$query->from("customer");
$query->andWhere(['newsletter' => 1]);
$query->andWhere(['status' => Customer::STATUS_ACTIVE]);
if ($model->load(Yii::$app->request->post()) && $model->validate()) {
$message = \Yii::$app->mailer->compose ( );
$message
->setFrom ( "noreply@fitnessadmin.hu" )
->setBcc(['rocho02@gmail.com',"rocho02@freemail.hu"])
@@ -225,9 +224,9 @@ class CustomerController extends \backend\controllers\BackendController
->send ();
return $this->redirect(['customer/mail']);
}
return $this->render('mail', [ 'model' => $model ]);
}
}