Lilian BRETON 2 years ago
commit f7c84a7c63

@ -64,7 +64,6 @@ else{
if (isset($dataView)):
?>
<form>
<div class="container">
<ul class="responsive-table">
@ -99,8 +98,8 @@ else{
}
?>
<form method="POST" id="marche" name="marche" class="col col-2">
<input value="Delete" type="submit"/>
<form method="post" id="marche" name="marche" class="col col-2">
<input value="DELETE" type="submit"/>
<input type="hidden" name="action" value="delList"/>
<input type="hidden" name="list" value="<?=$list->getId()?>"/>
</form>
@ -181,6 +180,5 @@ else{
<?php
endif;
?>
</form>
</div>
</div>

@ -11,7 +11,7 @@ class FrontController {
session_start();
try{
$user=$_SESSION??null;
$action = $_REQUEST['action'];
$action = $_REQUEST['action']??null;
if (in_array($action,$liste_actions_utilisateur)){
if($user == null){

@ -26,10 +26,13 @@ class ListeGateway
}
public function delete(int $id): void{
$results=findById($id);
$results=$this->findById($id);
$tacheGateway=new TacheGateway($this->con);
foreach($results[0]->getTaches() as $taches){
$tacheGateway->delete($taches);
foreach ($results as $row ) {
$taches=$tacheGateway->getTacheFromIdList($row['id']);
foreach($taches as $tata){
$tacheGateway->delete($tata);
}
}
$query = "DELETE FROM Liste where id=:id";
$this->con->executeQuery($query, array(':id' => array($id, PDO::PARAM_INT)));
@ -60,14 +63,13 @@ class ListeGateway
return $results;
}
public function findById(string $id): array{
public function findById(int $id): Array{
$results=[];
$taches = array();
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;
$results = $this->con->getResults();
}
return $results;
}

@ -30,7 +30,6 @@ class TacheGateway
$query = "SELECT * FROM Tache t where idListe=:id";
$this->con->executeQuery($query, array(':id' => array($id, PDO::PARAM_INT)));
$results=$this->con->getResults();
return $results;
foreach ($results as $row) {
$tabTaches[]=new Tache($row['id'], $row['name'], $row['content'], $row['completed']);
}

@ -64,7 +64,7 @@ class MdlListe{
$tabTache=[];
$taches=$gateTache->getTacheFromIdList($row['id']);
foreach($taches as $tata){
$tabTache[]=new Tache($tata['id'], $tata['name'], $tata['content'], $tata['completed']);
$tabTache[]=$tata;
}
$tabListe[]=new Liste($row['id'], $row['name'], $row['private'], null, $tabTache);
}

Loading…
Cancel
Save