ADD :visitor modele

master
Lucie Bedouret 2 years ago
parent 2021f8a165
commit b9bcb8f706

BIN
.DS_Store vendored

Binary file not shown.

@ -1,6 +1,6 @@
<?php <?php
class UserController extends VisitorController{ class UserController{
public function __construct() { public function __construct() {
global $rep,$vues; global $rep,$vues;
@ -10,20 +10,20 @@ class UserController extends VisitorController{
try{ try{
$action = $_REQUEST['action']??null; $action = $_REQUEST['action']??null;
/*
switch($action){ switch($action){
case NULL: case NULL:
$this->Reinit(); $this->reinit();
break; break;
case "deconnection": case "deconnection":
$this->deconnection($arrayErrorViews); $this->deconnection($arrayErrorViews);
break; break;
case "creerListe": case "creerListePrivee":
$this->creerListe($arrayErrorViews); $this->creerListe($arrayErrorViews);
break; break;
case "supprListe": case "supprListe":
$this->supprListe($arrayErrorViews); $this->supprListe($arrayErrorViews);
break; break;
case "cocherTache":
default : default :
$arrayErrorViews[]="Erreur innatendue !!!"; $arrayErrorViews[]="Erreur innatendue !!!";
require($rep.$vues['error']); require($rep.$vues['error']);
@ -33,7 +33,7 @@ class UserController extends VisitorController{
$dataView[]="Erreur inatendue"; $dataView[]="Erreur inatendue";
require(__DIR__.'/../vues/erreur.php'); require(__DIR__.'/../vues/erreur.php');
} }
} }
} }
?> ?>

@ -17,10 +17,10 @@ class VisitorController {
case "connection": case "connection":
$this->connection($arrayErrorViews); $this->connection($arrayErrorViews);
break; break;
case "creerListe": case "creerListePublique":
$this->creerListe($arrayErrorViews); $this->creerListe($arrayErrorViews);
break; break;
case "supprListe": case "supprListePublique":
$this->supprListe($arrayErrorViews); $this->supprListe($arrayErrorViews);
break; break;
default : default :
@ -41,6 +41,7 @@ class VisitorController {
public function connection(array $vues_erreur){ public function connection(array $vues_erreur){
global $rep,$vues; global $rep,$vues;
require($rep.$vues['connection']); require($rep.$vues['connection']);
} }
} }

@ -3,8 +3,24 @@
class FrontControleur{ class FrontControleur{
public function __construct(){ public function __construct(){
$liste_actions_utilisateur = array('deconnecter','crerListePrivee','supprListeprivee');
$liste_actions_visiteur = array('ajoutListe','suprrListe','connecter');
global $rep,$vues; global $rep,$vues;
require($rep.$vues['acceuil']); require($rep.$vues['acceuil']);
try{
$utilisateur = UserModel::IsUtilisateur();
$action = $_REQUEST['action'];
if (in_array($action,$liste_actions_utilisateur)){
if($utilisateur == null){
new VisitorController();
} else {
new UserController();
}
} else{
new VisitorController();
}
} catch (Exception $e){require ($rep.$vues['erreur']);}
} }
} }

@ -0,0 +1,16 @@
<?php
class VisitorModel{
public $gw;
public function __construct(){
$co = new Connection();
$this->gw = new ListeGateway($co);
}
public function creerListe(){
}
}
?>

@ -3,14 +3,15 @@
<head> <head>
<title>Acceuil</title> <title>Acceuil</title>
<link rel="stylesheet" href="views/styles/commonStyles.css"> <link rel="stylesheet" href="../vues/styles/commonStyles.css">
</head> </head>
<body> <body>
<header> <header>
<h1>Welcome to our fantastic to do list app !</h1> <h1>Welcome to our fantastic to do list app !</h1>
<form method="post" name="connection"> <form method="post" name="connection">
<input class="button" type="button" value="Connection"/> <a href='vues/connection.php'>
<input type="hidden" value="connection"/> <input class="button" type="button" value="Connection"/>
</a>
</form> </form>
</header> </header>

@ -19,8 +19,8 @@
<br/> <br/>
<br/> <br/>
<p>You are new here?</p> <p>You are new here?</p>
<a class="button" href="./signUp.html"> <a href="inscription.php">
<input type="button" value="Sign Up"/> <input class="button" type="button" value="Sign Up"/>
</a> </a>
</div> </div>
</body> </body>

Loading…
Cancel
Save