public function showModule() { if (isset($_GET['idModule'])) { $infosUser = new UserDAO(); $infos = $infosUser->getInfoUser($_SESSION['idUser']); $managerFormation = new FormationDAO(); $managerModule = new ModuleDAO(); $haveRight = false; if ($infos['type'] != 'Admin') { $formations = $managerFormation->getFormationsByUser($infos['id']); $mesModules = array(); foreach ($formations as $formation) { array_push($mesModules, $managerModule->getModulesByFormation($formation['id'])); } foreach ($mesModules as $formation) { foreach ($formation as $module) { if ($module['id'] == $_GET['idModule']) { $haveRight = true; } } } } if ($haveRight || $infos['type'] == 'Admin') { $isModuleExist = $managerModule->verifModule($_GET['idModule']); if (!$isModuleExist) { $_SESSION['error'] = 'Le module n\'existe pas'; $_SESSION['display_msg_error'] = true; $this->profile(); } else { $managerPractice = new PracticeDAO(); $mesCours = $managerPractice->getPracticesByModule($_GET['idModule']); if ($mesCours) { foreach ($mesCours as &$cours) { $idUserForPractice = $cours['user']; $getInfoUser = $infosUser->getInfoUser($idUserForPractice); if ($cours['user'] == $infos['id']) { $cours['haveRight'] = true; } else { $cours['haveRight'] = false; } $cours['user'] = $getInfoUser['login']; } } $infosModule = $managerModule->getNameModule($_GET['idModule']); $practiceView = new PracticeView(); echo $practiceView->getView($mesCours, $infos['type'], $infosModule['name']); } } 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'] = '[10] La page n\'existe pas'; $_SESSION['display_msg_error'] = true; $this->profile(); } }