finition css
This commit is contained in:
@@ -9,17 +9,18 @@ class Playlist extends CI_Controller {
|
||||
$this->load->library('form_validation');
|
||||
}
|
||||
public function index(){
|
||||
$user = $this->session->userdata('userId');
|
||||
if ($recherche=filter_input(INPUT_GET,'recherche') == false or $recherche=filter_input(INPUT_GET,'recherche') == null){
|
||||
$playlists = $this->model_music->getPlaylist();
|
||||
$playlists = $this->model_music->getPlaylist($user);
|
||||
}else{
|
||||
$recherche=filter_input(INPUT_GET,'recherche');
|
||||
$playlists = $this->model_music->getSearchPlaylist($recherche);
|
||||
$playlists = $this->model_music->getSearchPlaylist($recherche,$user);
|
||||
}
|
||||
$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();
|
||||
$playlists = $this->model_music->getPlaylist($user);
|
||||
}
|
||||
$this->load->view('playlist_list',['playlists'=>$playlists]);
|
||||
$this->load->view('layout/footer');
|
||||
|
||||
@@ -21,17 +21,28 @@ class User extends CI_Controller {
|
||||
$this->load->view('layout/header');
|
||||
$this->load->view('create_user');
|
||||
$this->load->view('layout/footer');
|
||||
}else{
|
||||
|
||||
}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");
|
||||
if($this->model_music->verifyMail($this->input->post("email")) == false){
|
||||
$this->model_music->create_user($user);
|
||||
$dataUser=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),
|
||||
"logged_in" => TRUE
|
||||
);
|
||||
$this->session->set_userdata($dataUser);
|
||||
redirect("albums");
|
||||
}else{
|
||||
$this->session->set_flashdata('error', 'Cet email est déjà utilisé.');
|
||||
redirect('user/create');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -63,7 +74,7 @@ class User extends CI_Controller {
|
||||
$this->session->set_userdata($dataUser);
|
||||
redirect("albums");
|
||||
}else{
|
||||
redirect("user/create");
|
||||
redirect("user/auth");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -176,16 +176,14 @@ class Model_music extends CI_Model {
|
||||
}
|
||||
|
||||
public function getSearchAlbums($nom){
|
||||
$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
|
||||
WHERE album.name LIKE '$nom'
|
||||
"
|
||||
);
|
||||
//$query->result();
|
||||
$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('artist','album.artistid = artist.id');
|
||||
$this->db->join('genre','genre.id = album.genreid');
|
||||
$this->db->join('cover','cover.id = album.coverid');
|
||||
$this->db->where('album.name', $nom);
|
||||
$this->db->order_by('year','ASC');
|
||||
$query = $this->db->get();
|
||||
if ($query->num_rows() > 0){
|
||||
return $query->result();
|
||||
}
|
||||
@@ -193,13 +191,10 @@ class Model_music extends CI_Model {
|
||||
}
|
||||
|
||||
public function getSearchArtistes($nom){
|
||||
$query = $this->db->query(
|
||||
"SELECT artist.name, artist.id
|
||||
FROM artist
|
||||
WHERE artist.name LIKE '$nom'
|
||||
"
|
||||
);
|
||||
$query->result();
|
||||
$this->db->select('artist.name, artist.id');
|
||||
$this->db->from('artist');
|
||||
$this->db->like('artist.name',$nom);
|
||||
$query = $this->db->get();
|
||||
if ($query->num_rows() > 0){
|
||||
return $query->result();
|
||||
}
|
||||
@@ -207,18 +202,15 @@ class Model_music extends CI_Model {
|
||||
}
|
||||
|
||||
public function getSearchChansons($nom){
|
||||
$query = $this->db->query(
|
||||
"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
|
||||
JOIN artist ON album.artistid = artist.id
|
||||
JOIN genre ON genre.id = album.genreid
|
||||
WHERE song.name LIKE '$nom'
|
||||
|
||||
"
|
||||
);
|
||||
$query->result();
|
||||
$this->db->select('album.name,album.id as albumId,year,artist.name as artistName, genre.name as genreName,jpeg ');
|
||||
$this->db->from('song');
|
||||
$this->db->join('track','track.songId = song.id');
|
||||
$this->db->join('album','track.artistid = album.id');
|
||||
$this->db->join('artist','album.artistid = artist.id');
|
||||
$this->db->join('genre','genre.id = album.genreid');
|
||||
$this->db->where('song.name', $nom);
|
||||
$this->db->order_by('year','ASC');
|
||||
$query = $this->db->get();
|
||||
if ($query->num_rows() > 0){
|
||||
return $query->result();
|
||||
}
|
||||
@@ -230,18 +222,16 @@ class Model_music extends CI_Model {
|
||||
$query = $this->db->get('album');
|
||||
$album = $query->row();
|
||||
|
||||
// Recupere la couverture
|
||||
$this->db->where('id', $album->coverId);
|
||||
$coverQuery = $this->db->get('cover');
|
||||
$cover = $coverQuery->row();
|
||||
$album->coverImage = $cover->jpeg;
|
||||
// Recupere le l'id de la musique a partie de l'album
|
||||
|
||||
$this->db->select('songId');
|
||||
$this->db->where('albumId', $id);
|
||||
$songsQuery = $this->db->get('track');
|
||||
$songIds = $songsQuery->result();
|
||||
|
||||
// Récupérer les noms des chansons à partir des songIds
|
||||
$album->songs = [];
|
||||
foreach ($songIds as $song) {
|
||||
$this->db->select('name');
|
||||
@@ -272,22 +262,18 @@ class Model_music extends CI_Model {
|
||||
$artist = $artistQuery->row();
|
||||
$album->artist = $artist;
|
||||
|
||||
|
||||
|
||||
return $album;
|
||||
}
|
||||
|
||||
public function getAlbumsByArtistId($artistId) {
|
||||
$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
|
||||
WHERE album.artistid=$artistId
|
||||
ORDER BY year
|
||||
"
|
||||
);
|
||||
$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('artist','album.artistid = artist.id');
|
||||
$this->db->join('genre','genre.id = album.genreid');
|
||||
$this->db->join('cover','cover.id = album.coverid');
|
||||
$this->db->where('album.artistid', $artistId);
|
||||
$this->db->order_by('year','ASC');
|
||||
$query = $this->db->get();
|
||||
return $query->result();
|
||||
}
|
||||
|
||||
@@ -305,23 +291,20 @@ class Model_music extends CI_Model {
|
||||
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 getPlaylist($iduser){
|
||||
$this->db->select("Playlist.name, Playlist.playlistId");
|
||||
$this->db->from('Playlist');
|
||||
$this->db->where('Playlist.userId',$iduser);
|
||||
$query = $this->db->get();
|
||||
return $query->result();
|
||||
}
|
||||
|
||||
public function getSearchPlaylist($nom){
|
||||
$query = $this->db->query(
|
||||
"SELECT Playlist.name, Playlist.playlistId
|
||||
FROM Playlist
|
||||
WHERE Playlist.name LIKE '$nom'
|
||||
"
|
||||
);
|
||||
public function getSearchPlaylist($nom,$iduser){
|
||||
$this->db->select("Playlist.name, Playlist.playlistId");
|
||||
$this->db->from('Playlist');
|
||||
$this->db->where('Playlist.name',$nom);
|
||||
$this->db->where('Playlist.userId',$iduser);
|
||||
$query = $this->db->get();
|
||||
$query->result();
|
||||
if ($query->num_rows() > 0){
|
||||
return $query->result();
|
||||
@@ -335,14 +318,12 @@ class Model_music extends CI_Model {
|
||||
$track = $result->row();
|
||||
$trackId = $track->trackId;
|
||||
|
||||
$query = $this->db->query(
|
||||
"SELECT Playlist.name, Playlist.playlistId
|
||||
FROM Playlist
|
||||
JOIN PlaylistSong ON Playlist.playlistId = PlaylistSong.playlistId
|
||||
WHERE PlaylistSong.trackId = $trackId
|
||||
ORDER BY Playlist.name
|
||||
"
|
||||
);
|
||||
$this->db->select('Playlist.name, Playlist.playlistId');
|
||||
$this->db->from('Playlist');
|
||||
$this->db->join('PlaylistSong','Playlist.playlistId = PlaylistSong.playlistId');
|
||||
$this->db->where('PlaylistSong.trackId',$trackId);
|
||||
$this->db->order_by('Playlist.name','ASC');
|
||||
$query = $this->db->get();
|
||||
return $query->result();
|
||||
}
|
||||
|
||||
@@ -387,7 +368,6 @@ class Model_music extends CI_Model {
|
||||
public function SongInPlaylist($id){
|
||||
$result = $this->model_music->TrackidSonginPlaylist($id);
|
||||
|
||||
// Si on trouve au moins une piste de cette chanson dans la playlist, retourner true
|
||||
if ($result->num_rows() > 0) {
|
||||
return true;
|
||||
}
|
||||
@@ -399,23 +379,19 @@ class Model_music extends CI_Model {
|
||||
$idtrack = array($idtrack);
|
||||
}
|
||||
|
||||
// Étape 1: Récupérer l'ID de la chanson à partir de l'un des IDs de piste fournis
|
||||
$this->db->select('song.id as songId');
|
||||
$this->db->from('track');
|
||||
$this->db->join('song', 'song.id = track.songId');
|
||||
$this->db->where_in('track.id', $idtrack);
|
||||
$query = $this->db->get();
|
||||
|
||||
// Vérifier si des résultats ont été trouvés
|
||||
if ($query->num_rows() == 0) {
|
||||
return false; // Si aucun résultat trouvé, retourner false
|
||||
return false;
|
||||
}
|
||||
|
||||
// Récupérer le premier songId correspondant
|
||||
$result = $query->row();
|
||||
$songId = $result->songId;
|
||||
|
||||
// Étape 2: Récupérer tous les IDs de pistes associés à cette chanson
|
||||
$this->db->select('track.id as trackId');
|
||||
$this->db->from('track');
|
||||
$this->db->where('track.songId', $songId);
|
||||
@@ -425,14 +401,12 @@ class Model_music extends CI_Model {
|
||||
$trackIds[] = $track->trackId;
|
||||
}
|
||||
|
||||
// Étape 3: Vérifier si l'une des pistes de cette chanson est dans la playlist
|
||||
$this->db->select('PlaylistSong.trackid as trackId');
|
||||
$this->db->from('PlaylistSong');
|
||||
$this->db->where_in('PlaylistSong.trackId', $trackIds);
|
||||
$this->db->where('PlaylistSong.playlistId',$idplaylist);
|
||||
$query = $this->db->get();
|
||||
|
||||
// Si on trouve au moins une piste de cette chanson dans la playlist, retourner true
|
||||
if ($query->num_rows() > 0) {
|
||||
return true;
|
||||
}
|
||||
@@ -444,23 +418,19 @@ class Model_music extends CI_Model {
|
||||
$id = array($id);
|
||||
}
|
||||
|
||||
// Étape 1: Récupérer l'ID de la chanson à partir de l'un des IDs de piste fournis
|
||||
$this->db->select('song.id as songId');
|
||||
$this->db->from('track');
|
||||
$this->db->join('song', 'song.id = track.songId');
|
||||
$this->db->where_in('track.id', $id);
|
||||
$query = $this->db->get();
|
||||
|
||||
// Vérifier si des résultats ont été trouvés
|
||||
if ($query->num_rows() == 0) {
|
||||
return false; // Si aucun résultat trouvé, retourner false
|
||||
return false;
|
||||
}
|
||||
|
||||
// Récupérer le premier songId correspondant
|
||||
$result = $query->row();
|
||||
$songId = $result->songId;
|
||||
|
||||
// Étape 2: Récupérer tous les IDs de pistes associés à cette chanson
|
||||
$this->db->select('track.id as trackId');
|
||||
$this->db->from('track');
|
||||
$this->db->where('track.songId', $songId);
|
||||
@@ -470,7 +440,6 @@ class Model_music extends CI_Model {
|
||||
$trackIds[] = $track->trackId;
|
||||
}
|
||||
|
||||
// Étape 3: Vérifier si l'une des pistes de cette chanson est dans la playlist
|
||||
$this->db->select('PlaylistSong.trackId as trackId');
|
||||
$this->db->from('PlaylistSong');
|
||||
$this->db->where_in('PlaylistSong.trackId', $trackIds);
|
||||
@@ -554,9 +523,23 @@ class Model_music extends CI_Model {
|
||||
$this->db->where_in('year', $years);
|
||||
}
|
||||
|
||||
$this->db->order_by('RAND()');
|
||||
$this->db->order_by('trackId','RANDOM');
|
||||
$this->db->limit($num_tracks);
|
||||
$query = $this->db->get();
|
||||
return $query->result();
|
||||
}
|
||||
|
||||
public function verifyMail($email){
|
||||
$this->db->select('usermail');
|
||||
$this->db->from('User');
|
||||
$this->db->where('usermail', $email);
|
||||
|
||||
$query = $this->db->get();
|
||||
|
||||
if($query->num_rows() > 0){
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
|
||||
|
||||
<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">
|
||||
@@ -9,7 +8,6 @@
|
||||
<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>
|
||||
|
||||
@@ -1,9 +1,6 @@
|
||||
|
||||
<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" required>
|
||||
@@ -14,7 +11,6 @@
|
||||
<input type="text" id="nom" name="nom" placeholder="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" required>
|
||||
<div class="grid">
|
||||
@@ -24,9 +20,13 @@
|
||||
<label for="cpassword">Confirmation password
|
||||
<input type="password" id="cpassword" name="cpassword" placeholder="Password" required>
|
||||
</label>
|
||||
|
||||
</div>
|
||||
<!-- Button -->
|
||||
<?php if ($this->session->flashdata('error')): ?>
|
||||
<div class="alert-danger">
|
||||
<?php echo $this->session->flashdata('error'); ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<br>
|
||||
<br>
|
||||
<button type="submit">Submit</button>
|
||||
|
||||
</form>
|
||||
|
||||
@@ -17,11 +17,17 @@
|
||||
<?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 if($this->session->userdata('logged_in')){ ?>
|
||||
<form method="GET">
|
||||
<input type="text" class="recherchelog" name="recherche" placeholder="Recherche... ">
|
||||
</form>
|
||||
<?php }else{ ?>
|
||||
<form method="GET">
|
||||
<input type="text" class="recherche" name="recherche" placeholder="Recherche... ">
|
||||
</form>
|
||||
<?php } ?>
|
||||
<?php } ?>
|
||||
<ul>
|
||||
<ul class="onglet">
|
||||
<li><?= anchor('albums', 'Albums'); ?></li>
|
||||
<li><?= anchor('artistes', 'Artistes'); ?></li>
|
||||
<li><?= anchor('chansons', 'Chansons'); ?></li>
|
||||
|
||||
@@ -12,16 +12,28 @@ section.list img {
|
||||
display:inline-block;
|
||||
|
||||
}
|
||||
.short-text {
|
||||
.short-text, h6{
|
||||
overflow: hidden;
|
||||
white-space: nowrap;
|
||||
text-overflow: ellipsis;
|
||||
color: #2a2a2a;
|
||||
color: #d8d3d3;
|
||||
}
|
||||
|
||||
h5,h3{
|
||||
font-size: 25px;
|
||||
color: #5106dd;
|
||||
}
|
||||
|
||||
.recherche {
|
||||
width : 75px;
|
||||
width : 150px;
|
||||
height : 24px;
|
||||
margin-left: -200px;
|
||||
margin-right: 150px;
|
||||
}
|
||||
|
||||
.recherchelog{
|
||||
margin-left: -150px;
|
||||
margin-right: 50px;
|
||||
}
|
||||
|
||||
.short-text{
|
||||
@@ -30,10 +42,15 @@ section.list img {
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.appli{
|
||||
width : 100px;
|
||||
height : 75px;
|
||||
color: #444;
|
||||
li .appli{
|
||||
position: relative;
|
||||
bottom: 15px;
|
||||
font-size: 30px;
|
||||
color: #ad1010;
|
||||
}
|
||||
|
||||
.onglet{
|
||||
font-size: 20px;
|
||||
}
|
||||
|
||||
.apliiiiiii{
|
||||
@@ -95,6 +112,7 @@ html {
|
||||
background-color: #13171f;
|
||||
color: #ffffff;
|
||||
font-family: Arial, sans-serif;
|
||||
padding: 10px;
|
||||
}
|
||||
|
||||
.album-details {
|
||||
@@ -176,4 +194,8 @@ i {
|
||||
cursor: pointer;
|
||||
font-size: 14px;
|
||||
border-radius: 4px;
|
||||
}
|
||||
}
|
||||
|
||||
article, article header, article footer{
|
||||
background-color: #444;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user