problème résolu
This commit is contained in:
@@ -23,7 +23,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
| a PHP script and you can easily do that on your own.
|
||||
|
|
||||
*/
|
||||
$config['base_url']='/~felix-vi/SAE_PHP_2024_test/CodeIgniter-3.1.13/';
|
||||
$config['base_url']='/~felix-vi/SAE_PHP_2024/CodeIgniter-3.1.13/';
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
|
||||
@@ -66,7 +66,6 @@ class Albums extends CI_Controller {
|
||||
$this->load->view('layout/footer');
|
||||
}else{
|
||||
$playlistId = $this->input->post('playlist_id');
|
||||
$page = $this->input->get('page');
|
||||
$this->model_music->AddAlbumtoPlaylist($playlistId,$id);
|
||||
redirect('albums');
|
||||
}
|
||||
|
||||
@@ -14,7 +14,6 @@ class Artistes extends CI_Controller {
|
||||
$order = $this->input->get('order');
|
||||
|
||||
if ($recherche=filter_input(INPUT_GET,'recherche') == false or $recherche=filter_input(INPUT_GET,'recherche') == null){
|
||||
$artistes = $this->model_music->getArtistes();
|
||||
$artistes = $this->model_music->get_filtered_artistes($genre, $sort, $order);
|
||||
$data['artistes'] = $artistes;
|
||||
}else{
|
||||
@@ -26,7 +25,6 @@ class Artistes extends CI_Controller {
|
||||
if ($artistes == false){
|
||||
$page = preg_split('/[\/]/',$_SERVER['REQUEST_URI']);
|
||||
$this->load->view('error',['page'=>$page[count($page)-1]]);
|
||||
$artistes = $this->model_music->getArtistes();
|
||||
$artistes = $this->model_music->get_filtered_artistes($genre, $sort, $order);
|
||||
$data['artistes'] = $artistes;
|
||||
}
|
||||
|
||||
@@ -53,16 +53,6 @@ class Model_music extends CI_Model {
|
||||
return $query->result();
|
||||
}
|
||||
|
||||
public function getArtistes(){
|
||||
$query = $this->db->query(
|
||||
"SELECT artist.name, artist.id
|
||||
FROM artist
|
||||
ORDER BY artist.name
|
||||
"
|
||||
);
|
||||
return $query->result();
|
||||
}
|
||||
|
||||
public function get_filtered_artistes($genre = [], $sort = null, $order = null) {
|
||||
$this->db->distinct();
|
||||
$this->db->select('artist.Id,artist.name, genre.name as genreName');
|
||||
@@ -317,7 +307,7 @@ class Model_music extends CI_Model {
|
||||
|
||||
public function getPlaylist(){
|
||||
$query = $this->db->query(
|
||||
"SELECT Playlist.name, Playlist.playlistid
|
||||
"SELECT Playlist.name, Playlist.playlistId
|
||||
FROM Playlist
|
||||
ORDER BY Playlist.name
|
||||
"
|
||||
@@ -327,7 +317,7 @@ class Model_music extends CI_Model {
|
||||
|
||||
public function getSearchPlaylist($nom){
|
||||
$query = $this->db->query(
|
||||
"SELECT Playlist.name, Playlist.playlistid
|
||||
"SELECT Playlist.name, Playlist.playlistId
|
||||
FROM Playlist
|
||||
WHERE Playlist.name LIKE '$nom'
|
||||
"
|
||||
@@ -346,9 +336,9 @@ class Model_music extends CI_Model {
|
||||
$trackId = $track->trackId;
|
||||
|
||||
$query = $this->db->query(
|
||||
"SELECT Playlist.name, Playlist.playlistid
|
||||
"SELECT Playlist.name, Playlist.playlistId
|
||||
FROM Playlist
|
||||
JOIN PlaylistSong ON Playlist.playlistid = PlaylistSong.playlistid
|
||||
JOIN PlaylistSong ON Playlist.playlistId = PlaylistSong.playlistId
|
||||
WHERE PlaylistSong.trackId = $trackId
|
||||
ORDER BY Playlist.name
|
||||
"
|
||||
@@ -383,12 +373,12 @@ class Model_music extends CI_Model {
|
||||
public function get_song_playlist($id){
|
||||
$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('Playlist');
|
||||
$this->db->join('PlaylistSong', 'PlaylistSong.playlistid = Playlist.playlistid');
|
||||
$this->db->join('track', 'PlaylistSong.trackid = track.id');
|
||||
$this->db->join('PlaylistSong', 'PlaylistSong.playlistId = Playlist.playlistId');
|
||||
$this->db->join('track', 'PlaylistSong.trackId = track.id');
|
||||
$this->db->join('song', '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');
|
||||
$this->db->join('genre', 'genre.id = album.genreId');
|
||||
$this->db->where('PlaylistSong.playlistId', $id);
|
||||
$query = $this->db->get();
|
||||
return $query->result();
|
||||
@@ -438,7 +428,7 @@ class Model_music extends CI_Model {
|
||||
// É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_in('PlaylistSong.trackId', $trackIds);
|
||||
$this->db->where('PlaylistSong.playlistId',$idplaylist);
|
||||
$query = $this->db->get();
|
||||
|
||||
@@ -481,9 +471,9 @@ class Model_music extends CI_Model {
|
||||
}
|
||||
|
||||
// É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->select('PlaylistSong.trackId as trackId');
|
||||
$this->db->from('PlaylistSong');
|
||||
$this->db->where_in('PlaylistSong.trackid', $trackIds);
|
||||
$this->db->where_in('PlaylistSong.trackId', $trackIds);
|
||||
$query = $this->db->get();
|
||||
return $query;
|
||||
}
|
||||
@@ -492,10 +482,10 @@ class Model_music extends CI_Model {
|
||||
$this->db->select('track.id as trackId');
|
||||
$this->db->from('album');
|
||||
$this->db->join('track', 'album.id = track.albumId');
|
||||
$this->db->where('track.albumId', $albumId);
|
||||
$this->db->where('album.id', $albumId);
|
||||
$query = $this->db->get();
|
||||
foreach($query->result() as $tab){
|
||||
if($this->model_music->SongInPlaylist($tab->trackId) == false){
|
||||
if($this->model_music->SongInThisPlaylist($tab->trackId,$idplaylist) == false){
|
||||
$this->model_music->AddSongtoPlaylist($idplaylist,$tab->trackId);
|
||||
}
|
||||
}
|
||||
@@ -509,7 +499,7 @@ class Model_music extends CI_Model {
|
||||
$this->db->where('artist.id', $artisteId);
|
||||
$query = $this->db->get();
|
||||
foreach($query->result() as $tab){
|
||||
if($this->model_music->SongInPlaylist($tab->trackId) == false){
|
||||
if($this->model_music->SongInThisPlaylist($tab->trackId,$idplaylist) == false){
|
||||
$this->model_music->AddSongtoPlaylist($idplaylist,$tab->trackId);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,11 +6,11 @@
|
||||
</div>
|
||||
|
||||
<section class="list">
|
||||
<form method="post" action="your_form_action_url.php">
|
||||
<form method="post">
|
||||
<?php foreach ($playlists as $playlist): ?>
|
||||
<div class="playlist-option">
|
||||
<label>
|
||||
<input type="radio" name="playlist_id" value="<?=$playlist->playlistid ?>">
|
||||
<input type="radio" name="playlist_id" value="<?=$playlist->playlistId ?>">
|
||||
<?= $playlist->name ?>
|
||||
</label>
|
||||
</div>
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
<?php foreach ($playlists as $playlist): ?>
|
||||
<div class="playlist-option">
|
||||
<label>
|
||||
<input type="radio" name="playlist_id" value="<?=$playlist->playlistid ?>">
|
||||
<input type="radio" name="playlist_id" value="<?=$playlist->playlistId ?>">
|
||||
<?= $playlist->name ?>
|
||||
</label>
|
||||
</div>
|
||||
|
||||
@@ -10,8 +10,8 @@
|
||||
<?php foreach ($playlists as $playlist): ?>
|
||||
<div class="playlist-option">
|
||||
<label>
|
||||
<?php if($this->model_music->SongInThisPlaylist($id,$playlist->playlistid) == false){ ?>
|
||||
<input type="radio" name="playlist_id" value="<?= $playlist->playlistid ?>">
|
||||
<?php if($this->model_music->SongInThisPlaylist($id,$playlist->playlistId) == false){ ?>
|
||||
<input type="radio" name="playlist_id" value="<?= $playlist->playlistId ?>">
|
||||
<?= $playlist->name ?>
|
||||
<?php } ?>
|
||||
</label>
|
||||
|
||||
@@ -67,9 +67,9 @@ foreach ($albums as $album):
|
||||
<article>
|
||||
<header class="short-text">
|
||||
<?= anchor("albums/viewMusique/{$album->albumId}", $album->name); ?>
|
||||
<?php if ($this->session->userdata('logged_in')): ?>
|
||||
<?= anchor("albums/addAlbumtoPlaylist/{$album->albumId}", "<i class='fa fa-plus'></i>"); ?>
|
||||
<?php endif; ?>
|
||||
<?php if ($this->session->userdata('logged_in')):
|
||||
echo anchor("albums/addAlbumtoPlaylist/{$album->albumId}", "<i class='fa fa-plus'></i>");
|
||||
endif; ?>
|
||||
</header>
|
||||
<img src="data:image/jpeg;base64,<?= base64_encode($album->jpeg); ?>" alt="cover de l'album" />
|
||||
<nav class="short-text">Genre: <?= $album->genreName; ?></nav>
|
||||
|
||||
@@ -139,6 +139,7 @@ foreach($chansons_for_current_page as $chanson): ?>
|
||||
$start_page = max(1, $total_pages - 4);
|
||||
}
|
||||
|
||||
if ( $total_pages > 1){
|
||||
for ($i = $start_page; $i <= $end_page; $i++): ?>
|
||||
<?php if ($i == $current_page): ?>
|
||||
<span><?= $i ?></span>
|
||||
@@ -150,4 +151,5 @@ foreach($chansons_for_current_page as $chanson): ?>
|
||||
<?php if ($current_page < $total_pages): ?>
|
||||
<a href="?page=<?= $current_page + 1 ?>">Next »</a>
|
||||
<?php endif; ?>
|
||||
<?php } ?>
|
||||
</div>
|
||||
@@ -10,10 +10,10 @@ echo"</div>";
|
||||
foreach($playlists as $playlist){
|
||||
echo "<div><article>";
|
||||
echo "<header class='short-text'>";
|
||||
echo anchor("chansons/view/{$playlist->playlistid}","{$playlist->name}");
|
||||
echo anchor("chansons/view/{$playlist->playlistId}","{$playlist->name}");
|
||||
if($this->session->userdata('logged_in')){
|
||||
echo anchor("playlist/deletePlaylist/{$playlist->playlistid}","<i class='fa fa-trash'></i>");
|
||||
echo anchor("playlist/duplicatePlaylist/{$playlist->playlistid}","<i class='fa fa-clone'></i>");
|
||||
echo anchor("playlist/deletePlaylist/{$playlist->playlistId}","<i class='fa fa-trash'></i>");
|
||||
echo anchor("playlist/duplicatePlaylist/{$playlist->playlistId}","<i class='fa fa-clone'></i>");
|
||||
}
|
||||
echo "</header>";
|
||||
echo "</article></div>";
|
||||
|
||||
Reference in New Issue
Block a user