|
|
@ -105,8 +105,7 @@ class UserControler {
|
|
|
|
* @throws RuntimeError
|
|
|
|
* @throws RuntimeError
|
|
|
|
* @throws LoaderError
|
|
|
|
* @throws LoaderError
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
public function continueQuiz(int $id_quiz, int $total_questions) : void
|
|
|
|
public function continueQuiz(int $id_quiz, int $total_questions) : void{
|
|
|
|
{
|
|
|
|
|
|
|
|
global $racine;
|
|
|
|
global $racine;
|
|
|
|
$score = $_SESSION['score'];
|
|
|
|
$score = $_SESSION['score'];
|
|
|
|
$_SESSION['no_question'] = Verification::verifChar( isset($_SESSION['no_question']) ? ($_SESSION['no_question'] + 1) : 1);
|
|
|
|
$_SESSION['no_question'] = Verification::verifChar( isset($_SESSION['no_question']) ? ($_SESSION['no_question'] + 1) : 1);
|
|
|
@ -123,8 +122,7 @@ class UserControler {
|
|
|
|
* @throws RuntimeError
|
|
|
|
* @throws RuntimeError
|
|
|
|
* @throws LoaderError
|
|
|
|
* @throws LoaderError
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
public function endQuiz(int $id_quiz, int $score) : void
|
|
|
|
public function endQuiz(int $id_quiz, int $score) : void{
|
|
|
|
{
|
|
|
|
|
|
|
|
global $vues,$co;
|
|
|
|
global $vues,$co;
|
|
|
|
|
|
|
|
|
|
|
|
$gw = new QuizGateway($co);
|
|
|
|
$gw = new QuizGateway($co);
|
|
|
@ -136,8 +134,7 @@ class UserControler {
|
|
|
|
require_once $vues['endQuiz'];
|
|
|
|
require_once $vues['endQuiz'];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public function CorrectAnswer() : bool
|
|
|
|
public function CorrectAnswer() : bool{
|
|
|
|
{
|
|
|
|
|
|
|
|
$answera = Verification::verifChar($_POST['answera'] ?? null);
|
|
|
|
$answera = Verification::verifChar($_POST['answera'] ?? null);
|
|
|
|
$answerb = Verification::verifChar($_POST['answerb'] ?? null);
|
|
|
|
$answerb = Verification::verifChar($_POST['answerb'] ?? null);
|
|
|
|
$answerc = Verification::verifChar($_POST['answerc'] ?? null);
|
|
|
|
$answerc = Verification::verifChar($_POST['answerc'] ?? null);
|
|
|
@ -164,8 +161,7 @@ class UserControler {
|
|
|
|
return $answer == $res->getCanswer();
|
|
|
|
return $answer == $res->getCanswer();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public function GetQuestion(int $id): array
|
|
|
|
public function GetQuestion(int $id): array{
|
|
|
|
{
|
|
|
|
|
|
|
|
global $co;
|
|
|
|
global $co;
|
|
|
|
$gw = new QuizQuestionGateway($co);
|
|
|
|
$gw = new QuizQuestionGateway($co);
|
|
|
|
$mdl = new QuizQuestionModel($gw);
|
|
|
|
$mdl = new QuizQuestionModel($gw);
|
|
|
@ -177,8 +173,7 @@ class UserControler {
|
|
|
|
* @throws SyntaxError
|
|
|
|
* @throws SyntaxError
|
|
|
|
* @throws LoaderError
|
|
|
|
* @throws LoaderError
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
public function showQuestion(int $id, int $num) : void
|
|
|
|
public function showQuestion(int $id, int $num) : void{
|
|
|
|
{
|
|
|
|
|
|
|
|
global $vues,$twig;
|
|
|
|
global $vues,$twig;
|
|
|
|
$q = $this->GetQuestion($id);
|
|
|
|
$q = $this->GetQuestion($id);
|
|
|
|
$question = $q[$num] ?? $q[0];
|
|
|
|
$question = $q[$num] ?? $q[0];
|
|
|
@ -189,8 +184,7 @@ class UserControler {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public function getNumberOfQuestion(int $id) : int
|
|
|
|
public function getNumberOfQuestion(int $id) : int{
|
|
|
|
{
|
|
|
|
|
|
|
|
global $co;
|
|
|
|
global $co;
|
|
|
|
$gw = new QuizGateway($co);
|
|
|
|
$gw = new QuizGateway($co);
|
|
|
|
$mdl = new QuizModel($gw);
|
|
|
|
$mdl = new QuizModel($gw);
|
|
|
@ -212,8 +206,7 @@ class UserControler {
|
|
|
|
header("Location:". $racine ."/quote/$id");
|
|
|
|
header("Location:". $racine ."/quote/$id");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public function changedata() : void
|
|
|
|
public function changedata() : void{
|
|
|
|
{
|
|
|
|
|
|
|
|
global $vues, $racine;
|
|
|
|
global $vues, $racine;
|
|
|
|
if ($_POST)
|
|
|
|
if ($_POST)
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -258,8 +251,7 @@ class UserControler {
|
|
|
|
* @throws RuntimeError
|
|
|
|
* @throws RuntimeError
|
|
|
|
* @throws LoaderError
|
|
|
|
* @throws LoaderError
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
public function submit() : void
|
|
|
|
public function submit() : void{
|
|
|
|
{
|
|
|
|
|
|
|
|
global $vues;
|
|
|
|
global $vues;
|
|
|
|
require_once $vues['submitQuote'];
|
|
|
|
require_once $vues['submitQuote'];
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -269,8 +261,7 @@ class UserControler {
|
|
|
|
* @throws RuntimeError
|
|
|
|
* @throws RuntimeError
|
|
|
|
* @throws LoaderError
|
|
|
|
* @throws LoaderError
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
public function toSubmit() : ?array
|
|
|
|
public function toSubmit() : ?array{
|
|
|
|
{
|
|
|
|
|
|
|
|
global $co;
|
|
|
|
global $co;
|
|
|
|
if ($_POST)
|
|
|
|
if ($_POST)
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -317,8 +308,7 @@ class UserControler {
|
|
|
|
* @throws RuntimeError
|
|
|
|
* @throws RuntimeError
|
|
|
|
* @throws LoaderError
|
|
|
|
* @throws LoaderError
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
public function validsubmit() : void
|
|
|
|
public function validsubmit() : void{
|
|
|
|
{
|
|
|
|
|
|
|
|
$recap = $this -> toSubmit();
|
|
|
|
$recap = $this -> toSubmit();
|
|
|
|
if ($recap)
|
|
|
|
if ($recap)
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -331,14 +321,12 @@ class UserControler {
|
|
|
|
* @throws SyntaxError
|
|
|
|
* @throws SyntaxError
|
|
|
|
* @throws LoaderError
|
|
|
|
* @throws LoaderError
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
public function recapSubmitQuote(?array $recap) : void
|
|
|
|
public function recapSubmitQuote(?array $recap) : void{
|
|
|
|
{
|
|
|
|
|
|
|
|
global $twig;
|
|
|
|
global $twig;
|
|
|
|
echo $twig -> render("recapSubmitQuote.html.twig", ['content' => $recap[0], 'character' => $recap[1], 'source' => $recap[2]]);
|
|
|
|
echo $twig -> render("recapSubmitQuote.html.twig", ['content' => $recap[0], 'character' => $recap[1], 'source' => $recap[2]]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public function getIdOfUser() : ?int
|
|
|
|
public function getIdOfUser() : ?int{
|
|
|
|
{
|
|
|
|
|
|
|
|
if (isset($_SESSION['user']))
|
|
|
|
if (isset($_SESSION['user']))
|
|
|
|
{
|
|
|
|
{
|
|
|
|
global $co;
|
|
|
|
global $co;
|
|
|
|