Commit 8e7a541ca8dc3e406fc4268497b209258903b5fc
1 parent
62cd05d8
firs page
Showing
6 changed files
with
82 additions
and
14 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
@@ -3,7 +3,8 @@ namespace frontend\controllers; | @@ -3,7 +3,8 @@ namespace frontend\controllers; | ||
3 | 3 | ||
4 | use Yii; | 4 | use Yii; |
5 | use common\models\User; | 5 | use common\models\User; |
6 | -use yii\data\ActiveDataProvider; | 6 | +use common\models\UserInfo; |
7 | + | ||
7 | use yii\filters\AccessControl; | 8 | use yii\filters\AccessControl; |
8 | use yii\web\Controller; | 9 | use yii\web\Controller; |
9 | use yii\web\NotFoundHttpException; | 10 | use yii\web\NotFoundHttpException; |
@@ -39,17 +40,15 @@ class AccountsController extends Controller | @@ -39,17 +40,15 @@ class AccountsController extends Controller | ||
39 | { | 40 | { |
40 | 41 | ||
41 | 42 | ||
42 | - $model = $this->findModel(Yii::$app->user->identity->id); | ||
43 | - | 43 | + $user = $this->findUser(Yii::$app->user->identity->id); |
44 | 44 | ||
45 | - if ($model->load(Yii::$app->request->post()) && $model->validate()) { | 45 | + $user_info = $this->findUserInfo(Yii::$app->user->identity->id); |
46 | 46 | ||
47 | - $model->save(); | ||
48 | 47 | ||
49 | - } | ||
50 | 48 | ||
51 | return $this->render('cabinet', [ | 49 | return $this->render('cabinet', [ |
52 | - 'model' => $model | 50 | + 'user' => $user, |
51 | + 'user_info' => $user_info, | ||
53 | ]); | 52 | ]); |
54 | 53 | ||
55 | 54 | ||
@@ -59,7 +58,7 @@ class AccountsController extends Controller | @@ -59,7 +58,7 @@ class AccountsController extends Controller | ||
59 | 58 | ||
60 | 59 | ||
61 | 60 | ||
62 | - protected function findModel($id) | 61 | + protected function findUser($id) |
63 | { | 62 | { |
64 | 63 | ||
65 | if (($model = User::findOne(["id"=>$id])) !== null) { | 64 | if (($model = User::findOne(["id"=>$id])) !== null) { |
@@ -71,4 +70,15 @@ class AccountsController extends Controller | @@ -71,4 +70,15 @@ class AccountsController extends Controller | ||
71 | 70 | ||
72 | 71 | ||
73 | 72 | ||
73 | + protected function findUserInfo($id) | ||
74 | + { | ||
75 | + | ||
76 | + if (($model = UserInfo::findOne(["user_id"=>$id])) !== null) { | ||
77 | + return $model; | ||
78 | + } else { | ||
79 | + throw new NotFoundHttpException('The requested page does not exist.'); | ||
80 | + } | ||
81 | + } | ||
82 | + | ||
83 | + | ||
74 | } | 84 | } |
frontend/controllers/SiteController.php
1 | <?php | 1 | <?php |
2 | namespace frontend\controllers; | 2 | namespace frontend\controllers; |
3 | 3 | ||
4 | +use common\models\UserInfo; | ||
4 | use Yii; | 5 | use Yii; |
5 | use common\models\LoginForm; | 6 | use common\models\LoginForm; |
6 | use frontend\models\PasswordResetRequestForm; | 7 | use frontend\models\PasswordResetRequestForm; |
@@ -212,6 +213,13 @@ class SiteController extends Controller | @@ -212,6 +213,13 @@ class SiteController extends Controller | ||
212 | $model = new SignupForm(); | 213 | $model = new SignupForm(); |
213 | if ($model->load(Yii::$app->request->post())) { | 214 | if ($model->load(Yii::$app->request->post())) { |
214 | if ($user = $model->signup()) { | 215 | if ($user = $model->signup()) { |
216 | + | ||
217 | + $user_info = new UserInfo(); | ||
218 | + | ||
219 | + $user_info->user_id = $user->id; | ||
220 | + | ||
221 | + $user_info->save(); | ||
222 | + | ||
215 | if (Yii::$app->getUser()->login($user)) { | 223 | if (Yii::$app->getUser()->login($user)) { |
216 | return $this->goHome(); | 224 | return $this->goHome(); |
217 | } | 225 | } |
frontend/views/accounts/cabinet.php
1 | <?php | 1 | <?php |
2 | - use common\models\Option; | ||
3 | - | 2 | +use common\models\Option; |
3 | +use yii\helpers\Html; | ||
4 | +use yii\widgets\ActiveForm; | ||
4 | $this->title = 'Мой профиль'; | 5 | $this->title = 'Мой профиль'; |
5 | $this->params['breadcrumbs'][] = $this->title; | 6 | $this->params['breadcrumbs'][] = $this->title; |
6 | ?> | 7 | ?> |
7 | 8 | ||
8 | <h1><?= $this->title ?></h1> | 9 | <h1><?= $this->title ?></h1> |
9 | 10 | ||
11 | +<?php $form = ActiveForm::begin(); ?> | ||
12 | + | ||
13 | + <?= $form->field($user, 'username')->textInput() ?> | ||
14 | + | ||
15 | + <?= $form->field($user, 'lastname')->textInput() ?> | ||
16 | + | ||
17 | + <?= $form->field($user, 'firstname')->textInput() ?> | ||
18 | + | ||
19 | + <?= $form->field($user, 'email')->textInput() ?> | ||
20 | + | ||
21 | + <?= $form->field($user_info, 'user_id')->textInput() ?> | ||
22 | + | ||
23 | + <?= $form->field($user_info, 'view_count')->textInput() ?> | ||
24 | + | ||
25 | + <?= $form->field($user_info, 'busy')->textInput(['maxlength' => true]) ?> | ||
26 | + | ||
27 | + <?= $form->field($user_info, 'date_visit')->textInput() ?> | ||
28 | + | ||
29 | + <?= $form->field($user_info, 'experience')->textInput() ?> | ||
30 | + | ||
31 | + <?= $form->field($user_info, 'rank')->textInput(['maxlength' => true]) ?> | ||
32 | + | ||
33 | + <?= $form->field($user_info, 'salary')->textInput(['maxlength' => true]) ?> | ||
34 | + | ||
35 | + <?= $form->field($user_info, 'job')->textInput(['maxlength' => true]) ?> | ||
36 | + | ||
37 | + <?= $form->field($user_info, 'location')->textInput(['maxlength' => true]) ?> | ||
38 | + | ||
39 | + <?= $form->field($user_info, 'soft')->textInput() ?> | ||
40 | + | ||
41 | + <?= $form->field($user_info, 'guarantee')->textInput() ?> | ||
42 | + | ||
43 | + <?= $form->field($user_info, 'contract')->textInput() ?> | ||
44 | + | ||
45 | + <?= $form->field($user_info, 'estimate')->textInput() ?> | ||
46 | + | ||
47 | + <?= $form->field($user_info, 'purchase')->textInput() ?> | ||
48 | + | ||
49 | + <?= $form->field($user_info, 'delivery')->textInput() ?> | ||
50 | + | ||
51 | + <?= $form->field($user_info, 'prepayment')->textInput() ?> | ||
52 | + | ||
53 | + <?= $form->field($user_info, 'about')->textarea(['rows' => 6]) ?> | ||
54 | + | ||
55 | + <div class="form-group"> | ||
56 | + <?= Html::submitButton('Create', ['class' => 'btn btn-success']) ?> | ||
57 | + </div> | ||
58 | + | ||
59 | +<?php ActiveForm::end(); ?> | ||
10 | \ No newline at end of file | 60 | \ No newline at end of file |
frontend/views/layouts/main.php
@@ -17,7 +17,6 @@ AppAsset::register($this); | @@ -17,7 +17,6 @@ AppAsset::register($this); | ||
17 | <html lang="<?= Yii::$app->language ?>"> | 17 | <html lang="<?= Yii::$app->language ?>"> |
18 | 18 | ||
19 | <head> | 19 | <head> |
20 | - <link href='https://fonts.googleapis.com/css?family=Roboto:400,700&subset=cyrillic,latin' rel='stylesheet' type='text/css'> | ||
21 | <meta charset="<?= Yii::$app->charset ?>"> | 20 | <meta charset="<?= Yii::$app->charset ?>"> |
22 | 21 | ||
23 | <?= Html::csrfMetaTags() ?> | 22 | <?= Html::csrfMetaTags() ?> |