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/controller/VisitorCtrl.php b/controller/VisitorCtrl.php index 6951be5..93cca68 100644 --- a/controller/VisitorCtrl.php +++ b/controller/VisitorCtrl.php @@ -120,9 +120,12 @@ class VisitorCtrl function connection(){ $isCo = $this->userModel->connexion($_POST['username'],$_POST['password']); - if(!$isCo) + if(!$isCo){ $TMessage[] = 'This user does not exist'; require($this->TabVues["erreur"]); - $this->loadHome(); + $this->loadHome(); + } + else + $this->loadHome(); } function go_register(){ diff --git a/dal/TaskGateway.php b/dal/TaskGateway.php index 30a880c..6e3e8c3 100644 --- a/dal/TaskGateway.php +++ b/dal/TaskGateway.php @@ -17,18 +17,23 @@ class TaskGateway // code de retour pour les fonctions i,u,d? public function insertT(Task $t){ $query='INSERT INTO Tache VALUES (:id,:titre,:descript,:dateDeb,:dateFin,:priorite,:idList,false)'; + if($t->get_dateDeb() == null) + $dateDeb = NULL; + else + $dateDeb = $t->get_dateDeb(); + if($t->get_dateFin() == null) + $dateFin = NULL; + else + $dateFin = $t->get_dateFin(); + $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), + ':dateDeb'=> array($dateDeb,PDO::PARAM_STR), + ':dateFin'=> array($dateFin,PDO::PARAM_STR), ':priorite'=> array($t->get_priorite(),PDO::PARAM_STR), ':idList'=> array($t->get_idList(),PDO::PARAM_STR) )); - - /*Comment gerer les erreurs? - * si valeur existe deja - */ } public function update($table,$id,$element, $valeur){ 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); diff --git a/view/newList.php b/view/newList.php index 423a963..a862a05 100644 --- a/view/newList.php +++ b/view/newList.php @@ -58,7 +58,7 @@