Commit de louay : modifs

This commit is contained in:
stiti 2024-06-10 20:41:30 +02:00
parent a3bcef8683
commit 73f0cb1377
2 changed files with 15 additions and 11 deletions

View File

@ -87,9 +87,11 @@ class Model_music extends CI_Model {
); );
$album = $query->row(); $album = $query->row();
$tracks = []; // Initialiser le tableau des pistes
if ($album) { if ($album) {
$query = $this->db->query( $query = $this->db->query(
"SELECT track.id, track.diskNumber, track.number, track.duration, song.name as songName "SELECT track.id, track.diskNumber, track.number, track.duration, song.id as song_id, song.name as songName
FROM track FROM track
JOIN song ON track.songid = song.id JOIN song ON track.songid = song.id
WHERE track.albumid = ? WHERE track.albumid = ?

View File

@ -25,7 +25,9 @@
<ul> <ul>
<?php foreach ($tracks as $track): ?> <?php foreach ($tracks as $track): ?>
<li> <li>
<strong><?php echo $track->diskNumber . '.' . $track->number; ?>:</strong> <?php echo $track->songName; ?> (<?php echo gmdate("i:s", $track->duration); ?>) <strong><?php echo $track->diskNumber . '.' . $track->number; ?>:</strong>
<a href="<?php echo site_url('musiques/view/' . $track->song_id); ?>"><?php echo $track->songName; ?></a>
(<?php echo gmdate("i:s", $track->duration); ?>)
<?php if ($this->session->userdata('user_id')): ?> <?php if ($this->session->userdata('user_id')): ?>
<button onclick="addSongToPlaylist(<?php echo $track->id; ?>, <?php echo $album->id; ?>)" class="btn-add-music-to-playlist">Ajouter la musique à la playlist</button> <button onclick="addSongToPlaylist(<?php echo $track->id; ?>, <?php echo $album->id; ?>)" class="btn-add-music-to-playlist">Ajouter la musique à la playlist</button>
<?php endif; ?> <?php endif; ?>