plein d'ajout

pull/23/head
kevin.modejar 6 months ago
parent 34be1dadcb
commit 889e16fb25

@ -12,7 +12,7 @@ $base = '';
$login = ''; $login = '';
$mdp = ''; $mdp = '';
$racine='/~lebeaulato/WF-Website'; // /~kekentin/WF/WF-Website $racine='/~kemondejar/WF-Website'; // /~kekentin/WF/WF-Website
//Vues //Vues
@ -24,7 +24,7 @@ $vues['login'] = 'vue/login.php';
$vues['signin'] = 'vue/signin.php'; $vues['signin'] = 'vue/signin.php';
$vues['search'] = 'vue/search.php'; $vues['search'] = 'vue/search.php';
$vues['favorite'] = 'vue/favorits.php'; $vues['favorite'] = 'vue/favorits.php';
$vues['create'] = 'vue/create.php';
$vues['quiz'] = 'vue/quiz.php'; $vues['quiz'] = 'vue/quiz.php';
$vues['endQuiz'] = 'vue/endQuiz.php'; $vues['endQuiz'] = 'vue/endQuiz.php';
$vues['submitQuote'] = 'vue/submitQuote.php'; $vues['submitQuote'] = 'vue/submitQuote.php';

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

@ -0,0 +1 @@
@import url(./style.css); /* Import de style.css */

