ajout SAE PHP 19/20 Meilleure note de la promo

This commit is contained in:
EmmanuelTiamzon
2025-12-05 10:30:43 +01:00
parent b05817dbcd
commit 0ae7d097f9
290 changed files with 69511 additions and 0 deletions

View File

@@ -0,0 +1,48 @@
<!DOCTYPE html>
<html lang="fr">
<head>
<meta charset="UTF-8">
<title>Modifier la critique</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="<?= base_url('assets/style.css') ?>">
</head>
<body>
<div class="edit-review-container">
<h2>Modifier votre critique</h2>
<?php if (!empty($critique->tvshow_id)): ?>
<div style="text-align: center; margin-bottom: 30px;">
<?php if (!empty($critique->jpeg)): ?>
<img
style="display: block; margin: 0 auto;"
src="data:image/jpeg;base64,<?= base64_encode($critique->jpeg) ?>" />
<?php else: ?>
<img
src="<?= base_url('assets/img/default.jpg') ?>"
alt="Image non disponible" />
<?php endif; ?>
</a>
</div>
<?php endif; ?>
<form method="post">
<label class="edit-label">Note :</label>
<div class="rating">
<?php for ($i = 5; $i >= 1; $i--): ?>
<input type="radio" id="star<?= $i ?>" name="note" value="<?= $i ?>" <?= ($critique->note == $i ? 'checked' : '') ?>>
<label for="star<?= $i ?>">★</label>
<?php endfor; ?>
</div>
<label for="commentaire" class="edit-label">Commentaire :</label>
<textarea name="commentaire" id="commentaire" class="edit-textarea" rows="6"><?= html_escape($critique->commentaire ?? '') ?></textarea>
<button type="submit" class="edit-btn">Enregistrer</button>
</form>
</div>
</body>
</html>

View File

@@ -0,0 +1,8 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
echo "\nERROR: ",
$heading,
"\n\n",
$message,
"\n\n";

View File

@@ -0,0 +1,8 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
echo "\nDatabase error: ",
$heading,
"\n\n",
$message,
"\n\n";

View File

@@ -0,0 +1,21 @@
<?php defined('BASEPATH') OR exit('No direct script access allowed'); ?>
An uncaught Exception was encountered
Type: <?php echo get_class($exception), "\n"; ?>
Message: <?php echo $message, "\n"; ?>
Filename: <?php echo $exception->getFile(), "\n"; ?>
Line Number: <?php echo $exception->getLine(); ?>
<?php if (defined('SHOW_DEBUG_BACKTRACE') && SHOW_DEBUG_BACKTRACE === TRUE): ?>
Backtrace:
<?php foreach ($exception->getTrace() as $error): ?>
<?php if (isset($error['file']) && strpos($error['file'], realpath(BASEPATH)) !== 0): ?>
File: <?php echo $error['file'], "\n"; ?>
Line: <?php echo $error['line'], "\n"; ?>
Function: <?php echo $error['function'], "\n\n"; ?>
<?php endif ?>
<?php endforeach ?>
<?php endif ?>

View File

@@ -0,0 +1,8 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
echo "\nERROR: ",
$heading,
"\n\n",
$message,
"\n\n";

View File

@@ -0,0 +1,21 @@
<?php defined('BASEPATH') OR exit('No direct script access allowed'); ?>
A PHP Error was encountered
Severity: <?php echo $severity, "\n"; ?>
Message: <?php echo $message, "\n"; ?>
Filename: <?php echo $filepath, "\n"; ?>
Line Number: <?php echo $line; ?>
<?php if (defined('SHOW_DEBUG_BACKTRACE') && SHOW_DEBUG_BACKTRACE === TRUE): ?>
Backtrace:
<?php foreach (debug_backtrace() as $error): ?>
<?php if (isset($error['file']) && strpos($error['file'], realpath(BASEPATH)) !== 0): ?>
File: <?php echo $error['file'], "\n"; ?>
Line: <?php echo $error['line'], "\n"; ?>
Function: <?php echo $error['function'], "\n\n"; ?>
<?php endif ?>
<?php endforeach ?>
<?php endif ?>

View File

@@ -0,0 +1,11 @@
<!DOCTYPE html>
<html lang="en">
<head>
<title>403 Forbidden</title>
</head>
<body>
<p>Directory access is forbidden.</p>
</body>
</html>

View File

