From 549a68e30f4f3fd83acd7e6194dd76444d0c57ea Mon Sep 17 00:00:00 2001 From: Anna BOUDOUL Date: Fri, 23 Dec 2022 15:43:18 +0100 Subject: [PATCH] task date saved --- business/Task.php | 2 +- dal/TaskGateway.php | 5 +++-- model/TaskModel.php | 2 +- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/business/Task.php b/business/Task.php index cdea1fb..bb84679 100644 --- a/business/Task.php +++ b/business/Task.php @@ -10,7 +10,7 @@ private string $idlist; // # id associating task to list private bool $isDone; // # si la tache est complete - function __construct($titre,$description,$priorite,$idl,$dateDeb="",$dateFin="",$isDone=false,$id=0) { + function __construct($titre,$description,$priorite,$idl,$dateDeb=null,$dateFin=null,$isDone=false,$id=0) { # if id = 0, on veut donc creer une nouvelle tache # qui n'est pas encore dans la base de donnée et donc # le id sera fait avec le auto increment diff --git a/dal/TaskGateway.php b/dal/TaskGateway.php index b1e4249..30a880c 100644 --- a/dal/TaskGateway.php +++ b/dal/TaskGateway.php @@ -16,12 +16,13 @@ class TaskGateway // functions // code de retour pour les fonctions i,u,d? public function insertT(Task $t){ - $query='INSERT INTO Tache VALUES (:id,:titre,:descript,NULL,NULL,:priorite,:idList,false)'; - + $query='INSERT INTO Tache VALUES (:id,:titre,:descript,:dateDeb,:dateFin,:priorite,:idList,false)'; $this->con->executeQuery($query, array( ':id'=> array($t->get_id(),PDO::PARAM_STR), ':titre'=> array($t->get_titre(),PDO::PARAM_STR), ':descript'=> array($t->get_description(),PDO::PARAM_STR), + ':dateDeb'=> array($t->get_dateDeb(),PDO::PARAM_STR), + ':dateFin'=> array($t->get_dateFin(),PDO::PARAM_STR), ':priorite'=> array($t->get_priorite(),PDO::PARAM_STR), ':idList'=> array($t->get_idList(),PDO::PARAM_STR) )); diff --git a/model/TaskModel.php b/model/TaskModel.php index 1a63606..748a3c5 100644 --- a/model/TaskModel.php +++ b/model/TaskModel.php @@ -13,7 +13,7 @@ class TaskModel $this->gtw= new TaskGateway($con); } - public function addTask($titre,$desc,$priorite,$idList,$dateDeb="",$dateFin="",$isDone=false,$id=0) + public function addTask($titre,$desc,$priorite,$idList,$dateDeb=null,$dateFin=null,$isDone=false,$id=0) { $t = new Task($titre,$desc,$priorite,$idList,$dateDeb,$dateFin,$isDone,$id); $this->gtw->insertT($t);