Thomas Chazot 2 years ago
parent 2163568960
commit 0fc97662f6

@ -33,26 +33,26 @@ class VisitorController {
break; break;
case "supprimerListe": case "supprimerListe":
$this->DelList(); $this->DelList($dVueEreur);
break; break;
case "accessListInfos": case "accessListInfos":
$this->accessListInfos(); $this->accessListInfos($dVueEreur);
break; break;
case "modifierListe": case "modifierListe":
$this->UpdateList(); $this->UpdateList($dVueEreur);
break; break;
case "ajouterTache": case "ajouterTache":
$this->AddTask(); $this->AddTask($dVueEreur);
break; break;
case "supprimerTache": case "supprimerTache":
$this->DelTask(); $this->DelTask($dVueEreur);
break; break;
case "modifierTache": case "modifierTache":
$this->UpdateTask(); $this->UpdateTask($dVueEreur);
break; break;
default: default:

@ -59,6 +59,18 @@ class ListeGateway
return $results; return $results;
} }
public function findById(string $id): array{
$results=[];
if (!empty($id)){
$query = "SELECT * FROM Liste WHERE id=:id";
$this->con->executeQuery($query, array(':id' => array($id, PDO::PARAM_STR)));
$results=$this->con->getResults();
return $results;
}
return $results;
}
public function findByUserId(string $userId): array{ public function findByUserId(string $userId): array{
$query = "SELECT * FROM Liste WHERE idCreator=:idCreator"; $query = "SELECT * FROM Liste WHERE idCreator=:idCreator";
$this->con->executeQuery($query, array(':idCreator' => array($userId, PDO::PARAM_STR))); $this->con->executeQuery($query, array(':idCreator' => array($userId, PDO::PARAM_STR)));

@ -55,6 +55,27 @@ class MdlListe{
return $tabListe; return $tabListe;
} }
public function findById(string $id): array{
$gate=new ListeGateway($this->con);
$gateTache=new TacheGateway($this->con);
$results=$gate->findById($id);
$tabListe=[];
foreach ($results as $row ) {
$tabTache=[];
$taches=$gateTache->getTacheFromIdList($row['id']);
foreach($taches as $tata){
$tabTache[]=new Tache($tata['id'], $tata['name'], $tata['content'], $tata['completed']);
}
if ($row['private']==false){
$tabListe[]=new Liste($row['id'], $row['name'], $row['private'], null, $tabTache);
}
if ($row['idCreator']==$u->getId()){
$tabListe[]=new Liste($row['id'], $row['name'], $row['private'], $u, $tabTache);
}
}
return $tabListe;
}
public function findByUser(string $username): array{ public function findByUser(string $username): array{
$gate=new ListeGateway($this->con); $gate=new ListeGateway($this->con);
$gateTache=new TacheGateway($this->con); $gateTache=new TacheGateway($this->con);

Loading…
Cancel
Save