From 8265694bf09c9490da99ccce7465e118fef06095 Mon Sep 17 00:00:00 2001 From: "victor.soulier" Date: Fri, 17 Nov 2023 09:47:07 +0100 Subject: [PATCH] =?UTF-8?q?ADD=20:=20affichage=20du=20jeu=20et=20difficult?= =?UTF-8?q?=C3=A9=20selectionn=C3=A9s?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- project/src/controller/FrontController.php | 9 +++++---- project/src/templates/accueil.html | 9 +++++++-- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/project/src/controller/FrontController.php b/project/src/controller/FrontController.php index 12b04e6..538f07e 100644 --- a/project/src/controller/FrontController.php +++ b/project/src/controller/FrontController.php @@ -127,11 +127,12 @@ class FrontController { global $twig; - $game = $_POST['jeu'] ?? ''; - $difficulty = $_POST['difficulte'] ?? ''; - \config\Validation::val_form($game, $difficulty, $dVueErreur); + $id_jeu = $_POST['jeu'] ?? ''; + $id_difficulte = $_POST['difficulte'] ?? ''; + \config\Validation::val_form($id_jeu, $id_difficulte, $dVueErreur); - $dVue['info'] = "Jeu '$game' créé avec la difficulté $difficulty"; + $dVue['nomJeu'] = (new \model\JeuGateway($this->con))->getFromId($id_jeu)->getNom(); + $dVue['libelleDifficulte'] = (new \model\DifficulteGateway($this->con))->getFromId($id_difficulte)->getLibelle(); echo $twig->render('accueil.html', ['dVue' => $dVue, 'dVueErreur' => $dVueErreur]); } diff --git a/project/src/templates/accueil.html b/project/src/templates/accueil.html index 71557e8..33aa647 100644 --- a/project/src/templates/accueil.html +++ b/project/src/templates/accueil.html @@ -14,9 +14,14 @@

Bienvenue sur Mini-Jeux

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

{{dVue.info}}

+ + {% 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}}