parent
e6808dd19c
commit
ba8eb05b5d
@ -0,0 +1,156 @@
|
||||
<?php
|
||||
namespace Entity;
|
||||
|
||||
class UserEntity {
|
||||
|
||||
private int $id;
|
||||
private string $pseudo;
|
||||
private string $password;
|
||||
private string $email;
|
||||
private string $date;
|
||||
private string $imgPrfl;
|
||||
|
||||
public function getId(): int
|
||||
{
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
public function setId(int $id): void
|
||||
{
|
||||
$this->id = $id;
|
||||
}
|
||||
|
||||
public function getPseudo(): string
|
||||
{
|
||||
return $this->pseudo;
|
||||
}
|
||||
|
||||
public function setPseudo(string $pseudo): void
|
||||
{
|
||||
$this->pseudo = $pseudo;
|
||||
}
|
||||
|
||||
public function getPassword(): string
|
||||
{
|
||||
return $this->password;
|
||||
}
|
||||
|
||||
public function setPassword(string $password): void
|
||||
{
|
||||
$this->password = $password;
|
||||
}
|
||||
|
||||
public function getEmail(): string
|
||||
{
|
||||
return $this->email;
|
||||
}
|
||||
|
||||
public function setEmail(string $email): void
|
||||
{
|
||||
$this->email = $email;
|
||||
}
|
||||
|
||||
public function getDate(): string
|
||||
{
|
||||
return $this->date;
|
||||
}
|
||||
|
||||
public function setDate(string $date): void
|
||||
{
|
||||
$this->date = $date;
|
||||
}
|
||||
|
||||
public function isAdmin(): bool
|
||||
{
|
||||
return $this->isAdmin;
|
||||
}
|
||||
|
||||
public function setIsAdmin(bool $isAdmin): void
|
||||
{
|
||||
$this->isAdmin = $isAdmin;
|
||||
}
|
||||
|
||||
public function getImgPrfl(): string
|
||||
{
|
||||
return $this->imgPrfl;
|
||||
}
|
||||
|
||||
public function setImgPrfl(string $imgPrfl): void
|
||||
{
|
||||
$this->imgPrfl = $imgPrfl;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $id
|
||||
* @param string $pseudo
|
||||
* @param string $password
|
||||
* @param string $email
|
||||
* @param int $imgPrfl
|
||||
* @param bool $isAdmin
|
||||
* @param string $date
|
||||
*/
|
||||
public function __construct(int $id, string $pseudo, string $password, string $email, string $imgPrfl, string $date)
|
||||
{
|
||||
$this->id = $id;
|
||||
$this->pseudo = $pseudo;
|
||||
$this->password = $password;
|
||||
$this->email = $email;
|
||||
$this->imgPrfl = $imgPrfl;
|
||||
$this->date = $date;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
// ============================================ En attente du Model ============================================
|
||||
/*$dsn = "pgsql:host=londres;dbname=dblebeaulato";
|
||||
$username = "lebeaulato";
|
||||
$password = "";
|
||||
|
||||
$con = new Connection($dsn,$username,$password);
|
||||
|
||||
$query = 'SELECT * FROM Users WHERE id_user=:idUser';
|
||||
$con->executeQuery($query, array(':idUser'=>array('U003', PDO::PARAM_STR)));
|
||||
$result = $con->getResults();
|
||||
|
||||
$u = new User($result[0]['id_user'],$result[0]['username'], $result[0]['pssword'], '../images/imageProfil.png', $result[0]['email']);
|
||||
|
||||
|
||||
|
||||
|
||||
//UPDATE username User
|
||||
$query = 'UPDATE Users SET username=:newUsername WHERE id_user=:idUser';
|
||||
$con->executeQuery($query, array(':idUser'=>array('U003', PDO::PARAM_STR), ':newUsername'=> array('Hello', PDO::PARAM_STR)));
|
||||
$queryReponse = 'SELECT username FROM Users WHERE id_user=:idUser';
|
||||
|
||||
$con->executeQuery($queryReponse, array(':idUser'=>array('U003', PDO::PARAM_STR)));
|
||||
$result = $con->getResults();
|
||||
$u->setUsername($result[0]['username']);
|
||||
|
||||
|
||||
//UPDATE email User
|
||||
$query = 'UPDATE Users SET email=:newEmail WHERE id_user=:idUser';
|
||||
$con->executeQuery($query, array(':idUser'=>array('U003', PDO::PARAM_STR), ':newEmail'=> array('hello@gmail.com', PDO::PARAM_STR)));
|
||||
$queryReponse = 'SELECT email FROM Users WHERE id_user=:idUser';
|
||||
|
||||
$con->executeQuery($queryReponse, array(':idUser'=>array('U003', PDO::PARAM_STR)));
|
||||
$result = $con->getResults();
|
||||
$u->setEmail($result[0]['email']);
|
||||
|
||||
//UPDATE passwd User
|
||||
$query = 'UPDATE Users SET pssword=:newPassWd WHERE id_user=:idUser';
|
||||
$con->executeQuery($query, array(':idUser'=>array('U003', PDO::PARAM_STR), ':newPassWd'=> array('TestMotDePasssse', PDO::PARAM_STR)));
|
||||
|
||||
$queryReponse = 'SELECT pssword FROM Users WHERE id_user=:idUser';
|
||||
$con->executeQuery($queryReponse, array(':idUser'=>array('U003', PDO::PARAM_STR)));
|
||||
$result = $con->getResults();
|
||||
$u->setPasswd($result[0]['pssword']); /*Test*/
|
||||
|
||||
// ================================================================================================================
|
||||
|
||||
|
||||
|
||||
function hidenPassWd(string $passwd){
|
||||
if(strlen($passwd) >= 16) return str_repeat('*', 16);
|
||||
return str_repeat('*', strlen($passwd));
|
||||
}
|
||||
?>
|
@ -1,148 +0,0 @@
|
||||
<?php
|
||||
namespace Entity;
|
||||
|
||||
class QuestionEntity
|
||||
{
|
||||
private int $id_question;
|
||||
private string $question;
|
||||
private string $answerA;
|
||||
private string $answerB;
|
||||
private string $answerC;
|
||||
private string $answerD;
|
||||
private string $cAnswer;
|
||||
|
||||
/**
|
||||
* @param int $id_question
|
||||
* @param string $question
|
||||
* @param string $answerA
|
||||
* @param string $answerB
|
||||
* @param string $answerC
|
||||
* @param string $answerD
|
||||
* @param string $cAnswer
|
||||
*/
|
||||
public function __construct(int $id_question, string $question, string $answerA, string $answerB, string $answerC, string $answerD, string $cAnswer)
|
||||
{
|
||||
$this->id_question = $id_question;
|
||||
$this->question = $question;
|
||||
$this->answerA = $answerA;
|
||||
$this->answerB = $answerB;
|
||||
$this->answerC = $answerC;
|
||||
$this->answerD = $answerD;
|
||||
$this->cAnswer = $cAnswer;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
public function getIdQuestion(): int
|
||||
{
|
||||
return $this->id_question;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $id_question
|
||||
*/
|
||||
public function setIdQuestion(int $id_question): void
|
||||
{
|
||||
$this->id_question = $id_question;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getQuestion(): string
|
||||
{
|
||||
return $this->question;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $question
|
||||
*/
|
||||
public function setQuestion(string $question): void
|
||||
{
|
||||
$this->question = $question;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getAnswerA(): string
|
||||
{
|
||||
return $this->answerA;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $answerA
|
||||
*/
|
||||
public function setAnswerA(string $answerA): void
|
||||
{
|
||||
$this->answerA = $answerA;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getAnswerB(): string
|
||||
{
|
||||
return $this->answerB;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $answerB
|
||||
*/
|
||||
public function setAnswerB(string $answerB): void
|
||||
{
|
||||
$this->answerB = $answerB;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getAnswerC(): string
|
||||
{
|
||||
return $this->answerC;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $answerC
|
||||
*/
|
||||
public function setAnswerC(string $answerC): void
|
||||
{
|
||||
$this->answerC = $answerC;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getAnswerD(): string
|
||||
{
|
||||
return $this->answerD;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $answerD
|
||||
*/
|
||||
public function setAnswerD(string $answerD): void
|
||||
{
|
||||
$this->answerD = $answerD;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getCAnswer(): string
|
||||
{
|
||||
return $this->cAnswer;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $cAnswer
|
||||
*/
|
||||
public function setCAnswer(string $cAnswer): void
|
||||
{
|
||||
$this->cAnswer = $cAnswer;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
@ -1,15 +0,0 @@
|
||||
<?php
|
||||
namespace Gateway;
|
||||
|
||||
use PDO;
|
||||
|
||||
class AccueilGateway {
|
||||
|
||||
private Connection $con;
|
||||
|
||||
public function __construct(Connection $con) {
|
||||
$this->con = $con;
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,18 @@
|
||||
<?php
|
||||
global $twig;
|
||||
|
||||
|
||||
echo $twig->render('head.html.twig', [
|
||||
'title' => "Quiz",
|
||||
'style' => "public/styles/styleQuiz.css",
|
||||
'scripts' => array("public/script/theme-toggle.js")
|
||||
]);
|
||||
|
||||
|
||||
// Rendu du bandeau
|
||||
echo $twig->render('bandeau.html.twig');
|
||||
|
||||
echo $twig->render('endQuiz.html.twig', ['score' => $score, 'nextquiz' => $id_quiz + 1])
|
||||
?>
|
||||
|
||||
|
@ -1,61 +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 : 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>
|
||||
<script>
|
||||
// Timer pour 5 minutes
|
||||
|
||||
var timeLeft = 300;
|
||||
function countdown() {
|
||||
var timerDisplay = document.getElementById("timer");
|
||||
if (timeLeft <= 0) {
|
||||
document.getElementById("quizForm").submit();
|
||||
} else {
|
||||
timerDisplay.innerHTML = timeLeft + " seconds left";
|
||||
timeLeft -= 1;
|
||||
setTimeout(countdown, 1000);
|
||||
}
|
||||
}
|
||||
window.onload = countdown;
|
||||
</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">
|
||||
<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>
|
||||
|
||||
<h1>▶ Quiz ◀</h1>
|
||||
|
||||
<div class="quiz">
|
||||
<h2>Question 1</h2>
|
||||
<p>“Tu es un sorcier Harry”</p>
|
||||
|
||||
<!-- Grille de réponses (2 par ligne) -->
|
||||
<div class="answers">
|
||||
<button class="answer">Fight Club</button>
|
||||
<button class="answer">Jurassic World</button>
|
||||
<button class="answer">La 7ème compagnie</button>
|
||||
<button class="answer">Harry Potter à l'école des sorciers</button>
|
||||
</div>
|
||||
|
||||
<div class="submit-button">
|
||||
<button class="buttonSudmite" type="submit">Confirmer</button>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
@ -0,0 +1,17 @@
|
||||
<?php
|
||||
global $twig;
|
||||
|
||||
|
||||
echo $twig->render('head.html.twig', [
|
||||
'title' => "Quiz",
|
||||
'style' => "../public/styles/styleQuiz.css",
|
||||
'scripts' => array("../public/script/theme-toggle-double-param.js")
|
||||
]);
|
||||
|
||||
|
||||
// Rendu du bandeau
|
||||
echo $twig->render('bandeau.html.twig');
|
||||
|
||||
echo $twig->render('quiz.html.twig', ['idQuiz'=>$id , 'question' => $question,'id'=>$idquestion]);
|
||||
?>
|
||||
|
@ -1,211 +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 : Quizz</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">
|
||||
<style>
|
||||
@import url('https://fonts.googleapis.com/css2?family=Lemon&display=swap');
|
||||
|
||||
/* ====== DARK MODE ====== */
|
||||
body.dark-mode h1, body.dark-mode h2, body.dark-mode p {
|
||||
color: white;
|
||||
font-family: "Lemon", serif;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
body.dark-mode .quizz {
|
||||
background-color: black;
|
||||
width: 50%;
|
||||
margin: 3% auto;
|
||||
padding: 2%;
|
||||
border-radius: 25px;
|
||||
border: 2px solid transparent;
|
||||
}
|
||||
|
||||
body.dark-mode .answers {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
justify-content: space-around;
|
||||
gap: 10px;
|
||||
}
|
||||
|
||||
body.dark-mode .answer {
|
||||
background-color: #1b0048;
|
||||
color: white;
|
||||
border: none;
|
||||
border-radius: 25px;
|
||||
width: 45%;
|
||||
padding: 10px;
|
||||
font-size: 18px;
|
||||
text-align: center;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
body.dark-mode .answer:hover {
|
||||
background-color: #6100ff;
|
||||
}
|
||||
|
||||
body.dark-mode .submit-button {
|
||||
text-align: center;
|
||||
margin-top: 20px;
|
||||
}
|
||||
|
||||
body.dark-mode .buttonSudmite {
|
||||
background: linear-gradient(90deg, #6100ff 0%, #1b0048 100%);
|
||||
font-family: "Lemon", serif;
|
||||
border: none;
|
||||
color: white;
|
||||
padding: 10px 20px;
|
||||
border-radius: 25px;
|
||||
font-size: 20px;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
/* ====== LIGHT MODE ====== */
|
||||
body.light-mode h1, body.light-mode h2, body.light-mode p {
|
||||
color: black;
|
||||
font-family: "Lemon", serif;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
body.light-mode .quizz {
|
||||
background-color: white;
|
||||
width: 50%;
|
||||
margin: 3% auto;
|
||||
padding: 2%;
|
||||
border-radius: 25px;
|
||||
border: 2px solid black;
|
||||
}
|
||||
|
||||
body.light-mode .answers {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
justify-content: space-around;
|
||||
gap: 10px;
|
||||
}
|
||||
|
||||
body.light-mode .answer {
|
||||
background-color: #fff1f1;
|
||||
color: black;
|
||||
border: 1px solid black;
|
||||
border-radius: 25px;
|
||||
width: 45%;
|
||||
padding: 10px;
|
||||
font-size: 18px;
|
||||
text-align: center;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
body.light-mode .answer:hover {
|
||||
background-color: #c7f6c4;
|
||||
}
|
||||
|
||||
body.light-mode .submit-button {
|
||||
text-align: center;
|
||||
margin-top: 20px;
|
||||
}
|
||||
|
||||
body.light-mode .buttonSudmite {
|
||||
background: linear-gradient(180deg, rgba(187,211,249,1) 0%, rgba(199,246,196,1) 100%);
|
||||
font-family: "Lemon", serif;
|
||||
border: none;
|
||||
color: black;
|
||||
padding: 10px 20px;
|
||||
border-radius: 25px;
|
||||
font-size: 20px;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
/* ====== OTHER ====== */
|
||||
.container {
|
||||
width: 100%;
|
||||
height: 100px;
|
||||
background-color: transparent;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
margin-bottom: 50px;
|
||||
}
|
||||
|
||||
.header {
|
||||
display: flex;
|
||||
width: 100%;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.nav img {
|
||||
margin-right: 10px;
|
||||
}
|
||||
|
||||
.logo img {
|
||||
display: block;
|
||||
margin: 0 auto;
|
||||
}
|
||||
|
||||
.user img {
|
||||
margin-left: 10px;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body class="dark-mode"> <!-- Ajouter ici la classe pour le mode sombre ou clair -->
|
||||
|
||||
<!-- Bandeau du haut avec les images -->
|
||||
<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 class="user">
|
||||
<img src="../images/user_dark.png" alt="user" width="70px" height="70px" onmousedown="return false">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Section du quizz -->
|
||||
<h1>▶ Quizz ◀</h1>
|
||||
|
||||
<div class="quizz">
|
||||
<h2>Question 1</h2>
|
||||
<p>“Tu es un sorcier Harry”</p>
|
||||
|
||||
<!-- Grille de réponses (2 par ligne) -->
|
||||
<div class="answers">
|
||||
<button class="answer">Fight Club</button>
|
||||
<button class="answer">Jurassic World</button>
|
||||
<button class="answer">La 7ème compagnie</button>
|
||||
<button class="answer">Harry Potter à l'école des sorciers</button>
|
||||
</div>
|
||||
|
||||
<div class="submit-button">
|
||||
<button class="buttonSudmite">Confirmer</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
function toggleTheme() {
|
||||
const body = document.body;
|
||||
body.classList.toggle("dark-mode");
|
||||
body.classList.toggle("light-mode");
|
||||
|
||||
const themeIcon = document.getElementById("theme-icon");
|
||||
if (body.classList.contains("dark-mode")) {
|
||||
themeIcon.src = "../images/light.svg";
|
||||
} else {
|
||||
themeIcon.src = "../images/dark.svg";
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
</body>
|
||||
</html>
|
@ -1,19 +1,6 @@
|
||||
<!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>
|
||||
|
Loading…
Reference in new issue