debut du merge

pull/21/head
brongniart 5 months ago
commit 59e2154c5f

@ -1,19 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="dataSourceStorageLocal" created-in="PS-241.18034.69">
<data-source name="dbwikifantasy" uuid="351a7e7c-c4d1-4e89-bf03-667b32764270">
<database-info product="PostgreSQL" version="14.13 (Homebrew)" jdbc-version="4.2" driver-name="PostgreSQL JDBC Driver" driver-version="42.6.0" dbms="POSTGRES" exact-version="14.13" exact-driver-version="42.6">
<identifier-quote-string>&quot;</identifier-quote-string>
</database-info>
<case-sensitivity plain-identifiers="lower" quoted-identifiers="exact" />
<secret-storage>master_key</secret-storage>
<schema-mapping>
<introspection-scope>
<node kind="database" qname="@">
<node kind="schema" qname="@" />
</node>
</introspection-scope>
</schema-mapping>
</data-source>
</component>
</project>

@ -1,12 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="DataSourceManagerImpl" format="xml" multifile-model="true">
<data-source source="LOCAL" name="dbwikifantasy" uuid="351a7e7c-c4d1-4e89-bf03-667b32764270">
<driver-ref>postgresql</driver-ref>
<synchronize>true</synchronize>
<jdbc-driver>org.postgresql.Driver</jdbc-driver>
<jdbc-url>jdbc:postgresql://localhost:5432/dbwikifantasy</jdbc-url>
<working-dir>$ProjectFileDir$</working-dir>
</data-source>
</component>
</project>

File diff suppressed because it is too large Load Diff

@ -1,10 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="MaterialThemeProjectNewConfig">
<option name="metadata">
<MTProjectMetadataState>
<option name="userId" value="5c5a39c9:192fb929d1e:-7ffa" />
</MTProjectMetadataState>
</option>
</component>
</project>

@ -1,33 +0,0 @@
<?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/altorouter/altorouter" />
<path value="$PROJECT_DIR$/vendor/twig/twig" />
<path value="$PROJECT_DIR$/vendor/symfony/polyfill-ctype" />
<path value="$PROJECT_DIR$/vendor/symfony/polyfill-php81" />
<path value="$PROJECT_DIR$/vendor/symfony/deprecation-contracts" />
<path value="$PROJECT_DIR$/vendor/symfony/polyfill-mbstring" />
</include_path>
</component>
<component name="PhpProjectSharedConfiguration" php_language_level="8.3">
<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>

@ -1,6 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="" vcs="Git" />
</component>
</project>

@ -1,131 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="AutoImportSettings">
<option name="autoReloadType" value="SELECTIVE" />
</component>
<component name="ChangeListManager">
<list default="true" id="afa12d51-331f-4dbc-a297-7289ad4e396d" name="Changes" comment="">
<change beforePath="$PROJECT_DIR$/composer.json" beforeDir="false" afterPath="$PROJECT_DIR$/composer.json" afterDir="false" />
<change beforePath="$PROJECT_DIR$/index.php" beforeDir="false" afterPath="$PROJECT_DIR$/index.php" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/Controleur/FrontControler.php" beforeDir="false" afterPath="$PROJECT_DIR$/src/Controleur/FrontControler.php" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/Controleur/QuizController.php" beforeDir="false" afterPath="$PROJECT_DIR$/src/Controleur/QuizController.php" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/Gateway/Connection.php" beforeDir="false" afterPath="$PROJECT_DIR$/src/Gateway/Connection.php" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/Gateway/QuestionGateway.php" beforeDir="false" afterPath="$PROJECT_DIR$/src/Gateway/QuestionGateway.php" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/Gateway/QuizGateway.php" beforeDir="false" afterPath="$PROJECT_DIR$/src/Gateway/QuizGateway.php" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/Model/QuestionModel.php" beforeDir="false" afterPath="$PROJECT_DIR$/src/Model/QuestionModel.php" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/Model/QuizQuestionModel.php" beforeDir="false" afterPath="$PROJECT_DIR$/src/Model/QuizQuestionModel.php" afterDir="false" />
<change beforePath="$PROJECT_DIR$/vendor/composer/autoload_psr4.php" beforeDir="false" afterPath="$PROJECT_DIR$/vendor/composer/autoload_psr4.php" afterDir="false" />
<change beforePath="$PROJECT_DIR$/vendor/composer/autoload_static.php" beforeDir="false" afterPath="$PROJECT_DIR$/vendor/composer/autoload_static.php" afterDir="false" />
<change beforePath="$PROJECT_DIR$/vue/accueil.php" beforeDir="false" afterPath="$PROJECT_DIR$/vue/accueil.php" afterDir="false" />
<change beforePath="$PROJECT_DIR$/vue/quiz.php" beforeDir="false" afterPath="$PROJECT_DIR$/vue/templates/quiz.html.twig" afterDir="false" />
</list>
<option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" />
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
<option name="LAST_RESOLUTION" value="IGNORE" />
</component>
<component name="ComposerSettings" synchronizationState="SYNCHRONIZE">
<pharConfigPath>$PROJECT_DIR$/composer.json</pharConfigPath>
<execution />
</component>
<component name="Git.Settings">
<excluded-from-favorite>
<branch-storage>
<map>
<entry type="LOCAL">
<value>
<list>
<branch-info repo="$PROJECT_DIR$" source="master" />
</list>
</value>
</entry>
</map>
</branch-storage>
</excluded-from-favorite>
<favorite-branches>
<branch-storage>
<map>
<entry type="LOCAL">
<value>
<list>
<branch-info repo="$PROJECT_DIR$" source="reorganisation" />
</list>
</value>
</entry>
</map>
</branch-storage>
</favorite-branches>
<option name="RECENT_BRANCH_BY_REPOSITORY">
<map>
<entry key="$PROJECT_DIR$" value="master" />
</map>
</option>
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
</component>
<component name="PhpWorkspaceProjectConfiguration" interpreter_name="/opt/homebrew/Cellar/php/8.3.8/bin/php">
<include_path>
<path value="$PROJECT_DIR$/vendor/composer" />
<path value="$PROJECT_DIR$/vendor/altorouter/altorouter" />
<path value="$PROJECT_DIR$/vendor/twig/twig" />
<path value="$PROJECT_DIR$/vendor/symfony/polyfill-ctype" />
<path value="$PROJECT_DIR$/vendor/symfony/polyfill-php81" />
<path value="$PROJECT_DIR$/vendor/symfony/deprecation-contracts" />
<path value="$PROJECT_DIR$/vendor/symfony/polyfill-mbstring" />
</include_path>
</component>
<component name="ProjectColorInfo">{
&quot;customColor&quot;: &quot;&quot;,
&quot;associatedIndex&quot;: 4
}</component>
<component name="ProjectId" id="2oQGGlghI0ydDNgxjOeok3kwC7m" />
<component name="ProjectViewState">
<option name="hideEmptyMiddlePackages" value="true" />
<option name="showLibraryContents" value="true" />
</component>
<component name="PropertiesComponent"><![CDATA[{
"keyToString": {
"RunOnceActivity.ShowReadmeOnStart": "true",
"git-widget-placeholder": "master",
"node.js.detected.package.eslint": "true",
"node.js.detected.package.tslint": "true",
"node.js.selected.package.eslint": "(autodetect)",
"node.js.selected.package.tslint": "(autodetect)",
"nodejs_package_manager_path": "npm",
"vue.rearranger.settings.migration": "true"
},
"keyToStringList": {
"DatabaseDriversLRU": [
"postgresql"
]
}
}]]></component>
<component name="RecentsManager">
<key name="MoveFile.RECENT_KEYS">
<recent name="$PROJECT_DIR$/vue/templates" />
</key>
</component>
<component name="SharedIndexes">
<attachedChunks>
<set>
<option value="bundled-js-predefined-1d06a55b98c1-0b3e54e931b4-JavaScript-PS-241.18034.69" />
<option value="bundled-php-predefined-ba97393d7c68-48a1a656d44e-com.jetbrains.php.sharedIndexes-PS-241.18034.69" />
</set>
</attachedChunks>
</component>
<component name="SpellCheckerSettings" RuntimeDictionaries="0" Folders="0" CustomDictionaries="0" DefaultDictionary="application-level" UseSingleDictionary="true" transferred="true" />
<component name="TaskManager">
<task active="true" id="Default" summary="Default task">
<changelist id="afa12d51-331f-4dbc-a297-7289ad4e396d" name="Changes" comment="" />
<created>1730794293135</created>
<option name="number" value="Default" />
<option name="presentableId" value="Default" />
<updated>1730794293135</updated>
<workItem from="1730794294713" duration="2741000" />
<workItem from="1730797544484" duration="27887000" />
</task>
<servers />
</component>
<component name="TypeScriptGeneratedFilesManager">
<option name="version" value="3" />
</component>
</project>

