예제 #1
0
    $role_detail = $do_role->get_role_detail($idrole);
    if (count($role_detail) > 0) {
        $allow_role_delete = true;
    } else {
        $msg = _('The role you are trying to delete does not exist !');
    }
}
if ($allow_role_delete === false) {
    echo '<div class="alert alert-error alert-block" style="height:100px;margin-top:20px;margin-left:200px;margin-right:200px;">';
    echo '<h4>';
    echo _('Delete not allowed !');
    echo '</h4>';
    echo $msg;
    echo '</div>';
} elseif ($allow_role_delete === true) {
    $users = $do_role->get_users_with_idrole($idrole);
    if ($users === false) {
        echo '<div class="alert alert-info">';
        echo _('There is no user associated with this role, so you can delete the role without having to transfer any data');
        echo '</div>';
    } else {
        echo '<div class="alert alert-info">';
        echo _('Following users are associated with the role you are trying to delete, please assign a different role to these users before delting the role.');
        echo '<br />';
        foreach ($users as $users) {
            echo '- ' . $users["user_name"] . '( ' . $users["full_name"] . ' )<br />';
        }
        echo '</div>';
    }
    $e_del = new Event("Roles->eventDeleteRole");
    $e_del->addParam("idrole", $idrole);