diff --git a/.gitignore b/.gitignore index e5728f9..95fc2fd 100755 --- a/.gitignore +++ b/.gitignore @@ -820,4 +820,4 @@ replay_pid* # .nfs files are created when an open file is removed but is still being accessed .nfs* # config ignore to not stock password on the git (: -/Website/usages/Config.php \ No newline at end of file +/Website/usages/Config_DB.php \ No newline at end of file diff --git a/Website/Media/mathEducFont.ttf b/Website/Media/mathEducFont.ttf index 43b47be..3d85ed9 100755 Binary files a/Website/Media/mathEducFont.ttf and b/Website/Media/mathEducFont.ttf differ diff --git a/Website/controllers/ControllerUser.php b/Website/controllers/ControllerUser.php index 6c809b6..61f16a0 100644 --- a/Website/controllers/ControllerUser.php +++ b/Website/controllers/ControllerUser.php @@ -144,13 +144,14 @@ class ControllerUser 'numQuestion' => $numQuestion, 'answerss' => $_SESSION["Answers"], ]); - } else { $answerContent = $_SESSION["Answers"][$numQuestion][$answerNumber]->getContent(); $_SESSION["playerAnswersContent"][$numQuestion] = $answerContent; if ($_SESSION["Questions"][$numQuestion]->getIdAnswerGood() == $_SESSION["Answers"][$numQuestion][$answerNumber]->getId()) { $time = $_SESSION["PrevTime"]->diff($_SESSION["CurrTime"]); $_SESSION["Score"] = $_SESSION["Score"] + 80 + 40 * ((30 - $time->s) / 100 * 10 / 3); + } else { + $_SESSION["Questions"][$numQuestion]->setNbFails($_SESSION["Questions"][$numQuestion]->getNbFails() + 1); } if ($numQuestion <= 8) { @@ -165,22 +166,21 @@ class ControllerUser $Final[]["Question"] = array(); $Final[]["goodAnswer"] = array(); $Final[]["PlayerAnswer"] = array(); - $c=0; + $c = 0; foreach ($_SESSION["Questions"] as &$question) { $answer = $this->mdAnswer->getAnswerByID($question->getIdAnswerGood()); $Final[$c]["goodAnswer"] = $answer->getContent(); - $c=$c+1; + $c = $c + 1; } - $c=0; + $c = 0; foreach ($_SESSION["Questions"] as $question) { $Final[$c]["Question"] = $question->getContent(); - $c=$c+1; + $c = $c + 1; } - $c=0; - foreach ($_SESSION["playerAnswersContent"] as $answer) - { + $c = 0; + foreach ($_SESSION["playerAnswersContent"] as $answer) { $Final[$c]["PlayerAnswer"] = $answer; - $c=$c+1; + $c = $c + 1; } echo $this->twig->render($this->vues["viewScore"], [ 'score' => $_SESSION["Score"], @@ -193,6 +193,7 @@ class ControllerUser { $numQuestion = $_POST["numQuestion"]; $_SESSION["playerAnswersContent"][$numQuestion] = "Pas de réponse"; + $_SESSION["Questions"][$numQuestion]->setNbFails($_SESSION["Questions"][$numQuestion]->getNbFails() + 1); if ($numQuestion <= 8) { $_SESSION["PrevTime"] = $_SESSION["CurrTime"]; echo $this->twig->render($this->vues["singleplayer"], [ @@ -205,22 +206,21 @@ class ControllerUser $Final[]["Question"] = array(); $Final[]["goodAnswer"] = array(); $Final[]["PlayerAnswer"] = array(); - $c=0; + $c = 0; foreach ($_SESSION["Questions"] as &$question) { $answer = $this->mdAnswer->getAnswerByID($question->getIdAnswerGood()); $Final[$c]["goodAnswer"] = $answer->getContent(); - $c=$c+1; + $c = $c + 1; } - $c=0; + $c = 0; foreach ($_SESSION["Questions"] as $question) { $Final[$c]["Question"] = $question->getContent(); - $c=$c+1; + $c = $c + 1; } - $c=0; - foreach ($_SESSION["playerAnswersContent"] as $answer) - { + $c = 0; + foreach ($_SESSION["playerAnswersContent"] as $answer) { $Final[$c]["PlayerAnswer"] = $answer; - $c=$c+1; + $c = $c + 1; } echo $this->twig->render($this->vues["viewScore"], [ 'score' => $_SESSION["Score"], diff --git a/Website/controllers/ControllerUserLobby.php b/Website/controllers/ControllerUserLobby.php new file mode 100644 index 0000000..f9bf141 --- /dev/null +++ b/Website/controllers/ControllerUserLobby.php @@ -0,0 +1,33 @@ +twig =$twig; + $this->vues = $vues; + + $this->mdLobby = new ModelLobby(); + + $lobbies = $this->mdLobby->getlobbies(); + + + echo $twig->render($vues["lobby"], [ + 'lobbies' => $lobbies, + ]); + + } catch (PDOException $e) { + // Gérez les erreurs PDO ici + } catch (Exception $e2) { + // Gérez d'autres erreurs ici + } + } +} \ No newline at end of file diff --git a/Website/controllers/FrontController.php b/Website/controllers/FrontController.php index 29e9166..4788dd5 100755 --- a/Website/controllers/FrontController.php +++ b/Website/controllers/FrontController.php @@ -4,7 +4,7 @@ class FrontController function __construct() { global $dsn, $user, $pass, $vues; - + try { // Initialize AltoRouter $router = new AltoRouter(); @@ -39,19 +39,17 @@ class FrontController if ($match) { $controller = $match['target']; if (strpos($controller, "#") !== false) { - list($controller,$action)=explode("#",$controller); - } - else { - $action=$match['params']['action']; - $id=$match['params']['id']; + list($controller, $action) = explode("#", $controller); + } else { + $action = $match['params']['action']; + $id = $match['params']['id']; } - $controller = new $controller; - if (is_callable(array($controller, $action))) { - call_user_func_array(array($controller, $action), array($match['params'])); + $controller = new $controller; + if (is_callable(array($controller, $action))) { + call_user_func_array(array($controller, $action), array($match['params'])); } } - } - catch (Exception $e) { + } catch (Exception $e) { header("Location:" . $vues["erreur"]); } } diff --git a/Website/templates/adminAdministrators.twig b/Website/templates/adminAdministrators.twig index 8573692..04230bf 100644 --- a/Website/templates/adminAdministrators.twig +++ b/Website/templates/adminAdministrators.twig @@ -14,7 +14,7 @@

Liste des administrators