Merge branch 'main' of grond.iut-fbleau.fr:keraudre/SAE_DEV2.2_2024
This commit is contained in:
@@ -7,7 +7,7 @@ foreach ($musics as $music) {
|
||||
echo "<li>$music->songName</li>";
|
||||
echo "<li>Durée: {$music->trackDuration} secondes</li>";
|
||||
// Ajout du bouton pour ajouter la musique à la playlist
|
||||
echo "<li><button onclick=\"location.href='" . site_url("playlist/add_track/{$music->songId}") . "'\">Ajouter à la Playlist</button></li>";
|
||||
echo "<button onclick=\"location.href='" . site_url("playlist/add_track/{$music->songId}") . "'\">Ajouter à la Playlist</button>";
|
||||
echo "</ul>";
|
||||
echo "</article></div>";
|
||||
}
|
||||
|
@@ -39,6 +39,8 @@ foreach($albums as $album){
|
||||
echo "<div><article>";
|
||||
echo "<header class='short-text'>";
|
||||
echo anchor("music/view/{$album->id}", "{$album->name}");
|
||||
echo "<br>";
|
||||
echo "<button onclick=\"location.href='" . site_url("playlist/add_track/{$album->id}") . "'\">Ajouter à la Playlist</button>";
|
||||
echo "</header>";
|
||||
echo '<img src="data:image/jpeg;base64,'.base64_encode($album->jpeg).'" />';
|
||||
echo "<footer class='short-text'>{$album->year} - {$album->artistName}</footer>
|
||||
|
@@ -53,6 +53,7 @@ foreach ($artistAlbums as $artistName => $albums) {
|
||||
echo "<ul>";
|
||||
foreach ($albums as $album) {
|
||||
echo "<li>" . anchor("music/view/{$album['albumId']}", $album['albumName']) . " - " . $album['year'] . "</li>";
|
||||
echo "<button onclick=\"location.href='" . site_url("playlist/add_track/{$album['albumId']}") . "'\">Ajouter à la Playlist</button>";
|
||||
}
|
||||
echo "</ul>";
|
||||
echo "</article></div>";
|
||||
|
25
codeigniter/application/views/playlist_list.php
Normal file
25
codeigniter/application/views/playlist_list.php
Normal file
@@ -0,0 +1,25 @@
|
||||
<h5>Mes Playlists</h5>
|
||||
|
||||
<!-- Formulaire pour créer la playlist avec le nom voulu -->
|
||||
<form action="<?= site_url('playlist/create'); ?>" method="post" class="create-playlist-form">
|
||||
<input type="text" name="name" placeholder="Nom de la playlist" required>
|
||||
<button type="submit">Créer</button>
|
||||
</form>
|
||||
|
||||
<!-- Affichez les playlist que nous avons -->
|
||||
<section class="playlists">
|
||||
<?php foreach($playlists as $playlist): ?>
|
||||
<div>
|
||||
<article>
|
||||
<header class="short-text">
|
||||
<?= anchor("playlist/view/{$playlist->id}", "{$playlist->name}"); ?>
|
||||
</header>
|
||||
<!-- Bouton pour supprimer la playlist -->
|
||||
<form action="<?= site_url('playlist/delete/' . $playlist->id); ?>" method="post" style="display:inline;">
|
||||
<button type="submit">Supprimer</button>
|
||||
</form>
|
||||
</article>
|
||||
</div>
|
||||
<?php endforeach; ?>
|
||||
</section>
|
||||
|
53
codeigniter/application/views/playlist_view.php
Normal file
53
codeigniter/application/views/playlist_view.php
Normal file
@@ -0,0 +1,53 @@
|
||||
<!-- En-tête de la playlist -->
|
||||
<h5>Playlist : <?= $playlistName; ?></h5>
|
||||
|
||||
<!-- Formulaire pour rechercher et ajouter une chanson -->
|
||||
<form action="<?= site_url('playlist/search_song'); ?>" method="post" class="add-song-form">
|
||||
<input type="hidden" name="playlistId" value="<?= $playlistId; ?>">
|
||||
<input type="text" name="songName" placeholder="Nom de la chanson" required>
|
||||
<button type="submit">Rechercher et Ajouter</button>
|
||||
</form>
|
||||
|
||||
<!-- Section pour afficher les résultats de la recherche -->
|
||||
<?php if (!empty($searchResults)): ?>
|
||||
<section class="search-results">
|
||||
<h5>Résultats de la recherche :</h5>
|
||||
<ul>
|
||||
<?php foreach($searchResults as $song): ?>
|
||||
<li>
|
||||
<?= $song->name; ?>
|
||||
<!-- Formulaire pour ajouter la chanson à la playlist -->
|
||||
<form action="<?= site_url('playlist/add_song'); ?>" method="post" style="display:inline;">
|
||||
<input type="hidden" name="playlistId" value="<?= $playlistId; ?>">
|
||||
<input type="hidden" name="songId" value="<?= $song->id; ?>">
|
||||
<button type="submit">Ajouter</button>
|
||||
</form>
|
||||
</li>
|
||||
<?php endforeach; ?>
|
||||
</ul>
|
||||
</section>
|
||||
<p>Test</p>
|
||||
<?php endif; ?>
|
||||
|
||||
<!-- Section pour afficher les chansons de son playlist -->
|
||||
<?php if (!empty($songs)): ?>
|
||||
<section class="current-songs">
|
||||
<h5>Chansons actuelles :</h5>
|
||||
<ul>
|
||||
<?php foreach($songs as $song): ?>
|
||||
<li>
|
||||
<?= $song->name; ?>
|
||||
<!-- Formulaire pour supprimer la chanson de la playlist -->
|
||||
<form action="<?= site_url('playlist/remove_song'); ?>" method="post" style="display:inline;">
|
||||
<input type="hidden" name="playlistId" value="<?= $playlistId; ?>">
|
||||
<input type="hidden" name="songId" value="<?= $song->id; ?>">
|
||||
<button type="submit">Supprimer</button>
|
||||
</form>
|
||||
</li>
|
||||
<?php endforeach; ?>
|
||||
</ul>
|
||||
</section>
|
||||
<?php endif; ?>
|
||||
|
||||
<a href="<?= site_url('playlist'); ?>" class="btn btn-secondary">Retour à toutes les playlists</a>
|
||||
|
27
codeigniter/application/views/song_search_results.php
Normal file
27
codeigniter/application/views/song_search_results.php
Normal file
@@ -0,0 +1,27 @@
|
||||
<h5>Résultats de la recherche pour : <?= $this->input->get('query'); ?></h5>
|
||||
|
||||
<form action="<?= site_url('playlist/search_song'); ?>" method="get" class="search-song-form">
|
||||
<input type="text" name="query" placeholder="Nom de la chanson" required>
|
||||
<button type="submit">Rechercher</button>
|
||||
</form>
|
||||
|
||||
<section class="songs">
|
||||
<?php foreach($songs as $song): ?>
|
||||
<div>
|
||||
<article>
|
||||
<header class="short-text">
|
||||
<?= $song->name; ?>
|
||||
<form action="<?= site_url('playlists/add_song'); ?>" method="post" style="display:inline;">
|
||||
<input type="hidden" name="songId" value="<?= $song->id; ?>">
|
||||
<select name="playlistId" required>
|
||||
<?php foreach($playlists as $playlist): ?>
|
||||
<option value="<?= $playlist->id; ?>"><?= $playlist->name; ?></option>
|
||||
<?php endforeach; ?>
|
||||
</select>
|
||||
<button type="submit">Ajouter à la playlist</button>
|
||||
</form>
|
||||
</header>
|
||||
</article>
|
||||
</div>
|
||||
<?php endforeach; ?>
|
||||
</section>
|
Reference in New Issue
Block a user