main
Thomas Chazot 2 years ago
parent 6bd63f2bfa
commit fbf860a804

@ -60,12 +60,6 @@ else{
<h2>List details</h2> <h2>List details</h2>
<?php <?php
$tabTaches[]=new Tache(1, "wesh", "bonjour bonjour", false);
$tabTaches[]=new Tache(2, "wesh wesh", "au revoir", true);
$tabTaches[]=new Tache(3, "Bonjour", "au revoir", true);
$dataView[]=new Liste(12, "test", false, null, $tabTaches);
if (isset($dataView)): if (isset($dataView)):
@ -103,7 +97,8 @@ else{
?> ?>
<form method="POST" id="deleteList" name="deleteList" class="col col-5"> <form method="POST" id="deleteList" name="deleteList" class="col col-5">
<input type="submit" value="Delete"/> <input value="Delete" type="submit"/>
<input type="hidden" name="action" value="delList"/>
<input type="hidden" name="list" value="<?=$dataView[0]->getId()?>"/> <input type="hidden" name="list" value="<?=$dataView[0]->getId()?>"/>
</form> </form>
</li> </li>

@ -2,9 +2,9 @@
$rep = __DIR__ . '/../'; $rep = __DIR__ . '/../';
$login="thchazot1"; $login="root";
$password="achanger"; $password="root";
$dsn="mysql:host=localhost;dbname=dbthchazot1"; // chemin vers bd (mysql:host=londres.uca.local;dbname=dblibreton => pour l'iut) $dsn="mysql:host=localhost;port=8888;dbname=bddDeQualite"; // chemin vers bd (mysql:host=londres.uca.local;dbname=dblibreton => pour l'iut)
//$dsn="mysql:host=localhost;port=8888;dbname=bddDeQualite"; //$dsn="mysql:host=localhost;port=8888;dbname=bddDeQualite";
/* /*
$login="thchazot1"; $login="thchazot1";

@ -32,7 +32,7 @@ class VisitorController {
require($rep.$vues['signUp']); require($rep.$vues['signUp']);
break; break;
case "supprimerListe": case "delList":
$this->DelList($dVueEreur); $this->DelList($dVueEreur);
break; break;
case "accessListInfos": case "accessListInfos":
@ -127,11 +127,9 @@ class VisitorController {
function DelList($dVueEreur) { function DelList($dVueEreur) {
global $rep, $vues; global $rep, $vues;
$idListe=$_POST['liste']; $idListe=$_POST['list'];
$name=$_POST['name'];
$private=$_POST['private'];
$model = new MdlListe(); $model = new MdlListe();
$model->delete($idListe, $name, $private); $model->delete($idListe);
$_REQUEST['action']=null; $_REQUEST['action']=null;
$this->reinit(); $this->reinit();
$dVueEreur= array(); $dVueEreur= array();

@ -25,13 +25,14 @@ class ListeGateway
} }
} }
public function delete(Liste $l): void{ public function delete(int $id): void{
$results=findById($id);
$tacheGateway=new TacheGateway($this->con); $tacheGateway=new TacheGateway($this->con);
foreach($l->getTaches() as $taches){ foreach($results[0]->getTaches() as $taches){
$tacheGateway->delete($taches); $tacheGateway->delete($taches);
} }
$query = "DELETE FROM Liste where id=:id"; $query = "DELETE FROM Liste where id=:id";
$this->con->executeQuery($query, array(':id' => array($l->getId(), PDO::PARAM_INT))); $this->con->executeQuery($query, array(':id' => array($id, PDO::PARAM_INT)));
} }
public function update(Liste $l): void{ public function update(Liste $l): void{

@ -20,9 +20,9 @@ class MdlListe{
return $l; return $l;
} }
public function delete(Liste $liste){ public function delete(int $id){
$gate=new ListeGateway($this->con); $gate=new ListeGateway($this->con);
$gate->delete($liste); $gate->delete($id);
} }
public function update(Liste $liste, string $name, bool $private){ public function update(Liste $liste, string $name, bool $private){

Loading…
Cancel
Save