Controleur pour la page Login (Kentin)

pull/17/head
Leni BEAULATON 6 months ago
parent d632844cf8
commit 03e5e48b3f

@ -0,0 +1,90 @@
<?php
use Twig\Environment;
use Twig\Error\LoaderError;
use Twig\Error\RuntimeError;
use Twig\Extension\CoreExtension;
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;
use Twig\TemplateWrapper;
/* head.html.twig */
class __TwigTemplate_eb23fe14e9c99cb057475369e77b2ea7 extends Template
{
private Source $source;
/**
* @var array<string, Template>
*/
private array $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 = []): iterable
{
$macros = $this->macros;
// line 1
yield "<!DOCTYPE html>
<html lang=\"fr\">
<head>
<meta charset=\"UTF-8\">
<meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">
<title>";
// line 6
yield $this->env->getRuntime('Twig\Runtime\EscaperRuntime')->escape(($context["title"] ?? null), "html", null, true);
yield "</title>
<link rel=\"stylesheet\" href=\"";
// line 7
yield $this->env->getRuntime('Twig\Runtime\EscaperRuntime')->escape(($context["style"] ?? null), "html", null, true);
yield "\">
<link id=\"favicon\" rel=\"icon\" href=\"../../public/images/iconeSombre.ico\" />
<script src=\"../public/script/theme-toggle.js\"></script>
</head>
";
yield from [];
}
/**
* @codeCoverageIgnore
*/
public function getTemplateName(): string
{
return "head.html.twig";
}
/**
* @codeCoverageIgnore
*/
public function isTraitable(): bool
{
return false;
}
/**
* @codeCoverageIgnore
*/
public function getDebugInfo(): array
{
return array ( 53 => 7, 49 => 6, 42 => 1,);
}
public function getSourceContext(): Source
{
return new Source("", "head.html.twig", "/home/www/lebeaulato/public_html/WF-Website/vue/templates/head.html.twig");
}
}

@ -0,0 +1,78 @@
<?php
use Twig\Environment;
use Twig\Error\LoaderError;
use Twig\Error\RuntimeError;
use Twig\Extension\CoreExtension;
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;
use Twig\TemplateWrapper;
/* bandeau.html.twig */
class __TwigTemplate_012dc2aef67e620d386f46e331598640 extends Template
{
private Source $source;
/**
* @var array<string, Template>
*/
private array $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 = []): iterable
{
$macros = $this->macros;
// line 1
yield "<div class=\"header\">
<div class=\"nav\">
<a href=\"favorite.html\"><img src=\"../images/coeur.svg\" alt=\"coeur\" width=\"67px\" height=\"67px\" onmousedown=\"return false\"></a>
<img id=\"theme-icon\" src=\"../images/light.svg\" alt=\"toggle theme\" width=\"72px\" height=\"37px\" onmousedown=\"return false\" onclick=\"toggleTheme()\">
<a href=\"quiz.html\"><img src=\"../images/quizz.svg\" alt=\"quizz\" width=\"51px\" height=\"82px\" onmousedown=\"return false\"></a>
</div>
<div class=\"logo\">
<a href=\"accueil.html\"><img src=\"../images/WIKIFANTASY.png\" alt=\"Logo\" width=\"227px\" height=\"106px\" onmousedown=\"return false\"></a>
</div>
<div class=\"user\">
<a href=\"profil.html\"><img src=\"../images/user_dark.png\" alt=\"user\" width=\"70px\" height=\"70px\" onmousedown=\"return false\"></a>
</div>
</div>";
yield from [];
}
/**
* @codeCoverageIgnore
*/
public function getTemplateName(): string
{
return "bandeau.html.twig";
}
/**
* @codeCoverageIgnore
*/
public function getDebugInfo(): array
{
return array ( 42 => 1,);
}
public function getSourceContext(): Source
{
return new Source("", "bandeau.html.twig", "/home/www/lebeaulato/public_html/WF-Website/vue/templates/bandeau.html.twig");
}
}

@ -17,6 +17,7 @@ $mdp = '';
$vues['erreur'] = 'vue/erreur.php';
$vues['accueil'] = 'vue/accueil.php';
$vues['quote'] = 'vue/quote.php';
$vues['login'] = 'vue/login.html';
//Style css
$style['accueil'] = 'public/styles/styleAccueil.css';

@ -30,6 +30,7 @@ Class FrontControler{
*/
$router->map('GET|POST', '/quote/[i:idQuote]?', 'VisitorControler');
$router->map('GET|POST', '/login', 'VisitorControler');
$match = $router->match();
$action = NULL;
@ -54,6 +55,12 @@ Class FrontControler{
$this->vueErreur($dVueEreur);
}
if(!$this->verifDroit($action)){
$action='login';
$controller='VisitorControler';
}
$controller = '\\Controleur\\' . $controller;
$controller = new $controller;
if (is_callable(array($controller, $action))) {
@ -77,9 +84,9 @@ Class FrontControler{
}
private function verifDroit(string $action):bool {
if( in_array($action , $listAction['admin']) && $role == 'admin') return true;
elseif( in_array($action , $listAction['user']) && ($role == 'admin' || $role == 'user') ) return true;
elseif(in_array($action , $listAction['visitor']) && ($role == 'admin'|| $role == 'user'|| $role == 'visitor')) return true;
if( in_array($action , $this->listAction['admin']) && $this->role == 'admin') return true;
elseif( in_array($action , $this->listAction['user']) && ($this->role == 'admin' || $this->role == 'user') ) return true;
elseif(in_array($action , $this->listAction['visitor']) && ($this->role == 'admin'|| $this->role == 'user'|| $this->role == 'visitor')) return true;
return false;
}

@ -16,4 +16,10 @@ Class VisitorControler{
require_once $vues['quote'];
}
public function login(){
global $vues;
require_once $vues['login'];
}
}

@ -1,13 +1,15 @@
<?php
// appele avec index.php ne pas metre si controleur fonctionnel
//appele avec index.php ne pas metre si controleur fonctionnel
require __DIR__ . '/../vendor/autoload.php';
$loader = new \Twig\Loader\FilesystemLoader('vue/templates');
$twig = new \Twig\Environment($loader, [
'cache' => false,
]);
//
//global $twig;
echo $twig->render('head.html.twig', array(
'title' => "Quote",
'style' => "../public/styles/styleQuote.css",

Loading…
Cancel
Save