From 2461971a248a8c1e6bedb9cdaf13f3684650725a Mon Sep 17 00:00:00 2001 From: brigitte Date: Mon, 3 Jun 2024 18:44:18 +0200 Subject: [PATCH] =?UTF-8?q?d=C3=A9but=20cr=C3=A9ation=20playlist?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ci/application/controllers/Playlist.php | 16 +++++++++++++++- ci/application/models/Model_music.php | 8 ++++++++ ci/application/views/create_playlist.php | 10 ++++++++++ ci/application/views/playlist_list.php | 5 +++++ 4 files changed, 38 insertions(+), 1 deletion(-) create mode 100644 ci/application/views/create_playlist.php diff --git a/ci/application/controllers/Playlist.php b/ci/application/controllers/Playlist.php index ffd00a4..4af69bb 100644 --- a/ci/application/controllers/Playlist.php +++ b/ci/application/controllers/Playlist.php @@ -33,4 +33,18 @@ class Playlist extends CI_Controller { $delete = $this->model_music->deletePlaylist($playlist_id); redirect('playlist'); } -} \ No newline at end of file + + public function MenuCreate() { + //$this->load->view('layout/header_album'); + $this->load->view('create_playlist'); + } + + public function createPlaylistController() { + $name_playlist = $this->input->post('name_playlist'); + $create = $this->model_music->createPlaylist($name_playlist); + redirect('playlist'); + } +} + + + diff --git a/ci/application/models/Model_music.php b/ci/application/models/Model_music.php index b53e150..832c9df 100644 --- a/ci/application/models/Model_music.php +++ b/ci/application/models/Model_music.php @@ -49,6 +49,14 @@ class Model_music extends CI_Model { ); } + public function createPlaylist($name_playlist){ + $name_playlist_escaped = $this->db->escape($name_playlist); + $query = $this->db->query( + "INSERT INTO playlist VALUES (1, $name_playlist_escaped); + " + ); + } + public function getSongOfPlaylist($playlist_id){ $query = $this->db->query( "SELECT SongPlaylist.name diff --git a/ci/application/views/create_playlist.php b/ci/application/views/create_playlist.php new file mode 100644 index 0000000..27ee44b --- /dev/null +++ b/ci/application/views/create_playlist.php @@ -0,0 +1,10 @@ +
Créer une nouvelle Playlist
+ + +
+ + + +
\ No newline at end of file diff --git a/ci/application/views/playlist_list.php b/ci/application/views/playlist_list.php index 41ec9ae..67ed953 100644 --- a/ci/application/views/playlist_list.php +++ b/ci/application/views/playlist_list.php @@ -1,5 +1,10 @@
Playlist List
"; +echo ""; +echo ""; + foreach($playlists as $playlist){ echo "
"; echo "
";