push
This commit is contained in:
		@@ -3,13 +3,13 @@ defined('BASEPATH') OR exit('No direct script access allowed');
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
class Artistes extends CI_Controller {
 | 
					class Artistes extends CI_Controller {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    public function __construct(){
 | 
					    public function __construct() {
 | 
				
			||||||
        parent::__construct();
 | 
					        parent::__construct();
 | 
				
			||||||
        $this->load->model('model_music');
 | 
					        $this->load->model('model_music');
 | 
				
			||||||
        $this->load->library('session');
 | 
					        $this->load->library('session');
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    public function index(){
 | 
					    public function index() {
 | 
				
			||||||
        $genre = $this->input->get('genre');
 | 
					        $genre = $this->input->get('genre');
 | 
				
			||||||
        $order = $this->input->get('order');
 | 
					        $order = $this->input->get('order');
 | 
				
			||||||
        $query = $this->input->get('query');
 | 
					        $query = $this->input->get('query');
 | 
				
			||||||
@@ -31,12 +31,13 @@ class Artistes extends CI_Controller {
 | 
				
			|||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    public function view($artistId) {
 | 
					    public function view($artistId) {
 | 
				
			||||||
		$artistData = $this->model_music->getArtistDetails($artistId);
 | 
					        $artist = $this->model_music->getArtistDetails($artistId);
 | 
				
			||||||
 | 
					        $albums = $this->model_music->getAlbumsByArtist($artistId);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        $is_logged_in = $this->session->userdata('logged_in');
 | 
					        $is_logged_in = $this->session->userdata('logged_in');
 | 
				
			||||||
        $data = array(
 | 
					        $data = array(
 | 
				
			||||||
			'artist' => $artistData['artist'],
 | 
					            'artist' => $artist,
 | 
				
			||||||
			'albums' => $artistData['albums'],
 | 
					            'albums' => $albums,
 | 
				
			||||||
            'is_logged_in' => $is_logged_in
 | 
					            'is_logged_in' => $is_logged_in
 | 
				
			||||||
        );
 | 
					        );
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -44,7 +45,5 @@ class Artistes extends CI_Controller {
 | 
				
			|||||||
        $this->load->view('artist_details', $data);
 | 
					        $this->load->view('artist_details', $data);
 | 
				
			||||||
        $this->load->view('layout/footer');
 | 
					        $this->load->view('layout/footer');
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
	
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					?>
 | 
				
			||||||
 | 
					 | 
				
			||||||
 
 | 
				
			|||||||
@@ -17,13 +17,13 @@ class Music extends CI_Controller {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
        $musics = $this->model_music->getMusics($genre, $order, $artist, $query);
 | 
					        $musics = $this->model_music->getMusics($genre, $order, $artist, $query);
 | 
				
			||||||
        $genres = $this->model_music->researchtype();
 | 
					        $genres = $this->model_music->researchtype();
 | 
				
			||||||
        $artists = $this->model_music->nameArtist();
 | 
					        $artists = $this->model_music->nameArtist(); // S'assurer que cette méthode récupère bien les artistes
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        $is_logged_in = $this->session->userdata('logged_in');
 | 
					        $is_logged_in = $this->session->userdata('logged_in');
 | 
				
			||||||
        $data = array(
 | 
					        $data = array(
 | 
				
			||||||
            'musics' => $musics,
 | 
					            'musics' => $musics,
 | 
				
			||||||
            'genres' => $genres,
 | 
					            'genres' => $genres,
 | 
				
			||||||
            'artists' => $artists,
 | 
					            'artistes' => $artists, // Passer les artistes à la vue
 | 
				
			||||||
            'is_logged_in' => $is_logged_in
 | 
					            'is_logged_in' => $is_logged_in
 | 
				
			||||||
        );
 | 
					        );
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -33,8 +33,12 @@ class Music extends CI_Controller {
 | 
				
			|||||||
        $this->load->view('layout/footer');
 | 
					        $this->load->view('layout/footer');
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    public function view($trackId) {
 | 
					    public function view($songId) {
 | 
				
			||||||
        $songData = $this->model_music->getSongDetails($trackId);
 | 
					        $songData = $this->model_music->getSongDetails($songId);
 | 
				
			||||||
 | 
					    
 | 
				
			||||||
 | 
					        if (!$songData) {
 | 
				
			||||||
 | 
					            show_404();
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
    
 | 
					    
 | 
				
			||||||
        $is_logged_in = $this->session->userdata('logged_in');
 | 
					        $is_logged_in = $this->session->userdata('logged_in');
 | 
				
			||||||
        $data = array(
 | 
					        $data = array(
 | 
				
			||||||
@@ -46,4 +50,6 @@ class Music extends CI_Controller {
 | 
				
			|||||||
        $this->load->view('song_details', $data);
 | 
					        $this->load->view('song_details', $data);
 | 
				
			||||||
        $this->load->view('layout/footer');
 | 
					        $this->load->view('layout/footer');
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					    
 | 
				
			||||||
 | 
					    
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										151
									
								
								application/controllers/Playlist.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										151
									
								
								application/controllers/Playlist.php
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,151 @@
 | 
				
			|||||||
 | 
					<?php
 | 
				
			||||||
 | 
					defined('BASEPATH') OR exit('No direct script access allowed');
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					class Playlist extends CI_Controller {
 | 
				
			||||||
 | 
					    public function __construct() {
 | 
				
			||||||
 | 
					        parent::__construct();
 | 
				
			||||||
 | 
					        $this->load->model('Model_playlist');
 | 
				
			||||||
 | 
					        $this->load->model('Model_music'); // Ajouté pour accéder aux musiques
 | 
				
			||||||
 | 
					        $this->load->library('session');
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public function index() {
 | 
				
			||||||
 | 
					        $is_logged_in = $this->session->userdata('logged_in');
 | 
				
			||||||
 | 
					        $user_email = $this->session->userdata('email');
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        if (!$is_logged_in) {
 | 
				
			||||||
 | 
					            redirect('connect/login');
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        $data = array(
 | 
				
			||||||
 | 
					            'is_logged_in' => $is_logged_in,
 | 
				
			||||||
 | 
					            'playlists' => $this->Model_playlist->getPlaylistsByUser($user_email)
 | 
				
			||||||
 | 
					        );
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        $this->load->view('layout/header', $data);
 | 
				
			||||||
 | 
					        $this->load->view('playlists_list', $data);
 | 
				
			||||||
 | 
					        $this->load->view('layout/footer');
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public function add() {
 | 
				
			||||||
 | 
					        $is_logged_in = $this->session->userdata('logged_in');
 | 
				
			||||||
 | 
					        $user_email = $this->session->userdata('email');
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        if (!$is_logged_in) {
 | 
				
			||||||
 | 
					            redirect('connect/login');
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        $name = $this->input->post('name');
 | 
				
			||||||
 | 
					        $type = $this->input->post('type');
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        if ($type == 'random') {
 | 
				
			||||||
 | 
					            $numSongs = $this->input->post('numSongs');
 | 
				
			||||||
 | 
					            $artist = $this->input->post('artist');
 | 
				
			||||||
 | 
					            $genre = $this->input->post('genre');
 | 
				
			||||||
 | 
					            $this->Model_playlist->createRandomPlaylist($user_email, $name, $numSongs, $artist, $genre);
 | 
				
			||||||
 | 
					        } else {
 | 
				
			||||||
 | 
					            $this->Model_playlist->addPlaylist($user_email, $name);
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        redirect('playlist');
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public function selectPlaylist() {
 | 
				
			||||||
 | 
					        $itemId = $this->input->post('itemId');
 | 
				
			||||||
 | 
					        $itemType = $this->input->post('itemType');
 | 
				
			||||||
 | 
					        $playlists = $this->Model_playlist->getPlaylistsByUser($this->session->userdata('email'));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        $data = array(
 | 
				
			||||||
 | 
					            'itemId' => $itemId,
 | 
				
			||||||
 | 
					            'itemType' => $itemType,
 | 
				
			||||||
 | 
					            'playlists' => $playlists
 | 
				
			||||||
 | 
					        );
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        $this->load->view('layout/header', $data);
 | 
				
			||||||
 | 
					        $this->load->view('select_playlist', $data);
 | 
				
			||||||
 | 
					        $this->load->view('layout/footer');
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public function addItems() {
 | 
				
			||||||
 | 
					        $playlistId = $this->input->post('playlistId');
 | 
				
			||||||
 | 
					        $itemId = $this->input->post('itemId');
 | 
				
			||||||
 | 
					        $itemType = $this->input->post('itemType');
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        if ($itemType == 'album') {
 | 
				
			||||||
 | 
					            $songs = $this->Model_music->getSongsByAlbum($itemId);
 | 
				
			||||||
 | 
					            foreach ($songs as $song) {
 | 
				
			||||||
 | 
					                $this->Model_playlist->addItem($playlistId, $song->id, 'song');
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					        } else if ($itemType == 'artist') {
 | 
				
			||||||
 | 
					            $albums = $this->Model_music->getAlbumsByArtist($itemId);
 | 
				
			||||||
 | 
					            foreach ($albums as $album) {
 | 
				
			||||||
 | 
					                $songs = $this->Model_music->getSongsByAlbum($album->albumId);
 | 
				
			||||||
 | 
					                foreach ($songs as $song) {
 | 
				
			||||||
 | 
					                    $this->Model_playlist->addItem($playlistId, $song->id, 'song');
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					        } else {
 | 
				
			||||||
 | 
					            $this->Model_playlist->addItem($playlistId, $itemId, 'song');
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        redirect('playlist/view/' . $playlistId);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public function view($playlistId) {
 | 
				
			||||||
 | 
					        $is_logged_in = $this->session->userdata('logged_in');
 | 
				
			||||||
 | 
					        $items = $this->Model_playlist->getPlaylistItems($playlistId);
 | 
				
			||||||
 | 
					        $data = array(
 | 
				
			||||||
 | 
					            'is_logged_in' => $is_logged_in,
 | 
				
			||||||
 | 
					            'items' => $items
 | 
				
			||||||
 | 
					        );
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        $this->load->view('layout/header', $data);
 | 
				
			||||||
 | 
					        $this->load->view('playlist_details', $data);
 | 
				
			||||||
 | 
					        $this->load->view('layout/footer');
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public function deleteItem($playlistId, $itemId) {
 | 
				
			||||||
 | 
					        $this->Model_playlist->deleteItem($playlistId, $itemId);
 | 
				
			||||||
 | 
					        redirect('playlist/view/' . $playlistId);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public function delete($playlist_id) {
 | 
				
			||||||
 | 
					        $is_logged_in = $this->session->userdata('logged_in');
 | 
				
			||||||
 | 
					        $user_email = $this->session->userdata('email');
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        if (!$is_logged_in) {
 | 
				
			||||||
 | 
					            redirect('connect/login');
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        $this->Model_playlist->deletePlaylist($playlist_id);
 | 
				
			||||||
 | 
					        redirect('playlist');
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public function duplicate($playlist_id) {
 | 
				
			||||||
 | 
					        $is_logged_in = $this->session->userdata('logged_in');
 | 
				
			||||||
 | 
					        $user_email = $this->session->userdata('email');
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        if (!$is_logged_in) {
 | 
				
			||||||
 | 
					            redirect('connect/login');
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        $this->Model_playlist->duplicatePlaylist($playlist_id, $user_email);
 | 
				
			||||||
 | 
					        redirect('playlist');
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public function rename() {
 | 
				
			||||||
 | 
					        $is_logged_in = $this->session->userdata('logged_in');
 | 
				
			||||||
 | 
					        $user_email = $this->session->userdata('email');
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        if (!$is_logged_in) {
 | 
				
			||||||
 | 
					            redirect('connect/login');
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        $playlistId = $this->input->post('playlistId');
 | 
				
			||||||
 | 
					        $newName = $this->input->post('newName');
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        $this->Model_playlist->renamePlaylist($playlistId, $newName);
 | 
				
			||||||
 | 
					        redirect('playlist');
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -71,7 +71,6 @@ class Model_music extends CI_Model {
 | 
				
			|||||||
        return $result->result();
 | 
					        return $result->result();
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 | 
				
			||||||
    public function getMusics($genre = '', $order = '', $artist = '', $query = '') {
 | 
					    public function getMusics($genre = '', $order = '', $artist = '', $query = '') {
 | 
				
			||||||
        $this->db->select('album.name as albumName, album.id as albumId, year, artist.name as artistName, genre.name as genreName, jpeg, song.name as trackName, track.id as trackId');
 | 
					        $this->db->select('album.name as albumName, album.id as albumId, year, artist.name as artistName, genre.name as genreName, jpeg, song.name as trackName, track.id as trackId');
 | 
				
			||||||
        $this->db->from('track');
 | 
					        $this->db->from('track');
 | 
				
			||||||
@@ -103,7 +102,6 @@ class Model_music extends CI_Model {
 | 
				
			|||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    public function getAlbumDetails($albumId) {
 | 
					    public function getAlbumDetails($albumId) {
 | 
				
			||||||
        // Get album info
 | 
					 | 
				
			||||||
        $this->db->select('album.name as albumName, album.id, year, artist.name as artistName, genre.name as genreName, jpeg');
 | 
					        $this->db->select('album.name as albumName, album.id, year, artist.name as artistName, genre.name as genreName, jpeg');
 | 
				
			||||||
        $this->db->from('album');
 | 
					        $this->db->from('album');
 | 
				
			||||||
        $this->db->join('artist', 'album.artistid = artist.id');
 | 
					        $this->db->join('artist', 'album.artistid = artist.id');
 | 
				
			||||||
@@ -113,7 +111,6 @@ class Model_music extends CI_Model {
 | 
				
			|||||||
        $albumQuery = $this->db->get();
 | 
					        $albumQuery = $this->db->get();
 | 
				
			||||||
        $albumDetails = $albumQuery->row();
 | 
					        $albumDetails = $albumQuery->row();
 | 
				
			||||||
    
 | 
					    
 | 
				
			||||||
        // Get album songs
 | 
					 | 
				
			||||||
        $this->db->select('song.name as trackName, track.id as trackId');
 | 
					        $this->db->select('song.name as trackName, track.id as trackId');
 | 
				
			||||||
        $this->db->from('track');
 | 
					        $this->db->from('track');
 | 
				
			||||||
        $this->db->join('song', 'track.songId = song.id');
 | 
					        $this->db->join('song', 'track.songId = song.id');
 | 
				
			||||||
@@ -124,22 +121,15 @@ class Model_music extends CI_Model {
 | 
				
			|||||||
        return array('album' => $albumDetails, 'songs' => $songs);
 | 
					        return array('album' => $albumDetails, 'songs' => $songs);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    public function getArtistDetails($artistId) {
 | 
					    public function getAlbumsByArtist($artistId) {
 | 
				
			||||||
        // Get artist info
 | 
					        $this->db->select('album.id as albumId, album.name as albumName, album.year, cover.jpeg, genre.name as genreName');
 | 
				
			||||||
        $this->db->select('artist.name as artistName, artist.id');
 | 
					 | 
				
			||||||
        $this->db->from('artist');
 | 
					 | 
				
			||||||
        $this->db->where('artist.id', $artistId);
 | 
					 | 
				
			||||||
        $artistQuery = $this->db->get();
 | 
					 | 
				
			||||||
        $artistDetails = $artistQuery->row();
 | 
					 | 
				
			||||||
    
 | 
					 | 
				
			||||||
        // Get artist's albums with their songs
 | 
					 | 
				
			||||||
        $this->db->select('album.id as albumId, album.name as albumName, album.year');
 | 
					 | 
				
			||||||
        $this->db->from('album');
 | 
					        $this->db->from('album');
 | 
				
			||||||
 | 
					        $this->db->join('genre', 'album.genreid = genre.id');
 | 
				
			||||||
 | 
					        $this->db->join('cover', 'album.coverid = cover.id');
 | 
				
			||||||
        $this->db->where('album.artistid', $artistId);
 | 
					        $this->db->where('album.artistid', $artistId);
 | 
				
			||||||
        $albumsQuery = $this->db->get();
 | 
					        $albumsQuery = $this->db->get();
 | 
				
			||||||
        $albums = $albumsQuery->result();
 | 
					        $albums = $albumsQuery->result();
 | 
				
			||||||
    
 | 
					    
 | 
				
			||||||
        // Get songs for each album
 | 
					 | 
				
			||||||
        foreach ($albums as $album) {
 | 
					        foreach ($albums as $album) {
 | 
				
			||||||
            $this->db->select('track.id as trackId, song.name as songName');
 | 
					            $this->db->select('track.id as trackId, song.name as songName');
 | 
				
			||||||
            $this->db->from('track');
 | 
					            $this->db->from('track');
 | 
				
			||||||
@@ -148,15 +138,34 @@ class Model_music extends CI_Model {
 | 
				
			|||||||
            $album->songs = $this->db->get()->result();
 | 
					            $album->songs = $this->db->get()->result();
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    
 | 
					    
 | 
				
			||||||
        return array('artist' => $artistDetails, 'albums' => $albums);
 | 
					        return $albums;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public function getArtistDetails($artistId) {
 | 
				
			||||||
 | 
					        $this->db->select('artist.name as artistName, artist.id');
 | 
				
			||||||
 | 
					        $this->db->from('artist');
 | 
				
			||||||
 | 
					        $this->db->where('artist.id', $artistId);
 | 
				
			||||||
 | 
					        $artistQuery = $this->db->get();
 | 
				
			||||||
 | 
					        return $artistQuery->row();
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    public function getSongDetails($songId) {
 | 
					    public function getSongDetails($songId) {
 | 
				
			||||||
        $this->db->select('song.name as songName, song.id as songId, album.name as albumName, album.id as albumId, album.year, artist.name as artistName, artist.id as artistId, cover.jpeg');
 | 
					        $this->db->select('
 | 
				
			||||||
 | 
					            song.name as songName, 
 | 
				
			||||||
 | 
					            song.id as songId, 
 | 
				
			||||||
 | 
					            album.name as albumName, 
 | 
				
			||||||
 | 
					            album.id as albumId, 
 | 
				
			||||||
 | 
					            album.year, 
 | 
				
			||||||
 | 
					            artist.name as artistName, 
 | 
				
			||||||
 | 
					            artist.id as artistId, 
 | 
				
			||||||
 | 
					            cover.jpeg,
 | 
				
			||||||
 | 
					            track.diskNumber, 
 | 
				
			||||||
 | 
					            track.number, 
 | 
				
			||||||
 | 
					            track.duration
 | 
				
			||||||
 | 
					        ');
 | 
				
			||||||
        $this->db->from('track');
 | 
					        $this->db->from('track');
 | 
				
			||||||
        $this->db->join('album', 'track.albumId = album.id');
 | 
					        $this->db->join('album', 'track.albumid = album.id');
 | 
				
			||||||
        $this->db->join('song', 'song.id = track.songId');
 | 
					        $this->db->join('song', 'song.id = track.songid');
 | 
				
			||||||
        $this->db->join('artist', 'album.artistid = artist.id');
 | 
					        $this->db->join('artist', 'album.artistid = artist.id');
 | 
				
			||||||
        $this->db->join('cover', 'cover.id = album.coverid');
 | 
					        $this->db->join('cover', 'cover.id = album.coverid');
 | 
				
			||||||
        $this->db->where('track.id', $songId);
 | 
					        $this->db->where('track.id', $songId);
 | 
				
			||||||
@@ -165,9 +174,52 @@ class Model_music extends CI_Model {
 | 
				
			|||||||
        return $result->row_array();
 | 
					        return $result->row_array();
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    // Suppression de la deuxième méthode researchtype
 | 
					    public function getSongsByAlbum($albumId) {
 | 
				
			||||||
 | 
					        $this->db->select('track.id');
 | 
				
			||||||
 | 
					        $this->db->from('track');
 | 
				
			||||||
 | 
					        $this->db->where('track.albumid', $albumId);
 | 
				
			||||||
 | 
					        $query = $this->db->get();
 | 
				
			||||||
 | 
					        return $query->result();
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    public function research(){
 | 
					    public function getSongsByArtist($artistId) {
 | 
				
			||||||
        $result = $this->db->query();
 | 
					        $this->db->select('track.id');
 | 
				
			||||||
 | 
					        $this->db->from('track');
 | 
				
			||||||
 | 
					        $this->db->join('album', 'track.albumid = album.id');
 | 
				
			||||||
 | 
					        $this->db->where('album.artistid', $artistId);
 | 
				
			||||||
 | 
					        $query = $this->db->get();
 | 
				
			||||||
 | 
					        return $query->result();
 | 
				
			||||||
 | 
					    }    
 | 
				
			||||||
 | 
					    
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public function getRandomSongs($numSongs, $artist = '', $genre = '') {
 | 
				
			||||||
 | 
					        $this->db->select('track.id as trackId');
 | 
				
			||||||
 | 
					        $this->db->from('track');
 | 
				
			||||||
 | 
					        $this->db->join('album', 'track.albumid = album.id');
 | 
				
			||||||
 | 
					        $this->db->join('song', 'song.id = track.songid');
 | 
				
			||||||
 | 
					        $this->db->join('artist', 'album.artistid = artist.id');
 | 
				
			||||||
 | 
					        $this->db->join('genre', 'album.genreid = genre.id');
 | 
				
			||||||
 | 
					    
 | 
				
			||||||
 | 
					        if (!empty($artist)) {
 | 
				
			||||||
 | 
					            $this->db->where('artist.name', $artist);
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					    
 | 
				
			||||||
 | 
					        if (!empty($genre)) {
 | 
				
			||||||
 | 
					            $this->db->where('genre.name', $genre);
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					    
 | 
				
			||||||
 | 
					        $this->db->order_by('RAND()');
 | 
				
			||||||
 | 
					        $this->db->limit($numSongs);
 | 
				
			||||||
 | 
					    
 | 
				
			||||||
 | 
					        $query = $this->db->get();
 | 
				
			||||||
 | 
					        return $query->result();
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public function getGenres() {
 | 
				
			||||||
 | 
					        $this->db->select('id, name');
 | 
				
			||||||
 | 
					        $this->db->from('genre');
 | 
				
			||||||
 | 
					        $query = $this->db->get();
 | 
				
			||||||
 | 
					        return $query->result();
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										98
									
								
								application/models/Model_playlist.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										98
									
								
								application/models/Model_playlist.php
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,98 @@
 | 
				
			|||||||
 | 
					<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					class Model_playlist extends CI_Model {
 | 
				
			||||||
 | 
					    public function __construct() {
 | 
				
			||||||
 | 
					        $this->load->database();
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public function getPlaylistsByUser($userEmail) {
 | 
				
			||||||
 | 
					        $this->db->select('*');
 | 
				
			||||||
 | 
					        $this->db->from('playlists');
 | 
				
			||||||
 | 
					        $this->db->where('user_email', $userEmail);
 | 
				
			||||||
 | 
					        $query = $this->db->get();
 | 
				
			||||||
 | 
					        return $query->result();
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public function addPlaylist($userEmail, $name) {
 | 
				
			||||||
 | 
					        $data = array(
 | 
				
			||||||
 | 
					            'user_email' => $userEmail,
 | 
				
			||||||
 | 
					            'name' => $name
 | 
				
			||||||
 | 
					        );
 | 
				
			||||||
 | 
					        $this->db->insert('playlists', $data);
 | 
				
			||||||
 | 
					        return $this->db->insert_id();
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public function addItem($playlistId, $itemId, $itemType) {
 | 
				
			||||||
 | 
					        $data = array(
 | 
				
			||||||
 | 
					            'playlist_id' => $playlistId,
 | 
				
			||||||
 | 
					            'item_id' => $itemId,
 | 
				
			||||||
 | 
					            'item_type' => $itemType
 | 
				
			||||||
 | 
					        );
 | 
				
			||||||
 | 
					        return $this->db->insert('playlist_items', $data);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public function getPlaylistItems($playlistId) {
 | 
				
			||||||
 | 
					        $this->db->select('playlist_items.item_id, song.name as songName, artist.name as artistName, album.name as albumName, playlist_items.playlist_id');
 | 
				
			||||||
 | 
					        $this->db->from('playlist_items');
 | 
				
			||||||
 | 
					        $this->db->join('track', 'track.id = playlist_items.item_id');
 | 
				
			||||||
 | 
					        $this->db->join('song', 'song.id = track.songid');
 | 
				
			||||||
 | 
					        $this->db->join('album', 'album.id = track.albumid');
 | 
				
			||||||
 | 
					        $this->db->join('artist', 'artist.id = album.artistid');
 | 
				
			||||||
 | 
					        $this->db->where('playlist_items.playlist_id', $playlistId);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        $result = $this->db->get();
 | 
				
			||||||
 | 
					        return $result->result();
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public function deleteItem($playlistId, $itemId) {
 | 
				
			||||||
 | 
					        $this->db->where('playlist_id', $playlistId);
 | 
				
			||||||
 | 
					        $this->db->where('item_id', $itemId);
 | 
				
			||||||
 | 
					        return $this->db->delete('playlist_items');
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public function deletePlaylist($playlistId) {
 | 
				
			||||||
 | 
					        $this->db->where('playlist_id', $playlistId);
 | 
				
			||||||
 | 
					        $this->db->delete('playlist_items');
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        $this->db->where('id', $playlistId);
 | 
				
			||||||
 | 
					        return $this->db->delete('playlists');
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public function duplicatePlaylist($playlistId) {
 | 
				
			||||||
 | 
					        $this->db->select('*');
 | 
				
			||||||
 | 
					        $this->db->from('playlists');
 | 
				
			||||||
 | 
					        $this->db->where('id', $playlistId);
 | 
				
			||||||
 | 
					        $query = $this->db->get();
 | 
				
			||||||
 | 
					        $playlist = $query->row();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        if ($playlist) {
 | 
				
			||||||
 | 
					            $newPlaylistData = array(
 | 
				
			||||||
 | 
					                'user_email' => $playlist->user_email,
 | 
				
			||||||
 | 
					                'name' => $playlist->name . ' (Copie)'
 | 
				
			||||||
 | 
					            );
 | 
				
			||||||
 | 
					            $this->db->insert('playlists', $newPlaylistData);
 | 
				
			||||||
 | 
					            $newPlaylistId = $this->db->insert_id();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            $this->db->select('*');
 | 
				
			||||||
 | 
					            $this->db->from('playlist_items');
 | 
				
			||||||
 | 
					            $this->db->where('playlist_id', $playlistId);
 | 
				
			||||||
 | 
					            $query = $this->db->get();
 | 
				
			||||||
 | 
					            $items = $query->result();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            foreach ($items as $item) {
 | 
				
			||||||
 | 
					                $newItemData = array(
 | 
				
			||||||
 | 
					                    'playlist_id' => $newPlaylistId,
 | 
				
			||||||
 | 
					                    'item_id' => $item->item_id,
 | 
				
			||||||
 | 
					                    'item_type' => $item->item_type
 | 
				
			||||||
 | 
					                );
 | 
				
			||||||
 | 
					                $this->db->insert('playlist_items', $newItemData);
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public function renamePlaylist($playlistId, $newName) {
 | 
				
			||||||
 | 
					        $data = array('name' => $newName);
 | 
				
			||||||
 | 
					        $this->db->where('id', $playlistId);
 | 
				
			||||||
 | 
					        return $this->db->update('playlists', $data);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
@@ -1,31 +1,38 @@
 | 
				
			|||||||
<!DOCTYPE html>
 | 
					<!DOCTYPE html>
 | 
				
			||||||
<html>
 | 
					<html>
 | 
				
			||||||
<head>
 | 
					 | 
				
			||||||
    <title><?= $album->albumName ?> - Details</title>
 | 
					 | 
				
			||||||
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bulma@1.0.0/css/bulma.min.css">
 | 
					 | 
				
			||||||
</head>
 | 
					 | 
				
			||||||
<body>
 | 
					<body>
 | 
				
			||||||
    <section class="section">
 | 
					    <section class="section">
 | 
				
			||||||
        <div class="container">
 | 
					        <div class="container">
 | 
				
			||||||
            <h1 class="title"><?= $album->albumName ?></h1>
 | 
					            <div class="columns is-vcentered">
 | 
				
			||||||
            <div class="columns">
 | 
					 | 
				
			||||||
                <div class="column is-one-third">
 | 
					                <div class="column is-one-third">
 | 
				
			||||||
                    <figure class="image">
 | 
					                    <figure class="image is-square">
 | 
				
			||||||
                        <img src="data:image/jpeg;base64,<?= base64_encode($album->jpeg) ?>" alt="<?= $album->albumName ?> Cover">
 | 
					                        <img src="data:image/jpeg;base64,<?= base64_encode($album->jpeg) ?>" alt="<?= $album->albumName ?> Cover">
 | 
				
			||||||
                    </figure>
 | 
					                    </figure>
 | 
				
			||||||
                </div>
 | 
					                </div>
 | 
				
			||||||
                <div class="column">
 | 
					                <div class="column">
 | 
				
			||||||
                    <p><strong>Artist:</strong> <?= $album->artistName ?></p>
 | 
					                    <h1 class="title"><?= $album->albumName ?></h1>
 | 
				
			||||||
 | 
					                    <p><strong>Artiste:</strong> <?= $album->artistName ?></p>
 | 
				
			||||||
                    <p><strong>Genre:</strong> <?= $album->genreName ?></p>
 | 
					                    <p><strong>Genre:</strong> <?= $album->genreName ?></p>
 | 
				
			||||||
                    <p><strong>Year:</strong> <?= $album->year ?></p>
 | 
					                    <p><strong>Année:</strong> <?= $album->year ?></p>
 | 
				
			||||||
                </div>
 | 
					                </div>
 | 
				
			||||||
            </div>
 | 
					            </div>
 | 
				
			||||||
            <h2 class="title is-4">Songs</h2>
 | 
					            <h2 class="title is-4">Chansons</h2>
 | 
				
			||||||
            <ul>
 | 
					            <div class="table-container">
 | 
				
			||||||
 | 
					                <table class="table is-striped is-fullwidth">
 | 
				
			||||||
 | 
					                    <thead>
 | 
				
			||||||
 | 
					                        <tr>
 | 
				
			||||||
 | 
					                            <th>Titre</th>
 | 
				
			||||||
 | 
					                        </tr>
 | 
				
			||||||
 | 
					                    </thead>
 | 
				
			||||||
 | 
					                    <tbody>
 | 
				
			||||||
                        <?php foreach ($songs as $song): ?>
 | 
					                        <?php foreach ($songs as $song): ?>
 | 
				
			||||||
                    <li><?= anchor("music/view/{$song->trackId}", $song->trackName) ?></li>
 | 
					                            <tr>
 | 
				
			||||||
 | 
					                                <td><?= anchor("music/view/{$song->trackId}", $song->trackName) ?></td>
 | 
				
			||||||
 | 
					                            </tr>
 | 
				
			||||||
                        <?php endforeach; ?>
 | 
					                        <?php endforeach; ?>
 | 
				
			||||||
            </ul>
 | 
					                    </tbody>
 | 
				
			||||||
 | 
					                </table>
 | 
				
			||||||
 | 
					            </div>
 | 
				
			||||||
        </div>
 | 
					        </div>
 | 
				
			||||||
    </section>
 | 
					    </section>
 | 
				
			||||||
</body>
 | 
					</body>
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,7 +1,18 @@
 | 
				
			|||||||
<h5 class="title is-5 has-text-white">Liste des Albums</h5>
 | 
					<!doctype html>
 | 
				
			||||||
<section class="columns is-multiline">
 | 
					<html lang="en">
 | 
				
			||||||
    <?php foreach($albums as $album): ?>
 | 
					<head>
 | 
				
			||||||
        <div class="column is-one-quarter">
 | 
					    <meta charset="UTF-8">
 | 
				
			||||||
 | 
					    <meta name="viewport" content="width=device-width, initial-scale=1.0">
 | 
				
			||||||
 | 
					    <title>Liste des Albums - Dix heures</title>
 | 
				
			||||||
 | 
					    <link rel="stylesheet" href="<?= base_url('assets/style.css') ?>">
 | 
				
			||||||
 | 
					</head>
 | 
				
			||||||
 | 
					<body>
 | 
				
			||||||
 | 
					    <section class="section">
 | 
				
			||||||
 | 
					        <div class="container">
 | 
				
			||||||
 | 
					            <h1 class="title is-4 has-text-dark">Liste des Albums</h1>
 | 
				
			||||||
 | 
					            <div class="columns is-multiline is-centered">
 | 
				
			||||||
 | 
					                <?php foreach ($albums as $album): ?>
 | 
				
			||||||
 | 
					                    <div class="column is-one-quarter-desktop is-half-tablet is-full-mobile">
 | 
				
			||||||
                        <div class="card">
 | 
					                        <div class="card">
 | 
				
			||||||
                            <div class="card-image">
 | 
					                            <div class="card-image">
 | 
				
			||||||
                                <figure class="image is-4by3">
 | 
					                                <figure class="image is-4by3">
 | 
				
			||||||
@@ -11,14 +22,23 @@
 | 
				
			|||||||
                            <div class="card-content">
 | 
					                            <div class="card-content">
 | 
				
			||||||
                                <div class="media">
 | 
					                                <div class="media">
 | 
				
			||||||
                                    <div class="media-content">
 | 
					                                    <div class="media-content">
 | 
				
			||||||
                            <p class="title is-4">
 | 
					                                        <p class="title is-4 album-title"><?= anchor("albums/view/{$album->id}", $album->name) ?></p>
 | 
				
			||||||
                                <?= anchor("albums/view/{$album->id}", $album->name) ?>
 | 
					 | 
				
			||||||
                            </p>
 | 
					 | 
				
			||||||
                                        <p class="subtitle is-6"><?= "{$album->year} - {$album->artistName}" ?></p>
 | 
					                                        <p class="subtitle is-6"><?= "{$album->year} - {$album->artistName}" ?></p>
 | 
				
			||||||
 | 
					                                        <?php if (isset($is_logged_in) && $is_logged_in): ?>
 | 
				
			||||||
 | 
					                                            <form method="post" action="<?= site_url('playlist/selectPlaylist') ?>">
 | 
				
			||||||
 | 
					                                                <input type="hidden" name="itemId" value="<?= $album->id ?>">
 | 
				
			||||||
 | 
					                                                <input type="hidden" name="itemType" value="album">
 | 
				
			||||||
 | 
					                                                <button type="submit" class="button is-link is-fullwidth">Ajouter à la playlist</button>
 | 
				
			||||||
 | 
					                                            </form>
 | 
				
			||||||
 | 
					                                        <?php endif; ?>
 | 
				
			||||||
                                    </div>
 | 
					                                    </div>
 | 
				
			||||||
                                </div>
 | 
					                                </div>
 | 
				
			||||||
                            </div>
 | 
					                            </div>
 | 
				
			||||||
                        </div>
 | 
					                        </div>
 | 
				
			||||||
                    </div>
 | 
					                    </div>
 | 
				
			||||||
                <?php endforeach; ?>
 | 
					                <?php endforeach; ?>
 | 
				
			||||||
</section>
 | 
					            </div>
 | 
				
			||||||
 | 
					        </div>
 | 
				
			||||||
 | 
					    </section>
 | 
				
			||||||
 | 
					</body>
 | 
				
			||||||
 | 
					</html>
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,32 +1,37 @@
 | 
				
			|||||||
<!DOCTYPE html>
 | 
					<!DOCTYPE html>
 | 
				
			||||||
<html>
 | 
					<html>
 | 
				
			||||||
<head>
 | 
					 | 
				
			||||||
    <title><?= $album->albumName ?> - Details</title>
 | 
					 | 
				
			||||||
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bulma@1.0.0/css/bulma.min.css">
 | 
					 | 
				
			||||||
</head>
 | 
					 | 
				
			||||||
<body>
 | 
					<body>
 | 
				
			||||||
    <section class="section">
 | 
					    <section class="section">
 | 
				
			||||||
        <div class="container">
 | 
					        <div class="container">
 | 
				
			||||||
            <h1 class="title has-text-white"><?= $album->albumName ?></h1>
 | 
					            <h1 class="title"><?= $artist->artistName ?></h1>
 | 
				
			||||||
 | 
					            <h2 class="title is-4">Albums</h2>
 | 
				
			||||||
 | 
					            <?php if ($albums): ?>
 | 
				
			||||||
 | 
					                <?php foreach ($albums as $album): ?>
 | 
				
			||||||
 | 
					                    <div class="box">
 | 
				
			||||||
                        <div class="columns">
 | 
					                        <div class="columns">
 | 
				
			||||||
                            <div class="column is-one-third">
 | 
					                            <div class="column is-one-third">
 | 
				
			||||||
                    <figure class="image is-square">
 | 
					                                <figure class="image">
 | 
				
			||||||
                                    <img src="data:image/jpeg;base64,<?= base64_encode($album->jpeg) ?>" alt="<?= $album->albumName ?> Cover">
 | 
					                                    <img src="data:image/jpeg;base64,<?= base64_encode($album->jpeg) ?>" alt="<?= $album->albumName ?> Cover">
 | 
				
			||||||
                                </figure>
 | 
					                                </figure>
 | 
				
			||||||
                            </div>
 | 
					                            </div>
 | 
				
			||||||
                            <div class="column">
 | 
					                            <div class="column">
 | 
				
			||||||
                    <p><strong>Artist:</strong> <?= $album->artistName ?></p>
 | 
					                                <h3 class="title is-5"><?= $album->albumName ?></h3>
 | 
				
			||||||
                                <p><strong>Genre:</strong> <?= $album->genreName ?></p>
 | 
					                                <p><strong>Genre:</strong> <?= $album->genreName ?></p>
 | 
				
			||||||
                                <p><strong>Year:</strong> <?= $album->year ?></p>
 | 
					                                <p><strong>Year:</strong> <?= $album->year ?></p>
 | 
				
			||||||
                </div>
 | 
					                                <h4 class="title is-6">Songs</h4>
 | 
				
			||||||
            </div>
 | 
					 | 
				
			||||||
            <h2 class="title is-4 has-text-white">Songs</h2>
 | 
					 | 
				
			||||||
                                <ul>
 | 
					                                <ul>
 | 
				
			||||||
                <?php foreach ($songs as $song): ?>
 | 
					                                    <?php foreach ($album->songs as $song): ?>
 | 
				
			||||||
                    <li><?= anchor("music/view/{$song->trackId}", $song->trackName) ?></li>
 | 
					                                        <li><?= anchor("music/view/{$song->trackId}", $song->songName) ?></li>
 | 
				
			||||||
                                    <?php endforeach; ?>
 | 
					                                    <?php endforeach; ?>
 | 
				
			||||||
                                </ul>
 | 
					                                </ul>
 | 
				
			||||||
                            </div>
 | 
					                            </div>
 | 
				
			||||||
 | 
					                        </div>
 | 
				
			||||||
 | 
					                    </div>
 | 
				
			||||||
 | 
					                <?php endforeach; ?>
 | 
				
			||||||
 | 
					            <?php else: ?>
 | 
				
			||||||
 | 
					                <p>No albums found for this artist.</p>
 | 
				
			||||||
 | 
					            <?php endif; ?>
 | 
				
			||||||
 | 
					        </div>
 | 
				
			||||||
    </section>
 | 
					    </section>
 | 
				
			||||||
</body>
 | 
					</body>
 | 
				
			||||||
</html>
 | 
					</html>
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,11 +1,27 @@
 | 
				
			|||||||
<h5>Liste des Artistes</h5>
 | 
					<section class="section">
 | 
				
			||||||
<section class="list">
 | 
					    <div class="container">
 | 
				
			||||||
<?php
 | 
					        <h1 class="title is-4">Liste des Artistes</h1>
 | 
				
			||||||
foreach($artists as $artist){
 | 
					        <div class="columns is-multiline">
 | 
				
			||||||
        echo "<div><article>";
 | 
					            <?php foreach ($artists as $artist): ?>
 | 
				
			||||||
        echo "<header class='short-text'>";
 | 
					                <div class="column is-one-quarter-desktop is-half-tablet is-full-mobile">
 | 
				
			||||||
        echo anchor("artistes/view/{$artist->artistId}","{$artist->artistName}");
 | 
					                    <div class="card artist-card">
 | 
				
			||||||
        echo "</header></article></div>";
 | 
					                        <div class="card-content">
 | 
				
			||||||
}
 | 
					                            <div class="media">
 | 
				
			||||||
?>
 | 
					                                <div class="media-content">
 | 
				
			||||||
 | 
					                                    <p class="title is-4 artist-title"><?= anchor("artistes/view/{$artist->artistId}", $artist->artistName) ?></p>
 | 
				
			||||||
 | 
					                                    <?php if (isset($is_logged_in) && $is_logged_in): ?>
 | 
				
			||||||
 | 
					                                        <form method="post" action="<?= site_url('playlist/selectPlaylist') ?>">
 | 
				
			||||||
 | 
					                                            <input type="hidden" name="itemId" value="<?= $artist->artistId ?>">
 | 
				
			||||||
 | 
					                                            <input type="hidden" name="itemType" value="artist">
 | 
				
			||||||
 | 
					                                            <button type="submit" class="button is-link">Ajouter à la playlist</button>
 | 
				
			||||||
 | 
					                                        </form>
 | 
				
			||||||
 | 
					                                    <?php endif; ?>
 | 
				
			||||||
 | 
					                                </div>
 | 
				
			||||||
 | 
					                            </div>
 | 
				
			||||||
 | 
					                        </div>
 | 
				
			||||||
 | 
					                    </div>
 | 
				
			||||||
 | 
					                </div>
 | 
				
			||||||
 | 
					            <?php endforeach; ?>
 | 
				
			||||||
 | 
					        </div>
 | 
				
			||||||
 | 
					    </div>
 | 
				
			||||||
</section>
 | 
					</section>
 | 
				
			||||||
@@ -1,32 +1,59 @@
 | 
				
			|||||||
<?=validation_errors(); ?>
 | 
					<!doctype html>
 | 
				
			||||||
<?=form_open('connect/create')?>
 | 
					<html lang="en">
 | 
				
			||||||
  <!-- Grid -->
 | 
					<body>
 | 
				
			||||||
  <div class="grid">
 | 
					    <section class="hero is-fullheight">
 | 
				
			||||||
 | 
					        <div class="hero-body">
 | 
				
			||||||
    <label for="prenom">
 | 
					            <div class="container">
 | 
				
			||||||
      Prénom
 | 
					                <div class="columns is-centered">
 | 
				
			||||||
      <input type="text" id="prenom" name="prenom" placeholder="Prénom" value="<?=set_value('prenom')?>" required>
 | 
					                    <div class="column is-5">
 | 
				
			||||||
    </label>
 | 
					                        <div class="box">
 | 
				
			||||||
 | 
					                            <h1 class="title is-1 has-text-centered">Inscription</h1>
 | 
				
			||||||
    <label for="nom">
 | 
					                            <?=validation_errors(); ?>
 | 
				
			||||||
      Nom
 | 
					                            <?=form_open('connect/create')?>
 | 
				
			||||||
      <input type="text" id="nom" name="nom" placeholder="Nom" value="<?=set_value('nom')?>" required>
 | 
					                                <div class="field">
 | 
				
			||||||
    </label>
 | 
					                                    <label class="label" for="prenom">Prénom</label>
 | 
				
			||||||
 | 
					                                    <div class="control">
 | 
				
			||||||
 | 
					                                        <input class="input is-dark" type="text" id="prenom" name="prenom" placeholder="Prénom" value="<?=set_value('prenom')?>" required>
 | 
				
			||||||
                                    </div>
 | 
					                                    </div>
 | 
				
			||||||
 | 
					 | 
				
			||||||
  <label for="email">Adresse mail</label>
 | 
					 | 
				
			||||||
  <input type="email" id="email" name="email" placeholder="Email" value="<?=set_value('email')?>" required>
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  <div class="grid">
 | 
					 | 
				
			||||||
    <label for="password">Password
 | 
					 | 
				
			||||||
      <input type="password" id="password" name="password" placeholder="Password" value="<?=set_value('password')?>" required>
 | 
					 | 
				
			||||||
    </label>
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    <label for="cpassword">Confirmation password
 | 
					 | 
				
			||||||
      <input type="password" id="cpassword" name="cpassword" placeholder="Confirmation Password" value="<?=set_value('cpassword')?>" required>
 | 
					 | 
				
			||||||
    </label>
 | 
					 | 
				
			||||||
                                </div>
 | 
					                                </div>
 | 
				
			||||||
 | 
					                                <div class="field">
 | 
				
			||||||
  <!-- Button -->
 | 
					                                    <label class="label" for="nom">Nom</label>
 | 
				
			||||||
  <button type="submit">Submit</button>
 | 
					                                    <div class="control">
 | 
				
			||||||
</form>
 | 
					                                        <input class="input is-dark" type="text" id="nom" name="nom" placeholder="Nom" value="<?=set_value('nom')?>" required>
 | 
				
			||||||
 | 
					                                    </div>
 | 
				
			||||||
 | 
					                                </div>
 | 
				
			||||||
 | 
					                                <div class="field">
 | 
				
			||||||
 | 
					                                    <label class="label" for="email">Adresse mail</label>
 | 
				
			||||||
 | 
					                                    <div class="control">
 | 
				
			||||||
 | 
					                                        <input class="input is-dark" type="email" id="email" name="email" placeholder="Email" value="<?=set_value('email')?>" required>
 | 
				
			||||||
 | 
					                                    </div>
 | 
				
			||||||
 | 
					                                </div>
 | 
				
			||||||
 | 
					                                <div class="field">
 | 
				
			||||||
 | 
					                                    <label class="label" for="password">Mot de passe</label>
 | 
				
			||||||
 | 
					                                    <div class="control">
 | 
				
			||||||
 | 
					                                        <input class="input is-dark" type="password" id="password" name="password" placeholder="Mot de passe" value="<?=set_value('password')?>" required>
 | 
				
			||||||
 | 
					                                    </div>
 | 
				
			||||||
 | 
					                                </div>
 | 
				
			||||||
 | 
					                                <div class="field">
 | 
				
			||||||
 | 
					                                    <label class="label" for="cpassword">Confirmation mot de passe</label>
 | 
				
			||||||
 | 
					                                    <div class="control">
 | 
				
			||||||
 | 
					                                        <input class="input is-dark" type="password" id="cpassword" name="cpassword" placeholder="Confirmation mot de passe" value="<?=set_value('cpassword')?>" required>
 | 
				
			||||||
 | 
					                                    </div>
 | 
				
			||||||
 | 
					                                </div>
 | 
				
			||||||
 | 
					                                <div class="field">
 | 
				
			||||||
 | 
					                                    <div class="control">
 | 
				
			||||||
 | 
					                                        <button class="button is-primary is-fullwidth is-large" type="submit">S'inscrire</button>
 | 
				
			||||||
 | 
					                                    </div>
 | 
				
			||||||
 | 
					                                </div>
 | 
				
			||||||
 | 
					                                <div class="has-text-centered">
 | 
				
			||||||
 | 
					                                    <p>Vous avez déjà un compte ? <a href="<?= site_url('connect/login') ?>" class="has-text-primary">Connexion</a></p>
 | 
				
			||||||
 | 
					                                </div>
 | 
				
			||||||
 | 
					                            </form>
 | 
				
			||||||
 | 
					                        </div>
 | 
				
			||||||
 | 
					                    </div>
 | 
				
			||||||
 | 
					                </div>
 | 
				
			||||||
 | 
					            </div>
 | 
				
			||||||
 | 
					        </div>
 | 
				
			||||||
 | 
					    </section>
 | 
				
			||||||
 | 
					</body>
 | 
				
			||||||
 | 
					</html>
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -17,6 +17,7 @@
 | 
				
			|||||||
    <!-- Div contenant les filtres, cachée par défaut -->
 | 
					    <!-- Div contenant les filtres, cachée par défaut -->
 | 
				
			||||||
    <div id="filters" style="display: none;">
 | 
					    <div id="filters" style="display: none;">
 | 
				
			||||||
        <form method="GET" action="">
 | 
					        <form method="GET" action="">
 | 
				
			||||||
 | 
					            <?php if ($this->uri->segment(1) != 'artistes'): ?>
 | 
				
			||||||
            <!-- Filtre par artiste -->
 | 
					            <!-- Filtre par artiste -->
 | 
				
			||||||
            <div class="field">
 | 
					            <div class="field">
 | 
				
			||||||
                <label class="label" for="artist">Artiste</label>
 | 
					                <label class="label" for="artist">Artiste</label>
 | 
				
			||||||
@@ -31,6 +32,7 @@
 | 
				
			|||||||
                    </div>
 | 
					                    </div>
 | 
				
			||||||
                </div>
 | 
					                </div>
 | 
				
			||||||
            </div>
 | 
					            </div>
 | 
				
			||||||
 | 
					            <?php endif; ?>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            <!-- Filtre par genre -->
 | 
					            <!-- Filtre par genre -->
 | 
				
			||||||
            <div class="field">
 | 
					            <div class="field">
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,58 +1,48 @@
 | 
				
			|||||||
<!doctype html>
 | 
					<!doctype html>
 | 
				
			||||||
<html lang="en" class="has-navbar-fixed-top">
 | 
					<html lang="en">
 | 
				
			||||||
<head>
 | 
					<head>
 | 
				
			||||||
    <meta charset="UTF-8" />
 | 
					    <meta charset="UTF-8">
 | 
				
			||||||
    <title>Dix heures</title>
 | 
					    <meta name="viewport" content="width=device-width, initial-scale=1.0">
 | 
				
			||||||
 | 
					    <title><?= $title ?? 'Dix heures' ?></title>
 | 
				
			||||||
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bulma@1.0.0/css/bulma.min.css">
 | 
					    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bulma@1.0.0/css/bulma.min.css">
 | 
				
			||||||
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css">
 | 
					    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css">
 | 
				
			||||||
    <?= link_tag('assets/style.css') ?>
 | 
					    <link rel="stylesheet" href="<?= base_url('assets/style.css') ?>">
 | 
				
			||||||
    <style>
 | 
					 | 
				
			||||||
        body {
 | 
					 | 
				
			||||||
            background-color: #121212;
 | 
					 | 
				
			||||||
            color: #FFFFFF;
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
        .navbar {
 | 
					 | 
				
			||||||
            background-color: #000000;
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
        .navbar-item {
 | 
					 | 
				
			||||||
            color: white;
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
        .hero {
 | 
					 | 
				
			||||||
            background-color: #282828;
 | 
					 | 
				
			||||||
            color: white;
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
        .card {
 | 
					 | 
				
			||||||
            background-color: #1e1e1e;
 | 
					 | 
				
			||||||
            color: white;
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
        .button, .input, .select {
 | 
					 | 
				
			||||||
            background-color: #282828;
 | 
					 | 
				
			||||||
            color: white;
 | 
					 | 
				
			||||||
            border-color: #282828;
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
        .button:hover, .input:hover, .select:hover {
 | 
					 | 
				
			||||||
            background-color: #3b3b3b;
 | 
					 | 
				
			||||||
            border-color: #3b3b3b;
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
    </style>
 | 
					 | 
				
			||||||
</head>
 | 
					</head>
 | 
				
			||||||
<body>
 | 
					<body>
 | 
				
			||||||
    <nav class="navbar">
 | 
					    <nav class="navbar">
 | 
				
			||||||
 | 
					        <div class="container">
 | 
				
			||||||
            <div class="navbar-brand">
 | 
					            <div class="navbar-brand">
 | 
				
			||||||
            <a class="navbar-item" href="#">Dix heures</a>
 | 
					                <a class="navbar-item" href="#">
 | 
				
			||||||
 | 
					                    <img src="<?= base_url('assets/logo.png') ?>" alt="Logo">
 | 
				
			||||||
 | 
					                </a>
 | 
				
			||||||
 | 
					                <a role="button" class="navbar-burger" aria-label="menu" aria-expanded="false" data-target="navbarBasicExample">
 | 
				
			||||||
 | 
					                    <span aria-hidden="true"></span>
 | 
				
			||||||
 | 
					                    <span aria-hidden="true"></span>
 | 
				
			||||||
 | 
					                    <span aria-hidden="true"></span>
 | 
				
			||||||
 | 
					                </a>
 | 
				
			||||||
            </div>
 | 
					            </div>
 | 
				
			||||||
        <div class="navbar-menu">
 | 
					
 | 
				
			||||||
            <div class="navbar-end">
 | 
					            <div id="navbarBasicExample" class="navbar-menu">
 | 
				
			||||||
 | 
					                <div class="navbar-start">
 | 
				
			||||||
                    <a class="navbar-item" href="<?= site_url('albums') ?>">Albums</a>
 | 
					                    <a class="navbar-item" href="<?= site_url('albums') ?>">Albums</a>
 | 
				
			||||||
                    <a class="navbar-item" href="<?= site_url('artistes') ?>">Artistes</a>
 | 
					                    <a class="navbar-item" href="<?= site_url('artistes') ?>">Artistes</a>
 | 
				
			||||||
                <a class="navbar-item" href="<?= site_url('music') ?>">Music</a>
 | 
					                    <a class="navbar-item" href="<?= site_url('music') ?>">Musiques</a>
 | 
				
			||||||
                    <?php if (isset($is_logged_in) && $is_logged_in): ?>
 | 
					                    <?php if (isset($is_logged_in) && $is_logged_in): ?>
 | 
				
			||||||
                    <a class="navbar-item" href="<?= site_url('playlist') ?>">Playlist</a>
 | 
					                        <a class="navbar-item" href="<?= site_url('playlist') ?>">Playlists</a>
 | 
				
			||||||
                    <a class="navbar-item" href="<?= site_url('connect/logout') ?>">Déconnexion</a>
 | 
					                    <?php endif; ?>
 | 
				
			||||||
 | 
					                </div>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                <div class="navbar-end">
 | 
				
			||||||
 | 
					                    <div class="navbar-item">
 | 
				
			||||||
 | 
					                        <?php if (isset($is_logged_in) && $is_logged_in): ?>
 | 
				
			||||||
 | 
					                            <a class="button is-light" href="<?= site_url('connect/logout') ?>">Déconnexion</a>
 | 
				
			||||||
                        <?php else: ?>
 | 
					                        <?php else: ?>
 | 
				
			||||||
                    <a class="navbar-item" href="<?= site_url('connect/login') ?>">Connexion</a>
 | 
					                            <a class="button is-light" href="<?= site_url('connect/login') ?>">Connexion</a>
 | 
				
			||||||
 | 
					                            <a class="button is-primary" href="<?= site_url('connect/create') ?>">Inscription</a>
 | 
				
			||||||
                        <?php endif; ?>
 | 
					                        <?php endif; ?>
 | 
				
			||||||
                    </div>
 | 
					                    </div>
 | 
				
			||||||
                </div>
 | 
					                </div>
 | 
				
			||||||
 | 
					            </div>
 | 
				
			||||||
 | 
					        </div>
 | 
				
			||||||
    </nav>
 | 
					    </nav>
 | 
				
			||||||
    <main class="container">
 | 
					    <main class="container" style="padding-top: 90px;"> <!-- Ajout de padding-top pour éviter que la navbar ne masque le contenu -->
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,29 +1,44 @@
 | 
				
			|||||||
<!DOCTYPE html>
 | 
					<!doctype html>
 | 
				
			||||||
<html>
 | 
					<html lang="fr">
 | 
				
			||||||
<head>
 | 
					 | 
				
			||||||
    <title>Login</title>
 | 
					 | 
				
			||||||
</head>
 | 
					 | 
				
			||||||
<body>
 | 
					<body>
 | 
				
			||||||
 | 
					    <section class="hero is-fullheight">
 | 
				
			||||||
 | 
					        <div class="hero-body">
 | 
				
			||||||
 | 
					            <div class="container">
 | 
				
			||||||
 | 
					                <div class="columns is-centered">
 | 
				
			||||||
 | 
					                    <div class="column is-5">
 | 
				
			||||||
 | 
					                        <div class="box">
 | 
				
			||||||
 | 
					                            <h1 class="title is-1 has-text-centered">Connexion</h1>
 | 
				
			||||||
                            <?= validation_errors(); ?>
 | 
					                            <?= validation_errors(); ?>
 | 
				
			||||||
 | 
					 | 
				
			||||||
                            <?php if (isset($error)): ?>
 | 
					                            <?php if (isset($error)): ?>
 | 
				
			||||||
      <p style="color: red;"><?= $error ?></p>
 | 
					                                <p class="has-text-danger"><?= $error ?></p>
 | 
				
			||||||
                            <?php endif; ?>
 | 
					                            <?php endif; ?>
 | 
				
			||||||
 | 
					 | 
				
			||||||
                            <?= form_open('connect/login') ?>
 | 
					                            <?= form_open('connect/login') ?>
 | 
				
			||||||
      <!-- Grid -->
 | 
					                                <div class="field">
 | 
				
			||||||
      <div class="grid">
 | 
					                                    <label class="label" for="email">Adresse mail</label>
 | 
				
			||||||
        <label for="email">Adresse mail</label>
 | 
					                                    <div class="control">
 | 
				
			||||||
        <input type="email" id="email" name="email" placeholder="Email" value="<?= set_value('email') ?>" required>
 | 
					                                        <input class="input is-dark" type="email" id="email" name="email" placeholder="Email" value="<?= set_value('email') ?>" required>
 | 
				
			||||||
 | 
					                                    </div>
 | 
				
			||||||
        <label for="password">Password</label>
 | 
					                                </div>
 | 
				
			||||||
        <input type="password" id="password" name="password" placeholder="Password" value="<?= set_value('password') ?>" required>
 | 
					                                <div class="field">
 | 
				
			||||||
 | 
					                                    <label class="label" for="password">Mot de passe</label>
 | 
				
			||||||
 | 
					                                    <div class="control">
 | 
				
			||||||
 | 
					                                        <input class="input is-dark" type="password" id="password" name="password" placeholder="Mot de passe" value="<?= set_value('password') ?>" required>
 | 
				
			||||||
 | 
					                                    </div>
 | 
				
			||||||
 | 
					                                </div>
 | 
				
			||||||
 | 
					                                <div class="field">
 | 
				
			||||||
 | 
					                                    <div class="control">
 | 
				
			||||||
 | 
					                                        <button class="button is-primary is-fullwidth is-large" type="submit">Se connecter</button>
 | 
				
			||||||
 | 
					                                    </div>
 | 
				
			||||||
 | 
					                                </div>
 | 
				
			||||||
 | 
					                                <div class="has-text-centered">
 | 
				
			||||||
 | 
					                                    <p>Vous n'avez pas de compte ? <a href="<?= site_url('connect/create') ?>" class="has-text-primary">Inscription</a></p>
 | 
				
			||||||
                                </div>
 | 
					                                </div>
 | 
				
			||||||
      <!-- Button -->
 | 
					 | 
				
			||||||
      <button type="submit">Submit</button>
 | 
					 | 
				
			||||||
      
 | 
					 | 
				
			||||||
      <?= anchor('connect/create', "Pas de compte ? Créez-en un !"); ?>
 | 
					 | 
				
			||||||
                            </form>
 | 
					                            </form>
 | 
				
			||||||
 | 
					                        </div>
 | 
				
			||||||
 | 
					                    </div>
 | 
				
			||||||
 | 
					                </div>
 | 
				
			||||||
 | 
					            </div>
 | 
				
			||||||
 | 
					        </div>
 | 
				
			||||||
 | 
					    </section>
 | 
				
			||||||
</body>
 | 
					</body>
 | 
				
			||||||
</html>
 | 
					</html>
 | 
				
			||||||
 | 
					 | 
				
			||||||
 
 | 
				
			|||||||
@@ -2,14 +2,6 @@
 | 
				
			|||||||
defined('BASEPATH') OR exit('No direct script access allowed');
 | 
					defined('BASEPATH') OR exit('No direct script access allowed');
 | 
				
			||||||
?>
 | 
					?>
 | 
				
			||||||
<!doctype html>
 | 
					<!doctype html>
 | 
				
			||||||
<html lang="en" class="has-navbar-fixed-top">
 | 
					 | 
				
			||||||
<head>
 | 
					 | 
				
			||||||
  <meta charset="UTF-8" />
 | 
					 | 
				
			||||||
  <title>Dix heures</title>
 | 
					 | 
				
			||||||
  <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@picocss/pico@2/css/pico.min.css"/>
 | 
					 | 
				
			||||||
  <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css">
 | 
					 | 
				
			||||||
  <?=link_tag('assets/style.css')?>
 | 
					 | 
				
			||||||
</head>
 | 
					 | 
				
			||||||
<body>
 | 
					<body>
 | 
				
			||||||
  <main class='container'>
 | 
					  <main class='container'>
 | 
				
			||||||
    <nav>
 | 
					    <nav>
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,16 +1,33 @@
 | 
				
			|||||||
<h5>Liste des musiques</h5>
 | 
					<section class="section">
 | 
				
			||||||
<section class="list">
 | 
					    <div class="container">
 | 
				
			||||||
<?php
 | 
					        <h1 class="title is-4 has-text-dark">Liste des musiques</h1>
 | 
				
			||||||
foreach($musics as $music){
 | 
					        <div class="columns is-multiline">
 | 
				
			||||||
    echo "<div><article>";
 | 
					            <?php foreach ($musics as $music): ?>
 | 
				
			||||||
    echo "<header class='short-text'>";
 | 
					                <div class="column is-one-quarter-desktop is-half-tablet is-full-mobile">
 | 
				
			||||||
    if(isset($music->trackName)) {
 | 
					                    <div class="card">
 | 
				
			||||||
        echo anchor("music/view/{$music->trackId}", $music->trackName);
 | 
					                        <div class="card-image">
 | 
				
			||||||
    }
 | 
					                            <figure class="image is-4by3">
 | 
				
			||||||
    echo "</header>";
 | 
					                                <img src="data:image/jpeg;base64,<?= base64_encode($music->jpeg) ?>" alt="<?= $music->trackName ?>">
 | 
				
			||||||
    echo '<img src="data:image/jpeg;base64,'.base64_encode($music->jpeg).'" />';
 | 
					                            </figure>
 | 
				
			||||||
    echo "<footer class='short-text'>{$music->year} - {$music->artistName} - {$music->albumName}</footer>
 | 
					                        </div>
 | 
				
			||||||
    </article></div>";
 | 
					                        <div class="card-content">
 | 
				
			||||||
}
 | 
					                            <div class="media">
 | 
				
			||||||
?>
 | 
					                                <div class="media-content">
 | 
				
			||||||
 | 
					                                    <p class="title is-4 music-title"><?= anchor("music/view/{$music->trackId}", $music->trackName) ?></p>
 | 
				
			||||||
 | 
					                                    <p class="subtitle is-6"><?= "{$music->year} - {$music->artistName} - {$music->albumName}" ?></p>
 | 
				
			||||||
 | 
					                                    <?php if (isset($is_logged_in) && $is_logged_in): ?>
 | 
				
			||||||
 | 
					                                        <form method="post" action="<?= site_url('playlist/selectPlaylist') ?>">
 | 
				
			||||||
 | 
					                                            <input type="hidden" name="itemId" value="<?= $music->trackId ?>">
 | 
				
			||||||
 | 
					                                            <input type="hidden" name="itemType" value="song">
 | 
				
			||||||
 | 
					                                            <button type="submit" class="button is-link">Ajouter à la playlist</button>
 | 
				
			||||||
 | 
					                                        </form>
 | 
				
			||||||
 | 
					                                    <?php endif; ?>
 | 
				
			||||||
 | 
					                                </div>
 | 
				
			||||||
 | 
					                            </div>
 | 
				
			||||||
 | 
					                        </div>
 | 
				
			||||||
 | 
					                    </div>
 | 
				
			||||||
 | 
					                </div>
 | 
				
			||||||
 | 
					            <?php endforeach; ?>
 | 
				
			||||||
 | 
					        </div>
 | 
				
			||||||
 | 
					    </div>
 | 
				
			||||||
</section>
 | 
					</section>
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										38
									
								
								application/views/playlist_details.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										38
									
								
								application/views/playlist_details.php
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,38 @@
 | 
				
			|||||||
 | 
					<section class="section">
 | 
				
			||||||
 | 
					    <div class="container">
 | 
				
			||||||
 | 
					        <h1 class="title">Détails de la Playlist</h1>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        <?php if ($items): ?>
 | 
				
			||||||
 | 
					            <div class="table-container" style="max-height: 400px; overflow-y: auto;">
 | 
				
			||||||
 | 
					                <table class="table is-fullwidth is-striped">
 | 
				
			||||||
 | 
					                    <thead>
 | 
				
			||||||
 | 
					                        <tr>
 | 
				
			||||||
 | 
					                            <th>Titre</th>
 | 
				
			||||||
 | 
					                            <th>Artiste</th>
 | 
				
			||||||
 | 
					                            <th>Album</th>
 | 
				
			||||||
 | 
					                            <th>Actions</th>
 | 
				
			||||||
 | 
					                        </tr>
 | 
				
			||||||
 | 
					                    </thead>
 | 
				
			||||||
 | 
					                    <tbody>
 | 
				
			||||||
 | 
					                        <?php foreach ($items as $item): ?>
 | 
				
			||||||
 | 
					                            <tr>
 | 
				
			||||||
 | 
					                                <td><?= anchor("music/view/{$item->item_id}", $item->songName) ?></td>
 | 
				
			||||||
 | 
					                                <td><?= $item->artistName ?></td>
 | 
				
			||||||
 | 
					                                <td><?= $item->albumName ?></td>
 | 
				
			||||||
 | 
					                                <td>
 | 
				
			||||||
 | 
					                                    <form method="post" action="<?= site_url('playlist/deleteItem/'.$item->playlist_id.'/'.$item->item_id) ?>" style="display:inline;">
 | 
				
			||||||
 | 
					                                        <button type="submit" class="button is-danger is-small">Supprimer</button>
 | 
				
			||||||
 | 
					                                    </form>
 | 
				
			||||||
 | 
					                                </td>
 | 
				
			||||||
 | 
					                            </tr>
 | 
				
			||||||
 | 
					                        <?php endforeach; ?>
 | 
				
			||||||
 | 
					                    </tbody>
 | 
				
			||||||
 | 
					                </table>
 | 
				
			||||||
 | 
					            </div>
 | 
				
			||||||
 | 
					        <?php else: ?>
 | 
				
			||||||
 | 
					            <p>La playlist est vide.</p>
 | 
				
			||||||
 | 
					        <?php endif; ?>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        <a href="<?= site_url('playlist') ?>" class="button is-link">Retour aux playlists</a>
 | 
				
			||||||
 | 
					    </div>
 | 
				
			||||||
 | 
					</section>
 | 
				
			||||||
							
								
								
									
										154
									
								
								application/views/playlists_list.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										154
									
								
								application/views/playlists_list.php
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,154 @@
 | 
				
			|||||||
 | 
					<section class="section">
 | 
				
			||||||
 | 
					    <div class="container">
 | 
				
			||||||
 | 
					        <h1 class="title">Mes Playlists</h1>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        <?php if (isset($error)): ?>
 | 
				
			||||||
 | 
					            <div class="notification is-danger">
 | 
				
			||||||
 | 
					                <?= $error ?>
 | 
				
			||||||
 | 
					            </div>
 | 
				
			||||||
 | 
					        <?php endif; ?>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        <?php if ($playlists): ?>
 | 
				
			||||||
 | 
					            <div class="columns is-multiline">
 | 
				
			||||||
 | 
					                <?php foreach ($playlists as $playlist): ?>
 | 
				
			||||||
 | 
					                    <div class="column is-one-third">
 | 
				
			||||||
 | 
					                        <div class="card">
 | 
				
			||||||
 | 
					                            <div class="card-content">
 | 
				
			||||||
 | 
					                                <div class="media">
 | 
				
			||||||
 | 
					                                    <div class="media-content">
 | 
				
			||||||
 | 
					                                        <p class="title is-4"><?= anchor("playlist/view/{$playlist->id}", $playlist->name) ?></p>
 | 
				
			||||||
 | 
					                                    </div>
 | 
				
			||||||
 | 
					                                    <div class="media-right buttons-right">
 | 
				
			||||||
 | 
					                                        <?= form_open('playlist/duplicate/'.$playlist->id, ['style' => 'display:inline;']) ?>
 | 
				
			||||||
 | 
					                                            <button type="submit" class="button is-info is-small">Dupliquer</button>
 | 
				
			||||||
 | 
					                                        <?= form_close() ?>
 | 
				
			||||||
 | 
					                                        <button class="button is-warning is-small" onclick="showRenameModal('<?= $playlist->id ?>', '<?= $playlist->name ?>')">Renommer</button>
 | 
				
			||||||
 | 
					                                    </div>
 | 
				
			||||||
 | 
					                                </div>
 | 
				
			||||||
 | 
					                            </div>
 | 
				
			||||||
 | 
					                            <footer class="card-footer">
 | 
				
			||||||
 | 
					                                <?= form_open('playlist/delete/'.$playlist->id, ['class' => 'card-footer-item']) ?>
 | 
				
			||||||
 | 
					                                    <button type="submit" class="button is-danger is-small">Supprimer</button>
 | 
				
			||||||
 | 
					                                <?= form_close() ?>
 | 
				
			||||||
 | 
					                            </footer>
 | 
				
			||||||
 | 
					                        </div>
 | 
				
			||||||
 | 
					                    </div>
 | 
				
			||||||
 | 
					                <?php endforeach; ?>
 | 
				
			||||||
 | 
					            </div>
 | 
				
			||||||
 | 
					        <?php else: ?>
 | 
				
			||||||
 | 
					            <p>Vous n'avez pas encore de playlists.</p>
 | 
				
			||||||
 | 
					        <?php endif; ?>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        <div class="box">
 | 
				
			||||||
 | 
					            <form method="post" action="<?= site_url('playlist/add') ?>">
 | 
				
			||||||
 | 
					                <div class="field">
 | 
				
			||||||
 | 
					                    <label class="label">Nom de la playlist</label>
 | 
				
			||||||
 | 
					                    <div class="control">
 | 
				
			||||||
 | 
					                        <input type="text" name="name" class="input" placeholder="Nom de la playlist" required>
 | 
				
			||||||
 | 
					                    </div>
 | 
				
			||||||
 | 
					                </div>
 | 
				
			||||||
 | 
					                <div class="field">
 | 
				
			||||||
 | 
					                    <label class="label">Type de Playlist</label>
 | 
				
			||||||
 | 
					                    <div class="control">
 | 
				
			||||||
 | 
					                        <div class="select">
 | 
				
			||||||
 | 
					                            <select name="type" id="playlistType" onchange="toggleRandomOptions()">
 | 
				
			||||||
 | 
					                                <option value="empty">Vide</option>
 | 
				
			||||||
 | 
					                                <option value="random">Aléatoire</option>
 | 
				
			||||||
 | 
					                            </select>
 | 
				
			||||||
 | 
					                        </div>
 | 
				
			||||||
 | 
					                    </div>
 | 
				
			||||||
 | 
					                </div>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                <div id="randomOptions" style="display: none;">
 | 
				
			||||||
 | 
					                    <div class="field">
 | 
				
			||||||
 | 
					                        <label class="label">Nombre de chansons</label>
 | 
				
			||||||
 | 
					                        <div class="control">
 | 
				
			||||||
 | 
					                            <input type="number" name="numSongs" class="input" placeholder="Nombre de chansons">
 | 
				
			||||||
 | 
					                        </div>
 | 
				
			||||||
 | 
					                    </div>
 | 
				
			||||||
 | 
					                    <div class="field">
 | 
				
			||||||
 | 
					                        <label class="label">Artiste</label>
 | 
				
			||||||
 | 
					                        <div class="control">
 | 
				
			||||||
 | 
					                            <div class="select">
 | 
				
			||||||
 | 
					                                <select name="artist">
 | 
				
			||||||
 | 
					                                    <option value="">Tous</option>
 | 
				
			||||||
 | 
					                                    <?php foreach($artists as $artist): ?>
 | 
				
			||||||
 | 
					                                        <option value="<?= $artist->name ?>"><?= $artist->name ?></option>
 | 
				
			||||||
 | 
					                                    <?php endforeach; ?>
 | 
				
			||||||
 | 
					                                </select>
 | 
				
			||||||
 | 
					                            </div>
 | 
				
			||||||
 | 
					                        </div>
 | 
				
			||||||
 | 
					                    </div>
 | 
				
			||||||
 | 
					                    <div class="field">
 | 
				
			||||||
 | 
					                        <label class="label">Genre</label>
 | 
				
			||||||
 | 
					                        <div class="control">
 | 
				
			||||||
 | 
					                            <div class="select">
 | 
				
			||||||
 | 
					                                <select name="genre">
 | 
				
			||||||
 | 
					                                    <option value="">Tous</option>
 | 
				
			||||||
 | 
					                                    <?php foreach($genres as $genre): ?>
 | 
				
			||||||
 | 
					                                        <option value="<?= $genre->name ?>"><?= $genre->name ?></option>
 | 
				
			||||||
 | 
					                                    <?php endforeach; ?>
 | 
				
			||||||
 | 
					                                </select>
 | 
				
			||||||
 | 
					                            </div>
 | 
				
			||||||
 | 
					                        </div>
 | 
				
			||||||
 | 
					                    </div>
 | 
				
			||||||
 | 
					                </div>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                <div class="field">
 | 
				
			||||||
 | 
					                    <div class="control">
 | 
				
			||||||
 | 
					                        <button type="submit" class="button is-link">Créer une playlist</button>
 | 
				
			||||||
 | 
					                    </div>
 | 
				
			||||||
 | 
					                </div>
 | 
				
			||||||
 | 
					            </form>
 | 
				
			||||||
 | 
					        </div>
 | 
				
			||||||
 | 
					    </div>
 | 
				
			||||||
 | 
					</section>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					<!-- Rename Modal -->
 | 
				
			||||||
 | 
					<div id="renameModal" class="modal">
 | 
				
			||||||
 | 
					    <div class="modal-background"></div>
 | 
				
			||||||
 | 
					    <div class="modal-card">
 | 
				
			||||||
 | 
					        <header class="modal-card-head">
 | 
				
			||||||
 | 
					            <p class="modal-card-title">Renommer la Playlist</p>
 | 
				
			||||||
 | 
					            <button class="delete" aria-label="close" onclick="closeRenameModal()"></button>
 | 
				
			||||||
 | 
					        </header>
 | 
				
			||||||
 | 
					        <section class="modal-card-body">
 | 
				
			||||||
 | 
					            <form id="renameForm" method="post" action="<?= site_url('playlist/rename') ?>">
 | 
				
			||||||
 | 
					                <div class="field">
 | 
				
			||||||
 | 
					                    <label class="label">Nouveau Nom</label>
 | 
				
			||||||
 | 
					                    <div class="control">
 | 
				
			||||||
 | 
					                        <input type="hidden" name="playlistId" id="renamePlaylistId">
 | 
				
			||||||
 | 
					                        <input type="text" name="newName" class="input" id="renameNewName" required>
 | 
				
			||||||
 | 
					                    </div>
 | 
				
			||||||
 | 
					                </div>
 | 
				
			||||||
 | 
					                <div class="field">
 | 
				
			||||||
 | 
					                    <div class="control">
 | 
				
			||||||
 | 
					                        <button type="submit" class="button is-link">Renommer</button>
 | 
				
			||||||
 | 
					                    </div>
 | 
				
			||||||
 | 
					                </div>
 | 
				
			||||||
 | 
					            </form>
 | 
				
			||||||
 | 
					        </section>
 | 
				
			||||||
 | 
					    </div>
 | 
				
			||||||
 | 
					</div>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					<script>
 | 
				
			||||||
 | 
					    function toggleRandomOptions() {
 | 
				
			||||||
 | 
					        var playlistType = document.getElementById('playlistType').value;
 | 
				
			||||||
 | 
					        var randomOptions = document.getElementById('randomOptions');
 | 
				
			||||||
 | 
					        if (playlistType === 'random') {
 | 
				
			||||||
 | 
					            randomOptions.style.display = 'block';
 | 
				
			||||||
 | 
					        } else {
 | 
				
			||||||
 | 
					            randomOptions.style.display = 'none';
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    function showRenameModal(playlistId, playlistName) {
 | 
				
			||||||
 | 
					        document.getElementById('renamePlaylistId').value = playlistId;
 | 
				
			||||||
 | 
					        document.getElementById('renameNewName').value = playlistName;
 | 
				
			||||||
 | 
					        document.getElementById('renameModal').classList.add('is-active');
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    function closeRenameModal() {
 | 
				
			||||||
 | 
					        document.getElementById('renameModal').classList.remove('is-active');
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					</script>
 | 
				
			||||||
							
								
								
									
										31
									
								
								application/views/select_playlist.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										31
									
								
								application/views/select_playlist.php
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,31 @@
 | 
				
			|||||||
 | 
					<section class="section">
 | 
				
			||||||
 | 
					    <div class="container">
 | 
				
			||||||
 | 
					        <h1 class="title is-4">Sélectionner une playlist</h1>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        <?php if ($playlists): ?>
 | 
				
			||||||
 | 
					            <form method="post" action="<?= site_url('playlist/addItems') ?>">
 | 
				
			||||||
 | 
					                <input type="hidden" name="itemId" value="<?= $itemId ?>">
 | 
				
			||||||
 | 
					                <input type="hidden" name="itemType" value="<?= $itemType ?>">
 | 
				
			||||||
 | 
					                <div class="field">
 | 
				
			||||||
 | 
					                    <label class="label">Choisir une playlist</label>
 | 
				
			||||||
 | 
					                    <div class="control">
 | 
				
			||||||
 | 
					                        <div class="select is-dark">
 | 
				
			||||||
 | 
					                            <select name="playlistId">
 | 
				
			||||||
 | 
					                                <?php foreach ($playlists as $playlist): ?>
 | 
				
			||||||
 | 
					                                    <option value="<?= $playlist->id ?>"><?= $playlist->name ?></option>
 | 
				
			||||||
 | 
					                                <?php endforeach; ?>
 | 
				
			||||||
 | 
					                            </select>
 | 
				
			||||||
 | 
					                        </div>
 | 
				
			||||||
 | 
					                    </div>
 | 
				
			||||||
 | 
					                </div>
 | 
				
			||||||
 | 
					                <div class="field">
 | 
				
			||||||
 | 
					                    <div class="control">
 | 
				
			||||||
 | 
					                        <button type="submit" class="button is-link">Ajouter</button>
 | 
				
			||||||
 | 
					                    </div>
 | 
				
			||||||
 | 
					                </div>
 | 
				
			||||||
 | 
					            </form>
 | 
				
			||||||
 | 
					        <?php else: ?>
 | 
				
			||||||
 | 
					            <p>Vous n'avez pas encore de playlists. Veuillez en créer une.</p>
 | 
				
			||||||
 | 
					        <?php endif; ?>
 | 
				
			||||||
 | 
					    </div>
 | 
				
			||||||
 | 
					</section>
 | 
				
			||||||
@@ -1,14 +1,28 @@
 | 
				
			|||||||
<!DOCTYPE html>
 | 
					<!DOCTYPE html>
 | 
				
			||||||
<html>
 | 
					<html>
 | 
				
			||||||
<head>
 | 
					 | 
				
			||||||
    <title><?= $song['songName'] ?> - Details</title>
 | 
					 | 
				
			||||||
</head>
 | 
					 | 
				
			||||||
<body>
 | 
					<body>
 | 
				
			||||||
    <h1><?= $song['songName'] ?></h1>
 | 
					    <section class="section">
 | 
				
			||||||
    <p><strong>Album:</strong> <?= anchor("music/view/{$song['albumId']}", $song['albumName']) ?> (<?= $song['year'] ?>)</p>
 | 
					        <div class="container">
 | 
				
			||||||
    <p><strong>Artist:</strong> <?= $song['artistName'] ?></p>
 | 
					            <h1 class="title"><?= $song['songName'] ?></h1>
 | 
				
			||||||
 | 
					            <div class="columns">
 | 
				
			||||||
 | 
					                <div class="column is-one-third">
 | 
				
			||||||
 | 
					                    <figure class="image">
 | 
				
			||||||
                        <?php if(isset($song['jpeg']) && $song['jpeg'] != ''): ?>
 | 
					                        <?php if(isset($song['jpeg']) && $song['jpeg'] != ''): ?>
 | 
				
			||||||
                            <img src="data:image/jpeg;base64,<?= base64_encode($song['jpeg']) ?>" alt="<?= $song['albumName'] ?> Cover">
 | 
					                            <img src="data:image/jpeg;base64,<?= base64_encode($song['jpeg']) ?>" alt="<?= $song['albumName'] ?> Cover">
 | 
				
			||||||
 | 
					                        <?php else: ?>
 | 
				
			||||||
 | 
					                            <img src="path_to_default_image" alt="Default Cover">
 | 
				
			||||||
                        <?php endif; ?>
 | 
					                        <?php endif; ?>
 | 
				
			||||||
 | 
					                    </figure>
 | 
				
			||||||
 | 
					                </div>
 | 
				
			||||||
 | 
					                <div class="column">
 | 
				
			||||||
 | 
					                    <p><strong>Album:</strong> <?= anchor("albums/view/{$song['albumId']}", $song['albumName']) ?> (<?= $song['year'] ?>)</p>
 | 
				
			||||||
 | 
					                    <p><strong>Artist:</strong> <?= $song['artistName'] ?></p>
 | 
				
			||||||
 | 
					                    <p><strong>Disk Number:</strong> <?= $song['diskNumber'] ?></p>
 | 
				
			||||||
 | 
					                    <p><strong>Track Number:</strong> <?= $song['number'] ?></p>
 | 
				
			||||||
 | 
					                    <p><strong>Duration:</strong> <?= $song['duration'] ?> seconds</p>
 | 
				
			||||||
 | 
					                </div>
 | 
				
			||||||
 | 
					            </div>
 | 
				
			||||||
 | 
					        </div>
 | 
				
			||||||
 | 
					    </section>
 | 
				
			||||||
</body>
 | 
					</body>
 | 
				
			||||||
</html>
 | 
					</html>
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										0
									
								
								assets/common.css
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										0
									
								
								assets/common.css
									
									
									
									
									
										Normal file
									
								
							
							
								
								
									
										
											BIN
										
									
								
								assets/logo.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								assets/logo.png
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							| 
		 After Width: | Height: | Size: 61 KiB  | 
@@ -1,20 +1,38 @@
 | 
				
			|||||||
section.list
 | 
					/* style.css */
 | 
				
			||||||
{
 | 
					 | 
				
			||||||
	display : flex;
 | 
					 | 
				
			||||||
	justify-content : space-between;
 | 
					 | 
				
			||||||
	flex-wrap:wrap;
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
section.list > div 
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
width : 30%;
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
section.list img {
 | 
					 | 
				
			||||||
	display:inline-block;
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					.card {
 | 
				
			||||||
 | 
					    display: flex;
 | 
				
			||||||
 | 
					    flex-direction: column;
 | 
				
			||||||
 | 
					    height: 100%;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
.short-text {
 | 
					
 | 
				
			||||||
 | 
					.card-image {
 | 
				
			||||||
 | 
					    flex-shrink: 0;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					.card-content {
 | 
				
			||||||
 | 
					    flex-grow: 1;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					.card-footer {
 | 
				
			||||||
 | 
					    flex-shrink: 0;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					.album-title, .artist-title, .music-title {
 | 
				
			||||||
 | 
					    display: -webkit-box;
 | 
				
			||||||
 | 
					    -webkit-box-orient: vertical;
 | 
				
			||||||
 | 
					    -webkit-line-clamp: 2; /* Limite à 2 lignes */
 | 
				
			||||||
    overflow: hidden;
 | 
					    overflow: hidden;
 | 
				
			||||||
	white-space: nowrap;
 | 
					 | 
				
			||||||
    text-overflow: ellipsis;
 | 
					    text-overflow: ellipsis;
 | 
				
			||||||
 | 
					    height: 3em; /* Ajuste en fonction de la taille de la police */
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					.columns {
 | 
				
			||||||
 | 
					    justify-content: center; /* Centre les colonnes */
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					.card img {
 | 
				
			||||||
 | 
					    object-fit: cover; /* Assure que les images couvrent bien les figures */
 | 
				
			||||||
 | 
					    width: 100%;
 | 
				
			||||||
 | 
					    height: auto;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user