task date saved

action&exception
Anna BOUDOUL 2 years ago
parent 682cc8abd0
commit 549a68e30f

@ -10,7 +10,7 @@
private string $idlist; // # id associating task to list private string $idlist; // # id associating task to list
private bool $isDone; // # si la tache est complete 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 # if id = 0, on veut donc creer une nouvelle tache
# qui n'est pas encore dans la base de donnée et donc # qui n'est pas encore dans la base de donnée et donc
# le id sera fait avec le auto increment # le id sera fait avec le auto increment

@ -16,12 +16,13 @@ class TaskGateway
// functions // functions
// code de retour pour les fonctions i,u,d? // code de retour pour les fonctions i,u,d?
public function insertT(Task $t){ 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( $this->con->executeQuery($query, array(
':id'=> array($t->get_id(),PDO::PARAM_STR), ':id'=> array($t->get_id(),PDO::PARAM_STR),
':titre'=> array($t->get_titre(),PDO::PARAM_STR), ':titre'=> array($t->get_titre(),PDO::PARAM_STR),
':descript'=> array($t->get_description(),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), ':priorite'=> array($t->get_priorite(),PDO::PARAM_STR),
':idList'=> array($t->get_idList(),PDO::PARAM_STR) )); ':idList'=> array($t->get_idList(),PDO::PARAM_STR) ));

@ -13,7 +13,7 @@ class TaskModel
$this->gtw= new TaskGateway($con); $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); $t = new Task($titre,$desc,$priorite,$idList,$dateDeb,$dateFin,$isDone,$id);
$this->gtw->insertT($t); $this->gtw->insertT($t);

Loading…
Cancel
Save