guild/frontend/modules/card/views/user-card/view.php

71 lines
2.4 KiB
PHP
Raw Normal View History

<?php
use yii\grid\GridView;
use yii\helpers\Html;
use yii\widgets\DetailView;
/* @var $this yii\web\View */
/* @var $skills \common\models\CardSkill */
/* @var $skill \common\models\Skill */
2021-09-13 13:37:59 +03:00
/* @var $achievements \common\models\Achievement */
/* @var $modelFildValue yii\data\ActiveDataProvider */
2020-09-09 16:37:35 +03:00
/* @var $model */
2019-11-18 16:14:06 +03:00
$this->title = 'Профиль';
?>
<div class="user-card-view">
<h3>Личная информация</h3>
<?php
2020-09-09 16:37:35 +03:00
echo Html::a('Изменить профиль', ['/card/user-card/update'], ['class' => 'btn btn-success'])
. '&nbsp' . Html::a('Изменить пароль', ['/card/user-card/password'], ['class' => 'btn btn-success']) . '<br><br>';
2020-01-22 12:18:03 +03:00
echo DetailView::widget([
'model' => $model,
'attributes' => [
['label' => 'ФИО', 'attribute' => 'fio',],
['label' => 'Email', 'attribute' => 'email',],
['label' => 'Дата рождения', 'attribute' => 'dob',],
[
'attribute' => 'position_id',
'value' => (isset($model->position->name)) ? $model->position->name : 'Без должности',
],
],
]);
?>
<h2>Навыки</h2>
<?php foreach ($skills as $skill) : ?>
<span class="btn btn-default btn-sm"><?= $skill['skill']->name; ?></span>
<?php endforeach; ?>
2019-11-18 16:14:06 +03:00
2021-09-13 13:37:59 +03:00
<h2>Достижения</h2>
<?php foreach ($achievements as $achievement) : ?>
2021-09-14 13:52:13 +03:00
<div class="btn btn-default btn-sm">
2021-09-13 13:37:59 +03:00
<?= Html::tag('img', null,
2021-09-13 13:40:52 +03:00
['src' => $achievement['achievement']->img, 'height' => '50px','width' => '50px']
2021-09-13 13:37:59 +03:00
) ?>
<?= $achievement['achievement']->title; ?>
2021-09-14 13:52:13 +03:00
</div>
2021-09-13 13:37:59 +03:00
<?php endforeach; ?>
<h2>Дополнительные сведения</h2>
<?= GridView::widget([
'dataProvider' => $modelFildValue,
'layout' => "{items}",
'columns' => [
'field.name:text:Поле',
[
'attribute' => 'value',
'format' => 'raw',
'value' => function ($model) {
if ($model->type_file == 'file') {
return $model->value . ' (' . Html::a('Скачать', $model->value, ['target' => '_blank', 'download' => 'download']) . ')';
}
return $model->value;
}
],
],
]); ?>
</div>