From f2d0dd6e549313b6981f24acbfbc57205690370b Mon Sep 17 00:00:00 2001 From: Emre KARTAL Date: Tue, 29 Nov 2022 22:54:53 +0100 Subject: [PATCH] =?UTF-8?q?J=20ai=20fait=20le=20UserGateway=20(possible=20?= =?UTF-8?q?qu=20il=20lui=20manque=20des=20m=C3=A9thodes),=20la=20classe=20?= =?UTF-8?q?TacheGateway=20est=20=C3=A0=20refaire(je=20peut=20le=20faire),?= =?UTF-8?q?=20les=20probl=C3=A8mes=20que=20je=20rencontre=20sont=20:Faut-i?= =?UTF-8?q?l=20l=20attribut=20id=20dans=20les=20classe,=20l=20attribut=20m?= =?UTF-8?q?ot=20de=20passe=20pour=20l=20utilisateur=20comment=20hasher=20e?= =?UTF-8?q?t=20dehasher=20le=20mdp=20et=20comme=20faire=20le=20frontContro?= =?UTF-8?q?ller!=20Du=20coup=20je=20poserais=20des=20question=20aux=20prof?= =?UTF-8?q?s!=20(Si=20t=20tout=20lu=20t=20un=20goat)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Logo.png | Bin README.md | 0 doc/{ => BDD}/Mld.drawio | 0 doc/{ => BDD}/Mld.png | Bin src/Modele/Tache.php | 30 ++++++++++++--- src/Modele/TacheGateway.php | 9 ++--- src/Modele/Utilisateur.php | 60 +++++++++++++++++++++++++----- src/Modele/UtilisateurGateway.php | 24 ++++++++++++ src/Vue/html/login.html | 1 - src/Vue/html/profilARefaire.html | 3 ++ 10 files changed, 106 insertions(+), 21 deletions(-) mode change 100644 => 100755 Logo.png mode change 100644 => 100755 README.md rename doc/{ => BDD}/Mld.drawio (100%) rename doc/{ => BDD}/Mld.png (100%) diff --git a/Logo.png b/Logo.png old mode 100644 new mode 100755 diff --git a/README.md b/README.md old mode 100644 new mode 100755 diff --git a/doc/Mld.drawio b/doc/BDD/Mld.drawio similarity index 100% rename from doc/Mld.drawio rename to doc/BDD/Mld.drawio diff --git a/doc/Mld.png b/doc/BDD/Mld.png similarity index 100% rename from doc/Mld.png rename to doc/BDD/Mld.png diff --git a/src/Modele/Tache.php b/src/Modele/Tache.php index 213ba47..77ad0e4 100644 --- a/src/Modele/Tache.php +++ b/src/Modele/Tache.php @@ -4,19 +4,39 @@ namespace modeles; class Tache { - + private string $id; private string $nom; private string $description; private Date $dateCreation; private bool $estValide; - private Utilisateur $createur; - private int $id; - public function __construct(String $nom, string $description, Date $dateCreation,Utilisateur $createur, int $id){ + public function __construct(string $id, string $nom, string $description, Date $dateCreation){ + $this->id = $id; $this->nom = $nom; $this->description = $description; $this->dateCreation = $dateCreation; $this->estValide = false; - $this->createur = $createur; } + //Nom + public function getNom(){ + return $this->nom; + } + + //Description + public function getDescription(){ + return $this->description; + } + + //DateCreation + public function getDateCreation(){ + return $this->dateCreation; + } + + //EstValide + public function getEstValide(){ + return $this->estValide; + } + + +} diff --git a/src/Modele/TacheGateway.php b/src/Modele/TacheGateway.php index 4cb9bca..56b40b0 100644 --- a/src/Modele/TacheGateway.php +++ b/src/Modele/TacheGateway.php @@ -1,14 +1,11 @@ con=$con; } - public Tache function Ajouter($nom, $description, Date $dateCreation, Utilisateur $createur){ + public function Ajouter($nom, $description, Date $dateCreation, Utilisateur $createur){ $query='INSERT INTO Tache VALUES($nom, $description, dateCreation, $createur)'; } @@ -20,8 +17,8 @@ class TacheGateway{ public function Supprimer(Tache $tache){ - $query='DELETE FROM Tache WHERE utilisateur=:utilisateur AND nom=:nom AND id=:id'; - $this->con->executeQuery($query, array('utilisateur' => array($tache->createur, PDO::PARAM_INT),'nom' => array($tache->nom, PDO::PARAM_STRING), 'id' => array($tache->id, PDO::PARAM_INT))); + $query='DELETE FROM Tache WHERE utilisateur=:utilisateur AND nom=:nom'; + $this->con->executeQuery($query, array('utilisateur' => array($tache->createur, PDO::PARAM_INT),'nom' => array($tache->nom, PDO::PARAM_STRING))); } } ?> \ No newline at end of file diff --git a/src/Modele/Utilisateur.php b/src/Modele/Utilisateur.php index 7a5a3c8..3f0c917 100644 --- a/src/Modele/Utilisateur.php +++ b/src/Modele/Utilisateur.php @@ -4,22 +4,64 @@ namespace modeles; class Utilisateur { - private int $id; + private string $id; private string $nom; private string $prenom; - private string $pseudo + private string $pseudo; private string $email; - private string $motDePasse; - private bool $isAdmin; - public function __construct(string $nom, string $prenom, string $pseudo, string $email,string $motDePasse, bool $isAdmin, int $id){ - $this->nom = $nom; + public function __construct(string $id, string $nom, string $prenom, string $pseudo, string $email,string $motDePasse, bool $isAdmin){ + $this->id = $id; + $this->nom = $nom; $this->prenom = $prenom; $this->pseudo = $pseudo; $this->email = $email; - $this->motDePasse = $motDePasse; - $this->isAdmin = $isAdmin; - $this->id = id; } + + //Nom + public function getId(){ + return $this->id; + } + + public function setId(string $id){ + $this->nom = $id; + } + + //Nom + public function getNom(){ + return $this->nom; + } + + public function setNom(string $nom){ + $this->nom = $nom; + } + + //Prenom + public function getPrenom(){ + return $this->prenom; + } + + public function setPrenom(string $prenom){ + $this->prenom = $prenom; + } + + //Pseudo + public function getPseudo(){ + return $this->pseudo; + } + + public function setPseudo(string $pseudo){ + $this->pseudo = $pseudo; + } + + //mail + public function getMail(){ + return $this->email; + } + + public function setEmail(string $email){ + $this->email = $email; + } + } ?> diff --git a/src/Modele/UtilisateurGateway.php b/src/Modele/UtilisateurGateway.php index e69de29..7e708fc 100644 --- a/src/Modele/UtilisateurGateway.php +++ b/src/Modele/UtilisateurGateway.php @@ -0,0 +1,24 @@ +con=$con; + } + + public function CreerUtilisateur(string $nom,string $prenom, string $pseudo, string $email, string $mdp){ + $query='INSERT INTO ToDoList_Utilisateur(nom,prenom,pseudo,email,motDePasse) values (:nom,:prenom,:pseudo,:email,:mdp);'; + $this->con->executeQuery($query, array( + 'nom' => array($nom, PDO::PARAM_STRING), + 'prenom' => array($prenom, PDO::PARAM_STRING), + 'pseudo' => array($pseudo, PDO::PARAM_STRING), + 'email' => array($email, PDO::PARAM_STRING), + 'mdp' => array($mdp, PDO::PARAM_STRING))); + } + + public function Supprimer(Utilisateur $user){ + $query='DELETE FROM ToDoList_Utilisateur WHERE id=:id;'; + $this->con->executeQuery($query, array( + 'id' => array($user->getNom(), PDO::PARAM_STRING))); + } +} +?> \ No newline at end of file diff --git a/src/Vue/html/login.html b/src/Vue/html/login.html index 0f0de4b..7125ac2 100644 --- a/src/Vue/html/login.html +++ b/src/Vue/html/login.html @@ -6,7 +6,6 @@ Login Page - diff --git a/src/Vue/html/profilARefaire.html b/src/Vue/html/profilARefaire.html index 77d4d70..abc8b90 100644 --- a/src/Vue/html/profilARefaire.html +++ b/src/Vue/html/profilARefaire.html @@ -73,6 +73,9 @@
+
+ +
\ No newline at end of file