@ -0,0 +1,95 @@
<?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;
/* endQuiz.html.twig */
class __TwigTemplate_c06a302c21f2b7c0cffcc93742935dad 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>Wiki Fantasy : Quiz</title>
<link id=\"favicon\" rel=\"icon\" href=\"../../images/iconeSombre.ico\"> <!-- Par défaut sombre -->
<link rel=\"stylesheet\" href=\"../../public/styles/styleQuiz.css\">
<script defer src=\"../../public/script/theme-toggle.js\"></script>
</head>
<body>
<h2> ";
// line 14
yield $this->env->getRuntime('Twig\Runtime\EscaperRuntime')->escape(($context["score"] ?? null), "html", null, true);
yield " </h2>
</body>
</html>
";
yield from [];
}
/**
* @codeCoverageIgnore
*/
public function getTemplateName(): string
{
return "endQuiz.html.twig";
}
/**
* @codeCoverageIgnore
*/
public function isTraitable(): bool
{
return false;
}
/**
* @codeCoverageIgnore
*/
public function getDebugInfo(): array
{
return array ( 57 => 14, 42 => 1,);
}
public function getSourceContext(): Source
{
return new Source("", "endQuiz.html.twig", "/Users/kiem/Documents/WikiFantasy/WF-Website/vue/templates/endQuiz.html.twig");
}
}

@ -1,36 +1,38 @@
<?php
//gen
$rep = __DIR__ . '/../';
// liste des modules à inclure
//$dConfig['includes']= array('controleur/Validation.php');
//BD
$base = '';
$login = '';
$mdp = '';
//Vues
$vues['erreur'] = 'vue/erreur.php';
$vues['accueil'] = 'vue/accueil.php';
$vues['quote'] = 'vue/quote.php';
$vues['login'] = 'vue/login.php';
$vues['signin'] = 'vue/signin.php';
$vues['quiz'] = 'vue/quiz.html';
$vues['search'] = 'vue/search.php';
//Style css
$style['accueil'] = 'public/styles/styleAccueil.css';
//Script js
//Images
$image['default'] = 'public/images/default.jpg';
<?php
//gen
$rep = __DIR__ . '/../';
// liste des modules à inclure
//$dConfig['includes']= array('controleur/Validation.php');
//BD
$base = '';
$login = '';
$mdp = '';
//Vues
$vues['erreur'] = 'vue/erreur.php';
$vues['accueil'] = 'vue/accueil.php';
$vues['quote'] = 'vue/quote.php';
$vues['login'] = 'vue/login.php';
$vues['signin'] = 'vue/signin.php';
$vues['quiz'] = 'vue/quiz.html';
$vues['search'] = 'vue/search.php';
$vues['favorite'] = 'vue/favorits.php';
//Style css
$style['accueil'] = 'public/styles/styleAccueil.css';
//Script js
//Images
$image['default'] = 'public/images/default.jpg';

@ -1,30 +1,27 @@
<?php
session_start();
$_SESSION['role']='admin';
$_SESSION['login']=NULL;
$_SESSION['theme']='dark';
//chargement config
require_once __DIR__ . '/config/config.php';
require __DIR__ . '/vendor/autoload.php';
$co = new \Gateway\Connection('pgsql:host=localhost;dbname=dbkekentin;', 'kekentin', 'Chocolat-77');
//twig
$loader = new \Twig\Loader\FilesystemLoader('vue/templates');
$twig = new \Twig\Environment($loader, [
'cache' => false,
]);
$twig->addGlobal('racine','/~kekentin/WF/WF-Website');
$cont = new Controleur\FrontControler($co);
session_unset();
session_destroy();
$_SESSION = array();
?>
<?php
session_start();
$_SESSION['role']='admin';
$_SESSION['login']=NULL;
$_SESSION['theme']='dark';
//chargement config
require_once __DIR__ . '/config/config.php';
require __DIR__ . '/vendor/autoload.php';
$co = new \Gateway\Connection('pgsql:host=localhost;dbname=dbkekentin;', 'kekentin', 'Chocolat-77');
//twig
$loader = new \Twig\Loader\FilesystemLoader('vue/templates');
$twig = new \Twig\Environment($loader, [
'cache' => false,
]);
$twig->addGlobal('racine','/~kekentin/WF/WF-Website');
$cont = new Controleur\FrontControler($co);
?>

