From 561d27f4c9b7b0d9b0071338807ac5145fffb3b9 Mon Sep 17 00:00:00 2001 From: "nicolas.franco" Date: Fri, 23 Dec 2022 15:39:11 +0100 Subject: [PATCH] all private task/list manipulation redirecting to myList instead of Home --- controller/UserCtrl.php | 3 +-- controller/VisitorCtrl.php | 18 ++++++++++++++---- view/newTask.php | 2 +- view/privHome.php | 3 +++ 4 files changed, 19 insertions(+), 7 deletions(-) diff --git a/controller/UserCtrl.php b/controller/UserCtrl.php index 5ae2320..5f5a040 100644 --- a/controller/UserCtrl.php +++ b/controller/UserCtrl.php @@ -28,7 +28,6 @@ class UserCtrl $this->newListPrivate(); break; - case 'deconnecter': $this->deconnexion(); break; @@ -54,7 +53,7 @@ class UserCtrl $this->loadListePriv(); } - function loadHome(){ + public function loadHome(){ $user = false; $public_lists = $this->taskModel->loadPublicLists(); require($this->TabVues["home"]); diff --git a/controller/VisitorCtrl.php b/controller/VisitorCtrl.php index 8105396..4e75f1c 100644 --- a/controller/VisitorCtrl.php +++ b/controller/VisitorCtrl.php @@ -139,24 +139,34 @@ class VisitorCtrl function go_task(){ $user = $this->isUser; if(isset($_POST['listId'])) $_SESSION['listId'] = $_POST['listId']; + if(isset($_POST['isPriv'])) $_SESSION['isPriv'] = $_POST['isPriv']; require("view/newTask.php"); } function addTask(){ - //$titre,$desc,$priorite,$idList,$dateDeb="",$dateFin="",$isDone=false,$id=0 $this->taskModel->addTask($_POST['titreT'],$_POST['descT'], $_POST['prioriteT'],$_SESSION['listId'],$_POST['dateDebT'],$_POST['dateFinT']); - $this->loadHome(); + + if(isset($_SESSION['isPriv']) && $_SESSION['isPriv']) + header("Location:index.php?action=voirListePriv"); + else + $this->loadHome(); } function eraseTask(){ $this->taskModel->supTask($_POST['idT']); - $this->loadHome(); + if($_POST['isPriv']) + header("Location:index.php?action=voirListePriv"); + else + $this->loadHome(); } function isDone(){ $this->taskModel->modifTask($_POST['idT'],'isDone',true); - $this->loadHome(); + if($_POST['isPriv']) + header("Location:index.php?action=voirListePriv"); + else + $this->loadHome(); } } ?> \ No newline at end of file diff --git a/view/newTask.php b/view/newTask.php index 3b52f0f..f009427 100644 --- a/view/newTask.php +++ b/view/newTask.php @@ -18,7 +18,7 @@ New List + My Lists 🔒'; + echo 'My Lists 🔒'; } ?> About diff --git a/view/privHome.php b/view/privHome.php index 781508d..469a23d 100644 --- a/view/privHome.php +++ b/view/privHome.php @@ -61,6 +61,7 @@ + @@ -92,12 +93,14 @@