"; + echo "
"; - echo "
diff --git a/ci/application/controllers/Albums.php b/ci/application/controllers/Albums.php
index 9cc72c4..ca5e760 100644
--- a/ci/application/controllers/Albums.php
+++ b/ci/application/controllers/Albums.php
@@ -10,8 +10,9 @@ class Albums extends CI_Controller {
public function index(){
$albums = $this->model_music->getAlbums();
+ $playlists = $this->model_music->getPlaylist();
$this->load->view('layout/header');
- $this->load->view('albums_list', ['albums' => $albums]);
+ $this->load->view('albums_list', ['albums' => $albums, 'playlists' => $playlists]);
$this->load->view('layout/footer');
}
@@ -25,5 +26,15 @@ class Albums extends CI_Controller {
$this->load->view('song_album_list', ['songs' => $songs, 'playlists' => $playlists]);
$this->load->view('layout/footer');
}
+
+ public function addAllSongsToPlaylist(){
+ $album_id = $this->input->post('album_id');
+ $playlistId = $this->input->post('playlist');
+ $songs = $this->model_music->getSongOfAlbum($album_id);
+ foreach ($songs as $song) {
+ $this->model_music->addSongToPlaylist($song->name, $playlistId);
+ }
+ redirect('playlist');
+ }
}
?>
diff --git a/ci/application/controllers/Artistes.php b/ci/application/controllers/Artistes.php
index 207e2be..50e7a22 100644
--- a/ci/application/controllers/Artistes.php
+++ b/ci/application/controllers/Artistes.php
@@ -16,9 +16,20 @@ class artistes extends CI_Controller {
public function view($AlbumsOfArtistId){
$AlbumsOfArtists = $this->model_music->getAlbumsOfArtist($AlbumsOfArtistId);
+ $playlists = $this->model_music->getPlaylist();
$this->load->view('layout/header');
- $this->load->view('albums_artist_list',['AlbumsOfArtists'=>$AlbumsOfArtists]);
+ $this->load->view('albums_artist_list', ['AlbumsOfArtists' => $AlbumsOfArtists, 'playlists' => $playlists, 'artist_id' => $AlbumsOfArtistId]);
$this->load->view('layout/footer');
}
+ public function addAllSongsToPlaylist(){
+ $album_id = $this->input->post('album_id');
+ $playlistId = $this->input->post('playlist');
+ $songs = $this->model_music->getSongOfAlbum($album_id);
+ foreach ($songs as $song) {
+ $this->model_music->addSongToPlaylist($song->name, $playlistId);
+ }
+ redirect('playlist');
+ }
+
}
\ No newline at end of file
diff --git a/ci/application/models/Model_music.php b/ci/application/models/Model_music.php
index aa3904b..a40d57d 100644
--- a/ci/application/models/Model_music.php
+++ b/ci/application/models/Model_music.php
@@ -50,8 +50,9 @@ class Model_music extends CI_Model {
}
public function delete_Song($playlist_id,$Song_name){
+ $Song_name = urldecode($Song_name);
$this->db->query(
- "DELETE FROM SongPlaylist Where id = ? AND name LIKE ?",
+ "DELETE FROM SongPlaylist Where id = ? AND name=?",
array($playlist_id, $Song_name)
);
}
diff --git a/ci/application/views/albums_artist_list.php b/ci/application/views/albums_artist_list.php
index b2868f9..e22408b 100644
--- a/ci/application/views/albums_artist_list.php
+++ b/ci/application/views/albums_artist_list.php
@@ -1,16 +1,27 @@
+
";
+ echo "
";
- echo "