From 70c71f12fbde5e1531fdb7d49716857c3b8e9f00 Mon Sep 17 00:00:00 2001 From: stiti Date: Mon, 27 May 2024 22:40:16 +0200 Subject: [PATCH] Test --- CodeIgniter-3.1.13/application/config/config.php | 2 +- .../application/models/Model_music.php | 4 ++++ .../application/models/Model_playlist.php | 6 +++--- .../application/views/playlist_view.php | 16 +++++++++------- 4 files changed, 17 insertions(+), 11 deletions(-) diff --git a/CodeIgniter-3.1.13/application/config/config.php b/CodeIgniter-3.1.13/application/config/config.php index 50aac36..c4f49b2 100644 --- a/CodeIgniter-3.1.13/application/config/config.php +++ b/CodeIgniter-3.1.13/application/config/config.php @@ -497,7 +497,7 @@ $config['compress_output'] = FALSE; | helper' page of the user guide for information regarding date handling. | */ -$config['time_reference'] = 'local'; +$config['time_reference'] = 'Europe/Paris'; /* |-------------------------------------------------------------------------- diff --git a/CodeIgniter-3.1.13/application/models/Model_music.php b/CodeIgniter-3.1.13/application/models/Model_music.php index 0b82df2..340f98d 100644 --- a/CodeIgniter-3.1.13/application/models/Model_music.php +++ b/CodeIgniter-3.1.13/application/models/Model_music.php @@ -72,6 +72,10 @@ class Model_music extends CI_Model { return $query->result(); } + public function get_artist_name_by_id($artist_id) { + return $this->db->get_where('artist', array('id' => $artist_id))->row('name'); + } + public function get_album_by_id($id){ $query = $this->db->query( "SELECT album.id, album.name, album.year, artist.name as artistName, genre.name as genreName, cover.jpeg diff --git a/CodeIgniter-3.1.13/application/models/Model_playlist.php b/CodeIgniter-3.1.13/application/models/Model_playlist.php index 4301c45..0918487 100644 --- a/CodeIgniter-3.1.13/application/models/Model_playlist.php +++ b/CodeIgniter-3.1.13/application/models/Model_playlist.php @@ -107,14 +107,14 @@ class Model_playlist extends CI_Model { return $this->db->delete('playlist_song'); } - // Récupérer les chansons d'une playlist public function get_songs_by_playlist($playlist_id) { - $this->db->select('song.*'); + $this->db->select('song.*, artist.name as artist_name'); $this->db->from('playlist_song'); $this->db->join('song', 'song.id = playlist_song.song_id'); + $this->db->join('artist', 'artist.id = song.artistId'); $this->db->where('playlist_song.playlist_id', $playlist_id); return $this->db->get()->result(); - } + } public function add_album_to_playlist($data) { return $this->db->insert('playlist_album', $data); diff --git a/CodeIgniter-3.1.13/application/views/playlist_view.php b/CodeIgniter-3.1.13/application/views/playlist_view.php index 0e557c0..b60fa71 100644 --- a/CodeIgniter-3.1.13/application/views/playlist_view.php +++ b/CodeIgniter-3.1.13/application/views/playlist_view.php @@ -2,7 +2,7 @@ - Détails de la Playlist + Détails de la Playlist - Onzeur @@ -36,16 +36,17 @@

Chansons

- - - - - + + + + + + @@ -53,10 +54,11 @@ - + +
TitreActions
TitreArtisteActions
name, ENT_QUOTES, 'UTF-8'); ?>artist_name, ENT_QUOTES, 'UTF-8'); ?> Supprimer
Aucune chanson trouvée dans cette playlist.Aucune chanson trouvée dans cette playlist.
Ajouter une musique