From 487c7c828300ba0c0f3fc5870f883c846320dd41 Mon Sep 17 00:00:00 2001 From: stiti Date: Wed, 22 May 2024 23:26:06 +0200 Subject: [PATCH] =?UTF-8?q?Commit=20de=20Moncef=20:=20Ajout=20de=20foncito?= =?UTF-8?q?nnalit=C3=A9s?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../application/config/routes.php | 3 ++ .../controllers/MentionsLegales.php | 17 ++++++ .../application/controllers/Search.php | 33 ++++++++++++ .../application/models/Search_model.php | 49 +++++++++++++++++ .../application/views/album_view.php | 2 +- .../application/views/albums_list.php | 2 +- .../application/views/artiste_details.php | 2 +- .../application/views/layout/footer_dark.php | 2 +- .../views/layout/header_not_logged_dark.php | 54 +++++++++++-------- .../application/views/mentions-legals.php | 42 +++++++++++++++ .../application/views/search_results.php | 52 ++++++++++++++++++ .../assets/css/header_not_logged_dark.css | 25 +++++++++ .../assets/css/mention-legals.css | 31 +++++++++++ 13 files changed, 288 insertions(+), 26 deletions(-) create mode 100644 CodeIgniter-3.1.13/application/controllers/MentionsLegales.php create mode 100644 CodeIgniter-3.1.13/application/controllers/Search.php create mode 100644 CodeIgniter-3.1.13/application/models/Search_model.php create mode 100644 CodeIgniter-3.1.13/application/views/mentions-legals.php create mode 100644 CodeIgniter-3.1.13/application/views/search_results.php create mode 100644 CodeIgniter-3.1.13/assets/css/mention-legals.css diff --git a/CodeIgniter-3.1.13/application/config/routes.php b/CodeIgniter-3.1.13/application/config/routes.php index db535f9..7616e69 100644 --- a/CodeIgniter-3.1.13/application/config/routes.php +++ b/CodeIgniter-3.1.13/application/config/routes.php @@ -55,5 +55,8 @@ $route['translate_uri_dashes'] = FALSE; $route['albums'] = 'albums/index'; $route['musiques'] = 'Musiques/index'; $route['artiste/(:num)'] = 'artiste/index/$1'; +$route['search'] = 'search/index'; +$route['mentions-legals'] = 'MentionsLegales/index'; + diff --git a/CodeIgniter-3.1.13/application/controllers/MentionsLegales.php b/CodeIgniter-3.1.13/application/controllers/MentionsLegales.php new file mode 100644 index 0000000..2e84b0c --- /dev/null +++ b/CodeIgniter-3.1.13/application/controllers/MentionsLegales.php @@ -0,0 +1,17 @@ +load->helper('url'); + } + + public function index() + { + $this->load->view('layout/header_not_logged_dark'); + $this->load->view('mentions-legals'); + $this->load->view('layout/footer_dark'); + } +} diff --git a/CodeIgniter-3.1.13/application/controllers/Search.php b/CodeIgniter-3.1.13/application/controllers/Search.php new file mode 100644 index 0000000..122d87a --- /dev/null +++ b/CodeIgniter-3.1.13/application/controllers/Search.php @@ -0,0 +1,33 @@ +load->model('Search_model'); + $this->load->helper('url'); + } + + public function index(){ + // Récupérer la requête de recherche depuis la barre de recherche + $query = $this->input->get('query'); + + // Faire une recherche dans les musiques, les albums, les genres et les artistes + $musiques = $this->Search_model->searchMusiques($query); + $albums = $this->Search_model->searchAlbums($query); + $genres = $this->Search_model->searchGenres($query); + $artistes = $this->Search_model->searchArtistes($query); + + // Charger la vue avec les résultats de la recherche + $data['query'] = $query; + $data['musiques'] = $musiques; + $data['albums'] = $albums; + $data['genres'] = $genres; + $data['artistes'] = $artistes; + + $this->load->view('layout/header_not_logged_dark'); + $this->load->view('search_results', $data); + $this->load->view('layout/footer_dark'); + } +} \ No newline at end of file diff --git a/CodeIgniter-3.1.13/application/models/Search_model.php b/CodeIgniter-3.1.13/application/models/Search_model.php new file mode 100644 index 0000000..7e8fb61 --- /dev/null +++ b/CodeIgniter-3.1.13/application/models/Search_model.php @@ -0,0 +1,49 @@ +load->database(); + } + + public function searchMusiques($query){ + $sql = "SELECT song.id, song.name, artist.id as artist_id, artist.name as artistName, album.name as album_name, track.albumid as album_id, cover.jpeg as cover + FROM song + JOIN track ON song.id = track.songid + JOIN album ON track.albumid = album.id + JOIN artist ON album.artistid = artist.id + JOIN cover ON album.coverid = cover.id + WHERE song.name LIKE '%$query%' + ORDER BY song.name ASC"; + + $query = $this->db->query($sql); + return $query->result(); + } + + public function searchAlbums($query){ + $sql = "SELECT album.id, album.name, album.year, artist.name as artistName, genre.name as genreName, cover.jpeg + FROM album + JOIN artist ON album.artistid = artist.id + JOIN genre ON album.genreid = genre.id + JOIN cover ON album.coverid = cover.id + WHERE album.name LIKE '%$query%' + ORDER BY album.name ASC"; + + $query = $this->db->query($sql); + return $query->result(); + } + + public function searchGenres($query){ + $sql = "SELECT id, name FROM genre WHERE name LIKE '%$query%' ORDER BY name ASC"; + $query = $this->db->query($sql); + return $query->result(); + } + + public function searchArtistes($query){ + $sql = "SELECT id, name FROM artist WHERE name LIKE '%$query%' ORDER BY name ASC"; + $query = $this->db->query($sql); + return $query->result(); + } +} diff --git a/CodeIgniter-3.1.13/application/views/album_view.php b/CodeIgniter-3.1.13/application/views/album_view.php index 9098954..c955725 100644 --- a/CodeIgniter-3.1.13/application/views/album_view.php +++ b/CodeIgniter-3.1.13/application/views/album_view.php @@ -3,7 +3,7 @@ - + <?php echo $album->name; ?> - Details diff --git a/CodeIgniter-3.1.13/application/views/albums_list.php b/CodeIgniter-3.1.13/application/views/albums_list.php index f635965..dfd45c4 100644 --- a/CodeIgniter-3.1.13/application/views/albums_list.php +++ b/CodeIgniter-3.1.13/application/views/albums_list.php @@ -3,7 +3,7 @@ - + Albums - Onzeur diff --git a/CodeIgniter-3.1.13/application/views/artiste_details.php b/CodeIgniter-3.1.13/application/views/artiste_details.php index 4fbf358..c3461a7 100644 --- a/CodeIgniter-3.1.13/application/views/artiste_details.php +++ b/CodeIgniter-3.1.13/application/views/artiste_details.php @@ -3,7 +3,7 @@ - + Détails de l'artiste <?php echo $artiste->name; ?> diff --git a/CodeIgniter-3.1.13/application/views/layout/footer_dark.php b/CodeIgniter-3.1.13/application/views/layout/footer_dark.php index 2f7e333..7be684d 100644 --- a/CodeIgniter-3.1.13/application/views/layout/footer_dark.php +++ b/CodeIgniter-3.1.13/application/views/layout/footer_dark.php @@ -15,7 +15,7 @@ Youtube