Lucie GOIGOUX 1 year ago
commit c4e9928fbd

@ -56,6 +56,8 @@ class TeacherController extends UserController
public function addVocabList():void {
global $twig;
global $user;
$id = $user->getId();
$mdl = new MdlTeacher();
$userID = Validation::filter_int($_GET['userID'] ?? null);
$name = Validation::filter_str_simple($_GET['listName'] ?? null);
@ -67,6 +69,6 @@ class TeacherController extends UserController
}
var_dump($words);
$mdl->addVocabList($userID, $name, "", $words);
echo $twig->render('addVocabList.html');
echo $twig->render('addVocabList.html', [ 'userId' => $id ]);
}
}

@ -5,7 +5,7 @@ namespace model;
use gateway\GroupGateway;
use gateway\UserGateway;
class MdlAdmin extends AbsModel
class MdlAdmin extends MdlUser
{
public function __construct()
{

@ -6,7 +6,7 @@ use gateway\UserGateway;
use gateway\VocabularyGateway;
use gateway\VocabularyListGateway;
class MdlStudent extends AbsModel
class MdlStudent extends MdlUser
{
public function __construct()

@ -7,7 +7,7 @@ use gateway\UserGateway;
use gateway\VocabularyGateway;
use gateway\VocabularyListGateway;
class MdlTeacher extends AbsModel
class MdlTeacher extends MdlUser
{
public function __construct()

@ -4,11 +4,7 @@ namespace model;
use gateway\UserGateway;
public class MdlUser extends AbsModel {
public function getUser(int $id): User{
$gtw = new UserGateway();
return $gtw->findById($id);
}
class MdlUser extends AbsModel {
public function modifyNickname(int $id, string $newNickname): void{
$gtw = new UserGateway();

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

@ -21,17 +21,30 @@
</a>
{% elseif actions == 'getByName' %}
<a href="{{base}}/teacher/{{userId}}/getByName?VocabID={{selectedName}}">
<a href="{{base}}/teacher/{{userId}}/getByName?listName={{selectedName}}">
</a>
{% elseif actions == 'delById' %}
<a id="delButton" href="{{base}}/teacher/{{userId}}/delById?vocabID={{ row.id }}">
<input class="btn-black" type="button" value="delete from vocabulary" />
</a>
{% endif %}
</td>
{% endif %}
{% endfor %}
{% 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 %}
</td>
</tr>
{% endfor %}
{% endif %}
</table>
Loading…
Cancel
Save