navigation with controler

gateway
Leo Tuaillon 1 year ago
parent 0f22dc9463
commit 8943498064

@ -2,15 +2,17 @@
<module type="WEB_MODULE" version="4">
<component name="NewModuleRootManager">
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/config" isTestSource="false" packagePrefix="config\" />
<sourceFolder url="file://$MODULE_DIR$/controleur" isTestSource="false" packagePrefix="controleur\" />
<sourceFolder url="file://$MODULE_DIR$/modeles" isTestSource="false" packagePrefix="modeles\" />
<sourceFolder url="file://$MODULE_DIR$/spec" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/tests" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/php/config" isTestSource="false" packagePrefix="config\" />
<sourceFolder url="file://$MODULE_DIR$/php/controleur" isTestSource="false" packagePrefix="controleur\" />
<sourceFolder url="file://$MODULE_DIR$/php/modeles" isTestSource="false" packagePrefix="modeles\" />
<excludeFolder url="file://$MODULE_DIR$/vendor/composer" />
<excludeFolder url="file://$MODULE_DIR$/vendor/symfony/polyfill-ctype" />
<excludeFolder url="file://$MODULE_DIR$/vendor/symfony/polyfill-mbstring" />
<excludeFolder url="file://$MODULE_DIR$/vendor/twig/twig" />
<excludeFolder url="file://$MODULE_DIR$/php/vendor/composer" />
<excludeFolder url="file://$MODULE_DIR$/php/vendor/symfony/polyfill-ctype" />
<excludeFolder url="file://$MODULE_DIR$/php/vendor/symfony/polyfill-mbstring" />
<excludeFolder url="file://$MODULE_DIR$/php/vendor/twig/twig" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />

@ -0,0 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="PublishConfigData" serverName="SAEALICAPHP">
<serverData>
<paths name="SAEALICAPHP">
<serverdata>
<mappings>
<mapping local="$PROJECT_DIR$" web="SAE_2A_FA-Reseau_ALICA/" />
</mappings>
</serverdata>
</paths>
</serverData>
</component>
</project>

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="DiscordProjectSettings">
<option name="show" value="ASK" />
<option name="description" value="" />
</component>
</project>

@ -4,8 +4,9 @@
<inspection_tool class="HtmlUnknownAttribute" enabled="true" level="WARNING" enabled_by_default="true">
<option name="myValues">
<value>
<list size="1">
<list size="2">
<item index="0" class="java.lang.String" itemvalue="center" />
<item index="1" class="java.lang.String" itemvalue="action" />
</list>
</value>
</option>

@ -1,14 +1,34 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="MessDetectorOptionsConfiguration">
<option name="transferred" value="true" />
</component>
<component name="PHPCSFixerOptionsConfiguration">
<option name="transferred" value="true" />
</component>
<component name="PHPCodeSnifferOptionsConfiguration">
<option name="highlightLevel" value="WARNING" />
<option name="transferred" value="true" />
</component>
<component name="PhpIncludePathManager">
<include_path>
<path value="$PROJECT_DIR$/vendor/composer" />
<path value="$PROJECT_DIR$/vendor/symfony/polyfill-ctype" />
<path value="$PROJECT_DIR$/vendor/symfony/polyfill-mbstring" />
<path value="$PROJECT_DIR$/vendor/twig/twig" />
<path value="$PROJECT_DIR$/php/vendor/symfony/polyfill-mbstring" />
<path value="$PROJECT_DIR$/php/vendor/symfony/polyfill-ctype" />
<path value="$PROJECT_DIR$/php/vendor/composer" />
<path value="$PROJECT_DIR$/php/vendor/twig/twig" />
</include_path>
</component>
<component name="PhpProjectSharedConfiguration" php_language_level="8.1">
<option name="suggestChangeDefaultLanguageLevel" value="false" />
</component>
<component name="PhpStanOptionsConfiguration">
<option name="transferred" value="true" />
</component>
<component name="PsalmOptionsConfiguration">
<option name="transferred" value="true" />
</component>
</project>

