Commit b32c8ed844196232e9c303f476e517aafa8dbece
1 parent
b1f73dd7
-Testing email
Showing
3 changed files
with
134 additions
and
16 deletions
Show diff stats
backend/controllers/RequestController.php
@@ -17,10 +17,10 @@ | @@ -17,10 +17,10 @@ | ||
17 | 'class' => Index::class, | 17 | 'class' => Index::class, |
18 | 'columns' => [ | 18 | 'columns' => [ |
19 | 'name' => [ | 19 | 'name' => [ |
20 | - 'type' => Index::ACTION_COL, | 20 | + 'type' => Index::ACTION_COL, |
21 | 'columnConfig' => [ | 21 | 'columnConfig' => [ |
22 | - 'buttonsTemplate' => '{edit}{delete}' | ||
23 | - ] | 22 | + 'buttonsTemplate' => '{edit}{delete}', |
23 | + ], | ||
24 | ], | 24 | ], |
25 | 'secondname' => [ | 25 | 'secondname' => [ |
26 | 'type' => Index::STRING_COL, | 26 | 'type' => Index::STRING_COL, |
1 | +<?php | ||
2 | + | ||
3 | + /** | ||
4 | + * @var \yii\web\View $this | ||
5 | + * @var \common\models\Customer $model | ||
6 | + */ | ||
7 | + | ||
8 | + use common\models\Customer; | ||
9 | + | ||
10 | + $formatter = \Yii::$app->formatter; | ||
11 | + | ||
12 | +?> | ||
13 | + | ||
14 | +<table> | ||
15 | + <tr> | ||
16 | + <td><b>Фамилия</b> :</td> | ||
17 | + <td><?= $formatter->asText($model->secondname) ?></td> | ||
18 | + </tr> | ||
19 | + <tr> | ||
20 | + <td><b>Имя</b> :</td> | ||
21 | + <td><?= $formatter->asText($model->name) ?></td> | ||
22 | + </tr> | ||
23 | + <tr> | ||
24 | + <td><b>Титул</b> :</td> | ||
25 | + <td><?= $formatter->asText($model->dignity) ?></td> | ||
26 | + </tr> | ||
27 | + <tr> | ||
28 | + <td><b>Пол</b> :</td> | ||
29 | + <td><?php | ||
30 | + if ($model->gender === Customer::MALE) { | ||
31 | + echo 'Мужской'; | ||
32 | + } elseif ($model->gender === Customer::FEMALE) { | ||
33 | + echo 'Женский'; | ||
34 | + } else { | ||
35 | + echo 'Не задано'; | ||
36 | + } | ||
37 | + ?></td> | ||
38 | + </tr> | ||
39 | + <tr> | ||
40 | + <td><b>Дата рождения</b> :</td> | ||
41 | + <td><?= $formatter->asText($model->birth) ?></td> | ||
42 | + </tr> | ||
43 | + <tr> | ||
44 | + <td><b>Гражданство</b> :</td> | ||
45 | + <td><?= $formatter->asText($model->citizenship) ?></td> | ||
46 | + </tr> | ||
47 | + <tr> | ||
48 | + <td><b>Паспорт</b> :</td> | ||
49 | + <td><?= $formatter->asText($model->passport) ?></td> | ||
50 | + </tr> | ||
51 | + <tr> | ||
52 | + <td><b>Email</b> :</td> | ||
53 | + <td><?= $formatter->asText($model->email) ?></td> | ||
54 | + </tr> | ||
55 | + <tr> | ||
56 | + <td><b>Должность</b> :</td> | ||
57 | + <td><?= $formatter->asText($model->organization) ?></td> | ||
58 | + </tr> | ||
59 | + <tr> | ||
60 | + <td><b>Министерская конференция</b> :</td> | ||
61 | + <td><?= $formatter->asBoolean($model->conference) ?></td> | ||
62 | + </tr> | ||
63 | + <tr> | ||
64 | + <td><b>GEEE</b> :</td> | ||
65 | + <td><?= $formatter->asBoolean($model->geee) ?></td> | ||
66 | + </tr> | ||
67 | + <tr> | ||
68 | + <td><b>GERE</b> :</td> | ||
69 | + <td><?= $formatter->asBoolean($model->gere) ?></td> | ||
70 | + </tr> | ||
71 | +</table> |
frontend/controllers/SiteController.php
1 | <?php | 1 | <?php |
2 | + | ||
2 | namespace frontend\controllers; | 3 | namespace frontend\controllers; |
3 | 4 | ||
4 | use artbox\core\models\Feedback; | 5 | use artbox\core\models\Feedback; |
@@ -12,7 +13,7 @@ | @@ -12,7 +13,7 @@ | ||
12 | use yii\web\Controller; | 13 | use yii\web\Controller; |
13 | use yii\web\Response; | 14 | use yii\web\Response; |
14 | use yii\web\UploadedFile; | 15 | use yii\web\UploadedFile; |
15 | - | 16 | + |
16 | /** | 17 | /** |
17 | * Site controller | 18 | * Site controller |
18 | */ | 19 | */ |
@@ -52,10 +53,22 @@ | @@ -52,10 +53,22 @@ | ||
52 | */ | 53 | */ |
53 | public function actionIndex() | 54 | public function actionIndex() |
54 | { | 55 | { |
55 | - $speakers = Speaker::find()->with(['language', 'image'])->where(['status' => true])->orderBy('sort')->all(); | ||
56 | - return $this->render('index', [ | ||
57 | - 'speakers' => $speakers | ||
58 | - ]); | 56 | + $speakers = Speaker::find() |
57 | + ->with( | ||
58 | + [ | ||
59 | + 'language', | ||
60 | + 'image', | ||
61 | + ] | ||
62 | + ) | ||
63 | + ->where([ 'status' => true ]) | ||
64 | + ->orderBy('sort') | ||
65 | + ->all(); | ||
66 | + return $this->render( | ||
67 | + 'index', | ||
68 | + [ | ||
69 | + 'speakers' => $speakers, | ||
70 | + ] | ||
71 | + ); | ||
59 | } | 72 | } |
60 | 73 | ||
61 | /** | 74 | /** |
@@ -154,15 +167,49 @@ | @@ -154,15 +167,49 @@ | ||
154 | public function actionRegister() | 167 | public function actionRegister() |
155 | { | 168 | { |
156 | $model = new Customer(); | 169 | $model = new Customer(); |
157 | - if ($model->load(\Yii::$app->request->post())){ | ||
158 | - $model->file = UploadedFile::getInstance($model, 'file'); | ||
159 | - if ($model->upload() and $model->save()){ | ||
160 | - \Yii::$app->session->setFlash('success', \Yii::t('app', 'Дякуемо за реєстрацію. Підтвердження участі буде відправлено на вказаний email')); | ||
161 | - return $this->redirect(['site/index']); | 170 | + if ($model->load(\Yii::$app->request->post())) { |
171 | + $model->file = UploadedFile::getInstance($model, 'file'); | ||
172 | + if ($model->upload() and $model->save()) { | ||
173 | + \Yii::$app->session->setFlash( | ||
174 | + 'success', | ||
175 | + \Yii::t( | ||
176 | + 'app', | ||
177 | + 'Дякуемо за реєстрацію. Підтвердження участі буде відправлено на вказаний email' | ||
178 | + ) | ||
179 | + ); | ||
180 | + | ||
181 | + $this->mail($model); | ||
182 | + | ||
183 | + return $this->redirect([ 'site/index' ]); | ||
162 | } | 184 | } |
163 | } | 185 | } |
164 | - return $this->render('signup', [ | ||
165 | - 'model' => $model | ||
166 | - ]); | 186 | + return $this->render( |
187 | + 'signup', | ||
188 | + [ | ||
189 | + 'model' => $model, | ||
190 | + ] | ||
191 | + ); | ||
192 | + } | ||
193 | + | ||
194 | + /** | ||
195 | + * @param $model Customer | ||
196 | + */ | ||
197 | + public function mail($model) | ||
198 | + { | ||
199 | + \Yii::$app->mailer->compose( | ||
200 | + 'request', | ||
201 | + [ | ||
202 | + 'model' => $model, | ||
203 | + ] | ||
204 | + ) | ||
205 | + ->setFrom( | ||
206 | + [ | ||
207 | + 'artboxcore@gmail.com' => 'Artbox Core', | ||
208 | + ] | ||
209 | + ) | ||
210 | + ->setTo('kennen.md@gmail.com') | ||
211 | + ->setSubject('U have request!') | ||
212 | + ->attach(\Yii::getAlias('@' . trim($model->image, '/'))) | ||
213 | + ->send(); | ||
167 | } | 214 | } |
168 | } | 215 | } |