parent
8943498064
commit
29b08cf4bb
@ -1,57 +1,56 @@
|
||||
<?php
|
||||
namespace controleur;
|
||||
|
||||
use config\Validation;
|
||||
|
||||
class FrontControleur
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
global $twig; // nécessaire pour utiliser variables globales
|
||||
// on démarre ou reprend la session pas utilisée ici
|
||||
global $twig;
|
||||
session_start();
|
||||
|
||||
//debut
|
||||
//on initialise un tableau d'erreur
|
||||
$dVueEreur = [];
|
||||
|
||||
try {
|
||||
$action = $_REQUEST['action'] ?? null;
|
||||
|
||||
switch($action) {
|
||||
//pas d'action, on réinitialise 1er appel
|
||||
case null:
|
||||
$this->reinit();
|
||||
break;
|
||||
|
||||
default:
|
||||
$dVueEreur[] = "Erreur d'appel php";
|
||||
echo $twig->render('accueil.html', ['dVueEreur' => $dVueEreur]);
|
||||
break;
|
||||
}
|
||||
} catch (\PDOException $e) {
|
||||
//si erreur BD, pas le cas ici
|
||||
$dVueEreur[] = 'Erreur inattendue!!! ';
|
||||
} catch (\Exception $e2) {
|
||||
$dVueEreur[] = 'Erreur inattendue!!! ';
|
||||
echo $twig->render('erreur.html', ['dVueEreur' => $dVueEreur]);
|
||||
$dVueErreur = [];
|
||||
$actions = array(
|
||||
"Admin" => [
|
||||
"supprimerCompte", "consulterSignalement", "creerEvenement", "supprimerEvenement","supprimerOffre"
|
||||
],
|
||||
"Modérateur" => [
|
||||
//TODO
|
||||
],
|
||||
"Membre" => [
|
||||
"deconnexion","proposerOffre","consulterProfil","modifierProfil","signaler"
|
||||
],
|
||||
"Utilisateur" => [
|
||||
"connection", "inscription", "accueil","consulterProfilLimite"
|
||||
]
|
||||
);
|
||||
|
||||
$action = Validation::nettoyerString($_GET["action"] ?? "");
|
||||
if(in_array($action,$actions['Admin'])) {
|
||||
if (false) { //TODO: tester si connecté en tant qu'admin via la session
|
||||
$dVueErreur[] = 'Veuillez vous connecter';
|
||||
echo $twig->render('erreur.html', ['dVueEreur' => $dVueErreur]);
|
||||
} else{
|
||||
new AdminControleur();
|
||||
}
|
||||
}
|
||||
else if(in_array($action,$actions['Modérateur'])) {
|
||||
if (false) { //TODO: tester si connecté en tant que modérateur via la session
|
||||
$dVueErreur[] = 'Veuillez vous connecter';
|
||||
echo $twig->render('erreur.html', ['dVueEreur' => $dVueErreur]);
|
||||
} else{
|
||||
new ModerateurControleur();
|
||||
}
|
||||
}
|
||||
else if(in_array($action,$actions['Membre'])) {
|
||||
if (isset($_SESSION["login"]) && !empty($_SESSION["login"]) == null) {
|
||||
$dVueErreur[] = 'Veuillez vous connecter';
|
||||
echo $twig->render('erreur.html', ['dVueEreur' => $dVueErreur]);
|
||||
} else{
|
||||
new MembreControleur();
|
||||
}
|
||||
}else{
|
||||
new UtilisateurControleur();
|
||||
}
|
||||
|
||||
//fin
|
||||
exit(0);
|
||||
}//fin constructeur
|
||||
|
||||
public function reinit()
|
||||
{
|
||||
global $twig; // nécessaire pour utiliser variables globales
|
||||
echo 'toto';
|
||||
$dVue = [
|
||||
'nom' => '',
|
||||
'age' => 0,
|
||||
];
|
||||
var_dump($dVue);
|
||||
|
||||
echo $twig->render('accueil.html', [
|
||||
'dVue' => $dVue
|
||||
]);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
namespace controleur;
|
||||
|
||||
use config\Validation;
|
||||
|
||||
class ModerateurControleur extends MembreControleur
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
global $twig;
|
||||
if (!isset($_REQUEST["action"])) {
|
||||
$action = NULL;
|
||||
} else {
|
||||
$action = Validation::nettoyerString($_REQUEST["action"]);
|
||||
}
|
||||
switch ($action) {
|
||||
default:
|
||||
parent::__construct();
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,14 @@
|
||||
@import url(https://fonts.googleapis.com/css2?family=Poppins:ital,wght@0,100;0,200;0,300;0,400;0,500;0,600;0,700;1,100;1,200;1,300;1,400;1,500;1,600;1,700&family=Share+Tech+Mono&display=swap);
|
||||
*{
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
box-sizing: border-box;
|
||||
font-family: 'Poppins', sans-serif;
|
||||
}
|
||||
body{
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
min-height: 100vh;
|
||||
background: #2f363e;
|
||||
}
|
@ -0,0 +1,18 @@
|
||||
<?php
|
||||
|
||||
class EvenementGateway
|
||||
{
|
||||
private Connection $con;
|
||||
|
||||
/**
|
||||
* @param $con
|
||||
*/
|
||||
public function __construct(Connection $con){
|
||||
$this->con = $con;
|
||||
}
|
||||
|
||||
public function insert(){
|
||||
$query='INSERT INTO Evenement VALUES ()';
|
||||
$this->con->executeQuery($query, array());
|
||||
}
|
||||
}
|
@ -0,0 +1,18 @@
|
||||
<?php
|
||||
|
||||
class OffreGateway
|
||||
{
|
||||
private Connection $con;
|
||||
|
||||
/**
|
||||
* @param $con
|
||||
*/
|
||||
public function __construct(Connection $con){
|
||||
$this->con = $con;
|
||||
}
|
||||
|
||||
public function insert(){
|
||||
$query='INSERT INTO Offre VALUES ()';
|
||||
$this->con->executeQuery($query, array());
|
||||
}
|
||||
}
|
@ -0,0 +1,6 @@
|
||||
<?php
|
||||
|
||||
class Evenement
|
||||
{
|
||||
|
||||
}
|
@ -0,0 +1,6 @@
|
||||
<?php
|
||||
|
||||
class Offre
|
||||
{
|
||||
|
||||
}
|
@ -0,0 +1,8 @@
|
||||
<?php
|
||||
|
||||
namespace modeles;
|
||||
|
||||
class ModerateurControleur
|
||||
{
|
||||
|
||||
}
|
@ -0,0 +1,50 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>Alica - Inscription</title>
|
||||
<link rel="stylesheet" type="text/css" href="css/inscription.css">
|
||||
</head>
|
||||
<body>
|
||||
<div class="container">
|
||||
<form action="" method="POST">
|
||||
<h3>S'inscrire</h3>
|
||||
<div class="CadreInput">
|
||||
<span>Identifiant</span>
|
||||
<div class="box">
|
||||
<div class="icon"><ion-icon name="person"></ion-icon>
|
||||
</div>
|
||||
<input type="text" name="username" required>
|
||||
</div>
|
||||
</div>
|
||||
<div class="CadreInput">
|
||||
<span>Email</span>
|
||||
<div class="box">
|
||||
<div class="icon"><ion-icon name="mail-outline"></ion-icon>
|
||||
</div>
|
||||
<input type="email" name="email" required>
|
||||
</div>
|
||||
</div>
|
||||
<div class="CadreInput">
|
||||
<span>Mot de passe</span>
|
||||
<div class="box">
|
||||
<div class="icon"><ion-icon name="lock-closed"></ion-icon>
|
||||
</div>
|
||||
<input type="password" name="password" required>
|
||||
</div>
|
||||
</div>
|
||||
<div class="CadreInput">
|
||||
<div class="box">
|
||||
<div class="icon"></div>
|
||||
<input type="submit" value="Creer mon compte">
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
<form action="index.php?action=connection" method="POST">
|
||||
<input type="submit" value="S'identifier">
|
||||
</form>
|
||||
</div>
|
||||
<script type="module" src="https://unpkg.com/ionicons@5.5.2/dist/ionicons/ionicons.esm.js"></script>
|
||||
<script noModule src="https://unpkg.com/ionicons@5.5.2/dist/ionicons/ionicons.js"></script>
|
||||
</body>
|
||||
</html>
|
Loading…
Reference in new issue