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); ?> <?php echo anchor("albums/view/{$album->id}", $album->name); ?>
</header> </header>
<img src="data:image/jpeg;base64,<?php echo base64_encode($album->jpeg); ?>" alt="<?php echo $album->name; ?>"> <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')): ?> <?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) : ?> <?php foreach ($user_playlists as $playlist) : ?>
<option value="<?php echo $playlist->id; ?>"><?php echo $playlist->name; ?></option> <option value="<?php echo $playlist->id; ?>"><?php echo $playlist->name; ?></option>
<?php endforeach; ?> <?php endforeach; ?>
</select> </select>
<button onclick="addToPlaylist(<?php echo $album->id; ?>)" class="btn-add-to-playlist">Ajouter l'album à la playlist</button> <button onclick="addToPlaylist(<?php echo $album->id; ?>)" class="btn-add-to-playlist">Ajouter l'album à la playlist</button>
<?php endif; ?> <?php endif; ?>
<?php endif; ?>
</footer> </footer>
</article> </article>
</div> </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> <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> </p>
<?php if ($this->session->userdata('user_id')): ?> <?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); ?>"> <form method="post" action="<?php echo site_url('playlists/add_artist_in_playlist_from_list/'.$artist->id); ?>">
<select name="playlist_id" class="select-playlist"> <select name="playlist_id" class="select-playlist">
<?php foreach ($user_playlists as $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> <button type="submit" class="btn-add-to-playlist">Ajouter les musiques de l'artiste à la playlist</button>
</form> </form>
<?php endif; ?> <?php endif; ?>
<?php endif; ?>
</div> </div>
</li> </li>
<?php endforeach; ?> <?php endforeach; ?>

View File

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

View File

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