Commit de louay

This commit is contained in:
stiti 2024-06-10 17:43:35 +02:00
parent f05e570e86
commit 1c75469b90
2 changed files with 6 additions and 2 deletions

View File

@ -113,10 +113,12 @@ class Model_playlist extends CI_Model {
} }
public function get_songs_by_playlist($playlist_id) { public function get_songs_by_playlist($playlist_id) {
$this->db->select('song.*, artist.name as artist_name'); $this->db->select('song.*, artist.name as artist_name, album.id as album_id, album.name as album_name'); // Ajoutez album.id à la sélection
$this->db->from('playlist_song'); $this->db->from('playlist_song');
$this->db->join('song', 'song.id = playlist_song.song_id'); $this->db->join('song', 'song.id = playlist_song.song_id');
$this->db->join('artist', 'artist.id = song.artistId'); $this->db->join('artist', 'artist.id = song.artistId');
$this->db->join('track', 'track.songId = song.id');
$this->db->join('album', 'album.id = track.albumId');
$this->db->where('playlist_song.playlist_id', $playlist_id); $this->db->where('playlist_song.playlist_id', $playlist_id);
return $this->db->get()->result(); return $this->db->get()->result();
} }

View File

@ -45,6 +45,7 @@
<tr> <tr>
<th>Titre</th> <th>Titre</th>
<th>Artiste</th> <th>Artiste</th>
<th>Album</th>
<th>Écouter sur</th> <th>Écouter sur</th>
<?php if ($this->session->userdata('user_id') === $playlist->utilisateur_id): ?> <?php if ($this->session->userdata('user_id') === $playlist->utilisateur_id): ?>
<th>Actions</th> <th>Actions</th>
@ -56,6 +57,7 @@
<tr> <tr>
<td><?php echo htmlspecialchars($song->name, ENT_QUOTES, 'UTF-8'); ?></td> <td><?php echo htmlspecialchars($song->name, ENT_QUOTES, 'UTF-8'); ?></td>
<td><a href="<?php echo site_url('artiste/index/' . $song->artistId); ?>"><?php echo htmlspecialchars($song->artist_name, ENT_QUOTES, 'UTF-8'); ?></a></td> <td><a href="<?php echo site_url('artiste/index/' . $song->artistId); ?>"><?php echo htmlspecialchars($song->artist_name, ENT_QUOTES, 'UTF-8'); ?></a></td>
<td><a href="<?php echo site_url('albums/view/' . $song->album_id); ?>"><?php echo htmlspecialchars($song->album_name, ENT_QUOTES, 'UTF-8'); ?></a></td>
<td> <td>
<a href="https://open.spotify.com/search/<?php echo urlencode($song->artist_name . ' ' . $song->name); ?>" class="spotify" target="_blank">Spotify</a> | <a href="https://open.spotify.com/search/<?php echo urlencode($song->artist_name . ' ' . $song->name); ?>" class="spotify" target="_blank">Spotify</a> |
<a href="https://www.deezer.com/search/<?php echo urlencode($song->artist_name . ' ' . $song->name); ?>" class="deezer" target="_blank">Deezer</a> | <a href="https://www.deezer.com/search/<?php echo urlencode($song->artist_name . ' ' . $song->name); ?>" class="deezer" target="_blank">Deezer</a> |