From bbeee05bb23855c43b506b644f9a5b0848b5d889 Mon Sep 17 00:00:00 2001 From: Lucie Bedouret Date: Sat, 10 Dec 2022 11:14:25 +0100 Subject: [PATCH] ADD: front controleur fonctionnel --- .DS_Store | Bin 6148 -> 0 bytes controleurs/ControleurUtilisateur.php | 5 ++- controleurs/ControleurVisiteur.php | 51 +++++--------------------- controleurs/FrontControleur.php | 15 ++++---- modeles/.DS_Store | Bin 6148 -> 0 bytes modeles/Gateways/ListeGateway.php | 16 -------- modeles/Modele/VisiteurModel.php | 12 ------ phpProject | 1 - vues/creationListe.php | 0 vues/creerTache.php | 0 vues/liste.php | 0 vues/suppressionListe.php | 0 12 files changed, 19 insertions(+), 81 deletions(-) delete mode 100644 .DS_Store delete mode 100644 modeles/.DS_Store delete mode 160000 phpProject delete mode 100644 vues/creationListe.php delete mode 100644 vues/creerTache.php delete mode 100644 vues/liste.php delete mode 100644 vues/suppressionListe.php diff --git a/.DS_Store b/.DS_Store deleted file mode 100644 index c7413f45803d85a377304657411499018588414f..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 6148 zcmeHK&u`N(6n^f)nyy0Xfe9{1k+@Ey{21EAC6sa44J`-`8!Amxwm@cAO}Zjgm2w6C z7>@f-_+L1&@7bQTq=3W)p~_Es{+{jkIrZnpj)_S0rpW`M4iWiqMsEYfFO2)ym#kr1 zxKrpcQaU-v)G*Feyp-)4oB~dP|4jjYch_l1iX^?K>if%^!ZY~xPi^|Aw{31g6L2yb z(G*dB?X3q(+^w-%7+F$+>`$~!V>+dAl|kQXj3%97d}i=7>f?X?b9Ow-$9508h{su) z7v1i6(OC0ttT+9p-}c`|r)m}zgJPQZ29qPMy;3TRui`=cIvvgWomG3U+rETfuyf!^e-FEEX+)^WOcZhy9P) znN**(m?W@mYP)Ii3cetyNpK!bWTxZ^dYH9gWTcmRAwEE)Ar)0o8=QN6@jN=maxKgG zqn3xNv(;C?{`vg&>QB|p&?(>)_)7(Ne+b}=p~cdm-a1g|D*(_#vo^&1*}$B@Vra26 zh#r_QRG^^>d&Lljj`qOjg%(SLhEBp>K7@U;us0N;pN{bZolYV&=t`%6Q=qEAnyGg9 z{D1NL`+t?>YEA*Cz)C3~y!~juhbh^!b!l>Z)&}r*a5l~>4QdJsdmQV4kK#LUZRiU) W0EQMzgJ^-d4*@NME1UxVRDnxxLYspC diff --git a/controleurs/ControleurUtilisateur.php b/controleurs/ControleurUtilisateur.php index 77328c4..84260f2 100644 --- a/controleurs/ControleurUtilisateur.php +++ b/controleurs/ControleurUtilisateur.php @@ -4,7 +4,8 @@ class UserController{ public function __construct() { global $rep,$vues; - + //On démarre la session + session_sart(); $arrayErrorViews= array(); $action = $_REQUEST['action']??null; @@ -69,7 +70,7 @@ class UserController{ try{ UserModel::changerPassword($newPassword); - require($rep.$vues['profil']); + require($rep.$vues['profil']) }catch(PDOException $e){ $dataView[]="Erreur inatendue"; require($rep.$vues['erreur']); diff --git a/controleurs/ControleurVisiteur.php b/controleurs/ControleurVisiteur.php index 11e34b5..461703d 100644 --- a/controleurs/ControleurVisiteur.php +++ b/controleurs/ControleurVisiteur.php @@ -4,6 +4,8 @@ class VisitorController { public function __construct() { global $rep,$vues; + //On démarre la session + session_sart(); $arrayErrorViews= array(); try{ @@ -17,7 +19,6 @@ class VisitorController { break; case "inscription": $this->inscription($arrayErrorViews); - break; case "creerListe": $this->creerListe($arrayErrorViews); break; @@ -30,9 +31,6 @@ class VisitorController { case "cocherTache": $this->cocherTache($arrayErrorViews); break; - case "decocherTache": - $this->decocherTache($arrayErrorViews); - break; case "supprTache": $this->supprTache($arrayErrorViews); default : @@ -41,14 +39,14 @@ class VisitorController { } } catch(PDOException $e){ $dataView[]="Erreur inatendue"; - require('erreur.php'); + require(__DIR__.'/../vues/erreur.php'); } exit(0); } public function reinit(){ global $rep,$vues; - require($rep.$vues['acceuil.php']); + require($rep.$vues['acceuil']); } public function connection(array $vues_erreur){ @@ -59,7 +57,7 @@ class VisitorController { Validation::clear_string($pwd); Validation::val_connexion($usrname,$pwd,$vues_erreur); - $model = new VisiteurModel(); + $model = new UserModel(); $worked=$model->connexion(); /* $dVue = array ( @@ -75,13 +73,12 @@ class VisitorController { public function inscription(array $vues_erreur){ global $rep,$vues; - require($rep.$vues['inscription']); $usrname=$_POST['login']; $pwd=$_POST['mdp']; Validation::val_connexion($usrname,$pwd,$vues_erreur); - $model = new VisiteurModel(); + $model = new UserModel(); $model->inscription(); } @@ -91,7 +88,7 @@ class VisitorController { $nom=$_POST['nom']; - $model = new VisiteurModel(); + $model = new ListeModel(); $model->creerListe($nom); } @@ -99,7 +96,7 @@ class VisitorController { global $rep, $vues; require($rep.$vues['suppressionListe']); - $model = new VisiteurModel(); + $model = new ListeModel(); $model->supprListe(); } @@ -109,39 +106,9 @@ class VisitorController { $intitule = $_POST['intitule']; - $model = new VisiteurModel(); + $model = new ListeModel(); $model->creerTache(); } - - public function cocherTache(array $vues_erreur){ - global $rep, $vues; - require($rep.$vues['liste']); - - $id = $_POST['idTache']; - - $model = new VisiteurModel(); - $model->cocherTache($id); - } - - public function decocherTache(array $vues_erreur){ - global $rep, $vues; - require($rep.$vues['liste']); - - $id = $_POST['idTache']; - - $model = new VisiteurModel(); - $model->decocherTache($id); - } - - public function supprTache(array $vues_erreur){ - global $rep, $vues; - require($rep.$vues['liste']); - - $id = $_POST['idTache']; - - $model = new VisiteurModel(); - $model->supprTache($id); - } } ?> \ No newline at end of file diff --git a/controleurs/FrontControleur.php b/controleurs/FrontControleur.php index 689b865..22e743c 100644 --- a/controleurs/FrontControleur.php +++ b/controleurs/FrontControleur.php @@ -1,28 +1,27 @@ a?B5|EYDX0?Sl66DV4qOO=14AWQA{G(ss!113Ri#{k zAH#9~WdC8m0={Q^Xl*wRJ0LXqNzdQ&^LuvkIksaW5`#(dl&C{Q9+a`sMsbaBJL{4( ztfvJOx{s8OsHBV($)#xL_#YYIxw}uhdd4JOoxg1w(J_q7QMz;3F31~=VQf>zs1H?F|yBb7LW3*D7)Qr(O7BTYpr^# z-kSF@JXTd$M&+a!MB@)!d#h9)U)oXpE=#Ln=fSR$Wt7QutP`>%Mabd%OeU%tsEJGp zog114ukE#mosH?V*WdD=_xiIffBK@=h5f8Qo3*`%kDt7JGyIZ&mFgSwft7%zpk>|S zC47f5_xdN{SmsK8hM#k|?Lse~l*S9xY@+=t?Wj6&3^)cH1Gi_uZdBgd?YnT9jseHO z9c6&`2Or89SgZ}|tpkO=0sxzEYk|$biJaqG3@p|L(E<@B6=+h0y{X0*kdl zlTN~3K7<`v*c*z_qoaRchm!~ly3#S=7?@{Z#Z)_d{=d5U{y(4OYK{TNz@1`1H21>2 z0ba?TtxGS*XRQzY1ZCm4+TfoQ82TtiEFZ;>pjzPf*#HI>YlHAW+>d~!!4-~yf6Bmb DZBl

