1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
use yii\web\IdentityInterface; |
4
|
|
|
use yii\db\ActiveRecord; |
5
|
|
|
use yii\grid\GridView; |
6
|
|
|
use yii\helpers\{Html, Url, ArrayHelper}; |
7
|
|
|
use Itstructure\UsersModule\Module; |
8
|
|
|
|
9
|
|
|
/* @var $this yii\web\View */ |
10
|
|
|
/* @var $searchModel ActiveRecord|IdentityInterface */ |
11
|
|
|
/* @var $dataProvider yii\data\ActiveDataProvider */ |
12
|
|
|
/* @var $customRewrite bool */ |
13
|
|
|
/* @var $indexViewColumns array */ |
14
|
|
|
|
15
|
|
|
$this->title = Module::t('users', 'Users'); |
16
|
|
|
$this->params['breadcrumbs'][] = $this->title; |
17
|
|
|
?> |
18
|
|
|
<div class="profile-index"> |
19
|
|
|
|
20
|
|
|
<?php // echo $this->render('_search', ['model' => $searchModel]); ?> |
|
|
|
|
21
|
|
|
|
22
|
|
|
<p> |
23
|
|
|
<?php echo Html::a(Module::t('users', 'Create user'), [ |
24
|
|
|
$this->params['urlPrefix'].'create' |
25
|
|
|
], [ |
26
|
|
|
'class' => 'btn btn-success' |
27
|
|
|
]) ?> |
28
|
|
|
</p> |
29
|
|
|
|
30
|
|
|
<?php echo GridView::widget([ |
31
|
|
|
'dataProvider' => $dataProvider, |
32
|
|
|
//'filterModel' => $searchModel, |
|
|
|
|
33
|
|
|
'columns' => $customRewrite ? $indexViewColumns : ArrayHelper::merge( |
34
|
|
|
[ |
35
|
|
|
'id' => [ |
36
|
|
|
'label' => Module::t('main', 'ID'), |
37
|
|
View Code Duplication |
'value' => function($searchModel) { |
|
|
|
|
38
|
|
|
return Html::a( |
39
|
|
|
Html::encode($searchModel->id), |
40
|
|
|
Url::to([ |
41
|
|
|
$this->params['urlPrefix'].'view', |
|
|
|
|
42
|
|
|
'id' => $searchModel->id |
43
|
|
|
]) |
44
|
|
|
); |
45
|
|
|
}, |
46
|
|
|
'format' => 'raw', |
47
|
|
|
], |
48
|
|
|
'name' => [ |
49
|
|
|
'label' => Module::t('users', 'Name'), |
50
|
|
View Code Duplication |
'value' => function($searchModel) { |
|
|
|
|
51
|
|
|
return Html::a( |
52
|
|
|
Html::encode($searchModel->name), |
53
|
|
|
Url::to([ |
54
|
|
|
$this->params['urlPrefix'].'view', |
|
|
|
|
55
|
|
|
'id' => $searchModel->id |
56
|
|
|
]) |
57
|
|
|
); |
58
|
|
|
}, |
59
|
|
|
'format' => 'raw', |
60
|
|
|
], |
61
|
|
|
'email' => [ |
62
|
|
|
'attribute' => 'email', |
63
|
|
|
'label' => Module::t('users', 'Email'), |
64
|
|
|
], |
65
|
|
|
'created_at' => [ |
66
|
|
|
'attribute' => 'created_at', |
67
|
|
|
'label' => Module::t('main', 'Created date'), |
68
|
|
|
'format' => ['date', 'dd.MM.YY HH:mm:ss'], |
69
|
|
|
], |
70
|
|
|
'updated_at' => [ |
71
|
|
|
'attribute' => 'updated_at', |
72
|
|
|
'label' => Module::t('main', 'Updated date'), |
73
|
|
|
'format' => ['date', 'dd.MM.Y HH:mm:ss'], |
74
|
|
|
], |
75
|
|
|
'ActionColumn' => [ |
76
|
|
|
'class' => 'yii\grid\ActionColumn', |
77
|
|
|
'header' => Module::t('main', 'Actions'), |
78
|
|
|
'template' => '{view} {update} {delete}', |
79
|
|
|
'urlCreator'=>function($action, $model, $key, $index){ |
|
|
|
|
80
|
|
|
return Url::to([ |
81
|
|
|
$this->params['urlPrefix'].$action, |
|
|
|
|
82
|
|
|
'id' => $model->id |
83
|
|
|
]); |
84
|
|
|
} |
85
|
|
|
], |
86
|
|
|
], |
87
|
|
|
$indexViewColumns |
88
|
|
|
) |
89
|
|
|
]); ?> |
90
|
|
|
</div> |
91
|
|
|
|
Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.
The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.
This check looks for comments that seem to be mostly valid code and reports them.