Exemplo n.º 1
0
    </div>

    <div class="row">
        <div class="col-sm-4">
            <div class="panel panel-default">
                <div class="panel-heading">
                    <strong>
                        <span class="glyphicon glyphicon-th"></span> <?php 
echo Yii::t('yee/user', 'Roles');
?>
                    </strong>
                </div>
                <div class="panel-body">

                    <?php 
echo Html::beginForm(['set-roles', 'id' => $user->id]);
?>

                    <?php 
echo Html::checkboxList('roles', ArrayHelper::map(Role::getUserRoles($user->id), 'name', 'name'), ArrayHelper::map(Role::getAvailableRoles(), 'name', 'description'), ['item' => function ($index, $label, $name, $checked, $value) {
    $list = '<ul style="padding-left: 10px">';
    foreach (Role::getPermissionsByRole($value) as $permissionName => $permissionDescription) {
        $list .= $permissionDescription ? "<li>{$permissionDescription}</li>" : "<li>{$permissionName}</li>";
    }
    $list .= '</ul>';
    $helpIcon = Html::beginTag('span', ['title' => Yii::t('yee/user', 'Permissions for "{role}" role', ['role' => $label]), 'data-content' => $list, 'data-html' => 'true', 'role' => 'button', 'style' => 'margin: 0 30px 5px 0; padding: 0 5px;', 'class' => 'btn btn-sm btn-default role-help-btn']);
    $helpIcon .= '?';
    $helpIcon .= Html::endTag('span');
    $checkbox = Html::checkbox($name, $checked, ['label' => $label, 'value' => $value]);
    return "<div><div class='pull-left' style='margin-right: 15px;'>{$checkbox}</div><div>{$helpIcon}</div></div>";
}]);
Exemplo n.º 2
0
            </div>
        </div>

        <div class="col-sm-8">
            <div class="panel panel-default">
                <div class="panel-heading">
                    <strong>
                        <span class="glyphicon glyphicon-th"></span>
                        <?php 
echo Yii::t('yee/user', 'Permissions');
?>
                    </strong>
                </div>
                <div class="panel-body">
                    <?php 
echo Html::beginForm(['set-child-permissions', 'id' => $role->name]);
?>

                    <div class="row">
                        <?php 
foreach ($permissionsByGroup as $groupName => $permissions) {
    ?>
                            <div class="col-sm-6">
                                <fieldset>
                                    <legend><?php 
    echo $groupName;
    ?>
</legend>
                                    <?php 
    echo Html::checkboxList('child_permissions', ArrayHelper::map($currentPermissions, 'name', 'name'), ArrayHelper::map($permissions, 'name', 'description'));
    ?>
Exemplo n.º 3
0
        </div>

        <div class="col-sm-8">
            <div class="panel panel-default">
                <div class="panel-heading">
                    <strong>
                        <span class="glyphicon glyphicon-th"></span><?php 
echo Yii::t('yee/user', 'Routes');
?>
                    </strong>
                </div>

                <div class="panel-body">

                    <?php 
echo Html::beginForm(['set-child-routes', 'id' => $item->name]);
?>

                    <div class="row">
                        <div class="col-sm-3">
                            <?php 
if (User::hasPermission('manageRolesAndPermissions')) {
    ?>
                                <?php 
    echo Html::submitButton(Yii::t('yee', 'Save'), ['class' => 'btn btn-primary btn-sm']);
    ?>
                            <?php 
}
?>
                        </div>