guild/frontend/modules/card/views/user-card/view.php
2021-09-13 13:37:59 +03:00

73 lines
2.6 KiB
PHP
Executable File

<?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 */
/* @var $achievements \common\models\Achievement */
/* @var $modelFildValue yii\data\ActiveDataProvider */
/* @var $model */
$this->title = 'Профиль';
?>
<div class="user-card-view">
<h3>Личная информация</h3>
<?php
echo Html::a('Изменить профиль', ['/card/user-card/update'], ['class' => 'btn btn-success'])
. '&nbsp' . Html::a('Изменить пароль', ['/card/user-card/password'], ['class' => 'btn btn-success']) . '<br><br>';
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; ?>
<h2>Достижения</h2>
<?php foreach ($achievements as $achievement) : ?>
<a target="_blank"
href="<? echo \yii\helpers\Url::to(['/achievements/achievements/view', 'id' => $achievement['achievement']->id]);?>"
class="btn btn-default btn-sm">
<?= Html::tag('img', null,
['src' => $achievement['achievement']->img, 'height' => '50px','width' => '50px', 'alt'=> $achievement['achievement']->title]
) ?>
<?= $achievement['achievement']->title; ?>
</a>
<?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>