|
|
|
@ -27,16 +27,16 @@ class UserControler {
|
|
|
|
|
private CommentaryModel $cMod;
|
|
|
|
|
private UserModel $uMod;
|
|
|
|
|
private QuoteModel $qMod;
|
|
|
|
|
private QuestionModel $mdl;
|
|
|
|
|
private CharacterModel $caMod;
|
|
|
|
|
private SourceModel $srcMod;
|
|
|
|
|
private QuestionModel $questMod;
|
|
|
|
|
|
|
|
|
|
public function __construct() {
|
|
|
|
|
global $co;
|
|
|
|
|
$this->cMod = new CommentaryModel(new CommentaryGateway($co));
|
|
|
|
|
$this->uMod = new UserModel(new UserGateway($co));
|
|
|
|
|
$this->qMod = new QuoteModel(new QuoteGateway($co));
|
|
|
|
|
$this -> mdl = new QuestionModel(new QuestionGateway($co));
|
|
|
|
|
$this -> questMod = new QuestionModel(new QuestionGateway($co));
|
|
|
|
|
$this -> caMod = new CharacterModel(new CharacterGateway($co));
|
|
|
|
|
$this->srcMod = new SourceModel(new SourceGateway($co));
|
|
|
|
|
}
|
|
|
|
@ -174,7 +174,7 @@ class UserControler {
|
|
|
|
|
$answer = explode('-', $answerd)[0];
|
|
|
|
|
$id = (int) explode('-', $answerd)[1];
|
|
|
|
|
}
|
|
|
|
|
$res = $this->mdl->getQuestion($id);
|
|
|
|
|
$res = $this->questMod->getQuestion($id);
|
|
|
|
|
return $answer == $res->getCanswer();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -509,4 +509,26 @@ class UserControler {
|
|
|
|
|
var_dump($error);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Quiz aléatoire
|
|
|
|
|
|
|
|
|
|
// argument = Langue / type question / type reponse
|
|
|
|
|
public function quizAleatoire(){
|
|
|
|
|
global $vues;
|
|
|
|
|
if(!isset($_POST["nbVie"])){
|
|
|
|
|
$vie = 3;
|
|
|
|
|
}
|
|
|
|
|
$question = $questMod->getRandomQuestion([$_POST["questionType"],$_POST["awnserType"]],$_POST["langue"]);
|
|
|
|
|
addTab($question);
|
|
|
|
|
if($question == null){
|
|
|
|
|
$require_once($vues["erreur"]);
|
|
|
|
|
}
|
|
|
|
|
else{
|
|
|
|
|
$require_once($vues['quiz']);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function questionSuivantAleatoire(){
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|