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

75 lines
3.9 KiB
PHP
Raw Normal View History

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'); ?>">
2024-05-30 14:38:38 +02:00
<label for="genre">Genre:</label>
<select name="genre_id" id="genre">
<option value="">Tous les genres</option>
<?php foreach($genres as $genre): ?>
<option value="<?php echo $genre->id; ?>" <?php echo ($genre->id == $genre_id) ? 'selected' : ''; ?>><?php echo $genre->name; ?></option>
<?php endforeach; ?>
</select>
<label for="artist">Artiste:</label>
<select name="artist_id" id="artist">
<option value="">Tous les artistes</option>
<?php foreach($artists as $artist): ?>
<option value="<?php echo $artist->id; ?>" <?php echo ($artist->id == $artist_id) ? 'selected' : ''; ?>><?php echo $artist->name; ?></option>
<?php endforeach; ?>
</select>
2024-05-22 22:05:48 +02:00
<label for="sort">Trier par:</label>
<select name="sort" id="sort">
2024-05-30 14:38:38 +02:00
<option value="name" <?php echo ($sort == 'name') ? 'selected' : ''; ?>>Nom</option>
<option value="year" <?php echo ($sort == 'year') ? 'selected' : ''; ?>>Année</option>
2024-05-22 22:05:48 +02:00
</select>
<button type="submit">Filtrer</button>
</form>
</div>
2024-05-30 14:38:38 +02:00
2024-05-22 22:05:48 +02:00
<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">
2024-05-26 17:44:28 +02:00
<a href="<?php echo base_url('index.php/artiste/index/'.$musique->artist_id); ?>" class="artist-name">
2024-05-23 00:08:48 +02:00
<?php echo $musique->artistName; ?>
2024-05-27 13:29:00 +02:00
</a> -
2024-05-26 17:44:28 +02:00
<a href="<?php echo base_url('index.php/albums/view/'.$musique->album_id); ?>" class="album-name">
2024-05-23 00:08:48 +02:00
<?php echo $musique->album_name; ?>
</a>
2024-05-26 17:44:28 +02:00
<div class="music-links">
<!-- Lien Spotify -->
<a href="https://open.spotify.com/search/<?php echo urlencode($musique->name . ' ' . $musique->artistName); ?>" class="spotify" target="_blank">Spotify</a> |
<!-- Lien Deezer -->
<a href="https://www.deezer.com/search/<?php echo urlencode($musique->name . ' ' . $musique->artistName); ?>" class="deezer" target="_blank">Deezer</a> |
2024-05-26 17:44:28 +02:00
<!-- Lien YouTube -->
<a href="https://www.youtube.com/results?search_query=<?php echo urlencode($musique->name . ' ' . $musique->artistName); ?>" class="youtube" target="_blank">YouTube</a>
2024-05-26 17:44:28 +02:00
</div>
2024-05-22 22:05:48 +02:00
</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>