Thomas Chazot 2 years ago
parent a18486fbc6
commit 1dd827f263

@ -12,12 +12,12 @@
<div class="container">
<h2>Ajouter une tâche</h2>
<h2>Modify a task</h2>
<form method="post" name="addTask" id="addTask">
<div class="group">
<input type="text" name="name" placeholder="Task name" required>
<input type="text" name="name"required>
<span class="highlight"></span>
<span class="bar"></span>
</div>

@ -42,8 +42,9 @@ class VisitorController {
require($rep.$vues['addTask']);
break;
case "accessModifyTask":
$dataView=[$_POST['list']];
$dataView[]=$_POST['task'];
$mdlTache= new MdlTache();
$tache=$mdlTache->findById($_POST['task']);
$dataView=$tache;
require($rep.$vues['modifyTask']);
break;

@ -43,20 +43,19 @@ class TacheGateway
return $results[0]['oldId'];
}
/*
public function findByName(string $name): array{
if (!empty($name)){
$query = "SELECT * FROM Tache WHERE name=:name";
$this->con->executeQuery($query, array(':name' => array($name, PDO::PARAM_STR)));
$results=$con->getResults();
foreach ($results as $row ) {
$tabTaches[]=new Tache($row['id'], $row['name'], $row['content']);
}
return $tabTaches;
public function findById(int $id): ?Tache{
$tache=null;
$query = "SELECT * FROM Tache WHERE id=:id";
$this->con->executeQuery($query, array(':id' => array($id, PDO::PARAM_STR)));
$results=$con->getResults();
foreach ($results as $row ) {
$tache=new Tache($row['id'], $row['name'], $row['content']);
}
return $tache;
}
*/
}
?>

@ -27,12 +27,18 @@ class MdlTache{
}
public function update(Tache $tache, string $name, string $content, bool $completed){
$gate=new ListeGateway($this->con);
$gate=new TacheGateway($this->con);
$tache->setName($name);
$tache->setContent($content);
$tache->setCompleted($completed);
$gate->update($tache);
}
public function findById(int $id){
$gate=new TacheGateway($this->con);
return $gate->findById($id);
}
}

Loading…
Cancel
Save