These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | |||
3 | /* |
||
4 | * This file is part of the 2amigos/yii2-usuario project. |
||
5 | * |
||
6 | * (c) 2amigOS! <http://2amigos.us/> |
||
7 | * |
||
8 | * For the full copyright and license information, please view |
||
9 | * the LICENSE file that was distributed with this source code. |
||
10 | */ |
||
11 | |||
12 | use yii\grid\GridView; |
||
13 | use yii\helpers\Html; |
||
14 | use yii\web\View; |
||
15 | use yii\widgets\Pjax; |
||
16 | |||
17 | /** |
||
18 | * @var $this yii\web\View |
||
19 | * @var $dataProvider yii\data\ActiveDataProvider |
||
20 | * @var $searchModel Da\User\Search\UserSearch |
||
21 | */ |
||
22 | |||
23 | $this->title = Yii::t('usuario', 'Manage users'); |
||
24 | $this->params['breadcrumbs'][] = $this->title; |
||
25 | ?> |
||
26 | |||
27 | <?php $this->beginContent('@Da/User/resources/views/shared/admin_layout.php') ?> |
||
28 | |||
29 | <?php Pjax::begin() ?> |
||
30 | |||
31 | <?= GridView::widget( |
||
32 | [ |
||
33 | 'dataProvider' => $dataProvider, |
||
34 | 'filterModel' => $searchModel, |
||
35 | 'layout' => "{items}\n{pager}", |
||
36 | 'columns' => [ |
||
37 | 'username', |
||
38 | 'email:email', |
||
39 | [ |
||
40 | 'attribute' => 'registration_ip', |
||
41 | 'value' => function ($model) { |
||
42 | return $model->registration_ip == null |
||
43 | ? '<span class="not-set">'.Yii::t('usuario', '(not set)').'</span>' |
||
44 | : $model->registration_ip; |
||
45 | }, |
||
46 | 'format' => 'html', |
||
47 | ], |
||
48 | [ |
||
49 | 'attribute' => 'created_at', |
||
50 | 'value' => function ($model) { |
||
51 | if (extension_loaded('intl')) { |
||
52 | return Yii::t('usuario', '{0, date, MMMM dd, YYYY HH:mm}', [$model->created_at]); |
||
53 | } else { |
||
54 | return date('Y-m-d G:i:s', $model->created_at); |
||
55 | } |
||
56 | }, |
||
57 | ], |
||
58 | [ |
||
59 | 'header' => Yii::t('usuario', 'Confirmation'), |
||
60 | 'value' => function ($model) { |
||
61 | if ($model->isConfirmed) { |
||
62 | return '<div class="text-center"> |
||
63 | <span class="text-success">' .Yii::t('usuario', 'Confirmed').'</span> |
||
64 | </div>'; |
||
65 | } else { |
||
66 | return Html::a( |
||
67 | Yii::t('usuario', 'Confirm'), |
||
68 | ['confirm', 'id' => $model->id], |
||
69 | [ |
||
70 | 'class' => 'btn btn-xs btn-success btn-block', |
||
71 | 'data-method' => 'post', |
||
72 | 'data-confirm' => Yii::t('usuario', 'Are you sure you want to confirm this user?'), |
||
73 | ] |
||
74 | ); |
||
75 | } |
||
76 | }, |
||
77 | 'format' => 'raw', |
||
78 | 'visible' => Yii::$app->getModule('user')->enableEmailConfirmation, |
||
79 | ], |
||
80 | [ |
||
81 | 'header' => Yii::t('usuario', 'Block status'), |
||
82 | 'value' => function ($model) { |
||
83 | if ($model->isBlocked) { |
||
84 | return Html::a( |
||
85 | Yii::t('usuario', 'Unblock'), |
||
86 | ['block', 'id' => $model->id], |
||
87 | [ |
||
88 | 'class' => 'btn btn-xs btn-success btn-block', |
||
89 | 'data-method' => 'post', |
||
90 | 'data-confirm' => Yii::t('usuario', 'Are you sure you want to unblock this user?'), |
||
91 | ] |
||
92 | ); |
||
93 | } else { |
||
94 | return Html::a( |
||
95 | Yii::t('usuario', 'Block'), |
||
96 | ['block', 'id' => $model->id], |
||
97 | [ |
||
98 | 'class' => 'btn btn-xs btn-danger btn-block', |
||
99 | 'data-method' => 'post', |
||
100 | 'data-confirm' => Yii::t('usuario', 'Are you sure you want to block this user?'), |
||
101 | ] |
||
102 | ); |
||
103 | } |
||
104 | }, |
||
105 | 'format' => 'raw', |
||
106 | ], |
||
107 | [ |
||
108 | 'class' => 'yii\grid\ActionColumn', |
||
109 | 'template' => '{update} {delete}', |
||
110 | ], |
||
111 | ], |
||
112 | ] |
||
113 | ); ?> |
||
114 | |||
115 | <?php Pjax::end() ?> |
||
116 | |||
117 | <?php $this->endContent() ?> |
||
0 ignored issues
–
show
|
|||
118 |
Using a closing tag in PHP files that only contain PHP code is not recommended as you might accidentally add whitespace after the closing tag which would then be output by PHP. This can cause severe problems, for example headers cannot be sent anymore.
A simple precaution is to leave off the closing tag as it is not required, and it also has no negative effects whatsoever.