From 611587f7a0ee2ff432f37a7ecee7057d4ee0c6f0 Mon Sep 17 00:00:00 2001 From: orfao Date: Thu, 23 May 2024 14:33:23 +0200 Subject: [PATCH] =?UTF-8?q?=20ajout=20d'un=20header=20post=20connexion=20+?= =?UTF-8?q?=20adaptation=20des=20diff=C3=A9rents=20controllers=20+=20cr?= =?UTF-8?q?=C3=A9ations=20de=20fichiers=20temporaires?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../application/config/config.php | 2 +- .../application/controllers/Albums.php | 33 ++++++++++++---- .../application/controllers/Artiste.php | 33 +++++++++++++--- .../application/controllers/Home.php | 19 +++++++-- .../controllers/MentionsLegales.php | 16 ++++++-- .../application/controllers/Musiques.php | 15 +++++-- .../application/controllers/Search.php | 32 +++++++++++---- .../application/controllers/Utilisateur.php | 4 ++ .../application/controllers/temporaire.php | 7 ++++ .../application/views/layout/header_dark.php | 9 +++++ .../views/layout/header_logged_dark.php | 39 +++++++++++++++++++ .../views/layout/header_not_logged_dark.php | 14 +------ 12 files changed, 181 insertions(+), 42 deletions(-) create mode 100644 CodeIgniter-3.1.13/application/controllers/temporaire.php create mode 100644 CodeIgniter-3.1.13/application/views/layout/header_dark.php create mode 100644 CodeIgniter-3.1.13/application/views/layout/header_logged_dark.php diff --git a/CodeIgniter-3.1.13/application/config/config.php b/CodeIgniter-3.1.13/application/config/config.php index df7c320..3bc1dcf 100644 --- a/CodeIgniter-3.1.13/application/config/config.php +++ b/CodeIgniter-3.1.13/application/config/config.php @@ -23,7 +23,7 @@ defined('BASEPATH') OR exit('No direct script access allowed'); | a PHP script and you can easily do that on your own. | */ -$config['base_url'] = '/~stiti/SAE_2.02/CodeIgniter-3.1.13'; +$config['base_url'] = '/~orfao/SAE/SAE_2.02/CodeIgniter-3.1.13'; /* |-------------------------------------------------------------------------- diff --git a/CodeIgniter-3.1.13/application/controllers/Albums.php b/CodeIgniter-3.1.13/application/controllers/Albums.php index 566a62b..de1d97c 100644 --- a/CodeIgniter-3.1.13/application/controllers/Albums.php +++ b/CodeIgniter-3.1.13/application/controllers/Albums.php @@ -32,19 +32,38 @@ class Albums extends CI_Controller { // Récupérer les genres et les artistes pour les filtres $data['genres'] = $this->model_music->getGenres(); $data['artists'] = $this->model_music->getArtists(); - - $this->load->view('layout/header_not_logged_dark'); - $this->load->view('albums_list', $data); - $this->load->view('layout/footer_dark'); + + include 'temporaire.php'; + if($logged == true){ + $this->load->view('layout/header_dark'); + $this->load->view('layout/header_logged_dark'); + $this->load->view('albums_list', $data); + $this->load->view('layout/footer_dark'); + } else { + $this->load->view('layout/header_dark'); + $this->load->view('layout/header_not_logged_dark'); + $this->load->view('albums_list', $data); + $this->load->view('layout/footer_dark'); + } } public function view($id){ $album = $this->model_music->get_album_by_id($id); $data['album'] = $album; - $this->load->view('layout/header_not_logged_dark'); - $this->load->view('album_view', $data); - $this->load->view('layout/footer_dark'); + include 'temporaire.php'; + if($logged == true){ + $this->load->view('layout/header_dark'); + $this->load->view('layout/header_logged_dark'); + $this->load->view('album_view', $data); + $this->load->view('layout/footer_dark'); + } else { + $this->load->view('layout/header_dark'); + $this->load->view('layout/header_not_logged_dark'); + $this->load->view('album_view', $data); + $this->load->view('layout/footer_dark'); + } } + } ?> diff --git a/CodeIgniter-3.1.13/application/controllers/Artiste.php b/CodeIgniter-3.1.13/application/controllers/Artiste.php index abcb9f5..4916312 100644 --- a/CodeIgniter-3.1.13/application/controllers/Artiste.php +++ b/CodeIgniter-3.1.13/application/controllers/Artiste.php @@ -24,9 +24,20 @@ class Artiste extends CI_Controller { $data['artiste'] = $artiste; $data['albums'] = $albums; $data['mostUsedGenre'] = $mostUsedGenre; // Passer $mostUsedGenre à la vue - $this->load->view('layout/header_not_logged_dark'); - $this->load->view('artiste_details', $data); - $this->load->view('layout/footer_dark'); + + include 'temporaire.php'; + if($logged == true){ + $this->load->view('layout/header_dark'); + $this->load->view('layout/header_logged_dark'); + $this->load->view('artists_list', $data); + $this->load->view('layout/footer_dark'); + } else { + $this->load->view('layout/header_dark'); + $this->load->view('layout/header_not_logged_dark'); + $this->load->view('artists_list', $data); + $this->load->view('layout/footer_dark'); + } + } else { // Gérer le cas où l'artiste n'est pas trouvé == afficher un error 404 show_404(); @@ -44,9 +55,19 @@ class Artiste extends CI_Controller { // Charger la vue avec la liste des artistes $data['artists'] = $artists; $data['current_order'] = $order; - $this->load->view('layout/header_not_logged_dark'); - $this->load->view('artists_list', $data); - $this->load->view('layout/footer_dark'); + + include 'temporaire.php'; + if($logged == true){ + $this->load->view('layout/header_dark'); + $this->load->view('layout/header_logged_dark'); + $this->load->view('artists_list', $data); + $this->load->view('layout/footer_dark'); + } else { + $this->load->view('layout/header_dark'); + $this->load->view('layout/header_not_logged_dark'); + $this->load->view('artists_list', $data); + $this->load->view('layout/footer_dark'); + } } } ?> diff --git a/CodeIgniter-3.1.13/application/controllers/Home.php b/CodeIgniter-3.1.13/application/controllers/Home.php index 5802789..35afd61 100644 --- a/CodeIgniter-3.1.13/application/controllers/Home.php +++ b/CodeIgniter-3.1.13/application/controllers/Home.php @@ -2,6 +2,9 @@ class Home extends CI_Controller { public function index() { + + + // Charger le modèle $this->load->model('Cover_model'); @@ -13,9 +16,19 @@ public function index() { $data['covers'] = $this->Cover_model->get_covers(); // Charger la vue avec les données récupérées - $this->load->view('layout/header_not_logged_dark'); - $this->load->view('accueil', $data); - $this->load->view('layout/footer_dark'); + + include 'temporaire.php'; + if($logged == true){ + $this->load->view('layout/header_dark'); + $this->load->view('layout/header_logged_dark'); + $this->load->view('accueil', $data); + $this->load->view('layout/footer_dark'); + } else { + $this->load->view('layout/header_dark'); + $this->load->view('layout/header_not_logged_dark'); + $this->load->view('accueil', $data); + $this->load->view('layout/footer_dark'); + } } } ?> \ No newline at end of file diff --git a/CodeIgniter-3.1.13/application/controllers/MentionsLegales.php b/CodeIgniter-3.1.13/application/controllers/MentionsLegales.php index bb12647..24c7476 100644 --- a/CodeIgniter-3.1.13/application/controllers/MentionsLegales.php +++ b/CodeIgniter-3.1.13/application/controllers/MentionsLegales.php @@ -11,8 +11,18 @@ class MentionsLegales extends CI_Controller { public function index() { - $this->load->view('layout/header_not_logged_dark'); - $this->load->view('mentions-legals'); - $this->load->view('layout/footer_dark'); + include 'temporaire.php'; + if($logged == true){ + $this->load->view('layout/header_dark'); + $this->load->view('layout/header_logged_dark'); + $this->load->view('mentions-legals'); + $this->load->view('layout/footer_dark'); + } else { + $this->load->view('layout/header_dark'); + $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/Musiques.php b/CodeIgniter-3.1.13/application/controllers/Musiques.php index 60e9e46..67d74c2 100644 --- a/CodeIgniter-3.1.13/application/controllers/Musiques.php +++ b/CodeIgniter-3.1.13/application/controllers/Musiques.php @@ -37,9 +37,18 @@ class Musiques extends CI_Controller { $data['sort'] = $sort; // Passer la valeur de tri à la vue // Charger la vue - $this->load->view('layout/header_not_logged_dark'); - $this->load->view('musiques_list', $data); - $this->load->view('layout/footer_dark'); + include 'temporaire.php'; + if($logged == true){ + $this->load->view('layout/header_dark'); + $this->load->view('layout/header_logged_dark'); + $this->load->view('musiques_list', $data); + $this->load->view('layout/footer_dark'); + } else { + $this->load->view('layout/header_dark'); + $this->load->view('layout/header_not_logged_dark'); + $this->load->view('musiques_list', $data); + $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 index 579a1e4..fa46fe9 100644 --- a/CodeIgniter-3.1.13/application/controllers/Search.php +++ b/CodeIgniter-3.1.13/application/controllers/Search.php @@ -13,6 +13,7 @@ class Search extends CI_Controller { public function index(){ // Récupérer la requête de recherche depuis la barre de recherche $query = $this->input->get('query'); + include 'temporaire.php'; // Vérifier que la requête de recherche n'est pas vide if (empty($query)) { @@ -24,9 +25,18 @@ class Search extends CI_Controller { $data['artistes'] = []; $data['error'] = "La requête de recherche ne peut pas être vide."; - $this->load->view('layout/header_not_logged_dark'); - $this->load->view('search_results', $data); - $this->load->view('layout/footer_dark'); + + if($logged == true){ + $this->load->view('layout/header_dark'); + $this->load->view('layout/header_logged_dark'); + $this->load->view('search_results', $data); + $this->load->view('layout/footer_dark'); + } else { + $this->load->view('layout/header_dark'); + $this->load->view('layout/header_not_logged_dark'); + $this->load->view('search_results', $data); + $this->load->view('layout/footer_dark'); + } return; } @@ -42,9 +52,17 @@ class Search extends CI_Controller { $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'); + + if($logged == true){ + $this->load->view('layout/header_dark'); + $this->load->view('layout/header_logged_dark'); + $this->load->view('search_results', $data); + $this->load->view('layout/footer_dark'); + } else { + $this->load->view('layout/header_dark'); + $this->load->view('layout/header_not_logged_dark'); + $this->load->view('search_results', $data); + $this->load->view('layout/footer_dark'); + } } } diff --git a/CodeIgniter-3.1.13/application/controllers/Utilisateur.php b/CodeIgniter-3.1.13/application/controllers/Utilisateur.php index 9c0febf..b6372ee 100644 --- a/CodeIgniter-3.1.13/application/controllers/Utilisateur.php +++ b/CodeIgniter-3.1.13/application/controllers/Utilisateur.php @@ -21,6 +21,7 @@ class Utilisateur extends CI_Controller { if ($this->form_validation->run() == FALSE) { // Charger la vue avec les erreurs + $this->load->view('layout/header_dark'); $this->load->view('layout/header_not_logged_dark'); $this->load->view('inscription'); $this->load->view('layout/footer_dark'); @@ -40,6 +41,7 @@ class Utilisateur extends CI_Controller { redirect('utilisateur/connexion'); } else { $data['error'] = 'Une erreur est survenue. Veuillez réessayer.'; + $this->load->view('layout/header_dark'); $this->load->view('layout/header_not_logged_dark'); $this->load->view('inscription', $data); $this->load->view('layout/footer_dark'); @@ -54,6 +56,7 @@ class Utilisateur extends CI_Controller { if ($this->form_validation->run() == FALSE) { // Charger la vue avec les erreurs + $this->load->view('layout/header_dark'); $this->load->view('layout/header_not_logged_dark'); $this->load->view('connexion'); $this->load->view('layout/footer_dark'); @@ -71,6 +74,7 @@ class Utilisateur extends CI_Controller { redirect('dashboard'); } else { $data['error'] = 'Email ou mot de passe incorrect.'; + $this->load->view('layout/header_dark'); $this->load->view('layout/header_not_logged_dark'); $this->load->view('connexion', $data); $this->load->view('layout/footer_dark'); diff --git a/CodeIgniter-3.1.13/application/controllers/temporaire.php b/CodeIgniter-3.1.13/application/controllers/temporaire.php new file mode 100644 index 0000000..73c3e20 --- /dev/null +++ b/CodeIgniter-3.1.13/application/controllers/temporaire.php @@ -0,0 +1,7 @@ + \ No newline at end of file diff --git a/CodeIgniter-3.1.13/application/views/layout/header_dark.php b/CodeIgniter-3.1.13/application/views/layout/header_dark.php new file mode 100644 index 0000000..cbb033d --- /dev/null +++ b/CodeIgniter-3.1.13/application/views/layout/header_dark.php @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/CodeIgniter-3.1.13/application/views/layout/header_logged_dark.php b/CodeIgniter-3.1.13/application/views/layout/header_logged_dark.php new file mode 100644 index 0000000..851f0ad --- /dev/null +++ b/CodeIgniter-3.1.13/application/views/layout/header_logged_dark.php @@ -0,0 +1,39 @@ +
+ +
+ + + diff --git a/CodeIgniter-3.1.13/application/views/layout/header_not_logged_dark.php b/CodeIgniter-3.1.13/application/views/layout/header_not_logged_dark.php index df8a1f1..3166b6e 100644 --- a/CodeIgniter-3.1.13/application/views/layout/header_not_logged_dark.php +++ b/CodeIgniter-3.1.13/application/views/layout/header_not_logged_dark.php @@ -1,17 +1,8 @@ - - - - - - - - -