diff --git a/controller/UserCtrl.php b/controller/UserCtrl.php
index 40be171..1dfa5c6 100644
--- a/controller/UserCtrl.php
+++ b/controller/UserCtrl.php
@@ -1,56 +1,63 @@
con = $con;
- $this->usrmodel = new UserModel($this->con);
- try{
- $action=$_REQUEST['action'];
- switch($action){
+ $this->userModel = new UserModel($this->con);
+ $this->taskModel = new TaskModel($this->con);
+ // try{
+ // $action=$_REQUEST['action'];
+ // switch($action){
- // voir les listes privees
- case 'voir_liste_priv':
- $this->loadListePriv();
- break;
+ // // voir les listes privees
+ // case 'voirListePriv':
+ // $this->loadListePriv();
+ // break;
- // ajouter une liste privee
- case 'creer_liste_priv':
- $this->newListPrivate();
- break;
- case 'deconnexion':
- $this->deconnexion();
- break;
+ // // ajouter une liste privee
+ // case 'creerListePriv':
+ // $this->newListPrivate();
+ // break;
+ // case 'deconnecter':
+ // $this->deconnexion();
+ // break;
- }
- } catch(Exception $e) {
- require("../view/erreur.php");
- }
+ // }
+ // } catch(Exception $e) {
+ // require("../view/erreur.php");
+ // }
}
public function loadListePriv(){
$name = "Liste privée";
- $taskmdl = new TaskModel($this->con);
- $TabTask = $taskmdl->loadPublicLists();
- var_dump($TabTask);
// $TabList[] = new ListTask(0, "Projet PHP");
// $TabList[] = new ListTask(1, "Projet Blazor");
- $TabListPriv = $this->taskmodel->loadPrivateLists($user);
+ $TabList = $this->taskModel->loadPrivateLists($_SESSION['login']);
require("../view/liste.php");
}
public function newListPrivate(){
$nom=$_POST['listeNom'];
- insertL(new ListTask(0, $nom, $_SESSION['login']));
- require("../view/liste.php");
+ // $nom = "New List";
+ $this->taskModel->addList($nom,$_SESSION['login']);
+ }
+
+ function loadHome(){
+ $user = false;
+ $public_lists = $this->taskModel->loadPublicLists();
+ require("../view/home.php");
}
public function deconnexion(){
- $usrmodel->deconnexion();
-
+ $usrModel->deconnexion();
+ loadHome();
}
}
?>
diff --git a/controller/VisitorCtrl.php b/controller/VisitorCtrl.php
index 8807105..a4545dd 100644
--- a/controller/VisitorCtrl.php
+++ b/controller/VisitorCtrl.php
@@ -74,7 +74,7 @@ class VisitorCtrl
}
function loadHome(){
- $public_lists = $this->taskModel.loadPublicList();
+ $public_lists = $this->taskModel->loadPublicLists();
require("../view/home.php");
}
diff --git a/dal/TaskGateway.php b/dal/TaskGateway.php
index 4db8f33..072cd6c 100644
--- a/dal/TaskGateway.php
+++ b/dal/TaskGateway.php
@@ -72,13 +72,8 @@ class TaskGateway
$results=$this->con->getResults();
foreach($results as $row)
{
-<<<<<<< HEAD
- $tabResult[]=new Task($row['id'],$row['titre'],$row['description'],$row['priorite'],
- $row['idList'],$row['dateDebut'],$row['dateFin'],$row['isDone']);
-=======
$tabTaches[]=new Task($row['titre'],$row['description'],$row['priorite'],
$row['idList'],$row['dateDebut'],$row['dateFin'],$row['isDone'],$row['id']);
->>>>>>> 55a7b525b1da9fc9a167f6044dbe963c2f3dde57
}
return $tabResult;
@@ -98,11 +93,7 @@ class TaskGateway
$results=$this->con->getResults();
foreach($results as $row)
{
-<<<<<<< HEAD
- $tabResult[]=new ListTask($row['id'],$row['nom'],$row['user'],$row['dc']);
-=======
$tabList[]=new ListTask($row['nom'],$row['user'],$row['dc'],$row['id']);
->>>>>>> 55a7b525b1da9fc9a167f6044dbe963c2f3dde57
}
return $tabResult;
}
@@ -131,7 +122,7 @@ class TaskGateway
$this->con->executeQuery($query, array(
':user' => array($user,PDO::PARAM_STR)
));
-
+ $tabLists = array();
$results = $this->con->getResults();
foreach($results as $row){
$tabLists[]= new ListTask($row[1],$row[2],$row[3],$row[0]);
@@ -161,6 +152,7 @@ class TaskGateway
$query='SELECT * from uList where user is NULL';
$this->con->executeQuery($query);
+ $tabLists = array();
$results = $this->con->getResults();
foreach($results as $row){
$tabLists[]= new ListTask($row[1],$row[2],$row[3],$row[0]);
diff --git a/index.php b/index.php
index efbdd90..08ca4c4 100644
--- a/index.php
+++ b/index.php
@@ -1,8 +1,9 @@
diff --git a/tests/test.php b/tests/test.php
index e1b780d..8162c46 100644
--- a/tests/test.php
+++ b/tests/test.php
@@ -12,11 +12,7 @@ require_once("../controller/VisitorCtrl.php");
# connection
include("credentials.php");
-<<<<<<< HEAD
$con = new Connection('mysql:host=localhost;dbname=dbanboudoul', 'anboudoul', 'mdpMYSQL');
-=======
-$con = new Connection('mysql:host=localhost;dbname=phpproject', 'nifranco', 'achanger');
->>>>>>> 55a7b525b1da9fc9a167f6044dbe963c2f3dde57
# gateway
// $t = new Task(3,'richarlison voltar pro flu','desc.','urgent','0');
@@ -29,13 +25,12 @@ $con = new Connection('mysql:host=localhost;dbname=phpproject', 'nifranco', 'ach
// }
# test find
-/*$tasks=$tgt->find('idList','001');
-foreach($tasks as $i)
- echo $i->get_id()."
"; */
+// $tasks=$tgt->find('idList','001');
+// foreach($tasks as $i)
+// echo $i->get_id()."
";
-<<<<<<< HEAD
# Test du modele Tache
-$mt= new TaskModel($con);
+// $mt= new TaskModel($con);
//$mt->addTask('3','testIsDone','desc.','urgent','001');
//$mt->modifTask('3','isDone','1');
//$tasks = $mt->getTaskBy('titre','tache1');
@@ -43,13 +38,11 @@ $mt= new TaskModel($con);
// foreach($tasks as $i)
// echo $i->get_id()."
";
-# Test LOAD PRIVATE TASKS
-// $mt= new TaskModel($con);
-=======
# Test LOAD PRIVATE TASKS
$mt= new TaskModel($con);
-$mt->addList('private','nifranco');
->>>>>>> 55a7b525b1da9fc9a167f6044dbe963c2f3dde57
+# Test LOAD PRIVATE TASKS
+// $mt= new TaskModel($con);
+// $mt->addList('private','nifranco');
// $lists = $mt->loadPublicLists();
// foreach($lists as $l){
@@ -59,7 +52,6 @@ $mt->addList('private','nifranco');
// echo $t->get_id()."
";
// }
// }
-<<<<<<< HEAD
// //$tasks = $mt->getTaskBy('titre','tache1');
// $tasks = $mt->getAllTask();
// foreach($tasks as $i)
@@ -67,14 +59,12 @@ $mt->addList('private','nifranco');
// $tasks = $mt->loadPublicLists();
// foreach($tasks as $i)
// echo $i->get_id()."
";
-=======
->>>>>>> 55a7b525b1da9fc9a167f6044dbe963c2f3dde57
// $mt->addList('002','todo2','nifranco');
// $mt->modifList('2','nom','22do');
//mt->supList('2');
-$public_lists = $mt->loadPrivateLists('nifranco');
-$user = true;
+// $public_lists = $mt->loadPrivateLists('nifranco');
+// $user = true;
//require("../view/home.php");
//require("../view/register.php");
//require("../view/connection.php");
@@ -104,16 +94,23 @@ $mdl = new UserModel($con);
// $mdl->supprimer('Aeryn');
$mdl->connexion('Aeryn', 'wtfmec');
-// $usrctrl = new UserCtrl($con);
-// // $usrctrl->loadListePriv();
-// $usrctrl->loadListePriv();
+$mt->addList("Test Liste");
+$mt->addList("Liste publique");
+$mt->addList("Liste privée", "Aeryn");
+$mt->addList("Projet de PHP", "Aeryn");
+$mt->addList("Projet Blazor", "Aeryn");
+$mt->addList("Projet de PHP", "RicharlisonR9");
+$mt->addList("Projet Blazor", "RicharlisonR9");
+
+// TEST USER CONTROLLER
+
+
+session_start();
+$_SESSION['login'] = 'RicharlisonR9';
+$usrctrl = new UserCtrl($con);
+$usrctrl->loadHome();
+
-// $mt->addList(0, "Test Liste");
-// // $mt->addList(1, "Liste privée", "Aeryn");
-// $mt->addList(2, "Projet de PHP", "Aeryn");
-// $mt->addList(3, "Projet Blazor", "Aeryn");
-// $mt->addList(4, "Projet de PHP", "RicharlisonR9");
-// $mt->addList(5, "Projet Blazor", "RicharlisonR9");
?>