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. | 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(); 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){ public function get_album_by_id($id){
$query = $this->db->query( $query = $this->db->query(
"SELECT album.id, album.name, album.year, artist.name as artistName, genre.name as genreName, cover.jpeg "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'); return $this->db->delete('playlist_song');
} }
// Récupérer les chansons d'une playlist
public function get_songs_by_playlist($playlist_id) { 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->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->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

@ -2,7 +2,7 @@
<html lang="fr"> <html lang="fr">
<head> <head>
<meta charset="UTF-8"> <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'); ?>"> <link rel="stylesheet" href="<?php echo base_url('assets/css/playlist_view.css'); ?>">
</head> </head>
<body> <body>
@ -38,14 +38,15 @@
<thead> <thead>
<tr> <tr>
<th>Titre</th> <th>Titre</th>
<th>Artiste</th>
<th>Actions</th> <th>Actions</th>
</tr> </tr>
</thead>
<tbody> <tbody>
<?php if (!empty($songs)) : ?> <?php if (!empty($songs)) : ?>
<?php foreach ($songs as $song) : ?> <?php foreach ($songs as $song) : ?>
<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><?php echo htmlspecialchars($song->artist_name, ENT_QUOTES, 'UTF-8'); ?></td> <!-- Affichage du nom de l'artiste -->
<td> <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> <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> </td>
@ -53,10 +54,11 @@
<?php endforeach; ?> <?php endforeach; ?>
<?php else : ?> <?php else : ?>
<tr> <tr>
<td colspan="2">Aucune chanson trouvée dans cette playlist.</td> <td colspan="3">Aucune chanson trouvée dans cette playlist.</td>
</tr> </tr>
<?php endif; ?> <?php endif; ?>
</tbody> </tbody>
</table> </table>
<a href="<?php echo site_url('playlists/add_song/' . $playlist->id); ?>" class="btn btn-primary">Ajouter une musique</a> <a href="<?php echo site_url('playlists/add_song/' . $playlist->id); ?>" class="btn btn-primary">Ajouter une musique</a>