@@ -0,0 +1,87 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
?><!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>404 Page Not Found</title>
<style type="text/css">
::selection { background-color: #f07746; color: #fff; }
::-moz-selection { background-color: #f07746; color: #fff; }
body {
background-color: #fff;
margin: 40px auto;
max-width: 1024px;
font: 16px/24px normal "Helvetica Neue", Helvetica, Arial, sans-serif;
color: #808080;
}
a {
color: #dd4814;
background-color: transparent;
font-weight: normal;
text-decoration: none;
}
a:hover {
color: #97310e;
}
h1 {
color: #fff;
background-color: #dd4814;
border-bottom: 1px solid #d0d0d0;
font-size: 22px;
font-weight: bold;
margin: 0 0 14px 0;
padding: 5px 15px;
line-height: 40px;
}
h2 {
color:#404040;
margin:0;
padding:0 0 10px 0;
}
code {
font-family: Consolas, Monaco, Courier New, Courier, monospace;
font-size: 13px;
background-color: #f5f5f5;
border: 1px solid #e3e3e3;
border-radius: 4px;
color: #002166;
display: block;
margin: 14px 0 14px 0;
padding: 12px 10px 12px 10px;
}
#container {
margin: 10px;
border: 1px solid #d0d0d0;
box-shadow: 0 4px 15px rgba(0,0,0,0.15); 0 8px #d0d0d0;
border-radius: 4px;
}
p {
margin: 0 0 10px;
padding:0;
}
#body {
margin: 0 15px 0 15px;
min-height: 96px;
}
</style>
</head>
<body>
<div id="container">
<h1><?php echo $heading; ?></h1>
<div id="body">
<?php echo $message; ?>
</div>
</div>
</body>
</html>

View File

@@ -0,0 +1,87 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
?><!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Database Error</title>
<style type="text/css">
::selection { background-color: #f07746; color: #fff; }
::-moz-selection { background-color: #f07746; color: #fff; }
body {
background-color: #fff;
margin: 40px auto;
max-width: 1024px;
font: 16px/24px normal "Helvetica Neue", Helvetica, Arial, sans-serif;
color: #808080;
}
a {
color: #dd4814;
background-color: transparent;
font-weight: normal;
text-decoration: none;
}
a:hover {
color: #97310e;
}
h1 {
color: #fff;
background-color: #dd4814;
border-bottom: 1px solid #d0d0d0;
font-size: 22px;
font-weight: bold;
margin: 0 0 14px 0;
padding: 5px 15px;
line-height: 40px;
}
h2 {
color:#404040;
margin:0;
padding:0 0 10px 0;
}
code {
font-family: Consolas, Monaco, Courier New, Courier, monospace;
font-size: 13px;
background-color: #f5f5f5;
border: 1px solid #e3e3e3;
border-radius: 4px;
color: #002166;
display: block;
margin: 14px 0 14px 0;
padding: 12px 10px 12px 10px;
}
#container {
margin: 10px;
border: 1px solid #d0d0d0;
box-shadow: 0 0 8px #d0d0d0;
border-radius: 4px;
}
p {
margin: 0 0 10px;
padding:0;
}
#body {
margin: 0 15px 0 15px;
min-height: 96px;
}
</style>
</head>
<body>
<div id="container">
<h1><?php echo $heading; ?></h1>
<div id="body">
<?php echo $message; ?>
</div>
</div>
</body>
</html>

View File

@@ -0,0 +1,32 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
?>
<div style="border:1px solid #dd4814;padding-left:20px;margin:10px 0;">
<h4>An uncaught Exception was encountered</h4>
<p>Type: <?php echo get_class($exception); ?></p>
<p>Message: <?php echo $message; ?></p>
<p>Filename: <?php echo $exception->getFile(); ?></p>
<p>Line Number: <?php echo $exception->getLine(); ?></p>
<?php if (defined('SHOW_DEBUG_BACKTRACE') && SHOW_DEBUG_BACKTRACE === TRUE): ?>
<p>Backtrace:</p>
<?php foreach ($exception->getTrace() as $error): ?>
<?php if (isset($error['file']) && strpos($error['file'], realpath(BASEPATH)) !== 0): ?>
<p style="margin-left:10px">
File: <?php echo $error['file']; ?><br />
Line: <?php echo $error['line']; ?><br />
Function: <?php echo $error['function']; ?>
</p>
<?php endif ?>
<?php endforeach ?>
<?php endif ?>
</div>

