From ac1b3ec7e8188c25f69f95de67e51b83f41beba2 Mon Sep 17 00:00:00 2001 From: Yohann Date: Sun, 27 Oct 2019 00:18:50 +0200 Subject: [PATCH] =?UTF-8?q?Possibilit=C3=A9=20de=20supprimer=20un=20partic?= =?UTF-8?q?ipant?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- server_files/controllers/informations.php | 10 ++++ server_files/views/informations.php | 57 +++++++++++++---------- 2 files changed, 43 insertions(+), 24 deletions(-) diff --git a/server_files/controllers/informations.php b/server_files/controllers/informations.php index 46b5659..46e0625 100644 --- a/server_files/controllers/informations.php +++ b/server_files/controllers/informations.php @@ -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; diff --git a/server_files/views/informations.php b/server_files/views/informations.php index f5a0350..391dd5a 100644 --- a/server_files/views/informations.php +++ b/server_files/views/informations.php @@ -18,15 +18,15 @@ if (!$has_error) { } ?> -
- Rôle : getRole()) ?> -
+
+ Rôle : getRole()) ?> +
getRole() == Role::PARTICIPANT || $user->getRole() == Role::ENCADRANT) { ?>
Équipe : getTrigram() . "\">" - . $team->getName() . " (" . $team->getTrigram() . ")" ?> + . $team->getName() . " (" . $team->getTrigram() . ")" ?>
@@ -34,31 +34,31 @@ if (!$has_error) {
- + - +
getValidationStatus() == ValidationStatus::NOT_READY) { ?>
- + Virer de l'équipe
@@ -94,16 +94,25 @@ if (!$has_error) {

Autorisation de droit à l'image :

- getId()) { ?> -
+if ($_SESSION["role"] == Role::ADMIN && $_SESSION["user_id"] != $user->getId()) { + if ($user->getRole() != Role::ADMIN && $team == null) { ?> +
+ +
+ +
+ + +
- getSurname() ?>" /> + getSurname() ?>"/>