Exemple #1
0
use yii\helpers\Html;
use yii\grid\GridView;
use backend\models\CmsPages;
/* @var $this yii\web\View */
/* @var $dataProvider yii\data\ActiveDataProvider */
$this->title = Yii::t('backend', 'Pages');
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="cms-pages-index">

    <h1><?php 
echo Html::encode($this->title);
?>
</h1>

    <p>
        <?php 
echo Html::a(Yii::t('backend', 'Create Page'), ['create'], ['class' => 'btn btn-success']);
?>
    </p>

    <?php 
echo GridView::widget(['dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'rowOptions' => function ($model) {
    if ($model->is_active == 0) {
        return ['class' => 'danger'];
    }
}, 'columns' => [['class' => 'yii\\grid\\SerialColumn'], 'id', 'title', array('attribute' => 'is_active', 'filter' => Html::activeDropDownList($searchModel, 'is_active', CmsPages::dropdownActive(), ['class' => 'form-control', 'prompt' => Yii::t('backend', 'All')]), 'format' => 'boolean'), 'sort_order', ['class' => 'yii\\grid\\ActionColumn', 'template' => '{update} {delete}']]]);
?>

</div>