Ejemplo n.º 1
0
    $do_profile->getId($idprofile);
    if ($do_profile->getNumRows() > 0) {
        $allow_role_delete = true;
    } else {
        $msg = _('The profile 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) {
    $associated_roles = $do_role_profile_rel->get_roles_related_to_profile($idprofile);
    if ($associated_roles === false) {
        echo '<div class="alert alert-info">';
        echo _('This profile is not associated with any role, so you can delete the profile without having to transfer any data');
        echo '</div>';
    } else {
        echo '<div class="alert alert-info">';
        echo _('This profile is associated with the following roles, please assign a different profile to these roles before deleting it.');
        echo '<br />';
        foreach ($associated_roles as $associated_roles) {
            echo '- ' . $associated_roles . '<br />';
        }
        echo '</div>';
    }
    $e_del = new Event("Roles->eventDeleteRole");
    $e_del->addParam("idrole", $idrole);