Commit 0ae6f10931b5cc2eeb2303fa4e6a4cc66eb5567e
1 parent
88def988
firs page
Showing
3 changed files
with
24 additions
and
62 deletions
Show diff stats
common/config/main-local.php
| @@ -3,9 +3,9 @@ return [ | @@ -3,9 +3,9 @@ return [ | ||
| 3 | 'components' => [ | 3 | 'components' => [ |
| 4 | 'db' => [ | 4 | 'db' => [ |
| 5 | 'class' => 'yii\db\Connection', | 5 | 'class' => 'yii\db\Connection', |
| 6 | - 'dsn' => 'pgsql:host=127.0.0.1;port=5432;dbname=mfp_local', | ||
| 7 | - 'username' => 'postgres', | ||
| 8 | - 'password' => '', | 6 | + 'dsn' => 'pgsql:host=195.248.225.149;port=5432;dbname=mfp', |
| 7 | + 'username' => 'test33', | ||
| 8 | + 'password' => 'E4q2N7i9', | ||
| 9 | 'schemaMap' => [ | 9 | 'schemaMap' => [ |
| 10 | 'pgsql'=> [ | 10 | 'pgsql'=> [ |
| 11 | 'class'=>'yii\db\pgsql\Schema', | 11 | 'class'=>'yii\db\pgsql\Schema', |
frontend/controllers/AccountsController.php
| @@ -2,9 +2,7 @@ | @@ -2,9 +2,7 @@ | ||
| 2 | namespace frontend\controllers; | 2 | namespace frontend\controllers; |
| 3 | 3 | ||
| 4 | use Yii; | 4 | use Yii; |
| 5 | -use common\models\Accounts; | ||
| 6 | -use frontend\models\ChangePasswordForm; | ||
| 7 | -use common\models\News; | 5 | +use common\models\User; |
| 8 | use yii\data\ActiveDataProvider; | 6 | use yii\data\ActiveDataProvider; |
| 9 | use yii\filters\AccessControl; | 7 | use yii\filters\AccessControl; |
| 10 | use yii\web\Controller; | 8 | use yii\web\Controller; |
| @@ -17,9 +15,6 @@ use yii\web\NotFoundHttpException; | @@ -17,9 +15,6 @@ use yii\web\NotFoundHttpException; | ||
| 17 | class AccountsController extends Controller | 15 | class AccountsController extends Controller |
| 18 | { | 16 | { |
| 19 | 17 | ||
| 20 | - public $layout = '/internal'; | ||
| 21 | - | ||
| 22 | - | ||
| 23 | public function behaviors() | 18 | public function behaviors() |
| 24 | { | 19 | { |
| 25 | return [ | 20 | return [ |
| @@ -58,38 +53,13 @@ class AccountsController extends Controller | @@ -58,38 +53,13 @@ class AccountsController extends Controller | ||
| 58 | 53 | ||
| 59 | } | 54 | } |
| 60 | 55 | ||
| 61 | - public function actionIndex() | ||
| 62 | - { | ||
| 63 | - $dataProvider = new ActiveDataProvider([ | ||
| 64 | - 'query' => News::find()->where(['is_active'=>1]), | ||
| 65 | - 'pagination' => [ | ||
| 66 | - 'pageSize' => 16, | ||
| 67 | - ], | ||
| 68 | 56 | ||
| 69 | - ]); | ||
| 70 | - return $this->render('index',[ | ||
| 71 | - 'dataProvider' => $dataProvider | ||
| 72 | - ]); | ||
| 73 | - } | ||
| 74 | 57 | ||
| 75 | - public function actionView($translit) | ||
| 76 | - { | ||
| 77 | - | ||
| 78 | - $activeNews = $this->findModel($translit); | ||
| 79 | - $next_news = News::find()->where(['is_active'=>1])->andWhere('id > :id',[':id' => $activeNews->id])->one(); | ||
| 80 | - $prev_news = News::find()->where(['is_active'=>1])->andWhere('id < :id',[':id' => $activeNews->id])->one(); | ||
| 81 | - | ||
| 82 | - return $this->render('view', [ | ||
| 83 | - 'model' => $activeNews, | ||
| 84 | - 'next_news' => $next_news instanceof News ? $next_news : '', | ||
| 85 | - 'prev_news' => $prev_news instanceof News ? $prev_news : '' | ||
| 86 | - ]); | ||
| 87 | - } | ||
| 88 | 58 | ||
| 89 | protected function findModel($id) | 59 | protected function findModel($id) |
| 90 | { | 60 | { |
| 91 | 61 | ||
| 92 | - if (($model = Accounts::findOne(["id"=>$id])) !== null) { | 62 | + if (($model = User::findOne(["id"=>$id])) !== null) { |
| 93 | return $model; | 63 | return $model; |
| 94 | } else { | 64 | } else { |
| 95 | throw new NotFoundHttpException('The requested page does not exist.'); | 65 | throw new NotFoundHttpException('The requested page does not exist.'); |
| @@ -97,32 +67,5 @@ class AccountsController extends Controller | @@ -97,32 +67,5 @@ class AccountsController extends Controller | ||
| 97 | } | 67 | } |
| 98 | 68 | ||
| 99 | 69 | ||
| 100 | - public function actionChangePassword(){ | ||
| 101 | - | ||
| 102 | - | ||
| 103 | - $form = new ChangePasswordForm(); | ||
| 104 | - | ||
| 105 | - | ||
| 106 | - if ($form->load(Yii::$app->request->post()) && $form->validate()) { | ||
| 107 | - | ||
| 108 | - $model = Accounts::findOne(Yii::$app->user->identity->id); | ||
| 109 | - | ||
| 110 | - $model->load(Yii::$app->request->post(), 'ChangePasswordForm'); | ||
| 111 | - | ||
| 112 | - $model->save(); | ||
| 113 | - | ||
| 114 | - return $this->redirect(['cabinet']); | ||
| 115 | - | ||
| 116 | - } else { | ||
| 117 | - | ||
| 118 | - return $this->render('change-password', [ | ||
| 119 | - 'model' => $form | ||
| 120 | - ]); | ||
| 121 | - | ||
| 122 | - } | ||
| 123 | - } | ||
| 124 | - | ||
| 125 | - | ||
| 126 | - | ||
| 127 | 70 | ||
| 128 | } | 71 | } |
| 1 | +<?php | ||
| 2 | +/** | ||
| 3 | + * Created by PhpStorm. | ||
| 4 | + * User: vitaliy | ||
| 5 | + * Date: 26.01.16 | ||
| 6 | + * Time: 13:30 | ||
| 7 | + */ | ||
| 8 | + | ||
| 9 | +namespace frontend\controllers; | ||
| 10 | + | ||
| 11 | + | ||
| 12 | +class LandingController { | ||
| 13 | + | ||
| 14 | + public function ViewAction($view) | ||
| 15 | + { | ||
| 16 | + $this->render(); | ||
| 17 | + } | ||
| 18 | + | ||
| 19 | +} | ||
| 0 | \ No newline at end of file | 20 | \ No newline at end of file |