<?php

use yii\helpers\Html;
use \common\components\zii\AdminGrid;

use common\modules\school\models\Courses;

/* @var $this yii\web\View */
/* @var $searchModel common\modules\faq\models\SearchFaq */
/* @var $dataProvider yii\data\ActiveDataProvider */

?>

<p>
    <?= Html::a('Добавить', ['create'], ['class' => 'btn btn-success']) ?>
</p>

<?php echo AdminGrid::widget([
    'dataProvider' => $dataProvider,
    'filterModel' => $searchModel,
    'columns' => [
        'title',
        [
            'attribute' => 'type',
            'filter' => Courses::$type_list,
            'value' => function($model)
            {
                return Courses::$type_list[$model->type];
            }
        ],
        [
            'class' => 'common\components\ColorActionColumn',
            'template' => '{view} {update}',
        ],
    ],
]); ?>