Exemplo n.º 1
0
                <div class="col-sm-8">
                    {pager}
                </div>
                <div class="col-sm-4 text-right" style="padding: 20px">
                    ' . GridBulkActions::widget(['gridId' => 'user-grid']) . '
                </div>
            </div>
        ', 'columns' => [['class' => 'yii\\grid\\CheckboxColumn', 'options' => ['style' => 'width:10px']], ['class' => 'yii\\grid\\SerialColumn', 'options' => ['style' => 'width:10px']], ['class' => 'roman444uk\\yii\\grid\\StatusColumn', 'attribute' => 'superadmin', 'visible' => Yii::$app->user->isSuperadmin, 'filterInputOptions' => ['class' => 'form-control input-sm']], ['attribute' => 'username', 'value' => function (User $model) {
    return Html::a($model->username, ['view', 'id' => $model->id], ['data-pjax' => 0]);
}, 'format' => 'raw', 'filterInputOptions' => ['class' => 'form-control input-sm']], ['attribute' => 'email', 'format' => 'raw', 'visible' => User::hasPermission('viewUserEmail'), 'filterInputOptions' => ['class' => 'form-control input-sm']], ['class' => 'roman444uk\\yii\\grid\\StatusColumn', 'attribute' => 'email_confirmed', 'visible' => User::hasPermission('viewUserEmail'), 'filterInputOptions' => ['class' => 'form-control input-sm']], ['attribute' => 'gridRoleSearch', 'filter' => ArrayHelper::map(Role::getAvailableRoles(Yii::$app->user->isSuperAdmin), 'name', 'description'), 'value' => function (User $model) {
    return implode(', ', ArrayHelper::map($model->roles, 'name', 'description'));
}, 'format' => 'raw', 'visible' => User::hasPermission('viewUserRoles'), 'filterInputOptions' => ['class' => 'form-control input-sm']], ['attribute' => 'registration_ip', 'value' => function (User $model) {
    return Html::a($model->registration_ip, "http://ipinfo.io/" . $model->registration_ip, ["target" => "_blank"]);
}, 'format' => 'raw', 'visible' => User::hasPermission('viewRegistrationIp'), 'filterInputOptions' => ['class' => 'form-control input-sm']], ['value' => function (User $model) {
    return GhostHtml::a(UsersModule::t('back', 'Roles and permissions'), ['/user/user-permission/set', 'id' => $model->id], ['class' => 'btn btn-sm btn-primary', 'data-pjax' => 0, 'data-set-roles' => $model->id]);
}, 'format' => 'raw', 'visible' => User::canRoute('/user/permission/set'), 'options' => ['width' => '10px']], ['value' => function (User $model) {
    return GhostHtml::a(UsersModule::t('back', 'Change password'), ['change-password', 'id' => $model->id], ['class' => 'btn btn-sm btn-default', 'data-pjax' => 0, 'data-change-password' => $model->id]);
}, 'format' => 'raw', 'options' => ['width' => '10px']], ['class' => 'roman444uk\\yii\\grid\\StatusColumn', 'attribute' => 'status', 'optionsArray' => [[User::STATUS_ACTIVE, UsersModule::t('back', 'Active'), 'success'], [User::STATUS_INACTIVE, UsersModule::t('back', 'Inactive'), 'warning'], [User::STATUS_BANNED, UsersModule::t('back', 'Banned'), 'danger']], 'filterInputOptions' => ['class' => 'form-control input-sm']], ['class' => 'yii\\grid\\ActionColumn', 'contentOptions' => ['class' => 'actions'], 'buttons' => ['view' => function ($url, $model, $key) {
    return Html::a('<span class="glyphicon glyphicon-eye-open"></span>', $url, ['title' => Yii::t('yii', 'View'), 'data-pjax' => '0', 'data-view' => $key]);
}, 'update' => function ($url, $model, $key) {
    return Html::a('<span class="glyphicon glyphicon-pencil"></span>', $url, ['title' => Yii::t('yii', 'Update'), 'data-pjax' => '0', 'data-update' => $key]);
}]]]]);
?>

    <?php 
echo MagnificPopup::widget(['id' => '', 'type' => 'ajax', 'target' => '#user-grid-create-button, a[data-update], a[data-view]', 'options' => ['removalDelay' => 300]]);
?>

<?php 
Pjax::end();
?>
Exemplo n.º 2
0
 /**
  * @inheritdoc
  */
 public function behaviors()
 {
     return array_merge(parent::behaviors(), ['createProfile' => ['class' => 'frontend\\behaviors\\CreateUserProfileBehavior']]);
 }
