From 9693d4be2072374e0599c93e36a991361dcba26f Mon Sep 17 00:00:00 2001 From: stiti Date: Thu, 6 Jun 2024 12:07:45 +0200 Subject: [PATCH] Modifs --- .../application/controllers/Albums.php | 9 ++- .../application/models/Model_music.php | 4 +- .../application/views/album_view.php | 58 +++++++++++++------ .../application/views/artiste_details.php | 6 +- 4 files changed, 50 insertions(+), 27 deletions(-) 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 @@ +
+

name; ?>

+

Artiste : artistName; ?>

+

Année : year; ?>

+

Genre : genreName; ?>

+ Image d'album -
-

name; ?>

-

Artiste : artistName; ?>

-

Année : year; ?>

-

Genre : genreName; ?>

- Image d'album - - tracks)): ?> -

Musiques

-
    - tracks as $track): ?> -
  • - diskNumber . '.' . $track->number; ?>: songName; ?> (duration); ?>) -
  • + session->userdata('user_id')): ?> + + +

    Ajouter à la playlist :

    + + -

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

    +

    Vous n'avez pas encore de playlist. Créez-en une pour ajouter cet album !

    -
- + + + +

Musiques

+ + +

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

+ +
+ \ No newline at end of file diff --git a/CodeIgniter-3.1.13/application/views/artiste_details.php b/CodeIgniter-3.1.13/application/views/artiste_details.php index 49235e5..361ef63 100644 --- a/CodeIgniter-3.1.13/application/views/artiste_details.php +++ b/CodeIgniter-3.1.13/application/views/artiste_details.php @@ -1,13 +1,13 @@

Détails de l'artiste name; ?>

-

Genre le plus utilisé : genreName; ?>

+

Genre le plus utilisé par l'artiste : genreName; ?>

Albums de name; ?>