plein d'ajout

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

@ -12,7 +12,7 @@ $base = '';
$login = '';
$mdp = '';
$racine='/~lebeaulato/WF-Website'; // /~kekentin/WF/WF-Website
$racine='/~kemondejar/WF-Website'; // /~kekentin/WF/WF-Website
//Vues
@ -24,7 +24,7 @@ $vues['login'] = 'vue/login.php';
$vues['signin'] = 'vue/signin.php';
$vues['search'] = 'vue/search.php';
$vues['favorite'] = 'vue/favorits.php';
$vues['create'] = 'vue/create.php';
$vues['quiz'] = 'vue/quiz.php';
$vues['endQuiz'] = 'vue/endQuiz.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);
}
body.dark-mode .suiv img{
filter: invert(100%);
}
/* ====== LIGHT MODE ====== */
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);
}
body.light-mode .suiv img{
filter: invert(100%);
}
/* ====== ECRAN DEFAUT ====== */
h1 {
@ -48,7 +48,7 @@ h1 {
}
.suiv img {
width: 1vh;
width: 7vh;
}
/* ====== ECRAN TABLETTE ====== */

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

@ -69,6 +69,10 @@ body.light-mode .likeLien{
color: var(--main-light-text-color);
}
body.light-mode .like-icon-none img{
filter: invert(100%);
}
/* ====== DEFAULT ====== */
.central_container{
@ -170,7 +174,22 @@ body.light-mode .likeLien{
}
.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;
}
@ -222,6 +241,15 @@ body.light-mode .likeLien{
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){
.central_container{
flex-direction: column;
@ -272,12 +300,25 @@ body.light-mode .likeLien{
.icons{
margin: 2vh;
}
.like-icon{
font-size: 35px;
margin-bottom: 2vh;
height: 3vh;
}
.like-icon img{
height: 3vh;
width: 5vh;
}
.like-icon-none img{
height: 3vh;
width: 3vh;
}
.like-icon-none{
height: 3vh;
}
.share-icon{
font-size: 35px;
}

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

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

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

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

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

@ -19,11 +19,23 @@ class CharacterModel extends Model
$c = $this -> gateway -> findById($id_character);
if ($c)
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['caracter'],
$c['id_img']
);
return null;
}
return $charac;
}
public function getCharacterByName(string $name) : ?CharacterEntity

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

@ -38,6 +38,10 @@ namespace Verification;
}
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
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>
<form method="post" action="{{ racine }}/changedata">
<img src="{{ srcImg }}" class="imageProfil" onmousedown="return false"/>
<button name="image" class="saveButtonPasswd" value="1" type="Submit">Changer l'image de profil</button>
{# <img src="{{ srcImg }}" class="imageProfil" onmousedown="return false"/> #}
<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>

@ -9,9 +9,9 @@
<div class="icons">
{% 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 %}
<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 %}
<div class="share-icon" onclick="copyCurrentUrl()">🔗</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="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">
<div id="sourceField">
<p>Source *</p>
<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>
<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 %}
{% if errors[1] is defined and errors[1] is not empty %}
<p style="color: red">{{ errors[1] }}</p>
{% endif %}
</div>
</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>
<div id="sourceField">
{% if errors[0] is defined and errors[0] is not empty %}
<p style="color: red">{{ errors[0] }}</p>
{% endif %}
<p>Source *</p>
<input type="text" id="source" name="source" placeholder="Entrez la source de la citation" required/>
{% if errors[1] is defined and errors[1] is not empty %}
<p style="color: red">{{ errors[1] }}</p>
{% endif %}
</div>
</div>
<div class="part">
<div id="imageField">
<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>

Loading…
Cancel
Save