Example #1
0
    <h1>

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

    <span class="pull-right">
        <?php 
echo Html::a(Yii::t('app', 'Create Article'), ['create'], ['class' => 'btn btn-success']);
?>
    </span>  

    </h1>

    <?php 
echo GridView::widget(['dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'summary' => false, 'columns' => [['class' => 'yii\\grid\\SerialColumn'], ['attribute' => 'user_id', 'value' => function ($data) {
    return $data->getAuthorName();
}], 'title', ['attribute' => 'status', 'filter' => $searchModel->statusList, 'value' => function ($data) {
    return $data->getStatusName($data->status);
}, 'contentOptions' => function ($model, $key, $index, $column) {
    return ['class' => CssHelper::articleStatusCss($model->statusName)];
}], ['attribute' => 'category', 'filter' => $searchModel->categoryList, 'value' => function ($data) {
    return $data->getCategoryName($data->category);
}, 'contentOptions' => function ($model, $key, $index, $column) {
    return ['class' => CssHelper::articleCategoryCss($model->categoryName)];
}], ['class' => 'yii\\grid\\ActionColumn', 'header' => Yii::t('app', 'Menu')]]]);
?>

</div>
Example #2
0
echo Html::encode($this->title);
?>

    <span class="pull-right">
        <?php 
echo Html::a(Yii::t('app', 'Create User'), ['create'], ['class' => 'btn btn-success']);
?>
    </span>         

    </h1>

    <?php 
echo GridView::widget(['dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'summary' => false, 'columns' => [['class' => 'yii\\grid\\SerialColumn'], 'username', 'email:email', ['attribute' => 'status', 'filter' => $searchModel->statusList, 'value' => function ($data) {
    return $data->statusName;
}, 'contentOptions' => function ($model, $key, $index, $column) {
    return ['class' => CssHelper::statusCss($model->statusName)];
}], ['attribute' => 'item_name', 'filter' => $searchModel->rolesList, 'value' => function ($data) {
    return $data->roleName;
}, 'contentOptions' => function ($model, $key, $index, $column) {
    return ['class' => CssHelper::roleCss($model->roleName)];
}], ['class' => 'yii\\grid\\ActionColumn', 'header' => "Menu", 'template' => '{view} {update} {delete}', 'buttons' => ['view' => function ($url, $model, $key) {
    return Html::a('', $url, ['title' => 'View user', 'class' => 'glyphicon glyphicon-eye-open']);
}, 'update' => function ($url, $model, $key) {
    return Html::a('', $url, ['title' => 'Manage user', 'class' => 'glyphicon glyphicon-user']);
}, 'delete' => function ($url, $model, $key) {
    return Html::a('', $url, ['title' => 'Delete user', 'class' => 'glyphicon glyphicon-trash', 'data' => ['confirm' => Yii::t('app', 'Are you sure you want to delete this user?'), 'method' => 'post']]);
}]]]]);
?>

</div>
Example #3
0
    <h1>

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

    <span class="pull-right">
        <?php 
echo Html::a(Yii::t('app', 'Create Post'), ['create'], ['class' => 'btn btn-success']);
?>
    </span>  

    </h1>

    <?php 
echo GridView::widget(['dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'summary' => false, 'columns' => [['class' => 'yii\\grid\\SerialColumn'], ['attribute' => 'user_id', 'value' => function ($data) {
    return $data->getAuthorName();
}], 'title', ['attribute' => 'status', 'filter' => $searchModel->statusList, 'value' => function ($data) {
    return $data->getStatusName($data->status);
}, 'contentOptions' => function ($model, $key, $index, $column) {
    return ['class' => CssHelper::postStatusCss($model->statusName)];
}], ['attribute' => 'type', 'filter' => $searchModel->typeList, 'value' => function ($data) {
    return $data->getTypeName($data->type);
}, 'contentOptions' => function ($model, $key, $index, $column) {
    return ['class' => CssHelper::postTypeCss($model->typeName)];
}], ['class' => 'yii\\grid\\ActionColumn', 'header' => Yii::t('app', 'Menu')]]]);
?>

</div>