View File

@@ -0,0 +1,87 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
?><!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Error</title>
<style type="text/css">
::selection { background-color: #f07746; color: #fff; }
::-moz-selection { background-color: #f07746; color: #fff; }
body {
background-color: #fff;
margin: 40px auto;
max-width: 1024px;
font: 16px/24px normal "Helvetica Neue", Helvetica, Arial, sans-serif;
color: #808080;
}
a {
color: #dd4814;
background-color: transparent;
font-weight: normal;
text-decoration: none;
}
a:hover {
color: #97310e;
}
h1 {
color: #fff;
background-color: #dd4814;
border-bottom: 1px solid #d0d0d0;
font-size: 22px;
font-weight: bold;
margin: 0 0 14px 0;
padding: 5px 15px;
line-height: 40px;
}
h2 {
color:#404040;
margin:0;
padding:0 0 10px 0;
}
code {
font-family: Consolas, Monaco, Courier New, Courier, monospace;
font-size: 13px;
background-color: #f5f5f5;
border: 1px solid #e3e3e3;
border-radius: 4px;
color: #002166;
display: block;
margin: 14px 0 14px 0;
padding: 12px 10px 12px 10px;
}
#container {
margin: 10px;
border: 1px solid #d0d0d0;
box-shadow: 0 4px 15px rgba(0,0,0,0.15); 0 8px #d0d0d0;
border-radius: 4px;
}
p {
margin: 0 0 10px;
padding:0;
}
#body {
margin: 0 15px 0 15px;
min-height: 96px;
}
</style>
</head>
<body>
<div id="container">
<h1><?php echo $heading; ?></h1>
<div id="body">
<?php echo $message; ?>
</div>
</div>
</body>
</html>

View File

@@ -0,0 +1,33 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
?>
<div style="border:1px solid #dd4814;padding-left:20px;margin:10px 0;">
<h4>A PHP Error was encountered</h4>
<p>Severity: <?php echo $severity; ?></p>
<p>Message: <?php echo $message; ?></p>
<p>Filename: <?php echo $filepath; ?></p>
<p>Line Number: <?php echo $line; ?></p>
<?php if (defined('SHOW_DEBUG_BACKTRACE') && SHOW_DEBUG_BACKTRACE === TRUE): ?>
<p>Backtrace:</p>
<?php foreach (debug_backtrace() as $error): ?>
<?php if (isset($error['file']) && strpos($error['file'], realpath(BASEPATH)) !== 0): ?>
<p style="margin-left:10px">
File: <?php echo $error['file'] ?><br />
Line: <?php echo $error['line'] ?><br />
Function: <?php echo $error['function'] ?>
</p>
<?php endif ?>
<?php endforeach ?>
<?php endif ?>
</div>

View File

@@ -0,0 +1,11 @@
<!DOCTYPE html>
<html lang="en">
<head>
<title>403 Forbidden</title>
</head>
<body>
<p>Directory access is forbidden.</p>
</body>
</html>

View File

@@ -0,0 +1,11 @@
<!DOCTYPE html>
<html lang="en">
<head>
<title>403 Forbidden</title>
</head>
<body>
<p>Directory access is forbidden.</p>
</body>
</html>

View File

@@ -0,0 +1,7 @@
<footer style="margin-top: 3rem; text-align: center; font-size: 0.9rem; color: #888;">
<p>🎬 Bon visionnage</p>
<p>© Tous droits réservés - Emmanuel & Wael</p>
</footer>
</main>
</body>
</html>

View File