@ -0,0 +1,66 @@
<?php
use Twig\Environment;
use Twig\Error\LoaderError;
use Twig\Error\RuntimeError;
use Twig\Extension\SandboxExtension;
use Twig\Markup;
use Twig\Sandbox\SecurityError;
use Twig\Sandbox\SecurityNotAllowedTagError;
use Twig\Sandbox\SecurityNotAllowedFilterError;
use Twig\Sandbox\SecurityNotAllowedFunctionError;
use Twig\Source;
use Twig\Template;
/* accueil.html */
class __TwigTemplate_3d5cf680e70c0069d652ab3d71cf7eef extends Template
{
private $source;
private $macros = [];
public function __construct(Environment $env)
{
parent::__construct($env);
$this->source = $this->getSourceContext();
$this->parent = false;
$this->blocks = [
];
}
protected function doDisplay(array $context, array $blocks = [])
{
$macros = $this->macros;
// line 1
echo "<!DOCTYPE html>
<html lang=\"fr\">
<head>
<meta charset=\"UTF-8\" />
<meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\" />
<title>Alica - Accueil</title>
</head>
<body>
</body>
</html>
";
}
public function getTemplateName()
{
return "accueil.html";
}
public function getDebugInfo()
{
return array ( 37 => 1,);
}
public function getSourceContext()
{
return new Source("", "accueil.html", "/Applications/MAMP/htdocs/SAE_2A_FA-Reseau_ALICA/php/vues/accueil.html");
}
}

@ -42,11 +42,13 @@ class FrontControleur
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
]);

@ -2,7 +2,73 @@
namespace controleur;
use Twig\Error\LoaderError;
use Twig\Error\RuntimeError;
use Twig\Error\SyntaxError;
class UtilisateurControleur
{
//Ce controlleur est appelé par le FrontControleur uniquement si l'action demandée est 'utilisateur' (un user lambda non connecté)
public function __construct()
{
global $twig; // nécessaire pour utiliser variables globales
// on démarre ou reprend la session pas utilisée ici
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;
case 'connection':
$this->connection();
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[] = 'TODO ';
} catch (\Exception $e2) {
$dVueEreur[] = 'TODO ';
echo $twig->render('erreur.html', ['dVueEreur' => $dVueEreur]);
}
//fin
exit(0);
}//fin constructeur
/**
* @throws SyntaxError
* @throws RuntimeError
* @throws LoaderError
*/
private function connection()
{
global $twig;
echo $twig->render('connection.html', []);
}
public function reinit()
{
global $twig;
$dVue = [
'session' => ''
];
var_dump($dVue);
echo $twig->render('accueil.html', [
'dVue' => $dVue
]);
}
}

BIN
php/css/.DS_Store vendored

Binary file not shown.

@ -0,0 +1,124 @@
@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;
}
.container{
position: relative;
width: 350px;
min-height: 500px;
display: flex;
justify-content: center;
align-items: center;
background: #2f363e;
box-shadow: 25px 25px 75px rgba(0,0,0,0.25),
10px 10px 70px rgba(0,0,0,0.25),
inset 5px 5px 10px rgba(0, 0, 0, 0.5),
inset 5px 5px 10px rgba(255, 255, 255, 0.2),
inset -5px -5px 15px rgba(0, 0, 0, 0.75);
border-radius: 30px;
padding: 50px;
}
form{
position: relative;
width: 100%;
}
.container h3{
color: #fff;
font-weight: 600;
font-size: 2em;
width: 100%;
text-align: center;
margin-bottom: 30px;
letter-spacing: 2px;
text-transform: uppercase;
}
.CadreInput
{
position: relative;
width: 100%;
margin-bottom: 20px;
}
.CadreInput span{
display: inline-block;
color: #fff;
margin-bottom: 10px;
text-transform: uppercase;
letter-spacing: 1px;
font-size: 0.75em;
border-left: 4px solid #fff;
padding-left: 4px;
line-height: 1em;
}
.CadreInput .box{
display: flex;
}
.CadreInput .box .icon{
position: relative;
min-width: 40px;
height: 40px;
background-color: #a50b12;
display: flex;
justify-content: center;
align-items: center;
border-radius: 50%;
margin-right: 10px;
color: #fff;
font-size: 1.15em;
box-shadow: 5px 5px 7px rgba(0, 0, 0, 0.25),
inset 2px 2px 5px rgba(255, 255, 255, 0.25),
inset -3px -3px 5px rgba(0, 0, 0, 0.5);
}
.CadreInput .box input{
position: relative;
width: 100%;
border: none;
outline: none;
padding: 10px 20px;
border-radius: 30px;
text-transform: uppercase;
letter-spacing: 1px;
font-size: 0.85em;
box-shadow: 5px 5px 7px rgba(0, 0, 0, 0.25),
inset 2px 2px 5px rgba(255, 255, 255, 0.25),
inset -3px -3px 5px rgba(0, 0, 0, 0.5);
}
.CadreInput .box input[type="submit"]{
background-color: #04070a;
box-shadow: 5px 5px 7px rgba(0, 0, 0, 0.25),
inset 2px 2px 5px rgba(255, 255, 255, 0.25),
inset -3px -3px 5px rgba(0, 0, 0, 0.5);
color: #fff;
cursor: pointer;
text-transform: uppercase;
letter-spacing: 2px;
font-weight: 600;
margin-top: 10px;
}
label{
color: #fff;
text-transform: uppercase;
letter-spacing: 1px;
font-size: 0.85em;
display: flex;
align-items: center;
}
label input{
margin-right: 5px;
}
.forgot{
color: #fff;
text-transform: uppercase;
letter-spacing: 1px;
font-size: 0.85em;
}

