diff --git a/CodeIgniter-3.1.13/application/controllers/Albums.php b/CodeIgniter-3.1.13/application/controllers/Albums.php index 2345a1d..bdd4f09 100644 --- a/CodeIgniter-3.1.13/application/controllers/Albums.php +++ b/CodeIgniter-3.1.13/application/controllers/Albums.php @@ -48,16 +48,19 @@ class Albums extends CI_Controller { } public function view($id){ - $album = $this->model_music->get_album_by_id($id); + [$album,$tracks] = $this->model_music->get_album_by_id($id); $data['album'] = $album; - $data['title'] = $album->name." - Details"; $data['css']='assets/css/album_view'; + $data['tracks'] = $tracks; + if ($this->session->userdata('user_id')) { + $user_id = $this->session->userdata('user_id'); + $data['user_playlists'] = $this->Model_playlist->get_user_playlists($user_id); + } $this->load->view('layout/header_dark', $data); $this->load->view('album_view'); $this->load->view('layout/footer_dark'); } - } ?> diff --git a/CodeIgniter-3.1.13/application/models/Model_music.php b/CodeIgniter-3.1.13/application/models/Model_music.php index fe2da6b..113dd22 100644 --- a/CodeIgniter-3.1.13/application/models/Model_music.php +++ b/CodeIgniter-3.1.13/application/models/Model_music.php @@ -95,10 +95,10 @@ class Model_music extends CI_Model { WHERE track.albumid = ? ORDER BY track.diskNumber, track.number", array($id) ); - $album->tracks = $query->result(); + $tracks = $query->result(); } - return $album; + return [$album,$tracks]; } public function getMusiques($limit, $offset, $order_by = 'name', $order_direction = 'ASC', $genre_id = null, $artist_id = null) { diff --git a/CodeIgniter-3.1.13/application/views/album_view.php b/CodeIgniter-3.1.13/application/views/album_view.php index 9d564d8..bd09118 100644 --- a/CodeIgniter-3.1.13/application/views/album_view.php +++ b/CodeIgniter-3.1.13/application/views/album_view.php @@ -1,22 +1,44 @@ +
Artiste : artistName; ?>
+Année : year; ?>
+Genre : genreName; ?>
+ -Artiste : artistName; ?>
-Année : year; ?>
-Genre : genreName; ?>
- - - tracks)): ?> -Aucune musique n'est disponible dans cette album...
+Vous n'avez pas encore de playlist. Créez-en une pour ajouter cet album !
-