diff --git a/ci/application/controllers/Playlist.php b/ci/application/controllers/Playlist.php index 8625daa..6447a49 100644 --- a/ci/application/controllers/Playlist.php +++ b/ci/application/controllers/Playlist.php @@ -14,4 +14,18 @@ class Playlist extends CI_Controller { $this->load->view('playlist_list', ['playlists' => $playlists]); //$this->load->view('layout/footer_album'); } + + public function view(){ + $playlists = $this->model_music->deletePlaylist(); + //$this->load->view('layout/header_album'); + $this->load->view('playlist_list', ['playlists' => $playlists]); + //$this->load->view('layout/footer_album'); + } + + public function SongPLaylist($playlist_id){ + $songPlaylists = $this->model_music->getSongOfPlaylist($playlist_id); + //$this->load->view('layout/header_album'); + $this->load->view('song_playlist', ['songPlaylists' => $songPlaylists]); + //$this->load->view('layout/footer_album'); + } } \ No newline at end of file diff --git a/ci/application/models/Model_music.php b/ci/application/models/Model_music.php index 3b070f8..8d22e5b 100644 --- a/ci/application/models/Model_music.php +++ b/ci/application/models/Model_music.php @@ -38,6 +38,27 @@ class Model_music extends CI_Model { return $query->result(); } + public function deletePlaylist(){ + $query = $this->db->query( + "SELECT playlist.id, playlist.name + FROM playlist + Group by playlist.id + " + ); + return $query->result(); + } + + public function getSongOfPlaylist($playlist_id){ + $query = $this->db->query( + "SELECT SongPlaylist.name + FROM SongPlaylist + WHERE $playlist_id = SongPlaylist.id; + + " + ); + return $query->result(); + } + public function getSongOfAlbum($album_id){ $query = $this->db->query( "SELECT song.id, song.name diff --git a/ci/application/views/playlist_list.php b/ci/application/views/playlist_list.php index 7493091..cfd1997 100644 --- a/ci/application/views/playlist_list.php +++ b/ci/application/views/playlist_list.php @@ -3,7 +3,14 @@ foreach($playlists as $playlist){ echo "
"; echo "
"; - echo anchor("playlists/view/{$playlist->id}","{$playlist->name}"); + echo anchor("playlist/SongPLaylist/{$playlist->id}","{$playlist->name}"); + + //bouton supprimer playlist + echo "
"; + echo ""; + echo ""; + echo "
"; + echo "
"; echo "
"; echo "
"; diff --git a/ci/application/views/song_playlist.php b/ci/application/views/song_playlist.php new file mode 100644 index 0000000..74ac851 --- /dev/null +++ b/ci/application/views/song_playlist.php @@ -0,0 +1,14 @@ +
Song of the playlist
+
+
"; + echo "
"; + echo "{$songPlaylist->name}"; + echo "
"; + echo "
"; + echo "
"; +} +?> +
\ No newline at end of file