diff --git a/.gitignore b/.gitignore old mode 100644 new mode 100755 diff --git a/dbemkartal1.sql b/dbemkartal1.sql old mode 100644 new mode 100755 diff --git a/doc/BDD/Mld.drawio b/doc/BDD/Mld.drawio old mode 100644 new mode 100755 diff --git a/doc/BDD/Mld.png b/doc/BDD/Mld.png old mode 100644 new mode 100755 diff --git a/doc/Diagramme De Cas D'utilisation/DDCD.drawio b/doc/Diagramme De Cas D'utilisation/DDCD.drawio old mode 100644 new mode 100755 diff --git a/doc/Diagrammes/DiagrammeClasse.drawio b/doc/Diagrammes/DiagrammeClasse.drawio old mode 100644 new mode 100755 diff --git a/doc/Diagrammes/DiagrammeClasse.png b/doc/Diagrammes/DiagrammeClasse.png old mode 100644 new mode 100755 diff --git a/src/.htaccess b/src/.htaccess old mode 100644 new mode 100755 diff --git a/src/config/.DS_Store b/src/config/.DS_Store old mode 100644 new mode 100755 diff --git a/src/config/Connection.php b/src/config/Connection.php old mode 100644 new mode 100755 diff --git a/src/config/Validation.php b/src/config/Validation.php index ee64e31..c38f0de 100755 --- a/src/config/Validation.php +++ b/src/config/Validation.php @@ -46,6 +46,7 @@ class Validation { } + static function cleanString(string &$str) { $str = preg_replace('/[^A-Za-z\-]/', '', $str); if($str == null || $str == '') @@ -64,6 +65,31 @@ class Validation { return $str; } + static function val_form_add(string &$nom,string &$description,&$dVueEreur) { + $nom = Validation::cleanText($nom); + if ($nom == NULL) { + $dVueEreur['nom'] = "Veuillez entrer un nom*"; + } + $description = Validation::cleanText($description); + if ($description == NULL) { + $dVueEreur['description'] = "Veuillez entrer une description*"; + } + if(count($dVueEreur)>0){ + throw new Exception("Problème lors de l'ajout"); + } + + + } + + static function cleanText(string &$txt) { + $txt = preg_replace('/[^A-Za-z\-\^0-9\ ]/', '', $txt); + if($txt == null || $txt == '') + { + return null; + } + return $txt; + } + static function val_mail(string &$mail) { if(filter_var($mail, FILTER_VALIDATE_EMAIL)) { diff --git a/src/controller/CtrlAdmin.php b/src/controller/CtrlAdmin.php old mode 100644 new mode 100755 diff --git a/src/controller/CtrlUtilisateur.php b/src/controller/CtrlUtilisateur.php old mode 100644 new mode 100755 diff --git a/src/controller/CtrlVisiteur.php b/src/controller/CtrlVisiteur.php old mode 100644 new mode 100755 index a5b1bf1..81f7997 --- a/src/controller/CtrlVisiteur.php +++ b/src/controller/CtrlVisiteur.php @@ -49,6 +49,22 @@ class CtrlVisiteur { $this->SupprimerListe($dVueErreur); break; + case "AjouterTache": + $this->AjouterTache(); + break; + + case "AjouterListePublic": + $this->AjouterListePublic($dVueErreur); + break; + + case "ModifierListe": + $this->ModifierListe(); + break; + + case "check": + $this->check(); + break; + //mauvaise action default: $dVueErreur[] = "Erreur d'appel php"; @@ -146,6 +162,52 @@ class CtrlVisiteur { require ($rep.$vues['listPublic']); } + + public function AjouterTache(){ + global $rep,$vues; + $tache = MdlVisiteur::AjouterTache(); + $listes = MdlVisiteur::RecupererListePublic(); + $taches = MdlVisiteur::RecupererTache(); + $action=NULL; + require ($rep.$vues['listPublic']); + } + + public function AjouterListePublic(array $dVueErreur){ + global $rep,$vues; + + try{ + $tache = MdlVisiteur::AjouterListePublic($dVueErreur); + $this->ConsulterListePublic($dVueErreur); + } + catch (Exception $e) + { + $ErreurLog=$e->getMessage(); + $listes = MdlVisiteur::RecupererListePublic(); + $taches = MdlVisiteur::RecupererTache(); + $action=NULL; + require ($rep.$vues['listPublic']); + } + + } + + public function ModifierListe(){ + global $rep,$vues; + $tache = MdlVisiteur::ModifierListe(); + $listes = MdlVisiteur::RecupererListePublic(); + $taches = MdlVisiteur::RecupererTache(); + $action=NULL; + require ($rep.$vues['listPublic']); + } + + public function check() + { + global $rep,$vues; + $tache = MdlVisiteur::check(); + $listes = MdlVisiteur::RecupererListePublic(); + $taches = MdlVisiteur::RecupererTache(); + $action=NULL; + require ($rep.$vues['listPublic']); + } }//fin class ?> diff --git a/src/controller/FrontControleur.php b/src/controller/FrontControleur.php old mode 100644 new mode 100755 index 2ea2737..d0d446f --- a/src/controller/FrontControleur.php +++ b/src/controller/FrontControleur.php @@ -18,6 +18,7 @@ class FrontControleur { $action = $_REQUEST["action"]; } + //On vérifie si l'action fait partie des listes d'actions $string_actor=FrontControleur::quelListe($action,$listeActions); if($string_actor!=NULL){ diff --git a/src/modele/MdlAdmin.php b/src/modele/MdlAdmin.php old mode 100644 new mode 100755 diff --git a/src/modele/MdlUtilisateur.php b/src/modele/MdlUtilisateur.php old mode 100644 new mode 100755 diff --git a/src/modele/MdlVisiteur.php b/src/modele/MdlVisiteur.php old mode 100644 new mode 100755 index c8c92d3..523f1ec --- a/src/modele/MdlVisiteur.php +++ b/src/modele/MdlVisiteur.php @@ -25,7 +25,7 @@ class MdlVisiteur $userGtw = new TacheGateway(); return $userGtw->getTache(); } - + public static function SupprimerTache(){ $userGtw = new TacheGateway(); $id = $_GET['idTache']; @@ -40,4 +40,43 @@ class MdlVisiteur $userGtw->Supprimer($id); } + public function AjouterTache(){ + $taskGtw = new TacheGateway(); + $id = $_POST['idListe']; + $nom = $_POST['nom-ajout']; + $description = $_POST['description-ajout']; + Validation::val_form_add($nom,$description,$dVueErreur); + $taskGtw->AjouterTache($nom, $description,false,$id); + } + + public function ModifierListe(){ + $userGtw = new ListeGateway(); + $id = $_POST['idListe']; + $nom = $_POST['nom-modif-liste']; + $description = $_POST['description-modif-liste']; + if($description == NULL){ + $userGtw->EditerNom($id, $nom); + } + else if($nom == NULL){ + $userGtw->EditerDescription($id, $description); + } + else{ + $userGtw->Editer($id, $nom, $description); + } + } + + public function AjouterListePublic(&$dVueErreur){ + $taskGtw = new ListeGateway(); + $nom=$_POST['nom-ajout-liste']; + $description=$_POST['description-ajout-liste']; + Validation::val_form_add($nom,$description,$dVueErreur); + $taskGtw->Ajouter($nom, $description,1, true); + } + + public function check(){ + $taskGtw = new TacheGateway(); + $id = $_POST['idTache']; + $taskGtw->isDone($id); + } + } diff --git a/src/modele/gateway/ListeGateway.php b/src/modele/gateway/ListeGateway.php old mode 100644 new mode 100755 index 17752d3..9d98fc1 --- a/src/modele/gateway/ListeGateway.php +++ b/src/modele/gateway/ListeGateway.php @@ -7,21 +7,39 @@ 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)'; - $this->con->executeQuery($query, array('nom' => array($nom, PDO::PARAM_STRING)), - array('dateCreation' => array($dateCreation, PDO::PARAM_STRING)), - array('estValide' => array($estValide, PDO::PARAM_BOOL)), - array('idCreateur' => array($idCreateur, PDO::PARAM_INT)), - array('estPublic' => array($estPublic, PDO::PARAM_INT))); + 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), + 'description' => array($description, PDO::PARAM_STR), + 'estPublic' => array($estPublic, PDO::PARAM_INT), + 'createur' => array($createur, PDO::PARAM_STR), + )); } - public function Editer(Liste $Liste){ - $query='UPDATE ToDoList_Liste SET nom=:nom WHERE id=:id'; - $this->con->executeQuery($query, array('nom' => array($Liste->getNom(), PDO::PARAM_STRING)), array('id' => array($Liste->getId()),PDO::PARAM_INT)); + public function Editer(string $id, string $nom, string $description){ + $query='UPDATE ToDoList_Liste SET nom=:nom AND description=:description WHERE id=:id;'; + $this->con->executeQuery($query, array( + 'nom' => array($nom, PDO::PARAM_STR), + 'id' => array($id,PDO::PARAM_INT), + 'description' => array($description, PDO::PARAM_STR)) + ); } - public function Supprimer(int $id){ + public function EditerNom(string $id, string $nom){ + $query='UPDATE ToDoList_Liste SET nom=:nom WHERE id=:id;'; + +// erreur iciiiiiiii + $this->con->executeQuery($query, array('nom' => array($nom, PDO::PARAM_STR),'id' => array($id, PDO::PARAM_INT))); + + } + + public function EditerDescription(string $id, string $description){ + $query='UPDATE ToDoList_Liste SET description=:description WHERE id=:id;'; + $this->con->executeQuery($query, array('description' => array($description, PDO::PARAM_STR), 'id' => array($id, PDO::PARAM_INT))); + } + + public function Supprimer(string $id){ $query="DELETE FROM ToDoList_Liste WHERE id=:id"; $this->con->executeQuery($query,array('id' => array($id, PDO::PARAM_INT))); } diff --git a/src/modele/gateway/TacheGateway.php b/src/modele/gateway/TacheGateway.php old mode 100644 new mode 100755 index 20a7268..7eeb072 --- a/src/modele/gateway/TacheGateway.php +++ b/src/modele/gateway/TacheGateway.php @@ -6,33 +6,44 @@ class TacheGateway{ $this->con=new Connection($dsn,$user,$pass); } - public function Ajouter(string $nom, string $description, Date $dateCreation, bool $estValide, int $idCreateur){ - $query='INSERT INTO ToDoList_Tache(nom, description, dateCreation,estValide, createur) VALUES(:nom, :description, :dateCreation, :estValide, :idCreateur)'; - $this->con->executeQuery($query, array('nom' => array($nom, PDO::PARAM_STRING)), - array('description' => array($description, PDO::PARAM_STRING)), - array('dateCreation' => array($dateCreation, PDO::PARAM_STRING)), - array('estValide' => array($estValide, PDO::PARAM_BOOL)), - array('idCreateur' => array($idCreateur, PDO::PARAM_INT))); + + public function AjouterTache(string $nom, string $description, bool $estValide, string $idListe){ + $query='INSERT INTO ToDoList_Tache(nom, description, dateCreation,estValide, idListe) VALUES(:nom, :description, CURRENT_DATE, :estValide, :idListe);'; + $this->con->executeQuery($query, array( + 'nom' => array($nom, PDO::PARAM_STR), + 'description' => array($description, PDO::PARAM_STR), + 'estValide' => array($estValide, PDO::PARAM_BOOL), + 'idListe' => array($idListe, PDO::PARAM_INT))); + } + + public function Editer(string $id, string $nom, string $description){ + $query='UPDATE ToDoList_Tache SET nom=:nom, description =:description WHERE id=:id;'; + $this->con->executeQuery($query, array('nom' => array($nom, PDO::PARAM_STR), 'description' => array($description, PDO::PARAM_STR), 'id' => array($id, PDO::PARAM_INT))); } - public function Editer(Tache $tache, string $nom, string $description){ - $query='UPDATE ToDoList_Tache SET nom=:nom, description =:description WHERE id=:id'; - $this->con->executeQuery($query, array('nom' => array($tache->getNom(), PDO::PARAM_STRING)), array('description' => array($tache->getdescription(), PDO::PARAM_STRING)), array('id' => array($tache->getId(),PDO::PARAM_INT))); + public function EditerNom(string $id, string $nom){ + $query='UPDATE ToDoList_Tache SET nom=:nom WHERE id=:id;'; + $this->con->executeQuery($query, array('nom' => array($nom, PDO::PARAM_STR), 'id' => array($id, PDO::PARAM_INT))); + } + + public function EditerDescription(string $id, string $description){ + $query='UPDATE ToDoList_Tache SET description=:description WHERE id=:id;'; + $this->con->executeQuery($query, array('description' => array($description, PDO::PARAM_STR), 'id' => array($id, PDO::PARAM_INT))); } public function Supprimer(string $id){ - $query='DELETE FROM ToDoList_Tache WHERE id=:id'; + $query='DELETE FROM ToDoList_Tache WHERE id=:id;'; $this->con->executeQuery($query,array('id' => array($id, PDO::PARAM_INT))); } // Si une liste est supprimée on supprime toutes ces tâches grâce à cette fonction public function SupprimerViaListe(string $id){ - $query='DELETE FROM ToDoList_Tache WHERE idListe=:id'; + $query='DELETE FROM ToDoList_Tache WHERE idListe=:id;'; $this->con->executeQuery($query,array('id' => array($id, PDO::PARAM_INT))); } public function getTache(){ - $query='SELECT * FROM ToDoList_Tache'; + $query='SELECT * FROM ToDoList_Tache;'; $this->con->executeQuery($query); $taches = []; foreach ($this->con->getResults() as $tache) { @@ -40,5 +51,10 @@ class TacheGateway{ } return $taches; } + + public function isDone(string $id){ + $query = 'UPDATE ToDoList_Tache SET estValide = !estValide WHERE id=:id;'; + $this->con->executeQuery($query, array('id' => array($id, PDO::PARAM_STR))); + } } ?> \ No newline at end of file diff --git a/src/modele/gateway/UtilisateurGateway.php b/src/modele/gateway/UtilisateurGateway.php old mode 100644 new mode 100755 diff --git a/src/modele/metier/Liste.php b/src/modele/metier/Liste.php old mode 100644 new mode 100755 diff --git a/src/modele/metier/Tache.php b/src/modele/metier/Tache.php old mode 100644 new mode 100755 diff --git a/src/modele/metier/Utilisateur.php b/src/modele/metier/Utilisateur.php old mode 100644 new mode 100755 diff --git a/src/vue/Images/Logo.png b/src/vue/Images/Logo.png old mode 100644 new mode 100755 diff --git a/src/vue/Images/LogoForHome.png b/src/vue/Images/LogoForHome.png old mode 100644 new mode 100755 diff --git a/src/vue/Images/c.gif b/src/vue/Images/c.gif new file mode 100755 index 0000000..57b41f2 Binary files /dev/null and b/src/vue/Images/c.gif differ diff --git a/src/vue/Images/check.gif b/src/vue/Images/check.gif new file mode 100755 index 0000000..4ebc7bf Binary files /dev/null and b/src/vue/Images/check.gif differ diff --git a/src/vue/Images/edit.png b/src/vue/Images/edit.png old mode 100644 new mode 100755 diff --git a/src/vue/Images/gif.gif b/src/vue/Images/gif.gif old mode 100644 new mode 100755 diff --git a/src/vue/Images/plus.png b/src/vue/Images/plus.png new file mode 100755 index 0000000..6a22172 Binary files /dev/null and b/src/vue/Images/plus.png differ diff --git a/src/vue/Images/trash.png b/src/vue/Images/trash.png old mode 100644 new mode 100755 diff --git a/src/vue/css/reset.css b/src/vue/css/reset.css old mode 100644 new mode 100755 diff --git a/src/vue/css/style.css b/src/vue/css/style.css old mode 100644 new mode 100755 diff --git a/src/vue/html/NavBar.php b/src/vue/html/NavBar.php old mode 100644 new mode 100755 diff --git a/src/vue/html/PageListePublic.php b/src/vue/html/PageListePublic.php old mode 100644 new mode 100755 index ee8e69b..773485c --- a/src/vue/html/PageListePublic.php +++ b/src/vue/html/PageListePublic.php @@ -1,7 +1,7 @@
- +
= $liste->getNom()?>
@@ -36,23 +86,102 @@
-
= $liste->getDescription()?> -
= $liste->getDateCreation()?>
+= $liste->getDescription()?> +
= $liste->getDateCreation()?>
+