search page

pull/21/head
brongniart 5 months ago
parent 7b98ca54a8
commit 812c73c94e

Binary file not shown.

After

Width:  |  Height:  |  Size: 50 KiB

@ -50,6 +50,19 @@ body {
width: 40%;
}
.search {
display: flex;
flex-direction: row;
justify-content: center;
align-items: center;
vertical-align: center;
margin: 10px;
width: 70px;
height: 70px;
border-radius: 50%;
}
/* Mode sombre */
body.dark-mode {
background-color: #120B1D;
@ -68,6 +81,10 @@ body.dark-mode .nav img:hover {
filter: invert(59%) sepia(96%) saturate(6733%) hue-rotate(275deg) brightness(112%) contrast(122%);
}
body.dark-mode .search {
background: linear-gradient(to right, #4a148c, #7b1fa2);
}
/* Mode clair */
body.light-mode {
background-color: #ffffff;
@ -86,6 +103,10 @@ body.light-mode .nav img:hover {
filter: invert(22%) sepia(6%) saturate(2269%) hue-rotate(193deg) brightness(98%) contrast(106%);
}
body.light-mode .search {
background: linear-gradient(180deg, rgba(187,211,249,1) 0%, rgba(199,246,196,1) 100%);
}
/* Media queries for responsiveness */
/* For tablets and small devices */

@ -1,4 +1,5 @@
@import url('style.css'); /* Import de style.css */
@import url(./style.css); /* Import de style.css */
@import url(./styleQuoteLittle.css);
/* Conteneur général pour les citations */
.citations-section {
@ -11,41 +12,6 @@
margin: 0 0;
}
/* Conteneur pour les suggestions en deux colonnes */
.suggestions-container {
display: flex;
flex-wrap: wrap;
justify-content: space-between;
width: 90%;
margin: 0 auto;
}
/* Citations */
.citation-container {
background: linear-gradient(to right, #4a148c, #7b1fa2);
border-radius: 12px;
color: white;
display: flex;
align-items: flex-start;
width: 49%; /* Chaque citation occupe 45% de la largeur pour laisser 5% d'espace */
box-sizing: border-box;
padding: 0;
height: 150px;
overflow: hidden;
margin-bottom: 20px;
word-wrap: break-word; /* Permet de couper les mots trop longs */
word-break: break-word;
}
/* Fixe la taille pour s'assurer que toutes les citations restent cohérentes */
.citation-container .text-content {
flex-grow: 1;
display: flex;
flex-direction: column;
justify-content: center;
height: 150px;
}
/* Citation du jour - toujours en pleine largeur */
.citation-du-jour {
width: 90%; /* Prend toute la largeur */
@ -56,80 +22,3 @@
height: 150px;
}
.suggestion {
background: linear-gradient(180deg, rgba(187,211,249,1) 0%, rgba(199,246,196,1) 100%);
padding: 0;
overflow: hidden;
}
.citation-image {
width: 150px;
height: 100%;
object-fit: cover;
margin: 0;
border-radius: 0;
}
.text-content {
flex: 1;
padding: 10px;
display: flex;
flex-direction: column;
justify-content: center; /* Centre verticalement le texte */
word-wrap: break-word; /* Permet de couper les mots trop longs */
word-break: break-word;
}
.quote {
font-size: 1.2em;
margin-bottom: 10px;
font-style: italic;
}
.movie, .character, .year {
margin-bottom: 5px;
}
/* Mode sombre */
body.dark-mode .suggestion {
background: linear-gradient(to right, #4a148c, #7b1fa2);
color:white;
}
/* Mode clair */
body.light-mode .suggestion {
background: linear-gradient(180deg, rgba(187,211,249,1) 0%, rgba(199,246,196,1) 100%);
color:black; /* Changer le texte en noir pour le mode clair */
}
body.light-mode .quote,
body.light-mode .movie,
body.light-mode .character,
body.light-mode .year {
color: black; /* Forcer le texte en noir pour le mode clair */
}
/* Responsive design */
@media (max-width: 768px) {
.suggestions-container {
flex-direction: column;
width: 100%;
}
.citation-container {
width: 100%; /* Chaque citation prend toute la largeur sur mobile */
max-width: 100%;
height: 100px; /* Supprimer la hauteur fixe sur mobile */
}
.citation-image {
width: 100px;
height: 100px;
}
.quote {
font-size: 1em;
}
}

@ -0,0 +1,111 @@
/* Conteneur pour les suggestions en deux colonnes */
.quotes-container {
display: flex;
flex-wrap: wrap;
justify-content: space-between;
width: 90%;
margin: 0 auto;
}
/* Citations */
.citation-container {
background: linear-gradient(to right, #4a148c, #7b1fa2);
border-radius: 12px;
color: white;
display: flex;
align-items: flex-start;
width: 49%; /* Chaque citation occupe 45% de la largeur pour laisser 5% d'espace */
box-sizing: border-box;
padding: 0;
height: 150px;
overflow: hidden;
margin-bottom: 20px;
word-wrap: break-word; /* Permet de couper les mots trop longs */
word-break: break-word;
}
/* Fixe la taille pour s'assurer que toutes les citations restent cohérentes */
.citation-container .text-content {
flex-grow: 1;
display: flex;
flex-direction: column;
justify-content: center;
height: 150px;
}
.quote {
background: linear-gradient(180deg, rgba(187,211,249,1) 0%, rgba(199,246,196,1) 100%);
padding: 0;
overflow: hidden;
}
.citation-image {
width: 150px;
height: 100%;
object-fit: cover;
margin: 0;
border-radius: 0;
}
.text-content {
flex: 1;
padding: 10px;
display: flex;
flex-direction: column;
justify-content: center; /* Centre verticalement le texte */
word-wrap: break-word; /* Permet de couper les mots trop longs */
word-break: break-word;
}
.quoteContent {
font-size: 1.2em;
margin-bottom: 10px;
font-style: italic;
}
.movie, .character, .year {
margin-bottom: 5px;
}
/* Mode sombre */
body.dark-mode .quote {
background: linear-gradient(to right, #4a148c, #7b1fa2);
color:white;
}
/* Mode clair */
body.light-mode .quote {
background: linear-gradient(180deg, rgba(187,211,249,1) 0%, rgba(199,246,196,1) 100%);
color:black; /* Changer le texte en noir pour le mode clair */
}
body.light-mode .quote,
body.light-mode .movie,
body.light-mode .character,
body.light-mode .year {
color: black; /* Forcer le texte en noir pour le mode clair */
}
/* Responsive design */
@media (max-width: 768px) {
.suggestions-container {
flex-direction: column;
width: 100%;
}
.citation-container {
width: 100%; /* Chaque citation prend toute la largeur sur mobile */
max-width: 100%;
height: 100px; /* Supprimer la hauteur fixe sur mobile */
}
.citation-image {
width: 100px;
height: 100px;
}
.quote {
font-size: 1em;
}
}

@ -1,11 +1,69 @@
@import url(./style.css);
@import url(./styleQuoteLittle.css);
/* ====== DEFAULT ====== */
.search-container {
margin-left: 5%;
width: 90%;
height: 60px;
border-radius: 40px;
}
.search-container .searchButton {
float: right;
width: 60px;
height: 60px;
border-radius: 50%;
display: flex;
justify-content: center;
align-items: center;
}
.searchButton img{
width: 70%;
height: 70%;
}
.search-container input[type="search"] {
margin: 10px ;
border:none;
background: none;
float:left;
padding: 0;
color: #00f;
font-size: 16px;
line-height: 40px;
width:auto;
}
.filtre{
display: flex;
justify-content: space-around;
font-size: 30px;
}
/* ====== DARK MODE ====== */
/*body.dark-mode */
body.dark-mode .search-container {
background: #fff;
}
body.dark-mode .search-container input[type="search"] {
color: #000;
}
body.dark-mode .search-container .searchButton {
background: linear-gradient(to right, #4a148c, #7b1fa2);
}
/* ====== LIGHT MODE ====== */
/*body.light-mode*/
/* ====== DEFAULT ====== */
body.light-mode .search-container {
background: #ccc;
}
body.light-mode .search-container input[type="search"] {
color: #000;
}
body.light-mode .search-container .searchButton {
background: linear-gradient(180deg, rgba(187,211,249,1) 0%, rgba(199,246,196,1) 100%);
}

@ -37,12 +37,12 @@ Class FrontControler{
'' => '[^/\.]++'
*/
$router->map('GET|POST', '/quote/[i:idQuote]?', 'VisitorControler','quote');
$router->map('GET|POST', '/login', 'VisitorControler','login');
$router->map('GET|POST', '/signin', 'VisitorControler','signin');
$router->map('GET', '/quote/[i:idQuote]?', 'VisitorControler','quote');
$router->map('GET', '/login', 'VisitorControler','login');
$router->map('GET', '/signin', 'VisitorControler','signin');
$router->map('GET|POST', '/quiz/[i:id]?', 'QuizControler','quiz');
$router->map('GET|POST', '/search/[a:type]?', 'VisitorControler','search');
$router->map('GET', '/quiz/[i:id]?', 'QuizControler','quiz');
$router->map('GET|POST', '/search', 'VisitorControler','search');
$match = $router->match();

@ -1,16 +1,19 @@
<?php
namespace Controleur;
use Model\QuoteModel;
use Model\SearchModel;
use Gateway\Connection;
use Gateway\QuoteGateway;
Class VisitorControler{
private QuoteModel $qMod;
private SearchModel $sMod;
public function __construct(){
global $co;
$this->qMod = new QuoteModel(new QuoteGateway($co));
$this->sMod = new SearchModel(new QuoteGateway($co));
}
public function accueil(){
@ -22,7 +25,7 @@ Class VisitorControler{
global $vues;
$id=$arg['idQuote'] ?? 1;
$q = $this->qMod->searchId($id);
//echo "{$id}";
require_once $vues['quote'];
}
@ -38,9 +41,16 @@ Class VisitorControler{
require_once $vues['signin'];
}
public function search(){
public function search(array $arg){
global $vues;
$type = ($_POST['type'] ?? "");
$search = ($_POST['search'] ?? NULL);
$filtre = ($arg['filtre'] ?? []);
$tq=$this->sMod->searchQuote($type,$search,$filtre);
require_once $vues['search'];
}
}

@ -44,7 +44,33 @@ Class QuoteGateway{
return $result;
}
public function search(?string $type,?string $search,array $filtre):array{
$query="SELECT q.id_quote, q.content, c.caracter, i.imgPath, s.title, s.dates, q.likes, q.langue
FROM Quote q
JOIN Caracter c ON c.id_caracter = q.id_caracter
JOIN Source s ON s.id_source = q.id_source
JOIN Image i ON c.id_img = i.id_img
WHERE lower(";
if($type=='personnage'){
$query = $query . "c.caracter) LIKE lower('%" . $search . "%')";
}
elseif($type=='titre'){
$query = $query . "s.title) LIKE lower('%" . $search . "%')";
}
else{
$query = $query . "q.content) LIKE lower('%" . $search . "%')";
}
/* Categorie a rajouter
foreach($filtre as $fil){
$query = $query . " AND " . $fil
}*/
$this->con->executeQuery($query,array());
$result=$this->con->getResults();
return $result;
}
//======================== PARTI ADMIN ========================
//Probablement à déplacer dans un autre fichier

@ -49,7 +49,7 @@ if ($citationDuJour) {
echo "<div class='citation-container citation-du-jour'>";
echo "<img src='$imagePath' alt='$movie' class='citation-image'>";
echo "<div class='text-content'>";
echo "<p class='quote'>\"$quote\"</p>";
echo "<p class='quoteContent'>\"$quote\"</p>";
echo "<p class='movie'>- $movie</p>";
echo "<p class='character'>Personnage : $character</p>";
echo "<p class='year'>Année : $year</p>";
@ -61,23 +61,16 @@ if ($citationDuJour) {
if (!empty($suggestions)) {
echo "<h2>Suggestions</h2>";
echo "<div class='suggestions-container'>";
foreach ($suggestions as $suggestion) {
$quote = htmlspecialchars(trim($suggestion[0]));
$movie = htmlspecialchars(trim($suggestion[1]));
$character = htmlspecialchars(trim($suggestion[2]));
$year = htmlspecialchars(trim($suggestion[3]));
$imagePath = htmlspecialchars(trim($suggestion[4]));
echo "<div class='citation-container suggestion'>";
echo "<img src='$imagePath' alt='$movie' class='citation-image'>";
echo "<div class='text-content'>";
echo "<p class='quote'>\"$quote\"</p>";
echo "<p class='movie'>- $movie</p>";
echo "<p class='character'>Personnage : $character</p>";
echo "<p class='year'>Année : $year</p>";
echo "</div>";
echo "</div>";
echo "<div class='quotes-container'>";
foreach($suggestions as $suggestion){
echo $twig->render('quoteLittle.html.twig', array(
'srcImg' => htmlspecialchars(trim($suggestion[4])),
'quoteContent' => htmlspecialchars(trim($suggestion[0])) ,
'sourceName' => htmlspecialchars(trim($suggestion[1])) ,
'nameCarac' => htmlspecialchars(trim($suggestion[2])) ,
'dateSortie' => htmlspecialchars(trim($suggestion[3])) ,
));
}
echo "</div>";
}

@ -8,9 +8,25 @@
));
echo $twig->render('bandeau.html.twig');
echo $twig->render('filtre.html.twig');
echo $_POST['type'];
echo $_POST['search'];
echo $twig->render('filtre.html.twig',array(
'search'=>$search,
'type'=>$type,
));
echo "<h2>Résultats</h2>";
echo "<div class='quotes-container'>";
foreach($tq as $q){
echo $twig->render('quoteLittle.html.twig', array(
'srcImg' => $q->getImgPath(),
'quoteContent' => $q->getContent(),
'sourceName' => $q->getTitleSrc(),
'nameCarac' => $q->getCarac(),
'dateSortie' => $q->getDateSrc(),
));
}
echo "</div>";
//echo $twig->render('resultat.html.twig');
?>

@ -9,6 +9,11 @@
<a href="{{ racine }}/"><img src="images/WIKIFANTASY.png" alt="Logo" width="227px" height="106px" onmousedown="return false"></a>
</div>
<div class="user">
<div class="search">
<a href="{{ racine }}/search"><img src="images/search.png" alt="search" width="50px" height="50px" onmousedown="return false"></a>
</div>
<a href="{{ racine }}/login"><img src="images/user_dark.png" alt="user" width="70px" height="70px" onmousedown="return false"></a>
</div>
</div>

@ -1,44 +1,46 @@
<form action="#" method="post">
<input type="search" id="filtre" name="search"/>
<form action="{{racine}}/search" method="post">
<div class="search-container">
<input type="search" placeholder="Recherche" id="filtre" name="search" value="{{ search }}"/>
<button class="searchButton" type="submit"> <img src="images/search" alt='Search'> </button>
</div>
<div>
<div class="filtre">
<div>
<input type="radio" id="citation" name="type" value="citation" checked />
<input type="radio" id="citation" name="type" value="citation" {% if type!='titre' or type!='personnage' %} checked {% endif %}/>
<label for="citation">Citation</label>
</div>
<div>
<input type="radio" id="titre" name="type" value="titre" />
<input type="radio" id="titre" name="type" value="titre" {% if type=='titre' %} checked {% endif %} />
<label for="titre">Titre</label>
</div>
<div>
<input type="radio" id="personnage" name="type" value="personnage" />
<input type="radio" id="personnage" name="type" value="personnage" {% if type=='personnage' %} checked {% endif %} />
<label for="personnage">Personnage</label>
</div>
</div>
<!--
<p>Plus de filtre</p>
<div>
<label>Filter by:</label>
<div>
<input type="checkbox" id="film" name="film" checked />
<input type="checkbox" id="film" name="film" value="film" />
<label for="film">Film</label>
</div>
<div>
<input type="checkbox" id="roman" name="roman" />
<input type="checkbox" id="roman" name="roman" value="roman"/>
<label for="roman">Roman</label>
</div>
<div>
<input type="checkbox" id="jeux_vidéo" name="jeux_vidéo" />
<input type="checkbox" id="jeux_vidéo" name="jeux_vidéo" value="jeux_vidéo"/>
<label for="jeux_vidéo">Jeux Vidéo</label>
</div>
</div>
<input type="submit" value="Search" />
-->
</form>

@ -0,0 +1,9 @@
<div class='citation-container quote'>
<img src="{{ srcImg }}" alt='{{ sourceName }}' class='citation-image'>
<div class='text-content'>
<p class='quoteContent'>{{ quoteContent }}</p>
<p class='movie'>- {{ sourceName }}</p>
<p class='character'>Personnage : {{ nameCarac }}</p>
<p class='year'>Année : {{ dateSortie }}</p>
</div>
</div>
Loading…
Cancel
Save