[ 'class' => 'yii\web\ErrorAction', ], 'captcha' => [ 'class' => 'yii\captcha\CaptchaAction', 'fixedVerifyCode' => YII_ENV_TEST ? 'testme' : null, ], ]; } /** * Displays homepage. * * @return mixed */ public function actionIndex() { $this->layout = '/outer'; $news_list = News::find()->where(['is_active'=>1])->limit(3)->all(); $slider_list = Slider::find()->where(['is_active'=>1])->all(); if (Yii::$app->request->post()) { $post = Yii::$app->request->post(); if(isset($post['Callback'])){ $text = "Имя: ".$post['Callback']['name'].'
'; $text .= "Телефон: ".$post['Callback']['phone_num']; $model = new Callback(); $model->load(Yii::$app->request->post()); $model->save(); MailWidget::widget(['email' => 'ital-auto@test.com', 'text' => $text, 'subject' => 'Обратный звонок']); } } return $this->render('index',[ 'slider_list' => $slider_list, 'news_list' => $news_list ]); } public function actionNotFound() { $this->layout = '/internal'; return $this->render('not-found'); } public function action404() { $this->layout = '/internal'; return $this->render('404'); } public function actionTeam() { $teamGroups = TeamGroup::find()->all(); $this->layout = '/internal'; return $this->render('team',[ 'teamGroups' => $teamGroups, ]); } 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 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'); } public function actionWholesalers() { $this->layout = '/internal'; return $this->render('wholesalers'); } 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'); } /** * Logs in a user. * * @return mixed */ public function actionLogin() { if (!\Yii::$app->user->isGuest) { return $this->goHome(); } $model = new UserLoginForm(); if ($model->load(Yii::$app->request->post()) && $model->login()) { return $this->goBack(); } else { $this->layout = '/internal'; return $this->render('login', [ 'model' => $model, ]); } } /** * Logs out the current user. * * @return mixed */ public function actionLogout() { Yii::$app->user->logout(); return $this->goHome(); } public function actionContacts() { $this->layout = '/internal'; return $this->render('contacts'); } public function actionPaymentDelivery() { $this->layout = '/internal'; return $this->render('payment_delivery'); } /** * Displays about page. * * @return mixed */ public function actionAbout() { $teamGroups = TeamGroup::find()->all(); $this->layout = '/internal'; return $this->render('about',[ 'teamGroups' => $teamGroups, ]); } /** * Signs user up. * * @return mixed */ public function actionSignup() { $this->layout = '/internal'; $model = new AccountsForm(); if ($model->load(Yii::$app->request->post()) && $model->validate() ) { $accounts = new Accounts(); $accounts->load(Yii::$app->request->post()); $accounts->generateAuthKey(); $accounts->save(); if (Yii::$app->getUser()->login($accounts)) { return $this->goHome(); } } return $this->render('signup', [ 'model' => $model, ]); } /** * Requests password reset. * * @return mixed */ public function actionRequestPasswordReset() { $this->layout = '/internal'; $model = new PasswordResetRequestForm(); if ($model->load(Yii::$app->request->post()) && $model->validate()) { if ($model->sendEmail()) { Yii::$app->session->setFlash('success', 'Для того, чтобы изменить пароль, перейдите по ссылке, которая придет Вам на email'); return $this->goHome(); } else { die('here2'); Yii::$app->session->setFlash('error', 'Пользователя с таким e-mail в базе не существует'); } } 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, ]); } }