barre de recherche
This commit is contained in:
parent
a1b797a1c5
commit
ffd3f5dd39
@ -9,32 +9,30 @@ class Albums extends CI_Controller {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public function index(){
|
public function index(){
|
||||||
$selectedGenre = '0'; // Valeur par défaut pour le genre si aucun n'est sélectionné
|
$genre = $this->model_music->getGenre();
|
||||||
if ($_SERVER["REQUEST_METHOD"] == "POST") {
|
|
||||||
if(isset($_POST['Genre'])){
|
|
||||||
$selectedGenre = $_POST['Genre'];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
$albums = $this->model_music->getAlbums($selectedGenre);
|
|
||||||
$playlists = $this->model_music->getPlaylist();
|
|
||||||
$this->load->view('layout/header');
|
$this->load->view('layout/header');
|
||||||
$this->load->view('albums_list', ['albums' => $albums, 'playlists' => $playlists]);
|
$this->load->view('GenreFilter',['genre'=>$genre]);
|
||||||
$this->load->view('layout/footer');
|
|
||||||
|
|
||||||
$selectedGenre = '0';
|
$selectedGenre = '0';
|
||||||
$search = '';
|
$search = '';
|
||||||
if ($_SERVER["REQUEST_METHOD"] == "POST") {
|
if ($_SERVER["REQUEST_METHOD"] == "POST") {
|
||||||
if(isset($_POST['Genre'])){
|
if(isset($_POST['Genre'])){
|
||||||
$selectedGenre = $_POST['Genre'];
|
$selectedGenre = $_POST['Genre'];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ($_SERVER["REQUEST_METHOD"] == "POST") {
|
if ($_SERVER["REQUEST_METHOD"] == "POST") {
|
||||||
if(isset($_POST['recherche'])){
|
if(isset($_POST['recherche'])){
|
||||||
$search = $_POST['recherche'];
|
$search = $_POST['recherche'];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
$playlists = $this->model_music->getPlaylist();
|
||||||
|
$albums = $this->model_music->searchAlbums($search, $selectedGenre);
|
||||||
|
$this->load->view('albums_list', ['albums' => $albums, 'playlists' => $playlists]);
|
||||||
|
$this->load->view('layout/footer');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public function view($album_id){
|
public function view($album_id){
|
||||||
$songs = $this->model_music->getSongOfAlbum($album_id);
|
$songs = $this->model_music->getSongOfAlbum($album_id);
|
||||||
if (empty($songs)) {
|
if (empty($songs)) {
|
||||||
|
@ -1,12 +1,15 @@
|
|||||||
<form method="post" action="albums">
|
<form method="post" action="albums">
|
||||||
<?php
|
<?php
|
||||||
|
echo "<br>";
|
||||||
|
echo "<br>";
|
||||||
|
echo "<br>";
|
||||||
echo "<select id='GenreId' name='Genre'>";
|
echo "<select id='GenreId' name='Genre'>";
|
||||||
echo "<option value='0'>Select genre</option>";
|
echo "<option value='0'>Select genre</option>";
|
||||||
foreach($genre as $genre) {
|
foreach($genre as $genre) {
|
||||||
echo "<option value='{$genre->id}'>{$genre->name}</option>";
|
echo "<option value='{$genre->id}'>{$genre->name}</option>";
|
||||||
}
|
}
|
||||||
echo "</select>";
|
echo "</select>";
|
||||||
echo"<form class'search-bar' action='/search' method='post'>";
|
echo"<form class'search-bar' action='/search' method='post'>";
|
||||||
echo"<input type'search' name='recherche' placeholder='Search...'>";
|
echo"<input type'search' name='recherche' placeholder='Search...'>";
|
||||||
?>
|
?>
|
||||||
<button type="submit">Submit</button>
|
<button type="submit">Submit</button>
|
||||||
|
Loading…
Reference in New Issue
Block a user