From 4966402b38580ac19416096f68f5fc3702995cdf Mon Sep 17 00:00:00 2001 From: "nicolas.franco" Date: Fri, 23 Dec 2022 14:56:23 +0100 Subject: [PATCH] fin actions --- config/config.php | 1 + controller/FrontCtrl.php | 2 +- controller/UserCtrl.php | 15 +++-- view/newList.php | 8 +-- view/privHome.php | 130 +++++++++++++++++++++++++++++++++++++++ 5 files changed, 143 insertions(+), 13 deletions(-) create mode 100644 view/privHome.php diff --git a/config/config.php b/config/config.php index 738b56b..d22eb06 100644 --- a/config/config.php +++ b/config/config.php @@ -15,5 +15,6 @@ $TabVues["register"] = "view/register.php"; $TabVues["newList"] = "view/newList.php"; $TabVues["liste"] = "view/liste.php"; + $TabVues["prives"] = "view/privHome.php"; ?> \ No newline at end of file diff --git a/controller/FrontCtrl.php b/controller/FrontCtrl.php index e81ab76..1096771 100644 --- a/controller/FrontCtrl.php +++ b/controller/FrontCtrl.php @@ -13,7 +13,7 @@ class FrontCtrl session_start(); $this->TabVues = $TabVues; $this->usrMdl = new UserModel($con); - $this->action_User = array('deconnecter','loadListePriv','newListPrivate'); + $this->action_User = array('deconnecter','voirListePriv','creerListePriv'); try{ $this->isUser = $this->usrMdl->isConnected(); diff --git a/controller/UserCtrl.php b/controller/UserCtrl.php index 3419cac..5ae2320 100644 --- a/controller/UserCtrl.php +++ b/controller/UserCtrl.php @@ -27,6 +27,8 @@ class UserCtrl case 'creerListePriv': $this->newListPrivate(); break; + + case 'deconnecter': $this->deconnexion(); break; @@ -42,17 +44,14 @@ class UserCtrl } public function loadListePriv(){ - $name = "Liste privée"; - // $TabList[] = new ListTask(0, "Projet PHP"); - // $TabList[] = new ListTask(1, "Projet Blazor"); - $TabList = $this->taskModel->loadPrivateLists($_SESSION['login']); - require($this->TabVues["liste"]); + $user = $_SESSION['login']; + $private_lists = $this->taskModel->loadPrivateLists($user); + require($this->TabVues["prives"]); } public function newListPrivate(){ - $nom=$_POST['listeNom']; - // $nom = "New List"; - $this->taskModel->addList($nom,$_SESSION['login']); + $this->taskModel->addList($_POST['listName'],$_SESSION['login']); + $this->loadListePriv(); } function loadHome(){ diff --git a/view/newList.php b/view/newList.php index 4984108..10a87a4 100644 --- a/view/newList.php +++ b/view/newList.php @@ -62,15 +62,15 @@ - + - - '; + '; } ?> diff --git a/view/privHome.php b/view/privHome.php new file mode 100644 index 0000000..781508d --- /dev/null +++ b/view/privHome.php @@ -0,0 +1,130 @@ + + + + + + + + + + + +
+ + + +
+ + + +
+

My Lists

+ + + Add List ➕ +
'; + } + foreach($private_lists as $l){ + echo ' +
+
+
+
+
+
+ +

'.$l->get_nom().'

+
+ +
+ + + +
+
+ + + + + + + + + '; + # IF NO TASKS, display NO TASKS + if(!empty($l->get_taches())){ + foreach($l->get_taches() as $t){ + if(!$t->get_isDone()){ + echo ' + + + '; + } else { + echo ' + + + '; + } + echo ' + + '; + } + } else { + echo '
No tasks here yet!
'; + } + + echo ' +
TaskImportanceActions
'.$t->get_titre().''.$t->get_priorite().'
'.$t->get_titre().''.$t->get_priorite().' +
+ +
+
+ +
+
+
+
+
+
+
+
'; + } + ?> + +
+
+ + + + + + + +