You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
89 lines
2.7 KiB
89 lines
2.7 KiB
<?php
|
|
global $twig;
|
|
|
|
echo $twig->render('head.html.twig', array(
|
|
'title' => "Accueil",
|
|
'style' => "public/styles/styleAccueil.css",
|
|
'scripts' => array("public/script/theme-toggle.js")
|
|
));
|
|
|
|
echo $twig->render('bandeau.html.twig');
|
|
|
|
?>
|
|
<?php
|
|
|
|
$file = 'citation.txt';
|
|
$citations = file($file, FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES);
|
|
|
|
$citationDuJour = null;
|
|
$suggestions = [];
|
|
|
|
|
|
foreach ($citations as $citation) {
|
|
$parts = explode(';', $citation);
|
|
|
|
if (strpos(trim($parts[0]), 'µ') === 0) {
|
|
$citationDuJour = $parts;
|
|
} else {
|
|
$suggestions[] = $parts;
|
|
}
|
|
}
|
|
|
|
shuffle($suggestions);
|
|
|
|
$suggestions = array_filter($suggestions, function($suggestion) use ($citationDuJour) {
|
|
return count($suggestion) == 5 && !($suggestion[0] === trim($citationDuJour[1]));
|
|
});
|
|
|
|
$suggestions = array_slice($suggestions, 0, 10);
|
|
|
|
echo "<div class='citations-section'>";
|
|
|
|
if ($citationDuJour) {
|
|
$quote = htmlspecialchars(trim(substr($citationDuJour[1], 1))); // Retirer le symbole µ
|
|
$movie = htmlspecialchars(trim($citationDuJour[2]));
|
|
$character = htmlspecialchars(trim($citationDuJour[3]));
|
|
$year = htmlspecialchars(trim($citationDuJour[4]));
|
|
$imagePath = htmlspecialchars(trim($citationDuJour[5]));
|
|
|
|
echo "<h2>Citation du jour</h2>";
|
|
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='movie'>- $movie</p>";
|
|
echo "<p class='character'>Personnage : $character</p>";
|
|
echo "<p class='year'>Année : $year</p>";
|
|
echo "</div>";
|
|
echo "</div>";
|
|
} else {
|
|
echo "<p class='error'>Aucune citation du jour n'a été trouvée.</p>";
|
|
}
|
|
|
|
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>";
|
|
}
|
|
|
|
echo "</div>";
|
|
?>
|
|
</body>
|
|
</html>
|