12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061 |
- <?php
- use app\models\Person;
- use yii\helpers\Html;
- use yii\helpers\Url;
- use yii\grid\ActionColumn;
- use yii\grid\GridView;
- /** @var yii\web\View $this */
- /** @var yii\data\ActiveDataProvider $dataProvider */
- $this->title = 'Персоны (Эксперты)';
- $this->params['breadcrumbs'][] = $this->title;
- ?>
- <div class="person-index">
- <p>
- <?= Html::a('Создать карточку персоны', ['create'], ['class' => 'btn btn-success']) ?>
- </p>
- <?= GridView::widget([
- 'dataProvider' => $dataProvider,
- 'columns' => [
- ['class' => 'yii\grid\SerialColumn'],
- [
- 'attribute' => 'Фото',
- 'value' => function ($model) {
- return '<img class="profile-user-img img-circle" style="width:64px;height:64px;object-fit:cover;-o-object-fit:cover;" src="'.$model->getImg('4','jpg').'">';
- },
- 'format' => 'raw',
- ],
- 'name:text',
- [
- 'attribute' => 'alias',
- 'value' => function ($model) {
- return Url::base('https').'/person/'.$model->alias;
- },
- 'format' => 'url',
- ],
- 'jobtitle:ntext',
- 'birthdate:date',
- 'phone:ntext',
- 'email:email',
- 'show:ntext',
- //'id',
- [
- 'class' => ActionColumn::className(),
- 'visibleButtons' =>[
- 'delete' => Yii::$app->user->can('admin'),
- ],
- 'buttonOptions' => ['class' => 'btn btn-default'],
- 'urlCreator' => function ($action, Person $model, $key, $index, $column) {
- return Url::toRoute([$action, 'id' => $model->id]);
- }
- ],
- ],
- ]); ?>
- </div>
|