mirror of
https://gitlab.com/animath/si/plateforme-corres2math.git
synced 2025-01-07 13:02:21 +00:00
Possibilité de supprimer un participant
This commit is contained in:
parent
faae8613cf
commit
ac1b3ec7e8
@ -49,6 +49,16 @@ if (isset($_POST["view_as"]) && $_SESSION["role"] == Role::ADMIN) {
|
||||
exit();
|
||||
}
|
||||
|
||||
if (isset($_POST["delete_account"]) && $team == null && $_SESSION["role"] == Role::ADMIN) {
|
||||
/** @var Document $document */
|
||||
foreach ($user->getAllDocuments() as $document)
|
||||
unlink($LOCAL_PATH . "/files/" . $document->getFileId());
|
||||
$DB->prepare("DELETE FROM `documents` WHERE `user` = ?;")->execute([$user->getId()]);
|
||||
$DB->prepare("DELETE FROM `users` WHERE `id` = ?;")->execute([$user->getId()]);
|
||||
header("Location: /");
|
||||
exit();
|
||||
}
|
||||
|
||||
class AttributeTeam
|
||||
{
|
||||
private $team_id;
|
||||
|
@ -18,9 +18,9 @@ if (!$has_error) {
|
||||
}
|
||||
?>
|
||||
|
||||
<div class="alert alert-info">
|
||||
<div class="alert alert-info">
|
||||
<strong>Rôle :</strong> <?= Role::getTranslatedName($user->getRole()) ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php if ($user->getRole() == Role::PARTICIPANT || $user->getRole() == Role::ENCADRANT) { ?>
|
||||
<div class="alert alert-info">
|
||||
@ -41,7 +41,7 @@ if (!$has_error) {
|
||||
continue;
|
||||
|
||||
$team_name = $t->getName() . " (" . $t->getTrigram() . "), "
|
||||
. ($t->getProblem() == 0 ? "pas de problème choisi" :"problème " . $t->getProblem());
|
||||
. ($t->getProblem() == 0 ? "pas de problème choisi" : "problème " . $t->getProblem());
|
||||
$team_id = $t->getId();
|
||||
echo "<option value=\"$team_id\">$team_name</option>\n";
|
||||
}
|
||||
@ -58,7 +58,7 @@ if (!$has_error) {
|
||||
</form>
|
||||
<?php } elseif ($team->getValidationStatus() == ValidationStatus::NOT_READY) { ?>
|
||||
<form method="POST">
|
||||
<input type="hidden" name="kick" />
|
||||
<input type="hidden" name="kick"/>
|
||||
<a href="#" onclick="this.parentNode.submit()">Virer de l'équipe</a>
|
||||
</form>
|
||||
<?php } ?>
|
||||
@ -98,12 +98,21 @@ if (!$has_error) {
|
||||
printDocuments($documents);
|
||||
}
|
||||
|
||||
if ($_SESSION["role"] == Role::ADMIN && $_SESSION["user_id"] != $user->getId()) { ?>
|
||||
<hr />
|
||||
if ($_SESSION["role"] == Role::ADMIN && $_SESSION["user_id"] != $user->getId()) {
|
||||
if ($user->getRole() != Role::ADMIN && $team == null) { ?>
|
||||
<hr/>
|
||||
|
||||
<form method="POST">
|
||||
<input type="submit" name="view_as" class="btn btn-secondary btn-lg btn-block" style="background-color: #ff2e34"
|
||||
value="Afficher le site en tant que <?= $user->getFirstName() . " " . $user->getSurname() ?>" />
|
||||
<input type="submit" name="delete_account" class="btn btn-secondary btn-lg btn-block"
|
||||
style="background-color: #ff2e34" value="Supprimer le compte"/>
|
||||
</form>
|
||||
<?php } ?>
|
||||
|
||||
<hr/>
|
||||
|
||||
<form method="POST">
|
||||
<input type="submit" name="view_as" class="btn btn-secondary btn-lg btn-block" style="background-color: #2ba42b"
|
||||
value="Afficher le site en tant que <?= $user->getFirstName() . " " . $user->getSurname() ?>"/>
|
||||
</form>
|
||||
<?php }
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user