ajout connexion,ajout playlist, ajout chanson dans playlist, ajout filtre et tri pour chanson et album
This commit is contained in:
@@ -58,7 +58,7 @@ $autoload['packages'] = array();
|
||||
|
|
||||
| $autoload['libraries'] = array('user_agent' => 'ua');
|
||||
*/
|
||||
$autoload['libraries'] = array();
|
||||
$autoload['libraries'] = array('session');
|
||||
|
||||
/*
|
||||
| -------------------------------------------------------------------
|
||||
@@ -89,7 +89,7 @@ $autoload['drivers'] = array();
|
||||
|
|
||||
| $autoload['helper'] = array('url', 'file');
|
||||
*/
|
||||
$autoload['helper'] = array('url');
|
||||
$autoload['helper'] = array('url', 'form', 'html');
|
||||
|
||||
/*
|
||||
| -------------------------------------------------------------------
|
||||
|
||||
@@ -383,14 +383,14 @@ $config['encryption_key'] = '';
|
||||
| except for 'cookie_prefix' and 'cookie_httponly', which are ignored here.
|
||||
|
|
||||
*/
|
||||
$config['sess_driver'] = 'files';
|
||||
$config['sess_driver'] = 'database';
|
||||
$config['sess_cookie_name'] = 'ci_session';
|
||||
$config['sess_samesite'] = 'Lax';
|
||||
$config['sess_expiration'] = 7200;
|
||||
$config['sess_save_path'] = NULL;
|
||||
$config['sess_save_path'] = 'sessions';
|
||||
$config['sess_match_ip'] = FALSE;
|
||||
$config['sess_time_to_update'] = 300;
|
||||
$config['sess_regenerate_destroy'] = FALSE;
|
||||
$config['sess_regenerate_destroy'] = TRUE;
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
|
||||
@@ -6,23 +6,35 @@ class Albums extends CI_Controller {
|
||||
public function __construct(){
|
||||
parent::__construct();
|
||||
$this->load->model('model_music');
|
||||
$this->load->helper('html');
|
||||
$this->load->helper('url');
|
||||
}
|
||||
public function index(){
|
||||
$genre = $this->input->get('genre');
|
||||
$artist = $this->input->get('artist');
|
||||
$year = $this->input->get('year');
|
||||
$sort = $this->input->get('sort');
|
||||
$order = $this->input->get('order');
|
||||
|
||||
if ($recherche=filter_input(INPUT_GET,'recherche') == false or $recherche=filter_input(INPUT_GET,'recherche') == null){
|
||||
$albums = $this->model_music->getAlbums();
|
||||
$albums = $this->model_music->get_filtered_albums($genre, $artist, $year, $sort, $order);
|
||||
$data['albums'] = $albums;
|
||||
}else{
|
||||
$recherche=filter_input(INPUT_GET,'recherche');
|
||||
$albums = $this->model_music->getSearchAlbums($recherche);
|
||||
$data['albums'] = $albums;
|
||||
}
|
||||
$this->load->view('layout/header');
|
||||
if ($albums == false){
|
||||
//$page = preg_split('/[\/]/',$_SERVER['HTTP_REFERER']);
|
||||
//$this->load->view('error',['page'=>$page[count($page)-1]]);
|
||||
$albums = $this->model_music->getAlbums();
|
||||
$page = preg_split('/[\/]/',$_SERVER['REQUEST_URI']);
|
||||
$this->load->view('error',['page'=>$page[count($page)-1]]);
|
||||
$albums = $this->model_music->get_filtered_albums($genre, $artist, $year, $sort, $order);
|
||||
$data['albums'] = $albums;
|
||||
}
|
||||
$this->load->view('albums_list',['albums'=>$albums]);
|
||||
|
||||
$data['genres'] = $this->model_music->get_all_genres();
|
||||
$data['artists'] = $this->model_music->get_all_artists();
|
||||
$data['years'] = $this->model_music->get_all_years();
|
||||
|
||||
$this->load->view('albums_list',$data);
|
||||
$this->load->view('layout/footer');
|
||||
}
|
||||
|
||||
|
||||
@@ -6,8 +6,6 @@ class Artistes extends CI_Controller {
|
||||
public function __construct(){
|
||||
parent::__construct();
|
||||
$this->load->model('model_music');
|
||||
$this->load->helper('html');
|
||||
$this->load->helper('url');
|
||||
}
|
||||
public function index(){
|
||||
if ($recherche=filter_input(INPUT_GET,'recherche') == false or $recherche=filter_input(INPUT_GET,'recherche') == null){
|
||||
@@ -18,7 +16,7 @@ class Artistes extends CI_Controller {
|
||||
}
|
||||
$this->load->view('layout/header');
|
||||
if ($artistes == false){
|
||||
$page = preg_split('/[\/]/',$_SERVER['HTTP_REFERER']);
|
||||
$page = preg_split('/[\/]/',$_SERVER['REQUEST_URI']);
|
||||
$this->load->view('error',['page'=>$page[count($page)-1]]);
|
||||
$artistes = $this->model_music->getArtistes();
|
||||
}
|
||||
|
||||
@@ -6,25 +6,53 @@ class Chansons extends CI_Controller {
|
||||
public function __construct(){
|
||||
parent::__construct();
|
||||
$this->load->model('model_music');
|
||||
$this->load->helper('html');
|
||||
$this->load->helper('url');
|
||||
$this->load->library('form_validation');
|
||||
}
|
||||
public function index(){
|
||||
$genre = $this->input->get('genre');
|
||||
$artist = $this->input->get('artist');
|
||||
$year = $this->input->get('year');
|
||||
$album = $this->input->get('albums');
|
||||
$sort = $this->input->get('sort');
|
||||
$order = $this->input->get('order');
|
||||
|
||||
if ($recherche=filter_input(INPUT_GET,'recherche') == false or $recherche=filter_input(INPUT_GET,'recherche') == null){
|
||||
$chansons = $this->model_music->getChansons();
|
||||
$chansons = $this->model_music->get_filtered_chansons($genre, $artist, $year, $album, $sort, $order);
|
||||
$data['chansons'] = $chansons;
|
||||
}else{
|
||||
$recherche=filter_input(INPUT_GET,'recherche');
|
||||
$chansons = $this->model_music->getSearchChansons($recherche);
|
||||
$data['chansons'] = $chansons;
|
||||
}
|
||||
$this->load->view('layout/header');
|
||||
if ($chansons == false){
|
||||
$page = preg_split('/[\/]/',$_SERVER['HTTP_REFERER']);
|
||||
$page = preg_split('/[\/]/',$_SERVER['REQUEST_URI']);
|
||||
$this->load->view('error',['page'=>$page[count($page)-1]]);
|
||||
$chansons = $this->model_music->getChansons();
|
||||
$chansons = $this->model_music->get_filtered_chansons($genre, $artist, $year, $album, $sort, $order);
|
||||
$data['chansons'] = $chansons;
|
||||
}
|
||||
$this->load->view('chansons_list',['chansons'=>$chansons]);
|
||||
$data['genres'] = $this->model_music->get_all_genres_chansons();
|
||||
$data['artists'] = $this->model_music->get_all_artists_chansons();
|
||||
$data['years'] = $this->model_music->get_all_years_chansons();
|
||||
$data['albums'] = $this->model_music->get_all_albums_chansons();
|
||||
|
||||
$this->load->view('chansons_list',$data);
|
||||
$this->load->view('layout/footer');
|
||||
}
|
||||
|
||||
public function addSongtoPlaylist($id){
|
||||
$playlists = $this->model_music->getPlaylist();
|
||||
|
||||
$this->form_validation->set_rules('playlist_id', 'playlist_id', 'required');
|
||||
|
||||
if ($this->form_validation->run() == FALSE){
|
||||
$this->load->view('layout/header');
|
||||
$this->load->view('addSongtoplaylist', ["playlists" => $playlists]);
|
||||
$this->load->view('layout/footer');
|
||||
}else{
|
||||
$playlistId = $this->input->post('playlist_id');
|
||||
$this->model_music->AddSongtoPlaylist($playlistId,$id);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
51
CodeIgniter-3.1.13/application/controllers/Playlist.php
Normal file
51
CodeIgniter-3.1.13/application/controllers/Playlist.php
Normal file
@@ -0,0 +1,51 @@
|
||||
<?php
|
||||
defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
|
||||
class Playlist extends CI_Controller {
|
||||
|
||||
public function __construct(){
|
||||
parent::__construct();
|
||||
$this->load->model('model_music');
|
||||
$this->load->library('form_validation');
|
||||
}
|
||||
public function index(){
|
||||
if ($recherche=filter_input(INPUT_GET,'recherche') == false or $recherche=filter_input(INPUT_GET,'recherche') == null){
|
||||
$playlists = $this->model_music->getPlaylist();
|
||||
}else{
|
||||
$recherche=filter_input(INPUT_GET,'recherche');
|
||||
$playlists = $this->model_music->getSearchPlaylist($recherche);
|
||||
}
|
||||
$this->load->view('layout/header');
|
||||
if ($playlists == false){
|
||||
$page = preg_split('/[\/]/',$_SERVER['REQUEST_URI']);
|
||||
$this->load->view('error',['page'=>$page[count($page)-1]]);
|
||||
$playlists = $this->model_music->getPlaylist();
|
||||
}
|
||||
$this->load->view('playlist_list',['playlists'=>$playlists]);
|
||||
$this->load->view('layout/footer');
|
||||
}
|
||||
|
||||
public function addplaylist(){
|
||||
|
||||
|
||||
$this->form_validation->set_rules('name', 'name', 'required');
|
||||
|
||||
if ($this->form_validation->run() == FALSE){
|
||||
$this->load->view('layout/header');
|
||||
$this->load->view('create_playlist');
|
||||
$this->load->view('layout/footer');
|
||||
}else{
|
||||
$nom = $this->input->post('name');
|
||||
$description = $this->input->post('Description');
|
||||
$userId = $this->session->userdata('userId');
|
||||
$playlist = array(
|
||||
'name'=>$nom,
|
||||
'description'=>$description,
|
||||
'userId'=>$userId,
|
||||
);
|
||||
$this->model_music->addPlayliste($playlist);
|
||||
redirect('playlist');
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
76
CodeIgniter-3.1.13/application/controllers/User.php
Normal file
76
CodeIgniter-3.1.13/application/controllers/User.php
Normal file
@@ -0,0 +1,76 @@
|
||||
<?php
|
||||
defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
|
||||
class User extends CI_Controller {
|
||||
|
||||
public function __construct(){
|
||||
parent::__construct();
|
||||
$this->load->model('model_music');
|
||||
}
|
||||
|
||||
public function create(){
|
||||
$this->load->library('form_validation');
|
||||
|
||||
$this->form_validation->set_rules('nom', 'Nom', 'required');
|
||||
$this->form_validation->set_rules('prenom', 'Prénom', 'required');
|
||||
$this->form_validation->set_rules('email', 'Adresse mail', 'valid_email');
|
||||
$this->form_validation->set_rules('password', 'current password', 'min_length[5]|required');
|
||||
$this->form_validation->set_rules('cpassword', 'confirm password', 'required|matches[password]');
|
||||
|
||||
if ($this->form_validation->run() == FALSE){
|
||||
$this->load->view('layout/header');
|
||||
$this->load->view('create_user');
|
||||
$this->load->view('layout/footer');
|
||||
}else{
|
||||
|
||||
$user=array(
|
||||
"usernom" => $this->input->post("nom"),
|
||||
"userprenom" => $this->input->post("prenom"),
|
||||
"usermail" => $this->input->post("email"),
|
||||
"userpassword" => password_hash(($this->input->post("password")), PASSWORD_DEFAULT),
|
||||
);
|
||||
|
||||
$this->model_music->create_user($user);
|
||||
redirect("user/auth");
|
||||
}
|
||||
}
|
||||
|
||||
public function auth()
|
||||
{
|
||||
$this->load->library('form_validation');
|
||||
|
||||
$this->form_validation->set_rules('email', 'Adresse mail', 'valid_email');
|
||||
$this->form_validation->set_rules('password', 'current password', 'min_length[5]|required');
|
||||
|
||||
if ($this->form_validation->run() == FALSE){
|
||||
$this->load->view('layout/header');
|
||||
$this->load->view('connexion_user');
|
||||
$this->load->view('layout/footer');
|
||||
}else{
|
||||
$email = $this->input->post('email');
|
||||
$MDP = $this->input->post('password');
|
||||
|
||||
$dataUtilisateur = $this->model_music->get_user_by_email($email);
|
||||
|
||||
if(password_verify($MDP, $dataUtilisateur->userpassword)){
|
||||
$dataUser = array(
|
||||
"userId" => $dataUtilisateur->userId,
|
||||
"userprenom" => $dataUtilisateur->userprenom,
|
||||
"usermail" => $dataUtilisateur->usermail,
|
||||
"userpassword" => $dataUtilisateur->userpassword,
|
||||
"logged_in" => TRUE
|
||||
);
|
||||
$this->session->set_userdata($dataUser);
|
||||
redirect("albums");
|
||||
}else{
|
||||
redirect("user/create");
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public function logout(){
|
||||
$this->session->sess_destroy();
|
||||
redirect("albums");
|
||||
}
|
||||
}
|
||||
@@ -4,19 +4,54 @@ class Model_music extends CI_Model {
|
||||
public function __construct(){
|
||||
$this->load->database();
|
||||
}
|
||||
|
||||
public function get_filtered_albums($genre = [], $artist = [], $year = [], $sort = null, $order = null) {
|
||||
$this->db->select('album.name,album.id as albumId,year,artist.name as artistName, genre.name as genreName,jpeg ');
|
||||
$this->db->from('album');
|
||||
$this->db->join('genre', 'album.genreId = genre.Id');
|
||||
$this->db->join('artist', 'album.artistId = artist.Id');
|
||||
$this->db->join('cover', 'album.coverId = cover.Id');
|
||||
|
||||
public function getAlbums(){
|
||||
$query = $this->db->query(
|
||||
"SELECT album.name,album.id as albumId,year,artist.name as artistName, genre.name as genreName,jpeg
|
||||
FROM album
|
||||
JOIN artist ON album.artistid = artist.id
|
||||
JOIN genre ON genre.id = album.genreid
|
||||
JOIN cover ON cover.id = album.coverid
|
||||
ORDER BY year
|
||||
"
|
||||
);
|
||||
return $query->result();
|
||||
}
|
||||
if (!empty($genre)) {
|
||||
$this->db->where_in('genre.name', $genre);
|
||||
}
|
||||
if (!empty($artist)) {
|
||||
$this->db->where_in('artist.name', $artist);
|
||||
}
|
||||
if (!empty($year)) {
|
||||
$this->db->where_in('album.year', $year);
|
||||
}
|
||||
if ($sort && in_array($sort, ['year', 'artistName', 'name', 'genreName'])) {
|
||||
$this->db->order_by($sort, $order);
|
||||
}
|
||||
$query = $this->db->get();
|
||||
return $query->result();
|
||||
}
|
||||
|
||||
public function get_all_genres() {
|
||||
$this->db->distinct();
|
||||
$this->db->select('genreId,genre.name as genreName');
|
||||
$this->db->from('album');
|
||||
$this->db->join('genre', 'album.genreId = genre.Id');
|
||||
$query = $this->db->get();
|
||||
return $query->result();
|
||||
}
|
||||
|
||||
public function get_all_artists() {
|
||||
$this->db->distinct();
|
||||
$this->db->select('artistId,artist.name as artistName');
|
||||
$this->db->from('album');
|
||||
$this->db->join('artist', 'album.artistId = artist.Id');
|
||||
$query = $this->db->get();
|
||||
return $query->result();
|
||||
}
|
||||
|
||||
public function get_all_years() {
|
||||
$this->db->distinct();
|
||||
$this->db->select('year');
|
||||
$query = $this->db->get('album');
|
||||
return $query->result();
|
||||
}
|
||||
|
||||
public function getArtistes(){
|
||||
$query = $this->db->query(
|
||||
@@ -28,19 +63,74 @@ class Model_music extends CI_Model {
|
||||
return $query->result();
|
||||
}
|
||||
|
||||
public function getChansons(){
|
||||
$query = $this->db->query(
|
||||
"SELECT song.name,song.id,album.year,album.name as albumName, artist.name as artistName, genre.name as genreName
|
||||
FROM song
|
||||
JOIN track ON track.songId = song.id
|
||||
JOIN album ON album.id = track.albumId
|
||||
JOIN artist ON album.artistid = artist.id
|
||||
JOIN genre ON genre.id = album.genreid
|
||||
ORDER BY album.year
|
||||
"
|
||||
);
|
||||
return $query->result();
|
||||
}
|
||||
public function get_filtered_chansons($genre = [], $artist = [], $year = [], $album = [], $sort = null, $order = null) {
|
||||
$this->db->select('track.id as trackId, song.name,song.id,album.year,album.name as albumName, artist.name as artistName, genre.name as genreName');
|
||||
$this->db->from('song');
|
||||
$this->db->join('track', 'track.songId = song.id');
|
||||
$this->db->join('album', 'album.id = track.albumId');
|
||||
$this->db->join('artist', 'album.artistId = artist.Id');
|
||||
$this->db->join('genre', 'genre.id = album.genreid');
|
||||
|
||||
if (!empty($genre)) {
|
||||
$this->db->where_in('genre.name', $genre);
|
||||
}
|
||||
if (!empty($artist)) {
|
||||
$this->db->where_in('artist.name', $artist);
|
||||
}
|
||||
if (!empty($year)) {
|
||||
$this->db->where_in('album.year', $year);
|
||||
}
|
||||
if (!empty($album)) {
|
||||
$this->db->where_in('album.name', $album);
|
||||
}
|
||||
if ($sort && in_array($sort, ['year', 'artistName', 'name', 'genreName'])) {
|
||||
$this->db->order_by($sort, $order);
|
||||
}
|
||||
$query = $this->db->get();
|
||||
return $query->result();
|
||||
}
|
||||
|
||||
public function get_all_genres_chansons() {
|
||||
$this->db->distinct();
|
||||
$this->db->select('genreId,genre.name as genreName');
|
||||
$this->db->from('song');
|
||||
$this->db->join('track', 'track.songId = song.id');
|
||||
$this->db->join('album', 'album.id = track.albumId');
|
||||
$this->db->join('genre', 'album.genreId = genre.Id');
|
||||
$query = $this->db->get();
|
||||
return $query->result();
|
||||
}
|
||||
|
||||
public function get_all_artists_chansons() {
|
||||
$this->db->distinct();
|
||||
$this->db->select('artistId,artist.name as artistName');
|
||||
$this->db->from('song');
|
||||
$this->db->join('track', 'track.songId = song.id');
|
||||
$this->db->join('album', 'album.id = track.albumId');
|
||||
$this->db->join('artist', 'album.artistId = artist.Id');
|
||||
$query = $this->db->get();
|
||||
return $query->result();
|
||||
}
|
||||
|
||||
public function get_all_years_chansons() {
|
||||
$this->db->distinct();
|
||||
$this->db->select('year');
|
||||
$this->db->from('song');
|
||||
$this->db->join('track', 'track.songId = song.id');
|
||||
$this->db->join('album', 'album.id = track.albumId');
|
||||
$query = $this->db->get();
|
||||
return $query->result();
|
||||
}
|
||||
|
||||
public function get_all_albums_chansons() {
|
||||
$this->db->distinct();
|
||||
$this->db->select('album.Id,album.name as albumName');
|
||||
$this->db->from('song');
|
||||
$this->db->join('track', 'track.songId = song.id');
|
||||
$this->db->join('album', 'album.id = track.albumId');
|
||||
$query = $this->db->get();
|
||||
return $query->result();
|
||||
}
|
||||
|
||||
public function getSearchAlbums($nom){
|
||||
$query = $this->db->query(
|
||||
@@ -75,7 +165,7 @@ class Model_music extends CI_Model {
|
||||
|
||||
public function getSearchChansons($nom){
|
||||
$query = $this->db->query(
|
||||
"SELECT song.name,song.id,album.year,album.name as albumName, artist.name as artistName, genre.name as genreName
|
||||
"SELECT track.id as trackId,song.name,song.id,album.year,album.name as albumName, artist.name as artistName, genre.name as genreName
|
||||
FROM song
|
||||
JOIN track ON track.songId = song.id
|
||||
JOIN album ON album.id = track.albumId
|
||||
@@ -157,4 +247,54 @@ class Model_music extends CI_Model {
|
||||
);
|
||||
return $query->result();
|
||||
}
|
||||
|
||||
public function create_user($user){
|
||||
$this->db->insert("User",$user);
|
||||
return $this->db->insert_id();
|
||||
}
|
||||
|
||||
public function get_user_by_email($email){
|
||||
$this->db->select("userId,usernom,userprenom,usermail,userpassword");
|
||||
$this->db->from("User");
|
||||
$this->db->where("usermail",$email);
|
||||
|
||||
$query = $this->db->get();
|
||||
return $query->row();
|
||||
}
|
||||
|
||||
public function getPlaylist(){
|
||||
$query = $this->db->query(
|
||||
"SELECT Playlist.name, Playlist.playlistid
|
||||
FROM Playlist
|
||||
ORDER BY Playlist.name
|
||||
"
|
||||
);
|
||||
return $query->result();
|
||||
}
|
||||
|
||||
public function getSearchPlaylist($nom){
|
||||
$query = $this->db->query(
|
||||
"SELECT Playlist.name, Playlist.playlistid
|
||||
FROM Playlist
|
||||
WHERE Playlist.name LIKE '$nom'
|
||||
"
|
||||
);
|
||||
$query->result();
|
||||
if ($query->num_rows() > 0){
|
||||
return $query->result();
|
||||
}
|
||||
return $query = false;
|
||||
}
|
||||
|
||||
public function addPlayliste($playlist){
|
||||
$this->db->insert("Playlist",$playlist);
|
||||
return $this->db->insert_id();
|
||||
}
|
||||
|
||||
public function AddSongtoPlaylist($idplaylist, $trackId){
|
||||
$tupple = array(
|
||||
"playlistId"=> $idplaylist,
|
||||
"trackId"=> $trackId);
|
||||
$this->db->insert("PlaylistSong",$tupple);
|
||||
}
|
||||
}
|
||||
|
||||
25
CodeIgniter-3.1.13/application/views/addSongtoplaylist.php
Normal file
25
CodeIgniter-3.1.13/application/views/addSongtoplaylist.php
Normal file
@@ -0,0 +1,25 @@
|
||||
<title>Ajouter une chanson à une playlist</title>
|
||||
|
||||
<div class="trie">
|
||||
<h5>Playlists</h5>
|
||||
</div>
|
||||
|
||||
<section class="list">
|
||||
|
||||
<form method="post">
|
||||
<?php foreach ($playlists as $playlist): ?>
|
||||
<div class="playlist-option">
|
||||
<label>
|
||||
<input type="radio" name="playlist_id" value="<?= $playlist->playlistid ?>">
|
||||
<?= htmlspecialchars($playlist->name) ?>
|
||||
</label>
|
||||
</div>
|
||||
<?php endforeach; ?>
|
||||
<div class="submit-button">
|
||||
<button type="submit" class="btn btn-primary">Ajouter à la playlist</button>
|
||||
</div>
|
||||
</form>
|
||||
</section>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,3 +1,134 @@
|
||||
<style>
|
||||
.filter-options {
|
||||
display: none;
|
||||
margin-top: 10px;
|
||||
}
|
||||
.filter-buttons {
|
||||
display: none;
|
||||
}
|
||||
.filter-buttons.show {
|
||||
display: inline-block;
|
||||
}
|
||||
.filter-checkboxes {
|
||||
display: none;
|
||||
}
|
||||
.filter-checkboxes.show {
|
||||
display: block;
|
||||
}
|
||||
.sort-buttons {
|
||||
display: none;
|
||||
}
|
||||
.show-buttons .sort-buttons {
|
||||
display: block; / Afficher les boutons de tri lorsque la classe show-buttons est appliquée */
|
||||
}
|
||||
</style>
|
||||
<script>
|
||||
var filterOptionsVisible = false;
|
||||
|
||||
function toggleFilterOptions() {
|
||||
var filterOptions = document.getElementById('filter-options');
|
||||
var filterButtons = document.getElementById('filter-buttons');
|
||||
|
||||
if (!filterOptionsVisible) {
|
||||
filterOptions.style.display = 'block';
|
||||
filterButtons.classList.add('show');
|
||||
filterOptionsVisible = true;
|
||||
} else {
|
||||
filterOptions.style.display = 'none';
|
||||
filterButtons.classList.remove('show');
|
||||
hideCheckboxes();
|
||||
filterOptionsVisible = false;
|
||||
}
|
||||
}
|
||||
|
||||
function toggleCheckboxes(filterType) {
|
||||
var checkboxes = document.getElementById(filterType + '-checkboxes');
|
||||
if (checkboxes.style.display === 'none' || checkboxes.style.display === '') {
|
||||
checkboxes.style.display = 'block';
|
||||
} else {
|
||||
checkboxes.style.display = 'none';
|
||||
}
|
||||
}
|
||||
|
||||
function hideCheckboxes() {
|
||||
var checkboxes = document.querySelectorAll('.filter-checkboxes');
|
||||
checkboxes.forEach(function(checkbox) {
|
||||
checkbox.classList.remove('show');
|
||||
});
|
||||
}
|
||||
|
||||
function toggleSortButtons() {
|
||||
var sortButtons = document.getElementById('sort-buttons');
|
||||
if (sortButtons.style.display === 'none' || sortButtons.style.display === '') {
|
||||
sortButtons.style.display = 'block';
|
||||
} else {
|
||||
sortButtons.style.display = 'none';
|
||||
}
|
||||
}
|
||||
|
||||
function sortAlbums(column, order) {
|
||||
var url = "<?= site_url('albums/index'); ?>";
|
||||
url += "?sort=" + column + "&order=" + order;
|
||||
window.location.href = url;
|
||||
}
|
||||
</script>
|
||||
|
||||
<h5>Filter Albums</h5>
|
||||
<button type="button" onclick="toggleFilterOptions()">Filter</button>
|
||||
|
||||
<div id="filter-options" class="filter-options">
|
||||
<form method="get">
|
||||
<div id="filter-buttons" class="filter-buttons">
|
||||
<button type="button" onclick="toggleCheckboxes('genre')">Genres</button>
|
||||
<button type="button" onclick="toggleCheckboxes('artist')">Artists</button>
|
||||
<button type="button" onclick="toggleCheckboxes('year')">Years</button>
|
||||
</div>
|
||||
|
||||
<div id="genre-checkboxes" style="display:none;">
|
||||
<?php foreach ($genres as $genre): ?>
|
||||
<label>
|
||||
<input type="checkbox" name="genre[]" value="<?= $genre->genreName; ?>">
|
||||
<?= $genre->genreName; ?>
|
||||
</label><br>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
|
||||
<div id="artist-checkboxes" style="display:none;">
|
||||
<?php foreach ($artists as $artist): ?>
|
||||
<label>
|
||||
<input type="checkbox" name="artist[]" value="<?= $artist->artistName; ?>">
|
||||
<?= $artist->artistName; ?>
|
||||
</label><br>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
|
||||
<div id="year-checkboxes" style="display:none;">
|
||||
<?php foreach ($years as $year): ?>
|
||||
<label>
|
||||
<input type="checkbox" name="year[]" value="<?= $year->year; ?>">
|
||||
<?= $year->year; ?>
|
||||
</label><br>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
|
||||
<button type="submit">Apply Filters</button>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<h5>Sort Albums</h5>
|
||||
<button type="button" onclick="toggleSortButtons()">Sort</button>
|
||||
<div id="sort-buttons" class="sort-buttons">
|
||||
<button onclick="sortAlbums('year', 'asc')">Sort by Year Asc</button>
|
||||
<button onclick="sortAlbums('year', 'desc')">Sort by Year Desc</button>
|
||||
<button onclick="sortAlbums('artistName', 'asc')">Sort by Artist Asc</button>
|
||||
<button onclick="sortAlbums('artistName', 'desc')">Sort by Artist Desc</button>
|
||||
<button onclick="sortAlbums('name', 'asc')">Sort by Album Name Asc</button>
|
||||
<button onclick="sortAlbums('name', 'desc')">Sort by Album Name Desc</button>
|
||||
<button onclick="sortAlbums('genreName', 'asc')">Sort by Genre Asc</button>
|
||||
<button onclick="sortAlbums('genreName', 'desc')">Sort by Genre Desc</button>
|
||||
</div>
|
||||
|
||||
|
||||
<h5>Albums list</h5>
|
||||
<section class="list">
|
||||
<?php
|
||||
|
||||
@@ -1,14 +1,155 @@
|
||||
<style>
|
||||
.filter-options {
|
||||
display: none;
|
||||
margin-top: 10px;
|
||||
}
|
||||
.filter-buttons {
|
||||
display: none;
|
||||
}
|
||||
.filter-buttons.show {
|
||||
display: inline-block;
|
||||
}
|
||||
.filter-checkboxes {
|
||||
display: none;
|
||||
}
|
||||
.filter-checkboxes.show {
|
||||
display: block;
|
||||
}
|
||||
.sort-buttons {
|
||||
display: none;
|
||||
}
|
||||
.show-buttons .sort-buttons {
|
||||
display: block; / Afficher les boutons de tri lorsque la classe show-buttons est appliquée */
|
||||
}
|
||||
</style>
|
||||
<script>
|
||||
var filterOptionsVisible = false;
|
||||
|
||||
function toggleFilterOptions() {
|
||||
var filterOptions = document.getElementById('filter-options');
|
||||
var filterButtons = document.getElementById('filter-buttons');
|
||||
|
||||
if (!filterOptionsVisible) {
|
||||
filterOptions.style.display = 'block';
|
||||
filterButtons.classList.add('show');
|
||||
filterOptionsVisible = true;
|
||||
} else {
|
||||
filterOptions.style.display = 'none';
|
||||
filterButtons.classList.remove('show');
|
||||
hideCheckboxes();
|
||||
filterOptionsVisible = false;
|
||||
}
|
||||
}
|
||||
|
||||
function toggleCheckboxes(filterType) {
|
||||
var checkboxes = document.getElementById(filterType + '-checkboxes');
|
||||
if (checkboxes.style.display === 'none' || checkboxes.style.display === '') {
|
||||
checkboxes.style.display = 'block';
|
||||
} else {
|
||||
checkboxes.style.display = 'none';
|
||||
}
|
||||
}
|
||||
|
||||
function hideCheckboxes() {
|
||||
var checkboxes = document.querySelectorAll('.filter-checkboxes');
|
||||
checkboxes.forEach(function(checkbox) {
|
||||
checkbox.classList.remove('show');
|
||||
});
|
||||
}
|
||||
|
||||
function toggleSortButtons() {
|
||||
var sortButtons = document.getElementById('sort-buttons');
|
||||
if (sortButtons.style.display === 'none' || sortButtons.style.display === '') {
|
||||
sortButtons.style.display = 'block';
|
||||
} else {
|
||||
sortButtons.style.display = 'none';
|
||||
}
|
||||
}
|
||||
|
||||
function sortAlbums(column, order) {
|
||||
var url = "<?= site_url('albums/index'); ?>";
|
||||
url += "?sort=" + column + "&order=" + order;
|
||||
window.location.href = url;
|
||||
}
|
||||
</script>
|
||||
|
||||
<h5>Filter Chansons</h5>
|
||||
<button type="button" onclick="toggleFilterOptions()">Filter</button>
|
||||
|
||||
<div id="filter-options" class="filter-options">
|
||||
<form method="get">
|
||||
<div id="filter-buttons" class="filter-buttons">
|
||||
<button type="button" onclick="toggleCheckboxes('genre')">Genres</button>
|
||||
<button type="button" onclick="toggleCheckboxes('artist')">Artists</button>
|
||||
<button type="button" onclick="toggleCheckboxes('year')">Years</button>
|
||||
<button type="button" onclick="toggleCheckboxes('album')">Albums</button>
|
||||
</div>
|
||||
|
||||
<div id="genre-checkboxes" style="display:none;">
|
||||
<?php foreach ($genres as $genre): ?>
|
||||
<label>
|
||||
<input type="checkbox" name="genre[]" value="<?= $genre->genreName; ?>">
|
||||
<?= $genre->genreName; ?>
|
||||
</label><br>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
|
||||
<div id="artist-checkboxes" style="display:none;">
|
||||
<?php foreach ($artists as $artist): ?>
|
||||
<label>
|
||||
<input type="checkbox" name="artist[]" value="<?= $artist->artistName; ?>">
|
||||
<?= $artist->artistName; ?>
|
||||
</label><br>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
|
||||
<div id="year-checkboxes" style="display:none;">
|
||||
<?php foreach ($years as $year): ?>
|
||||
<label>
|
||||
<input type="checkbox" name="year[]" value="<?= $year->year; ?>">
|
||||
<?= $year->year; ?>
|
||||
</label><br>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
|
||||
<div id="album-checkboxes" style="display:none;">
|
||||
<?php foreach ($albums as $album): ?>
|
||||
<label>
|
||||
<input type="checkbox" name="albums[]" value="<?= $album->albumName; ?>">
|
||||
<?= $album->albumName; ?>
|
||||
</label><br>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
|
||||
<button type="submit">Apply Filters</button>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<h5>Sort Chansons</h5>
|
||||
<button type="button" onclick="toggleSortButtons()">Sort</button>
|
||||
<div id="sort-buttons" class="sort-buttons">
|
||||
<button onclick="sortAlbums('year', 'asc')">Sort by Year Asc</button>
|
||||
<button onclick="sortAlbums('year', 'desc')">Sort by Year Desc</button>
|
||||
<button onclick="sortAlbums('artistName', 'asc')">Sort by Artist Asc</button>
|
||||
<button onclick="sortAlbums('artistName', 'desc')">Sort by Artist Desc</button>
|
||||
<button onclick="sortAlbums('name', 'asc')">Sort by Album Name Asc</button>
|
||||
<button onclick="sortAlbums('name', 'desc')">Sort by Album Name Desc</button>
|
||||
<button onclick="sortAlbums('genreName', 'asc')">Sort by Genre Asc</button>
|
||||
<button onclick="sortAlbums('genreName', 'desc')">Sort by Genre Desc</button>
|
||||
</div>
|
||||
|
||||
<h5>Chansons list</h5>
|
||||
<section class="list">
|
||||
<?php
|
||||
foreach($chansons as $chansons){
|
||||
foreach($chansons as $chanson){
|
||||
echo "<div><article>";
|
||||
echo "<header class='short-text'>";
|
||||
echo anchor("albums/view/{$chansons->id}","{$chansons->name}");
|
||||
echo anchor("chansons/view/{$chanson->id}","{$chanson->name}");
|
||||
echo anchor("chansons/addSongtoPlaylist/{$chanson->trackId}","<i class='fa fa-plus'></i>");
|
||||
echo "</header>";
|
||||
echo "<nav class='short-text'>Nom album: {$chansons->albumName}</nav>";
|
||||
echo "<nav class='short-text'>Genre: {$chansons->genreName}</nav>";
|
||||
echo "<footer class='short-text'>{$chansons->year} - {$chansons->artistName}</footer>
|
||||
echo "<nav class='short-text'>Nom album: {$chanson->albumName}</nav>";
|
||||
echo "<nav class='short-text'>Genre: {$chanson->genreName}</nav>";
|
||||
echo "<footer class='short-text'>{$chanson->year} - {$chanson->artistName}</footer>
|
||||
</article></div>";
|
||||
}
|
||||
?>
|
||||
|
||||
16
CodeIgniter-3.1.13/application/views/connexion_user.php
Normal file
16
CodeIgniter-3.1.13/application/views/connexion_user.php
Normal file
@@ -0,0 +1,16 @@
|
||||
|
||||
|
||||
<form method="post">
|
||||
<!-- Markup example 2: input is after label -->
|
||||
<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>
|
||||
</div>
|
||||
<!-- Button -->
|
||||
<button type="submit">Submit</button>
|
||||
<?=anchor('user/create','Création de Compte');?>
|
||||
</form>
|
||||
|
||||
14
CodeIgniter-3.1.13/application/views/create_playlist.php
Normal file
14
CodeIgniter-3.1.13/application/views/create_playlist.php
Normal file
@@ -0,0 +1,14 @@
|
||||
|
||||
<form method="post">
|
||||
<!-- Markup example 2: input is after label -->
|
||||
<label for="name">Nom de la playlist</label>
|
||||
<input type="text" id="name" name="name" placeholder="name" required>
|
||||
<div class="grid">
|
||||
<label for="text">Déscription
|
||||
<input type="text" id="Description" name="Description" placeholder="Description" >
|
||||
</label>
|
||||
</div>
|
||||
<!-- Button -->
|
||||
<button type="submit">Submit</button>
|
||||
</form>
|
||||
|
||||
32
CodeIgniter-3.1.13/application/views/create_user.php
Normal file
32
CodeIgniter-3.1.13/application/views/create_user.php
Normal file
@@ -0,0 +1,32 @@
|
||||
|
||||
<form method="post">
|
||||
<!-- Grid -->
|
||||
<div class="grid">
|
||||
|
||||
<!-- Markup example 1: input is inside label -->
|
||||
<label for="prenom">
|
||||
Prénom
|
||||
<input type="text" id="prenom" name="prenom" placeholder="Prénom" value="<?=set_value('prenom')?>"required>
|
||||
</label>
|
||||
|
||||
<label for="nom">
|
||||
Nom
|
||||
<input type="text" id="nom" name="nom" placeholder="nom" value="<?=set_value('nom')?>" required>
|
||||
</label>
|
||||
</div>
|
||||
<!-- Markup example 2: input is after label -->
|
||||
<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="password">Confirmation password
|
||||
<input type="password" id="cpassword" name="cpassword" placeholder="Password" value="<?=set_value('cpassword')?>" required>
|
||||
</label>
|
||||
|
||||
</div>
|
||||
<!-- Button -->
|
||||
<button type="submit">Submit</button>
|
||||
|
||||
</form>
|
||||
@@ -16,15 +16,24 @@
|
||||
<nav>
|
||||
<ul>
|
||||
<li ><strong class= 'apliiiiiii'>Music APP</strong></li>
|
||||
<?php $page = preg_split('/[\/]/',$_SERVER['REQUEST_URI']);
|
||||
if($page[count($page)-1]!='auth' && $page[count($page)-1]!='create'){ ?>
|
||||
<form method='GET'>
|
||||
<input type='text' name='recherche' placeholder='Recherche... '>
|
||||
</form>
|
||||
<?php } ?>
|
||||
</ul>
|
||||
<ul>
|
||||
<li><?=anchor('albums','Albums');?></li>
|
||||
<li><?=anchor('artistes','Artistes');?></li>
|
||||
<li><?=anchor('chansons','Chansons');?></li>
|
||||
<li><?=anchor('playlist','Playlist');?></li>
|
||||
<li name='connexion'><?=anchor('connexion','Connexion');?></li>
|
||||
<?php if($this->session->userdata('logged_in')){ ?>
|
||||
<li><?=anchor('playlist','Playlist');?></li>
|
||||
<li name='déconnexion'><?=anchor('user/logout','Déconnexion');?></li>
|
||||
<?php }else{ ?>
|
||||
<li name='connexion'><?=anchor('user/auth','Connexion');?></li>
|
||||
<?php } ?>
|
||||
|
||||
|
||||
</ul>
|
||||
</nav>
|
||||
|
||||
15
CodeIgniter-3.1.13/application/views/playlist_list.php
Normal file
15
CodeIgniter-3.1.13/application/views/playlist_list.php
Normal file
@@ -0,0 +1,15 @@
|
||||
<h5>Playlist list</h5>
|
||||
<section class="list">
|
||||
<?php
|
||||
echo"<div>";
|
||||
echo anchor("playlist/addplaylist","<i class='fa fa-plus'></i>");
|
||||
echo"</div>";
|
||||
foreach($playlists as $playlist){
|
||||
echo "<div><article>";
|
||||
echo "<header class='short-text'>";
|
||||
echo anchor("playlist/view/{$playlist->playlistid}","{$playlist->name}");
|
||||
echo "</header>";
|
||||
echo "</article></div>";
|
||||
}
|
||||
?>
|
||||
</section>
|
||||
@@ -23,14 +23,15 @@ section.list img {
|
||||
height : 24px;
|
||||
}
|
||||
|
||||
.short-text{
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.apliiiiiii{
|
||||
width : 75px;
|
||||
height : 24px;
|
||||
color: red;
|
||||
}
|
||||
|
||||
.testtt{
|
||||
width : 75px;
|
||||
height : 24px;
|
||||
color: red;
|
||||
}
|
||||
Reference in New Issue
Block a user