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

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

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

Loading…
Cancel
Save