예제 #1
0
                <div class="panel-body">

                    <?php 
echo $form->field($model, 'childRoles', ['template' => '{input}'])->checkboxList(Role::getRolesList($model->name));
?>

                </div>
            </div>
            <div class="panel panel-default">
                <div class="panel-heading">
                    <div class="panel-title"><?php 
echo Yii::t('maddoger/user', 'Special permissions');
?>
</div>
                </div>
                <div class="panel-body">
                    <?php 
echo $form->field($model, 'childPermissions', ['template' => '{input}'])->checkboxList(Role::getPermissionsList());
?>
                </div>
            </div>
        </div>
    </div>


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

</div>
예제 #2
0
 /**
  * Finds the Role model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param string $id
  * @return Role the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = Role::findByName($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException(Yii::t('maddoger/user', 'The requested role does not exist.'));
     }
 }
예제 #3
0
<?php

use maddoger\user\common\models\Role;
use maddoger\user\common\models\User;
use yii\helpers\Html;
use yii\widgets\DetailView;
/* @var $this yii\web\View */
/* @var $model maddoger\user\common\models\User */
$this->title = $model->getName();
$this->params['breadcrumbs'][] = ['label' => Yii::t('maddoger/user', 'Users'), 'url' => ['index']];
$this->params['breadcrumbs'][] = $this->title;
$childRoles = $model->getRbacRoles();
if ($childRoles) {
    $childRoles = array_intersect_key(Role::getRolesList(), array_flip($childRoles));
}
?>
<div class="user-view">

    <div class="panel panel-default">
        <div class="panel-body">
            <p>
                <?php 
echo Html::a(Yii::t('maddoger/user', 'Update'), ['update', 'id' => $model->id], ['class' => 'btn btn-primary']);
?>
                <?php 
echo Html::a(Yii::t('maddoger/user', 'Delete'), ['delete', 'id' => $model->id], ['class' => 'btn btn-danger', 'data' => ['confirm' => Yii::t('maddoger/user', 'Are you sure you want to delete this item?'), 'method' => 'post']]);
?>
            </p>

            <?php 
echo DetailView::widget(['model' => $model, 'attributes' => ['id', 'username', 'email:email', 'profile.fullName', ['attribute' => 'profile.avatar', 'format' => ['image', ['width' => 200]]], 'roleDescription', ['attribute' => 'statusDescription', 'value' => Html::tag('span', $model->getStatusDescription(), ['class' => $model->status == User::STATUS_ACTIVE ? 'label label-success' : ($model->status == User::STATUS_DELETED ? 'label label-danger' : $model->status == User::STATUS_BLOCKED ? 'label label-warning' : 'label label-info')]), 'format' => 'html'], ['attribute' => 'rbacRoles', 'value' => $childRoles ? Html::ul($childRoles, ['class' => 'list-unstyled']) : null, 'format' => 'html'], 'last_visit_at:datetime', 'created_at:datetime', 'updated_at:datetime']]);