playlist suite
This commit is contained in:
parent
f1638ed865
commit
0e5002ce82
@ -14,4 +14,18 @@ class Playlist extends CI_Controller {
|
||||
$this->load->view('playlist_list', ['playlists' => $playlists]);
|
||||
//$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');
|
||||
}
|
||||
}
|
@ -38,6 +38,27 @@ class Model_music extends CI_Model {
|
||||
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){
|
||||
$query = $this->db->query(
|
||||
"SELECT song.id, song.name
|
||||
|
@ -3,7 +3,14 @@
|
||||
foreach($playlists as $playlist){
|
||||
echo "<div><article>";
|
||||
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 "</header>";
|
||||
echo "</article></div>";
|
||||
|
14
ci/application/views/song_playlist.php
Normal file
14
ci/application/views/song_playlist.php
Normal 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>
|
Loading…
Reference in New Issue
Block a user