This commit is contained in:
andrey 2021-12-11 15:54:37 +03:00
commit 243d7ae4c0
3 changed files with 44 additions and 11 deletions

View File

@ -112,6 +112,21 @@ class UserCardController extends Controller
]); ]);
} }
public function actionResume()
{
$id_user = Yii::$app->user->id;
$result = UserCard::find()->where(['id_user' => $id_user])->asArray()->all();
if ($result) {
$id = $result[0]['id'];
$model = $this->findModel($id);
return $this->render('resume', [
'model' => $model
]);
} else {
return $this->render('index', ['info' => '<h3>Ваши личные данные не заненсены в базу.</h3>']);
}
}
/** /**
* Finds the Product model based on its primary key value. * Finds the Product model based on its primary key value.
* If the model is not found, a 404 HTTP exception will be thrown. * If the model is not found, a 404 HTTP exception will be thrown.

View File

@ -0,0 +1,27 @@
<?php
use asmoday74\ckeditor5\EditorClassic;
use yii\helpers\Html;
use yii\widgets\ActiveForm;
use yii\helpers\Url;
/* @var $this yii\web\View */
/* @var $model */
$this->title = 'Резюме';
?>
<div class="user-card-view">
<h1>Резюме</h1>
<?php $form = ActiveForm::begin(['action' => Url::base(true)]); ?>
<?= $form->field($model, 'vc_text')->widget(EditorClassic::className(), [
'clientOptions' => [
'language' => 'ru',
]
]); ?>
<div class="form-group">
<?= Html::submitButton('<i class="fas fa-save"></i> Save', ['class' => 'btn btn-success']) ?>
<?= Html::a('<i class="fas fa-long-arrow-alt-left"></i> Back', Url::base(true), ['class' => 'btn btn-primary', 'style' => 'float: right']) ?>
</div>
<?php $form = ActiveForm::end(); ?>
</div>

View File

@ -19,7 +19,8 @@ $this->title = 'Профиль';
<h3>Личная информация</h3> <h3>Личная информация</h3>
<?php <?php
echo Html::a('Изменить профиль', ['/card/user-card/update'], ['class' => 'btn btn-success']) echo Html::a('Изменить профиль', ['/card/user-card/update'], ['class' => 'btn btn-success'])
. '&nbsp' . Html::a('Изменить пароль', ['/card/user-card/password'], ['class' => 'btn btn-success']) . '<br><br>'; . '&nbsp' . Html::a('Изменить пароль', ['/card/user-card/password'], ['class' => 'btn btn-success'])
. '&nbsp' . Html::a('Изменить резюме', ['/card/user-card/resume'], ['class' => 'btn btn-success']). '<br><br>';
echo DetailView::widget([ echo DetailView::widget([
'model' => $model, 'model' => $model,
@ -70,14 +71,4 @@ $this->title = 'Профиль';
], ],
]); ?> ]); ?>
<?php $form = ActiveForm::begin(); ?>
<?= $form->field($model, 'vc_text')->widget(EditorClassic::className(), [
'clientOptions' => [
'language' => 'ru',
]
]); ?>
<div class="form-group">
<?= Html::submitButton('Save', ['class' => 'btn btn-success']) ?>
</div>
<?php $form = ActiveForm::end(); ?>
</div> </div>