@@ -0,0 +1,69 @@
<!doctype html>
<html lang="fr">
<head>
<meta charset="UTF-8" />
<title>Séries</title>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@picocss/pico@2/css/pico.min.css" />
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.7.2/css/all.min.css" integrity="sha512-Evv84Mr4kqVGRNSgIGL/F/aIDqQb7xQ2vcrdIwxfjThSH8CSR7PBEakCr51Ck+w+/U6swU2Im1vVX0SVk9ABhg==" crossorigin="anonymous" referrerpolicy="no-referrer" />
<link rel="stylesheet" href="<?= base_url('assets/style.css') ?>">
</head>
<body>
<main class="container">
<button onclick="scrollToTop()" id="btnScrollTop"><span class="fleche"></span></button>
<nav>
<ul>
<li><strong>Séries</strong></li>
<li><a href="<?= site_url('tvshow') ?>"><i class="fas fa-home"></i></a></li>
<?php if ($this->session->userdata('logged_in')): ?>
<li><a href="<?= site_url('user/profile') ?>"><i class="fas fa-user"></i></a></li>
<li><a href="<?= site_url('auth/logout') ?>" title="Déconnexion"><i class="fas fa-sign-out-alt" style="font-size: 22px;"></i></a></li>
<?php else: ?>
<li><a href="<?= site_url('login') ?>"><i class="fas fa-user"></i></a></li>
<?php endif; ?>
</ul>
<ul>
<li>
<form method="GET" action="<?= site_url('tvshow') ?>" role="search">
<select name="type" onchange="this.form.submit()" aria-label="Genre"><option value="">Genre</option>
<?php foreach ($all_genres as $g): ?>
<option value="<?= $g->name ?>" <?= ($this->input->get('type') == $g->name) ? 'selected' : '' ?>><?= $g->name ?></option>
<?php endforeach; ?>
</select>
<select name="min_rating" onchange="this.form.submit()" aria-label="Note minimale">
<option value="">Note minimale</option>
<?php for ($i = 1; $i <= 5; $i++): ?>
<option value="<?= $i ?>" <?= ($this->input->get('min_rating') == $i) ? 'selected' : '' ?>><?= $i ?> étoile<?= $i > 1 ? 's' : '' ?> ou plus</option>
<?php endfor; ?>
</select>
<input name="search" type="search" placeholder="Rechercher..." value="<?= html_escape($this->input->get('search')) ?>" />
<input type="submit" value="Chercher" />
</form>
</li>
</ul>
</nav>
<script>
document.addEventListener('DOMContentLoaded', function () {
const btnScroll = document.getElementById('btnScrollTop');
btnScroll.style.display = 'none';
window.addEventListener('scroll', () => {
if (window.scrollY > 300) {
btnScroll.style.display = 'block';
} else {
btnScroll.style.display = 'none';
}
});
});
function scrollToTop() {
window.scrollTo({
top: 0,
behavior: 'smooth'
});
}
</script>

View File

@@ -0,0 +1,41 @@
<!doctype html>
<html lang="fr">
<head>
<meta charset="UTF-8" />
<title>Connexion - Séries</title>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@picocss/pico@2/css/pico.min.css" />
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.7.2/css/all.min.css" />
<link rel="stylesheet" href="<?= base_url('assets/style.css') ?>">
</head>
<body>
<main class="container">
<nav>
<ul>
<li><a href="<?= site_url('tvshow') ?>"><i class="fas fa-home"></i></a></li>
</ul>
</nav>
<h2>Connexion</h2>
<?php
$CI =& get_instance();
if ($CI->session->flashdata('error')):
?>
<p class="error"><?= html_escape($CI->session->flashdata('error')) ?></p>
<?php endif; ?>
<form method="post" action="<?= site_url('login') ?>">
<label for="login">Email :</label>
<input type="text" name="email" id="login" required />
<label for="password">Mot de passe :</label>
<input type="password" name="password" id="password" required />
<button type="submit">Se connecter</button>
</form>
<p>Pas encore inscrit ? <a href="<?= site_url('auth/register') ?>">S'inscrire</a></p>
</main>
</body>
</html>

View File

@@ -0,0 +1,60 @@
<!doctype html>
<html lang="fr">
<head>
<meta charset="UTF-8" />
<title>Inscription</title>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@picocss/pico@2/css/pico.min.css" />
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.7.2/css/all.min.css" />
<link rel="stylesheet" href="<?= base_url('assets/style.css') ?>">
<style>
.inline-fields {
display: flex;
gap: 20px;
margin-bottom: 1rem;
}
.inline-fields > div {
flex: 1;
}
</style>
</head>
<body>
<main class="container">
<nav>
<ul>
<li><a href="<?= site_url('tvshow') ?>"><i class="fas fa-home"></i></a></li>
</ul>
</nav>
<h2>Inscription</h2>
<?php if (!empty($error)): ?>
<p class="error"><?= html_escape($error) ?></p>
<?php endif; ?>
<form method="post" action="<?= site_url('auth/register') ?>">
<div class="inline-fields">
<div>
<label for="firstname">Prénom</label>
<input type="text" name="firstname" id="firstname" placeholder="Prénom" required />
</div>
<div>
<label for="lastname">Nom</label>
<input type="text" name="lastname" id="lastname" placeholder="Nom" required />
</div>
</div>
<label for="email">Adresse email</label>
<input type="email" name="email" id="email" placeholder="Email" required />
<label for="password">Mot de passe</label>
<input type="password" name="password" id="password" placeholder="Mot de passe" required />
<label for="password_confirm">Confirmation du mot de passe</label>
<input type="password" name="password_confirm" id="password_confirm" placeholder="Confirmer" required />
<button type="submit">S'inscrire</button>
</form>
<p>Déjà inscrit ? <a href="<?= site_url('auth/login') ?>">Connexion</a></p>
</main>
</body>
</html>

