diff --git a/images/iconeClaire copy.ico b/images/iconeClaire copy.ico new file mode 100644 index 0000000..4248279 Binary files /dev/null and b/images/iconeClaire copy.ico differ diff --git a/images/iconeClaire.ico b/images/iconeClaire.ico deleted file mode 100644 index 87a6e54..0000000 Binary files a/images/iconeClaire.ico and /dev/null differ diff --git a/index.php b/index.php index a4837a8..a92283c 100644 --- a/index.php +++ b/index.php @@ -15,8 +15,8 @@ if(!isset($_SESSION['theme'])){ require_once __DIR__ . '/config/config.php'; require __DIR__ . '/vendor/autoload.php'; -//$co = new \Gateway\Connection('pgsql:host=localhost;dbname=wikifantasy3;', 'postgres', 'sucepute'); -$co = new \Gateway\Connection('pgsql:host=localhost;dbname=dbkekentin;', 'kekentin', 'passwd'); +$co = new \Gateway\Connection('pgsql:host=localhost;dbname=wikifantasy3;', 'postgres', 'sucepute'); +//$co = new \Gateway\Connection('pgsql:host=localhost;dbname=dbkekentin;', 'kekentin', 'passwd'); //twig $loader = new \Twig\Loader\FilesystemLoader('vue/templates'); diff --git a/public/images/background.avif b/public/images/background.avif deleted file mode 100644 index 3350f94..0000000 Binary files a/public/images/background.avif and /dev/null differ diff --git a/public/images/iconeClaire.ico b/public/images/iconeClaire.ico index 87a6e54..4248279 100644 Binary files a/public/images/iconeClaire.ico and b/public/images/iconeClaire.ico differ diff --git a/public/styles/styleAccueilQuiz.css b/public/styles/styleAccueilQuiz.css index e25d58e..e1fdb96 100644 --- a/public/styles/styleAccueilQuiz.css +++ b/public/styles/styleAccueilQuiz.css @@ -3,40 +3,74 @@ h2{ text-align: center; font-size: 2em; - margin-top: 2em; - margin-bottom: 2em; + padding-top: 15px; + font-weight: bolder; } -.quizCard { - background: var(--main-dark-gradient); - border-radius: 15px; - padding: 1em; - display: flex; - flex-direction: column; - align-items: center; - box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1); +h3{ + text-align: center; + margin-left: 15px; + margin-right: 15px; + margin-top: -5px; + text-decoration: none; +} + +a{ + text-decoration: none; } -.quizCard img { - border-radius: 15px 15px 0 0; - width: 100%; - height: auto; +.linkQuiz img{ + width: 14vw; + height: 22vh; + object-fit: cover; + border-radius: 10px 10px 0px 0px; + margin : 10px; } -.quizCard h3 { - margin: 1em 0 0; - font-size: 1.5em; +.quizCard{ text-align: center; + border-radius: 15px; + box-shadow: 0px 0px 10px 0px rgba(0,0,0,0.2); } -.quizCard ul { +.quiz-container{ + margin-left: auto; + margin-right: auto; display: flex; - justify-content: center; - list-style: none; - padding: 0; - margin: 1em 0 0; + justify-content: start; + align-items: self-start; + gap: 2vw; + margin-top: 2em; + min-height: 68vh; + width: 95vw; + padding: 15px; + border-radius: 15px; +} + +/* Dark mode */ + +.dark-mode h3 { + color: white; +} + +.dark-mode .quizCard { + background: var(--main-dark-gradient); +} + +.dark-mode .quiz-container { + background: black; +} + +/* Light mode */ + +.light-mode h3 { + color: black; +} + +.light-mode .quizCard { + background: var(--main-light-gradient); } -.quizCard ul li { - margin: 0 0.5em; +.light-mode .quiz-container { + background: #46BE73; } \ No newline at end of file diff --git a/public/styles/styleSearch.css b/public/styles/styleSearch.css index 60c16ce..a142b5d 100644 --- a/public/styles/styleSearch.css +++ b/public/styles/styleSearch.css @@ -117,6 +117,13 @@ body.dark-mode .filtre label { body.light-mode .search-container { background: #ccc; } + +.light-mode form { + background-color: #fff; + margin-top: -30px; + padding-top: 35px; +} + body.light-mode .search-container input[type="search"] { color: #000; } diff --git a/src/Controleur/FrontControler.php b/src/Controleur/FrontControler.php index eea9964..50c1787 100644 --- a/src/Controleur/FrontControler.php +++ b/src/Controleur/FrontControler.php @@ -68,7 +68,7 @@ Class FrontControler{ $action = NULL; if(!$match){ - $dVueEreur = [404,"Page inconue"]; + $dVueEreur = [404,"Page non trouvée"]; $this->vueErreur($dVueEreur); } else{ @@ -78,7 +78,7 @@ Class FrontControler{ //Si existe, on l’appelle if(!$this->ifExisteAction($action)){ - $dVueEreur = [404,"Action inconue"]; + $dVueEreur = [404,"Action non trouvée"]; $this->vueErreur($dVueEreur); } diff --git a/src/Entity/QuizEntity.php b/src/Entity/QuizEntity.php index 8299b80..d440b2c 100644 --- a/src/Entity/QuizEntity.php +++ b/src/Entity/QuizEntity.php @@ -4,18 +4,26 @@ namespace Entity; class QuizEntity { - private int $id_quiz; + public int $id_quiz; - private int $nb_questions; + public int $nb_quest; + + public string $imgPath; + + public string $title; /** * @param int $id_quiz - * @param int $nb_questions + * @param int $nb_quest + * @param string $imgPath + * @param string $title */ - public function __construct(int $id_quiz, int $nb_questions) + public function __construct(int $id_quiz, int $nb_quest, string $imgPath, string $title) { $this->id_quiz = $id_quiz; - $this->nb_questions = $nb_questions; + $this->nb_quest = $nb_quest; + $this->imgPath = $imgPath; + $this->title = $title; } /** @@ -39,14 +47,46 @@ class QuizEntity */ public function getNbQuestions(): int { - return $this->nb_questions; + return $this->nb_quest; + } + + /** + * @param int $nb_quest + */ + public function setNbQuestions(int $nb_quest): void + { + $this->nb_quest = $nb_quest; + } + + /** + * @return string + */ + public function getIdImg(): string + { + return $this->imgPath; + } + + /** + * @param string $imgPath + */ + public function setIdImg(string $imgPath): void + { + $this->imgPath = $imgPath; + } + + /** + * @return string + */ + public function getTitle(): string + { + return $this->title; } /** - * @param int $nb_questions + * @param string $title */ - public function setNbQuestions(int $nb_questions): void + public function setTitle(string $title): void { - $this->nb_questions = $nb_questions; + $this->title = $title; } } diff --git a/src/Gateway/QuizGateway.php b/src/Gateway/QuizGateway.php index 5edce73..00c6a8d 100644 --- a/src/Gateway/QuizGateway.php +++ b/src/Gateway/QuizGateway.php @@ -8,16 +8,18 @@ use PDO; class QuizGateway extends Gateway { - public function create(int $id_quiz, int $nb_questions) : bool + public function create(int $id_quiz, int $nb_questions, string $id_img, string $title) : bool { $query = " INSERT INTO Quiz - VALUES (:id_q, :nb_q) + VALUES (:id_q, :nb_q, :id_img, :title) "; return $this -> co -> executeQuery($query, [ ':id_q' => array($id_quiz, PDO::PARAM_INT), - ':nb_q' => array($nb_questions, PDO::PARAM_INT) + ':nb_q' => array($nb_questions, PDO::PARAM_INT), + ':id_img' => array($id_img, PDO::PARAM_STR), + ':title' => array($title, PDO::PARAM_STR) ]); } @@ -36,7 +38,7 @@ class QuizGateway extends Gateway public function findAll() : array { - $query = "SELECT id_quiz, title, imgPath FROM Quiz q JOIN Image i on q.img = i.id_img"; + $query = "SELECT id_quiz, title, imgPath, nb_quest FROM Quiz q JOIN Image i on q.img = i.id_img"; $this -> co -> executeQuery($query); return $this -> co -> getResults(); } diff --git a/src/Model/QuizModel.php b/src/Model/QuizModel.php index 2284a83..8cc3383 100644 --- a/src/Model/QuizModel.php +++ b/src/Model/QuizModel.php @@ -8,9 +8,9 @@ use Gateway\Gateway; class QuizModel extends Model{ - public function createQuiz(int $id_quiz, int $nb_questions) : bool + public function createQuiz(int $id_quiz, int $nb_questions, String $id_img, string $title) : bool { - return $this -> gateway -> create($id_quiz, $nb_questions); + return $this -> gateway -> create($id_quiz, $nb_questions, $id_img, $title); } public function getQuiz(int $id_quiz): ?quizEntity @@ -19,7 +19,9 @@ class QuizModel extends Model{ if ($q) { return new quizEntity( $q[0]['id_quiz'], - $q[0]['nb_quest'] + $q[0]['nb_quest'], + $q[0]['id_img'], + $q[0]['title'] ); } return null; @@ -32,6 +34,20 @@ class QuizModel extends Model{ public function listQuiz() : array { - + $res = $this -> gateway -> findAll(); + + $quizs = []; + + foreach ($res as $quiz) + { + $quizs[] = new quizEntity( + $quiz['id_quiz'], + $quiz['nb_quest'], + $quiz['imgpath'], + $quiz['title'] + ); + } + + return $quizs; } } \ No newline at end of file diff --git a/vue/accueilQuiz.php b/vue/accueilQuiz.php index 98eed7b..2a5572b 100644 --- a/vue/accueilQuiz.php +++ b/vue/accueilQuiz.php @@ -10,7 +10,7 @@ echo $twig->render('head.html.twig', [ echo $twig->render('bandeau.html.twig'); -echo $twig->render('quiz.html.twig', [ - 'quizList' => $quizIds +echo $twig->render('accueilQuiz.html.twig', [ + 'quizs' => $quizs ]); ?> \ No newline at end of file diff --git a/vue/templates/accueilQuiz.html.twig b/vue/templates/accueilQuiz.html.twig index 47083ee..81eefa3 100644 --- a/vue/templates/accueilQuiz.html.twig +++ b/vue/templates/accueilQuiz.html.twig @@ -1,17 +1,15 @@