You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
67 lines
1.5 KiB
67 lines
1.5 KiB
<?php
|
|
include_once("../dal/TaskGateway.php");
|
|
include_once("../business/Task.php");
|
|
|
|
class TaskModel
|
|
{
|
|
public Connection $con;
|
|
public TaskGateway $gtw;
|
|
|
|
public function __construct(Connection $con)
|
|
{
|
|
$this->con=$con;
|
|
$this->gtw= new TaskGateway($con);
|
|
}
|
|
|
|
public function addTask($id,$titre,$desc,$priorite,$idList,$dateDeb="",$dateFin="",$isDone=false)
|
|
{
|
|
$t = new Task($id,$titre,$desc,$priorite,$idList,$dateDeb,$dateFin,$isDone);
|
|
$this->gtw->insertT($t);
|
|
// retourne quoi? con->lastInsertId() ??
|
|
}
|
|
|
|
public function supTask($id)
|
|
{
|
|
$this->gtw->delete('task',$id);
|
|
}
|
|
|
|
public function modifTask($id,$element,$valeur)
|
|
{
|
|
$this->gtw->update('task',$id,$element,$valeur);
|
|
}
|
|
|
|
public function getAllTask()
|
|
{
|
|
return $this->gtw->find('task');
|
|
}
|
|
|
|
public function getTaskBy($element,$valeur)
|
|
{
|
|
return $this->gtw->find('task',$element,$valeur);
|
|
}
|
|
|
|
/* LIST FUNCTIONS */
|
|
public function addList($id,$nom,$owner="",$dc=0)
|
|
{
|
|
$l = new ListTask($id,$nom,$owner="",$dc=0);
|
|
$this->gtw->insertL($l);
|
|
// retourne quoi? con->lastInsertId() ??
|
|
}
|
|
|
|
public function modifList($id,$element,$valeur)
|
|
{
|
|
$this->gtw->update('list',$id,$element,$valeur);
|
|
}
|
|
|
|
public function supList($id)
|
|
{
|
|
$this->gtw->delete('list',$id);
|
|
}
|
|
|
|
function loadPublicLists()
|
|
{
|
|
return $this->gtw->find('list','user','NULL');
|
|
}
|
|
}
|
|
?>
|