From 73f0cb13773d27afb326318d719dec3d5ee63b7b Mon Sep 17 00:00:00 2001 From: stiti Date: Mon, 10 Jun 2024 20:41:30 +0200 Subject: [PATCH] Commit de louay : modifs --- .../application/models/Model_music.php | 8 +++++--- .../application/views/album_view.php | 18 ++++++++++-------- 2 files changed, 15 insertions(+), 11 deletions(-) diff --git a/CodeIgniter-3.1.13/application/models/Model_music.php b/CodeIgniter-3.1.13/application/models/Model_music.php index d872f86..19be9db 100644 --- a/CodeIgniter-3.1.13/application/models/Model_music.php +++ b/CodeIgniter-3.1.13/application/models/Model_music.php @@ -87,9 +87,11 @@ class Model_music extends CI_Model { ); $album = $query->row(); + $tracks = []; // Initialiser le tableau des pistes + if ($album) { $query = $this->db->query( - "SELECT track.id, track.diskNumber, track.number, track.duration, song.name as songName + "SELECT track.id, track.diskNumber, track.number, track.duration, song.id as song_id, song.name as songName FROM track JOIN song ON track.songid = song.id WHERE track.albumid = ? @@ -98,8 +100,8 @@ class Model_music extends CI_Model { $tracks = $query->result(); } - return [$album,$tracks]; - } + return [$album, $tracks]; + } public function getMusiques($limit, $offset, $order_by = 'name', $order_direction = 'ASC', $genre_id = null, $artist_id = null) { // Préparer la colonne de tri en fonction du paramètre $order_by diff --git a/CodeIgniter-3.1.13/application/views/album_view.php b/CodeIgniter-3.1.13/application/views/album_view.php index 6d95661..9fac696 100644 --- a/CodeIgniter-3.1.13/application/views/album_view.php +++ b/CodeIgniter-3.1.13/application/views/album_view.php @@ -23,14 +23,16 @@

Musiques

Aucune musique n'est disponible dans cet album...