playlist suite

This commit is contained in:
Wilfried BRIGITTE 2024-06-03 15:02:52 +02:00
parent f1638ed865
commit 0e5002ce82
4 changed files with 57 additions and 1 deletions

View File

@ -14,4 +14,18 @@ class Playlist extends CI_Controller {
$this->load->view('playlist_list', ['playlists' => $playlists]); $this->load->view('playlist_list', ['playlists' => $playlists]);
//$this->load->view('layout/footer_album'); //$this->load->view('layout/footer_album');
} }
public function view(){
$playlists = $this->model_music->deletePlaylist();
//$this->load->view('layout/header_album');
$this->load->view('playlist_list', ['playlists' => $playlists]);
//$this->load->view('layout/footer_album');
}
public function SongPLaylist($playlist_id){
$songPlaylists = $this->model_music->getSongOfPlaylist($playlist_id);
//$this->load->view('layout/header_album');
$this->load->view('song_playlist', ['songPlaylists' => $songPlaylists]);
//$this->load->view('layout/footer_album');
}
} }

View File

@ -38,6 +38,27 @@ class Model_music extends CI_Model {
return $query->result(); return $query->result();
} }
public function deletePlaylist(){
$query = $this->db->query(
"SELECT playlist.id, playlist.name
FROM playlist
Group by playlist.id
"
);
return $query->result();
}
public function getSongOfPlaylist($playlist_id){
$query = $this->db->query(
"SELECT SongPlaylist.name
FROM SongPlaylist
WHERE $playlist_id = SongPlaylist.id;
"
);
return $query->result();
}
public function getSongOfAlbum($album_id){ public function getSongOfAlbum($album_id){
$query = $this->db->query( $query = $this->db->query(
"SELECT song.id, song.name "SELECT song.id, song.name

View File

@ -3,7 +3,14 @@
foreach($playlists as $playlist){ foreach($playlists as $playlist){
echo "<div><article>"; echo "<div><article>";
echo "<header class='short-text'>"; echo "<header class='short-text'>";
echo anchor("playlists/view/{$playlist->id}","{$playlist->name}"); echo anchor("playlist/SongPLaylist/{$playlist->id}","{$playlist->name}");
//bouton supprimer playlist
echo "<form action='".site_url('playlist/view')."' method='post'style='display:inline;'>";
echo "<input type='hidden' name='playlist_id' value='{$playlist->id}'>";
echo "<button type='submit'>Supprimer PLaylistn</button>";
echo "</form>";
echo "<br>"; echo "<br>";
echo "</header>"; echo "</header>";
echo "</article></div>"; echo "</article></div>";

View File

@ -0,0 +1,14 @@
<h5>Song of the playlist</h5>
<section class="list">
<?php
foreach($songPlaylists as $songPlaylist){
echo "<div><article>";
echo "<header class='short-text'>";
echo "{$songPlaylist->name}";
echo "<br>";
echo "</header>";
echo "</article></div>";
}
?>
</section>