View File

@@ -0,0 +1,22 @@
<div style="text-align: center; margin-top: 30px;">
<h2>Résultats de recherche pour "<?= html_escape($search) ?>"</h2>
<?php if (empty($tvshows)): ?>
<p>Désolé, "<strong><?= html_escape($search) ?></strong>" n'est pas dans notre catalogue.</p>
<?php endif; ?>
</div>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>

View File

@@ -0,0 +1,83 @@
<section class="saison-detail-wrapper">
<div class="saison-header">
<img class="poster-saison-large" src="data:image/jpeg;base64,<?= base64_encode($season->jpeg ?? $tvshow->jpeg) ?>" alt="Poster Saison <?= $season->seasonNumber ?>">
<div class="saison-infos">
<h2><?= html_escape($tvshow->name) ?> <span class="saison-num-title"><?= ($season->seasonNumber == 2147483647) ? 'Épisodes spéciaux' : 'Saison ' . html_escape($season->seasonNumber) ?>
</span></h2>
<?php if (!empty($season->overview)): ?>
<p class="saison-synopsis"><?= html_escape($season->overview) ?></p>
<?php endif; ?>
<div style="margin-top: 15px;">
<a href="#avis-section" class="btn-avis">Voir les avis</a>
</div>
<p class="saison-meta"><strong><?= count($episodes) ?></strong> épisode<?= count($episodes) > 1 ? 's' : '' ?></p>
</div>
</div>
</section>
<hr class="section-divider" />
<h3>Liste des épisodes</h3>
<section class="episodes-cartes-horizontales">
<?php foreach ($episodes as $ep): ?>
<details class="carte-episode-horizontale">
<summary class="episode-summary">
<strong class="episode-num">Épisode <?= $ep->episodeNumber ?></strong>
<span class="episode-title"><?= html_escape($ep->name) ?></span>
</summary>
<div class="carte-episode-contenu">
<div class="episode-overview">
<?= !empty($ep->overview) ? html_escape($ep->overview) : '<em>Pas de synopsis disponible.</em>' ?>
</div>
</div>
</details>
<?php endforeach; ?>
</section>
<hr class="section-divider" />
<section id="avis-section">
<?php if ($session->userdata('logged_in')): ?>
<section>
<h3>Laisser un avis</h3>
<form action="<?= site_url('tvshow/add_critique') ?>" method="post">
<input type="hidden" name="tvshow_id" value="<?= $tvshow->id ?>" />
<input type="hidden" name="season_id" value="<?= $season->seasonNumber ?>" />
<label for="note">Note :</label>
<div class="rating">
<?php for ($i = 5; $i >= 1; $i--): ?>
<input type="radio" id="star<?= $i ?>" name="note" value="<?= $i ?>" required>
<label for="star<?= $i ?>">★</label>
<?php endfor; ?>
</div>
<label for="commentaire">Commentaire :</label>
<textarea name="commentaire" id="commentaire" required></textarea>
<button type="submit">Envoyer</button>
</form>
</section>
<?php else: ?>
<p><a href="<?= site_url('login') ?>">Connectez-vous</a> pour laisser un avis.</p>
<?php endif; ?>
<hr class="section-divider" />
<section class="critiques-saison">
<h3>Avis de <?= $season->seasonNumber == 2147483647 ? 'la saison spéciale' : 'la saison ' . html_escape($season->seasonNumber) ?></h3>
<?php if (!empty($critiques_saison)): ?>
<ul class="season-review-list">
<?php foreach ($critiques_saison as $critique): ?>
<li>
<?= str_repeat('⭐', $critique->note) ?>
par <strong><?= html_escape($critique->auteur) ?></strong> :
<?= html_escape($critique->commentaire) ?>
</li>
<?php endforeach; ?>
</ul>
<?php else: ?>
<p><em>Aucun avis pour cette saison.</em></p>
<?php endif; ?>
</section>