@ -10,6 +10,10 @@ body.dark-mode .resultat {
background-color: var(--main-dark-other-color); background-color: var(--main-dark-other-color);
} }
body.dark-mode .suiv img{
filter: invert(100%);
}
/* ====== LIGHT MODE ====== */ /* ====== LIGHT MODE ====== */
body.light-mode h1, body.light-mode h2, body.light-mode p { body.light-mode h1, body.light-mode h2, body.light-mode p {
@ -20,10 +24,6 @@ body.light-mode .resultat {
background-color: var(--main-light-other-color); background-color: var(--main-light-other-color);
} }
body.light-mode .suiv img{
filter: invert(100%);
}
/* ====== ECRAN DEFAUT ====== */ /* ====== ECRAN DEFAUT ====== */
h1 { h1 {
@ -48,7 +48,7 @@ h1 {
} }
.suiv img { .suiv img {
width: 1vh; width: 7vh;
} }
/* ====== ECRAN TABLETTE ====== */ /* ====== ECRAN TABLETTE ====== */

@ -34,13 +34,6 @@ body.light-mode .inputPasswd{
color: black; color: black;
} }
body.dark-mode .saveButtonPasswd {
background: var(--main-dark-gradient);
color : var(--main-dark-text-color);
}
/* ====== LIGHT MODE ====== */ /* ====== LIGHT MODE ====== */
body.light-mode h1{ body.light-mode h1{
color : var(--main-light-text-color); color : var(--main-light-text-color);
@ -73,12 +66,6 @@ body.light-mode .inputPasswd{
color: black; color: black;
} }
body.light-mode .saveButtonPasswd {
background: var(--main-light-gradient);
color : var(--main-light-text-color);
}
/* ====== ECRAN DEFAUT ====== */ /* ====== ECRAN DEFAUT ====== */
h1{ h1{
@ -115,7 +102,7 @@ p{
.login{ .login{
width: 30vw; width: 30vw;
height: 77vh; height: 78vh;
margin: auto; margin: auto;
margin-top: 17vh; margin-top: 17vh;
border-radius: 25px; border-radius: 25px;
@ -141,13 +128,10 @@ p{
} }
.saveButtonPasswd { .saveButtonPasswd {
font-family: "Lemon", serif; display: block;
margin: auto;
background: transparent;
border: none; border: none;
padding: 1%;
border-radius: 25px;
width: 55%;
font-size: 15px;
margin-top: 5%;
} }
.buttonSudmiteDiv{ .buttonSudmiteDiv{

@ -69,6 +69,10 @@ body.light-mode .likeLien{
color: var(--main-light-text-color); color: var(--main-light-text-color);
} }
body.light-mode .like-icon-none img{
filter: invert(100%);
}
/* ====== DEFAULT ====== */ /* ====== DEFAULT ====== */
.central_container{ .central_container{
@ -170,7 +174,22 @@ body.light-mode .likeLien{
} }
.like-icon{ .like-icon{
font-size: 50px; height: 5vh;
margin-bottom: 2vh;
}
.like-icon img{
height: 5vh;
width: 5vh;
}
.like-icon-none img{
height: 5vh;
width: 5vh;
}
.like-icon-none{
height: 5vh;
margin-bottom: 2vh; margin-bottom: 2vh;
} }
@ -222,6 +241,15 @@ body.light-mode .likeLien{
flex: 1; flex: 1;
} }
.like-icon-none{
height: 5vh;
margin-bottom: 2vh;
}
.like-icon-none img{
height: 5vh;
}
@media (max-width: 834px) or (max-aspect-ratio : 1/1){ @media (max-width: 834px) or (max-aspect-ratio : 1/1){
.central_container{ .central_container{
flex-direction: column; flex-direction: column;
@ -274,8 +302,21 @@ body.light-mode .likeLien{
} }
.like-icon{ .like-icon{
font-size: 35px; height: 3vh;
margin-bottom: 2vh; }
.like-icon img{
height: 3vh;
width: 5vh;
}
.like-icon-none img{
height: 3vh;
width: 3vh;
}
.like-icon-none{
height: 3vh;
} }
.share-icon{ .share-icon{

@ -1,48 +1,42 @@
@import url(./style.css); @import url(./style.css);
@import url('https://fonts.googleapis.com/css2?family=Lemon&display=swap');
body, html {
height: 100%;
overflow: hidden;
}
/* ====== DARK MODE ====== */ /* ====== DARK MODE ====== */
body.dark-mode h1, body.dark-mode h2, body.dark-mode p { body.dark-mode h1, body.dark-mode h2, body.dark-mode p {
color: white; color: var(--main-dark-text-color);
font-family: "Lemon", serif;
text-align: center;
} }
body.dark-mode #box{
/* ====== LIGHT MODE ====== */ background: var(--main-dark-other-color);
body.light-mode h1, body.light-mode h2, body.light-mode p {
color: black;
font-family: "Lemon", serif;
text-align: center;
} }
/* ====== OTHER ====== */ /* ====== LIGHT MODE ====== */
body.light-mode h1, body.light-mode h2, body.light-mode p {
color: var(--main-light-text-color);
}
body.light-mode #box{
background: var(--main-light-other-color);
}
/* ====== ECRAN DEFAULT ====== */
#form { h1, h2{
width: 80%; font-family: "Lemon", serif;
height: 83%; text-align: center;
display: flex;
justify-content: center;
align-items: center;
} }
body.dark-mode #box { #box {
background-color: #1b0048; display: flex;
padding: 20px; flex-direction: column;
width: 50%; height: 60vh;
width: 60vw;
margin: auto; margin: auto;
border-radius: 15px; padding: 2%;
border: 1px solid #6100ff; border-radius: 25px;
} }

@ -28,6 +28,7 @@ class UserControler {
private UserModel $uMod; private UserModel $uMod;
private QuoteModel $qMod; private QuoteModel $qMod;
private QuestionModel $mdl; private QuestionModel $mdl;
private CharacterModel $caMod;
public function __construct() { public function __construct() {
global $co; global $co;
@ -35,6 +36,8 @@ class UserControler {
$this->uMod = new UserModel(new UserGateway($co)); $this->uMod = new UserModel(new UserGateway($co));
$this->qMod = new QuoteModel(new QuoteGateway($co)); $this->qMod = new QuoteModel(new QuoteGateway($co));
$this -> mdl = new QuestionModel(new QuestionGateway($co)); $this -> mdl = new QuestionModel(new QuestionGateway($co));
$this -> caMod = new CharacterModel(new CharacterGateway($co));
$this->srcMod = new SourceModel(new SourceGateway($co));
} }
public function profil() { public function profil() {
@ -113,6 +116,7 @@ class UserControler {
if ($_SESSION['no_question'] >= $total_questions) { if ($_SESSION['no_question'] >= $total_questions) {
$_SESSION['no_question'] = 0; $_SESSION['no_question'] = 0;
$this->endQuiz($id_quiz, $score); $this->endQuiz($id_quiz, $score);
$_SESSION['score'] = 0;
} }
else header("Location: ".$racine."/quiz/$id_quiz"); ///~kekentin/WF/WF-Website else header("Location: ".$racine."/quiz/$id_quiz"); ///~kekentin/WF/WF-Website
@ -159,7 +163,6 @@ class UserControler {
$answer = explode('-', $answerd)[0]; $answer = explode('-', $answerd)[0];
$id = (int) explode('-', $answerd)[1]; $id = (int) explode('-', $answerd)[1];
} }
$res = $this->mdl->getQuestion($id); $res = $this->mdl->getQuestion($id);
return $answer == $res->getCanswer(); return $answer == $res->getCanswer();
} }
@ -261,6 +264,8 @@ class UserControler {
public function submit() : void public function submit() : void
{ {
global $vues; global $vues;
$p = $this->caMod->getAllPerso();
$s = $this->srcMod->getAllSources();
require_once $vues['submitQuote']; require_once $vues['submitQuote'];
} }
@ -276,7 +281,7 @@ class UserControler {
{ {
$content = $_POST['content'] ?? null; $content = $_POST['content'] ?? null;
$character = $_POST['character'] ?? null; $character = $_POST['character'] ?? null;
$source = $_POST['source'] ?? null; $source = $_POST['src'] ?? null;
//$img = $_POST['img'] ?? null; //$img = $_POST['img'] ?? null;
$errors = [null, null]; $errors = [null, null];
@ -284,12 +289,12 @@ class UserControler {
$gw = new CharacterGateway($co); $gw = new CharacterGateway($co);
$mdl = new CharacterModel($gw); $mdl = new CharacterModel($gw);
$character = $mdl -> getCharacterByName($character); $character = $mdl -> getCharacterById($character);
$gw = new SourceGateway($co); $gw = new SourceGateway($co);
$mdl = new SourceModel($gw); $mdl = new SourceModel($gw);
$source = $mdl -> getSourceByTitle($source); $source = $mdl -> getSourceById($source);
if (!$character) if (!$character)
$errors[0] = "Personnage inexistant"; $errors[0] = "Personnage inexistant";
@ -298,16 +303,16 @@ class UserControler {
if ($errors[0] || $errors[1]) if ($errors[0] || $errors[1])
{ {
global $twig; global $twig;
echo $twig->render("submitQuote.html.twig", ['errors' => $errors]); $this->submit();
exit(); exit();
} }
$gw = new QuoteGateway($co); $gw = new QuoteGateway($co);
$mdl = new QuoteModel($gw); $mdl = new QuoteModel($gw);
$mdl -> insert4User($content, '/imgPath', 'fr', $this -> getIdOfUser(), $source->getIdSource(), $character->getIdCharacter()); //$mdl -> insert4User($content, '/imgPath', 'fr', $this -> getIdOfUser(), $source->getIdSource(), $character->getIdCharacter());
return [$content, $_POST['character'], $_POST['source']]; return [$content, $_POST['character'], $_POST['src']];
} }
return null; return null;
} }
@ -319,6 +324,28 @@ class UserControler {
*/ */
public function validsubmit() : void public function validsubmit() : void
{ {
if($_POST['src'] == 'other' && $_POST['character'] == 'other'){
global $vues;
$src = true;
$char = true;
require_once $vues['create'];
exit();
}
elseif($_POST['src'] == 'other'){
global $vues;
$src = true;
$char = false;
require_once $vues['create'];
exit();
}
elseif($_POST['character'] == 'other'){
global $vues;
$src = false;
$char = true;
require_once $vues['create'];
exit();
}
if($_POST)
$recap = $this -> toSubmit(); $recap = $this -> toSubmit();
if ($recap) if ($recap)
{ {

@ -39,7 +39,7 @@ class CharacterGateway extends Gateway
public function findAll() : array public function findAll() : array
{ {
$query = "SELECT * FROM caracter"; $query = "SELECT * FROM caracter ORDER BY caracter ASC";
$this -> co -> executeQuery($query); $this -> co -> executeQuery($query);
return $this -> co -> getResults(); return $this -> co -> getResults();
} }

@ -8,9 +8,13 @@ class CommentaryGateway extends Gateway{
$query = "Select id_comment from Commentary;"; $query = "Select id_comment from Commentary;";
$this -> co -> executeQuery($query); $this -> co -> executeQuery($query);
$res = $this -> co -> getResults(); $res = $this -> co -> getResults();
$tab = null;
foreach($res as $r){ foreach($res as $r){
$tab[] = $r["id_comment"]; $tab[] = $r["id_comment"];
} }
if($tab == null){
return 1;
}
$id=1; $id=1;
while(in_array($id,$tab)){$id=$id+1;} while(in_array($id,$tab)){$id=$id+1;}
return $id; return $id;

@ -24,24 +24,15 @@ class SourceGateway extends Gateway{
{ {
$query = "SELECT * FROM Source WHERE id_source = :id"; $query = "SELECT * FROM Source WHERE id_source = :id";
$this -> co -> executeQuery($query, array("id_source" => array($id, PDO::PARAM_INT))); $this -> co -> executeQuery($query, array("id" => array($id, PDO::PARAM_INT)));
return $res = $this -> co -> getResults(); return $res = $this -> co -> getResults();
} }
public function findByTitle(string $t) : array public function findByTitle(string $t) : array
{ {
$query = "SELECT * FROM Source WHERE title = :t"; $query = "SELECT * FROM Source WHERE title = :t";
$this -> co -> executeQuery($query, ["t" => array($t, PDO::PARAM_STR)]); $this -> co -> executeQuery($query, ["t" => array($t, PDO::PARAM_STR)]);
return $res = $this -> co -> getResults(); return $res = $this -> co -> getResults();
// if ($res)
// return new sourceEntity(
// $res["id_source"],
// $res["title"],
// $res["date"]
// );
// return null;
} }
public function findByDate(string $d) : array public function findByDate(string $d) : array
@ -64,22 +55,9 @@ class SourceGateway extends Gateway{
public function findAll() : array public function findAll() : array
{ {
$query = "SELECT * FROM Source"; $query = "SELECT * FROM Source ORDER BY title ASC";
$this -> co -> executeQuery($query); $this -> co -> executeQuery($query);
$res = $this -> co -> getResults(); return $this -> co -> getResults();
$sources = [];
foreach ($res as $source) {
$sources[] = new sourceEntity(
$source["id_source"],
$source["title"],
$source["date"],
TypeSourceEnum::Movie//$res["source"]
);
}
return $sources;
} }
public function delete(int $id) : bool public function delete(int $id) : bool

@ -19,11 +19,23 @@ class CharacterModel extends Model
$c = $this -> gateway -> findById($id_character); $c = $this -> gateway -> findById($id_character);
if ($c) if ($c)
return new CharacterEntity( return new CharacterEntity(
$c[0]['id_caracter'],
$c[0]['caracter'],
$c[0]['id_img']
);
return null;
}
public function getAllPerso() :array{
$res = $this->gateway->findAll();
foreach($res as $c){
$charac[] = new CharacterEntity(
$c['id_caracter'], $c['id_caracter'],
$c['caracter'], $c['caracter'],
$c['id_img'] $c['id_img']
); );
return null; }
return $charac;
} }
public function getCharacterByName(string $name) : ?CharacterEntity public function getCharacterByName(string $name) : ?CharacterEntity

@ -76,11 +76,12 @@ class SourceModel extends Model
$res = $this -> gateway -> findAll(); $res = $this -> gateway -> findAll();
$src = []; $src = [];
foreach ($res as $sources) { foreach ($res as $sources) {
$src[] = new sourceEntity( $src[] = new SourceEntity(
$sources["id_source"], $sources["id_source"],
$sources["title"], $sources["title"],
$sources["dates"], $sources["dates"],
TypeSourceEnum::from($sources["type"]) TypeSourceEnum::Movie
//TypeSourceEnum::from($sources["type"])
); );
} }
return $src; return $src;

@ -39,6 +39,10 @@ namespace Verification;
return $tabText; return $tabText;
} }
public static function verifNotNull($val){
}
} }
?> ?>

@ -0,0 +1,19 @@
<?php
global $twig;
echo $twig->render('head.html.twig', [
'title' => "Quiz",
'style' => "public/styles/styleCreate.css",
'scripts' => array("public/script/theme-toggle.js")
]);
// Rendu du bandeau
echo $twig->render('bandeau.html.twig');
echo $twig->render('create.html.twig', [
'src' => $src,
'char' => $char
]);
?>

@ -12,7 +12,11 @@ echo $twig->render('head.html.twig', [
// Rendu du bandeau // Rendu du bandeau
echo $twig->render('bandeau.html.twig'); echo $twig->render('bandeau.html.twig');
echo $twig -> render("submitQuote.html.twig"); echo $twig -> render("submitQuote.html.twig", array(
'valuesPerso' => $p,
'valuesSource' => $s,
'errors' => $errors ?? [],
));
?> ?>

@ -0,0 +1,16 @@
<div class="creation">
<form class="add" method="post" action="{{racine}}/add">
{% if src == true %}
<h1>Source</h1>
<label for="titre">Titre de la source *</label>
<input type="text" class="champ" id="titre" name="titre" placeholder="Titre de la source" required/>
<label for="quantity">Année de sortie *</label>
<input type="number" id="quantity" name="quantity" min="1850" max="{{ "now"|date("Y") }}" required>
{% endif %}
{% if char == true %}
{% endif %}
<input type="submit" class="btn" name="action" value="Soumettre"/>
</form>
<body>
<html>

@ -3,8 +3,8 @@
<h1>▶ Profil ◀</h1> <h1>▶ Profil ◀</h1>
<form method="post" action="{{ racine }}/changedata"> <form method="post" action="{{ racine }}/changedata">
<img src="{{ srcImg }}" class="imageProfil" onmousedown="return false"/> {# <img src="{{ srcImg }}" class="imageProfil" onmousedown="return false"/> #}
<button name="image" class="saveButtonPasswd" value="1" type="Submit">Changer l'image de profil</button> <button name="image" class="saveButtonPasswd" value="1" type="Submit"><img src="{{ srcImg }}" class="imageProfil" onmousedown="return false"/></button>
<p class="infoProfil" name="pseudo" id="username"> <strong>{{ srcUsername }}</strong><img class='imgModify' src='{{ racine }}/images/modify.svg' onclick="editFieldUsername('username')"/></p> <p class="infoProfil" name="pseudo" id="username"> <strong>{{ srcUsername }}</strong><img class='imgModify' src='{{ racine }}/images/modify.svg' onclick="editFieldUsername('username')"/></p>

@ -9,9 +9,9 @@
<div class="icons"> <div class="icons">
{% if fav == false %} {% if fav == false %}
<div class="like-icon"><a class="likeLien" href="{{racine}}/addFav/{{idQuote}}"></a></div> <div class="like-icon-none"><a class="likeLien" href="{{racine}}/addFav/{{idQuote}}"><img src="../images/Vector.png" alt="coeur vide"></a></div>
{% else %} {% else %}
<div class="like-icon"><a class="likeLien" href="{{racine}}/supFav/{{idQuote}}">❤️</a></div> <div class="like-icon"><a class="likeLien" href="{{racine}}/supFav/{{idQuote}}"><img src="../images/VectorCoeur.png" alt="coeur plein"></a></div>
{% endif %} {% endif %}
<div class="share-icon" onclick="copyCurrentUrl()">🔗</div> <div class="share-icon" onclick="copyCurrentUrl()">🔗</div>
</div> </div>

@ -1,38 +1,51 @@
<h1>▶ Submit a Quote ◀</h1> <h1>Ajouter une citation</h1>
<form id="form" method="post" action="/validsubmit"> <form id="form" method="post" action="{{racine}}/validsubmit">
<div id="box"> <div id="box">
<div id="contentField"> <div class="part">
<p>Contenu *</p>
<input type="text" id="content" name="content" placeholder="Entrez le contenu de la citation" required/>
</div>
<div id="characterField"> <div id="characterField">
<p>Personnage *</p>
<input type="text" id="character" name="character" placeholder="Entrez le/la personnage de la citation" required/>
{% if errors[0] is defined and errors[0] is not empty %}
<p style="color: red">{{ errors[0] }}</p>
{% endif %}
</div>
<div id="sourceField"> <div id="sourceField">
<p>Source *</p> <p>Source *</p>
<input type="text" id="source" name="source" placeholder="Entrez la source de la citation" required/> <select name="src" id="src">
<option value="">--Selectionner une source--</option>
{% for val in valuesSource %}
<option value="{{val.getIdSource()}}">{{val.title}}</option>
{% endfor %}
<option value="other">Autre</option>
</select>
{% if errors[1] is defined and errors[1] is not empty %} {% if errors[1] is defined and errors[1] is not empty %}
<p style="color: red">{{ errors[1] }}</p> <p style="color: red">{{ errors[1] }}</p>
{% endif %} {% endif %}
</div>
<p>Personnage *</p>
<select name="character" id="character">
<option value="">--Selectionner un personnage--</option>
{% for val in valuesPerso %}
<option value="{{val.getIdCharacter()}}">{{val.name}}</option>
{% endfor %}
<option value="other">Autre</option>
</select>
{% if errors[0] is defined and errors[0] is not empty %}
<p style="color: red">{{ errors[0] }}</p>
{% endif %}
</div> </div>
<div id="imageField"> </div>
<div class="part">
<p>Image *</p> <div id="contentField">
<p>Contenu *</p>
<textarea id="content" name="content" rows="5" cols="50" required>Ecrire une citation ...
</textarea>
</div>
</div> </div>

Loading…
Cancel
Save