diff --git a/config/config.php b/config/config.php index 322a129..830d1bd 100644 --- a/config/config.php +++ b/config/config.php @@ -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'; diff --git a/images/Vector.png b/images/Vector.png new file mode 100644 index 0000000..c07ee25 Binary files /dev/null and b/images/Vector.png differ diff --git a/images/VectorCoeur.png b/images/VectorCoeur.png new file mode 100644 index 0000000..18e6909 Binary files /dev/null and b/images/VectorCoeur.png differ diff --git a/public/styles/styleCreate.css b/public/styles/styleCreate.css new file mode 100644 index 0000000..e169897 --- /dev/null +++ b/public/styles/styleCreate.css @@ -0,0 +1 @@ +@import url(./style.css); /* Import de style.css */ \ No newline at end of file diff --git a/public/styles/styleEndQuiz.css b/public/styles/styleEndQuiz.css index 81c9892..b1de2e1 100644 --- a/public/styles/styleEndQuiz.css +++ b/public/styles/styleEndQuiz.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 ====== */ diff --git a/public/styles/styleProfil.css b/public/styles/styleProfil.css index e956e20..8e9c64f 100644 --- a/public/styles/styleProfil.css +++ b/public/styles/styleProfil.css @@ -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{ diff --git a/public/styles/styleQuote.css b/public/styles/styleQuote.css index de94f79..ae1fd7e 100644 --- a/public/styles/styleQuote.css +++ b/public/styles/styleQuote.css @@ -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; } diff --git a/public/styles/styleSubmitQuote.css b/public/styles/styleSubmitQuote.css index 98ee5cd..b99085b 100644 --- a/public/styles/styleSubmitQuote.css +++ b/public/styles/styleSubmitQuote.css @@ -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; } diff --git a/src/Controleur/UserControler.php b/src/Controleur/UserControler.php index 9a1ad92..fc30281 100644 --- a/src/Controleur/UserControler.php +++ b/src/Controleur/UserControler.php @@ -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); diff --git a/src/Entity/characterEntity.php b/src/Entity/CharacterEntity.php similarity index 100% rename from src/Entity/characterEntity.php rename to src/Entity/CharacterEntity.php diff --git a/src/Gateway/CharacterGateway.php b/src/Gateway/CharacterGateway.php index f09cbc1..9d4c1b7 100644 --- a/src/Gateway/CharacterGateway.php +++ b/src/Gateway/CharacterGateway.php @@ -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(); } diff --git a/src/Gateway/CommentaryGateway.php b/src/Gateway/CommentaryGateway.php index 0885ec1..22a4754 100644 --- a/src/Gateway/CommentaryGateway.php +++ b/src/Gateway/CommentaryGateway.php @@ -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; diff --git a/src/Gateway/SourceGateway.php b/src/Gateway/SourceGateway.php index ed540b3..15bff2b 100644 --- a/src/Gateway/SourceGateway.php +++ b/src/Gateway/SourceGateway.php @@ -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 diff --git a/src/Model/CharacterModel.php b/src/Model/CharacterModel.php index fa1e074..5259c60 100644 --- a/src/Model/CharacterModel.php +++ b/src/Model/CharacterModel.php @@ -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 diff --git a/src/Model/sourceModel.php b/src/Model/SourceModel.php similarity index 91% rename from src/Model/sourceModel.php rename to src/Model/SourceModel.php index baf1c37..2a7b6e4 100644 --- a/src/Model/sourceModel.php +++ b/src/Model/SourceModel.php @@ -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; diff --git a/src/Verification/Verification.php b/src/Verification/Verification.php index a849265..a3ac123 100644 --- a/src/Verification/Verification.php +++ b/src/Verification/Verification.php @@ -38,6 +38,10 @@ namespace Verification; } return $tabText; } + + public static function verifNotNull($val){ + + } } diff --git a/vue/create.php b/vue/create.php new file mode 100644 index 0000000..e0a16eb --- /dev/null +++ b/vue/create.php @@ -0,0 +1,19 @@ +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 +]); +?> diff --git a/vue/submitQuote.php b/vue/submitQuote.php index f36cb2c..f4d6595 100644 --- a/vue/submitQuote.php +++ b/vue/submitQuote.php @@ -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 ?? [], +)); ?> diff --git a/vue/templates/create.html.twig b/vue/templates/create.html.twig new file mode 100644 index 0000000..1661284 --- /dev/null +++ b/vue/templates/create.html.twig @@ -0,0 +1,16 @@ +