index.php 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. <?php
  2. use app\models\Authors;
  3. use yii\helpers\Html;
  4. use yii\helpers\Url;
  5. use yii\grid\ActionColumn;
  6. use yii\grid\GridView;
  7. /** @var yii\web\View $this */
  8. /** @var app\models\AuthorsSearch $searchModel */
  9. /** @var yii\data\ActiveDataProvider $dataProvider */
  10. $this->title = 'Authors';
  11. $this->params['breadcrumbs'][] = $this->title;
  12. ?>
  13. <div class="authors-index">
  14. <h1><?= Html::encode($this->title) ?></h1>
  15. <p>
  16. <?= Html::a('Create Authors', ['create'], ['class' => 'btn btn-success']) ?>
  17. </p>
  18. <?php // echo $this->render('_search', ['model' => $searchModel]); ?>
  19. <?= GridView::widget([
  20. 'dataProvider' => $dataProvider,
  21. 'filterModel' => $searchModel,
  22. 'layout' => "{errors}\n{pager}\n{items}\n{pager}\n{summary}",
  23. 'pager' => [
  24. 'prevPageCssClass' => 'page-item',
  25. 'firstPageLabel' => 'Начало',
  26. 'lastPageLabel' => 'Конец',
  27. 'linkOptions' => [ 'class'=>'page-link'],
  28. 'pageCssClass' => 'page-item',
  29. 'disabledListItemSubTagOptions' => ['tag' => 'a', 'class' => 'page-link'],
  30. ],
  31. 'columns' => [
  32. [
  33. 'attribute' => 'id',
  34. 'value' => 'id',
  35. 'contentOptions'=>['style'=>'width: 30px;']
  36. ],
  37. 'uid',
  38. 'name',
  39. 'url:url',
  40. 'jobTitle',
  41. //'phone',
  42. [
  43. 'attribute' => 'active',
  44. 'value' => 'active',
  45. 'contentOptions'=>['style'=>'width: 30px;']
  46. ],
  47. [
  48. 'class' => ActionColumn::className(),
  49. 'buttonOptions' => ['class' => 'btn btn-default'],
  50. 'contentOptions'=>['style'=>'min-width: 100px;'],
  51. 'visibleButtons' =>[
  52. 'delete' => false,
  53. ],
  54. 'urlCreator' => function ($action, Authors $model, $key, $index, $column) {
  55. return Url::toRoute([$action, 'id' => $model->id]);
  56. }
  57. ],
  58. ],
  59. ]); ?>
  60. </div>