diff --git a/project/src/.gitignore b/project/src/.gitignore deleted file mode 100755 index c588538..0000000 --- a/project/src/.gitignore +++ /dev/null @@ -1,5 +0,0 @@ -vendor/ -composer.lock -js/bootstrap*.js* -css/bootstrap*.css* -config.php diff --git a/project/src/.htaccess b/project/src/.htaccess deleted file mode 100755 index 7ded04e..0000000 --- a/project/src/.htaccess +++ /dev/null @@ -1,3 +0,0 @@ -RewriteEngine on -RewriteCond %{REQUEST_FILENAME} !-f -RewriteRule . index.php [L] \ No newline at end of file diff --git a/project/src/composer.json b/project/src/composer.json deleted file mode 100755 index 9e1c6da..0000000 --- a/project/src/composer.json +++ /dev/null @@ -1,26 +0,0 @@ -{ - "autoload": { - "psr-4": { - "controller\\": "controller/", - "config\\": "config/", - "model\\": ["model/", "model/mdl/", "model/gateways/", "model/metier/", "model/exception/"] - } - }, - "require": { - "altorouter/altorouter": "^2.0", - "twig/twig": "^3.7", - "twbs/bootstrap": "^5.3", - "ext-iconv": "*", - "ext-pdo": "*" - }, - "scripts": { - "post-update-cmd": [ - "mkdir -p ./css", - "mkdir -p ./js", - "rm -f ./js/bootstrap*.js*", - "rm -f ./css/bootstrap*.css*", - "cp ./vendor/twbs/bootstrap/dist/js/* ./js/", - "cp ./vendor/twbs/bootstrap/dist/css/* ./css/" - ] - } -} diff --git a/project/src/composer.phar b/project/src/composer.phar deleted file mode 100755 index e766506..0000000 Binary files a/project/src/composer.phar and /dev/null differ diff --git a/project/src/config/Validation.php b/project/src/config/Validation.php deleted file mode 100755 index 3c2fc37..0000000 --- a/project/src/config/Validation.php +++ /dev/null @@ -1,111 +0,0 @@ - 0) { - return 0; - } - return $val; - } - - public static function valMdlScienceQuizz($scienceQuizz, array &$dVueErreur): MdlScienceQuizz - { - if(! $scienceQuizz instanceof MdlScienceQuizz){ - $role = NULL; - $dVueErreur[] = 'Erreur, mauvais jeu en utilisation'; - throw new ValidationException('Erreur, mauvais jeu en utilisation'); - } - return $scienceQuizz; - } - -} diff --git a/project/src/config/config.php b/project/src/config/config.php deleted file mode 100755 index a4d2110..0000000 --- a/project/src/config/config.php +++ /dev/null @@ -1,18 +0,0 @@ - __DIR__.'/../', - - "db" => ["dsn" => 'pgsql:host=localhost;dbname=postgres', - "login" => 'postgres', - "mdp" => 'root'], - "templates" => ["index" => 'vues/index.php', - "pseudo" => 'pseudo.html', - "jouer" => "jouer.html", - "pendu" => "pendu.html", - "penduScore" => 'penduScore.html', - "scienceQuizz" => 'scienceQuizz.html', - "scienceQuizzReponse" => 'scienceQuizzReponse.html', - "scienceQuizzRecap" => 'scienceQuizzRecap.html',] -]; \ No newline at end of file diff --git a/project/src/controller/AdminController.php b/project/src/controller/AdminController.php deleted file mode 100755 index 4bc5f7f..0000000 --- a/project/src/controller/AdminController.php +++ /dev/null @@ -1,137 +0,0 @@ -render('admin/accueil.html'); - } - public function notLogged(array $params) { - global $twig; - //dire acces interdit aux non admins - $dVueErreur[] = 'Erreur 403 : Accès interdit !'; - echo $twig->render('erreur.html', ['dVueErreur' => $dVueErreur]); - } - public function stats(array $params) { - global $twig; - - echo $twig->render('admin/stats.html'); - } - public function ajouterScientifiques(array $params) { - global $twig; - - $sexe = new MdlSexe(); - $theme = new MdlThematique(); - $diff = new MdlDifficulte(); - $scient=null; - if(!empty($_POST)){ - $id=0; - if(isset($_GET["id"])){ - $id=intval($_GET["id"]); - } - try{ - $this->verifierDonnees(); - } catch (Exception $ex){ - $dVueErreur[] = 'Erreur : '.$ex; - echo $twig->render('erreur.html', ['dVueErreur' => $dVueErreur]); - return; - } - $sci = new Scientifique( - $id, - $_POST["name"], - $_POST["prenom"], - $_POST["url"], - \DateTime::createFromFormat("Y-m-d", $_POST["date"]), - $_POST["description"], - 0, - $theme->getFromId(intval($_POST["theme"])), - $diff->getFromId(intval($_POST["difficulte"])), - $sexe->getFromId(intval($_POST["sexe"])) - ); - $mdlsci=new MdlScientifique(); - if(isset($_GET["id"])){ - $mdlsci->editScientifique($sci); - } else { - $mdlsci->addScientifique($sci); - } - } - if(isset($_GET["id"])){ - $scient=new MdlScientifique(); - $scient=$scient->getScientifique($_GET["id"]); - } - - echo $twig->render('admin/ajouterScientifiques.html',['sexe' => $sexe->getAll(), 'themes' => $theme->getAll(), 'difficultes' => $diff->getAll(), 'scientifique' => $scient]); - } - public function listeScientifiques(array $params) { - global $twig; - - $ms = new MdlScientifique(); - if (!isset($params['id'])) { - $page = 1; - } else { - $page = Validation::valPosInt($params['id']); - } - $dVue['listeScientifiques'] = $ms->getScientifiquesParPage($page); - $dVue['pageMax'] = $ms->getMaxPages(); - $dVue['page'] = $page; - if ($page - 1 <= 0) { - $dVue['pagePrec'] = 1; - } else { - $dVue['pagePrec'] = $page - 1; - } - if ($page + 1 >= $dVue['pageMax']) { - $dVue['pageSuiv'] = $dVue['pageMax']; - } else { - $dVue['pageSuiv'] = $page + 1; - } - echo $twig->render('admin/listeScientifiques.html',['dVue' => $dVue]); - } - - - private function verifierDonnees(){ - $sexe = new MdlSexe(); - $theme = new MdlThematique(); - $diff = new MdlDifficulte(); - $selectTheme=$theme->getFromId(intval($_POST["theme"])); - $selectDiff=$diff->getFromId(intval($_POST["difficulte"])); - $selectSexe=$sexe->getFromId(intval($_POST["sexe"])); - //todo : verifier les données, mettre dans une fonction et try catch - if(strlen($_POST["name"]) < 2){ - throw new Exception("nom trop court"); - } - if(strlen($_POST["prenom"]) < 2){ - throw new Exception("prénom trop court"); - } - if(empty($_POST["url"])){ - throw new Exception("pas de photo"); - } - if(strlen($_POST["name"]) < 2){ - throw new Exception("nom trop court"); - } - if(strlen($_POST["description"]) < 20){ - throw new Exception("description trop courte "); - } - if($selectTheme==null){ - throw new Exception("thematique inconnue"); - } - if($selectSexe==null){ - throw new Exception("sexe inconnu"); - } - if($selectDiff==null){ - throw new Exception("difficulté inconnue"); - } - } -} - -?> \ No newline at end of file diff --git a/project/src/controller/FrontController.php b/project/src/controller/FrontController.php deleted file mode 100755 index 2b6bc6e..0000000 --- a/project/src/controller/FrontController.php +++ /dev/null @@ -1,116 +0,0 @@ -setBasePath($basePath); - - // Correspond à action = null et permet d'éviter une erreur sur la page /index.php - $router->map('GET|POST','/index.php','UserController'); - - $router->map('GET|POST','/pseudo/[a:action]?','_TO_DELETE__PseudoController'); - $router->map('GET|POST','/admin/[a:action]?/[i:id]?','AdminController'); - $router->map('GET|POST','/[a:action]?/[i:id]?','UserController'); - - try { - session_start(); - } catch (Exception $e) { - die('Session start failed: ' . $e->getMessage()); - } - - $dVue['idAdmin'] = false; - $dVue['idUser'] = false; - - if(isset($_SESSION['pseudo'])) { - $dVue['pseudo'] = $_SESSION['pseudo']; - if (isset($_SESSION['isUser']) && $_SESSION['isUser']) { - $dVue['isUser'] = true; - } elseif (isset($_SESSION['idAdmin']) && $_SESSION['idAdmin']) { - $dVue['isAdmin'] = true; - } - } - - try { - $match = $router->match(); - - if (!$match) { - throw new Exception('Wrong call'); - } - - switch($match['target']) { - - case 'UserController': - $this->callController('UserController',$match); - break; - - case 'AdminController': - $action = $match['params']['action'] ?? ''; - if (!MdlAdmin::isAdmin()) { - $match['params']['action'] = 'notLogged'; - } - $this->callController('AdminController',$match); - break; - - case '_TO_DELETE__PseudoController': - $this->callController('_TO_DELETE__PseudoController',$match); - break; - //mauvaise action - default: - $dVueErreur[] = "Erreur d'appel php"; - echo $twig->render('accueil.html', ['dVueErreur' => $dVueErreur]); - break; - } - } catch (LoginException $e) { - echo $twig->render('erreur.html', ['dVueErreur' => $dVueErreur]); - echo $twig->render('login.html'); - } catch (Exception $e2) { - $dVueErreur[] = 'Erreur inattendue !'; - $dVueErreur[] = $e2->getMessage(); - echo $twig->render('erreur.html', ['dVueErreur' => $dVueErreur]); - } - - exit(0); - } - - private function callController(string $cont, array $match) { - global $twig; - - $controller = '\\controller\\'.$cont; - $controller = new $controller; - $action = $match['params']['action'] ?? 'defaultAction'; - - if (is_callable(array($controller,$action))) { - call_user_func_array(array($controller,$action),array($match['params'])); - } else { - echo $twig->render('erreur.html', ['dVueErreur' => array('Page inconnue')]); - } - } -} diff --git a/project/src/controller/InviteController.php b/project/src/controller/InviteController.php deleted file mode 100644 index 0780549..0000000 --- a/project/src/controller/InviteController.php +++ /dev/null @@ -1,157 +0,0 @@ -render('accueil.html', ["dVue"=>$dVue]); - } - - public function historique(array $params) { - global $twig; - global $dVueErreur; - global $dVue; - - $ms = new MdlScientifique(); - - if (!isset($params['id'])) { - $page = 1; - } else { - $page = Validation::valPosInt($params['id']); - } - - $pseudo = Validation::valPseudo($_SESSION['pseudo'],$dVueErreur); - - $dVue['listeScientifiques'] = $ms->getHistoriqueParPage($pseudo,$page); - $dVue['pageMax'] = $ms->getMaxPagesHistorique($pseudo); - $dVue['page'] = $page; - - if ($page - 1 <= 0) { - $dVue['pagePrec'] = 1; - } else { - $dVue['pagePrec'] = $page - 1; - } - if ($page + 1 >= $dVue['pageMax']) { - $dVue['pageSuiv'] = $dVue['pageMax']; - } else { - $dVue['pageSuiv'] = $page + 1; - } - - echo $twig->render('historique.html',['dVue' => $dVue]); - } - - public function joinParty(array $params) { - global $twig; - - if(isset($_POST['codeInvitation'])){ - $codeInvitation = $_POST['codeInvitation']; - Validation::valCodeInvitation($codeInvitation, $dVueErreur); - echo $twig->render('join.html'); - } - } - - /** - * @throws Exception - */ - public function jouer(array $params) { - global $twig, $config; - $dVue = []; - $dVueErreur = []; - - if(isset($_SESSION["configuration"]) && isset($_SESSION['role'])){ - try{ - $role = $_SESSION['role']; - $role = Validation::valRole($role, $dVueErreur); - $configurationJeu = $_SESSION['configuration']; - $configurationJeu = Validation::valConfigurationJeu($configurationJeu, $dVueErreur); - }catch(ValidationException $e){ - header('Location: .'); - } - - if(count($dVueErreur) == 0){ - $idJeu = $configurationJeu->getJeu()->getId(); - switch($idJeu){ - case 2: - new _TO_DELETE__ScienceQuizzController($role, $configurationJeu); - break; - case 3: - new _TO_DELETE__PenduController($role, $configurationJeu); - break; - default: - throw new Exception("Jeu non défini !"); - } - } - }else{ - header("Location: ."); - } - } - - public function createParty(array $params) : void - { - global $twig; - global $dVueErreur; - - $listJeu = (new MdlJeu())->getAll(); - $listDifficulte = (new MdlDifficulte())->getAll(); - - $dVueCreateJeu = []; - foreach($listJeu as $jeu){ - $dVueCreateJeu[] = ['id' => $jeu->getId(), 'nom' => $jeu->getNom()]; - } - - $dVueCreateDifficulte = []; - foreach($listDifficulte as $difficulte){ - $dVueCreateDifficulte[] = ['id' => $difficulte->getId(), 'libelle' => $difficulte->getLibelle()]; - } - - echo $twig->render('create.html', ["dVueErreur" => $dVueErreur, 'dVueCreate' => ["jeux" => $dVueCreateJeu, "difficultes" => $dVueCreateDifficulte]]); - } - - public function ValidationFormulaire(array $params) - { - global $twig; - global $dVue; - global $dVueErreur; - global $basePath; - - $id_jeu = $_POST['jeu'] ?? ''; - $id_difficulte = $_POST['difficulte'] ?? ''; - try{ - Validation::val_form($id_jeu, $id_difficulte, $dVueErreur); - }catch (ValidationException|Exception $ex){ - $this->CreateParty($dVueErreur); - } - - if(count($dVueErreur) == 0){ - $jeu = (new MdlJeu())->getFromId($id_jeu); - $difficulte = (new MdlDifficulte())->getFromId($id_difficulte); - $_SESSION['configuration'] = new ConfigurationJeu($jeu, $difficulte); - - if(isset($_SESSION['role'])){ - header('Location: '.$basePath.'/jouer'); - }else{ - header("Location: ".$basePath."/pseudo"); - } - #echo $twig->render('accueil.html', ['dVue' => $dVue, 'dVueErreur' => $dVueErreur]); - }else{ - $this->CreateParty($dVueErreur); - } - } -} \ No newline at end of file diff --git a/project/src/controller/UserController.php b/project/src/controller/UserController.php deleted file mode 100755 index 7415b69..0000000 --- a/project/src/controller/UserController.php +++ /dev/null @@ -1,96 +0,0 @@ -login($_REQUEST['login'], $_REQUEST['password'])) { - $_SESSION['pseudo'] = $_REQUEST['login']; - $_SESSION['idUser'] = true; - $_SESSION['isLogged'] = true; - $_SESSION['role'] = $ug->getFromEmail($_REQUEST['login']); - header("Location: ."); - } else { - //voir si c'est un admin - $ug = new MdlAdmin(); - if ($ug->login($_REQUEST['login'], $_REQUEST['password'])) { - $_SESSION['pseudo'] = $_REQUEST['login']; - $_SESSION['isAdmin'] = true; - $_SESSION['isLogged'] = true; - unset($_SESSION['role']); - header("Location: ."); - } else { - $dVueErreur[] = "Connexion échouée"; - throw new LoginException("Connexion err"); - } - } - } else { - echo $twig->render('login.html'); - } - } - - public function register() { - global $twig, $dVueErreur; - if ($_SERVER['REQUEST_METHOD'] === 'POST') { - if($_REQUEST['password']!=$_REQUEST['cpassword']){ - $dVueErreur[]="Mots de passe différents."; - echo $twig->render('erreur.html',["dVueErreur" => $dVueErreur]); - return; - } - $ug = new MdlUser(); - try{ - if($ug->register($_REQUEST['login'], $_REQUEST['password'])){ - header('Location: login'); - } else { - $dVueErreur[]="Erreur de création de compte. Le compte doit déjà exister."; - echo $twig->render('erreur.html',["dVueErreur" => $dVueErreur]); - } - } catch (PseudoDejaPrisException $ex){ - $dVueErreur[]="Erreur de création de compte. Le compte existe déjà."; - echo $twig->render('erreur.html',["dVueErreur" => $dVueErreur]); - }catch(Exception $ex){ - $dVueErreur[]="Erreur de création de compte."; - echo $twig->render('erreur.html',["dVueErreur" => $dVueErreur]); - } - - } else { - echo $twig->render('register.html'); - } - } - - public function logout(){ - session_destroy(); - $_SESSION=[]; - header("Location: ."); - } -} \ No newline at end of file diff --git a/project/src/controller/_TO_DELETE__JouerController.php b/project/src/controller/_TO_DELETE__JouerController.php deleted file mode 100755 index 42f99f6..0000000 --- a/project/src/controller/_TO_DELETE__JouerController.php +++ /dev/null @@ -1,46 +0,0 @@ -getJeu()->getId(); - switch($idJeu){ - case 2: - new _TO_DELETE__ScienceQuizzController($role, $configurationJeu); - break; - case 3: - new _TO_DELETE__PenduController($role, $configurationJeu); - break; - default: - throw new Exception("Jeu non défini !"); - } - } - }else{ - header("Location: ".$basePath); - } - } -} \ No newline at end of file diff --git a/project/src/controller/_TO_DELETE__PenduController.php b/project/src/controller/_TO_DELETE__PenduController.php deleted file mode 100755 index 0cdc6fa..0000000 --- a/project/src/controller/_TO_DELETE__PenduController.php +++ /dev/null @@ -1,133 +0,0 @@ -role=$role; - $this->dVue = []; - $this->dVueErreur = []; - if(isset($_SESSION['pendu']) && Validation::valMdlPendu($_SESSION['pendu'], $this->dVueErreur)){ - $this->pendu = $_SESSION['pendu']; - }else{ - $this->reinit(); - } - - if(isset($_POST['lettre'])){ - try{ - $this->pendu->jouerLettre($_POST['lettre']); - }catch (ValidationException $e){ - $this->dVueErreur[] = $e->getMessage(); - } - } - - if($this->pendu->aGagne()){ - $this->renderAgagne(); - }elseif($this->pendu->aPerdu()){ - $this->renderAPerdu(); - }else{ - $this->renderJeu(); - } - } - - /** - * @throws Exception - */ - private function reinit(){ - $mdlScientifique = new MdlScientifique(); - $scientifique = $mdlScientifique->getRandom(); - $this->pendu = new MdlPendu($scientifique); - $_SESSION['pendu'] = $this->pendu; - } - - /** - * @throws SyntaxError - * @throws RuntimeError - * @throws LoaderError - */ - private function renderJeu(){ - global $twig, $config; - $this->dVue['decouvert'] = $this->pendu->getDecouvert(); - $this->dVue['essaisRestant'] = $this->pendu->getEssaisRestant(); - $lettreUtilisees = $this->pendu->getLettreUtilisees(); - sort($lettreUtilisees); - $this->dVue['lettresUtilisees'] = $lettreUtilisees; - echo $twig->render($config['templates']['pendu'], ['dVue' => $this->dVue, 'dVueErreur'=>$this->dVueErreur]); - } - - private function ajouterScientifiqueDecouvert(){ - if($this->role instanceof Utilisateur){ - try{ - (new MdlUser())->addScientifiqueDecouvert($this->role->getId(), $this->pendu->getScientifique()->getId()); - } - catch(ValidationException $e){ - $this->dVueErreur[] = $e->getMessage(); - } - } - } - - /** - * @throws SyntaxError - * @throws RuntimeError - * @throws LoaderError - */ - private function renderAgagne(){ - $this->dVue['messageScore'] = "Vous avez gagné !"; - $this->ajouterScientifiqueDecouvert(); - $this->renderScore(); - } - - /** - * @throws SyntaxError - * @throws RuntimeError - * @throws LoaderError - */ - private function renderAPerdu(){ - $this->dVue['messageScore'] = "Vous avez perdu !"; - $this->renderScore(); - } - - /** - * @throws SyntaxError - * @throws RuntimeError - * @throws LoaderError - */ - private function renderScore(){ - global $twig, $config; - $this->dVue['nbTours'] = $this->pendu->getNbTours(); - $this->dVue['nbFails'] = $this->pendu->getNbFails(); - $scientifique = $this->pendu->getScientifique(); - $dScientifique = []; - $dScientifique['nom'] = $scientifique->getNom(); - $dScientifique['prenom'] = $scientifique->getPrenom(); - $dScientifique['sexe'] = $scientifique->getSexe()->getLibelle(); - $dScientifique['thematique'] = $scientifique->getThematique()->getLibelle(); - $dScientifique['dateNaiss'] = $scientifique->getDateNaiss()->format('d/m/Y'); - $this->dVue['scientifique'] = $dScientifique; - unset($_SESSION['pendu']); - - echo $twig->render($config['templates']['penduScore'], ["dVue" => $this->dVue]); - } -} \ No newline at end of file diff --git a/project/src/controller/_TO_DELETE__PseudoController.php b/project/src/controller/_TO_DELETE__PseudoController.php deleted file mode 100755 index 282c9be..0000000 --- a/project/src/controller/_TO_DELETE__PseudoController.php +++ /dev/null @@ -1,44 +0,0 @@ -insertInvite($pseudo, session_id()); - }catch(ValidationException $e){ - - }catch(PseudoDejaPrisException $e){ - $dVueErreur[] = "Pseudo déjà pris"; - }catch(IdSessionDoubleException $e){ - try{ - $role = $mdlInvite->setPseudo($e->getIdJoueur(), $pseudo); - - }catch(PseudoDejaPrisException $e){ - $dVueErreur[] = "Pseudo déjà pris"; - } - } - - if(isset($role)){ - $_SESSION['role'] = $role; - header('Location: '.$basePath.'/jouer'); - } - } - echo $twig->render($config['templates']['pseudo'], ["dVue" => $dVue, "dVueErreur" => $dVueErreur]); - } -} \ No newline at end of file diff --git a/project/src/controller/_TO_DELETE__ScienceQuizzController.php b/project/src/controller/_TO_DELETE__ScienceQuizzController.php deleted file mode 100644 index 7d6d8c8..0000000 --- a/project/src/controller/_TO_DELETE__ScienceQuizzController.php +++ /dev/null @@ -1,132 +0,0 @@ -dVue = []; - $this->dVueErreur = []; - if (isset($_SESSION['scienceQuizz']) && Validation::valMdlScienceQuizz($_SESSION['scienceQuizz'], $this->dVueErreur)) { - $this->scienceQuizz = $_SESSION['scienceQuizz']; - } else { - $this->reInit(); - } - - if ($this->scienceQuizz->partieTerminee()) { - $this->vueRecap(); - } - else { - $this->vueJeu(); - } - } - - /** - * @throws Exception - */ - private function reInit() - { - $mdlScientifique = new MdlScientifique(); - $scientifique = $mdlScientifique->getRandom(); - $idScientifique = $scientifique->getId(); - $questions = $mdlScientifique->getQuestions($idScientifique); - $this->scienceQuizz = new MdlScienceQuizz($idScientifique,$questions); - $_SESSION['scienceQuizz'] = $this->scienceQuizz; - } - - /** - * @throws SyntaxError - * @throws RuntimeError - * @throws LoaderError - */ - private function vueJeu() - { - global $twig, $config; - - $dStatJeu['numQuestion'] = $this->scienceQuizz->getNumQuestion(); - - $questions = $this->scienceQuizz->getQuestions(); - - if ($questions) { - $dStatJeu['question'] = $this->scienceQuizz->getRandomQuestion($questions); - } else { - // Gérer le cas où aucune question n'est disponible - $this->dVueErreur[] = "Aucune question disponible."; - echo $twig->render('erreur.html', ['dVueErreur' => $this->dVueErreur]); - return; - } - - $this->dVue['statJeu'] = $dStatJeu; - - echo $twig->render($config['templates']['scienceQuizz'], ['dVue' => $this->dVue, 'dVueErreur' => $this->dVueErreur]); - ?> - - scienceQuizz->getNom(); - $dScientifique['prenom'] = $this->scienceQuizz->getPrenom(); - $dScientifique['dateNaissance'] = $this->scienceQuizz->getDateNaissance(); - - - $this->dVue['scientifique'] = $dScientifique; - - echo $twig->render($config['templates']['scienceQuizzReponse'], ["dVue" => $this->dVue]); - } - - /** - * @throws RuntimeError - * @throws SyntaxError - * @throws LoaderError - */ - private function vueRecap() - { - global $twig, $config; - - $dStatJoueur ['bonneReponse'] = $this->scienceQuizz->getBonneReponse(); - $dStatJoueur ['nbPoints'] = $this->scienceQuizz->getNbPoints(); - - $this->dVue['statJoueur'] = $dStatJoueur; - unset($_SESSION['scienceQuizz']); - - echo $twig->render($config['templates']['scienceQuizzRecap'], ["dVue" => $this->dVue]); - } -} \ No newline at end of file diff --git a/project/src/db.sql b/project/src/db.sql deleted file mode 100755 index 24aa91a..0000000 --- a/project/src/db.sql +++ /dev/null @@ -1,197 +0,0 @@ --- Testé sous pgsql 15 - -DROP TABLE IF EXISTS Reponse; - -DROP TABLE IF EXISTS Question; - -DROP TABLE IF EXISTS Admin; - -DROP TABLE IF EXISTS Partie; - -DROP TABLE IF EXISTS Jeu; - -DROP TABLE IF EXISTS Decouvrir; - -DROP TABLE IF EXISTS Utilisateur; - -DROP TABLE IF EXISTS Invite; - -DROP TABLE IF EXISTS Joueur; - -DROP TABLE IF EXISTS Indice; - -DROP TABLE IF EXISTS Scientifique; - -DROP TABLE IF EXISTS Thematique; - -DROP TABLE IF EXISTS Difficulte; - -DROP TABLE IF EXISTS Sexe; - - --- THEMATIQUE - -CREATE TABLE Thematique( - id SERIAL PRIMARY KEY, - libelle varchar(128) NOT NULL UNIQUE -); - - --- DIFFICULTE - -CREATE TABLE Difficulte( - id SERIAL PRIMARY KEY, - libelle varchar(128) NOT NULL UNIQUE -); - - --- SEXE - -CREATE TABLE Sexe( - id SERIAL PRIMARY KEY, - libelle varchar(128) NOT NULL UNIQUE -); - - --- SCIENTIFIQUE - -CREATE TABLE Scientifique( - id SERIAL PRIMARY KEY, - nom varchar(128) NOT NULL, - prenom varchar(128) NOT NULL, - photo varchar(512) NOT NULL, - dateNaissance date NOT NULL, - descriptif text NOT NULL, - ratioTrouvee numeric(5,4), - idThematique integer REFERENCES Thematique(id), - idDifficulte integer REFERENCES Difficulte(id), - idSexe integer REFERENCES Sexe(id) -); - - --- INDICE - -CREATE TABLE Indice( - id SERIAL PRIMARY KEY, - libelle varchar(512) NOT NULL UNIQUE, - idScientifique integer REFERENCES Scientifique(id) -); - --- QUESTION - -CREATE TABLE Question( - id SERIAL PRIMARY KEY, - question varchar(256) NOT NULL UNIQUE -); - - --- REPONSE - -CREATE TABLE Reponse( - id SERIAL PRIMARY KEY, - reponse varchar(255) NOT NULL, - idQuestion integer REFERENCES Question(id), - idScientifique integer REFERENCES Scientifique(id) -); - - --- ADMIN - -CREATE TABLE Admin( - id SERIAL PRIMARY KEY, - email varchar(255) NOT NULL UNIQUE, - password varchar(255) NOT NULL -); - - --- JOUEUR - -CREATE TABLE Joueur( - id SERIAL PRIMARY KEY, - pseudo varchar(255) NOT NULL UNIQUE -); - - --- Invite - -CREATE TABLE Invite( - idJoueur integer PRIMARY KEY REFERENCES Joueur(id), - idSession varchar(255) NOT NULL UNIQUE -); - - --- Utilisateur - -CREATE TABLE Utilisateur( - idJoueur integer PRIMARY KEY REFERENCES Joueur(id), - email varchar(255) NOT NULL UNIQUE, - password varchar(255) NOT NULL -); - - --- Decouvrir - -CREATE TABLE Decouvrir( - idUtilisateur integer REFERENCES Utilisateur(idJoueur), - idScientifique integer REFERENCES Scientifique(id), - PRIMARY KEY (idUtilisateur, idScientifique) -); - - --- Jeu - -CREATE TABLE Jeu( - id SERIAL PRIMARY KEY, - nom varchar(128) NOT NULL UNIQUE, - nbrParties integer NOT NULL DEFAULT 0 -); - - --- Partie - -CREATE TABLE Partie( - id SERIAL PRIMARY KEY, - codeInvitation varchar(10) NOT NULL UNIQUE, - idJoueur integer REFERENCES Joueur(id), - idJeu integer REFERENCES Jeu(id) -); - - --- INSERTS - --- Scientifiques -INSERT INTO Difficulte(libelle) VALUES ('Facile'),('Intermédiaire'),('Difficile'); -INSERT INTO Sexe(libelle) VALUES ('Homme'),('Femme'); -INSERT INTO Thematique(libelle) VALUES ('Nucléaire'),('Mathématiques'); -INSERT INTO Scientifique(nom, prenom, photo, dateNaissance, descriptif, ratioTrouvee, idThematique, idDifficulte, idSexe) -VALUES - ('Marie', 'Curie', '', CURRENT_DATE, 'desc', 0, 1, 1, 2), - ('Albert', 'Einstein', '', CURRENT_DATE, 'desc', 0, 2, 1, 1), - ('Sophie', 'Germain', '', CURRENT_DATE, 'desc', 0, 2, 2, 2); - --- Jeu -INSERT INTO Jeu(nom) VALUES ('Qui-est-ce ?'),('Science Quizz'), ('Pendu'); - --- Questions -INSERT INTO Question(question) -VALUES - ('Qui a reçu le prix Nobel de chimie en 1911, pour avoir réussi à isoler un gramme de radium ?'), - ('Quel mathématicien a dit : « Dieu existe, c’est les mathématiques » ?'), - ('Quel mathématicienne utilisa comme nom d"emprunt « Antoine Auguste Le Blanc » ?'); - --- Réponses -INSERT INTO Reponse(reponse, idQuestion, idScientifique) -VALUES - ('Marie Curie', 1, 1), - ('Albert Einstein', 2, 2), - ('Sophie Germain', 3, 3); - --- Utilisateurs -INSERT INTO Joueur(id,pseudo) VALUES (1337, 'moi, le meilleur joueur du monde'); -INSERT INTO Utilisateur(idJoueur,email,password) VALUES (1337, 'joueur','$2y$10$juGnlWC9cS19popEKLZsYeir0Jl39k6hDl0dpaCix00FDcdiEbtmS'); --- mdp = test - -INSERT INTO decouvrir(idUtilisateur,idScientifique) VALUES (1337,1); - -INSERT INTO Admin(id,email,password) VALUES (1, 'admin','$2y$10$juGnlWC9cS19popEKLZsYeir0Jl39k6hDl0dpaCix00FDcdiEbtmS'); --- mdp = test diff --git a/project/src/index.php b/project/src/index.php deleted file mode 100755 index 21fb24f..0000000 --- a/project/src/index.php +++ /dev/null @@ -1,22 +0,0 @@ - false, - ]); - - $basePath = preg_replace('/\/index.php/i', '', $_SERVER['PHP_SELF']); - - // Tableau qui contient les messages d'erreur - $dVueErreur = []; - $dVue['basePath'] = $basePath; - - $cont = new FrontController(); - \ No newline at end of file diff --git a/project/src/model/exception/IdSessionDoubleException.php b/project/src/model/exception/IdSessionDoubleException.php deleted file mode 100755 index 1566971..0000000 --- a/project/src/model/exception/IdSessionDoubleException.php +++ /dev/null @@ -1,26 +0,0 @@ -idJoueur=$idJoueur; - $this->idSession=$idSession; - } - - public function getIdJoueur():int{ - return $this->idJoueur; - } - - public function getIdSession(): string{ - return $this->idSession; - } -} \ No newline at end of file diff --git a/project/src/model/exception/LoginException.php b/project/src/model/exception/LoginException.php deleted file mode 100755 index ab91a35..0000000 --- a/project/src/model/exception/LoginException.php +++ /dev/null @@ -1,9 +0,0 @@ -con=$con; - } - - public function login(string $email, string $password): bool - { - $sql = "SELECT * FROM Admin WHERE email=:email"; - $this->con->executeQuery($sql, array( - ':email' => array($email, PDO::PARAM_STR) - )); - - $result = $this->con->getOneResult(); - - if (!empty($result)) { - return password_verify($password,$result['password']); - } - return false; - } - public function addUser(string $email, string $password): void - { - $sql = "INSERT INTO Admin (email, password) VALUES (:email, :password)"; - $stmt = $this->con->prepare($sql); - $stmt->bindValue(':email', $email); - $stmt->bindValue(':password', password_hash($password, PASSWORD_DEFAULT)); - $stmt->execute(); - } - public function deleteUser(int $id): void - { - $sql = "DELETE FROM Admin WHERE id=:id"; - $stmt = $this->con->prepare($sql); - $stmt->bindValue(':id', $id); - $stmt->execute(); - } - public function updateUser(int $id, string $email, string $password): void - { - $sql = "UPDATE Admin SET email=:email, password=:password WHERE id=:id"; - $stmt = $this->con->prepare($sql); - $stmt->bindValue(':id', $id); - $stmt->bindValue(':email', $email); - $stmt->bindValue(':password', password_hash($password, PASSWORD_DEFAULT)); - $stmt->execute(); - } - public function getUser(int $id): Admin - { - $sql = "SELECT * FROM Admin WHERE id=:id"; - $stmt = $this->con->prepare($sql); - $stmt->bindValue(':id', $id); - $stmt->execute(); - $result = $stmt->fetch(); - return new Admin($result['id'], $result['email'], $result['password']); - } - public function getUsers(): array - { - $sql = "SELECT * FROM Admin"; - $stmt = $this->con->prepare($sql); - $stmt->execute(); - $result = $stmt->fetchAll(); - $users = []; - foreach ($result as $user) { - $users[] = new Admin($user['id'], $user['email'], $user['password']); - } - return $users; - } - public function getHashedPasswordById(int $id): string - { - $sql = "SELECT password FROM Admin WHERE id=:id"; - $stmt = $this->con->prepare($sql); - $stmt->bindValue(':id', $id); - $stmt->execute(); - $result = $stmt->fetch(); - return $result['password']; - } - public function getHashedPassword(int $email): string - { - $sql = "SELECT password FROM Admin WHERE email=:email"; - $stmt = $this->con->prepare($sql); - $stmt->bindValue(':email', $email); - $stmt->execute(); - $result = $stmt->fetch(); - return $result['password']; - } - - public function getUserId(string $email): int - { - $sql = "SELECT id FROM Admin WHERE email=:email"; - $stmt = $this->con->prepare($sql); - $stmt->bindValue(':email', $email); - $stmt->execute(); - $result = $stmt->fetch(); - return $result['id']; - } - public function getUserByEmailAndPassword(string $email, string $password): Admin - { - $sql = "SELECT * FROM Admin WHERE email=:email AND password=:password"; - $stmt = $this->con->prepare($sql); - $stmt->bindValue(':email', $email); - $stmt->bindValue(':password', password_hash($password, PASSWORD_DEFAULT)); - $stmt->execute(); - $result = $stmt->fetch(); - return new Admin($result['id'], $result['email'], $result['password']); - } - - public function getFromEmail(string $email): array - { - $this->con->executeQuery( - "SELECT id, email, password FROM Admin WHERE email = :email;", - [":pseudo" => [$email, $this->con::PARAM_STR]] - ); - return $this->con->getOneResult(); - } -} diff --git a/project/src/model/gateways/Connection.php b/project/src/model/gateways/Connection.php deleted file mode 100755 index d6fc0b1..0000000 --- a/project/src/model/gateways/Connection.php +++ /dev/null @@ -1,63 +0,0 @@ -setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); - } catch (PDOException $e) { - die("Connection failed: " . $e->getMessage()); - } - } - - - /** * - * @param string $query - * @param array $params - * @return bool|null Returns `true` on success, `false` otherwise - */ - - /** - * @param string $query - * @param array $params - * @return PDOStatement|false Returns `PDOStatement` on success, `false` otherwise - * @throws Exception - */ - public function executeQuery(string $query, array $params = []) - { - try { - $stmt = $this->prepare($query); - - foreach ($params as $param => $value) { - $stmt->bindValue($param, $value[0], $value[1]); - } - - $stmt->execute(); - $this->stmt = $stmt; - - return $stmt; - - } catch (PDOException $e) { - throw new Exception($e->getMessage()); - } - } - - public function getResults() : array { - return $this->stmt->fetchall(); - } - - public function getOneResult() { - return $this->stmt->fetch(); - } - -} \ No newline at end of file diff --git a/project/src/model/gateways/DifficulteGateway.php b/project/src/model/gateways/DifficulteGateway.php deleted file mode 100755 index ec552d4..0000000 --- a/project/src/model/gateways/DifficulteGateway.php +++ /dev/null @@ -1,24 +0,0 @@ -con = $con; - } - public function getAll() : array - { - $this->con->executeQuery("SELECT id, libelle FROM Difficulte;"); - return $this->con->getResults(); - } - - public function getFromId(int $id): array - { - $this->con->executeQuery("SELECT id, libelle FROM Difficulte WHERE id=:id;", - [':id' => [$id, $this->con::PARAM_INT]]); - return $this->con->getOneResult(); - } -} \ No newline at end of file diff --git a/project/src/model/gateways/IndiceGateway.php b/project/src/model/gateways/IndiceGateway.php deleted file mode 100644 index cc4259e..0000000 --- a/project/src/model/gateways/IndiceGateway.php +++ /dev/null @@ -1,20 +0,0 @@ -con->executeQuery("SELECT idJoueur, pseudo, idSession FROM Invite JOIN Joueur ON id=idJoueur WHERE idSession = :idSession;", -// [":idSession" => [$idSession, $this->con::PARAM_STR]]); -// return $this->con->getOneResult(); -// } - - /** - * @param string $idSession - * @return array|bool - */ - public function getFromIdSession(string $idSession) { // <- PHP 7.4 - $this->con->executeQuery( - "SELECT idJoueur, pseudo, idSession FROM Invite JOIN Joueur ON id=idJoueur WHERE idSession = :idSession;", - [":idSession" => [$idSession, $this->con::PARAM_STR]] - ); - return $this->con->getOneResult(); - } - - - -// public function getFromId($id): array|bool // <- Seulement autorisé en PHP 8 /!\ (on est en 7.4) -// { -// $this->con->executeQuery("SELECT idJoueur, pseudo, idSession FROM Invite JOIN Joueur ON id=idJoueur WHERE id = :id;", -// [":id" => [$id, $this->con::PARAM_INT]]); -// return $this->con->getOneResult(); -// } - - /** - * @param int $id - * @return array|bool - */ - public function getFromId(int $id) { // <- PHP 7.4 - $this->con->executeQuery( - "SELECT idJoueur, pseudo, idSession FROM Invite JOIN Joueur ON id=idJoueur WHERE id = :id;", - [":id" => [$id, $this->con::PARAM_INT]] - ); - return $this->con->getOneResult(); - } - - public function insertInvite(string $pseudo, string $idSession): int{ - $row = $this->getFromIdSession($idSession); - if($row){ - throw new IdSessionDoubleException($row['idjoueur'], $row['idsession']); - }else{ - $id = $this->insertJoueur($pseudo); - $this->con->executeQuery("INSERT INTO Invite(idJoueur, idSession) VALUES(:id, :idSession);", - [":id" => [$id, $this->con::PARAM_INT], - ":idSession" => [$idSession, $this->con::PARAM_STR]]); - return $id; - } - } - - public function supprimerInvite(int $id) : bool { - - } -} \ No newline at end of file diff --git a/project/src/model/gateways/JeuGateway.php b/project/src/model/gateways/JeuGateway.php deleted file mode 100755 index 664f29e..0000000 --- a/project/src/model/gateways/JeuGateway.php +++ /dev/null @@ -1,24 +0,0 @@ -con = $con; - } - public function getAll() : array - { - $this->con->executeQuery("SELECT id, nom, nbrparties FROM Jeu;"); - return $this->con->getResults(); - } - - public function getFromId(int $id): array - { - $this->con->executeQuery("SELECT id, nom, nbrparties FROM Jeu WHERE id=:id;", - [':id' => [$id, $this->con::PARAM_INT]]); - return $this->con->getOneResult(); - } -} \ No newline at end of file diff --git a/project/src/model/gateways/JoueurGateway.php b/project/src/model/gateways/JoueurGateway.php deleted file mode 100755 index c8c25c4..0000000 --- a/project/src/model/gateways/JoueurGateway.php +++ /dev/null @@ -1,51 +0,0 @@ -con = $con; - } - -// protected function getFromPseudo($pseudo): array|bool <- autorisé seulement en PHP 8 -// { -// $this->con->executeQuery("SELECT id, pseudo FROM Joueur WHERE pseudo = :pseudo;", -// [":pseudo" => [$pseudo, $this->con::PARAM_STR]]); -// return $this->con->getOneResult(); -// } - - /** - * @param string $pseudo - * @return array|bool - */ - public function getFromPseudo(string $pseudo) { // <- PHP 7.4 - $this->con->executeQuery( - "SELECT id, pseudo FROM Joueur WHERE pseudo = :pseudo;", - [":pseudo" => [$pseudo, $this->con::PARAM_STR]] - ); - return $this->con->getOneResult(); - } - - public function insertJoueur(string $pseudo): int{ - if($this->getFromPseudo($pseudo)){ - throw new PseudoDejaPrisException(); - }else{ - $this->con->executeQuery("INSERT INTO Joueur(pseudo) VALUES(:pseudo);", - [":pseudo" => [$pseudo, $this->con::PARAM_STR]]); - return $this->getFromPseudo($pseudo)["id"]; - } - } - - public function setPseudo(int $id, string $pseudo){ - if($this->getFromPseudo($pseudo)){ - throw new PseudoDejaPrisException(); - }else{ - $this->con->executeQuery("UPDATE Joueur SET pseudo=:pseudo WHERE id=:id", - [":pseudo" => [$pseudo, $this->con::PARAM_STR], - ":id" => [$id, $this->con::PARAM_INT]]); - } - } -} \ No newline at end of file diff --git a/project/src/model/gateways/PartieGateway.php b/project/src/model/gateways/PartieGateway.php deleted file mode 100644 index 1480d11..0000000 --- a/project/src/model/gateways/PartieGateway.php +++ /dev/null @@ -1,31 +0,0 @@ -con = $con; - } - - public function getFromId(int $id) : array { - - } - -// public function getRandom(): array|bool{ <- autorisé seulement en PHP 8 -// $this->con->executeQuery( -// "SELECT id, nom, prenom, photo, dateNaissance, descriptif, ratiotrouvee, idthematique, iddifficulte, index FROM Scientifique ORDER BY RANDOM() LIMIT 1;"); -// return $this->con->getOneResult(); -// } - - /** - * @return array|bool - * @throws Exception - */ - public function getRandom() { // PHP 7.4 - $this->con->executeQuery( - "SELECT id, nom, prenom, photo, dateNaissance, descriptif, ratiotrouvee, idthematique, iddifficulte, idsexe FROM Scientifique ORDER BY RANDOM() LIMIT 1;" - ); - return $this->con->getOneResult(); - } - - public function getRandomFromDifficulte(Difficulte $difficulte) : array { - - } - - /** - * @throws Exception - */ - public function addScientifique(Scientifique $sci): bool{ - return $this->con->executeQuery( - "INSERT INTO Scientifique(nom, prenom, photo, dateNaissance, descriptif, ratioTrouvee, idThematique, idDifficulte, idSexe) VALUES (:nom, :prenom, :photo, :dateNaissance, :descriptif, :ratioTrouvee, :idThematique, :idDifficulte, :idSexe);" - ,[ - ":nom"=>[$sci->getNom(),$this->con::PARAM_STR], - ":prenom"=>[$sci->getPrenom(),$this->con::PARAM_STR], - ":photo"=>[$sci->getPhoto(),$this->con::PARAM_STR], - ":dateNaissance"=>[date("Y-m-d H:i:s", $sci->getDateNaiss()->getTimestamp()),$this->con::PARAM_STR], - ":descriptif"=>[$sci->getDescriptif(),$this->con::PARAM_STR], - ":ratioTrouvee"=>[$sci->getRatioTrouvee(),$this->con::PARAM_STR], - ":idThematique"=>[$sci->getThematique()->getId(),$this->con::PARAM_STR], - ":idDifficulte"=>[$sci->getDifficulte()->getId(),$this->con::PARAM_STR], - ":idSexe"=>[$sci->getSexe()->getId(),$this->con::PARAM_STR] - ]) ? true : false ; - } - - public function getScientifiquesParPages(int $currentPage, int $nbElemByPage) : array { - $query = 'SELECT * FROM Scientifique LIMIT :nbElem OFFSET :ind '; - $index = ($currentPage-1)*$nbElemByPage; - $this->con->executeQuery($query,array( - ':ind' => array($index,\PDO::PARAM_INT), - ':nbElem' => array($nbElemByPage,\PDO::PARAM_INT) - )); - return $this->con->getResults(); - } - - public function getHistorique(string $pseudoJoueur, int $currentPage, int $nbElemByPage) : array { - if($currentPage == 0) $currentPage = 1; - - $query = 'SELECT s.* - FROM Scientifique s, Decouvrir d, Utilisateur u - WHERE s.id = d.idscientifique - AND d.idutilisateur = u.idJoueur - AND u.email = :pseudo - LIMIT :nbElem OFFSET :ind '; - $index = ($currentPage-1)*$nbElemByPage; - $this->con->executeQuery($query,array( - ':ind' => array($index,\PDO::PARAM_INT), - ':nbElem' => array($nbElemByPage,\PDO::PARAM_INT), - ':pseudo' => array($pseudoJoueur,\PDO::PARAM_STR) - )); - return $this->con->getResults(); - } - - public function getNbScientifique() : int { - $query = 'SELECT DISTINCT count(*) as val FROM Scientifique'; - $this->con->executeQuery($query); - return $this->con->getResults()[0]['val']; - } - - public function getNbScientifiqueHistorique(string $pseudoJoueur) : int { - $query = 'SELECT count(*) as val - FROM Scientifique s, Decouvrir d, Utilisateur u - WHERE s.id = d.idscientifique - AND d.idutilisateur = u.idJoueur - AND u.email = :pseudo'; - $params = array( - ':pseudo' => array($pseudoJoueur,\PDO::PARAM_STR) - ); - $this->con->executeQuery($query,$params); - return $this->con->getResults()[0]['val']; - } - - /** - * @throws Exception - */ - public function editScientifique(Scientifique $sci): bool{ - return $this->con->executeQuery( - "UPDATE Scientifique SET nom = :nom, prenom = :prenom, photo = :photo, dateNaissance = :dateNaissance, descriptif = :descriptif, ratioTrouvee = :ratioTrouvee, idThematique = :idThematique, idDifficulte = :idDifficulte, idSexe = :idSexe WHERE id=:id;" - ,[ - ":nom"=>[$sci->getNom(),$this->con::PARAM_STR], - ":prenom"=>[$sci->getPrenom(),$this->con::PARAM_STR], - ":photo"=>[$sci->getPhoto(),$this->con::PARAM_STR], - ":dateNaissance"=>[date("Y-m-d H:i:s", $sci->getDateNaiss()->getTimestamp()),$this->con::PARAM_STR], - ":descriptif"=>[$sci->getDescriptif(),$this->con::PARAM_STR], - ":ratioTrouvee"=>[$sci->getRatioTrouvee(),$this->con::PARAM_STR], - ":idThematique"=>[$sci->getThematique()->getId(),$this->con::PARAM_STR], - ":idDifficulte"=>[$sci->getDifficulte()->getId(),$this->con::PARAM_STR], - ":idSexe"=>[$sci->getSexe()->getId(),$this->con::PARAM_STR], - ":id"=>[$sci->getId(),$this->con::PARAM_INT] - ]) ? true : false ; - } - - /** - * @throws Exception - */ - public function deleteScientifique(int $id): bool{ - return $this->con->executeQuery( - "DELETE FROM Scientifique WHERE id=:id;" - ,[ - ":id"=>[$id,$this->con::PARAM_INT] - ]); - } - - /** - * @throws Exception - */ - public function getScientifique(int $id) { - $this->con->executeQuery( - "SELECT id, nom, prenom, photo, dateNaissance, descriptif, ratioTrouvee, idThematique, idDifficulte, idSexe FROM Scientifique WHERE id=:id;" - ,[ - ":id"=>[$id,$this->con::PARAM_INT] - ]); - return $this->con->getOneResult(); - } - - /** - * @throws Exception - */ - public function getQuestions(int $idScientifique): array - { - $query = "SELECT q.* FROM Question q - JOIN Reponse r ON q.id = r.idQuestion - WHERE r.idScientifique = :idScientifique - ORDER BY RANDOM() LIMIT 5"; - $params = [":idScientifique" => [$idScientifique, $this->con::PARAM_INT]]; - - $this->con->executeQuery($query, $params); - - return $this->con->getResults(); - } -} \ No newline at end of file diff --git a/project/src/model/gateways/SexeGateway.php b/project/src/model/gateways/SexeGateway.php deleted file mode 100755 index 0310dab..0000000 --- a/project/src/model/gateways/SexeGateway.php +++ /dev/null @@ -1,29 +0,0 @@ -con = $con; - } - - public function getFromId(int $id): array - { - $this->con->executeQuery("SELECT id, libelle FROM Sexe WHERE id=:id;", - [':id' => [$id, $this->con::PARAM_INT]]); - return $this->con->getOneResult(); - } - - public function getAll(): array - { - $this->con->executeQuery("SELECT id, libelle FROM Sexe;"); - return $this->con->getResults(); - } - - public function getFromScientifique(int $idScientifique) : array { - - } -} \ No newline at end of file diff --git a/project/src/model/gateways/ThematiqueGateway.php b/project/src/model/gateways/ThematiqueGateway.php deleted file mode 100755 index 861983f..0000000 --- a/project/src/model/gateways/ThematiqueGateway.php +++ /dev/null @@ -1,28 +0,0 @@ -con = $con; - } - - public function getFromId(int $id): array - { - $this->con->executeQuery("SELECT id, libelle FROM Thematique WHERE id=:id;", - [':id' => [$id, $this->con::PARAM_INT]]); - return $this->con->getOneResult(); - } - public function getAll(): array - { - $this->con->executeQuery("SELECT id, libelle FROM Thematique;"); - return $this->con->getResults(); - } - - public function getFromScientifique(int $idScientifique) : array { - - } -} \ No newline at end of file diff --git a/project/src/model/gateways/UtilisateurConnecteGateway.php b/project/src/model/gateways/UtilisateurConnecteGateway.php deleted file mode 100644 index 8a72ab8..0000000 --- a/project/src/model/gateways/UtilisateurConnecteGateway.php +++ /dev/null @@ -1,59 +0,0 @@ -con = $con; - } - - public function login(string $email, string $password): bool - { - $sql = "SELECT * FROM Utilisateur WHERE email=:email"; - $this->con->executeQuery($sql, array( - ':email' => array($email, \PDO::PARAM_STR) - )); - - $result = $this->con->getOneResult(); - - if (!empty($result)) { - return password_verify($password,$result['password']); - } - return false; - } - public function register(string $email, string $password, int $idjoueur): bool - { - $sql = "INSERT INTO Utilisateur(email, password,idjoueur) VALUES (:email,:password,:idjoueur);"; - return $this->con->executeQuery($sql, [ - ':email' => array($email, \PDO::PARAM_STR), - ':password' => array(password_hash($password, PASSWORD_BCRYPT), \PDO::PARAM_STR), - ':idjoueur' => array($idjoueur, \PDO::PARAM_INT) - ] - ); - } - - public function getFromId(int $id){ - $this->con->executeQuery( - "SELECT idJoueur, pseudo, email, password FROM Utilisateur JOIN Joueur ON id=idJoueur WHERE id = :id;", - [":id" => [$id, $this->con::PARAM_INT]] - ); - return $this->con->getOneResult(); - } - - public function getFromEmail(string $email){ - $this->con->executeQuery( - "SELECT idJoueur, pseudo, email, password FROM Utilisateur JOIN Joueur ON id=idJoueur WHERE email = :email;", - [":email" => [$email, $this->con::PARAM_STR]] - ); - return $this->con->getOneResult(); - } - - public function addScientifiqueDecouvert(int $idUtilisateur, int $idScientifique){ - $this->con->executeQuery( - "INSERT INTO Decouvrir(idUtilisateur, idScientifique) VALUES (:idUtilisateur, :idScientifique);", - [":idUtilisateur" => [$idUtilisateur, $this->con::PARAM_INT], - ":idScientifique" => [$idScientifique, $this->con::PARAM_INT]] - ); - } -} \ No newline at end of file diff --git a/project/src/model/mdl/MdlAdmin.php b/project/src/model/mdl/MdlAdmin.php deleted file mode 100755 index e92adb3..0000000 --- a/project/src/model/mdl/MdlAdmin.php +++ /dev/null @@ -1,46 +0,0 @@ -gw = new AdminGateway($this->con); - } - public function login(string $username, string $password): bool{ - if ($this->gw->login($username, $password)) { - $_SESSION['pseudo'] = $username; - $_SESSION['admin'] = true; - return true; - } - return false; - } - - public static function isAdmin(): bool - { - if(!isset($_SESSION['admin']) - || !$_SESSION['admin'] - || !isset($_SESSION['pseudo']) - || $_SESSION['pseudo'] == null) { - return false; - } - - return true; - } - - public static function logout() { - global $basePath; - - session_unset(); - session_destroy(); - $_SESSION = array(); - header("Location: ."); - } - - public function getFromEmail(string $email): Admin{ - $row = $this->gw->getFromEmail($email); - return new Admin($row['id'], $row['email'], $row['password']); - } -} \ No newline at end of file diff --git a/project/src/model/mdl/MdlBase.php b/project/src/model/mdl/MdlBase.php deleted file mode 100755 index 56064e5..0000000 --- a/project/src/model/mdl/MdlBase.php +++ /dev/null @@ -1,13 +0,0 @@ -con = new Connection($config["db"]["dsn"], $config["db"]["login"], $config["db"]["mdp"]); - } -} \ No newline at end of file diff --git a/project/src/model/mdl/MdlDifficulte.php b/project/src/model/mdl/MdlDifficulte.php deleted file mode 100755 index ebe6546..0000000 --- a/project/src/model/mdl/MdlDifficulte.php +++ /dev/null @@ -1,25 +0,0 @@ -gw = new DifficulteGateway($this->con); - } - - public function getAll(): array{ - $listDifficulte = []; - foreach($this->gw->getAll() as $row){ - $listDifficulte[] = new Difficulte($row['id'], $row['libelle']); - } - return $listDifficulte; - } - - public function getFromId(int $id): Difficulte{ - $row = $this->gw->getFromId($id); - return new Difficulte($row['id'], $row['libelle']); - } -} \ No newline at end of file diff --git a/project/src/model/mdl/MdlInvite.php b/project/src/model/mdl/MdlInvite.php deleted file mode 100755 index 37642b9..0000000 --- a/project/src/model/mdl/MdlInvite.php +++ /dev/null @@ -1,27 +0,0 @@ -gw = new InviteGateway($this->con); - } - - public function setPseudo(int $id, string $pseudo): Invite{ - $this->gw->setPseudo($id, $pseudo); - return $this->getFromId($id); - } - - public function insertInvite(string $pseudo, string $idSession): Invite{ - $id = $this->gw->insertInvite($pseudo, $idSession); - return $this->getFromId($id); - } - - public function getFromId(int $id): Invite{ - $row = $this->gw->getFromId($id); - return new Invite($row['idjoueur'], $row['pseudo'], $row['idsession']); - } -} \ No newline at end of file diff --git a/project/src/model/mdl/MdlJeu.php b/project/src/model/mdl/MdlJeu.php deleted file mode 100755 index 0c33a7d..0000000 --- a/project/src/model/mdl/MdlJeu.php +++ /dev/null @@ -1,25 +0,0 @@ -gw = new JeuGateway($this->con); - } - - public function getAll(): array{ - $listJeu = []; - foreach($this->gw->getAll() as $row){ - $listJeu[] = new Jeu($row['id'], $row['nom'], $row['nbrparties']); - } - return $listJeu; - } - - public function getFromId(int $id): Jeu{ - $row = $this->gw->getFromId($id); - return new Jeu($row['id'], $row['nom'], $row['nbrparties']); - } -} \ No newline at end of file diff --git a/project/src/model/mdl/MdlPendu.php b/project/src/model/mdl/MdlPendu.php deleted file mode 100755 index 4981189..0000000 --- a/project/src/model/mdl/MdlPendu.php +++ /dev/null @@ -1,91 +0,0 @@ -scientifiqueATrouver = $scientifiqueATrouver; - $this->aTrouver = iconv('UTF-8', 'ASCII//TRANSLIT', $scientifiqueATrouver->getPrenom()." ".$scientifiqueATrouver->getNom()); #suppression des accents - $this->aTrouver = preg_replace('/[^A-Za-z0-9 ]/', '', $this->aTrouver); // Retire les caractères non-alphanumeric - $this->nbFail = 0; - $this->nbTours = 0; - $this->lettreExceptees = [' ', '-']; - $this->lettreUtilisees = []; - } - - public function jouerLettre(string $lettre): string{ - $lettre = strtolower($lettre); - if(strlen($lettre) != 1){ throw new ValidationException("Veuillez fournir une seule lettre");} - if(!ctype_alpha($lettre)){ throw new ValidationException("Veuillez fournir un caractère alphabétique");} - if(in_array($lettre, $this->lettreUtilisees)){ throw new ValidationException("Vous avez déjà joué cette lettre");} - $this->nbTours += 1; - -// if(!str_contains($this->aTrouver, $lettre)){ // UNIQUEMENT EN PHP 8.0 -// $this->nbFail += 1; -// } - - if (strpos($this->aTrouver, $lettre) === false) { // PHP 7.4 - $this->nbFail += 1; - } - - $this->lettreUtilisees[] = $lettre; - return $this->getDecouvert(); - } - - public function getScientifique(): Scientifique - { - return $this->scientifiqueATrouver; - } - - public function getLettreUtilisees(): array{ - return $this->lettreUtilisees; - } - - public function getATrouver(): string - { - return $this->aTrouver; - } - - public function getDecouvert(): string - { - $decouvert = ''; - foreach(str_split($this->aTrouver) as $lettre){ - if(in_array(strtolower($lettre), $this->lettreUtilisees) || in_array(strtolower($lettre), $this->lettreExceptees)){ - $decouvert.=$lettre; - }else{ - $decouvert.="_"; - } - } - return $decouvert; - } - - public function getNbTours():int{ - return $this->nbTours; - } - - public function getNbFails():int{ - return $this->nbFail; - } - - public function getEssaisRestant():int{ - return $this::$nbFailsMax - $this->nbFail; - } - - public function aGagne(): bool{ - return $this->getDecouvert() == $this->getATrouver(); - } - - public function aPerdu(): bool{ - return $this->getEssaisRestant() <= 0; - } - -} \ No newline at end of file diff --git a/project/src/model/mdl/MdlScienceQuizz.php b/project/src/model/mdl/MdlScienceQuizz.php deleted file mode 100644 index b99db6a..0000000 --- a/project/src/model/mdl/MdlScienceQuizz.php +++ /dev/null @@ -1,108 +0,0 @@ -bonneReponse = 0; - $this->nbPoints = 0; - $this->numQuestion = 0; - $this->reponses = []; - $this->scientifique = $scientifique; - $this->questions = $questions; - $this->questionsPass = []; - $this->partieTerminee = false; - } - - /** - * @return array - */ - public function getQuestions(): array - { - return $this->questions; - } - - public function getScientifique(): int - { - return $this->scientifique; - } - - /** - * @return int - */ - public function getBonneReponse(): int - { - return $this->bonneReponse; - } - - /** - * @return string - */ - public function getNbPoints(): string - { - return $this->nbPoints; - } - - /** - * @return int - */ - public function getNumQuestion(): int - { - return $this->numQuestion; - } - - /** - * @return array - */ - public function getReponses(): array - { - return $this->reponses; - } - - /** - * @param int $bonneReponse - */ - public function setBonneReponse(int $bonneReponse): void - { - $this->bonneReponse = $bonneReponse; - } - - // Sélectionne une question aléatoire - - /** - * @throws Exception - */ - public function getRandomQuestion(array $questions): string - { - $randomNum=random_int(0, count($questions)-1); - $question=$questions[$randomNum]; - $this->questionsPass[]=$question; - if (count($this->questionsPass)==count($questions)) - { - $this->partieTerminee=true; - } - return $question; - } - - public function partieTerminee(): bool - { - return $this->partieTerminee; - } - -} \ No newline at end of file diff --git a/project/src/model/mdl/MdlScientifique.php b/project/src/model/mdl/MdlScientifique.php deleted file mode 100755 index ea88564..0000000 --- a/project/src/model/mdl/MdlScientifique.php +++ /dev/null @@ -1,172 +0,0 @@ -gw = new ScientifiqueGateway($this->con); - $this->mdlSexe = new MdlSexe(); - $this->mdlDifficulte = new MdlDifficulte(); - $this->mdlThematique = new MdlThematique(); - } - - /** - * @throws Exception - */ - public function getRandom(): Scientifique{ - $row = $this->gw->getRandom(); - if(!$row) throw new RuntimeException("Erreur aucun scientifique trouvé"); - $sexe = $this->mdlSexe->getFromId($row['idsexe']); - $difficulte = $this->mdlDifficulte->getFromId($row['iddifficulte']); - $thematique = $this->mdlThematique->getFromId($row['idthematique']); - - return new Scientifique($row['id'], - $row['nom'], - $row['prenom'], - $row['photo'], - new DateTime($row['datenaissance']), - $row['descriptif'], - $row['ratiotrouvee'], - $thematique, - $difficulte, - $sexe); - } - - /** - * @throws Exception - */ - public function addScientifique(Scientifique $s): bool - { - return $this->gw->addScientifique($s); - } - - public function getScientifiquesParPage(int $page) : array { - $nbElemParPage = 20; - $pageMax = ceil($this->gw->getNbScientifique()/$nbElemParPage); - if ($page <= 0) { - $page = 1; - } elseif ($page > $pageMax) { - $page = $pageMax; - } - $result = $this->gw->getScientifiquesParPages($page,$nbElemParPage); - $scientifiques = array(); - foreach ($result as $scientifique) { - $sexe = $this->mdlSexe->getFromId($scientifique['idsexe']); - $difficulte = $this->mdlDifficulte->getFromId($scientifique['iddifficulte']); - $thematique = $this->mdlThematique->getFromId($scientifique['idthematique']); - $scientifiques[] = new Scientifique($scientifique['id'], - $scientifique['nom'], - $scientifique['prenom'], - $scientifique['photo'], - new DateTime($scientifique['datenaissance']), - $scientifique['descriptif'], - $scientifique['ratiotrouvee'], - $thematique, - $difficulte, - $sexe); - } - return $scientifiques; - } - public function getHistoriqueParPage(string $pseudoJoueur,int $page) { - $nbElemParPage = 20; - $pageMax = ceil($this->gw->getNbScientifiqueHistorique($pseudoJoueur)/$nbElemParPage); - - if ($page <= 0) { - $page = 1; - } elseif ($page > $pageMax) { - $page = $pageMax; - } - $result = $this->gw->getHistorique($pseudoJoueur,$page,$nbElemParPage); - $scientifiques = array(); - foreach ($result as $scientifique) { - $sexe = $this->mdlSexe->getFromId($scientifique['idsexe']); - $difficulte = $this->mdlDifficulte->getFromId($scientifique['iddifficulte']); - $thematique = $this->mdlThematique->getFromId($scientifique['idthematique']); - $scientifiques[] = new Scientifique($scientifique['id'], - $scientifique['nom'], - $scientifique['prenom'], - $scientifique['photo'], - new DateTime($scientifique['datenaissance']), - $scientifique['descriptif'], - $scientifique['ratiotrouvee'], - $thematique, - $difficulte, - $sexe); - } - return $scientifiques; - } - public function getMaxPages() : int { - $nbElemParPage = 20; - return ceil($this->gw->getNbScientifique()/$nbElemParPage); - } - public function getMaxPagesHistorique(string $pseudo) : int { - $nbElemParPage = 20; - return ceil($this->gw->getNbScientifiqueHistorique($pseudo)/$nbElemParPage); - } - - public function editScientifique(Scientifique $s){ - return $this->gw->editScientifique($s); - } - - /** - * @throws Exception - */ - public function getScientifique(int $id): Scientifique - { - $t=$this->gw->getScientifique($id); - if(gettype($t)!="array"){ - throw new Exception("Scientifique non trouvé"); - } - - $sexe=new MdlSexe(); - $sexe=$sexe->getFromId($t["idsexe"]); - - $diff=new MdlDifficulte(); - $diff=$diff->getFromId($t["iddifficulte"]); - - $theme=new MdlThematique(); - $theme=$theme->getFromId($t["idthematique"]); - - return new Scientifique( - $id, - $t["nom"], - $t["prenom"], - $t["photo"], - DateTime::createFromFormat("Y-m-d", $t["datenaissance"]), - $t["descriptif"], - $t["ratiotrouvee"], - $theme, - $diff, - $sexe - ); - } - - /** - * @throws Exception - */ - public function getQuestions(int $id): array - { - $t = $this->gw->getQuestions($id); - - if (gettype($t) != "array") { - throw new Exception("Scientifique non trouvé"); - } - - $questions = []; - - foreach ($t as $question) { - $questions[] = $question["question"]; - } - return $questions; - } -} \ No newline at end of file diff --git a/project/src/model/mdl/MdlSexe.php b/project/src/model/mdl/MdlSexe.php deleted file mode 100755 index beaf9d8..0000000 --- a/project/src/model/mdl/MdlSexe.php +++ /dev/null @@ -1,25 +0,0 @@ -gw = new SexeGateway($this->con); - } - - public function getFromId(int $id): Sexe{ - $row = $this->gw->getFromId($id); - return new Sexe($row['id'], $row['libelle']); - } - public function getAll(): array { - $ret=array(); - $row = $this->gw->getAll(); - for($i=0; $i< count($row); $i++){ - array_push($ret, new Sexe($row[$i]['id'], $row[$i]['libelle'])); - } - return $ret; - } -} \ No newline at end of file diff --git a/project/src/model/mdl/MdlThematique.php b/project/src/model/mdl/MdlThematique.php deleted file mode 100755 index e477104..0000000 --- a/project/src/model/mdl/MdlThematique.php +++ /dev/null @@ -1,26 +0,0 @@ -gw = new ThematiqueGateway($this->con); - } - - public function getFromId(int $id): Thematique{ - $row = $this->gw->getFromId($id); - return new Thematique($row['id'], $row['libelle']); - } - - public function getAll(): array { - $ret=array(); - $row = $this->gw->getAll(); - for($i=0; $i< count($row); $i++){ - array_push($ret, new Thematique($row[$i]['id'], $row[$i]['libelle'])); - } - return $ret; - } -} \ No newline at end of file diff --git a/project/src/model/mdl/MdlUser.php b/project/src/model/mdl/MdlUser.php deleted file mode 100755 index ab9aca5..0000000 --- a/project/src/model/mdl/MdlUser.php +++ /dev/null @@ -1,39 +0,0 @@ -gw = new UtilisateurConnecteGateway($this->con); - } - public function login(string $username, string $password): bool{ - return $this->gw->login($username, $password); - } - public function register(string $username, string $password): bool{ - $temp = new JoueurGateway($this->con); - $temp->insertJoueur($username); - return $this->gw->register($username, $password, $temp->getFromPseudo($username)["id"]); - } - - public function setPseudo(int $id, string $pseudo): Utilisateur{ - $this->gw->setPseudo($id, $pseudo); - return $this->getFromId($id); - } - - public function getFromId(int $id): Utilisateur{ - $row = $this->gw->getFromId($id); - return new Utilisateur($row['idjoueur'], $row['pseudo'], $row['email'], $row['password']); - } - - public function getFromEmail(string $email): Utilisateur{ - $row = $this->gw->getFromEmail($email); - return new Utilisateur($row['idjoueur'], $row['pseudo'], $row['email'], $row['password']); - } - - public function addScientifiqueDecouvert(int $idUtilisateur, int $idScientifique){ - $this->gw->addScientifiqueDecouvert($idUtilisateur, $idScientifique); - } -} \ No newline at end of file diff --git a/project/src/model/metier/Admin.php b/project/src/model/metier/Admin.php deleted file mode 100755 index 0029aa2..0000000 --- a/project/src/model/metier/Admin.php +++ /dev/null @@ -1,47 +0,0 @@ -id=$id; - $this->password=$password; - $this->email = $email; - } - - /** - * @return string - */ - public function getEmail(): string - { - return $this->email; - } - - /** - * @return int - */ - public function getId(): int - { - return $this->id; - } - - /** - * @return string - */ - public function getPassword(): string - { - return $this->password; - } - -} \ No newline at end of file diff --git a/project/src/model/metier/ConfigurationJeu.php b/project/src/model/metier/ConfigurationJeu.php deleted file mode 100755 index de00913..0000000 --- a/project/src/model/metier/ConfigurationJeu.php +++ /dev/null @@ -1,21 +0,0 @@ -jeu = $jeu; - $this->difficulte = $difficulte; - } - - public function getDifficulte(): Difficulte{ - return $this->difficulte; - } - - public function getJeu(): Jeu{ - return $this->jeu; - } -} \ No newline at end of file diff --git a/project/src/model/metier/Difficulte.php b/project/src/model/metier/Difficulte.php deleted file mode 100755 index e511320..0000000 --- a/project/src/model/metier/Difficulte.php +++ /dev/null @@ -1,37 +0,0 @@ -id=$id; - $this->libelle=$libelle; - } - - /** - * @return int - */ - public function getId(): int{ - return $this->id; - } - - /** - * @return string - */ - public function getLibelle(): string{ - return $this->libelle; - } - - public function __toString() { - return $this->libelle; - } -} \ No newline at end of file diff --git a/project/src/model/metier/Invite.php b/project/src/model/metier/Invite.php deleted file mode 100755 index 3e33d72..0000000 --- a/project/src/model/metier/Invite.php +++ /dev/null @@ -1,18 +0,0 @@ -idSession = $idSession; - } - - public function getIdSession(): string - { - return $this->idSession; - } -} \ No newline at end of file diff --git a/project/src/model/metier/Jeu.php b/project/src/model/metier/Jeu.php deleted file mode 100755 index 156e4e0..0000000 --- a/project/src/model/metier/Jeu.php +++ /dev/null @@ -1,51 +0,0 @@ -id=$id; - $this->nom=$nom; - $this->nbrParties=$nbrParties; - } - - /** - * @return int - */ - public function getId(): int{ - return $this->id; - } - - /** - * @return string - */ - public function getNom(): string{ - return $this->nom; - } - - /** - * @return int - */ - public function getNbParties():int{ - return $this->nbrParties; - } - - /** - * @return int - */ - public function incrementNbParties(): int{ - $this->nbrParties += 1; - return $this->nbrParties; - } -} \ No newline at end of file diff --git a/project/src/model/metier/Joueur.php b/project/src/model/metier/Joueur.php deleted file mode 100755 index 57f67c1..0000000 --- a/project/src/model/metier/Joueur.php +++ /dev/null @@ -1,24 +0,0 @@ -id=$id; - $this->pseudo=$pseudo; - } - - public function getId(): int - { - return $this->id; - } - - public function getPseudo(): String - { - return $this->pseudo; - } -} \ No newline at end of file diff --git a/project/src/model/metier/Scientifique.php b/project/src/model/metier/Scientifique.php deleted file mode 100755 index 3cc7d5b..0000000 --- a/project/src/model/metier/Scientifique.php +++ /dev/null @@ -1,138 +0,0 @@ -id = $id; - $this->nom = $nom; - $this->prenom = $prenom; - $this->photo = $photo; - $this->ratioTrouvee = $ratioTrouvee; - $this->descriptif = $descriptif; - $this->dateNaiss = $dateNaiss; - $this->thematique = $thematique; - $this->difficulte = $difficulte; - $this->sexe = $sexe; - $this->questions = $questions; - } - - /** - * @return int - */ - public function getId(): int - { - return $this->id; - } - - /** - * @return string - */ - public function getNom(): string - { - return $this->nom; - } - - /** - * @return string - */ - public function getPrenom(): string - { - return $this->prenom; - } - - /** - * @return string - */ - public function getPhoto(): string - { - return $this->photo; - } - - /** - * @return string - */ - public function getDescriptif(): string - { - return $this->descriptif; - } - - /** - * @return DateTime - */ - public function getDateNaiss(): DateTime - { - return $this->dateNaiss; - } - - /** - * @return float - */ - public function getRatioTrouvee(): float - { - return $this->ratioTrouvee; - } - - /** - * @return Thematique - */ - public function getThematique(): Thematique - { - return $this->thematique; - } - - /** - * @return Difficulte - */ - public function getDifficulte(): Difficulte - { - return $this->difficulte; - } - - /** - * @return Sexe - */ - public function getSexe(): Sexe - { - return $this->sexe; - } -} \ No newline at end of file diff --git a/project/src/model/metier/Sexe.php b/project/src/model/metier/Sexe.php deleted file mode 100755 index 740ab33..0000000 --- a/project/src/model/metier/Sexe.php +++ /dev/null @@ -1,30 +0,0 @@ -id=$id; - $this->libelle=$libelle; - } - - public function getId():int - { - return $this->id; - } - - public function getLibelle(): string - { - return $this->libelle; - } - - public function __toString() - { - return $this->libelle; - } -} \ No newline at end of file diff --git a/project/src/model/metier/Thematique.php b/project/src/model/metier/Thematique.php deleted file mode 100755 index 69fe77d..0000000 --- a/project/src/model/metier/Thematique.php +++ /dev/null @@ -1,30 +0,0 @@ -id=$id; - $this->libelle=$libelle; - } - - public function getId():int - { - return $this->id; - } - - public function getLibelle(): string - { - return $this->libelle; - } - - public function __toString() - { - return $this->libelle; - } -} \ No newline at end of file diff --git a/project/src/model/metier/Utilisateur.php b/project/src/model/metier/Utilisateur.php deleted file mode 100755 index 9cbdbd1..0000000 --- a/project/src/model/metier/Utilisateur.php +++ /dev/null @@ -1,25 +0,0 @@ -email = $email; - $this->motDePasse = $motDePasse; - } - - public function getEmail(): string - { - return $this->email; - } - - public function getMotDePasse(): string - { - return $this->motDePasse; - } -} \ No newline at end of file diff --git a/project/src/templates/accueil.html b/project/src/templates/accueil.html deleted file mode 100755 index 9f4acc3..0000000 --- a/project/src/templates/accueil.html +++ /dev/null @@ -1,44 +0,0 @@ - - - - - - - - Accueil - - - -

Bienvenue sur Mini-Jeux

- - {% if dVue.nomJeu is defined %} -

Jeu selectionné : {{dVue.nomJeu}}

- {% endif %} - {% if dVue.libelleDifficulte is defined %} -

Difficulte selectionné : {{dVue.libelleDifficulte}}

- {% endif %} - - -
- {% if dVue.pseudo is defined %} -

{{dVue.pseudo}}

-

Historique

- {% else %} -

Se connecter

- {% endif %} -
- -



-
- Rejoindre une partie - Créer une partie -
- - - - - diff --git a/project/src/templates/admin/accueil.html b/project/src/templates/admin/accueil.html deleted file mode 100644 index c98e2b6..0000000 --- a/project/src/templates/admin/accueil.html +++ /dev/null @@ -1,28 +0,0 @@ - - - - - - - - Accueil - - - -

Bienvenue sur Mini-Console Admin

-

{{dVue.pseudo}}

-



-
- Ajouter Scientifiques -
- Lister les scientifiques -
- - - - - diff --git a/project/src/templates/admin/ajouterScientifiques.html b/project/src/templates/admin/ajouterScientifiques.html deleted file mode 100644 index 700550d..0000000 --- a/project/src/templates/admin/ajouterScientifiques.html +++ /dev/null @@ -1,108 +0,0 @@ - - - - - Ajouter un(e) scientifique - - - - -

ajouterScientifiques

- -


-
-
-
- - -
-
- - -
-
- - -
-
- - -
-
- - -
-
- Sexe : - {% for se in sexe %} -
- - -
- {% endfor %} -
-
- Thematique : - {% for se in themes %} -
- - -
- {% endfor %} -
-
- Difficulté : - {% for se in difficultes %} -
- - -
- {% endfor %} -
- - - - -
-
- - - - \ No newline at end of file diff --git a/project/src/templates/admin/listeScientifiques.html b/project/src/templates/admin/listeScientifiques.html deleted file mode 100644 index 35eeeac..0000000 --- a/project/src/templates/admin/listeScientifiques.html +++ /dev/null @@ -1,46 +0,0 @@ - - - - - - - - Liste des scientifiques - - - -

Voici la liste des scientifiques dans la base de données :

-

{{dVue.pseudo}}

- -



- -
- Ajouter un(e) scientifique - {% for scientifique in dVue.listeScientifiques %} -
-

{{ scientifique.getNom() }} {{ scientifique.getPrenom() }}

-

Sexe : {{ scientifique.getSexe() }}

-

Né(e) le {{ scientifique.getDateNess() }}

-

Thematique : {{ scientifique.getThematique() }}

-

Difficulté à trouver : {{ scientifique.getDifficulte() }}

- Modifier -
-
-
- {% endfor %} -
- < - 1 -

{{ dVue.page }}

- 1 - > -
-
- - - - diff --git a/project/src/templates/create.html b/project/src/templates/create.html deleted file mode 100755 index 67c6c2a..0000000 --- a/project/src/templates/create.html +++ /dev/null @@ -1,66 +0,0 @@ - - - - - Créer une partie - - - - -

Créer une partie

- -


- -
-

Pour créer voter partie, merci de faire vos choix et de cliquer sur valider

-
-
- Mini-jeux disponibles - {% if dVueErreur|length > 0 %} -
-
Erreur :
- {% for erreur in dVueErreur %} -

{{erreur}}

- {% endfor %} -
- {% endif %} - {% if dVueCreate is defined %} - {% if dVueCreate["jeux"] is defined %} - {% for value in dVueCreate["jeux"] %} -
- - -
- {% endfor %} - {% endif %} -
- - {% if dVueCreate["difficultes"] is defined %} - - - {% endif %} - - - {% endif %} - -
-
- - - - \ No newline at end of file diff --git a/project/src/templates/erreur.html b/project/src/templates/erreur.html deleted file mode 100755 index 2aaf454..0000000 --- a/project/src/templates/erreur.html +++ /dev/null @@ -1,6 +0,0 @@ -

Une erreur s'est produite !

-{% if dVueErreur is defined %} - {% for value in dVueErreur %} -

{{value}}

- {% endfor %} -{% endif %} \ No newline at end of file diff --git a/project/src/templates/historique.html b/project/src/templates/historique.html deleted file mode 100644 index cc2b5bf..0000000 --- a/project/src/templates/historique.html +++ /dev/null @@ -1,44 +0,0 @@ - - - - - - - - Historique des scientifiques découverts : - - - -

Voici l'historique des scientifiques découverts :

-

{{dVue.pseudo}}

- -



- -
- {% for scientifique in dVue.listeScientifiques %} -
-

{{ scientifique.getNom() }} {{ scientifique.getPrenom() }}

-

Sexe : {{ scientifique.getSexe() }}

-

Né(e) le {{ scientifique.getDateNess() }}

-

Thematique : {{ scientifique.getThematique() }}

-

Difficulté à trouver : {{ scientifique.getDifficulte() }}

-
-
-
- {% endfor %} -
- < - 1 -

{{ dVue.page }}

- 1 - > -
-
- - - - diff --git a/project/src/templates/join.html b/project/src/templates/join.html deleted file mode 100755 index 4a779d3..0000000 --- a/project/src/templates/join.html +++ /dev/null @@ -1,29 +0,0 @@ - - - - - Rejoindre une partie - - - -

Rejoindre une partie

- -
-

Merci de vous munir de votre code de partie

-
- - - -
-
- {% if dErreur is defined %} - {% for err in dErreur %} -

{{ err }}

- {% endfor %} - {% endif %} -
-
- - - - \ No newline at end of file diff --git a/project/src/templates/login.html b/project/src/templates/login.html deleted file mode 100755 index 29f1fc7..0000000 --- a/project/src/templates/login.html +++ /dev/null @@ -1,32 +0,0 @@ - - - - - Se connecter - - - -

Se connecter

- -
-
-
- -
-
- -

-
- Creer un compte - {% for error in dErreur %} -
-

- {{error}} -

- {% endfor %} -
-
- - - - \ No newline at end of file diff --git a/project/src/templates/pendu.html b/project/src/templates/pendu.html deleted file mode 100755 index 93b871d..0000000 --- a/project/src/templates/pendu.html +++ /dev/null @@ -1,69 +0,0 @@ - - - - - Pendu - - - - - -


- -
-

-
-
- {% if dVue.decouvert is defined %} -
-

- {{dVue.decouvert}} -

-
-
- {% endif %} - {% if dVue.essaisRestant is defined %} -

Il vous reste {{dVue.essaisRestant}} essais

- {% endif %} - {% if dVue.lettresUtilisees is defined %} -
Lettres utilisées
-
- {%for lettre in dVue.lettresUtilisees %} - {{lettre}}  - {% endfor %} -
- {% endif %} - Votre lettre - {% if dVueErreur|length > 0 %} -
-
Erreur :
- {% for erreur in dVueErreur %} -

{{erreur}}

- {% endfor %} -
- {% endif %} -
- -
-
- - -
-
- - - - \ No newline at end of file diff --git a/project/src/templates/penduScore.html b/project/src/templates/penduScore.html deleted file mode 100755 index 928d924..0000000 --- a/project/src/templates/penduScore.html +++ /dev/null @@ -1,49 +0,0 @@ - - - - - Pendu - Score - - - - - -


- -
- {% if dVue.messageScore is defined %} -

{{dVue.messageScore}}

- {% endif %} - - {% if dVue.nbTours is defined and dVue.nbFails is defined %} -

Vous avez fais {{dVue.nbTours}} essais et {{dVue.nbFails}} erreur(s)

- {% endif %} - - {% if dVue.scientifique is defined %} -

Le scientifique a trouvé été {{dVue.scientifique.prenom}} {{dVue.scientifique.nom}}

-
-

Voici quelques informations à son sujet

-

Né(e) le : {{dVue.scientifique.dateNaiss}}

-

Sexe : {{dVue.scientifique.sexe}}

-

Domaine : {{dVue.scientifique.thematique}}

-

{{dVue.scientifique.descriptif}}

-
- {% endif %} - - Retour à l'accueil -
- - - - \ No newline at end of file diff --git a/project/src/templates/pseudo.html b/project/src/templates/pseudo.html deleted file mode 100755 index fdc992d..0000000 --- a/project/src/templates/pseudo.html +++ /dev/null @@ -1,50 +0,0 @@ - - - - - Saisir Pseudo - - - - - -


- -
-

-
-
- Veuillez choisir votre pseudo - {% if dVueErreur|length > 0 %} -
-
Erreur :
- {% for erreur in dVueErreur %} -

{{erreur}}

- {% endfor %} -
- {% endif %} -
- -
-
- - -
-
- - - - \ No newline at end of file diff --git a/project/src/templates/register.html b/project/src/templates/register.html deleted file mode 100755 index 384ab00..0000000 --- a/project/src/templates/register.html +++ /dev/null @@ -1,45 +0,0 @@ - - - - - S'inscrire - - - - -

S'inscrire

- -
-
-
- -
-
-
-
- - -

- - {% for error in dErreur %} -
-

- {{error}} -

- {% endfor %} -
-
- - - - \ No newline at end of file diff --git a/project/src/templates/scienceQuizz.html b/project/src/templates/scienceQuizz.html deleted file mode 100644 index 0afad17..0000000 --- a/project/src/templates/scienceQuizz.html +++ /dev/null @@ -1,52 +0,0 @@ - - - - - - - Science Quizz - - - - - -
-

Science Quizz

-
-

Question {{ dVue.statJeu.numQuestion }}:

-

{{ dVue.statJeu.question }}

- - - -
- - - {% if dVueErreur %} -
- -
- {% endif %} -
- - - - diff --git a/project/src/templates/scienceQuizzRecap.html b/project/src/templates/scienceQuizzRecap.html deleted file mode 100644 index d48d561..0000000 --- a/project/src/templates/scienceQuizzRecap.html +++ /dev/null @@ -1,10 +0,0 @@ - - - - - Science Quizz Recap - - - - - \ No newline at end of file diff --git a/project/src/templates/scienceQuizzReponse.html b/project/src/templates/scienceQuizzReponse.html deleted file mode 100644 index 0f5bfaa..0000000 --- a/project/src/templates/scienceQuizzReponse.html +++ /dev/null @@ -1,10 +0,0 @@ - - - - - Science Quizz 2 - - - - - \ No newline at end of file