diff --git a/src/controller/CtrlVisiteur.php b/src/controller/CtrlVisiteur.php index 91ad586..4a4d283 100755 --- a/src/controller/CtrlVisiteur.php +++ b/src/controller/CtrlVisiteur.php @@ -53,6 +53,10 @@ class CtrlVisiteur { $this->AjouterTache(); break; + case "AjouterListePublic": + $this->AjouterListePublic(); + break; + case "ModifierListe": $this->ModifierListe(); break; @@ -160,6 +164,15 @@ class CtrlVisiteur { require ($rep.$vues['listPublic']); } + public function AjouterListePublic(){ + global $rep,$vues; + $tache = MdlVisiteur::AjouterListePublic(); + $listes = MdlVisiteur::RecupererListePublic(); + $taches = MdlVisiteur::RecupererTache(); + $action=NULL; + require ($rep.$vues['listPublic']); + } + public function ModifierListe(){ global $rep,$vues; $tache = MdlVisiteur::ModifierListe(); diff --git a/src/modele/MdlVisiteur.php b/src/modele/MdlVisiteur.php index 19c99ce..861d3e1 100755 --- a/src/modele/MdlVisiteur.php +++ b/src/modele/MdlVisiteur.php @@ -46,16 +46,16 @@ class MdlVisiteur public function AjouterTache(){ $taskGtw = new TacheGateway(); $id = $_POST['idListe']; - $nom = Validation::cleanString($_POST['nom-ajout']); - $description = Validation::cleanString($_POST['description-ajout']); + $nom = $_POST['nom-ajout']; + $description = $_POST['description-ajout']; $taskGtw->AjouterTache($nom, $description,false,$id); } public function ModifierListe(){ $userGtw = new ListeGateway(); $id = $_POST['idListe']; - $nom = Validation::cleanString($_POST['nom-modif-liste']); - $description = Validation::cleanString($_POST['description-modif-liste']); + $nom = $_POST['nom-modif-liste']; + $description = $_POST['description-modif-liste']; if($description == NULL){ $userGtw->EditerNom($id, $nom); } @@ -67,6 +67,13 @@ class MdlVisiteur } } + public function AjouterListePublic(){ + $taskGtw = new ListeGateway(); + $nom = $_POST['nom-ajout-liste']; + $description = $_POST['description-ajout-liste']; + $taskGtw->Ajouter($nom, $description,1, true); + } + public function check(){ $taskGtw = new TacheGateway(); $id = $_POST['idTache']; diff --git a/src/modele/gateway/ListeGateway.php b/src/modele/gateway/ListeGateway.php index 096f81b..9d98fc1 100755 --- a/src/modele/gateway/ListeGateway.php +++ b/src/modele/gateway/ListeGateway.php @@ -7,14 +7,14 @@ class ListeGateway{ $this->con=new Connection($dsn,$user,$pass); } - public function Ajouter(string $nom, Date $dateCreation, bool $estValide, int $idCreateur, bool $estPublic){ - $query='INSERT INTO ToDoList_Liste(nom, dateCreation,estValide, createur, estPublic) VALUES(:nom, :dateCreation, :estValide, :idCreateur, :estPublic);'; + public function Ajouter(string $nom, string $description, bool $estPublic, string $createur){ + $query='INSERT INTO ToDoList_Liste(nom, description, dateCreation,estPublic, idUtilisateur) VALUES(:nom,:description,CURRENT_DATE, :estPublic, :createur);'; $this->con->executeQuery($query, array( 'nom' => array($nom, PDO::PARAM_STR), - 'dateCreation' => array($dateCreation, PDO::PARAM_STR), - 'estValide' => array($estValide, PDO::PARAM_BOOL), - 'idCreateur' => array($idCreateur, PDO::PARAM_INT), - 'estPublic' => array($estPublic, PDO::PARAM_INT))); + 'description' => array($description, PDO::PARAM_STR), + 'estPublic' => array($estPublic, PDO::PARAM_INT), + 'createur' => array($createur, PDO::PARAM_STR), + )); } public function Editer(string $id, string $nom, string $description){ diff --git a/src/vue/html/PageListePublic.php b/src/vue/html/PageListePublic.php index dea2c5f..62cbf4d 100755 --- a/src/vue/html/PageListePublic.php +++ b/src/vue/html/PageListePublic.php @@ -16,6 +16,40 @@ + + +