Commit de Louay : Correction de bugs

This commit is contained in:
stiti 2024-06-01 18:08:30 +02:00
parent 684ef237f4
commit db9f3a7e3a
4 changed files with 30 additions and 19 deletions

View File

@ -37,15 +37,17 @@
<?php echo anchor("albums/view/{$album->id}", $album->name); ?>
</header>
<img src="data:image/jpeg;base64,<?php echo base64_encode($album->jpeg); ?>" alt="<?php echo $album->name; ?>">
<footer class="short-text"><?php echo $album->year; ?> - <?php echo $album->artistName; ?><br><br>
<footer class="short-text"><?php echo $album->year; ?> - <?php echo $album->artistName; ?>
<?php if ($this->session->userdata('user_id')): ?>
<select id="playlist_<?php echo $album->id; ?>" class="select-playlist">
<?php if (!empty($user_playlists)): ?>
<br><br><select id="playlist_<?php echo $album->id; ?>" class="select-playlist">
<?php foreach ($user_playlists as $playlist) : ?>
<option value="<?php echo $playlist->id; ?>"><?php echo $playlist->name; ?></option>
<?php endforeach; ?>
</select>
<button onclick="addToPlaylist(<?php echo $album->id; ?>)" class="btn-add-to-playlist">Ajouter l'album à la playlist</button>
<?php endif; ?>
<?php endif; ?>
</footer>
</article>
</div>

View File

@ -16,6 +16,7 @@
<a href="https://www.youtube.com/results?search_query=<?php echo urlencode($artist->name); ?>&sp=EgIQAg%253D%253D" class="youtube" target="_blank">YouTube</a>
</p>
<?php if ($this->session->userdata('user_id')): ?>
<?php if (!empty($user_playlists)): ?>
<form method="post" action="<?php echo site_url('playlists/add_artist_in_playlist_from_list/'.$artist->id); ?>">
<select name="playlist_id" class="select-playlist">
<?php foreach ($user_playlists as $playlist) : ?>
@ -26,6 +27,7 @@
<button type="submit" class="btn-add-to-playlist">Ajouter les musiques de l'artiste à la playlist</button>
</form>
<?php endif; ?>
<?php endif; ?>
</div>
</li>
<?php endforeach; ?>

View File

@ -52,8 +52,9 @@
<!-- Lien YouTube -->
<a href="https://www.youtube.com/results?search_query=<?php echo urlencode($musique->name . ' ' . $musique->artistName); ?>" class="youtube" target="_blank">YouTube</a>
</div>
<br>
<?php if ($this->session->userdata('user_id')): ?>
<?php if (!empty($user_playlists)): ?>
<br>
<select id="playlist_music_<?php echo $musique->id; ?>" class="select-playlist">
<?php foreach ($user_playlists as $playlist) : ?>
<option value="<?php echo $playlist->id; ?>"><?php echo $playlist->name; ?></option>
@ -61,7 +62,7 @@
</select>
<button onclick="addToPlaylistMusic(<?php echo $musique->id; ?>)" class="btn-add-to-playlist">Ajouter la musique à la playlist</button>
<?php endif; ?>
<?php endif; ?>
</footer>
</article>
</div>

View File

@ -15,6 +15,7 @@
<?php echo htmlspecialchars($musique->artistName, ENT_QUOTES, 'UTF-8'); ?>
</a>
<?php if ($this->session->userdata('user_id')): ?>
<?php if (!empty($user_playlists)): ?>
<select id="playlist_<?php echo $musique->id; ?>" class="select-playlist">
<?php foreach ($user_playlists as $playlist) : ?>
<option value="<?php echo $playlist->id; ?>"><?php echo $playlist->name; ?></option>
@ -22,6 +23,7 @@
</select>
<button onclick="addToMusicPlaylist(<?php echo $musique->id; ?>)" class="btn-add-to-playlist">Ajouter la musique à la playlist</button>
<?php endif; ?>
<?php endif; ?>
</li>
<?php endforeach; ?>
</ul>
@ -41,6 +43,7 @@
<?php echo htmlspecialchars($album->artistName, ENT_QUOTES, 'UTF-8'); ?>
</a>
<?php if ($this->session->userdata('user_id')): ?>
<?php if (!empty($user_playlists)): ?>
<select id="playlist_<?php echo $album->id; ?>" class="select-playlist">
<?php foreach ($user_playlists as $playlist) : ?>
<option value="<?php echo $playlist->id; ?>"><?php echo $playlist->name; ?></option>
@ -48,6 +51,7 @@
</select>
<button onclick="addAlbumToPlaylist(<?php echo $album->id; ?>)" class="btn-add-to-playlist">Ajouter l'album à la playlist</button>
<?php endif; ?>
<?php endif; ?>
</li>
<?php endforeach; ?>
</ul>
@ -73,21 +77,23 @@
<div class="section">
<h3 class="section-title">Artistes</h3>
<ul class="artist-list">
<?php foreach ($artistes as $artiste): ?>
<li>
<a href="<?php echo site_url('artiste/' . htmlspecialchars($artiste->id, ENT_QUOTES, 'UTF-8')); ?>">
<?php echo htmlspecialchars($artiste->name, ENT_QUOTES, 'UTF-8'); ?>
</a>
<?php if ($this->session->userdata('user_id')): ?>
<select id="playlist_<?php echo $artiste->id; ?>" class="select-playlist">
<?php foreach ($user_playlists as $playlist) : ?>
<option value="<?php echo $playlist->id; ?>"><?php echo $playlist->name; ?></option>
<?php endforeach; ?>
</select>
<button onclick="addArtistToPlaylist(<?php echo $artiste->id; ?>)" class="btn-add-to-playlist">Ajouter l'artiste à la playlist</button>
<?php endif; ?>
</li>
<?php endforeach; ?>
<?php foreach ($artistes as $artiste): ?>
<li>
<a href="<?php echo site_url('artiste/' . htmlspecialchars($artiste->id, ENT_QUOTES, 'UTF-8')); ?>">
<?php echo htmlspecialchars($artiste->name, ENT_QUOTES, 'UTF-8'); ?>
</a>
<?php if ($this->session->userdata('user_id')): ?>
<?php if (!empty($user_playlists)): ?>
<select id="playlist_<?php echo $artiste->id; ?>" class="select-playlist">
<?php foreach ($user_playlists as $playlist) : ?>
<option value="<?php echo $playlist->id; ?>"><?php echo $playlist->name; ?></option>
<?php endforeach; ?>
</select>
<button onclick="addArtistToPlaylist(<?php echo $artiste->id; ?>)" class="btn-add-to-playlist">Ajouter l'artiste à la playlist</button>
<?php endif; ?>
<?php endif; ?>
</li>
<?php endforeach; ?>
</ul>
</div>
<?php endif; ?>