* * For the full copyright and license information, please view the LICENSE.md * file that was distributed with this source code. */ use yii\grid\GridView; use yii\helpers\Html; use yii\helpers\Url; use yii\web\View; use yii\widgets\Pjax; use dektrium\user\models\Profile; use dektrium\user\models\User; /** * @var \yii\web\View $this * @var \yii\data\ActiveDataProvider $dataProvider * @var \dektrium\user\models\UserSearch $searchModel */ $this->title = Yii::t('user', 'Manage users'); $this->params['breadcrumbs'][] = $this->title; ?> = $this->render('/_alert', ['module' => Yii::$app->getModule('user')]) ?> = $this->render('/admin/_menu') ?> ?> = GridView::widget([ 'dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'layout' => "{items}\n{pager}", 'columns' => [ [ 'attribute' => 'id', 'headerOptions' => ['style' => 'width:90px;'], # 90px is sufficient for 5-digit user ids ], 'username', [ 'attribute' => 'Name', 'value' => function ($model) { $s=''; //Yii::$app->profile->get($model->id); $profile = Profile::findOne($model->id); return $profile->name; }, 'format' => 'html', ], 'email:email', [ 'attribute' => 'registration_ip', 'value' => function ($model) { return $model->registration_ip == null ? '' . Yii::t('user', '(not set)') . '' : $model->registration_ip; }, 'format' => 'html', ], [ 'attribute' => 'Роли', 'value' => function ($model) { $s=''; foreach(Yii::$app->authManager->getRolesByUser($model->id) as $role=>$set){ $s .= $set->name.' '; } return $s; }, 'format' => 'html', ], [ 'attribute' => 'created_at', 'value' => function ($model) { if (extension_loaded('intl')) { return Yii::t('user', '{0, date, MMMM dd, YYYY HH:mm}', [$model->created_at]); } else { return date('Y-m-d G:i:s', $model->created_at); } }, ], [ 'attribute' => 'last_login_at', 'value' => function ($model) { if (!$model->last_login_at || $model->last_login_at == 0) { return Yii::t('user', 'Never'); } else if (extension_loaded('intl')) { return Yii::t('user', '{0, date, MMMM dd, YYYY HH:mm}', [$model->last_login_at]); } else { return date('Y-m-d G:i:s', $model->last_login_at); } }, ], [ 'header' => Yii::t('user', 'Confirmation'), 'value' => function ($model) { if ($model->isConfirmed) { return '