diff --git a/Website/controllers/ControllerUser.php b/Website/controllers/ControllerUser.php index 9ff0d0e..741c822 100644 --- a/Website/controllers/ControllerUser.php +++ b/Website/controllers/ControllerUser.php @@ -111,7 +111,6 @@ class ControllerUser $answers = $this->mdAnswer->getAnswersByIDQuestions($question->getId()); $_SESSION["Answers"][] = $answers; } - var_dump($_SESSION["Questions"]); echo $this->twig->render($this->vues["singleplayer"], [ 'questions' => $_SESSION["Questions"], 'numQuestion' => 0, @@ -153,16 +152,30 @@ class ControllerUser 'answerss' => $_SESSION["Answers"], ]); } else { - $goodAnswer = array(); + $Final = array(); + $Final[]["Question"] = array(); + $Final[]["goodAnswer"] = array(); + $Final[]["PlayerAnswer"] = array(); + $c=0; foreach ($_SESSION["Questions"] as &$question) { $answer = $this->mdAnswer->getAnswerByID($question->getIdAnswerGood()); - $goodAnswer[] = $answer->getContent(); + $Final[$c]["goodAnswer"] = $answer->getContent(); + $c=$c+1; + } + $c=0; + foreach ($_SESSION["Questions"] as $question) { + $Final[$c]["Question"] = $question->getContent(); + $c=$c+1; + } + $c=0; + foreach ($_SESSION["playerAnswersContent"] as $answer) + { + $Final[$c]["PlayerAnswer"] = $answer; + $c=$c+1; } echo $this->twig->render($this->vues["viewScore"], [ 'score' => $_SESSION["Score"], - 'questions' => $_SESSION["Questions"], - 'answerss' => $_SESSION["Answers"], - 'goodAnswer' => $goodAnswer, + 'Final' => $Final, ]); } } diff --git a/Website/models/ModelQuestion.php b/Website/models/ModelQuestion.php index a0492ed..1abe8f2 100644 --- a/Website/models/ModelQuestion.php +++ b/Website/models/ModelQuestion.php @@ -76,7 +76,6 @@ class ModelQuestion ); $this->questions[] = $question; } - return $this->questions; } } diff --git a/Website/templates/viewScore.twig b/Website/templates/viewScore.twig index 616fecc..ddbdc26 100644 --- a/Website/templates/viewScore.twig +++ b/Website/templates/viewScore.twig @@ -17,15 +17,15 @@
- {% for question in questions %} + {% for f in Final %}

- Question : {{ question['content'] }} + Question : {{ f['Question'] }}

- Bonne réponse : {{ goodAnswer['goodAnswersContent'] }} + Bonne réponse : {{ f['goodAnswer'] }}

- Votre réponse : {{ question['playerAnswersContent'] }} + Votre réponse : {{ f['PlayerAnswer'] }}

{% endfor %}