-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.php
More file actions
85 lines (72 loc) · 2.56 KB
/
index.php
File metadata and controls
85 lines (72 loc) · 2.56 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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
<?php
use mdm\admin\components\Helper;
use yii\helpers\Html;
use yii\grid\GridView;
use yii\helpers\Url;
/* @var $this yii\web\View */
/* @var $searchModel app\models\search\UserSearch */
/* @var $dataProvider yii\data\ActiveDataProvider */
$this->title = 'Users';
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="user-index">
<h1><?= Html::encode($this->title) ?></h1>
<p>
<?php
if(Helper::checkRoute('create')){
echo Html::a('Create User', ['create'], [
'class' => 'btn btn-success',
]);
}
?>
</p>
<?php // echo $this->render('_search', ['model' => $searchModel]); ?>
<?= GridView::widget([
'dataProvider' => $dataProvider,
'filterModel' => $searchModel,
'columns' => [
['class' => 'yii\grid\SerialColumn',
'options' => [
'width' => '50px',
]
],
'username',
//'email:email',
['header' => 'Status',
'value' => function($model){
return $model->status == 10 ? 'Aktif' : 'Tidak aktif';
},
'options' => ['width' => '100px']
],
//'created_at',
//'updated_at',
//'created_by',
//'updated_by',
[
'header' => 'Aksi',
'class' => 'yii\grid\ActionColumn',
'template' => Helper::filterActionColumn('{view} {update} {delete} {loginas}'),
'buttons' => [
'loginas' => function($url, $model) {
if ($model->status == 0) {
return null;
}
$title = "Login As";
$url = Url::to(['loginas', 'token' => $model->auth_key]);
$options = [
'title' => $title,
'data-method' => 'post',
];
$label = "<span class='glyphicon glyphicon-share' arial-hidden='true'></span>";
return Yii::$app->user->identity->username == $model->username ?
"<span class='glyphicon glyphicon-star' arial-hidden='true'></span>" :
Html::a($label, $url, $options);
}
],
'options' => [
'width' => '100px',
]
],
],
]); ?>
</div>