View File

@@ -0,0 +1,213 @@
<!DOCTYPE html>
<html lang="fr">
<head>
<meta charset="UTF-8" />
<title>Détail de la série</title>
<link rel="stylesheet" href="<?= base_url('assets/style.css') ?>">
</head>
<body>
<div class="fiche-wrapper">
<div class="fiche-image">
<a href="<?= html_escape($tvshow->homepage) ?>">
<img
class="serie-img"
src="data:image/jpeg;base64,<?= base64_encode($tvshow->jpeg) ?>"
alt="<?= html_escape($tvshow->name) ?>"
/>
</a>
</div>
<div class="fiche-infos">
<div class="titre-et-coeur">
<h2><?= html_escape($tvshow->name) ?></h2>
<?php if ($session->userdata('logged_in')): ?>
<form method="post" action="<?= site_url($est_favori ? 'favoris/supprimer/' . $tvshow->id : 'favoris/ajouter/' . $tvshow->id) ?>" class="favoris-form">
<button type="submit" class="coeur-btn <?= $est_favori ? '' : 'vide' ?>">
<?= $est_favori ? '♥' : '♡' ?>
</button>
</form>
<?php endif; ?>
</div>
<div style="margin-top: 15px;">
<a href="#avis-section" class="btn-avis">Voir les avis</a>
</div>
<?php if (isset($moyenne)): ?>
<div class="note-absolue">
<strong>Note moyenne :</strong>
<span class="stars">
<?php
$note_arrondie = round($moyenne);
for ($i = 1; $i <= 5; $i++) {
echo $i <= $note_arrondie ? '⭐' : '<span class="empty-star">☆</span>';
}
?>
</span>
(<?= round($moyenne, 1) ?>/5 <?= $nb_votes ?> avis)
</div>
<?php else: ?>
<p class="no-review-message"><em>Aucune critique pour le moment.</em></p>
<?php endif; ?>
<div class="genres-absolus">
<strong>Genres :</strong>
<?= implode(', ', array_map(function($g) {
return html_escape($g->name);
}, $genres)) ?>
</div>
<div class="synopsis-absolu">
<strong>Synopsis :</strong> <em><?= html_escape($tvshow->overview) ?></em>
</div>
</div>
</div>
<?php if (empty($episodes)): ?>
<p>Aucun épisode trouvé pour cette série.</p>
<?php else: ?>
<?php
$bySeason = [];
$specials = [];
foreach ($episodes as $ep) {
if ($ep->season_number == 2147483647) {
$specials[] = $ep;
} else {
$bySeason[$ep->season_number][] = $ep;
}
}
ksort($bySeason);
?>
<hr class="section-divider" />
<h3>Saisons disponibles</h3>
<section class="saison-cartes-ligne">
<?php foreach ($bySeason as $sNumber => $eps): ?>
<?php $seasonData = $this->Model_tvshow->getSeasonByNumber($tvshow->id, $sNumber); ?>
<a href="<?= site_url('tvshow/saison/' . $tvshow->id . '/' . $sNumber) ?>" class="carte-saison-ligne">
<img class="poster-saison" src="data:image/jpeg;base64,<?= base64_encode($seasonData->jpeg ?? $tvshow->jpeg) ?>" alt="Poster Saison <?= $sNumber ?>">
<div class="infos-saison">
<div class="saison-num">Saison <?= $sNumber ?></div>
<div class="saison-episodes"><strong><?= count($eps) ?></strong> épisode<?= count($eps) > 1 ? 's' : '' ?></div>
</div>
</a>
<?php endforeach; ?>
</section>
<?php if (!empty($specials)): ?>
<a href="<?= site_url('tvshow/saison/' . $tvshow->id . '/2147483647') ?>" class="carte-saison-ligne">
<img class="poster-saison" src="data:image/jpeg;base64,<?= base64_encode($tvshow->jpeg) ?>" alt="Poster Épisodes spéciaux">
<div class="infos-saison">
<div class="saison-num">Épisodes spéciaux</div>
</div>
</a>
<?php endif; ?>
<?php endif; ?>
<hr class="section-divider" />
<?php if (isset($suggestions) && !empty($suggestions)): ?>
<div>
<h3>Séries similaires</h3>
<section class="list">
<?php foreach ($suggestions as $suggestion): ?>
<a href="<?= site_url('tvshow/detail/' . $suggestion->id) ?>" class="tvshow-link" style="text-decoration:none; color:inherit;">
<article>
<header class="short-text"><?= html_escape($suggestion->name) ?></header>
<img
src="data:image/jpeg;base64,<?= base64_encode($suggestion->jpeg) ?>"
alt="<?= html_escape($suggestion->name) ?>"
/>
<footer class="short-text">
<?php if (isset($suggestion->seasons_count)): ?>
<?= $suggestion->seasons_count ?> saison<?= ($suggestion->seasons_count > 1 ? 's' : '') ?>
<?php else: ?>
0 saison
<?php endif; ?>
</footer>
</article>
</a>
<?php endforeach; ?>
</section>
</div>
<?php endif; ?>
<hr class="section-divider" />
<?php if ($this->session->userdata('logged_in')): ?>
<section>
<h3>Laisser un avis</h3>
<form action="<?= site_url('tvshow/add_critique') ?>" method="post">
<input type="hidden" name="tvshow_id" value="<?= $tvshow->id ?>" />
<label for="season_id">Saison (optionnelle) :</label>
<select name="season_id" id="season_id">
<option value="">Série entière</option>
<?php
$seen = [];
foreach ($episodes as $episode):
if (!isset($seen[$episode->season_number])): ?>
<option value="<?= $episode->season_number ?>">
<?= ($episode->season_number == 2147483647) ? 'Épisodes spéciaux' : 'Saison ' . $episode->season_number ?>
</option>
<?php
$seen[$episode->season_number] = true;
endif;
endforeach;
?>
</select>
<label for="note">Note :</label>
<div class="rating">
<?php for ($i = 5; $i >= 1; $i--): ?>
<input type="radio" id="star<?= $i ?>" name="note" value="<?= $i ?>" required>
<label for="star<?= $i ?>">★</label>
<?php endfor; ?>
</div>
<label for="commentaire">Commentaire :</label>
<textarea name="commentaire" id="commentaire" required></textarea>
<button type="submit">Envoyer</button>
</form>
</section>
<?php else: ?>
<p><a href="<?= site_url('login') ?>">Connectez-vous</a> pour laisser un avis.</p>
<?php endif; ?>
<br />
<section id="avis-section">
<hr class="section-divider" />
<section class="critiques-saison">
<h3>Avis</h3>
<br />
<?php if (!empty($critiques)): ?>
<?php
$saisons = [];
foreach ($critiques as $critique) {
$saisons[$critique->season_id ?? 0][] = $critique;
}
?>
<?php foreach ($saisons as $season_id => $liste): ?>
<h4 class="titre-saison">
<?= $season_id ? (($season_id == 2147483647) ? 'Épisodes spéciaux' : "Saison $season_id") : "Série entière" ?>
</h4>
<ul class="season-review-list">
<?php foreach ($liste as $critique): ?>
<li>
<?= str_repeat('⭐', $critique->note) ?>
par <strong><?= html_escape($critique->auteur) ?></strong> :
<?= html_escape($critique->commentaire) ?>
</li>
<?php endforeach; ?>
</ul>
<?php endforeach; ?>
<?php else: ?>
<p><em>Aucune critique pour le moment.</em></p>
<?php endif; ?>
</section>
</body>
</html>

