|
|
@ -108,19 +108,27 @@ class FrontController
|
|
|
|
{
|
|
|
|
{
|
|
|
|
global $twig;
|
|
|
|
global $twig;
|
|
|
|
$listJeu = (new \model\JeuGateway($this->con))->getAll();
|
|
|
|
$listJeu = (new \model\JeuGateway($this->con))->getAll();
|
|
|
|
$dVueCreate = [];
|
|
|
|
$listDifficulte = (new \model\DifficulteGateway($this->con))->getAll();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$dVueCreateJeu = [];
|
|
|
|
foreach($listJeu as $jeu){
|
|
|
|
foreach($listJeu as $jeu){
|
|
|
|
$dVueCreate[] = ['id' => $jeu->getId(), 'nom' => $jeu->getNom()];
|
|
|
|
$dVueCreateJeu[] = ['id' => $jeu->getId(), 'nom' => $jeu->getNom()];
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$dVueCreateDifficulte = [];
|
|
|
|
|
|
|
|
foreach($listDifficulte as $difficulte){
|
|
|
|
|
|
|
|
$dVueCreateDifficulte[] = ['id' => $difficulte->getId(), 'libelle' => $difficulte->getLibelle()];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
echo $twig->render('create.html', ['dVueCreate' => $dVueCreate]);
|
|
|
|
|
|
|
|
|
|
|
|
echo $twig->render('create.html', ['dVueCreate' => ["jeux" => $dVueCreateJeu, "difficultes" => $dVueCreateDifficulte]]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public function ValidationFormulaire(array &$dVueErreur, array &$dVue)
|
|
|
|
public function ValidationFormulaire(array &$dVueErreur, array &$dVue)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
global $twig;
|
|
|
|
global $twig;
|
|
|
|
|
|
|
|
|
|
|
|
$game = $_POST['game'] ?? '';
|
|
|
|
$game = $_POST['jeu'] ?? '';
|
|
|
|
$difficulty = $_POST['difficulty'] ?? '';
|
|
|
|
$difficulty = $_POST['difficulte'] ?? '';
|
|
|
|
\config\Validation::val_form($game, $difficulty, $dVueErreur);
|
|
|
|
\config\Validation::val_form($game, $difficulty, $dVueErreur);
|
|
|
|
|
|
|
|
|
|
|
|
$dVue['info'] = "Jeu '$game' créé avec la difficulté $difficulty";
|
|
|
|
$dVue['info'] = "Jeu '$game' créé avec la difficulté $difficulty";
|
|
|
|