This commit is contained in:
stiti 2024-05-27 22:40:16 +02:00
parent 9300cc18bb
commit 70c71f12fb
4 changed files with 17 additions and 11 deletions

View File

@ -497,7 +497,7 @@ $config['compress_output'] = FALSE;
| helper' page of the user guide for information regarding date handling.
|
*/
$config['time_reference'] = 'local';
$config['time_reference'] = 'Europe/Paris';
/*
|--------------------------------------------------------------------------

View File

@ -72,6 +72,10 @@ class Model_music extends CI_Model {
return $query->result();
}
public function get_artist_name_by_id($artist_id) {
return $this->db->get_where('artist', array('id' => $artist_id))->row('name');
}
public function get_album_by_id($id){
$query = $this->db->query(
"SELECT album.id, album.name, album.year, artist.name as artistName, genre.name as genreName, cover.jpeg

View File

@ -107,11 +107,11 @@ class Model_playlist extends CI_Model {
return $this->db->delete('playlist_song');
}
// Récupérer les chansons d'une playlist
public function get_songs_by_playlist($playlist_id) {
$this->db->select('song.*');
$this->db->select('song.*, artist.name as artist_name');
$this->db->from('playlist_song');
$this->db->join('song', 'song.id = playlist_song.song_id');
$this->db->join('artist', 'artist.id = song.artistId');
$this->db->where('playlist_song.playlist_id', $playlist_id);
return $this->db->get()->result();
}

View File

@ -2,7 +2,7 @@
<html lang="fr">
<head>
<meta charset="UTF-8">
<title>Détails de la Playlist</title>
<title>Détails de la Playlist - Onzeur</title>
<link rel="stylesheet" href="<?php echo base_url('assets/css/playlist_view.css'); ?>">
</head>
<body>
@ -38,14 +38,15 @@
<thead>
<tr>
<th>Titre</th>
<th>Artiste</th>
<th>Actions</th>
</tr>
</thead>
<tbody>
<?php if (!empty($songs)) : ?>
<?php foreach ($songs as $song) : ?>
<tr>
<td><?php echo htmlspecialchars($song->name, ENT_QUOTES, 'UTF-8'); ?></td>
<td><?php echo htmlspecialchars($song->artist_name, ENT_QUOTES, 'UTF-8'); ?></td> <!-- Affichage du nom de l'artiste -->
<td>
<a href="<?php echo site_url('playlists/remove_song/' . $playlist->id . '/' . $song->id); ?>" class="btn btn-danger" onclick="return confirm('Êtes-vous sûr de vouloir supprimer cette chanson de la playlist ?');">Supprimer</a>
</td>
@ -53,10 +54,11 @@
<?php endforeach; ?>
<?php else : ?>
<tr>
<td colspan="2">Aucune chanson trouvée dans cette playlist.</td>
<td colspan="3">Aucune chanson trouvée dans cette playlist.</td>
</tr>
<?php endif; ?>
</tbody>
</table>
<a href="<?php echo site_url('playlists/add_song/' . $playlist->id); ?>" class="btn btn-primary">Ajouter une musique</a>