public function deletePractice() { if (isset($_GET['idPractice'])) { $infosUser = new UserDAO(); $managerPractice = new PracticeDAO(); $infos = $infosUser->getInfoUser($_SESSION['idUser']); $haveRight = false; if ($infos['type'] == 'Professeur') { $practices = $managerPractice->getPracticesByUser($infos['id']); if ($practices) { foreach ($practices as $practice) { if ($practice['user'] == $infos['id'] && $_GET['idPractice'] == $practice['id']) { $haveRight = true; } } } } if ($infos['type'] == 'Admin' || $haveRight) { $uploader = PracticeController::Instance(); $uploader->deleteFile($_GET['idPractice']); $_SESSION['success'] = 'Le cours a bien été supprimé'; $_SESSION['display_msg_success'] = true; $this->profile(); } else { $_SESSION['error'] = 'Vous n\'avez pas les droits requis pour accéder à cette page'; $_SESSION['display_msg_error'] = true; $this->profile(); } } else { $_SESSION['error'] = '[3] La page n\'existe pas'; $_SESSION['display_msg_error'] = true; $this->profile(); } }