65 lines
1.7 KiB
PHP
65 lines
1.7 KiB
PHP
<!--
|
|
Variables de la vue
|
|
$films : les films de la page
|
|
-->
|
|
|
|
<h2>Films</h2>
|
|
<?php if (!empty($errorMessage)) { ?>
|
|
<article><?php echo htmlspecialchars($errorMessage, ENT_QUOTES, 'UTF-8'); ?></article>
|
|
<?php } ?>
|
|
<table>
|
|
<thead>
|
|
<tr>
|
|
<th>Titre</th>
|
|
<th>Année</th>
|
|
<th>Genre</th>
|
|
<th>Réalisateur</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
<?php
|
|
foreach ($films as $film) {
|
|
$titre = htmlspecialchars($film['titre'], ENT_QUOTES, 'UTF-8');
|
|
$annee = htmlspecialchars((string) $film['annee'], ENT_QUOTES, 'UTF-8');
|
|
$genre = htmlspecialchars($film['genre'], ENT_QUOTES, 'UTF-8');
|
|
$realisateur = htmlspecialchars($film['prenom'] . ' ' . $film['nom'], ENT_QUOTES, 'UTF-8');
|
|
|
|
echo "
|
|
<tr>
|
|
<td><a href='#'>{$titre}</a></td>
|
|
<td>{$annee}</td>
|
|
<td>{$genre}</td>
|
|
<td>{$realisateur}</td>
|
|
</tr>";
|
|
}
|
|
?>
|
|
</tbody>
|
|
</table>
|
|
|
|
<?php if ($totalPages > 1) { ?>
|
|
<nav>
|
|
<ul>
|
|
<li>
|
|
<?php if ($currentPage > 1) { ?>
|
|
<a href="?page=<?php echo $currentPage - 1; ?>">Précédent</a>
|
|
<?php } else { ?>
|
|
<span>Précédent</span>
|
|
<?php } ?>
|
|
</li>
|
|
</ul>
|
|
<ul>
|
|
<li>Page <?php echo $currentPage; ?> / <?php echo $totalPages; ?></li>
|
|
</ul>
|
|
<ul>
|
|
<li>
|
|
<?php if ($currentPage < $totalPages) { ?>
|
|
<a href="?page=<?php echo $currentPage + 1; ?>">Suivant</a>
|
|
<?php } else { ?>
|
|
<span>Suivant</span>
|
|
<?php } ?>
|
|
</li>
|
|
</ul>
|
|
</nav>
|
|
<?php } ?>
|
|
|