View File

@@ -0,0 +1,56 @@
<!DOCTYPE html>
<html lang="fr">
<head>
<meta charset="UTF-8">
<title>Liste des séries</title>
<link rel="stylesheet" href="<?= base_url('assets/style.css') ?>">
</head>
<body>
<br>
<br>
<section class="list">
<?php foreach ($tvshows as $show): ?>
<a href="<?= site_url("tvshow/detail/{$show->id}") ?>" class="tvshow-link">
<article>
<header class="short-text">
<?= html_escape($show->name) ?>
</header>
<img src="data:image/jpeg;base64,<?= base64_encode($show->jpeg) ?>"
alt="<?= html_escape($show->name) ?>" />
<footer class="short-text">
<?= $show->seasons_count ?> saison<?= ($show->seasons_count > 1 ? 's' : '') ?><br>
<?php if ($show->average_rating !== null): ?>
<?php
$fullStars = floor($show->average_rating);
$hasHalf = ($show->average_rating - $fullStars) >= 0.5;
$emptyStars = 5 - $fullStars - ($hasHalf ? 1 : 0);
for ($i = 0; $i < $fullStars; $i++) {
echo '<span style="color: gold;">★</span>';
}
if ($hasHalf) {
echo '<span style="color: lightgray;">★</span>';
}
for ($i = 0; $i < $emptyStars; $i++) {
echo '<span style="color: lightgray;">★</span>';
}
?>
<?php else: ?>
Aucune note
<?php endif; ?>
</footer>
</article>
</a>
<?php endforeach; ?>
</section>
</body>
</html>

