début création playlist
This commit is contained in:
parent
b5bb88c8da
commit
2461971a24
@ -33,4 +33,18 @@ class Playlist extends CI_Controller {
|
||||
$delete = $this->model_music->deletePlaylist($playlist_id);
|
||||
redirect('playlist');
|
||||
}
|
||||
|
||||
public function MenuCreate() {
|
||||
//$this->load->view('layout/header_album');
|
||||
$this->load->view('create_playlist');
|
||||
}
|
||||
|
||||
public function createPlaylistController() {
|
||||
$name_playlist = $this->input->post('name_playlist');
|
||||
$create = $this->model_music->createPlaylist($name_playlist);
|
||||
redirect('playlist');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
@ -49,6 +49,14 @@ class Model_music extends CI_Model {
|
||||
);
|
||||
}
|
||||
|
||||
public function createPlaylist($name_playlist){
|
||||
$name_playlist_escaped = $this->db->escape($name_playlist);
|
||||
$query = $this->db->query(
|
||||
"INSERT INTO playlist VALUES (1, $name_playlist_escaped);
|
||||
"
|
||||
);
|
||||
}
|
||||
|
||||
public function getSongOfPlaylist($playlist_id){
|
||||
$query = $this->db->query(
|
||||
"SELECT SongPlaylist.name
|
||||
|
10
ci/application/views/create_playlist.php
Normal file
10
ci/application/views/create_playlist.php
Normal file
@ -0,0 +1,10 @@
|
||||
<h5>Créer une nouvelle Playlist</h5>
|
||||
<?php
|
||||
|
||||
?>
|
||||
|
||||
<form action="<?= base_url('index.php/playlist/createPlaylistController') ?>" method="post">
|
||||
<label for="name_playlist">Nom de la Playlist:</label>
|
||||
<input type="text" name="name_playlist" id="name_playlist" required>
|
||||
<button type="submit" name="submit">Créer</button>
|
||||
</form>
|
@ -1,5 +1,10 @@
|
||||
<h5>Playlist List</h5>
|
||||
<?php
|
||||
|
||||
echo "<form action='" . base_url("index.php/playlist/MenuCreate/") . "' method='post'>";
|
||||
echo "<button type='Créer Playlist'>Create</button>";
|
||||
echo "</form>";
|
||||
|
||||
foreach($playlists as $playlist){
|
||||
echo "<div><article>";
|
||||
echo "<header class='short-text'>";
|
||||
|
Loading…
Reference in New Issue
Block a user