a63b5418
Administrator
first_commit
|
1
2
3
|
<?php
namespace frontend\controllers;
|
89d4b5ac
Administrator
VItaliy 25.11.2015
|
4
|
use common\models\Accounts;
|
1ec3afef
Administrator
VItaliy 27.11.2015
|
5
|
use common\models\News;
|
25545a10
Administrator
VItaliy 30.11.2015
|
6
|
use common\models\Slider;
|
89d4b5ac
Administrator
VItaliy 25.11.2015
|
7
8
|
use common\models\Team;
use common\models\TeamGroup;
|
a63b5418
Administrator
first_commit
|
9
|
use Yii;
|
27b0cb06
Administrator
VItaliy 02.12.2015
|
10
|
use common\models\UserLoginForm;
|
a63b5418
Administrator
first_commit
|
11
12
13
14
15
16
17
18
19
|
use frontend\models\PasswordResetRequestForm;
use frontend\models\ResetPasswordForm;
use frontend\models\SignupForm;
use frontend\models\ContactForm;
use yii\base\InvalidParamException;
use yii\web\BadRequestHttpException;
use yii\web\Controller;
use yii\filters\VerbFilter;
use yii\filters\AccessControl;
|
068f769f
Administrator
first commit from...
|
20
21
|
use common\models\Callback;
use common\components\MailWidget;
|
a63b5418
Administrator
first_commit
|
22
23
24
25
26
|
/**
* Site controller
*/
class SiteController extends Controller
{
|
7b407169
Administrator
upload project
|
27
|
|
89d4b5ac
Administrator
VItaliy 25.11.2015
|
28
|
// public $enableCsrfValidation = false;
|
a63b5418
Administrator
first_commit
|
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
|
/**
* @inheritdoc
*/
public function actions()
{
return [
'error' => [
'class' => 'yii\web\ErrorAction',
],
'captcha' => [
'class' => 'yii\captcha\CaptchaAction',
'fixedVerifyCode' => YII_ENV_TEST ? 'testme' : null,
],
];
}
/**
* Displays homepage.
*
* @return mixed
*/
public function actionIndex()
{
|
27b0cb06
Administrator
VItaliy 02.12.2015
|
53
|
|
394e2db6
Administrator
Importers CRUD
|
54
|
$this->layout = '/outer';
|
068f769f
Administrator
first commit from...
|
55
|
|
1ec3afef
Administrator
VItaliy 27.11.2015
|
56
|
$news_list = News::find()->where(['is_active'=>1])->limit(3)->all();
|
25545a10
Administrator
VItaliy 30.11.2015
|
57
|
$slider_list = Slider::find()->where(['is_active'=>1])->all();
|
068f769f
Administrator
first commit from...
|
58
59
60
61
62
63
64
65
66
|
if (Yii::$app->request->post()) {
$post = Yii::$app->request->post();
if(isset($post['Callback'])){
$text = "Имя: ".$post['Callback']['name'].'<br>';
$text .= "Телефон: ".$post['Callback']['phone_num'];
$model = new Callback();
$model->load(Yii::$app->request->post());
$model->save();
|
ad4b55bc
Administrator
VItaliy 26.11.2015
|
67
|
MailWidget::widget(['email' => 'ital-auto@test.com', 'text' => $text, 'subject' => 'Обратный звонок']);
|
068f769f
Administrator
first commit from...
|
68
69
70
|
}
}
|
1ec3afef
Administrator
VItaliy 27.11.2015
|
71
|
return $this->render('index',[
|
25545a10
Administrator
VItaliy 30.11.2015
|
72
|
'slider_list' => $slider_list,
|
1ec3afef
Administrator
VItaliy 27.11.2015
|
73
74
|
'news_list' => $news_list
]);
|
a63b5418
Administrator
first_commit
|
75
76
|
}
|
394e2db6
Administrator
Importers CRUD
|
77
78
79
80
81
82
83
84
85
86
|
public function actionNotFound()
{
$this->layout = '/internal';
return $this->render('not-found');
}
public function action404()
{
$this->layout = '/internal';
return $this->render('404');
}
|
7b407169
Administrator
upload project
|
87
|
|
394e2db6
Administrator
Importers CRUD
|
88
|
|
25545a10
Administrator
VItaliy 30.11.2015
|
89
|
public function actionTeam()
|
394e2db6
Administrator
Importers CRUD
|
90
|
{
|
25545a10
Administrator
VItaliy 30.11.2015
|
91
92
|
$teamGroups = TeamGroup::find()->all();
|
394e2db6
Administrator
Importers CRUD
|
93
|
$this->layout = '/internal';
|
25545a10
Administrator
VItaliy 30.11.2015
|
94
95
96
97
|
return $this->render('team',[
'teamGroups' => $teamGroups,
]);
|
394e2db6
Administrator
Importers CRUD
|
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
|
}
public function actionBc2Catalog()
{
$this->layout = '/internal';
return $this->render('BC2_catalog');
}
public function actionBc2CatalogZapchasti()
{
$this->layout = '/internal';
return $this->render('BC2_catalog_zapchasti');
}
public function actionBrands()
{
$this->layout = '/internal';
return $this->render('brands');
}
public function actionBusket()
{
$this->layout = '/internal';
return $this->render('busket');
}
public function actionBusketStep2()
{
$this->layout = '/internal';
return $this->render('busket_step2');
}
|
394e2db6
Administrator
Importers CRUD
|
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
|
public function actionCatalogMarokStep2()
{
$this->layout = '/internal';
return $this->render('catalog_marok_step2');
}
public function actionCatalogMarokStep3()
{
$this->layout = '/internal';
return $this->render('catalog_marok_step3');
}
public function actionCatalogMarokStep4()
{
$this->layout = '/internal';
return $this->render('catalog_marok_step4');
}
public function actionCatalogMarokStep5()
{
$this->layout = '/internal';
return $this->render('catalog_marok_step5');
}
public function actionCatalogMarokStep6()
{
$this->layout = '/internal';
return $this->render('catalog_marok_step6');
}
public function actionCatalogMarok()
{
$this->layout = '/internal';
return $this->render('catalog_marok');
}
public function actionNewsAll()
{
$this->layout = '/internal';
return $this->render('news_all');
}
public function actionNotepad()
{
$this->layout = '/internal';
return $this->render('notepad');
}
|
89d4b5ac
Administrator
VItaliy 25.11.2015
|
178
|
public function actionWholesalers()
|
394e2db6
Administrator
Importers CRUD
|
179
180
|
{
$this->layout = '/internal';
|
89d4b5ac
Administrator
VItaliy 25.11.2015
|
181
|
return $this->render('wholesalers');
|
394e2db6
Administrator
Importers CRUD
|
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
|
}
public function actionOriginalCatalog()
{
$this->layout = '/internal';
return $this->render('original_catalog');
}
public function actionOriginalCatalogStep2()
{
$this->layout = '/internal';
return $this->render('original_catalog_step2');
}
public function actionOriginalCatalogStep3()
{
$this->layout = '/internal';
return $this->render('original_catalog_step3');
}
public function actionOriginalCatalogStep4()
{
$this->layout = '/internal';
return $this->render('original_catalog_step4');
}
public function actionOriginalCatalogStep5()
{
$this->layout = '/internal';
return $this->render('original_catalog_step5');
}
public function actionOriginalCatalogStep6()
{
$this->layout = '/internal';
return $this->render('original_catalog_step6');
}
public function actionOriginalCatalogStep7()
{
$this->layout = '/internal';
return $this->render('original_catalog_step7');
}
public function actionProvider()
{
$this->layout = '/internal';
return $this->render('provider');
}
public function actionRegistrationForm()
{
$this->layout = '/internal';
return $this->render('registration_form');
}
public function actionSearchPage()
{
$this->layout = '/internal';
return $this->render('search_page');
}
public function actionSearchTovarFilters()
{
$this->layout = '/internal';
return $this->render('search_tovar_filters');
}
public function actionThanks()
{
$this->layout = '/internal';
return $this->render('thanks');
}
public function actionVinCode()
{
$this->layout = '/internal';
return $this->render('vin_code');
}
|
a63b5418
Administrator
first_commit
|
263
264
265
266
267
268
269
|
/**
* Logs in a user.
*
* @return mixed
*/
public function actionLogin()
{
|
27b0cb06
Administrator
VItaliy 02.12.2015
|
270
271
|
|
a63b5418
Administrator
first_commit
|
272
|
if (!\Yii::$app->user->isGuest) {
|
27b0cb06
Administrator
VItaliy 02.12.2015
|
273
|
|
a63b5418
Administrator
first_commit
|
274
275
276
|
return $this->goHome();
}
|
27b0cb06
Administrator
VItaliy 02.12.2015
|
277
278
|
$model = new UserLoginForm();
|
a63b5418
Administrator
first_commit
|
279
280
281
|
if ($model->load(Yii::$app->request->post()) && $model->login()) {
return $this->goBack();
} else {
|
27b0cb06
Administrator
VItaliy 02.12.2015
|
282
|
$this->layout = '/internal';
|
a63b5418
Administrator
first_commit
|
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
|
return $this->render('login', [
'model' => $model,
]);
}
}
/**
* Logs out the current user.
*
* @return mixed
*/
public function actionLogout()
{
Yii::$app->user->logout();
return $this->goHome();
}
|
89d4b5ac
Administrator
VItaliy 25.11.2015
|
301
302
|
public function actionContacts()
|
a63b5418
Administrator
first_commit
|
303
|
{
|
89d4b5ac
Administrator
VItaliy 25.11.2015
|
304
305
306
|
$this->layout = '/internal';
return $this->render('contacts');
}
|
a63b5418
Administrator
first_commit
|
307
|
|
89d4b5ac
Administrator
VItaliy 25.11.2015
|
308
309
310
311
312
|
public function actionPaymentDelivery()
{
$this->layout = '/internal';
return $this->render('payment_delivery');
|
a63b5418
Administrator
first_commit
|
313
314
315
316
317
318
319
320
321
|
}
/**
* Displays about page.
*
* @return mixed
*/
public function actionAbout()
{
|
89d4b5ac
Administrator
VItaliy 25.11.2015
|
322
323
|
$teamGroups = TeamGroup::find()->all();
|
7b407169
Administrator
upload project
|
324
|
$this->layout = '/internal';
|
89d4b5ac
Administrator
VItaliy 25.11.2015
|
325
326
327
|
return $this->render('about',[
'teamGroups' => $teamGroups,
]);
|
a63b5418
Administrator
first_commit
|
328
329
330
331
332
333
334
335
336
|
}
/**
* Signs user up.
*
* @return mixed
*/
public function actionSignup()
{
|
27b0cb06
Administrator
VItaliy 02.12.2015
|
337
338
339
|
$this->layout = '/internal';
|
89d4b5ac
Administrator
VItaliy 25.11.2015
|
340
341
|
$model = new Accounts();
|
27b0cb06
Administrator
VItaliy 02.12.2015
|
342
343
344
|
if ($model->load(Yii::$app->request->post()) ) {
$model->generateAuthKey();
|
89d4b5ac
Administrator
VItaliy 25.11.2015
|
345
|
|
27b0cb06
Administrator
VItaliy 02.12.2015
|
346
347
348
349
350
|
$model->save();
if (Yii::$app->getUser()->login($model)) {
return $this->goHome();
|
89d4b5ac
Administrator
VItaliy 25.11.2015
|
351
|
|
a63b5418
Administrator
first_commit
|
352
|
}
|
27b0cb06
Administrator
VItaliy 02.12.2015
|
353
|
|
a63b5418
Administrator
first_commit
|
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
|
}
return $this->render('signup', [
'model' => $model,
]);
}
/**
* Requests password reset.
*
* @return mixed
*/
public function actionRequestPasswordReset()
{
$model = new PasswordResetRequestForm();
if ($model->load(Yii::$app->request->post()) && $model->validate()) {
if ($model->sendEmail()) {
Yii::$app->session->setFlash('success', 'Check your email for further instructions.');
return $this->goHome();
} else {
Yii::$app->session->setFlash('error', 'Sorry, we are unable to reset password for email provided.');
}
}
return $this->render('requestPasswordResetToken', [
'model' => $model,
]);
}
/**
* Resets password.
*
* @param string $token
* @return mixed
* @throws BadRequestHttpException
*/
public function actionResetPassword($token)
{
try {
$model = new ResetPasswordForm($token);
} catch (InvalidParamException $e) {
throw new BadRequestHttpException($e->getMessage());
}
if ($model->load(Yii::$app->request->post()) && $model->validate() && $model->resetPassword()) {
Yii::$app->session->setFlash('success', 'New password was saved.');
return $this->goHome();
}
return $this->render('resetPassword', [
'model' => $model,
]);
}
|
89d4b5ac
Administrator
VItaliy 25.11.2015
|
409
|
|
a63b5418
Administrator
first_commit
|
410
|
}
|