début de travail sur le quizz et sur sa vue

php
Patrick BRUGIERE 2 years ago
parent 4a153a0bb4
commit 1c64a43e06

@ -2,8 +2,11 @@
namespace controller;
use config\Validation;
use gateway\TranslationGateway;
use gateway\VocabularyListGateway;
use model\MdlStudent;
use Exception;
use model\Translation;
class StudentController
{
@ -82,4 +85,21 @@ class StudentController
throw new Exception("invalid entries");
}
}
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) {
}
}
*/
}

@ -0,0 +1,14 @@
<table>
{% if translations is defined %}
{% for row in translations %}
<tr>
<td>{{ row.id }}</td>
<td>{{ row.word1 }}</td>
<td>{{ row.word2 }}</td>
<td>{{ row.listVocab }}</td>
</tr>
</table>

@ -0,0 +1,42 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Manage groups</title>
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no" />
<meta name="description" content="" />
<meta name="author" content="" />
<link rel="icon" type="image/x-icon" href="assets/favicon.ico" />
<!-- Font Awesome icons (free version)-->
<script src="https://use.fontawesome.com/releases/v6.3.0/js/all.js" crossorigin="anonymous"></script>
<!-- Google fonts-->
<link href="https://fonts.googleapis.com/css?family=Varela+Round" rel="stylesheet" />
<link
href="https://fonts.googleapis.com/css?family=Nunito:200,200i,300,300i,400,400i,600,600i,700,700i,800,800i,900,900i"
rel="stylesheet" />
<!-- Core theme CSS (includes Bootstrap)-->
<link href="css/styles.css" rel="stylesheet" />
</head>
<body>
<section>
<h1>Quiz</h1>
<form action="quiz" method="post">
<h2>{{frenchWord}}</h2>
{% for i in 0..3 %}
<input type="radio" name="answer{{i}}" value="{{valid[i]}}"> {{answers[i]}}<br>
{% endfor %}
<input type="submit" value="Soumettre">
</form>
<h1>Translator</h1>
<form action="quiz?vocabID={{row.id}}" method="POST">
<label for="wordInput">Enter a word:</label>
<input type="text" id="wordInput" name="wordInput">
<button type="submit">Translate</button>
</form>
</section>
</body>
</html>
Loading…
Cancel
Save