Antoine JOURDAIN 2 years ago
commit eda6889e04

@ -92,4 +92,12 @@ abstract class AbsController
throw new Exception("Erreur"); throw new Exception("Erreur");
} }
} }
public function quiz(): void
{
global $twig;
$vocabId = $_GET['vocabID'];
$mdl = new TranslationGateway();
$allTranslation = $mdl->findByIdVoc($vocabId);
echo $twig->render('quizzView.html', ['translations' => $allTranslation]);
}
} }

@ -55,6 +55,9 @@ class FrontController
case 'disconnect': case 'disconnect':
$this->disconnect(); $this->disconnect();
break; break;
case 'quiz':
$this->quiz();
break;
default : default :
if ($id != null && !$this->checkIdExist($id)) throw new Exception("identifiant invalide"); if ($id != null && !$this->checkIdExist($id)) throw new Exception("identifiant invalide");
@ -125,5 +128,10 @@ class FrontController
$mdl->deconnection(); $mdl->deconnection();
$this->home(); $this->home();
} }
public function quiz(){
$ctrl = new StudentController();
$ctrl->quiz();
}
} }

@ -3,6 +3,7 @@
namespace controller; namespace controller;
use config\Validation; use config\Validation;
use model\MdlStudent; use model\MdlStudent;
use gateway\TranslationGateway;
use Exception; use Exception;
class StudentController class StudentController
@ -34,4 +35,23 @@ class StudentController
$vocab = $mdl->getVocabByName($name); $vocab = $mdl->getVocabByName($name);
echo $twig->render('manageVocabView.html', ['vocabularies' => $vocab]); echo $twig->render('manageVocabView.html', ['vocabularies' => $vocab]);
} }
public function quiz(): void
{
global $twig;
$vocabId = $_GET['vocabID'];
$mdl = new TranslationGateway();
$allTranslation = $mdl->findByIdVoc($vocabId);
echo $twig->render('quizzView.html', ['translations' => $allTranslation]);
}
/*
public function flashcard(VocabularyList $v) {
$idVoc = $v->getId();
$mdl = new TranslationGateway();
$allTranslation = $mdl->findByIdVoc($idVoc);
while(1) {
}
}
}*/
} }

@ -9,6 +9,53 @@
<td>{{ row.word2 }}</td> <td>{{ row.word2 }}</td>
<td>{{ row.listVocab }}</td> <td>{{ row.listVocab }}</td>
</tr> </tr>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Manage groups</title>
<!-- Vos liens de styles et de scripts -->
</head>
<body>
<section>
<h1>Quiz</h1>
<form action="quiz" method="post">
{% if translations is defined %}
{% for translation in translations %}
<h2>{{ translation.word1 }}</h2>
{% set answers = [translation.word2] %}
{% for i in 0..3 %}
<input type="radio" name="answer{{ i }}" value="{{ valid[i] }}"> {{ answers[i] }}<br>
{% endfor %}
{% endfor %}
{% endif %}
<input type="submit" value="Submit">
</form>
<h1>Translator</h1>
<form action="quiz" method="POST">
{% if translations is defined %}
<table>
<tr>
<td>ID</td>
<td>Word 1</td>
<td>Word 2</td>
<td>List Vocabulary</td>
</tr>
{% for translation in translations %}
<tr>
<td>{{ translation.id }}</td>
<td>{{ translation.word1 }}</td>
<td>{{ translation.word2 }}</td>
<td>{{ translation.listVocab }}</td>
</tr>
{% endfor %}
</table>
{% endif %}
</form>
</section>
</body>
</html>
</table> </table>
Loading…
Cancel
Save