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();