From 9fa8efb860d28e0605d67ade990faeec4def3213 Mon Sep 17 00:00:00 2001 From: Thomas Chazot Date: Fri, 23 Dec 2022 22:38:33 +0100 Subject: [PATCH] wesh marche pd --- config/config.php | 6 +++--- controllers/UserController.php | 2 ++ controllers/VisitorController.php | 26 +++++++++++++++++++------- 3 files changed, 24 insertions(+), 10 deletions(-) diff --git a/config/config.php b/config/config.php index 76a557b..25f8641 100644 --- a/config/config.php +++ b/config/config.php @@ -2,9 +2,9 @@ $rep = __DIR__ . '/../'; -$login="thchazot1"; -$password="achanger"; -$dsn="mysql:host=localhost;dbname=dbthchazot1"; // chemin vers bd (mysql:host=londres.uca.local;dbname=dblibreton => pour l'iut) +$login="root"; +$password="root"; +$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"; /* $login="thchazot1"; diff --git a/controllers/UserController.php b/controllers/UserController.php index 9306bf2..67a168a 100644 --- a/controllers/UserController.php +++ b/controllers/UserController.php @@ -142,6 +142,8 @@ class UserController { } $dVueEreur = Validation::val_intitule($name, $dVueEreur); if(!empty($dVueEreur)){ + $liste=$model->findById($_POST['list']); + $dataView=$liste[0]; require($rep.$vues['modifyTask']); } else{ diff --git a/controllers/VisitorController.php b/controllers/VisitorController.php index 9510445..98924cd 100644 --- a/controllers/VisitorController.php +++ b/controllers/VisitorController.php @@ -108,14 +108,19 @@ class VisitorController { $name=$_POST['name']; - Validation::val_intitule($name, $dVueEreur); + $dVueEreur=Validation::val_intitule($name, $dVueEreur); try { - $model= new MdlListe(); - $list=[]; - $list[]=$model->insert($name, false, null); - $dataView=$list; - require($rep.$vues['seeList']); + if(!empty($dVueEreur)){ + require($rep.$vues['addListVis']); + } + else{ + $model= new MdlListe(); + $list=[]; + $list[]=$model->insert($name, false, null); + $dataView=$list; + require($rep.$vues['seeList']); + } } catch (PDOException $e) { $dataView[]="Erreur inatendue"; @@ -192,6 +197,7 @@ class VisitorController { $private=$_POST['private']; $dVueEreur = Validation::val_intitule($name, $dVueEreur); if(!empty($dVueEreur)){ + $dataView=$_POST['liste']; require($rep.$vues['modifyTask']); } else{ @@ -270,6 +276,10 @@ class VisitorController { $dVueEreur = Validation::val_intitule($content, $dVueEreur); } if(!empty($dVueEreur)){ + $mdlTache= new MdlTache(); + $tache=$mdlTache->findById($_POST['task']); + $dataView[]=$tache; + $dataView[]=$_POST['list']; require($rep.$vues['modifyListPub']); } else{ @@ -286,12 +296,14 @@ class VisitorController { global $rep,$vues,$dataView; $list=$_POST['list']; $name=$_POST['name']; + $model = new MdlListe(); $dVueEreur = Validation::val_intitule($name, $dVueEreur); if(!empty($dVueEreur)){ + $liste=$mdlListe->findById($_POST['list']); + $dataView=$liste[0]; require($rep.$vues['modifyListPub']); } else{ - $model = new MdlListe(); $mdlUsr = new MdlUser(); $list=$model->findById($list); $model->update($list[0], $name, false);