From bb66d7af18bd0bed3235f9290d95b71c9a90e19a Mon Sep 17 00:00:00 2001 From: bastien ollier Date: Fri, 16 Dec 2022 20:48:01 +0100 Subject: [PATCH] add supresion source --- controllers/ControllerAdmin.php | 4 ++-- gateways/GatewaySources.php | 6 +++--- vues/administration.php | 6 ++++-- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/controllers/ControllerAdmin.php b/controllers/ControllerAdmin.php index 78d949a..6058e00 100644 --- a/controllers/ControllerAdmin.php +++ b/controllers/ControllerAdmin.php @@ -84,9 +84,9 @@ class ControllerAdmin { function supprimerSource() { global $dsn,$user,$pass,$vues; - if(isset($_REQUEST["idSource"])) { + if(isset($_REQUEST["source"])) { $gate = new GatewaySources(new Connection($dsn, $user, $pass)); - $gate->deleteSources($_REQUEST["idSource"]); + $gate->deleteSources($_REQUEST["source"]); } header("location: index.php?action=goToAdministration"); } diff --git a/gateways/GatewaySources.php b/gateways/GatewaySources.php index 76360f2..8b6847b 100644 --- a/gateways/GatewaySources.php +++ b/gateways/GatewaySources.php @@ -15,10 +15,10 @@ class GatewaySources ); } - public function deleteSources($idSource) + public function deleteSources($link) { - $query = "delete from sources where link = :idsource;"; - $this->con->executeQuery($query, array(':idsource' => array($idSource, PDO::PARAM_INT) + $query = "delete from sources where link = :link;"; + $this->con->executeQuery($query, array(':link' => array($link, PDO::PARAM_STR) ) ); } diff --git a/vues/administration.php b/vues/administration.php index 81f7427..f26f273 100644 --- a/vues/administration.php +++ b/vues/administration.php @@ -8,8 +8,9 @@ getlink().'">'; + if(!is_null($listeSources)) { + foreach ($listeSources as $n) { + echo '
'; echo "
"; echo "
"; echo "
"; + } } ?>