View File

@@ -0,0 +1,88 @@
<!DOCTYPE html>
<html lang="fr">
<head>
<meta charset="UTF-8" />
<title>Profil utilisateur</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="<?= site_url('assets/style.css') ?>">
</head>
<body>
<?php if (isset($message)): ?>
<p class="message"><?= html_escape($message) ?></p>
<?php endif; ?>
<?php if (!empty($prenom) && !empty($nom)): ?>
<h3 class="bonjour-message">Bienvenue, <?= html_escape($prenom) ?></h3>
<?php endif; ?>
<hr>
<?php if (!empty($favoris)): ?>
<div class="favoris-section">
<h3>VOS SERIES PRÉFÉRÉES</h3>
<div class="favoris-wrapper">
<section class="list">
<?php foreach ($favoris as $show): ?>
<a href="<?= site_url('tvshow/detail/' . $show->id) ?>" class="tvshow-link">
<article>
<header class="short-text"><?= html_escape($show->name ?? 'Série inconnue') ?></header>
<?php if (!empty($show->jpeg)): ?>
<img src="data:image/jpeg;base64,<?= base64_encode($show->jpeg) ?>" alt="<?= html_escape($show->name) ?>" />
<?php else: ?>
<img src="<?= base_url('assets/img/default.jpg') ?>" alt="Image non disponible" />
<?php endif; ?>
<footer class="short-text">
<?= (int)($show->season_count ?? 0) ?> saison<?= (($show->season_count ?? 0) > 1 ? 's' : '') ?>
</footer>
</article>
</a>
<?php endforeach; ?>
</section>
</div>
</div>
<?php else: ?>
<p>Tu nas pas encore de séries préférées.</p>
<?php endif; ?>
<hr>
<section class="user-reviews">
<h3>Vos Avis</h3>
<?php if (!empty($critiques)): ?>
<?php foreach ($critiques as $critique): ?>
<div class="review-item" style="display: flex; gap: 20px; align-items: center; flex-wrap: wrap;">
<div class="review-content" style="flex: 1;">
<?php if (!empty($critique->commentaire)): ?>
<p>"<?= nl2br(html_escape($critique->commentaire)) ?>"</p>
<?php endif; ?>
<div class="stars">
<?php
$note = (int) $critique->note;
for ($i = 1; $i <= 5; $i++) {
echo $i <= $note ? '<span>⭐</span>' : '<span class="empty-star">☆</span>';
}
?>
</div>
<a href="<?= site_url('critiques/edit/' . $critique->id) ?>" class="btn-edit">Modifier</a>
</div>
<?php if (!empty($critique->tvshow_id)): ?>
<p class="short-text" style="; margin-bottom: 200px; font-weight: bold;text-transform: uppercase; font-size: 1.3rem;">
<?= html_escape($critique->tvshow_name ?? 'Série inconnue') ?>
</p>
<a href="<?= site_url('tvshow/detail/' . $critique->tvshow_id) ?>">
<?php if (!empty($critique->jpeg)): ?>
<img class="img-hover-grow" src="data:image/jpeg;base64,<?= base64_encode($critique->jpeg) ?>" alt="<?= html_escape($critique->tvshow_name ?? 'Série') ?>" />
<?php else: ?>
<img class="img-hover-grow" src="<?= base_url('assets/img/default.jpg') ?>" alt="Image non disponible" />
<?php endif; ?>
</a>
</div>
<?php endif; ?>
</div>
<?php endforeach; ?>
<?php else: ?>
<p class="no-reviews">Tu nas pas encore laissé de critique.</p>
<?php endif; ?>
</section>