Exemplo n.º 1
0
use app\modules\user\widgets\backend\grid\RoleColumn;
use kartik\date\DatePicker;
use yii\helpers\ArrayHelper;
use yii\grid\GridView;
use kartik\helpers\Html;
/* @var $this yii\web\View */
/* @var $searchModel \app\modules\user\models\backend\search\UserSearch */
/* @var $dataProvider yii\data\ActiveDataProvider */
$this->title = 'Пользователи';
$this->params['breadcrumbs'][] = $this->title;
?>


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

<p class="pull-left">
    <?php 
echo Html::a('<i class="material-icons">person_add</i> Добавить пользователя', ['create'], ['class' => 'btn btn-success']);
?>
</p>

    <?php 
echo GridView::widget(['dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'columns' => [['class' => 'yii\\grid\\CheckboxColumn', 'contentOptions' => ['class' => 'check-column']], ['class' => LinkColumn::className(), 'attribute' => 'username'], 'email:email', ['filter' => DatePicker::widget(['model' => $searchModel, 'attribute' => 'date_from', 'attribute2' => 'date_to', 'type' => DatePicker::TYPE_RANGE, 'separator' => '-', 'pluginOptions' => ['format' => 'yyyy-mm-dd']]), 'attribute' => 'created_at', 'format' => 'datetime', 'filterOptions' => ['style' => 'max-width: 180px']], ['class' => SetColumn::className(), 'filter' => User::getStatusesArray(), 'attribute' => 'status', 'name' => 'statusName', 'cssCLasses' => [User::STATUS_ACTIVE => 'success', User::STATUS_WAIT => 'warning', User::STATUS_BLOCKED => 'default']], ['class' => RoleColumn::className(), 'filter' => ArrayHelper::map(Yii::$app->authManager->getRoles(), 'name', 'description'), 'attribute' => 'role'], ['class' => ActionColumn::className()]]]);
?>



Exemplo n.º 2
0
use yii\widgets\Pjax;
use app\modules\page\models\backend\Page;
use app\widgets\grid\SetColumn;
/* @var $this yii\web\View */
/* @var $searchModel app\modules\page\models\backend\search\PageSearch */
/* @var $dataProvider yii\data\ActiveDataProvider */
$this->title = 'Страницы';
$this->params['breadcrumbs'][] = $this->title;
?>

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

    <p class="pull-left">
        <?php 
echo Html::a('<i class="material-icons">add</i> Добавить страницу', ['create'], ['class' => 'btn btn-success']);
?>
    </p>

<?php 
Pjax::begin(['enablePushState' => false]);
echo GridView::widget(['dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'columns' => [['class' => 'yii\\grid\\CheckboxColumn', 'contentOptions' => ['class' => 'check-column']], ['attribute' => 'title', 'format' => 'raw', 'value' => function ($model, $key, $index, $column) {
    /** @var \app\modules\page\models\backend\Page $model */
    return Html::a(Html::encode($model->title), ['/page/node/view', 'slug' => $model->slug]);
}], ['attribute' => 'updated_at', 'format' => 'datetime', 'contentOptions' => ['class' => 'at-column']], ['class' => SetColumn::className(), 'filter' => Page::getStatusesArray(), 'attribute' => 'status', 'name' => 'statusName', 'cssCLasses' => [Page::STATUS_ACTIVE => 'success', Page::STATUS_WAIT => 'warning'], 'contentOptions' => ['class' => 'status-column']], ['class' => 'app\\widgets\\grid\\ActionColumn', 'buttons' => ['view' => function ($url, $model, $key) {
    /** @var \app\modules\page\models\backend\Page $model */
    return Html::a('<i class="material-icons">visibility</i>', ['/page/node/view', 'slug' => $model->slug]);
}]]]]);
Pjax::end();
Exemplo n.º 3
0
use kartik\helpers\Html;
use yii\grid\GridView;
use yii\widgets\Pjax;
use app\modules\slider\models\backend\Slider;
use app\widgets\grid\SetColumn;
/* @var $this yii\web\View */
/* @var $searchModel app\modules\slider\models\backend\search\SliderSearch */
/* @var $dataProvider yii\data\ActiveDataProvider */
$this->title = 'Слайдеры';
$this->params['breadcrumbs'][] = $this->title;
?>

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

    <p class="pull-left">
        <?php 
echo Html::a('<i class="material-icons">add</i> Добавить слайдер', ['create'], ['class' => 'btn btn-success']);
?>
    </p>

<?php 
Pjax::begin(['enablePushState' => false]);
echo GridView::widget(['dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'columns' => [['attribute' => 'title'], ['attribute' => 'name'], ['class' => SetColumn::className(), 'filter' => Slider::getStatusesArray(), 'attribute' => 'status', 'name' => 'statusName', 'cssCLasses' => [Slider::STATUS_ACTIVE => 'success', Slider::STATUS_WAIT => 'warning'], 'contentOptions' => ['class' => 'status-column']], ['class' => 'app\\widgets\\grid\\ActionColumn', 'buttons' => ['view' => function ($url, $model, $key) {
    /** @var \app\modules\slider\models\backend\Slider $model */
    return Html::a('<i class="material-icons">visibility</i>', ['/slider/node/view', 'slug' => $model->name]);
}]]]]);
Pjax::end();