Blame view

frontend/views/accounts/gallery.php 1.27 KB
51e0a262   Yarik   test
1
  <?php
989c83b0   Yarik   test
2
3
4
5
6
7
8
9
10
11
12
      /**
       * @var GallerySearch      $searchModel
       * @var ActiveDataProvider $dataProvider
       */
      use common\models\GallerySearch;
      use yii\data\ActiveDataProvider;
      use yii\grid\GridView;
      use yii\helpers\Html;
  
      $this->title = 'Галерея';
      $this->params[ 'breadcrumbs' ][] = $this->title;
51e0a262   Yarik   test
13
  ?>
989c83b0   Yarik   test
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
  <h1><?= $this->title ?></h1>
  <p>
      <?= Html::a(Yii::t('app', 'Добавить'), [ 'gallery-create' ], [ 'class' => 'btn btn-success' ]) ?>
  </p>
  <?= GridView::widget([
      'dataProvider' => $dataProvider,
      'filterModel'  => $searchModel,
      'columns'      => [
          [
              'attribute' => 'gallery_id',
              'label' => 'ID',
          ],
          'name',
          'date_add',
          [
              'attribute' => 'type',
              'value' => function($model, $key, $index, $column) {
                  switch($model->type) {
                      case 2:
                          return 'Видео';
                          break;
                      default:
                          return 'Фото';
                          break;
                  }
              },
              'label' => 'Фото или Видео',
              'filter' => [
                  1 => 'Фото',
                  2 => 'Видео',
              ]
          ],
      ],
  ]) ?>