Exemplo n.º 3
0
                </div>
            </div>', 'columns' => [['class' => 'yii\\grid\\CheckboxColumn', 'options' => ['style' => 'width:10px']], ['class' => 'yii\\grid\\SerialColumn', 'options' => ['style' => 'width:10px']], ['class' => 'roman444uk\\yii\\grid\\StatusColumn', 'attribute' => 'is_from_service', 'visible' => Yii::$app->user->isSuperadmin, 'filterInputOptions' => ['class' => 'form-control input-sm']], ['attribute' => 'username', 'value' => function (User $model) {
    return Html::a($model->username, ['view', 'id' => $model->id], ['data-pjax' => 0]);
}, 'format' => 'raw', 'filterInputOptions' => ['class' => 'form-control input-sm']], ['class' => 'roman444uk\\yii\\grid\\StatusColumn', 'attribute' => 'superadmin', 'visible' => Yii::$app->user->isSuperadmin, 'filterInputOptions' => ['class' => 'form-control input-sm']], ['attribute' => 'email', 'format' => 'raw', 'visible' => User::hasPermission('viewUserEmail'), 'filterInputOptions' => ['class' => 'form-control input-sm']], ['class' => 'roman444uk\\yii\\grid\\StatusColumn', 'attribute' => 'email_confirmed', 'visible' => User::hasPermission('viewUserEmail'), 'filterInputOptions' => ['class' => 'form-control input-sm']], ['attribute' => 'gridRoleSearch', 'filter' => ArrayHelper::map(Role::getAvailableRoles(Yii::$app->user->isSuperAdmin), 'name', 'description'), 'value' => function (User $model) {
    return implode(', ', ArrayHelper::map($model->roles, 'name', 'description'));
}, 'format' => 'raw', 'visible' => User::hasPermission('viewUserRoles'), 'filterInputOptions' => ['class' => 'form-control input-sm']], ['attribute' => 'Аккаунты', 'value' => function (User $model) {
    $links = [];
    foreach ($model->serviceIdentities as $identity) {
        array_push($links, Html::a($identity->username, ['/eauth/service-user/view', 'id' => $identity->serviceId]));
    }
    return implode(',', $links);
}, 'format' => 'raw', 'filterInputOptions' => ['class' => 'form-control input-sm']], ['attribute' => 'registration_ip', 'value' => function (User $model) {
    return Html::a($model->registration_ip, "http://ipinfo.io/" . $model->registration_ip, ["target" => "_blank"]);
}, 'format' => 'raw', 'visible' => User::hasPermission('viewRegistrationIp'), 'filterInputOptions' => ['class' => 'form-control input-sm']], ['value' => function (User $model) {
    return GhostHtml::a(UsersModule::t('back', 'Roles and permissions'), ['/user/user-permission/set', 'id' => $model->id], ['class' => 'btn btn-sm btn-primary', 'data-pjax' => 0, 'data-set-roles' => $model->id]);
}, 'format' => 'raw', 'visible' => User::canRoute('/user/permission/set'), 'options' => ['width' => '10px']], ['class' => 'roman444uk\\yii\\grid\\StatusColumn', 'attribute' => 'status', 'optionsArray' => [[User::STATUS_ACTIVE, UsersModule::t('back', 'Active'), 'success'], [User::STATUS_INACTIVE, UsersModule::t('back', 'Inactive'), 'warning'], [User::STATUS_BANNED, UsersModule::t('back', 'Banned'), 'danger']], 'filterInputOptions' => ['class' => 'form-control input-sm']], ['class' => 'yii\\grid\\ActionColumn', 'contentOptions' => ['class' => 'actions'], 'buttons' => ['view' => function ($url, $model, $key) {
    return Html::a('<span class="glyphicon glyphicon-eye-open"></span>', $url, ['title' => Yii::t('yii', 'View'), 'data-pjax' => '0', 'data-view' => $key]);
}, 'update' => function ($url, $model, $key) {
    return Html::a('<span class="glyphicon glyphicon-pencil"></span>', $url, ['title' => Yii::t('yii', 'Update'), 'data-pjax' => '0', 'data-update' => $key]);
}]]]]);
?>

    <?php 
echo MagnificPopup::widget(['id' => '', 'type' => 'ajax', 'target' => '#user-grid-create-button, a[data-update], a[data-view]', 'options' => ['removalDelay' => 300]]);
?>

<?php 
Pjax::end();
?>

<?php 
Exemplo n.º 4
0
use yii\helpers\ArrayHelper;
use yii\helpers\Html;
use yii\widgets\DetailView;
use roman444uk\users\components\GhostHtml;
use roman444uk\users\models\rbacDB\Role;
use roman444uk\users\models\User;
use roman444uk\users\UsersModule;
$this->title = $model->username;
$this->params['breadcrumbs'][] = ['label' => 'Пользователи сервисов', 'url' => ['list']];
$this->params['breadcrumbs'][] = $this->title;
?>

<?php 
if (!Yii::$app->request->isAjax) {
    ?>
    <p>
        <?php 
    echo GhostHtml::a(UsersModule::t('back', 'Edit'), ['update', 'id' => $model->serviceId], ['class' => 'btn btn-sm btn-primary']);
    ?>
        <?php 
    echo GhostHtml::a(UsersModule::t('back', 'Delete'), ['delete', 'id' => $model->serviceId], ['class' => 'btn btn-sm btn-danger pull-right', 'data' => ['confirm' => UsersModule::t('back', 'Are you sure you want to delete this user?'), 'method' => 'post']]);
    ?>
    </p>
<?php 
}
?>

<?php 
echo DetailView::widget(['model' => $model, 'attributes' => ['id', ['attribute' => 'status', 'value' => User::getStatusValue($model->status)], 'username', ['attribute' => 'email', 'value' => $model->email, 'format' => 'email', 'visible' => User::hasPermission('viewUserEmail')], ['label' => UsersModule::t('back', 'Roles'), 'value' => implode('<br>', ArrayHelper::map(Role::getUserRoles($model->id), 'name', 'description')), 'visible' => User::hasPermission('viewUserRoles'), 'format' => 'raw']]]);