diff --git a/.DS_Store b/.DS_Store index c817179..c7413f4 100644 Binary files a/.DS_Store and b/.DS_Store differ diff --git a/controleurs/ControleurVisiteur.php b/controleurs/ControleurVisiteur.php index 9e9f2a0..11e34b5 100644 --- a/controleurs/ControleurVisiteur.php +++ b/controleurs/ControleurVisiteur.php @@ -17,6 +17,7 @@ class VisitorController { break; case "inscription": $this->inscription($arrayErrorViews); + break; case "creerListe": $this->creerListe($arrayErrorViews); break; @@ -29,6 +30,9 @@ class VisitorController { case "cocherTache": $this->cocherTache($arrayErrorViews); break; + case "decocherTache": + $this->decocherTache($arrayErrorViews); + break; case "supprTache": $this->supprTache($arrayErrorViews); default : @@ -37,14 +41,14 @@ class VisitorController { } } catch(PDOException $e){ $dataView[]="Erreur inatendue"; - require(__DIR__.'/../vues/erreur.php'); + require('erreur.php'); } exit(0); } public function reinit(){ global $rep,$vues; - require($rep.$vues['acceuil']); + require($rep.$vues['acceuil.php']); } public function connection(array $vues_erreur){ @@ -55,7 +59,7 @@ class VisitorController { Validation::clear_string($pwd); Validation::val_connexion($usrname,$pwd,$vues_erreur); - $model = new UserModel(); + $model = new VisiteurModel(); $worked=$model->connexion(); /* $dVue = array ( @@ -71,12 +75,13 @@ class VisitorController { public function inscription(array $vues_erreur){ global $rep,$vues; + require($rep.$vues['inscription']); $usrname=$_POST['login']; $pwd=$_POST['mdp']; Validation::val_connexion($usrname,$pwd,$vues_erreur); - $model = new UserModel(); + $model = new VisiteurModel(); $model->inscription(); } @@ -86,7 +91,7 @@ class VisitorController { $nom=$_POST['nom']; - $model = new ListeModel(); + $model = new VisiteurModel(); $model->creerListe($nom); } @@ -94,7 +99,7 @@ class VisitorController { global $rep, $vues; require($rep.$vues['suppressionListe']); - $model = new ListeModel(); + $model = new VisiteurModel(); $model->supprListe(); } @@ -104,9 +109,39 @@ class VisitorController { $intitule = $_POST['intitule']; - $model = new ListeModel(); + $model = new VisiteurModel(); $model->creerTache(); } + + public function cocherTache(array $vues_erreur){ + global $rep, $vues; + require($rep.$vues['liste']); + + $id = $_POST['idTache']; + + $model = new VisiteurModel(); + $model->cocherTache($id); + } + + public function decocherTache(array $vues_erreur){ + global $rep, $vues; + require($rep.$vues['liste']); + + $id = $_POST['idTache']; + + $model = new VisiteurModel(); + $model->decocherTache($id); + } + + public function supprTache(array $vues_erreur){ + global $rep, $vues; + require($rep.$vues['liste']); + + $id = $_POST['idTache']; + + $model = new VisiteurModel(); + $model->supprTache($id); + } } ?> \ No newline at end of file diff --git a/modeles/.DS_Store b/modeles/.DS_Store new file mode 100644 index 0000000..3effefc Binary files /dev/null and b/modeles/.DS_Store differ diff --git a/modeles/Gateways/ListeGateway.php b/modeles/Gateways/ListeGateway.php index 5d48252..fd7b6f5 100644 --- a/modeles/Gateways/ListeGateway.php +++ b/modeles/Gateways/ListeGateway.php @@ -92,6 +92,22 @@ class ListeGateway { } } + public function decocherTache(int $id){ + if(!empty($id)){ + try{ + $co = $this->co; + + $query = "UPDATE Tache SET isCompleted=false WHERE id=:id"; + + $co->executeQuery($query, array(':id' => array($id, PDO::PARAM_STR))); + } + catch(PDOException $Exception){ + echo 'erreur'; + echo $Exception->getMessage(); + } + } + } + public function creerListe(string $nom, int $idCreator){ try{ $co = $this->co; diff --git a/modeles/Modele/VisiteurModel.php b/modeles/Modele/VisiteurModel.php index 7398b04..0a2ab2d 100644 --- a/modeles/Modele/VisiteurModel.php +++ b/modeles/Modele/VisiteurModel.php @@ -43,6 +43,18 @@ public function creerTache(string $intitule){ $this->get_gtwListe()->creerTache($intitule); } + + public function cocherTache($id){ + $this->get_gtwListe()->completeTache($id); + } + + public function decocherTache($id){ + $this->get_gtwListe()->decocherTache($id); + } + + public function supprTache($id){ + $this->get_gtwListe()->delTache($id); + } } ?> \ No newline at end of file diff --git a/vues/creationListe.php b/vues/creationListe.php new file mode 100644 index 0000000..e69de29 diff --git a/vues/creerTache.php b/vues/creerTache.php new file mode 100644 index 0000000..e69de29 diff --git a/vues/liste.php b/vues/liste.php new file mode 100644 index 0000000..e69de29 diff --git a/vues/suppressionListe.php b/vues/suppressionListe.php new file mode 100644 index 0000000..e69de29