Anthony RICHARD 1 year ago
commit 986e55a3d8

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 371 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 438 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 149 KiB

@ -36,12 +36,13 @@ class StudentController extends UserController
echo $twig->render('manageVocabView.html', ['vocabularies' => $vocab]); echo $twig->render('manageVocabView.html', ['vocabularies' => $vocab]);
} }
public function memoryChoice(): void { public function ListVocChoice(): void {
global $twig; global $twig;
global $user; global $user;
$jeu = $_POST['jeu'];
$model = new MdlStudent(); $model = new MdlStudent();
$voc = $model->getAll(); $voc = $model->getAll();
echo $twig->render('vocabList.html', ['vocabularies' => $voc, 'userID' => $user->getId(), 'userRole' => $user->getRoles()]); echo $twig->render('vocabList.html', ['jeu' => $jeu, 'vocabularies' => $voc, 'userID' => $user->getId(), 'userRole' => $user->getRoles()]);
} }
public function gameChoice(): void { public function gameChoice(): void {

@ -12,6 +12,7 @@ class VisitorController
{ {
public function memory($match): void{ public function memory($match): void{
global $twig; global $twig;
global $user;
try{ try{
$idVoc = Validation::filter_int($_POST['idVoc'] ?? 4); $idVoc = Validation::filter_int($_POST['idVoc'] ?? 4);
@ -19,6 +20,7 @@ class VisitorController
$name = ((new \gateway\VocabularyListGateway())->findById($idVoc))->getName(); $name = ((new \gateway\VocabularyListGateway())->findById($idVoc))->getName();
$wordShuffle = array(); $wordShuffle = array();
shuffle($wordList); shuffle($wordList);
$pairs = []; $pairs = [];
$maxWords = 28; $maxWords = 28;
@ -33,11 +35,22 @@ class VisitorController
shuffle($wordShuffle); shuffle($wordShuffle);
echo $twig->render('memory.html', [ if(isset($user)) {
'wordShuffle' => $wordShuffle, echo $twig->render('memory.html', [
'pairs' => json_encode($pairs), 'wordShuffle' => $wordShuffle,
'name' => $name 'pairs' => json_encode($pairs),
]); 'name' => $name,
'userID' => $user->getID(),
'userRole' => $user->getRoles()
]);
}
else{
echo $twig->render('memory.html', [
'wordShuffle' => $wordShuffle,
'pairs' => json_encode($pairs),
'name' => $name
]);
}
} }
catch (Exception $e){ catch (Exception $e){
@ -47,40 +60,60 @@ class VisitorController
public function quiz($match): void public function quiz($match): void
{ {
global $twig; global $twig;
$vocabId = Validation::filter_int($_POST['idVoc'] ?? 4); global $user;
$vocabList = (new VocabularyListGateway())->findById($vocabId) ?? null; try {
if ($vocabList == null) throw new Exception("liste inconnue"); $vocabId = Validation::filter_int($_POST['idVoc'] ?? 4);
$mdl = new TranslationGateway(); $vocabList = (new VocabularyListGateway())->findById($vocabId) ?? null;
$allTranslation = $mdl->findByIdVoc($vocabId); if ($vocabList == null) throw new Exception("liste inconnue");
$shuffle = $allTranslation; $mdl = new TranslationGateway();
shuffle($shuffle); $allTranslation = $mdl->findByIdVoc($vocabId);
$shuffle = $allTranslation;
$questions = array(); shuffle($shuffle);
$goodAnswers = array();
$allEnglishWords = array(); $questions = array();
$goodAnswers = array();
foreach ($allTranslation as $translation) { $allEnglishWords = array();
$questions[] = $translation->getWord1();
$allEnglishWords[] = $translation->getWord2(); foreach ($allTranslation as $translation) {
$goodAnswers[] = $translation->getWord2(); $questions[] = $translation->getWord1();
} $allEnglishWords[] = $translation->getWord2();
$goodAnswers[] = $translation->getWord2();
}
$answers = array(); $answers = array();
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);
$tab = array_rand(array_flip($allEnglishWords), 3); $tab = array_rand(array_flip($allEnglishWords), 3);
array_push($allEnglishWords, $correctAnswer); array_push($allEnglishWords, $correctAnswer);
$tab[] = $correctAnswer; $tab[] = $correctAnswer;
shuffle($tab); shuffle($tab);
$answers[] = $tab; $answers[] = $tab;
} }
echo $twig->render('quizView.html', ['questions' => $questions, 'answers' => $answers, 'goodAnswers' => $goodAnswers, 'listName' => $vocabList->getName()]); if (isset($user)) {
echo $twig->render('quizView.html', [
'questions' => $questions,
'answers' => $answers,
'goodAnswers' => $goodAnswers,
'listName' => $vocabList->getName(),
'userID' => $user->getID(),
'userRole' => $user->getRoles()]);
} else {
echo $twig->render('quizView.html', [
'questions' => $questions,
'answers' => $answers,
'goodAnswers' => $goodAnswers,
'listName' => $vocabList->getName()]);
}
}
catch (Exception $e){
throw new Exception("Erreur");
}
} }
public function login(): void { public function login(): void {

@ -21,6 +21,8 @@ h1{
gap: 10px; gap: 10px;
margin: auto; margin: auto;
perspective: 1000px; perspective: 1000px;
min-width: 70vw;
max-height: 70vh;
} }
.card { .card {

@ -11338,6 +11338,7 @@ body {
background-image: url("../assets/img/portrait_black.png"); background-image: url("../assets/img/portrait_black.png");
} }
.device[data-device=iPhoneX][data-orientation=portrait][data-color=black] .button { .device[data-device=iPhoneX][data-orientation=portrait][data-color=black] .button {
display: none; display: none;
top: 0%; top: 0%;

@ -4,7 +4,7 @@ document.addEventListener('DOMContentLoaded', function () {
var word1; var word1;
var word2; var word2;
var clickEnabled = true; var clickEnabled = true;
var score = 25; var score = 500;
cards.forEach(function (card) { cards.forEach(function (card) {
card.addEventListener('click', function () { card.addEventListener('click', function () {
@ -12,7 +12,6 @@ document.addEventListener('DOMContentLoaded', function () {
return; return;
} }
card.classList.toggle('flipped'); card.classList.toggle('flipped');
nbCard += 1; nbCard += 1;
if (nbCard === 1) { if (nbCard === 1) {
word1 = card.dataset.word; word1 = card.dataset.word;
@ -67,12 +66,11 @@ document.addEventListener('DOMContentLoaded', function () {
(pair[0] === word1 && pair[1] === word2) || (pair[0] === word1 && pair[1] === word2) ||
(pair[0] === word2 && pair[1] === word1) (pair[0] === word2 && pair[1] === word1)
) { ) {
score+=10;
return true; return true;
} }
} }
if(score !== 0){ if(score !== 0){
score-=1; score-=5;
} }
return false; return false;
} }

@ -5,14 +5,62 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link rel="icon" type="image/x-icon" href="{{base}}/assets/favicon.ico"/> <link rel="icon" type="image/x-icon" href="{{base}}/assets/favicon.ico"/>
<title>Erreur</title> <title>Erreur</title>
</head> <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="{{base}}/css/styles.css" rel="stylesheet" />
</head>
<style>
body{
margin-top: 5vh;
display: flex;
align-items: center;
justify-content: center;
height: 100vh;
background-color: #7464a1;
background-image: url("{{base}}/assets/img/nnyc.jpeg");
flex-direction: column;
background-size: cover; /* Ajuster la taille de l'image pour couvrir tout le corps */
background-position: center;
}
.err{
justify-content:center;
color:white;
text-shadow: 0 0 50px black;
}
h1{
display: flex;
justify-content: center;
font-size: 100px;
}
p{
display: flex;
justify-content: center;
font-size: 50px;
}
</style>
<body> <body>
<h1>ERREUR page !!!!!</h1> <div class="err">
<h1> ERREUR</h1>
{% if dVueEreur is defined %} {% if dVueEreur is defined %}
{% for value in dVueEreur %} {% for value in dVueEreur %}
<p>{{value}}</p> <p>{{value}}</p>
{% endfor %} {% endfor %}
{% endif %} {% endif %}
</div>
</body> </body>
</html> </html>

@ -5,40 +5,48 @@
<title>Users</title> <title>Users</title>
<link href="{{base}}/css/styles.css" rel="stylesheet" /> <link href="{{base}}/css/styles.css" rel="stylesheet" />
<link rel="icon" type="image/x-icon" href="{{base}}/assets/favicon.ico"/> <link rel="icon" type="image/x-icon" href="{{base}}/assets/favicon.ico"/>
</head> <style>
<style> body {
body { margin-top: 5vh;
margin-top: 5vh; display: flex;
display: flex; align-items: center;
align-items: center; justify-content: center;
justify-content: center; height: 100vh;
height: 100vh; }
}
.content {
text-align: center;
}
table { table {
border-spacing: 5%; margin-top: 20px;
} }
</style> </style>
</head>
<body> <body>
{% include 'navBar.twig' %} {% include 'navBar.twig' %}
{% if vocabularies is defined %}
<div class="content"> <div class="content">
<section> <section>
<table> <table>
{% for row in vocabularies %}
<tr> <tr>
<td> <td>
<form action="{{base}}/student/{{userID}}/memory" method="post"> <form action="{{base}}/student/{{userID}}/listVocChoice" method="post">
<input type="hidden" name="idVoc" value="{{ row.id }}"> <input type="hidden" name="jeu" value="quiz">
<input class="btn-list" type="submit" value="{{ row.name }}" /> <input class="btn-list" type="submit" value="Quiz" />
</form>
</td>
</tr>
<tr>
<td>
<form action="{{base}}/student/{{userID}}/listVocChoice" method="post">
<input type="hidden" name="jeu" value="memory">
<input class="btn-list" type="submit" value="Memory" />
</form> </form>
</td> </td>
</tr> </tr>
{% endfor %}
</table> </table>
</section> </section>
</div> </div>
{% endif %}
</body> </body>
</html> </html>

@ -4,11 +4,13 @@
<meta charset="UTF-8"> <meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Memory Game</title> <title>Memory Game</title>
<link href="{{base}}/css/styles.css" rel="stylesheet" />
<link rel="stylesheet" href="{{base}}/css/memory.css"> <link rel="stylesheet" href="{{base}}/css/memory.css">
<link rel="icon" type="image/x-icon" href="{{base}}/assets/favicon.ico"/> <link rel="icon" type="image/x-icon" href="{{base}}/assets/favicon.ico"/>
</head> </head>
<body> <body>
<div> {% include 'navBar.twig' %}
<div class="content">
<h1><u>Memory Game:</u> <i>{{ name }}</i></h1> <h1><u>Memory Game:</u> <i>{{ name }}</i></h1>
<div id="memory-game"> <div id="memory-game">
{% for word in wordShuffle %} {% for word in wordShuffle %}

@ -15,12 +15,11 @@
<li class="nav-item"><a class="nav-link" href="{{ base }}/admin/{{ userID }}/showAccountInfos">My account</a></li> <li class="nav-item"><a class="nav-link" href="{{ base }}/admin/{{ userID }}/showAccountInfos">My account</a></li>
{% endif %} {% endif %}
{% if 'student' in userRole%} {% if 'student' in userRole%}
<li class="nav-item"><a class="nav-link" href="{{ base }}/student/{{ userID }}/memoryChoice">Memory</a></li> <li class="nav-item"><a class="nav-link" href="{{ base }}/student/{{ userID }}/gameChoice">Play</a></li>
<li class="nav-item"><a class="nav-link" href="{{ base }}/student/{{ userID }}/showAccountInfos">My account</a></li> <li class="nav-item"><a class="nav-link" href="{{ base }}/student/{{ userID }}/showAccountInfos">My account</a></li>
{% endif %} {% endif %}
{% if 'teacher' in userRole%} {% if 'teacher' in userRole%}
<li class="nav-item"><a class="nav-link" href="{{ base }}/teacher/{{ userID }}/affAllVocab">Manage lessons</a></li> <li class="nav-item"><a class="nav-link" href="{{ base }}/teacher/{{ userID }}/affAllVocab">Manage lessons</a></li>
<li class="nav-item"><a class="nav-link" href="{{ base }}/teacher/{{ userID }}/game">Play</a></li>
<li class="nav-item"><a class="nav-link" href="{{ base }}/teacher/{{ userID }}/showAccountInfos">My account</a></li> <li class="nav-item"><a class="nav-link" href="{{ base }}/teacher/{{ userID }}/showAccountInfos">My account</a></li>
{% endif %} {% endif %}
{% if userRole is empty %} {% if userRole is empty %}

@ -13,13 +13,11 @@
<link <link
href="https://fonts.googleapis.com/css?family=Nunito:200,200i,300,300i,400,400i,600,600i,700,700i,800,800i,900,900i" href="https://fonts.googleapis.com/css?family=Nunito:200,200i,300,300i,400,400i,600,600i,700,700i,800,800i,900,900i"
rel="stylesheet" /> rel="stylesheet" />
<!-- Core theme CSS (includes Bootstrap)--> <link href="{{base}}/css/styles.css" rel="stylesheet"/>
<link href="{{base}}/css/styles.css" rel="stylesheet" />
<link href="{{base}}/css/quiz.css" rel="stylesheet" /> <link href="{{base}}/css/quiz.css" rel="stylesheet" />
</head> </head>
<body> <body>
{% include 'navBar.twig' %}
<section id="quiz"> <section id="quiz">
<h1>{{listName}}</h1> <h1>{{listName}}</h1>
<div id="questionContainer"> <div id="questionContainer">

@ -12,11 +12,15 @@
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
height: 100vh; height: auto;
}
.content {
text-align: center;
} }
table { table {
border-spacing: 5%; margin-top: 20px;
} }
</style> </style>
@ -29,7 +33,7 @@
{% for row in vocabularies %} {% for row in vocabularies %}
<tr> <tr>
<td> <td>
<form action="{{base}}/student/{{userID}}/memory" method="post"> <form action="{{base}}/student/{{userID}}/{{jeu}}" method="post">
<input type="hidden" name="idVoc" value="{{ row.id }}"> <input type="hidden" name="idVoc" value="{{ row.id }}">
<input class="btn-list" type="submit" value="{{ row.name }}" /> <input class="btn-list" type="submit" value="{{ row.name }}" />
</form> </form>

Loading…
Cancel
Save