@ -0,0 +1,140 @@
@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;
}
a{
text-decoration: none;
}
body{
display: flex;
justify-content: center;
align-items: center;
min-height: 100vh;
background: #2f363e;
}
.container{
position: relative;
width: 350px;
min-height: 500px;
display: flex;
justify-content: center;
align-items: center;
background: #2f363e;
box-shadow: 25px 25px 75px rgba(0,0,0,0.25),
10px 10px 70px rgba(0,0,0,0.25),
inset 5px 5px 10px rgba(0, 0, 0, 0.5),
inset 5px 5px 10px rgba(255, 255, 255, 0.2),
inset -5px -5px 15px rgba(0, 0, 0, 0.75);
border-radius: 30px;
padding: 50px;
}
form{
position: relative;
width: 100%;
}
.container h3{
color: #fff;
font-weight: 600;
font-size: 2em;
width: 100%;
text-align: center;
margin-bottom: 30px;
letter-spacing: 2px;
text-transform: uppercase;
}
.container a:link {
color: #fff;
}
.container a:visited {
color: #fff;
}
.container a:hover {
color: #fff;
}
.container a:active {
color: #fff;
}
.CadreInput
{
position: relative;
width: 100%;
margin-bottom: 20px;
}
.CadreInput span{
display: inline-block;
color: #fff;
margin-bottom: 10px;
text-transform: uppercase;
letter-spacing: 1px;
font-size: 0.75em;
border-left: 4px solid #fff;
padding-left: 4px;
line-height: 1em;
}
.CadreInput .box{
display: flex;
}
.CadreInput .box .icon{
position: relative;
min-width: 40px;
height: 40px;
background-color: #a50b12;
display: flex;
justify-content: center;
align-items: center;
border-radius: 50%;
margin-right: 10px;
color: #fff;
font-size: 1.15em;
box-shadow: 5px 5px 7px rgba(0, 0, 0, 0.25),
inset 2px 2px 5px rgba(255, 255, 255, 0.25),
inset -3px -3px 5px rgba(0, 0, 0, 0.5);
}
.CadreInput .box input{
position: relative;
width: 100%;
border: none;
outline: none;
padding: 10px 20px;
border-radius: 30px;
text-transform: uppercase;
letter-spacing: 1px;
font-size: 0.85em;
box-shadow: 5px 5px 7px rgba(0, 0, 0, 0.25),
inset 2px 2px 5px rgba(255, 255, 255, 0.25),
inset -3px -3px 5px rgba(0, 0, 0, 0.5);
}
.CadreInput .box input[type="submit"]{
background-color: #04070a;
box-shadow: 5px 5px 7px rgba(0, 0, 0, 0.25),
inset 2px 2px 5px rgba(255, 255, 255, 0.25),
inset -3px -3px 5px rgba(0, 0, 0, 0.5);
color: #fff;
cursor: pointer;
text-transform: uppercase;
letter-spacing: 2px;
font-weight: 600;
margin-top: 10px;
}
label{
color: #fff;
text-transform: uppercase;
letter-spacing: 1px;
font-size: 0.85em;
display: flex;
align-items: center;
}
label input{
margin-right: 5px;
}
.forgot{
color: #fff;
text-transform: uppercase;
letter-spacing: 1px;
font-size: 0.85em;
}

