debut correction (conection et quiz a finir)

pull/21/head
brongniart 5 months ago
parent 8d8a6de0e1
commit aa39b5db37

@ -21,6 +21,7 @@ $vues['signin'] = 'vue/signin.php';
$vues['quiz'] = 'vue/quiz.html';
$vues['search'] = 'vue/search.php';
$vues['favorite'] = 'vue/favorits.php';
$vues['profil'] = 'vue/profil.php';

@ -7,7 +7,7 @@ Class FrontControler{
private $listAction;
private string $role = 'user'; //Mettre en admin le temps de créer les comptes
private string $role = 'visitor'; //Mettre en admin le temps de créer les comptes
private Connection $co;
@ -15,7 +15,7 @@ Class FrontControler{
global $twig;
$this->listAction = ['visitor' => array('accueil','search','quote','login','signin'),
'user' => array('quiz','commentary','logout','addComment','favorite'),
'user' => array('quiz','commentary','logout','addComment','favorite','profil'),
'admin' => array('null')];
$dVueEreur = [];
@ -36,12 +36,13 @@ Class FrontControler{
$router->map('GET|POST', '/quote/[i:idQuote]', 'VisitorControler','quote');
$router->map('GET|POST', '/login', 'VisitorControler','login');
$router->map('GET|POST', '/signin', 'VisitorControler','signin');
$router->map('GET|POST', '/addComment', 'UserControler','addComment');
$router->map('GET|POST', '/quiz/[i:id]?', 'QuizControler','quiz');
$router->map('GET|POST', '/favorite', 'UserControler','favorite');
$router->map('GET|POST', '/search', 'VisitorControler','search');
$router->map('GET|POST', '/profil', 'UserControler','profil');
$router->map('GET|POST', '/login', 'VisitorControler','login');
$router->map('GET|POST', '/signin', 'VisitorControler','signin');
$match = $router->match();
@ -67,13 +68,12 @@ Class FrontControler{
$controller='VisitorControler';
}
else {
$controller = '\\Controleur\\' . $controller;
$controller = new $controller($co);
if (is_callable(array($controller, $action))) {
call_user_func_array(array($controller, $action),
array($match['params']));
}
$controller = '\\Controleur\\' . $controller;
$controller = new $controller($co);
if (is_callable(array($controller, $action))) {
call_user_func_array(array($controller, $action),
array($match['params']));
}
}

@ -22,6 +22,12 @@ class UserControler {
$this->uMod = new UserModel(new UserGateway($co));
}
public function profil() {
global $vues;
require_once $vues['profil'];
}
public function quiz() {
global $vues;
require_once $vues['quiz'];

@ -37,12 +37,51 @@ Class VisitorControler {
global $co;
$this->qMod = new QuoteModel(new QuoteGateway($co));
$this->cMod = new CommentaryModel(new CommentaryGateway($co));
$this->sMod = new SearchModel(new QuoteGateway($co));
$this->accueilGateway = new AccueilGateway($co);
$this->gw = new UserGateway($co);
$this->mdl = new UserModel($this->gw);
$this -> getAction($action);
}
public function accueil(){
global $vues;
// Récupérer la citation du jour via AccueilGateway
$citationDuJour = $this->accueilGateway->getQuoteOfTheDay('fr');
$suggestions = $this->accueilGateway->getSuggestions(0, 'fr');
// Passer les données à la vue
require_once $vues['accueil'];
}
public function quote(array $arg){
global $vues;
$id= $arg['idQuote'] ?? 1;
$q = $this->qMod->searchId($id);
$c = $this->cMod->getComment($id);
require_once $vues['quote'];
}
public function favorite() {
global $vues;
require_once $vues['favorite'];
}
public function search(array $arg){
global $vues;
$type = ($_POST['type'] ?? "");
$search = ($_POST['search'] ?? NULL);
$filtre = ($arg['filtre'] ?? []);
$tq=$this->sMod->searchQuote($type,$search,$filtre);
require_once $vues['search'];
}
/**
* @throws SyntaxError
* @throws RuntimeError
@ -68,34 +107,19 @@ Class VisitorControler {
}
}
public function accueil(){
global $vues;
// Récupérer la citation du jour via AccueilGateway
$citationDuJour = $this->accueilGateway->getQuoteOfTheDay('fr');
$suggestions = $this->accueilGateway->getSuggestions(0, 'fr');
// Passer les données à la vue
require_once $vues['accueil'];
}
public function quote(array $arg){
global $vues;
$id= $arg['idQuote'] ?? 1;
$q = $this->qMod->searchId($id);
$c = $this->cMod->getComment($id);
require_once $vues['quote'];
}
/**
* @throws SyntaxError
* @throws RuntimeError
* @throws LoaderError
*/
public function visitorLogIn(): void
public function login()
{
global $twig;
echo $twig->render("login.html.twig");
global $vues;
require_once $vues['login'];
// global $twig;
// echo $twig->render("login.html.twig");
$this -> toLogIn();
}
@ -141,7 +165,7 @@ Class VisitorControler {
* @throws RuntimeError
* @throws LoaderError
*/
public function visitorSignIn(): void
public function signin(): void
{
global $twig;
echo $twig->render("signin.html.twig");
@ -194,22 +218,4 @@ Class VisitorControler {
header("Location: /");
}
}
public function favorite() {
global $vues;
require_once $vues['favorite'];
}
public function search(array $arg){
global $vues;
$type = ($_POST['type'] ?? "");
$search = ($_POST['search'] ?? NULL);
$filtre = ($arg['filtre'] ?? []);
$tq=$this->sMod->searchQuote($type,$search,$filtre);
require_once $vues['search'];
}
}

@ -9,5 +9,5 @@
));
echo $twig->render('bandeau.html.twig');
echo $twig->render('login.html');
echo $twig->render('login.html.twig');
?>

@ -1,18 +1,21 @@
<?php
global $twig;
// appele avec index.php ne pas mettre si controleur fonctionnel
require __DIR__ . '/../vendor/autoload.php';
$loader = new \Twig\Loader\FilesystemLoader('templates');
$twig = new \Twig\Environment($loader, [
'cache' => false,
echo $twig->render('head.html.twig', [
'title' => "Accueil",
'style' => "public/styles/styleProfil.css",
'scripts' => array("public/script/theme-toggle.js")
]);
//
echo $twig->render('profil.html', array(
// Rendu du bandeau
echo $twig->render('bandeau.html.twig');
echo $twig->render('profil.html.twig', array(
'srcUsername' => "Test User",
'srcEmail' => "test@gmail.com",
'srcPasswd' => "*****",
'srcImg' => "../images/imageProfil.png",
'srcImg' => "images/imageProfil.png",
));
?>

@ -8,7 +8,7 @@
'scripts' => array("../public/script/theme-toggle-double-param.js")
));
echo $twig->render('bandeau.html.twig');
echo $twig->render('quote.html', array(
echo $twig->render('quote.html.twig', array(
'srcImg' => $q->getImgPath(),
'nameCarac' => $q->getCarac(),
'quoteContent' => $q->getContent(),

@ -5,6 +5,7 @@
echo $twig->render('head.html.twig', array(
'title' => "Quote",
'style' => "public/styles/styleSearch.css",
'scripts' => array("public/script/theme-toggle.js")
));
echo $twig->render('bandeau.html.twig');

@ -8,14 +8,13 @@
<div class="logo">
<a href="{{ racine }}/"><img src="{{ racine }}/images/WIKIFANTASY.png" alt="Logo" width="227px" height="106px" onmousedown="return false"></a>
</div>
<div class="user">
<a href="{{ racine }}/login"><img src="{{ racine }}/images/user_dark.png" alt="user" width="70px" height="70px" onmousedown="return false"></a>
</div>
<div class="search">
<a href="{{ racine }}/search"><img src="images/search.png" alt="search" width="50px" height="50px" onmousedown="return false"></a>
</div>
<a href="{{ racine }}/login"><img src="images/user_dark.png" alt="user" width="70px" height="70px" onmousedown="return false"></a>
<div class="search">
<a href="{{ racine }}/search"><img src="{{ racine }}/images/search.png" alt="search" width="50px" height="50px" onmousedown="return false"></a>
</div>
<a href="{{ racine }}/profil"><img src="{{ racine }}/images/user_dark.png" alt="user" width="70px" height="70px" onmousedown="return false"></a>
</div>
</div>

@ -39,7 +39,7 @@
{% endif %}
<div class="createAccount">
<p class="createAccount">Vous n'avez de compte?</p>
<a href="/signin" class="createAccount">S'incrire</a>
<a href="{{ racine }}/signin" class="createAccount">S'incrire</a>
</div>

@ -1,34 +1,9 @@
<!DOCTYPE html>
<html lang="fr">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" type="text/css" href="../../public/styles/styleProfil.css" media="screen">
<title>Wiki Fantasy : Profil</title>
<link id="favicon" rel="icon" href="../images/iconeSombre.ico"> <!-- Par défaut sombre -->
<link href="https://fonts.googleapis.com/css2?family=Lemon&display=swap" rel="stylesheet">
<script defer src="../public/script/theme-toggle.js"></script>
<script defer src="../public/script/changeData.js"></script>
</head>
<body>
<div class="container">
<div class="header">
<div class="nav">
<img src="../images/coeur.svg" alt="coeur" width="67px" height="67px" onmousedown="return false">
<img id="theme-icon" src="../images/light.svg" alt="toggle theme" width="72px" height="37px" onmousedown="return false" onclick="toggleTheme()">
<img src="../images/quizz.svg" alt="quizz" width="51px" height="82px" onmousedown="return false">
</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>
</div>
<div class="login">
<h1>▶ Profil ◀</h1>
<img src="{{ srcImg }}" class="imageProfil" onmousedown="return false"/>
<img src="{{ racine }}/{{ srcImg }}" class="imageProfil" onmousedown="return false"/>
<p class="infoProfil"> <strong>{{ srcUsername }}</strong><img class='imgModify' src='../images/modify.svg'/></p>
@ -42,7 +17,7 @@
<div class="languageDiv">
<p class="languageTitle">Language :</p>
</div>
<img class="languageImage" src="../images/drapeauFrance.png" onmousedown="return false"/>
<img class="languageImage" src="{{ racine }}/images/drapeauFrance.png" onmousedown="return false"/>
<div class="createQuote">
<a href="rien" class="createQuote">Ajouter une citation</a>

Loading…
Cancel
Save