index.php
1.92 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
<?php
use yii\helpers\Html;
use yii\grid\GridView;
use mdm\admin\components\Helper;
/* @var $this yii\web\View */
/* @var $searchModel mdm\admin\models\searchs\User */
/* @var $dataProvider yii\data\ActiveDataProvider */
$this->title = Yii::t('rbac-admin', 'Users');
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="user-index">
<h1><?= Html::encode($this->title) ?></h1>
<?=
GridView::widget([
'dataProvider' => $dataProvider,
'filterModel' => $searchModel,
'columns' => [
['class' => 'yii\grid\SerialColumn'],
'username',
'email:email',
[
'attribute' => 'status',
'value' => function($model) {
return $model->status == 0 ? 'Inactive' : 'Active';
},
'filter' => [
0 => 'Inactive',
10 => 'Active'
]
],
[
'class' => 'yii\grid\ActionColumn',
'template' => Helper::filterActionColumn(['view', 'activate', 'delete']),
'buttons' => [
'activate' => function($url, $model) {
if ($model->status == 10) {
return '';
}
$options = [
'title' => Yii::t('rbac-admin', 'Activate'),
'aria-label' => Yii::t('rbac-admin', 'Activate'),
'data-confirm' => Yii::t('rbac-admin', 'Are you sure you want to activate this user?'),
'data-method' => 'post',
'data-pjax' => '0',
];
return Html::a('<span class="glyphicon glyphicon-ok"></span>', $url, $options);
}
]
],
],
]);
?>
</div>