@ -0,0 +1,125 @@
@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;
text-decoration: none;
}
body{
display: flex;
justify-content: center;
align-items: center;
min-height: 100vh;
background: #2f363e;
}
.container{
position: relative;
width: 350px;
min-height: 500px;
display: flex;
justify-content: center;
align-items: center;
background: #2f363e;
box-shadow: 25px 25px 75px rgba(0,0,0,0.25),
10px 10px 70px rgba(0,0,0,0.25),
inset 5px 5px 10px rgba(0, 0, 0, 0.5),
inset 5px 5px 10px rgba(255, 255, 255, 0.2),
inset -5px -5px 15px rgba(0, 0, 0, 0.75);
border-radius: 30px;
padding: 50px;
}
form{
position: relative;
width: 100%;
}
.container h3{
color: #fff;
font-weight: 600;
font-size: 2em;
width: 100%;
text-align: center;
margin-bottom: 30px;
letter-spacing: 2px;
text-transform: uppercase;
}
.CadreInput
{
position: relative;
width: 100%;
margin-bottom: 20px;
}
.CadreInput span{
display: inline-block;
color: #fff;
margin-bottom: 10px;
text-transform: uppercase;
letter-spacing: 1px;
font-size: 0.75em;
border-left: 4px solid #fff;
padding-left: 4px;
line-height: 1em;
}
.CadreInput .box{
display: flex;
}
.CadreInput .box .icon{
position: relative;
min-width: 40px;
height: 40px;
background-color: #a50b12;
display: flex;
justify-content: center;
align-items: center;
border-radius: 50%;
margin-right: 10px;
color: #fff;
font-size: 1.15em;
box-shadow: 5px 5px 7px rgba(0, 0, 0, 0.25),
inset 2px 2px 5px rgba(255, 255, 255, 0.25),
inset -3px -3px 5px rgba(0, 0, 0, 0.5);
}
.CadreInput .box input{
position: relative;
width: 100%;
border: none;
outline: none;
padding: 10px 20px;
border-radius: 30px;
text-transform: uppercase;
letter-spacing: 1px;
font-size: 0.85em;
box-shadow: 5px 5px 7px rgba(0, 0, 0, 0.25),
inset 2px 2px 5px rgba(255, 255, 255, 0.25),
inset -3px -3px 5px rgba(0, 0, 0, 0.5);
}
.CadreInput .box input[type="submit"]{
background-color: #04070a;
box-shadow: 5px 5px 7px rgba(0, 0, 0, 0.25),
inset 2px 2px 5px rgba(255, 255, 255, 0.25),
inset -3px -3px 5px rgba(0, 0, 0, 0.5);
color: #fff;
cursor: pointer;
text-transform: uppercase;
letter-spacing: 2px;
font-weight: 600;
margin-top: 10px;
}
label{
color: #fff;
text-transform: uppercase;
letter-spacing: 1px;
font-size: 0.85em;
display: flex;
align-items: center;
}
label input{
margin-right: 5px;
}
.login{
color: #fff;
text-transform: uppercase;
letter-spacing: 1px;
font-size: 0.85em;
}

@ -9,7 +9,8 @@ use controleur\FrontControleur;
/** Configuration twig */
$loader = new \Twig\Loader\FilesystemLoader('vues');
$twig = new \Twig\Environment($loader, [
'cache' => __DIR__.'/cache',
'cache' => false,
'debug' => true
]);
$cont = new FrontControleur();
$cont = new \controleur\UtilisateurControleur();

@ -6,7 +6,16 @@
<title>Alica - Accueil</title>
</head>
<body>
<body>
<h1>Accueil</h1>
<p>Vous êtes sur la page d'accueil</p>
<p>Vous pouvez vous connecter ou vous inscrire</p>
<p>Vous pouvez aussi consulter les articles</p>
<p>Vous pouvez aussi consulter les articles</p>
<p>Connection :</p>
<form action="index.php?action=connection" method="POST">
<input type="submit" value="S'identifier">
</form>
</body>
</html>

@ -0,0 +1,45 @@
<!DOCTYPE html>
<html lang="fr">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Alica - Connection</title>
<link rel="stylesheet" type="text/css" href="css/login.css">
</head>
<body>
<div class="container">
<form action="" method="POST">
<h3>S'identifier</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>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>
<label>
<input type="checkbox">Se souvenir de moi
</label>
<div class="CadreInput">
<div class="box">
<div class="icon"></div>
<input type="submit" value="S'identifier">
</div>
</div>
<a href="#" class="forgot">Mot de passe oublié</a>
<br><a href="" class="register">S'inscrire</a>
</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…
Cancel
Save