Exemplo n.º 1
0
                </div>
                <div class="panel-body">
                    <?php 
echo Html::beginForm(['set-child-roles', 'id' => $role->name]);
?>

                    <?php 
echo Html::checkboxList('child_roles', ArrayHelper::map($childRoles, 'name', 'name'), ArrayHelper::map($allRoles, '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-bottom: 5px; 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>";
}]);
?>

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