On peut enfin ajouter un vocabulaire à partir de la vue

php
Patrick BRUGIERE 1 year ago
parent 3c195bddac
commit ea5f419ad0

@ -59,16 +59,14 @@ class TeacherController extends UserController
global $user;
$id = $user->getId();
$mdl = new MdlTeacher();
$userID = Validation::filter_int($_GET['userID'] ?? null);
$name = Validation::filter_str_simple($_GET['listName'] ?? null);
$words = array();
for ($i = 0; $i <= 1; $i++) {
$frenchWord = Validation::filter_str_simple($_GET['frenchWord'.$i] ?? null);
$englishWord = Validation::filter_str_simple($_GET['englishWord'.$i] ?? null);
$frenchWord = Validation::filter_str_simple($_GET['frenchWord'] ?? null);
$englishWord = Validation::filter_str_simple($_GET['englishWord'] ?? null);
$words[] = array($frenchWord, $englishWord);
}
var_dump($words);
$mdl->addVocabList($userID, $name, "", $words);
echo $twig->render('addVocabList.html', [ 'userId' => $id ]);
var_dump($words);
$addvoc= $mdl->addVocabList($id, $name, "", $words);
echo $twig->render('manageVocabListView.html', [ 'vocabularies' => $addvoc ,'userId' => $id]);
}
}

@ -38,7 +38,7 @@
<section class="addGroupForm">
<h2>Add Vocabb</h2>
{% include 'vocabularyContainer.twig' with { 'actions' : 'addVocabList' , 'userId' : userId } %}
{% include 'vocabularyContainer.twig' with { 'vocabularies' : vocabularies ,'actions' : 'addVocabList' , 'userId' : userId } %}
</section>
<section class="unassignedUsers">

@ -28,20 +28,27 @@
<input class="btn-black" type="button" value="delete from vocabulary" />
</a>
{% endif %}
{% endif %}
{% endif %}
{% endfor %}
<br>
{% if actions == 'addVocabList' %}
<a id="delButton" href="{{base}}/teacher/{{userId}}/addVocabList" />
<tr>
<td colspan="2">
<td><input type="text" name="image" placeholder="id"></td>
<td><input type="text" name="image" placeholder="name"></td>
<td><input type="text" name="image" placeholder="img"></td>
<td><input type="text" name="auth" placeholder="auth"></td>
</tr>
<td colspan="2"><input type="submit" value="Add"></td>
</a>
{% endif %}
<form action="{{ base }}/teacher/{{ userId }}/addVocabList" method="GET">
<label for="listName">Name:</label>
<input type="text" id="listName" name="listName"><br><br>
<label for="frenchWord">French Word:</label>
<input type="text" id="frenchWord" name="frenchWord"><br><br>
<label for="englishWord">English Word:</label>
<input type="text" id="englishWord" name="englishWord"><br><br>
<input type="submit" value="Add Vocabulary">
</form>
{% endif %}
</td>
</tr>

Loading…
Cancel
Save