Commit de louay : modifs

This commit is contained in:
stiti 2024-06-10 20:30:26 +02:00
parent 46674a1b05
commit a3bcef8683
8 changed files with 27 additions and 15 deletions

View File

@ -26,7 +26,7 @@ class Artiste extends CI_Controller {
$user_id = $this->session->userdata('user_id');
$data['user_playlists'] = $this->Model_playlist->get_user_playlists($user_id);
}
// Charger la vue avec les détails de l'artiste et ses albums
$data['artiste'] = $artiste;
$data['albums'] = $albums;
@ -35,6 +35,7 @@ class Artiste extends CI_Controller {
$data['title']="Détails de l'artiste - Onzeur ".$artiste->name;
$data['css'] = 'assets/css/artiste_details';
$this->load->view('layout/header_dark', $data);
$this->load->view('artiste_details', $data);
$this->load->view('layout/footer_dark');

View File

@ -237,7 +237,7 @@ class Model_music extends CI_Model {
public function getAlbumsByArtiste($artiste_id){
$query = $this->db->query("
SELECT album.id, album.name, album.year, artist.name as artistName, genre.name as genreName, cover.jpeg,
track.id as track_id, track.diskNumber, track.number, track.duration, song.name as songName
track.id as track_id, track.diskNumber, track.number, track.duration, song.id as song_id, song.name as songName
FROM album
JOIN artist ON album.artistid = artist.id
JOIN genre ON album.genreid = genre.id
@ -270,13 +270,13 @@ class Model_music extends CI_Model {
'diskNumber' => $row->diskNumber,
'number' => $row->number,
'duration' => $row->duration,
'song_id' => $row->song_id, // Ajouter l'ID de la chanson
'songName' => $row->songName
);
}
return array_values($albums); // Réorganiser les albums en utilisant des index numériques
}
}
public function getMostUsedGenreByArtist($artist_id) {
$query = $this->db->query("
@ -293,7 +293,7 @@ class Model_music extends CI_Model {
}
public function get_songs_by_artist($artist_id) {
$this->db->select('song.*');
$this->db->select('song.id as song_id');
$this->db->from('track');
$this->db->join('song', 'track.songid = song.id');
$this->db->join('album', 'track.albumid = album.id');

View File

@ -30,13 +30,11 @@
<?php endif; ?>
<?php endif; ?>
<!-- Boutons pour chaque chanson de l'album -->
<h3>Ajouter une chanson à la playlist :</h3>
<ul class="songs-list">
<?php foreach($album->tracks as $track): ?>
<br><ul class="songs-list">
<?php foreach ($album->tracks as $track): ?>
<li>
<span><strong><?php echo $track->number . '.' . $track->diskNumber; ?></strong></span>
<span><?php echo $track->songName; ?></span>
<span><a href="<?php echo site_url('musiques/view/' . $track->song_id); ?>"><?php echo $track->songName; ?></a></span>
<span><strong><?php echo gmdate("i:s", $track->duration); ?></strong></span>
<?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>
@ -50,7 +48,6 @@
</ul>
</div>
<script>
function addAlbumToPlaylist(albumId) {
// Récupérer l'ID de la playlist sélectionnée

View File

@ -6,7 +6,7 @@
<?php if (!empty($song->cover_base64)) : ?>
<img src="data:image/jpeg;base64,<?php echo base64_encode($song->cover_base64); ?>" alt="Couverture de l'album">
<?php endif; ?>
<p><strong>Durée :</strong> <?php echo gmdate("i:s", $song->duration); ?></p>
<p><strong>Durée :</strong> <?php echo gmdate("i:s", $song->duration); ?></p><br>
<?php if ($this->session->userdata('user_id')): ?>
<?php if (!empty($user_playlists)): ?>

View File

@ -39,7 +39,9 @@
<div>
<article>
<header class="short-text">
<?php echo $musique->name; ?>
<a href="<?php echo base_url('index.php/musiques/view/'.$musique->id); ?>" class="artist-name">
<?php echo $musique->name; ?>
</a>
</header>
<img src="data:image/jpeg;base64,<?php echo base64_encode($musique->cover); ?>" alt="Couverture de l'album">
<footer class="short-text">

View File

@ -55,7 +55,7 @@
<?php if (!empty($songs)) : ?>
<?php foreach ($songs as $song) : ?>
<tr>
<td><?php echo htmlspecialchars($song->name, ENT_QUOTES, 'UTF-8'); ?></td>
<td><a href="<?php echo site_url('musiques/view/' . $song->id); ?>"><?php echo htmlspecialchars($song->name, ENT_QUOTES, 'UTF-8'); ?></a></td>
<td><a href="<?php echo site_url('artiste/index/' . $song->artistId); ?>"><?php echo htmlspecialchars($song->artist_name, ENT_QUOTES, 'UTF-8'); ?></a></td>
<td><a href="<?php echo site_url('albums/view/' . $song->album_id); ?>"><?php echo htmlspecialchars($song->album_name, ENT_QUOTES, 'UTF-8'); ?></a></td>
<td>

View File

@ -10,7 +10,9 @@
<ul class="music-list">
<?php foreach ($musiques as $musique): ?>
<li>
<?php echo htmlspecialchars($musique->name, ENT_QUOTES, 'UTF-8'); ?> -
<a href="<?php echo site_url('musiques/view/' . htmlspecialchars($musique->id, ENT_QUOTES, 'UTF-8')); ?>">
<?php echo htmlspecialchars($musique->name, ENT_QUOTES, 'UTF-8'); ?>
</a> -
<a href="<?php echo site_url('artiste/' . htmlspecialchars($musique->artist_id, ENT_QUOTES, 'UTF-8')); ?>">
<?php echo htmlspecialchars($musique->artistName, ENT_QUOTES, 'UTF-8'); ?>
</a>

View File

@ -86,4 +86,14 @@ img {
.titre{
margin-right: 10px;
}
.recommended-song .titre,
.recommended-song .artist,
.recommended-song .album {
display: block;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
max-width: calc(100% - 90px); /* Subtract the image width and some padding */
}