Thomas Chazot 2 years ago
parent 078533719a
commit 5238543385

@ -14,7 +14,7 @@
<h2>Ajouter une tâche</h2> <h2>Ajouter une tâche</h2>
<form method="POST" name="addTask" id="addTask"> <form method="post" name="addTask" id="addTask">
<div class="group"> <div class="group">
<input type="text" name="name" placeholder="Task name" required> <input type="text" name="name" placeholder="Task name" required>
@ -35,7 +35,7 @@
<input type="submit" value="Submit"/> <input type="submit" value="Submit"/>
<input type="hidden" name="action" value="addTask"/> <input type="hidden" name="action" value="addTask"/>
<input type="hidden" name="list" value="<?=$dataView[0]?>"/> <input type="hidden" name="list" value="<?=$dataView?>"/>
</form> </form>
</div> </div>

@ -155,6 +155,7 @@ else{
<form method="POST" id="deleteTask" name="deleteTask" class="col col-5"> <form method="POST" id="deleteTask" name="deleteTask" class="col col-5">
<input type="submit" value="Delete"/> <input type="submit" value="Delete"/>
<input type="hidden" name="action" value="deleteTask"/>
<input type="hidden" name="list" value="<?=$dataView[0]->getId()?>"/> <input type="hidden" name="list" value="<?=$dataView[0]->getId()?>"/>
<input type="hidden" name="tache" value="<?=$tache->getId()?>"/> <input type="hidden" name="tache" value="<?=$tache->getId()?>"/>
</form> </form>

@ -38,6 +38,10 @@ class Tache
return $this->completed; return $this->completed;
} }
public function setId(int $id){
$this->id=$id;
}
public function setName(string $name){ public function setName(string $name){
$this->name=$name; $this->name=$name;
} }

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

@ -15,9 +15,9 @@ class MdlTache{
public function insert(string $name, string $content ,bool $completed, string $idListe): Tache{ public function insert(string $name, string $content ,bool $completed, string $idListe): Tache{
$gate=new TacheGateway($this->con); $gate=new TacheGateway($this->con);
$t=new Tache(0, $name, $content, $completed); $t=new Tache(0, $name, $content, $completed);
$gate->insert($t); $gate->insert($t, $idListe);
$id=$gate->getLastId(); $id=$gate->getLastId();
$t->setId($id[0]['oldId']); $t->setId($id);
return $t; return $t;
} }

Loading…
Cancel
Save