Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- use yii\helpers\Html;
- use yii\grid\GridView;
- use yii\jui\DatePicker;
- /* @var $this yii\web\View */
- /* @var $searchModel common\models\UserSearch */
- /* @var $dataProvider yii\data\ActiveDataProvider */
- $this->title = Yii::t('app', 'Users');
- $this->params['breadcrumbs'][] = $this->title;
- ?>
- <div class="user-index">
- <p>
- <?= Html::a(Yii::t('app', 'Create User'), ['create'], ['class' => 'btn btn-success']) ?>
- </p>
- <?= GridView::widget([
- 'dataProvider' => $dataProvider,
- 'filterModel' => $searchModel,
- 'columns' => [
- [
- 'attribute' => 'id',
- 'headerOptions' => ['class' => 'col-sm-1 text-center'],
- 'contentOptions' => ['class' => 'text-center'],
- ],
- [
- 'attribute' => 'username',
- 'headerOptions' => ['class' => 'col-sm-1 text-center'],
- 'contentOptions' => ['class' => 'text-center'],
- ],
- 'email:email',
- [
- 'attribute' => 'status',
- 'filter' => $searchModel->getUserStatus(),
- 'format' => 'userStatusHighlighted',
- 'headerOptions' => ['class' => 'col-sm-2 text-center'],
- 'contentOptions' => ['class' => 'text-center'],
- ],
- [
- 'attribute' => 'created_at',
- 'filter' => '<div class="drp-container input-group">'.
- DatePicker::widget([
- 'model' => $searchModel,
- 'attribute'=>'created_at',
- 'language' => 'pt-BR',
- 'dateFormat' => 'dd/MM/yyyy',
- 'options' => [
- 'class' => 'form-control'
- ],
- ]) . '<span class="input-group-addon">
- <i class="glyphicon glyphicon-calendar"></i></span>
- </div>',
- 'format' => 'date',
- 'headerOptions' => ['class' => 'col-sm-2 text-center'],
- 'contentOptions' => ['class' => 'text-center'],
- ],
- [
- 'attribute' => 'updated_at',
- 'format' => 'date',
- 'filter' => '<div class="drp-container input-group">'.
- DatePicker::widget([
- 'model' => $searchModel,
- 'attribute'=>'updated_at',
- 'language' => 'pt-BR',
- 'dateFormat' => 'dd/MM/yyyy',
- 'options' => [
- 'class' => 'form-control'
- ],
- ]) . '<span class="input-group-addon">
- <i class="glyphicon glyphicon-calendar"></i></span>
- </div>',
- 'headerOptions' => ['class' => 'col-sm-2 text-center'],
- 'contentOptions' => ['class' => 'text-center'],
- ],
- [
- 'class' => 'yii\grid\ActionColumn',
- 'header' => 'Actions',
- 'headerOptions' => ['class' => 'col-sm-1 text-center'],
- 'contentOptions' => ['class' => 'text-center'],
- 'template' => '{view} {update} {delete} {change-password}',
- 'buttons' => [
- 'delete' => function ($url, $model) {
- return Html::a('<span class="glyphicon glyphicon-trash text-danger"></span>', $url, [
- 'name' => 'Delete',
- 'data-confirm' => sprintf(
- 'Do you wish delete user %s?',
- $model->username
- ),
- 'data-method' => 'POST'
- ]);
- },
- 'change-password' => function ($url, $model) {
- return ' ' . Html::a('<span class="glyphicon glyphicon-lock text-warning"></span>', $url, [
- 'name' => 'Change password',
- 'data-confirm' => sprintf(
- 'Are you sure you want to change the password user %s?',
- $model->username
- ),
- ]);
- },
- ]
- ],
- ],
- ]); ?>
- </div>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement