From 4c2424ef31c75e6b3c25a77f0c0ca4c4749101bf Mon Sep 17 00:00:00 2001 From: "maxime.point2" Date: Sat, 18 Nov 2023 19:14:45 +0100 Subject: [PATCH 1/5] ajout et suppression de flux fonctionne --- fluxRSS/src/DAL/FluxGateway.php | 16 +++--- fluxRSS/src/controleur/AdminControleur.php | 60 ++++++++++++++++++++-- fluxRSS/src/controleur/FrontControleur.php | 2 +- fluxRSS/src/controleur/UserControleur.php | 2 +- fluxRSS/src/metier/Flux.php | 4 +- fluxRSS/src/model/ArticleModel.php | 2 +- fluxRSS/src/model/FluxModel.php | 12 ++--- fluxRSS/templates/listArticleAdmin.html | 1 + fluxRSS/templates/listFlux.html | 23 +++++++++ 9 files changed, 100 insertions(+), 22 deletions(-) create mode 100755 fluxRSS/templates/listFlux.html diff --git a/fluxRSS/src/DAL/FluxGateway.php b/fluxRSS/src/DAL/FluxGateway.php index 1538bfc..bcdbcec 100755 --- a/fluxRSS/src/DAL/FluxGateway.php +++ b/fluxRSS/src/DAL/FluxGateway.php @@ -15,23 +15,25 @@ class FluxGateway public function addFlux(Flux $flux) { - $query = 'INSERT INTO Flux VALUES (:flux);'; - $this->con->executeQuery($query, array(':flux' => array($flux->getFlux(), PDO::PARAM_STR))); + $this->addFluxBySrc($flux->getFlux()); } - public function getId(): int + public function addFluxBySrc(string $flux) { - - return $this->id; + $query = 'INSERT INTO Flux VALUES (null,:flux);'; + var_dump($this->con->executeQuery($query, array(':flux' => array($flux, PDO::PARAM_STR)))); } public function removeFlux(Flux $flux){ + $this->removeFluxBySrc($flux->getFlux()); + } + + public function removeFluxBySrc(string $flux){ $query = 'DELETE FROM Flux WHERE flux = :flux;'; - $this->con->executeQuery($query, array(':flux' => array($flux->getFlux(), PDO::PARAM_STR))); + $this->con->executeQuery($query, array(':flux' => array($flux, PDO::PARAM_STR))); } public function findAllFlux(){ - $query = 'SELECT * FROM Flux;'; $this->con->executeQuery($query); return $this->con->getResults(); diff --git a/fluxRSS/src/controleur/AdminControleur.php b/fluxRSS/src/controleur/AdminControleur.php index 1f261a8..6166e7c 100755 --- a/fluxRSS/src/controleur/AdminControleur.php +++ b/fluxRSS/src/controleur/AdminControleur.php @@ -2,13 +2,20 @@ namespace controleur; +use http\Exception; +use metier\Flux; use model\AdminModel; use model\ArticleModel; use model\FluxModel; class AdminControleur { - public function __construct(){ + /*public function __construct() + { + $this->init(); + }*/ + + public function init(){ global $twig; // nécessaire pour utiliser variables globales //debut @@ -37,6 +44,14 @@ class AdminControleur $this->ValidationFormulaire($dVueEreur); break; + case 'listFlux': + $this->listFlux(); + break; + + case 'ajoutFlux': + $this->ajoutFlux(); + break; + //mauvaise action default: $dVueEreur[] = "Erreur d'appel php"; @@ -74,11 +89,29 @@ class AdminControleur } } + public function listFlux(){ + global $twig; + $fluxModel = new FluxModel(); + if (AdminModel::isAdmin()) { + $dVue = [ + 'data' => $fluxModel->findAllFlux() + ]; + echo $twig->render('listFlux.html', [ + 'dVue' => $dVue, + 'isAdmin' => AdminModel::isAdmin() + ]); + } + else { + $this->connection(); + } + } + public function connection(){ global $twig; // nécessaire pour utiliser variables globales $renderTemplate = true; if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST['username'])){ + $_REQUEST['action'] = null; $this->login(); $renderTemplate = false; } @@ -90,8 +123,27 @@ class AdminControleur public function deleteFlux(){ if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST['flux'])){ $fluxModel = new FluxModel(); - $fluxModel->removeFlux($_POST['flux']); - $this->listArticle(); + $fluxModel->removeFluxBySrc($_POST['flux']); + $_REQUEST['action'] = 'listFlux'; + $this->init(); + } + else{ + $_REQUEST['action'] = 'listFlux'; + $this->init(); + } + } + + public function ajoutFlux(){ + if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST['fluxAdd'])){ + $fluxModel = new FluxModel(); + $fluxModel->addFluxBySrc($_POST['fluxAdd']); + $_REQUEST['action'] = 'listFlux'; + unset($_POST['fluxAdd']); + $this->init(); + } + else{ + $_REQUEST['action'] = 'listFlux'; + $this->init(); } } @@ -102,7 +154,7 @@ class AdminControleur $adminModel = new AdminModel(); $admin = $adminModel->connection($username, $password); if($admin != null) { - $this->listArticle(); + $this->init(); } else{ unset($_POST['username']); diff --git a/fluxRSS/src/controleur/FrontControleur.php b/fluxRSS/src/controleur/FrontControleur.php index 6995f84..96af8ab 100755 --- a/fluxRSS/src/controleur/FrontControleur.php +++ b/fluxRSS/src/controleur/FrontControleur.php @@ -30,7 +30,7 @@ class FrontControleur else { session_start(); $controller=$match['target'] ?? null; - $action=$match['params']['action'] ?? null; + $action=$match['params']['action'] ?? "init"; try { if($controller == "AdminControleur"){ if (!AdminModel::isAdmin()){ diff --git a/fluxRSS/src/controleur/UserControleur.php b/fluxRSS/src/controleur/UserControleur.php index 8bec648..247ab39 100755 --- a/fluxRSS/src/controleur/UserControleur.php +++ b/fluxRSS/src/controleur/UserControleur.php @@ -7,7 +7,7 @@ use model\Parser; class UserControleur { - public function __construct() + public function init() { global $twig; // nécessaire pour utiliser variables globales //debut diff --git a/fluxRSS/src/metier/Flux.php b/fluxRSS/src/metier/Flux.php index b45e587..c7ea937 100755 --- a/fluxRSS/src/metier/Flux.php +++ b/fluxRSS/src/metier/Flux.php @@ -4,10 +4,10 @@ namespace metier; class Flux { - private int $id; + private ?int $id; private string $flux; - public function __construct(string $flux, int $id=null){ + public function __construct(?int $id, string $flux){ $this->id =$id; $this->flux = $flux; } diff --git a/fluxRSS/src/model/ArticleModel.php b/fluxRSS/src/model/ArticleModel.php index 332d0c7..0da42c6 100755 --- a/fluxRSS/src/model/ArticleModel.php +++ b/fluxRSS/src/model/ArticleModel.php @@ -47,7 +47,7 @@ class ArticleModel $res = $gwFlux->findAllFlux(); foreach ($res as $row) { - $flux = new Flux($row['flux'], (int)($row['id'])); + $flux = new Flux((int)($row['id']),$row['flux']); $tabFluxArticle[] = $this->findArticleByFluxAsStr($flux); } return $tabFluxArticle; diff --git a/fluxRSS/src/model/FluxModel.php b/fluxRSS/src/model/FluxModel.php index fb7461b..a79eedb 100755 --- a/fluxRSS/src/model/FluxModel.php +++ b/fluxRSS/src/model/FluxModel.php @@ -8,13 +8,13 @@ use metier\Flux; class FluxModel { - public function FindAllFlux(){ + public function findAllFlux(){ $gateway = new FluxGateway(new Connection('mysql:host=londres.uca.local;dbname=dbrorossetto','rorossetto','tpphp')); $data = array(); $result = $gateway->findAllFlux(); foreach ($result as $row){ - $data[] = new Flux((int)$row['id'],$row['$flux']); + $data[] = new Flux((int)$row['id'],$row['flux']); } return $data; } @@ -29,7 +29,7 @@ class FluxModel public function addFluxBySrc(string $flux): Flux { $gateway = new FluxGateway(new Connection('mysql:host=londres.uca.local;dbname=dbrorossetto','rorossetto','tpphp')); - $newFlux = new Flux($flux); + $newFlux = new Flux(null,$flux); $gateway->addFlux($newFlux); return $newFlux; } @@ -41,7 +41,7 @@ class FluxModel public function removeFluxBySrc(string $flux) { $gateway = new FluxGateway(new Connection('mysql:host=londres.uca.local;dbname=dbrorossetto','rorossetto','tpphp')); - $gateway->removeFlux($flux); + $gateway->removeFluxBySrc($flux); } public function findFlux(Flux $flux){ @@ -50,7 +50,7 @@ class FluxModel $result = $gateway->findFlux($flux); foreach ($result as $row){ - $data[] = new Flux($row['$flux'],(int)$row['id']); + $data[] = new Flux((int)$row['id'],$row['$flux']); } return $data; } @@ -61,7 +61,7 @@ class FluxModel $result = $gateway->findFluxBySrc($flux); foreach ($result as $row){ - $data[] = new Flux($row['$flux'],(int)$row['id']); + $data[] = new Flux((int)$row['id'],$row['$flux']); } return $data; } diff --git a/fluxRSS/templates/listArticleAdmin.html b/fluxRSS/templates/listArticleAdmin.html index 256f419..2643f24 100755 --- a/fluxRSS/templates/listArticleAdmin.html +++ b/fluxRSS/templates/listArticleAdmin.html @@ -21,6 +21,7 @@ admin {% endfor %} Vue user +Vue flux Déconnection \ No newline at end of file diff --git a/fluxRSS/templates/listFlux.html b/fluxRSS/templates/listFlux.html new file mode 100755 index 0000000..14d182e --- /dev/null +++ b/fluxRSS/templates/listFlux.html @@ -0,0 +1,23 @@ + + + + + All Flux + + + {% for value in dVue.data %} +
+ {{ value.getFlux() }} +
+ + +
+
+ {% endfor %} +
+ + +
+ Vue article + + \ No newline at end of file From d03131beea5645e28b9a390517c26f65f0e8e0ff Mon Sep 17 00:00:00 2001 From: "maxime.point2" Date: Sat, 18 Nov 2023 20:32:15 +0100 Subject: [PATCH 2/5] modif delete flux --- fluxRSS/src/DAL/ArticleGateway.php | 9 +++++++++ fluxRSS/src/DAL/FluxGateway.php | 5 +++++ fluxRSS/src/controleur/AdminControleur.php | 6 +++++- fluxRSS/src/model/ArticleModel.php | 6 ++++++ fluxRSS/src/model/FluxModel.php | 5 +++++ fluxRSS/src/test/test.php | 1 + fluxRSS/templates/listFlux.html | 2 +- 7 files changed, 32 insertions(+), 2 deletions(-) diff --git a/fluxRSS/src/DAL/ArticleGateway.php b/fluxRSS/src/DAL/ArticleGateway.php index e08f763..a6adc1a 100755 --- a/fluxRSS/src/DAL/ArticleGateway.php +++ b/fluxRSS/src/DAL/ArticleGateway.php @@ -47,6 +47,15 @@ class ArticleGateway $this->con->executeQuery($query); } + public function removeAllArticleFromFlux(int $idFlux){ + try { + $query = 'DELETE FROM Article WHERE Provenance = :idFlux;'; + $this->con->executeQuery($query, array(':idFlux' => array($idFlux, PDO::PARAM_INT))); + }catch(\PDOException $p){ + throw new Exception("Data of flux is not delete."); + } + } + public function findArticleByFlux(int $flux){ $query = 'SELECT * FROM Article WHERE provenance = :flux;'; $this->con->executeQuery($query, array(':flux' => array($flux, PDO::PARAM_INT))); diff --git a/fluxRSS/src/DAL/FluxGateway.php b/fluxRSS/src/DAL/FluxGateway.php index bcdbcec..3675a06 100755 --- a/fluxRSS/src/DAL/FluxGateway.php +++ b/fluxRSS/src/DAL/FluxGateway.php @@ -33,6 +33,11 @@ class FluxGateway $this->con->executeQuery($query, array(':flux' => array($flux, PDO::PARAM_STR))); } + public function removeFluxById(int $id){ + $query = 'DELETE FROM Flux WHERE id = :id;'; + $this->con->executeQuery($query, array(':id' => array($id, PDO::PARAM_INT))); + } + public function findAllFlux(){ $query = 'SELECT * FROM Flux;'; $this->con->executeQuery($query); diff --git a/fluxRSS/src/controleur/AdminControleur.php b/fluxRSS/src/controleur/AdminControleur.php index 6166e7c..8d862fc 100755 --- a/fluxRSS/src/controleur/AdminControleur.php +++ b/fluxRSS/src/controleur/AdminControleur.php @@ -2,6 +2,7 @@ namespace controleur; +use DAL\ArticleGateway; use http\Exception; use metier\Flux; use model\AdminModel; @@ -122,8 +123,11 @@ class AdminControleur public function deleteFlux(){ if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST['flux'])){ + $articleModel = new ArticleModel(); $fluxModel = new FluxModel(); - $fluxModel->removeFluxBySrc($_POST['flux']); + var_dump($_POST); + $articleModel->removeAticleIdFlux(intval($_POST['flux'])); + $fluxModel->removeFluxById(intval($_POST['flux'])); $_REQUEST['action'] = 'listFlux'; $this->init(); } diff --git a/fluxRSS/src/model/ArticleModel.php b/fluxRSS/src/model/ArticleModel.php index 0da42c6..372dd4a 100755 --- a/fluxRSS/src/model/ArticleModel.php +++ b/fluxRSS/src/model/ArticleModel.php @@ -66,4 +66,10 @@ class ArticleModel $dicoFluxArticle = [$flux,$tabArticle]; return $dicoFluxArticle; } + + public static function removeAticleIdFlux(int $idFlux) + { + $gwArticle = new ArticleGateway(new Connection('mysql:host=londres.uca.local;dbname=dbrorossetto','rorossetto','tpphp')); + $gwArticle->removeAllArticleFromFlux($idFlux); + } } \ No newline at end of file diff --git a/fluxRSS/src/model/FluxModel.php b/fluxRSS/src/model/FluxModel.php index a79eedb..5a329c3 100755 --- a/fluxRSS/src/model/FluxModel.php +++ b/fluxRSS/src/model/FluxModel.php @@ -39,6 +39,11 @@ class FluxModel $gateway->removeFlux($flux); } + public function removeFluxById(int $id){ + $gateway = new FluxGateway(new Connection('mysql:host=londres.uca.local;dbname=dbrorossetto','rorossetto','tpphp')); + $gateway->removeFluxById($id); + } + public function removeFluxBySrc(string $flux) { $gateway = new FluxGateway(new Connection('mysql:host=londres.uca.local;dbname=dbrorossetto','rorossetto','tpphp')); $gateway->removeFluxBySrc($flux); diff --git a/fluxRSS/src/test/test.php b/fluxRSS/src/test/test.php index ff5c34a..068db67 100755 --- a/fluxRSS/src/test/test.php +++ b/fluxRSS/src/test/test.php @@ -11,3 +11,4 @@ $gwArt = new ArticleGateway(new Connection('mysql:host=londres.uca.local;dbname= $gwFl = new FluxGateway(new Connection('mysql:host=londres.uca.local;dbname=dbrorossetto', 'rorossetto', 'tpphp')); $pars = new Parser( $gwFl,$gwArt); +var_dump($pars); \ No newline at end of file diff --git a/fluxRSS/templates/listFlux.html b/fluxRSS/templates/listFlux.html index 14d182e..b503f89 100755 --- a/fluxRSS/templates/listFlux.html +++ b/fluxRSS/templates/listFlux.html @@ -9,7 +9,7 @@
{{ value.getFlux() }}
- +
From e465122afa8d36ffad8ced7f6f2832259acb4bd9 Mon Sep 17 00:00:00 2001 From: "maxime.point2" Date: Sat, 18 Nov 2023 20:50:12 +0100 Subject: [PATCH 3/5] modif gestion flux --- fluxRSS/src/controleur/AdminControleur.php | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/fluxRSS/src/controleur/AdminControleur.php b/fluxRSS/src/controleur/AdminControleur.php index 6166e7c..1ad46f0 100755 --- a/fluxRSS/src/controleur/AdminControleur.php +++ b/fluxRSS/src/controleur/AdminControleur.php @@ -2,11 +2,15 @@ namespace controleur; +use DAL\ArticleGateway; +use DAL\Connection; +use DAL\FluxGateway; use http\Exception; use metier\Flux; use model\AdminModel; use model\ArticleModel; use model\FluxModel; +use model\Parser; class AdminControleur { @@ -122,8 +126,10 @@ class AdminControleur public function deleteFlux(){ if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST['flux'])){ + $articleModel = new ArticleModel(); $fluxModel = new FluxModel(); - $fluxModel->removeFluxBySrc($_POST['flux']); + $articleModel->removeAticleIdFlux(intval($_POST['flux'])); + $fluxModel->removeFluxById(intval($_POST['flux'])); $_REQUEST['action'] = 'listFlux'; $this->init(); } @@ -135,8 +141,13 @@ class AdminControleur public function ajoutFlux(){ if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST['fluxAdd'])){ + $con = new Connection('mysql:host=londres.uca.local;dbname=dbrorossetto','rorossetto','tpphp'); + $gwArticle = new ArticleGateway($con); + $gwFlux = new FluxGateway($con); + $parser = new Parser($gwFlux,$gwArticle); $fluxModel = new FluxModel(); $fluxModel->addFluxBySrc($_POST['fluxAdd']); + $parser->addAllArticles(); $_REQUEST['action'] = 'listFlux'; unset($_POST['fluxAdd']); $this->init(); From 64312ad5a64e090845a736166ee04274897b069d Mon Sep 17 00:00:00 2001 From: "maxime.point2" Date: Sat, 18 Nov 2023 23:12:50 +0100 Subject: [PATCH 4/5] ajout des fonctions perdus --- fluxRSS/src/controleur/AdminControleur.php | 18 +++++++++++++++- fluxRSS/src/controleur/UserControleur.php | 6 ++++-- fluxRSS/src/metier/Article.php | 6 ++++++ fluxRSS/templates/listArticle.html | 18 ++++++---------- fluxRSS/templates/listArticleAdmin.html | 25 +++++++++------------- 5 files changed, 43 insertions(+), 30 deletions(-) diff --git a/fluxRSS/src/controleur/AdminControleur.php b/fluxRSS/src/controleur/AdminControleur.php index 1ad46f0..9d8cadd 100755 --- a/fluxRSS/src/controleur/AdminControleur.php +++ b/fluxRSS/src/controleur/AdminControleur.php @@ -56,6 +56,10 @@ class AdminControleur $this->ajoutFlux(); break; + case 'changeNbArticle': + $this->changeNbArticle(); + break; + //mauvaise action default: $dVueEreur[] = "Erreur d'appel php"; @@ -79,9 +83,12 @@ class AdminControleur { global $twig; $articleModel = new ArticleModel(); + $nbArticle = isset($_SESSION['nbArticle']) ? intval($_SESSION['nbArticle']) : 5; + $allArticles = $articleModel->getArticles(); + $articles = array_slice($allArticles, 0, $nbArticle); if (AdminModel::isAdmin()) { $dVue = [ - 'data' => $articleModel->findAllArticleByAllFlux() + 'data' => $articles ]; echo $twig->render('listArticleAdmin.html', [ 'dVue' => $dVue, @@ -173,4 +180,13 @@ class AdminControleur $this->connection(); } } + + public function changeNbArticle() + { + if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST['nbArticle'])) { + $_SESSION['nbArticle'] = $_POST['nbArticle']; + unset($_POST['action']); + } + $this->init(); + } } \ No newline at end of file diff --git a/fluxRSS/src/controleur/UserControleur.php b/fluxRSS/src/controleur/UserControleur.php index 247ab39..3246bc7 100755 --- a/fluxRSS/src/controleur/UserControleur.php +++ b/fluxRSS/src/controleur/UserControleur.php @@ -3,7 +3,6 @@ namespace controleur; use model\AdminModel; use model\ArticleModel; -use model\Parser; class UserControleur { @@ -59,8 +58,11 @@ class UserControleur { global $twig; $articleModel = new ArticleModel(); + $nbArticle = isset($_SESSION['nbArticle']) ? intval($_SESSION['nbArticle']) : 5; + $allArticles = $articleModel->getArticles(); + $articles = array_slice($allArticles, 0, $nbArticle); $dVue = [ - 'data' => $articleModel->findAllArticleByAllFlux() + 'data' => $articles ]; echo $twig->render('listArticle.html', [ 'dVue' => $dVue, diff --git a/fluxRSS/src/metier/Article.php b/fluxRSS/src/metier/Article.php index 6a2c8b2..e3c8cc7 100755 --- a/fluxRSS/src/metier/Article.php +++ b/fluxRSS/src/metier/Article.php @@ -2,6 +2,8 @@ namespace metier; +use DateTime; + class Article { private int $id; @@ -128,4 +130,8 @@ class Article return $this->title . $this->date . $this->description; } + public function dateStr(): string{ + $dateTime = new DateTime($this->date); + return $dateTime->format('d/m/y à H:i') . ''; + } } \ No newline at end of file diff --git a/fluxRSS/templates/listArticle.html b/fluxRSS/templates/listArticle.html index 7cb0003..4decf81 100755 --- a/fluxRSS/templates/listArticle.html +++ b/fluxRSS/templates/listArticle.html @@ -5,22 +5,16 @@ All Articles -{% for value in dVue.data %} -

- {{ value.0.getFlux() }} - {% for article in value.1 %} -

- {{article}} -

- {% endfor %} -
-
-

+{% for article in dVue.data %} +

+ {{article.dateStr()}} + {{ article.getTitle() }} + {{ article.getDescription() }} +

{% endfor %} {% if not isAdmin %} Connect {% else %} -Vue admin Déconnection {% endif %} diff --git a/fluxRSS/templates/listArticleAdmin.html b/fluxRSS/templates/listArticleAdmin.html index 2643f24..f028236 100755 --- a/fluxRSS/templates/listArticleAdmin.html +++ b/fluxRSS/templates/listArticleAdmin.html @@ -5,22 +5,17 @@ All Articles -admin -{% for value in dVue.data %} -
- {{ value.0.getFlux() }} -
- - -
- {% for article in value.1 %} -

- {{article}} -

- {% endfor %} -
+
+ + +
+{% for article in dVue.data %} +

+ {{article.dateStr()}} + {{ article.getTitle() }} + {{ article.getDescription() }} +

{% endfor %} -Vue user Vue flux Déconnection From bb971a695913a5d03f67052181b7defbd7d9bad4 Mon Sep 17 00:00:00 2001 From: "maxime.point2" Date: Sat, 18 Nov 2023 23:20:10 +0100 Subject: [PATCH 5/5] =?UTF-8?q?r=C3=A9solution=20appelle=20de=20finction?= =?UTF-8?q?=20foireux?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- fluxRSS/src/DAL/FluxGateway.php | 2 +- fluxRSS/src/controleur/AdminControleur.php | 2 +- fluxRSS/src/model/ArticleModel.php | 6 ++++++ fluxRSS/src/test/test.php | 1 + 4 files changed, 9 insertions(+), 2 deletions(-) diff --git a/fluxRSS/src/DAL/FluxGateway.php b/fluxRSS/src/DAL/FluxGateway.php index 3675a06..f0469b8 100755 --- a/fluxRSS/src/DAL/FluxGateway.php +++ b/fluxRSS/src/DAL/FluxGateway.php @@ -21,7 +21,7 @@ class FluxGateway public function addFluxBySrc(string $flux) { $query = 'INSERT INTO Flux VALUES (null,:flux);'; - var_dump($this->con->executeQuery($query, array(':flux' => array($flux, PDO::PARAM_STR)))); + $this->con->executeQuery($query, array(':flux' => array($flux, PDO::PARAM_STR))); } public function removeFlux(Flux $flux){ diff --git a/fluxRSS/src/controleur/AdminControleur.php b/fluxRSS/src/controleur/AdminControleur.php index 9d8cadd..2a522c3 100755 --- a/fluxRSS/src/controleur/AdminControleur.php +++ b/fluxRSS/src/controleur/AdminControleur.php @@ -135,7 +135,7 @@ class AdminControleur if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST['flux'])){ $articleModel = new ArticleModel(); $fluxModel = new FluxModel(); - $articleModel->removeAticleIdFlux(intval($_POST['flux'])); + $articleModel->removeArticleIdFlux(intval($_POST['flux'])); $fluxModel->removeFluxById(intval($_POST['flux'])); $_REQUEST['action'] = 'listFlux'; $this->init(); diff --git a/fluxRSS/src/model/ArticleModel.php b/fluxRSS/src/model/ArticleModel.php index 0da42c6..aecdbe7 100755 --- a/fluxRSS/src/model/ArticleModel.php +++ b/fluxRSS/src/model/ArticleModel.php @@ -66,4 +66,10 @@ class ArticleModel $dicoFluxArticle = [$flux,$tabArticle]; return $dicoFluxArticle; } + + public static function removeArticleIdFlux(int $idFlux) + { + $gwArticle = new ArticleGateway(new Connection('mysql:host=londres.uca.local;dbname=dbrorossetto','rorossetto','tpphp')); + $gwArticle->removeAllArticleFromFlux($idFlux); + } } \ No newline at end of file diff --git a/fluxRSS/src/test/test.php b/fluxRSS/src/test/test.php index ff5c34a..068db67 100755 --- a/fluxRSS/src/test/test.php +++ b/fluxRSS/src/test/test.php @@ -11,3 +11,4 @@ $gwArt = new ArticleGateway(new Connection('mysql:host=londres.uca.local;dbname= $gwFl = new FluxGateway(new Connection('mysql:host=londres.uca.local;dbname=dbrorossetto', 'rorossetto', 'tpphp')); $pars = new Parser( $gwFl,$gwArt); +var_dump($pars); \ No newline at end of file