Anthony RICHARD 1 year ago
commit 366e95f909

@ -50,7 +50,7 @@ class UserController extends VisitorController
$this->showAccountInfos(); $this->showAccountInfos();
} }
catch (Exception $e){ catch (Exception $e){
throw new Exception("invalid entries"); throw new Exception("invalid entries". $e->getMessage());
} }
} }

@ -5,6 +5,7 @@ namespace controller;
use config\Validation; use config\Validation;
use gateway\TranslationGateway; use gateway\TranslationGateway;
use gateway\VocabularyListGateway; use gateway\VocabularyListGateway;
use http\Message;
use model\MdlUser; use model\MdlUser;
use Exception; use Exception;
@ -54,7 +55,7 @@ class VisitorController
} }
catch (Exception $e){ catch (Exception $e){
throw new Exception("Erreur"); throw new Exception($e->getMessage());
} }
} }
public function quiz($match): void public function quiz($match): void
@ -85,7 +86,9 @@ class VisitorController
for ($i = 0; $i < count($questions); $i++) { for ($i = 0; $i < count($questions); $i++) {
$correctAnswer = $allTranslation[$i]->getWord2(); $correctAnswer = $allTranslation[$i]->getWord2();
array_splice($allEnglishWords, array_search($correctAnswer, $allEnglishWords), 1); array_splice($allEnglishWords, array_search($correctAnswer, $allEnglishWords), 1);
if(count($allEnglishWords) < 3) {
throw new Exception("pas assez de vocabulaire");
}
$tab = array_rand(array_flip($allEnglishWords), 3); $tab = array_rand(array_flip($allEnglishWords), 3);
array_push($allEnglishWords, $correctAnswer); array_push($allEnglishWords, $correctAnswer);
@ -112,7 +115,7 @@ class VisitorController
} }
} }
catch (Exception $e){ catch (Exception $e){
throw new Exception("Erreur"); throw new Exception($e->getMessage());
} }
} }

@ -32,6 +32,7 @@
flex-direction: column; flex-direction: column;
background-size: cover; /* Ajuster la taille de l'image pour couvrir tout le corps */ background-size: cover; /* Ajuster la taille de l'image pour couvrir tout le corps */
background-position: center; background-position: center;
overflow: hidden;
} }
.err{ .err{
justify-content:center; justify-content:center;
@ -54,7 +55,8 @@
</style> </style>
<body> <body>
<div class="err"> {% include 'navBar.twig' %}
<div class="err content">
<h1> ERREUR</h1> <h1> ERREUR</h1>
{% if dVueEreur is defined %} {% if dVueEreur is defined %}
{% for value in dVueEreur %} {% for value in dVueEreur %}

Loading…
Cancel
Save