Commit de Louay : Correction de bugs

This commit is contained in:
stiti
2024-05-22 20:59:59 +02:00
parent 6fa5b60331
commit caa8210c75
8 changed files with 167 additions and 113 deletions

View File

@@ -1,31 +0,0 @@
<!DOCTYPE html>
<html lang="fr">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="<?php echo base_url('assets/css/album_musiques'); ?>">
<title><?php echo $album->name; ?> - Musiques</title>
</head>
<body>
<div class="album-details">
<h1><?php echo $album->name; ?></h1>
<p><strong>Artiste :</strong> <?php echo $album->artistName; ?></p>
<p><strong>Année :</strong> <?php echo $album->year; ?></p>
<p><strong>Genre :</strong> <?php echo $album->genreName; ?></p>
<img src="data:image/jpeg;base64,<?php echo base64_encode($album->jpeg); ?>" alt="Image d'album">
<?php if (!empty($album->tracks)): ?>
<h2>Musiques</h2>
<ul>
<?php foreach ($album->tracks as $track): ?>
<li>
<strong><?php echo $track->diskNumber . '.' . $track->number; ?>:</strong> <?php echo $track->songName; ?> (<?php echo gmdate("i:s", $track->duration); ?>)
</li>
<?php endforeach; ?>
</ul>
<?php else: ?>
<p>Aucune musique n'est disponible dans cet album...</p>
<?php endif; ?>
</div>
</body>
</html>

View File

@@ -1,10 +1,9 @@
<!-- application/views/album_view.php -->
<!DOCTYPE html>
<html lang="fr">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="<?php echo base_url('assets/css/album_view'); ?>">
<link rel="stylesheet" href="<?php echo base_url('assets/css/album_view.css'); ?>">
<title><?php echo $album->name; ?> - Details</title>
</head>
<body>

View File

@@ -9,6 +9,35 @@
</head>
<body>
<h1 class="title">Listes des albums</h1>
<div class="filters">
<form method="GET" action="<?php echo base_url('index.php/albums/index'); ?>">
<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>
<label for="order_by">Trier par:</label>
<select name="order_by" id="order_by">
<option value="year" <?php echo ($order_by == 'year') ? 'selected' : ''; ?>>Année</option>
<option value="name" <?php echo ($order_by == 'name') ? 'selected' : ''; ?>>Nom</option>
</select>
<button type="submit">Filtrer</button>
</form>
</div>
<section class="list">
<?php foreach($albums as $album): ?>
<div>
@@ -24,18 +53,17 @@
</section>
<div class="pagination">
<?php if ($current_page > 1): ?>
<a class="fleche" href="<?php echo base_url('index.php/albums/index/'.($current_page-1)); ?>"><</a>
<?php endif; ?>
<?php if ($current_page > 1): ?>
<a class="fleche" href="<?php echo base_url('index.php/albums/index/'.($current_page-1).'?order_by='.$order_by.'&genre_id='.$genre_id.'&artist_id='.$artist_id); ?>"><</a>
<?php endif; ?>
<?php for ($i = max(1, $current_page - 2); $i <= min($total_pages, $current_page + 2); $i++): ?>
<a href="<?php echo base_url('index.php/albums/index/'.$i.'?order_by='.$order_by.'&genre_id='.$genre_id.'&artist_id='.$artist_id); ?>" <?php echo ($i == $current_page) ? 'class="active"' : ''; ?>><?php echo $i; ?></a>
<?php endfor; ?>
<?php for ($i = max(1, $current_page - 2); $i <= min($total_pages, $current_page + 2); $i++): ?>
<a href="<?php echo base_url('index.php/albums/index/'.$i); ?>" <?php echo ($i == $current_page) ? 'class="active"' : ''; ?>><?php echo $i; ?></a>
<?php endfor; ?>
<?php if ($current_page < $total_pages): ?>
<a class="fleche" href="<?php echo base_url('index.php/albums/index/'.($current_page+1)); ?>">></a>
<?php endif; ?>
</div>
<?php if ($current_page < $total_pages): ?>
<a class="fleche" href="<?php echo base_url('index.php/albums/index/'.($current_page+1).'?order_by='.$order_by.'&genre_id='.$genre_id.'&artist_id='.$artist_id); ?>">></a>
<?php endif; ?>
</div>
</body>
</html>