parent
ff617d449a
commit
2021f8a165
@ -0,0 +1,50 @@
|
||||
<?php
|
||||
|
||||
class Autoload
|
||||
{
|
||||
private static $_instance = null;
|
||||
|
||||
public static function charger()
|
||||
{
|
||||
if(null !== self::$_instance) {
|
||||
throw new RuntimeException(sprintf('%s is already started', __CLASS__));
|
||||
}
|
||||
|
||||
self::$_instance = new self();
|
||||
|
||||
|
||||
if(!spl_autoload_register(array(self::$_instance, '_autoload'), false)) {
|
||||
throw RuntimeException(sprintf('%s : Could not start the autoload', __CLASS__));
|
||||
}
|
||||
}
|
||||
|
||||
public static function shutDown()
|
||||
{
|
||||
if(null !== self::$_instance) {
|
||||
|
||||
if(!spl_autoload_unregister(array(self::$_instance, '_autoload'))) {
|
||||
throw new RuntimeException('Could not stop the autoload');
|
||||
}
|
||||
|
||||
self::$_instance = null;
|
||||
}
|
||||
}
|
||||
|
||||
private static function _autoload($class)
|
||||
{
|
||||
global $rep;
|
||||
$filename = $class.'.php';
|
||||
$dir = array('modeles/','./','config/','controleurs/');
|
||||
foreach ($dir as $d){
|
||||
$file=$rep.$d.$filename;
|
||||
//echo $file;
|
||||
if (file_exists($file))
|
||||
{
|
||||
include $file;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
?>
|
@ -0,0 +1,18 @@
|
||||
<?php
|
||||
|
||||
//Prefixe
|
||||
$rep=__DIR__.'/../';
|
||||
//BD
|
||||
// ----
|
||||
// A CHANGER
|
||||
// ----
|
||||
$base="votre_base";
|
||||
$login="";
|
||||
$mdp="";
|
||||
//Vues
|
||||
$vues['acceuil']='vues/acceuil.php';
|
||||
$vues['erreur']='vues/erreur.php';
|
||||
$vues['connection']='vues/connection.php';
|
||||
$vues['inscription']='vues/inscription.php';
|
||||
|
||||
?>
|
@ -0,0 +1,39 @@
|
||||
<?php
|
||||
|
||||
class UserController extends VisitorController{
|
||||
|
||||
public function __construct() {
|
||||
global $rep,$vues;
|
||||
//On démarre la session
|
||||
session_sart();
|
||||
$arrayErrorViews= array();
|
||||
|
||||
try{
|
||||
$action = $_REQUEST['action']??null;
|
||||
/*
|
||||
switch($action){
|
||||
case NULL:
|
||||
$this->Reinit();
|
||||
break;
|
||||
case "deconnection":
|
||||
$this->deconnection($arrayErrorViews);
|
||||
break;
|
||||
case "creerListe":
|
||||
$this->creerListe($arrayErrorViews);
|
||||
break;
|
||||
case "supprListe":
|
||||
$this->supprListe($arrayErrorViews);
|
||||
break;
|
||||
default :
|
||||
$arrayErrorViews[]="Erreur innatendue !!!";
|
||||
require($rep.$vues['error']);
|
||||
}
|
||||
*/
|
||||
}catch(PDOException $e){
|
||||
$dataView[]="Erreur inatendue";
|
||||
require(__DIR__.'/../vues/erreur.php');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
@ -0,0 +1,47 @@
|
||||
<?php
|
||||
|
||||
class VisitorController {
|
||||
|
||||
public function __construct() {
|
||||
global $rep,$vues;
|
||||
//On démarre la session
|
||||
session_sart();
|
||||
$arrayErrorViews= array();
|
||||
|
||||
try{
|
||||
$action = $_REQUEST['action']??null;
|
||||
switch($action){
|
||||
case NULL:
|
||||
$this->reinit();
|
||||
break;
|
||||
case "connection":
|
||||
$this->connection($arrayErrorViews);
|
||||
break;
|
||||
case "creerListe":
|
||||
$this->creerListe($arrayErrorViews);
|
||||
break;
|
||||
case "supprListe":
|
||||
$this->supprListe($arrayErrorViews);
|
||||
break;
|
||||
default :
|
||||
$arrayErrorViews[]="Erreur innatendue !!!";
|
||||
require($rep.$vues['error']);
|
||||
}
|
||||
}catch(PDOException $e){
|
||||
$dataView[]="Erreur inatendue";
|
||||
require(__DIR__.'/../vues/erreur.php');
|
||||
}
|
||||
}
|
||||
|
||||
public function reinit(){
|
||||
global $rep,$vues;
|
||||
require($rep.$vues['acceuil']);
|
||||
}
|
||||
|
||||
public function connection(array $vues_erreur){
|
||||
global $rep,$vues;
|
||||
require($rep.$vues['connection']);
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
@ -0,0 +1,12 @@
|
||||
<?php
|
||||
|
||||
class FrontControleur{
|
||||
|
||||
public function __construct(){
|
||||
global $rep,$vues;
|
||||
require($rep.$vues['acceuil']);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
@ -1,24 +1,14 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<?php
|
||||
|
||||
<head>
|
||||
<title>Acceuil</title>
|
||||
<link rel="stylesheet" href="views/styles/commonStyles.css">
|
||||
</head>
|
||||
<body>
|
||||
<header>
|
||||
<h1>Welcome to our fantastic to do list app !</h1>
|
||||
<a href="views/connection.html">
|
||||
<input class="button" type="button" value="Connection"/>
|
||||
</a>
|
||||
</header>
|
||||
|
||||
<div>
|
||||
<h2>Todo listes publiques</h2>
|
||||
<p>oooooh fdp change</p>
|
||||
</div>
|
||||
</body>
|
||||
// Chargement config
|
||||
require_once(__DIR__.'/config/config.php');
|
||||
|
||||
// Autoload des classes
|
||||
require_once(__DIR__.'/config/Autoload.php');
|
||||
Autoload::charger();
|
||||
|
||||
// Construction du controleur
|
||||
$cont=new FrontControleur();
|
||||
?>
|
||||
|
||||
</html>
|
||||
|
||||
|
@ -0,0 +1,23 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<title>Acceuil</title>
|
||||
<link rel="stylesheet" href="views/styles/commonStyles.css">
|
||||
</head>
|
||||
<body>
|
||||
<header>
|
||||
<h1>Welcome to our fantastic to do list app !</h1>
|
||||
<form method="post" name="connection">
|
||||
<input class="button" type="button" value="Connection"/>
|
||||
<input type="hidden" value="connection"/>
|
||||
</form>
|
||||
</header>
|
||||
|
||||
<div>
|
||||
<h2>Todo listes publiques</h2>
|
||||
</div>
|
||||
<article>
|
||||
</article>
|
||||
</body>
|
||||
</html>
|
@ -0,0 +1,27 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>connection</title>
|
||||
<link rel="stylesheet" href="styles/commonStyles.css">
|
||||
</head>
|
||||
<body>
|
||||
<header>
|
||||
<h1>You are back ?!</h1>
|
||||
</header>
|
||||
<div>
|
||||
<h4>Username</h4>
|
||||
<input type="text"/>
|
||||
<h4>Password</h4>
|
||||
<input type="password"/>
|
||||
<br/>
|
||||
<br/>
|
||||
<input class="button" type="button" value="Log In"/>
|
||||
<br/>
|
||||
<br/>
|
||||
<p>You are new here?</p>
|
||||
<a class="button" href="./signUp.html">
|
||||
<input type="button" value="Sign Up"/>
|
||||
</a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
@ -0,0 +1,17 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<body>
|
||||
<div>
|
||||
<h3>Error!</h3>
|
||||
|
||||
<?php
|
||||
if (isset($dataVueErreur)) {
|
||||
foreach ($dataVueErreur as $value){
|
||||
echo $value;
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
@ -0,0 +1,27 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>connection</title>
|
||||
<link rel="stylesheet" href="styles/commonStyles.css">
|
||||
</head>
|
||||
<body>
|
||||
<header>
|
||||
<h1>Join the good side of the force</h1>
|
||||
|
||||
</header>
|
||||
<div>
|
||||
<p>Please enter all the informations :</p>
|
||||
<h4>Username</h4>
|
||||
<input type="text"/>
|
||||
<h4>Password</h4>
|
||||
<input type="password"/>
|
||||
<h4>Email</h4>
|
||||
<input type="email"/>
|
||||
<h4>Date Of Birth</h4>
|
||||
<input type="date"/>
|
||||
<br/>
|
||||
<br/>
|
||||
<input class="button" type="button" value="Sign Up"/>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
@ -0,0 +1,26 @@
|
||||
header{
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
background-color: #0971C9;
|
||||
}
|
||||
body{
|
||||
background-color: #0D2350;
|
||||
|
||||
}
|
||||
h1, h2, h3, h4, p{
|
||||
font-family: sans-serif;
|
||||
font-weight: bolder;
|
||||
color: #FFFEFD;
|
||||
}
|
||||
.button{
|
||||
width: 50%;
|
||||
height: 100%;
|
||||
background-color: #FFFEFD;
|
||||
border-radius: 20%;
|
||||
border-color: #0971C9;
|
||||
color: #0D2350;
|
||||
|
||||
}
|
||||
.button:hover{
|
||||
background-color: grey;
|
||||
}
|
Loading…
Reference in new issue