diff --git a/ControllerAdmin.php b/ControllerAdmin.php new file mode 100644 index 0000000..cf2d904 --- /dev/null +++ b/ControllerAdmin.php @@ -0,0 +1,60 @@ +ajoutSource(); + break; + case "suprimerSource": + $this->suprimerSource(); + break; + case "setNbArticlesParPage": + $this->setNbArticlesParPage(); + break; + + } + } + catch (PDOException $e) + { + // $dataVueEreur[] = "Erreur inattendue!!! "; + // require(__DIR__.'/../vues/erreur.php'); + } + catch (Exception $e2) + { + // $dataVueEreur[] = "Erreur inattendue!!! "; + // require ($rep.$vues['erreur']); + } + } + + function ajoutSource() { + $user= 'jeducourth'; + $pass='achanger'; + $dsn='mysql:host=localhost;dbname=dbjeducourth'; + $con = new Connection($dsn,$user,$pass); + + $mdl = new GatewaySources($con); + $mdl->addSources("bonjour.com"); + //require('menuAdmin.php'); + } + + function suprimerSource() { + //$mdl = new GatewaySource(); + //$mdl->suprSource(); + //require('menuAdmin.php'); + } + + function setNbArticlesParPage(){ + + //require('menuAdmin.php'); + } +} +?> diff --git a/index.php b/index.php index 08bdbe8..4e24167 100644 --- a/index.php +++ b/index.php @@ -4,18 +4,22 @@ require_once("connection.php"); require_once("gatewayNews.php"); require_once("gatewayAdmins.php"); - require_once("gatewaySources.php"); + //require_once("gatewaySources.php"); - $user= 'jeducourth'; - $pass='achanger'; - $dsn='mysql:host=localhost;dbname=dbjeducourth'; + require_once("ControllerAdmin.php"); - $title="titre"; + //$user= 'jeducourth'; + //$pass='achanger'; + //$dsn='mysql:host=localhost;dbname=dbjeducourth'; + + /*$title="titre"; $description="descirption du titre"; $pubdate="2022-04-12 8:8:8"; $link="exemple.com"; +*/ + $controller = new ControllerAdmin(); - try{ + /*try{ $con = new Connection($dsn,$user,$pass); $gateNews = new GatewayNews($con); $gateNews->addNews(new News($title,$description,$pubdate,$link)); @@ -25,12 +29,7 @@ $gateAdmin->addAdmin(new admin("toto","tata")); $sources->addSources(new sources($link)); - - - /*$results=$gateNews->getNews(); - Foreach ($results as $new){ - print $new->getTitle()."
".$new->getDescription()."
".$new->getPubDate()."
".$new->getLink()."

"; - }*/ + require("listeNews.php"); @@ -38,7 +37,7 @@ catch( PDOException $Exception ) { echo 'erreur'; echo $Exception->getMessage(); - } + }*/ ?>