co; - - $query = "UPDATE Tache SET isCompleted=false WHERE id=:id"; - - $co->executeQuery($query, array(':id' => array($id, PDO::PARAM_STR))); - } - catch(PDOException $Exception){ - echo 'erreur'; - echo $Exception->getMessage(); - } - } - } - public function creerListe(string $nom, int $idCreator){ try{ $co = $this->co; diff --git a/modeles/Modele/VisiteurModel.php b/modeles/Modele/VisiteurModel.php index 0a2ab2d..7398b04 100644 --- a/modeles/Modele/VisiteurModel.php +++ b/modeles/Modele/VisiteurModel.php @@ -43,18 +43,6 @@ public function creerTache(string $intitule){ $this->get_gtwListe()->creerTache($intitule); } - - public function cocherTache($id){ - $this->get_gtwListe()->completeTache($id); - } - - public function decocherTache($id){ - $this->get_gtwListe()->decocherTache($id); - } - - public function supprTache($id){ - $this->get_gtwListe()->delTache($id); - } } ?> \ No newline at end of file diff --git a/phpProject b/phpProject deleted file mode 160000 index 8d36530..0000000 --- a/phpProject +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 8d36530eb50f80bd0d2b77e03ff716c4776f5cfc diff --git a/vues/creationListe.php b/vues/creationListe.php deleted file mode 100644 index e69de29..0000000 diff --git a/vues/creerTache.php b/vues/creerTache.php deleted file mode 100644 index e69de29..0000000 diff --git a/vues/liste.php b/vues/liste.php deleted file mode 100644 index e69de29..0000000 diff --git a/vues/suppressionListe.php b/vues/suppressionListe.php deleted file mode 100644 index e69de29..0000000