SAE_2.02/CodeIgniter-3.1.13/application/views/musiques_list.php

57 lines
2.5 KiB
PHP
Raw Normal View History

2024-05-20 21:59:37 +02:00
<!DOCTYPE html>
<html lang="fr">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
2024-05-22 22:05:48 +02:00
<link rel="stylesheet" href="<?php echo base_url('assets/css/style'); ?>">
<link rel="icon" type="image/x-icon" href="<?php echo base_url('assets/img/Logo_ONZEUR.png'); ?>">
<title>Musiques - Onzeur</title>
2024-05-20 21:59:37 +02:00
</head>
<body>
2024-05-22 22:05:48 +02:00
<h1 class="title">Liste des musiques</h1>
<div class="filters">
<form method="GET" action="<?php echo base_url('index.php/musiques/index'); ?>">
<label for="sort">Trier par:</label>
<select name="sort" id="sort">
<option value="name" <?php echo (isset($sort) && $sort == 'name') ? 'selected' : ''; ?>>Titre</option>
<option value="artist" <?php echo (isset($sort) && $sort == 'artist') ? 'selected' : ''; ?>>Artiste</option>
<option value="album" <?php echo (isset($sort) && $sort == 'album') ? 'selected' : ''; ?>>Album</option>
</select>
<button type="submit">Filtrer</button>
</form>
</div>
<section class="list">
2024-05-20 21:59:37 +02:00
<?php foreach($musiques as $musique): ?>
2024-05-22 22:05:48 +02:00
<div>
<article>
<header class="short-text">
<?php echo $musique->name; ?>
</header>
<img src="data:image/jpeg;base64,<?php echo base64_encode($musique->cover); ?>" alt="Couverture de l'album">
<footer class="short-text">
<?php echo $musique->artistName; ?> - <?php echo $musique->album_name; ?>
</footer>
</article>
</div>
2024-05-20 21:59:37 +02:00
<?php endforeach; ?>
2024-05-22 22:05:48 +02:00
</section>
2024-05-20 21:59:37 +02:00
<div class="pagination">
<?php if ($current_page > 1): ?>
2024-05-22 22:05:48 +02:00
<a class="fleche" href="<?php echo base_url('index.php/musiques/index/'.($current_page-1).((isset($sort)) ? '?sort='.$sort : '')); ?>"><</a>
2024-05-20 21:59:37 +02:00
<?php endif; ?>
<?php for ($i = max(1, $current_page - 2); $i <= min($total_pages, $current_page + 2); $i++): ?>
2024-05-22 22:05:48 +02:00
<a href="<?php echo base_url('index.php/musiques/index/'.$i.((isset($sort)) ? '?sort='.$sort : '')); ?>" <?php echo ($i == $current_page) ? 'class="active"' : ''; ?>><?php echo $i; ?></a>
2024-05-20 21:59:37 +02:00
<?php endfor; ?>
<?php if ($current_page < $total_pages): ?>
2024-05-22 22:05:48 +02:00
<a class="fleche" href="<?php echo base_url('index.php/musiques/index/'.($current_page+1).((isset($sort)) ? '?sort='.$sort : '')); ?>">></a>
2024-05-20 21:59:37 +02:00
<?php endif; ?>
</div>
</body>
</html>