mirror of
https://grond.iut-fbleau.fr/stiti/SAE_2.02
synced 2024-11-09 13:01:42 +01:00
Commit de louay : modifs
This commit is contained in:
parent
a3bcef8683
commit
73f0cb1377
@ -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) {
|
||||
|
@ -23,14 +23,16 @@
|
||||
<?php if (!empty($tracks)): ?>
|
||||
<h2>Musiques</h2>
|
||||
<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); ?>)
|
||||
<?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; ?>
|
||||
</li>
|
||||
<?php endforeach; ?>
|
||||
<?php foreach ($tracks as $track): ?>
|
||||
<li>
|
||||
<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; ?>
|
||||
</li>
|
||||
<?php endforeach; ?>
|
||||
</ul>
|
||||
<?php else: ?>
|
||||
<p>Aucune musique n'est disponible dans cet album...</p>
|
||||
|
Loading…
Reference in New Issue
Block a user