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();
$tracks = []; // Initialiser le tableau des pistes
if ($album) {
$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
JOIN song ON track.songid = song.id
WHERE track.albumid = ?
@ -98,7 +100,7 @@ class Model_music extends CI_Model {
$tracks = $query->result();
}
return [$album,$tracks];
return [$album, $tracks];
}
public function getMusiques($limit, $offset, $order_by = 'name', $order_direction = 'ASC', $genre_id = null, $artist_id = null) {

View File

@ -25,7 +25,9 @@
<ul>
<?php foreach ($tracks as $track): ?>
<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')): ?>
<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; ?>