70f4f18b
Administrator
first_commit
|
1
2
3
|
<?php
namespace frontend\controllers;
|
c6152cd6
Administrator
VItaliy 25.11.2015
|
4
5
|
use common\models\Accounts;
use common\models\AccountsForm;
|
c4db9709
Administrator
VItaliy 27.11.2015
|
6
|
use common\models\News;
|
c6152cd6
Administrator
VItaliy 25.11.2015
|
7
8
|
use common\models\Team;
use common\models\TeamGroup;
|
70f4f18b
Administrator
first_commit
|
9
10
11
12
13
14
15
16
17
18
19
|
use Yii;
use common\models\LoginForm;
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;
|
66dd9e9a
Administrator
first commit from...
|
20
21
|
use common\models\Callback;
use common\components\MailWidget;
|
70f4f18b
Administrator
first_commit
|
22
23
24
25
26
|
/**
* Site controller
*/
class SiteController extends Controller
{
|
91ae643c
Administrator
upload project
|
27
|
|
c6152cd6
Administrator
VItaliy 25.11.2015
|
28
|
// public $enableCsrfValidation = false;
|
70f4f18b
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()
{
|
18b850c7
Administrator
Importers CRUD
|
53
|
$this->layout = '/outer';
|
66dd9e9a
Administrator
first commit from...
|
54
|
|
c4db9709
Administrator
VItaliy 27.11.2015
|
55
56
|
$news_list = News::find()->where(['is_active'=>1])->limit(3)->all();
|
66dd9e9a
Administrator
first commit from...
|
57
58
59
60
61
62
63
64
65
|
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();
|
b77421d2
Administrator
VItaliy 26.11.2015
|
66
|
MailWidget::widget(['email' => 'ital-auto@test.com', 'text' => $text, 'subject' => 'Обратный звонок']);
|
66dd9e9a
Administrator
first commit from...
|
67
68
69
|
}
}
|
c4db9709
Administrator
VItaliy 27.11.2015
|
70
71
72
|
return $this->render('index',[
'news_list' => $news_list
]);
|
70f4f18b
Administrator
first_commit
|
73
74
|
}
|
18b850c7
Administrator
Importers CRUD
|
75
76
77
78
79
80
81
82
83
84
|
public function actionNotFound()
{
$this->layout = '/internal';
return $this->render('not-found');
}
public function action404()
{
$this->layout = '/internal';
return $this->render('404');
}
|
91ae643c
Administrator
upload project
|
85
|
|
18b850c7
Administrator
Importers CRUD
|
86
87
88
89
90
91
92
93
94
95
96
97
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
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
|
public function actionArticle()
{
$this->layout = '/internal';
return $this->render('article');
}
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');
}
public function actionCabinet()
{
$this->layout = '/internal';
return $this->render('cabinet');
}
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');
}
|
c6152cd6
Administrator
VItaliy 25.11.2015
|
176
|
public function actionWholesalers()
|
18b850c7
Administrator
Importers CRUD
|
177
178
|
{
$this->layout = '/internal';
|
c6152cd6
Administrator
VItaliy 25.11.2015
|
179
|
return $this->render('wholesalers');
|
18b850c7
Administrator
Importers CRUD
|
180
181
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
|
}
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');
}
|
70f4f18b
Administrator
first_commit
|
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
|
/**
* Logs in a user.
*
* @return mixed
*/
public function actionLogin()
{
if (!\Yii::$app->user->isGuest) {
return $this->goHome();
}
$model = new LoginForm();
if ($model->load(Yii::$app->request->post()) && $model->login()) {
return $this->goBack();
} else {
return $this->render('login', [
'model' => $model,
]);
}
}
/**
* Logs out the current user.
*
* @return mixed
*/
public function actionLogout()
{
Yii::$app->user->logout();
return $this->goHome();
}
|
c6152cd6
Administrator
VItaliy 25.11.2015
|
294
295
|
public function actionContacts()
|
70f4f18b
Administrator
first_commit
|
296
|
{
|
c6152cd6
Administrator
VItaliy 25.11.2015
|
297
298
299
|
$this->layout = '/internal';
return $this->render('contacts');
}
|
70f4f18b
Administrator
first_commit
|
300
|
|
c6152cd6
Administrator
VItaliy 25.11.2015
|
301
302
303
304
305
|
public function actionPaymentDelivery()
{
$this->layout = '/internal';
return $this->render('payment_delivery');
|
70f4f18b
Administrator
first_commit
|
306
307
308
309
310
311
312
313
314
|
}
/**
* Displays about page.
*
* @return mixed
*/
public function actionAbout()
{
|
c6152cd6
Administrator
VItaliy 25.11.2015
|
315
316
|
$teamGroups = TeamGroup::find()->all();
|
91ae643c
Administrator
upload project
|
317
|
$this->layout = '/internal';
|
c6152cd6
Administrator
VItaliy 25.11.2015
|
318
319
320
|
return $this->render('about',[
'teamGroups' => $teamGroups,
]);
|
70f4f18b
Administrator
first_commit
|
321
322
323
324
325
326
327
328
329
|
}
/**
* Signs user up.
*
* @return mixed
*/
public function actionSignup()
{
|
c6152cd6
Administrator
VItaliy 25.11.2015
|
330
331
332
333
|
$model = new Accounts();
if ($model->load(Yii::$app->request->post(),'AccountsForm')) {
|
70f4f18b
Administrator
first_commit
|
334
|
if ($user = $model->signup()) {
|
c6152cd6
Administrator
VItaliy 25.11.2015
|
335
|
|
70f4f18b
Administrator
first_commit
|
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
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
|
if (Yii::$app->getUser()->login($user)) {
return $this->goHome();
}
}
}
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,
]);
}
|
c6152cd6
Administrator
VItaliy 25.11.2015
|
395
|
|
70f4f18b
Administrator
first_commit
|
396
|
}
|