on peut maintenant supprimer un vocabulaire sur la vue , mais j'ai du modifié un peu une fonction de la gateway teacher pour cela

php
Patrick BRUGIERE 1 year ago
parent 915782d514
commit 899071b307

@ -14,8 +14,8 @@ class FrontController
session_start();
var_dump($_SESSION['login']);
var_dump($_SESSION['roles']);
//var_dump($_SESSION['login']);
//var_dump($_SESSION['roles']);
try {
$router = new \AltoRouter();

@ -35,11 +35,12 @@ class TeacherController
}
public function DelById($id):void{
public function DelById():void{
global $twig;
$mdl = new MdlTeacher();
$id = Validation::filter_int($_GET['vocabID'] ?? null);
$vocab = $mdl->removeVocById($id);
echo $twig->render('usersView.html', ['users' => $vocab]);
echo $twig->render('manageVocabListView.html', [ 'vocabularies' => $vocab]);
}
public function showVocabListForm(): void {

@ -30,16 +30,21 @@ class VocabularyListGateway extends AbsGateway
public function remove(int $id): void
{
try{
$query = "DELETE FROM Translate WHERE listVoc=:id";
$args = array(':id'=>array($id,PDO::PARAM_INT));
$this->con->ExecuteQuery($query,$args);
$query = "DELETE FROM Practice WHERE vocabID=:id";
$args = array(':id'=>array($id,PDO::PARAM_INT));
$this->con->ExecuteQuery($query,$args);
$query = "DELETE FROM VocabularyList v WHERE v.id=:id ";
$query = "DELETE FROM VocabularyList WHERE id=:id ";
$args = array(':id'=>array($id,PDO::PARAM_INT));
$this->con->ExecuteQuery($query,$args);
}
catch (PDOException $e){
throw new Exception('problème pour supprimer les vocabulaires avec leur Id');
throw new Exception('problème pour supprimer les vocabulaires avec leur Id'. $e->getMessage());
}
}

@ -23,7 +23,7 @@
<section class="unassignedUsers">
<h1>Unassigned vocab</h1>
{% include 'vocabularyContainer.twig' with {'vocabularies' : vocabularies , 'actions' : 'getVocabByName'} %}
{% include 'vocabularyContainer.twig' with {'vocabularies' : vocabularies , 'actions' : 'delById'} %}
</section>
</div>
</body>

@ -18,11 +18,14 @@
<td>
{% if actions == 'affAllVocab' %}
<a href="affAllVocab">
<input class="btn-black" type="button" value="Delete from group"/>
</a>
{% elseif actions == 'getByName' %}
<a href="getByName?listName={{ selectedName }}">
<input class="btn-black" type="button" value="Delete from group"/>
</a>
{% elseif actions == 'delById' %}
<a id="delButton" href="delById?vocabID={{ row.id }}">
<input class="btn-black" type="button" value="delete from vocabulary" />
</a>
{% endif %}
</td>

Loading…
Cancel
Save