diff --git a/src/Controller/Controleur.php b/src/Controller/Controleur.php
index eae59aa..4f8e905 100755
--- a/src/Controller/Controleur.php
+++ b/src/Controller/Controleur.php
@@ -23,27 +23,31 @@ $action=NULL;
switch($action) {
-//pas d'action, on réinitialise 1er appel
-case NULL:
- $this->Reinit();
- break;
+ //pas d'action, on réinitialise 1er appel
+ case NULL:
+ $this->Reinit();
+ break;
-case "validationFormulaire":
- $this->ValidationFormulaire($dVueEreur);
- break;
+ case "validationFormulaire":
+ $this->ValidationFormulaire($dVueEreur);
+ break;
-case "redirectionLogin":
- $this->redirectionLogin($dVueEreur);
- break;
+ case "redirectionLogin":
+ $this->redirectionLogin($dVueEreur);
+ break;
-case "redirectionInscription":
- $this->redirectionInscription($dVueEreur);
- break;
+ case "redirectionInscription":
+ $this->redirectionInscription($dVueEreur);
+ break;
-case "seConnecter":
- $this->seConnecter($dVueEreur);
- break;
+ case "seConnecter":
+ $this->seConnecter($dVueEreur);
+ break;
+
+ case "ConsulterListe":
+ $this->ConsulterListe();
+ break;
//mauvaise action
default:
@@ -123,6 +127,18 @@ function seConnecter(array $dVueEreur) {
require ($rep.$vues['login']);
}
+function ConsulterListe(){
+ global $rep,$vues;
+ $con=new Connection("mysql:host=localhost;dbname=dbrahassou","rahassou","achanger");
+ $model = new ListeGateway($con);
+ $results=array();
+ $results=$model->getListePublic(0,10);
+ $dVue = array (
+ 'results' => $results
+ );
+ require ($rep.$vues['listeVue']);
+ }
+
}//fin class
diff --git a/src/Modele/Liste.php b/src/Modele/Liste.php
new file mode 100644
index 0000000..b7b5856
--- /dev/null
+++ b/src/Modele/Liste.php
@@ -0,0 +1,47 @@
+id = $id;
+ $this->nom = $nom;
+ $this->description = $description;
+ $this->dateCreation = $dateCreation;
+ $this->estValide = false;
+ $this->liste = $liste;
+ }
+
+ //Nom
+ public function getNom(){
+ return $this->nom;
+ }
+
+ //Id
+ public function getid(){
+ return $this->id;
+ }
+
+ //DateCreation
+ public function getDateCreation(){
+ return $this->dateCreation;
+ }
+
+ //EstValide
+ public function getEstValide(){
+ return $this->estValide;
+ }
+
+ public function getListe(){
+ return $this->liste;
+ }
+
+
+}
diff --git a/src/Modele/ListeGateway.php b/src/Modele/ListeGateway.php
new file mode 100644
index 0000000..92de164
--- /dev/null
+++ b/src/Modele/ListeGateway.php
@@ -0,0 +1,50 @@
+con=$con;
+ }
+
+ 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 Editer(Liste $Liste, string $nom,){
+ $query='UPDATE ToDoListe_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 Supprimer(Liste $liste){
+ $query='DELETE FROM ToDoListe_Liste WHERE id=:id';
+ $this->con->executeQuery($query,'id' => array($liste->id, PDO::PARAM_STRING)));
+ }
+
+ public function getListe(int $offset, int $limit){
+ $query = "SELECT * FROM ToDoListe_Liste LIMITS $offset,$limit";
+ $this->con->executeQuery($query);
+ $results=$this->con->getResults();
+ return $results;
+ }
+
+ public function getTacheListe(Liste $liste){
+ $query = 'SELECT tache FROM ToDoListe_Liste WHERE id=:id ';
+ $this->con->executeQuery($query, array('id' => array($liste->getId, PDO::PARAM_INT)));
+ $results=$this->con->getResults();
+ return $results;
+ }
+
+ public function getListePublic($offset,$limit){
+ $query = "SELECT * FROM ToDoListe_Liste AND isPublic LIMITS $offset,$limit";
+ $this->con->executeQuery($query);
+ $results=$this->con->getResults();
+ return $results;
+ }
+}
+?>
\ No newline at end of file
diff --git a/src/Modele/Tache.php b/src/Modele/Tache.php
index 77ad0e4..3a76aba 100644
--- a/src/Modele/Tache.php
+++ b/src/Modele/Tache.php
@@ -23,6 +23,11 @@ class Tache
return $this->nom;
}
+ //Id
+ public function getid(){
+ return $this->id;
+ }
+
//Description
public function getDescription(){
return $this->description;
diff --git a/src/Modele/TacheGateway.php b/src/Modele/TacheGateway.php
index 56b40b0..4a9ad67 100644
--- a/src/Modele/TacheGateway.php
+++ b/src/Modele/TacheGateway.php
@@ -5,20 +5,23 @@ class TacheGateway{
$this->con=$con;
}
- public function Ajouter($nom, $description, Date $dateCreation, Utilisateur $createur){
- $query='INSERT INTO Tache VALUES($nom, $description, dateCreation, $createur)';
-
+ 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 Editer(Tache $tache, string $nom, string $description){
- $query='UPDATE Tache SET :nom=$nom, :description=$description';
- $this->con->executeQuery($query, array('nom' => array($tache->nom, PDO::PARAM_STRING)), array('description' => array($tache->description, PDO::PARAM_STRING)));
+ $query='UPDATE ToDoListe_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 Supprimer(Tache $tache){
- $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)));
+ $query='DELETE FROM ToDoList_Tache WHERE id=:id';
+ $this->con->executeQuery($query,'id' => array($tache->getId(), PDO::PARAM_STRING)));
}
}
?>
\ No newline at end of file
diff --git a/src/Vue/html/ListeVue.php b/src/Vue/html/ListeVue.php
new file mode 100644
index 0000000..25a90a4
--- /dev/null
+++ b/src/Vue/html/ListeVue.php
@@ -0,0 +1,9 @@
+getNom();
+ echo ("
");
+ print $row->getDateCreation();
+ echo ("
");
+ }
+?>
diff --git a/src/Vue/html/index.html b/src/Vue/html/index.html
index de9dd8d..8a00d74 100644
--- a/src/Vue/html/index.html
+++ b/src/Vue/html/index.html
@@ -32,15 +32,27 @@