@ -1,24 +1,24 @@
@import url(./style.css); /* Import de style.css */
@import url(./styleQuoteLittle.css);
/* Conteneur général pour les citations */
.citations-section {
display: flex;
flex-direction: column;
gap: 20px;
padding: 20px 0;
align-items: center;
width: 100%;
margin: 0 0;
}
/* Citation du jour - toujours en pleine largeur */
.citation-du-jour {
width: 90%; /* Prend toute la largeur */
background: linear-gradient(to right, #ff5722, #ff9800); /* Dégradé spécial pour la citation du jour */
padding: 0;
overflow: hidden;
margin-bottom: 20px;
height: 150px;
}
@import url(./style.css); /* Import de style.css */
@import url(./styleQuoteLittle.css);
/* Conteneur général pour les citations */
.citations-section {
display: flex;
flex-direction: column;
gap: 20px;
padding: 20px 0;
align-items: center;
width: 100%;
margin: 0 0;
}
/* Citation du jour - toujours en pleine largeur */
.citation-du-jour {
width: 90%; /* Prend toute la largeur */
background: linear-gradient(to right, #ff5722, #ff9800); /* Dégradé spécial pour la citation du jour */
padding: 0;
overflow: hidden;
margin-bottom: 20px;
height: 150px;
}

@ -16,16 +16,17 @@ Class FrontControler{
$this->listAction = ['visitor' => array('accueil','search','quote','login','signin'),
'user' => array('quiz','commentary','favorite','logout'),
'admin' => array('null')];
$this->listAction = ['visitor' => array('accueil','search','quote','login','signin', 'favorite'),
'user' => array('quiz','commentary','logout'),
'admin' => array('null')];
$dVueEreur = [];
$router = new \AltoRouter();
$router->setBasePath('/~kekentin/WF/WF-Website');
$router->map('GET', '/', 'VisitorControler','accueil');
/*
@ -37,10 +38,12 @@ Class FrontControler{
'' => '[^/\.]++'
*/
$router->map('GET', '/quote/[i:idQuote]?', 'VisitorControler','quote');
$router->map('GET', '/login', 'VisitorControler','login');
$router->map('GET', '/signin', 'VisitorControler','signin');
$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', '/favorite', 'VisitorControler','favorite');
$router->map('GET', '/quiz/[i:id]?', 'QuizControler','quiz');
$router->map('GET|POST', '/search', 'VisitorControler','search');

@ -1,144 +1,158 @@
<?php
namespace Controleur;
use Entity\QuestionEntity;
use Gateway\Connection;
use Gateway\QuestionGateway;
use Gateway\QuizGateway;
use Gateway\QuizQuestionGateway;
use Model\QuestionModel;
use Model\QuizModel;
use Model\QuizQuestionModel;
use Twig\Environment;
use Twig\Error\LoaderError;
use Twig\Error\RuntimeError;
use Twig\Error\SyntaxError;
use Twig\Loader\FilesystemLoader;
class QuizControler
{
private int $no_question = 0;
private Connection $co;
private QuestionGateway $gw;
private QuestionModel $mdl;
/**
* @throws SyntaxError
* @throws RuntimeError
* @throws LoaderError
*/
public function __construct(Connection $co)
{
$this -> co = $co;
$this -> gw = new QuestionGateway($this->co);
$this -> mdl = new QuestionModel($this->gw);
$loader = new FilesystemLoader('vue/templates');
$action = $_REQUEST['action'] ?? null;
$id = (int) explode('/', $_SERVER['REQUEST_URI'])[2] ?? null;
switch ($action) {
case 'canswer':
if ($this->CorrectAnswer())
echo "Bonne réponse";
else echo "Mauvaise réponse";
$this->no_question ++;
echo $this->no_question;
$this->showQuestion($id, $this->no_question);
break;
default:
switch($id)
{
case null:
// page erreur
break;
default:
$this->showQuestion($id, $this->no_question);
break;
}
}
}
public function CorrectAnswer() : bool
{
$answera = $_POST['answera'] ?? null;
$answerb = $_POST['answerb'] ?? null;
$answerc = $_POST['answerc'] ?? null;
$answerd = $_POST['answerd'] ?? null;
$id= null;
$answer = null;
if ($answera) {
$answer = explode('-', $answera)[0];
$id = (int) explode('-', $answera)[1];
} elseif ($answerb) {
$answer = explode('-', $answerb)[0];
$id = (int) explode('-', $answerb)[1];
} elseif ($answerc) {
$answer = explode('-', $answerc)[0];
$id = (int) explode('-', $answerc)[1];
} elseif ($answerd) {
$answer = explode('-', $answerd)[0];
$id = (int) explode('-', $answerd)[1];
}
$res = $this->mdl->getQuestion($id);
return $answer == $res->getCanswer();
}
public function GetQuestion(int $id): array
{
$gw = new QuizQuestionGateway($this->co);
$mdl = new QuizQuestionModel($gw);
return $mdl->getAllQuestionByQuiz($id, $this->co);
}
/**
* @throws RuntimeError
* @throws SyntaxError
* @throws LoaderError
*/
public function showQuestion(int $id, int $no) : void
{
global $twig;
$q = $this->GetQuestion($id);
$question = $q[$no];
$idquestion = $question->getIdQuestion();
echo $twig->render('quiz.html.twig', ['question' => $question,'id'=>$idquestion]);
}
public function getNumberOfQuestion() : int
{
$gw = new QuizGateway($this->co);
$mdl = new QuizModel($gw);
return 0;
}
}
/*
<php
foreach ($news as $new)
{
<h2 href=<?= $new->getUrl() ?>> <?= $new->getTitle() ?> </h2>
}
?>
*/
<?php
namespace Controleur;
use Entity\QuestionEntity;
use Gateway\Connection;
use Gateway\QuestionGateway;
use Gateway\QuizGateway;
use Gateway\QuizQuestionGateway;
use Model\QuestionModel;
use Model\QuizModel;
use Model\QuizQuestionModel;
use Twig\Environment;
use Twig\Error\LoaderError;
use Twig\Error\RuntimeError;
use Twig\Error\SyntaxError;
use Twig\Loader\FilesystemLoader;
class QuizControler
{
private Connection $co;
private QuestionGateway $gw;
private QuestionModel $mdl;
/**
* @throws SyntaxError
* @throws RuntimeError
* @throws LoaderError
*/
public function __construct(Connection $co)
{
$this -> co = $co;
$this -> gw = new QuestionGateway($this -> co);
$this -> mdl = new QuestionModel($this -> gw);
global $num;
global $loader;
$action = $_REQUEST['action'] ?? null;
$id = (int) explode('/', $_SERVER['REQUEST_URI'])[2] ?? null;
$nb_questions = $this->getNumberOfQuestion($id);
switch ($action) {
case 'canswer':
if ($this->CorrectAnswer())
$_SESSION['score'] = isset($_SESSION['score']) ? ($_SESSION['score'] + 1) : 1;
$this->continueQuiz($id, $nb_questions);
break;
default:
switch($id)
{
case null:
// page erreur
break;
default:
$_SESSION['score'] = $_SESSION['score'] ?? 0;
$this->showQuestion($id, $_SESSION['no_question'] ?? 0);
break;
}
}
}
/**
* @throws SyntaxError
* @throws RuntimeError
* @throws LoaderError
*/
public function continueQuiz(int $id_quiz, int $total_questions) : void
{
$score = $_SESSION['score'];
$_SESSION['no_question'] = isset($_SESSION['no_question']) ? ($_SESSION['no_question'] + 1) : 1;
if ($_SESSION['no_question'] >= $total_questions) {
session_destroy();
$this->endQuiz($id_quiz, $score);
}
else header("Location: http://localhost:8000/quiz/$id_quiz");
}
/**
* @throws SyntaxError
* @throws RuntimeError
* @throws LoaderError
*/
public function endQuiz(int $id_quiz, int $score) : void
{
global $twig;
$gw = new QuizGateway($this->co);
$mdl = new QuizModel($gw);
if ($mdl->getQuiz($id_quiz + 1))
echo $twig->render('endQuiz.html.twig', ['score' => $score, 'nextquiz' => $id_quiz + 1]);
echo $twig->render('endQuiz.html.twig', ['score' => $score]);
}
public function CorrectAnswer() : bool
{
$answera = $_POST['answera'] ?? null;
$answerb = $_POST['answerb'] ?? null;
$answerc = $_POST['answerc'] ?? null;
$answerd = $_POST['answerd'] ?? null;
$id= null;
$answer = null;
if ($answera) {
$answer = explode('-', $answera)[0];
$id = (int) explode('-', $answera)[1];
} elseif ($answerb) {
$answer = explode('-', $answerb)[0];
$id = (int) explode('-', $answerb)[1];
} elseif ($answerc) {
$answer = explode('-', $answerc)[0];
$id = (int) explode('-', $answerc)[1];
} elseif ($answerd) {
$answer = explode('-', $answerd)[0];
$id = (int) explode('-', $answerd)[1];
}
$res = $this->mdl->getQuestion($id);
return $answer == $res->getCanswer();
}
public function GetQuestion(int $id): array
{
$gw = new QuizQuestionGateway($this->co);
$mdl = new QuizQuestionModel($gw);
return $mdl->getAllQuestionByQuiz($id, $this->co);
}
/**
* @throws RuntimeError
* @throws SyntaxError
* @throws LoaderError
*/
public function showQuestion(int $id, int $num) : void
{
global $twig;
$q = $this->GetQuestion($id);
$question = $q[$num] ?? $q[0];
$idquestion = $question->getIdQuestion();
echo $twig->render('quiz.html.twig', ['question' => $question,'id'=>$idquestion]);
}
public function getNumberOfQuestion(int $id) : int
{
$gw = new QuizGateway($this->co);
$mdl = new QuizModel($gw);
return $mdl->getQuiz($id)->getNbQuestions();
}
}

@ -1,10 +1,23 @@
<?php
namespace Controleur;
Class UserControler{
public function quiz(){
global $vues;
require_once $vues['quiz'];
}
}
<?php
namespace Controleur;
Class UserControler{
public function quiz(){
global $vues;
require_once $vues['quiz'];
}
public function favorits() {
global $vues;
$user = $_SESSION['username'];
$idUser = $this->userGateway->getIdUser($user);
$suggestions = $this->favoritsGateway->getFavorits(0, 'fr');
require_once $vues['favorits'];
}
}

@ -1,46 +1,60 @@
<?php
namespace Controleur;
use Model\QuoteModel;
use Model\SearchModel;
use Gateway\Connection;
use Gateway\QuoteGateway;
use Gateway\AccueilGateway;
Class VisitorControler{
class VisitorControler {
private QuoteModel $qMod;
private AccueilGateway $accueilGateway;
private SearchModel $sMod;
public function __construct(){
global $co;
$this->qMod = new QuoteModel(new QuoteGateway($co));
$this->sMod = new SearchModel(new QuoteGateway($co));
$this->accueilGateway = new AccueilGateway($co);
}
public function accueil(){
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){
public function quote(array $arg) {
global $vues;
$id=$arg['idQuote'] ?? 1;
$q = $this->qMod->searchId($id);
$id=$arg['idQuote'];
$q = $this->qMod->searchId($id);
require_once $vues['quote'];
}
public function login(){
public function login() {
global $vues;
require_once $vues['login'];
}
public function signin(){
public function signin() {
global $vues;
require_once $vues['signin'];
}
public function favorite() {
global $vues;
require_once $vues['favorite'];
}
public function search(array $arg){
global $vues;

@ -0,0 +1,49 @@
<?php
namespace Gateway;
use PDO;
class AccueilGateway {
private Connection $con;
public function __construct(Connection $con) {
$this->con = $con;
}
public function getQuoteOfTheDay(string $language): array {
$query = "SELECT q.id_quote, q.content, c.caracter, i.imgPath, s.title, s.dateS, q.likes, q.langue
FROM Quote q
JOIN Caracter c ON c.id_caracter = q.id_caracter
JOIN Source s ON s.id_source = q.id_source
JOIN Image i ON c.id_img = i.id_img
WHERE q.isValide = true AND q.isCitationDuJour = true AND q.langue = :language
ORDER BY id_quote DESC LIMIT 1;";
try {
$this->con->executeQuery($query, [':language' => [$language, PDO::PARAM_STR]]);
$result = $this->con->getResults();
return $result[0] ?? [];
} catch (PDOException $e) {
echo "Erreur dans getQuoteOfTheDay: " . $e->getMessage();
return [];
}
}
public function getSuggestions(int $numpage, string $language): array {
$query = "SELECT q.id_quote, q.content, c.caracter, i.imgPath, s.title, s.dateS, q.likes, q.langue
FROM Quote q
JOIN Caracter c ON c.id_caracter = q.id_caracter
JOIN Source s ON s.id_source = q.id_source
JOIN Image i ON c.id_img = i.id_img
WHERE q.isValide = true AND q.langue = :language
ORDER BY RANDOM()
LIMIT 20 OFFSET :offset;";
$this->con->executeQuery($query, [
':language' => [$language, PDO::PARAM_STR],
':offset' => [$numpage * 20, PDO::PARAM_INT]
]);
return $this->con->getResults();
}
}

@ -0,0 +1,31 @@
<?php
namespace Gateway;
use PDO;
class AccueilGateway {
private Connection $con;
public function __construct(Connection $con) {
$this->con = $con;
}
public function getSuggestions(int $numpage, string $language): array {
$username = $_SESSION['username'];
$userId = $this->userGateway->getIdUser($username);
$query = "SELECT q.id_quote, q.content, c.caracter, i.imgPath, s.title, s.dateS, q.likes, q.langue
FROM Quote q
JOIN Favorite f ON f.quote = q.id_quote
JOIN Caracter c ON c.id_caracter = q.id_caracter
JOIN Source s ON s.id_source = q.id_source
JOIN Image i ON c.id_img = i.id_img
WHERE q.isValide = true
AND q.langue = :language
AND f.users = :userId";
return $this->con->getResults();
}
}

@ -1,105 +1,177 @@
<?php
namespace Gateway;
use Connection;
Class UserGateway{
private Connection $con;
public function __construct(Connection $con){
$this->con=$con;
}
public function insert(string $username,string $email,string $passwd):string{
// récupération id
$query='SELECT id_user FROM Users WHERE id_user >= ALL (SELECT id_user FROM Users);';
$this->con->executeQuery($query);
$result=$this->con->getResults();
foreach($result as $row){
$id=$row['id_user'] + 1;
}
// insertion user
$query='INSERT INTO Users VALUES (:id,:username,:email,:passwd,CURRENT_DATE,false);';
$this->con->executeQuery($query,array(':id' => array($id,PDO::PARAM_STR),':username' => array($u->username,PDO::PARAM_STR),':email' => array($u->email,PDO::PARAM_STR),':passwd' => array($u->passwd,PDO::PARAM_STR)));
return $id;
}
public function delete(string $id) : bool{
// supretion user
$query='DELETE FROM Users WHERE id_user = :id;';
return $this->con->executeQuery($query,array(':id' => array($id,PDO::PARAM_STR)));
}
public function getFavorite(string $id):array{
//obtention favoris d'un user
$query='SELECT * FROM Quote WHERE id_quote IN (SELECT id_quote IN Favorite f JOIN User u ON u.id_user = f.user WHERE id_user = :id);';
$this->con->executeQuery($query,array(':id' => array($id,PDO::PARAM_STR)));
$result=$this->con->getResults();
return $result;
}
//obtenir les information d'un user
public function findDataUser(int $id):array{
$query = 'SELECT * FROM Users WHERE id_user=:idUser';
$con->executeQuery($query, array(':idUser'=>array($id, PDO::PARAM_STR)));
$result = $con->getResults();
return $result;
}
// ===================== UPDATE FUNCTION =====================
public function updateUsername(int $id, string $newUsername):array{
//Update le nom du user passé en paramètre
$queryUpdate = 'UPDATE Users SET username=:newUsername WHERE id_user=:idUser';
$con->executeQuery($queryUpdate, array(':idUser'=>array($id, PDO::PARAM_STR), ':newUsername'=> array($newUsername, PDO::PARAM_STR)));
//Renvoie le nouveau nom du user
$queryReponse = 'SELECT username FROM Users WHERE id_user=:idUser';
$con->executeQuery($queryReponse, array($id=>array($newUsername, PDO::PARAM_STR)));
return $result;
}
public function updateEmail(int $id, string $newEmail):array{
//Update le email du user passé en paramètre
$queryUpdate = 'UPDATE Users SET email=:newEmail WHERE id_user=:idUser';
$con->executeQuery($queryUpdate, array(':idUser'=>array($id, PDO::PARAM_STR), ':newEmail'=> array($newEmail, PDO::PARAM_STR)));
//Renvoie le nouveau email du user
$queryReponse = 'SELECT email FROM Users WHERE id_user=:idUser';
$con->executeQuery($queryReponse, array(':idUser'=>array($id, PDO::PARAM_STR)));
$result = $con->getResults();
return $result;
}
public function updateImg(int $id, int $newImg):array{
//Update l'image du user passé en paramètre
$query = 'UPDATE Users SET img=:newImg WHERE id_user=:idUser';
$con->executeQuery($query, array(':idUser'=>array($id, PDO::PARAM_STR), ':newImg'=> array($newImg, PDO::PARAM_STR)));
//Renvoie la nouvelle image du user
$queryReponse = 'SELECT img FROM Users WHERE id_user=:idUser';
$con->executeQuery($queryReponse, array(':idUser'=>array($id, PDO::PARAM_STR)));
$result = $con->getResults();
return $result;
}
public function updatePasswd(int $id, string $newPassWd):array{
//Update le passwd du user passé en paramètre
$query = 'UPDATE Users SET pssword=:newPassWd WHERE id_user=:idUser';
$con->executeQuery($query, array(':idUser'=>array($id, PDO::PARAM_STR), ':newPassWd'=> array($newPassWd, PDO::PARAM_STR)));
//Renvoie le nouveau passwd du user
$queryReponse = 'SELECT pssword FROM Users WHERE id_user=:idUser';
$con->executeQuery($queryReponse, array(':idUser'=>array($id, PDO::PARAM_STR)));
$result = $con->getResults();
return $result;
}
}
$uG = new UserGateway(new Connection("pgsql:host=londres;dbname=dblebeaulato","lebeaulato",""));
?>
<?php
namespace Gateway;
use Connection;
Class UserGateway{
private Connection $con;
public function __construct(Connection $con){
$this->con=$con;
}
public function insert(string $username,string $email,string $passwd):string{
//crypte passeword
$passwordEncrypted = crypt($passwd);
// insertion user
$query='INSERT INTO Users VALUES (:username,:email,:passwd,CURRENT_DATE,false);';
$this->con->executeQuery($query,array(':username' => array($u->username,PDO::PARAM_STR),':email' => array($u->email,PDO::PARAM_STR),':passwd' => array($u->passwordEncrypted,PDO::PARAM_STR)));
return $id;
}
public function delete(string $id) : bool{
// suppression user
$query='DELETE FROM Users WHERE id_user = :id;';
return $this->con->executeQuery($query,array(':id' => array($id,PDO::PARAM_INT)));
}
public function getFavorite(string $id):array{
//obtention favoris d'un user
$query='SELECT * FROM Quote WHERE id_quote IN (SELECT id_quote IN Favorite f JOIN User u ON u.id_user = f.user WHERE id_user = :id);';
$this->con->executeQuery($query,array(':id' => array($id,PDO::PARAM_INT)));
$result=$this->con->getResults();
return $result;
}
//obtenir les information d'un user
public function findDataUser(int $id):array{
$query = 'SELECT * FROM Users WHERE id_user=:idUser';
$con->executeQuery($query, array(':idUser'=>array($id, PDO::PARAM_INT)));
$result = $con->getResults();
return $result;
}
public function createQuote(int $id, string $content, string $langue, string $caracter, string $source):array{
//recupère id du personnage
$queryCaracter = "SELECT id_caracter FROM Caracter WHERE caracter =:caracter";
$con->executeQuery($queryCaracter, array(
':caracter'=>array($caracter, PDO::PARAM_STR)
));
$resultCaracter = $con->getResult();
if($resultCaracter == NULL){
//ajout creationCaracter
}
//recupère id de la source
$querySource = "SELECT id_source FROM Source WHERE title =:source";
$con->executeQuery($querySource, array(
':source'=>array($source, PDO::PARAM_STR)
));
$resultSource = $con->getResult();
if($resultSource == NULL){
//ajout creationSource
}
$queryInsert = "INSERT INTO Quote (content, langue, id_caracter, id_source, id_user_verif) VALUES (:content, :langue, :caracter, :source, :idverif)";
$con->executeQuery($queryInsert, array(
':content'=>array($content, PDO::PARAM_STR),
':langue'=>array($langue, PDO::PARAM_STR),
':caracter'=>array($resultCaracter, PDO::PARAM_STR),
':source'=>array($resultSource, PDO::PARAM_STR),
':idverif'=>array($id, PDO::PARAM_INT)
));
}
public function createCaracter(string $caracter, string $img):array{
//creation du personnage
$queryCaracter = "INSERT INTO Caracter(caracter, img_path) VALUES (:caracter, :img)";
$con->executeQuery($queryCaracter, array(
':caracter'=>array($caracter, PDO::PARAM_STR),
'img'=>array($img, PDO::PARAM_STR)
));
//récuperation de id caracter
$queryCaracter = "SELECT id_caracter FROM Caracter WHERE caracter =:caracter";
$con->executeQuery($queryCaracter, array(
':caracter'=>array($caracter, PDO::PARAM_STR)
));
$resultCaracter = $con->getResult();
}
public function createSource(string $title, string $dateS):array{
//creation du personnage
$querySource = "INSERT INTO Source(title, dateS) VALUES (:title, :dateS)";
$con->executeQuery($querySource, array(
':title'=>array($title, PDO::PARAM_STR),
'dateS'=>array($dateS, PDO::PARAM_STR)
));
//recupère id de la source
$querySource = "SELECT id_source FROM Source WHERE title =:source";
$con->executeQuery($querySource, array(
':source'=>array($source, PDO::PARAM_STR)
));
$querySource = $con->getResult();
}
// ===================== UPDATE FUNCTION =====================
public function updateUsername(int $id, string $newUsername):array{
//Update le nom du user passé en paramètre
$queryUpdate = 'UPDATE Users SET username=:newUsername WHERE id_user=:idUser';
$con->executeQuery($queryUpdate, array(':idUser'=>array($id, PDO::PARAM_INT), ':newUsername'=> array($newUsername, PDO::PARAM_STR)));
//Renvoie le nouveau nom du user
$queryReponse = 'SELECT username FROM Users WHERE id_user=:idUser';
$con->executeQuery($queryReponse, array($id=>array($id, PDO::PARAM_INT)));
return $result;
}
public function updateEmail(int $id, string $newEmail):array{
//Update le email du user passé en paramètre
$queryUpdate = 'UPDATE Users SET email=:newEmail WHERE id_user=:idUser';
$con->executeQuery($queryUpdate, array(':idUser'=>array($id, PDO::PARAM_INT), ':newEmail'=> array($newEmail, PDO::PARAM_STR)));
//Renvoie le nouveau email du user
$queryReponse = 'SELECT email FROM Users WHERE id_user=:idUser';
$con->executeQuery($queryReponse, array(':idUser'=>array($id, PDO::PARAM_INT)));
$result = $con->getResults();
return $result;
}
public function updateImg(int $id, int $newImg):array{
//Update l'image du user passé en paramètre
$query = 'UPDATE Users SET img=:newImg WHERE id_user=:idUser';
$con->executeQuery($query, array(':idUser'=>array($id, PDO::PARAM_INT), ':newImg'=> array($newImg, PDO::PARAM_STR)));
//Renvoie la nouvelle image du user
$queryReponse = 'SELECT img FROM Users WHERE id_user=:idUser';
$con->executeQuery($queryReponse, array(':idUser'=>array($id, PDO::PARAM_INT)));
$result = $con->getResults();
return $result;
}
public function updatePasswd(int $id, string $newPassWd):array{
//crypte le mot de passe
$passwordEncrypted = crypt($newPassWd);
//Update le passwd du user passé en paramètre
$query = 'UPDATE Users SET password=:newPassWd WHERE id_user=:idUser';
$con->executeQuery($query, array(':idUser'=>array($id, PDO::PARAM_INT), ':newPassWd'=> array($passwordEncrypted, PDO::PARAM_STR)));
}
public function getIdUser(string $username):array{
$query = 'SELECT id_user FROM Users WHERE username=:username';
$con->executeQuery($query, array(':username'=>array($username, PDO::PARAM_STR)));
$result = $con->getResults();
return $result;
}
}
$uG = new UserGateway(new Connection("pgsql:host=londres;dbname=dblebeaulato","lebeaulato",""));
?>

@ -1,55 +1,55 @@
<?php
namespace Model;
use Entity\quizEntity;
use Gateway\QuizGateway;
class QuizModel {
private QuizGateway $gateway;
public function __construct(QuizGateway $gw)
{
$this -> gateway = $gw;
}
public function createQuiz(int $id_quiz, int $nb_questions) : bool
{
return $this -> gateway -> create($id_quiz, $nb_questions);
}
public function getQuiz(int $id_quiz): ?quizEntity
{
$q = $this -> gateway -> findQuizById($id_quiz);
if ($q) {
return new quizEntity(
$q['id_quiz'],
$q['nb_questions'],
);
}
return null;
}
public function deleteQuiz(int $id_quiz) : bool
{
return $this -> gateway -> delete($id_quiz);
}
public function getAllQuiz() : array
{
$q = $this -> gateway -> findAll();
$quizzes = [];
foreach ($q as $quiz) {
$quizzes[] = new quizEntity(
$quiz['id_quiz'],
$quiz['nb_questions']
);
}
return $quizzes;
}
<?php
namespace Model;
use Entity\quizEntity;
use Gateway\QuizGateway;
class QuizModel {
private QuizGateway $gateway;
public function __construct(QuizGateway $gw)
{
$this -> gateway = $gw;
}
public function createQuiz(int $id_quiz, int $nb_questions) : bool
{
return $this -> gateway -> create($id_quiz, $nb_questions);
}
public function getQuiz(int $id_quiz): ?quizEntity
{
$q = $this -> gateway -> findQuizById($id_quiz);
if ($q) {
return new quizEntity(
$q[0]['id_quiz'],
$q[0]['nb_quest']
);
}
return null;
}
public function deleteQuiz(int $id_quiz) : bool
{
return $this -> gateway -> delete($id_quiz);
}
public function getAllQuiz() : array
{
$q = $this -> gateway -> findAll();
$quizzes = [];
foreach ($q as $quiz) {
$quizzes[] = new quizEntity(
$quiz['id_quiz'],
$quiz['nb_questions']
);
}
return $quizzes;
}
}

@ -0,0 +1,26 @@
<?php
namespace Model;
use Entity\Quote;
use Gateway\QuoteGateway;
class SearchModel
{
private QuoteGateway $gateway;
public function __construct(QuoteGateway $gate){
$this->gateway = $gate;
}
public function searchQuote(?string $type,?string $search,array $filtre): array{
$res = $this->gateway->search($type,$search,$filtre);
$tabQ=[];
foreach($res as $q ){
$tabQ[]= new Quote($q["id_quote"],$q["content"],$q["caracter"],$q["imgpath"],$q["title"],$q["dates"],$q["likes"],$q["langue"]) ;
}
return $tabQ;
}
}
?>

@ -1,81 +1,40 @@
<?php
global $twig;
global $twig;
echo $twig->render('head.html.twig', array(
'title' => "Accueil",
'style' => "public/styles/styleAccueil.css",
));
echo $twig->render('bandeau.html.twig');
echo $twig->render('head.html.twig', [
'title' => "Accueil",
'style' => "public/styles/styleAccueil.css",
]);
?>
<?php
$file = 'citation.txt';
$citations = file($file, FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES);
$citationDuJour = null;
$suggestions = [];
foreach ($citations as $citation) {
$parts = explode(';', $citation);
if (strpos(trim($parts[0]), 'µ') === 0) {
$citationDuJour = $parts;
} else {
$suggestions[] = $parts;
}
}
shuffle($suggestions);
// Rendu du bandeau
echo $twig->render('bandeau.html.twig');
$suggestions = array_filter($suggestions, function($suggestion) use ($citationDuJour) {
return count($suggestion) == 5 && !($suggestion[0] === trim($citationDuJour[1]));
});
$suggestions = array_slice($suggestions, 0, 10);
echo "<div class='citations-section'>";
if ($citationDuJour) {
$quote = htmlspecialchars(trim(substr($citationDuJour[1], 1))); // Retirer le symbole µ
$movie = htmlspecialchars(trim($citationDuJour[2]));
$character = htmlspecialchars(trim($citationDuJour[3]));
$year = htmlspecialchars(trim($citationDuJour[4]));
$imagePath = htmlspecialchars(trim($citationDuJour[5]));
echo "<h2>Citation du jour</h2>";
echo "<div class='citation-container citation-du-jour'>";
echo "<img src='$imagePath' alt='$movie' class='citation-image'>";
echo "<div class='text-content'>";
echo "<p class='quoteContent'>\"$quote\"</p>";
echo "<p class='movie'>- $movie</p>";
echo "<p class='character'>Personnage : $character</p>";
echo "<p class='year'>Année : $year</p>";
echo "</div>";
echo "</div>";
// Vérification de la présence de la "Citation du jour"
if (!empty($citationDuJour)) {
echo $twig->render('citation_du_jour.html.twig', [
'quote' => $citationDuJour['content'],
'movie' => $citationDuJour['title'],
'character' => $citationDuJour['caracter'],
'year' => $citationDuJour['dates'],
'imagePath' => $citationDuJour['imgpath']
]);
} else {
echo "<p class='error'>Aucune citation du jour n'a été trouvée.</p>";
}
if (!empty($suggestions)) {
echo "<h2>Suggestions</h2>";
echo "<div class='quotes-container'>";
foreach($suggestions as $suggestion){
echo $twig->render('quoteLittle.html.twig', array(
'srcImg' => htmlspecialchars(trim($suggestion[4])),
'quoteContent' => htmlspecialchars(trim($suggestion[0])) ,
'sourceName' => htmlspecialchars(trim($suggestion[1])) ,
'nameCarac' => htmlspecialchars(trim($suggestion[2])) ,
'dateSortie' => htmlspecialchars(trim($suggestion[3])) ,
));
}
echo "</div>";
// Affichage des suggestions de citations
echo "<h2>Suggestions</h2>";
echo "<div class='suggestions-container'>";
foreach ($suggestions as $suggestion) {
echo $twig->render('suggestion.html.twig', [
'quote' => $suggestion['content'],
'movie' => $suggestion['title'],
'character' => $suggestion['caracter'],
'year' => $suggestion['dates'],
'imagePath' => $suggestion['imgpath']
]);
}
echo "</div>";
?>
</body>
</html>
echo "</div>";
?>

@ -1,30 +0,0 @@
<!DOCTYPE html>
<html lang="fr">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Wiki Fantasy : Favoris</title>
<link id="favicon" rel="icon" href="../images/iconeSombre.ico"> <!-- Par défaut sombre -->
<link rel="stylesheet" href="../public/styles/style.css">
<script defer src="../public/script/theme-toggle.js"></script>
<script src="../script/auth-check.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()">
<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">
<img src="../images/user_dark.png" alt="user" width="70px" height="70px" onmousedown="return false">
</div>
</div>
</div>
<h1>Wiki Fantasy</h1>
</body>
</html>

@ -0,0 +1,25 @@
<?php
global $twig;
// Rendu de l'en-tête
echo $twig->render('head.html.twig', [
'title' => "Accueil",
'style' => "public/styles/styleAccueil.css",
]);
// Rendu du bandeau
echo $twig->render('bandeau.html.twig');
echo "<h2>Favorits</h2>";
echo "<div class='suggestions-container'>";
foreach ($suggestions as $suggestion) {
echo $twig->render('favorits.html.twig', [
'quote' => $suggestion['content'],
'movie' => $suggestion['title'],
'character' => $suggestion['caracter'],
'year' => $suggestion['dates'],
'imagePath' => $suggestion['imgpath']
]);
}
echo "</div>";
?>

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

@ -5,6 +5,7 @@
echo $twig->render('head.html.twig', array(
'title' => "Quote",
'style' => "../public/styles/styleQuote.css",
'scripts' => array("../public/script/theme-toggle.js")
));
echo $twig->render('bandeau.html.twig');
echo $twig->render('quote.html', array(
@ -14,7 +15,6 @@
'sourceName' => $q->getTitleSrc(),
'dateSortie' => $q->getDateSrc(),
'nbLike' => $q->getLike(),
'timeCode' =>"1h45",
));
?>

@ -1,12 +1,13 @@
<?php
global $twig;
echo $twig->render('head.html.twig', array(
'title' => "Sign in",
'style' => "public/styles/styleSignin.css",
));
echo $twig->render('bandeau.html.twig');
echo $twig->render('signin.html');
<?php
global $twig;
echo $twig->render('head.html.twig', array(
'title' => "Sign in",
'style' => "public/styles/styleSignin.css",
'scripts' => array("public/script/theme-toggle.js")
));
echo $twig->render('bandeau.html.twig');
echo $twig->render('signin.html');
?>

@ -1,6 +1,6 @@
<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>
<a href="{{ racine }}/favorite"><img src="images/coeur.svg" alt="coeur" width="67px" height="67px" onmousedown="return false"></a>
<img id="theme-icon" src="images/dark.svg" alt="toggle theme" width="72px" height="37px" onmousedown="return false" onclick="toggleTheme()">
<a href="{{ racine }}/quiz"><img src="images/quizz.svg" alt="quizz" width="51px" height="82px" onmousedown="return false"></a>

@ -0,0 +1,10 @@
<h2>Citation du jour</h2>
<div class="citation-container citation-du-jour">
<img src="{{ imagePath }}" alt="{{ movie }}" class="citation-image">
<div class="text-content">
<p class="quote">"{{ quote }}"</p>
<p class="movie">- {{ movie }}</p>
<p class="character">Personnage : {{ character }}</p>
<p class="year">Année : {{ year }}</p>
</div>
</div>

@ -0,0 +1,19 @@
<!DOCTYPE html>
<html lang="fr">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Wiki Fantasy : Quiz</title>
<link id="favicon" rel="icon" href="../../images/iconeSombre.ico"> <!-- Par défaut sombre -->
<link rel="stylesheet" href="../../public/styles/styleQuiz.css">
<script defer src="../../public/script/theme-toggle.js"></script>
</head>
<body>
<h1 style="color: #b7c8ff"> {{ score }} </h1>
<h1> {{ nextquiz }} </h1>
zeze
</body>
</html>

@ -0,0 +1,9 @@
<div class="citation-container suggestion">
<img src="{{ imagePath }}" alt="{{ movie }}" class="citation-image">
<div class="text-content">
<p class="quote">"{{ quote }}"</p>
<p class="movie">- {{ movie }}</p>
<p class="character">Personnage : {{ character }}</p>
<p class="year">Année : {{ year }}</p>
</div>
</div>

@ -1,11 +1,15 @@
<!DOCTYPE html>
<html lang="fr">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>{{ title }}</title>
<link rel="stylesheet" href="{{ style }}">
<link id="favicon" rel="icon" href="public/images/iconeSombre.ico" />
<script src="public/script/theme-toggle.js"></script>
</head>
<!DOCTYPE html>
<html lang="fr">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>{{ title }}</title>
<link rel="stylesheet" href="{{ style }}">
<link id="favicon" rel="icon" href="public/images/iconeSombre.ico" />
{% if scripts|length > 0 %}
{% for script in scripts %}
<script src="{{ script }}"></script>
{% endfor %}
{% endif %}
</head>

@ -9,7 +9,7 @@
<script defer src="../../public/script/theme-toggle.js"></script>
<script>
// Timer pour 5 minutes
var timeLeft = 300;
var timeLeft = 10;
function countdown() {
var timerDisplay = document.getElementById("timer");
if (timeLeft <= 0) {
@ -24,25 +24,12 @@
</script>
</head>
<body>
<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()">
<img src="../../images/quizz.svg" alt="quizz" width="51px" height="82px" onmousedown="return false">
</div>
<div class="logo">
<img src="../../images/WIKIFANTASY.png" alt="Logo" width="227px" height="106px" onmousedown="return false">
</div>
<div class="user">
<img src="../../images/user_dark.png" alt="user" width="70px" height="70px" onmousedown="return false">
</div>
</div>
{{ include "bandeau.html.twig" }}
<h1>▶ Quiz ◀</h1>
<div class="quiz">
<h2> {{ question.question }} </h2>
<a id="timer"> 300 seconds left .. </a>
<a id="timer"> 10 seconds left .. </a>
<form id="quizForm" method="POST">
<div class="answers">
@ -59,7 +46,7 @@
{{ question.answerd }}
</button>
</div>
<input type="hidden" name="action" value="canswer">
<input type="hidden" name="action" value="">
</form>
</div>
</body>

@ -1,23 +1,23 @@
<div class="card">
<img class="card-image" src="{{ srcImg }}" >
<div class="card-content">
<h2 class="quote">“{{quoteContent}}”</h2>
<ul class="infoQuote">
<li>- {{sourceName}} ({{timeCode}})</li>
<li>- {{nameCarac}}</li>
<li>- {{dateSortie}}</li>
</ul>
<div class="likes">
<p>{{nbLike}} ❤️</p>
</div>
</div>
<div class="like-icon">❤️</div>
<div class="share-icon">🔗</div>
</div>
</body>
<div class="card">
<img class="card-image" src="{{ srcImg }}" >
<div class="card-content">
<h2 class="quote">“{{quoteContent}}”</h2>
<ul class="infoQuote">
<li>- {{sourceName}}</li>
<li>- {{nameCarac}}</li>
<li>- {{dateSortie}}</li>
</ul>
<div class="likes">
<p>{{nbLike}} ❤️</p>
</div>
</div>
<div class="like-icon">❤️</div>
<div class="share-icon">🔗</div>
</div>
</body>
</html>

@ -0,0 +1,9 @@
<div class="citation-container suggestion">
<img src="{{ imagePath }}" alt="{{ movie }}" class="citation-image">
<div class="text-content">
<p class="quote">"{{ quote }}"</p>
<p class="movie">- {{ movie }}</p>
<p class="character">Personnage : {{ character }}</p>
<p class="year">Année : {{ year }}</p>
</div>
</div>
Loading…
Cancel
Save