|
|
@ -15,27 +15,40 @@ class TaskGateway
|
|
|
|
// functions
|
|
|
|
// functions
|
|
|
|
// code de retour pour les fonctions i,u,d?
|
|
|
|
// code de retour pour les fonctions i,u,d?
|
|
|
|
public function insert(Task $t){
|
|
|
|
public function insert(Task $t){
|
|
|
|
$query='INSERT INTO Tache VALUES (:id,:titre,:descript,NULL,NULL,:priorite)';
|
|
|
|
$query='INSERT INTO Tache VALUES (:id,:titre,:descript,NULL,NULL,:priorite,:idList)';
|
|
|
|
|
|
|
|
|
|
|
|
$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),
|
|
|
|
':priorite'=> array($t->get_priorite(),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($id_task){
|
|
|
|
public function update($id,$element, $valeur){
|
|
|
|
// update a task
|
|
|
|
$query='UPDATE Tache SET '.$element.'=:'.$element.' WHERE id=:id';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$this->con->executeQuery($query, array(
|
|
|
|
|
|
|
|
':id'=>array($id,PDO::PARAM_STR),
|
|
|
|
|
|
|
|
':'.$element =>array($valeur,PDO::PARAM_STR)));
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
|
|
|
element é o attributo da classe, valaeur é oque queremos botar
|
|
|
|
|
|
|
|
*/
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public function delete($id_task){
|
|
|
|
public function delete($id){
|
|
|
|
// delete a task
|
|
|
|
$query='DELETE FROM Tache WHERE id = :id';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$this->con->executeQuery($query, array(
|
|
|
|
|
|
|
|
':id'=>array($id,PDO::PARAM_STR)));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
# comment ça marche ?
|
|
|
|
# comment ça marche ?
|
|
|
|
public function Find($element, $valeur){
|
|
|
|
public function Find($element, $valeur){
|
|
|
|
// Find a task by multiple elements
|
|
|
|
|
|
|
|
// returns the array of found tasks
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
?>
|
|
|
|
?>
|
|
|
|