ajout d'un header post connexion + adaptation des différents controllers + créations de fichiers temporaires

This commit is contained in:
Marco ORFAO 2024-05-23 14:33:23 +02:00
parent deca6ccb93
commit 611587f7a0
12 changed files with 181 additions and 42 deletions

View File

@ -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';
/*
|--------------------------------------------------------------------------

View File

@ -33,18 +33,37 @@ class Albums extends CI_Controller {
$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');
}
}
}
?>

View File

@ -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');
}
}
}
?>

View File

@ -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');
}
}
}
?>

View File

@ -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');
}
}
}

View File

@ -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');
}
}
}

View File

@ -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;
}
@ -43,8 +53,16 @@ class Search extends CI_Controller {
$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');
}
}
}

View File

@ -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');

View File

@ -0,0 +1,7 @@
<?php
// ####### Temporaire ########
$logged = false;
?>

View File

@ -0,0 +1,9 @@
<!DOCTYPE html>
<html lang="fr">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<?=link_tag('assets/css/header_not_logged_dark')?>
<?=link_tag('assets/img/Logo_ONZEUR.png')?>
<?=link_tag('assets/css/footer_dark.css')?>
</head>

View File

@ -0,0 +1,39 @@
<header class="header">
<div class="header-content">
<div class="logo">
<a href="<?php echo site_url('home'); ?>">
<?= img(array('src' => 'assets/img/Logo_ONZEUR_DARK.png', 'alt' =>'logo')); ?>
</a>
</div>
<nav class="nav">
<div class="nav-buttons">
<form action="<?php echo site_url('search'); ?>" method="get" class="search-form">
<input type="text" name="query" placeholder="Recherche...">
<button type="submit">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="white" width="15px" height="15px">
<path d="M0 0h24v24H0z" fill="none"/>
<path d="M15.5 14h-.79l-.28-.27a6.5 6.5 0 0 0 1.48-5.34c-.47-2.78-2.94-5-5.75-5.34a6.505 6.505 0 0 0-7.27 7.27c.34 2.81 2.56 5.28 5.34 5.75a6.5 6.5 0 0 0 5.34-1.48l.27.28v.79l4.25 4.25c.41.41 1.08.41 1.49 0 .41-.41.41-1.08 0-1.49L15.5 14zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14z"/>
</svg>
</button>
</form>
<a href="<?php echo site_url('albums'); ?>" class="btn-albums">Albums</a>
<a href="<?php echo site_url('artiste/list_artists'); ?>" class="btn-artistes">Artistes</a>
<a href="<?php echo site_url('musiques'); ?>" class="btn-musiques">Musiques</a>
<a href="#PlaylistBIENTOT" class="btn-playlist">Mes Playlists</a>
<a href="#CompteBIENTOT" class="btn-MonCompte">Mon compte</a>
</div>
</nav>
<div class="menu-toggle">
<span></span>
<span></span>
<span></span>
</div>
</div>
</header>
<script>
document.querySelector('.menu-toggle').addEventListener('click', function() {
document.querySelector('.nav-buttons').classList.toggle('active');
});
</script>

View File

@ -1,17 +1,8 @@
<!DOCTYPE html>
<html lang="fr">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<?=link_tag('assets/css/header_not_logged_dark')?>
<?=link_tag('assets/img/Logo_ONZEUR.png')?>
<?=link_tag('assets/css/footer_dark.css')?>
</head>
<header class="header">
<div class="header-content">
<div class="logo">
<a href="<?php echo site_url('home'); ?>">
<?=img('assets/img/Logo_ONZEUR_DARK.png');?>
<?= img(array('src' => 'assets/img/Logo_ONZEUR_DARK.png', 'alt' =>'logo')); ?>
</a>
</div>
<nav class="nav">
@ -46,4 +37,3 @@
document.querySelector('.nav-buttons').classList.toggle('active');
});
</script>
</html>