playlist unique au compte connecté
This commit is contained in:
@@ -6,10 +6,12 @@ class Playlist extends CI_Controller {
|
||||
public function __construct(){
|
||||
parent::__construct();
|
||||
$this->load->model('model_music');
|
||||
$this->load->library('session');
|
||||
}
|
||||
|
||||
public function index(){
|
||||
$playlists = $this->model_music->getPlaylist();
|
||||
$mail = $this->session->userdata('mail');
|
||||
$playlists = $this->model_music->getPlaylist($mail);
|
||||
$this->load->view('layout/header');
|
||||
$this->load->view('playlist_list', ['playlists' => $playlists]);
|
||||
$this->load->view('layout/footer');
|
||||
@@ -25,7 +27,8 @@ class Playlist extends CI_Controller {
|
||||
public function SongPlaylist($playlist_id){
|
||||
$songPlaylists = $this->model_music->getSongOfPlaylist($playlist_id);
|
||||
$songs = $this->model_music->getSongOfAlbum($playlist_id);
|
||||
$playlists = $this->model_music->getPlaylist(); // Récupère toutes les playlists
|
||||
$mail = $this->session->userdata('mail');
|
||||
$playlists = $this->model_music->getPlaylist($mail); // Récupère toutes les playlists
|
||||
$id_playlist = null; // Initialise $id_playlist à null
|
||||
foreach ($playlists as $playlist_item) {
|
||||
if ($playlist_item->id == $playlist_id) {
|
||||
@@ -37,7 +40,8 @@ class Playlist extends CI_Controller {
|
||||
}
|
||||
|
||||
public function delete($playlist_id) {
|
||||
$delete = $this->model_music->deletePlaylist($playlist_id);
|
||||
$mail = $this->session->userdata('mail');
|
||||
$delete = $this->model_music->deletePlaylist($playlist_id, $mail);
|
||||
redirect('playlist');
|
||||
}
|
||||
|
||||
@@ -54,8 +58,9 @@ class Playlist extends CI_Controller {
|
||||
}
|
||||
|
||||
public function createPlaylistController() {
|
||||
$mail = $this->session->userdata('mail');
|
||||
$name_playlist = $this->input->post('name_playlist');
|
||||
$create = $this->model_music->createPlaylist($name_playlist);
|
||||
$create = $this->model_music->createPlaylist($name_playlist, $mail);
|
||||
redirect('playlist');
|
||||
}
|
||||
|
||||
@@ -67,11 +72,12 @@ class Playlist extends CI_Controller {
|
||||
}
|
||||
|
||||
public function duplicate($playlist_id){
|
||||
$mail = $this->session->userdata('mail');
|
||||
// Charger le modèle si ce n'est pas déjà fait
|
||||
$this->load->model('model_music');
|
||||
|
||||
// Dupliquer la playlist avec l'ID spécifié
|
||||
$this->model_music->duplicatePlaylist($playlist_id);
|
||||
$this->model_music->duplicatePlaylist($playlist_id, $mail);
|
||||
|
||||
// Rediriger l'utilisateur vers la page des playlists
|
||||
redirect('playlist');
|
||||
|
||||
Reference in New Issue
Block a user