Commit de Moncef : Ajout de foncitonnalités

This commit is contained in:
stiti 2024-05-22 23:26:06 +02:00
parent 6948cc21ab
commit 487c7c8283
13 changed files with 288 additions and 26 deletions

View File

@ -55,5 +55,8 @@ $route['translate_uri_dashes'] = FALSE;
$route['albums'] = 'albums/index'; $route['albums'] = 'albums/index';
$route['musiques'] = 'Musiques/index'; $route['musiques'] = 'Musiques/index';
$route['artiste/(:num)'] = 'artiste/index/$1'; $route['artiste/(:num)'] = 'artiste/index/$1';
$route['search'] = 'search/index';
$route['mentions-legals'] = 'MentionsLegales/index';

View File

@ -0,0 +1,17 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
class MentionsLegales extends CI_Controller {
public function __construct(){
parent::__construct();
$this->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');
}
}

View File

@ -0,0 +1,33 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
class Search extends CI_Controller {
public function __construct(){
parent::__construct();
$this->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');
}
}

View File

@ -0,0 +1,49 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
class Search_model extends CI_Model {
public function __construct(){
parent::__construct();
$this->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();
}
}

View File

@ -3,7 +3,7 @@
<head> <head>
<meta charset="UTF-8"> <meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="<?php echo base_url('assets/css/album_view.css'); ?>"> <link rel="stylesheet" href="<?php echo base_url('assets/css/album_view'); ?>">
<title><?php echo $album->name; ?> - Details</title> <title><?php echo $album->name; ?> - Details</title>
</head> </head>
<body> <body>

View File

@ -3,7 +3,7 @@
<head> <head>
<meta charset="UTF-8"> <meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="<?php echo base_url('assets/css/style.css'); ?>"> <link rel="stylesheet" href="<?php echo base_url('assets/css/style'); ?>">
<link rel="icon" type="image/x-icon" href="<?php echo base_url('assets/img/Logo_ONZEUR.png'); ?>"> <link rel="icon" type="image/x-icon" href="<?php echo base_url('assets/img/Logo_ONZEUR.png'); ?>">
<title>Albums - Onzeur</title> <title>Albums - Onzeur</title>
</head> </head>

View File

@ -3,7 +3,7 @@
<head> <head>
<meta charset="UTF-8"> <meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="<?php echo base_url('assets/css/artiste_details.css'); ?>"> <link rel="stylesheet" href="<?php echo base_url('assets/css/artiste_details'); ?>">
<title>Détails de l'artiste <?php echo $artiste->name; ?></title> <title>Détails de l'artiste <?php echo $artiste->name; ?></title>
</head> </head>
<body> <body>

View File

@ -15,7 +15,7 @@
<a href="https://www.youtube.com" class="social-icon"><img src="<?php echo base_url('assets/img/reseaux_sociaux/youtube.png'); ?>" alt="Youtube"></a> <a href="https://www.youtube.com" class="social-icon"><img src="<?php echo base_url('assets/img/reseaux_sociaux/youtube.png'); ?>" alt="Youtube"></a>
</div> </div>
<div class="legal"> <div class="legal">
<a href="#" class="legal-link">Mentions légales</a> <a href="<?php echo site_url('MentionsLegales'); ?>" class="legal-link">Mentions légales</a>
<span>|</span> <span>|</span>
<span>© 2024 Onzeur</span> <span>© 2024 Onzeur</span>
<span>|</span> <span>|</span>

View File

@ -16,6 +16,15 @@
</div> </div>
<nav class="nav"> <nav class="nav">
<div class="nav-buttons"> <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('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('artiste/list_artists'); ?>" class="btn-artistes">Artistes</a>
<a href="<?php echo site_url('musiques'); ?>" class="btn-musiques">Musiques</a> <a href="<?php echo site_url('musiques'); ?>" class="btn-musiques">Musiques</a>
@ -31,6 +40,7 @@
</div> </div>
</header> </header>
<script> <script>
document.querySelector('.menu-toggle').addEventListener('click', function() { document.querySelector('.menu-toggle').addEventListener('click', function() {
document.querySelector('.nav-buttons').classList.toggle('active'); document.querySelector('.nav-buttons').classList.toggle('active');

View File

@ -0,0 +1,42 @@
<!DOCTYPE html>
<html lang="fr">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="<?php echo base_url('assets/css/mention-legals'); ?>">
<title>Mentions Légales</title>
</head>
<body>
<header>
<h1>Mentions Légales</h1>
</header>
<main>
<section>
<h2>1. Informations sur l'éditeur du site</h2>
<p>Ce site web est une "parodie" du site web de Deezer. Il a été réalisé dans le cadre d'un projet scolaire et n'est en aucun cas lié à une activité commerciale ou autre type.</p>
<p>Adresse de l'école : IUT de Fontainebleau - Route Hurtault, 77300 Fontainebleau, France</p>
<p>Noms des étudiants : Moncef STITI, Marco ORFAO et Louay DARDOURI</p>
<p>Email du chef de projet : <a href="mailto:moncef.stiti@etu.u-pec.fr">moncef.stiti@etu.u-pec.fr</a></p>
</section>
<section>
<h2>2. Directeur de la publication</h2>
<p>Nom : Moncef STITI</p>
<p>Contact : <a href="mailto:moncef.stiti@etu.u-pec.fr">moncef.stiti@etu.u-pec.fr</a></p>
</section>
<section>
<h2>3. Hébergeur du site</h2>
<p>Raison sociale : IUT de Fontainebleau</p>
<p>Adresse : Route Hurtault, 77300 Fontainebleau, France</p>
<p>Téléphone : +33 1 60 74 68 00</p>
<p>Email : <a href="mailto:brouard@u-pec.fr">brouard@u-pec.fr</a></p>
</section>
</main>
<footer>
<p>Cette page de mentions légales est conforme aux exigences légales en vigueur. Dernière mise à jour : 22 mai 2024.</p>
</footer>
</body>
</html>

View File

@ -0,0 +1,52 @@
<!DOCTYPE html>
<html lang="fr">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Résultats de la recherche</title>
</head>
<body>
<h2>Résultats de la recherche pour "<?php echo $query; ?>"</h2>
<?php if (!empty($musiques)): ?>
<h3>Musiques</h3>
<ul>
<?php foreach($musiques as $musique): ?>
<li><?php echo $musique->name; ?> - <?php echo $musique->artistName; ?></li>
<?php endforeach; ?>
</ul>
<?php endif; ?>
<?php if (!empty($albums)): ?>
<h3>Albums</h3>
<ul>
<?php foreach($albums as $album): ?>
<li><?php echo $album->name; ?> by <?php echo $album->artistName; ?></li>
<?php endforeach; ?>
</ul>
<?php endif; ?>
<?php if (!empty($genres)): ?>
<h3>Genres</h3>
<ul>
<?php foreach($genres as $genre): ?>
<li><?php echo $genre->name; ?></li>
<?php endforeach; ?>
</ul>
<?php endif; ?>
<?php if (!empty($artistes)): ?>
<h3>Artistes</h3>
<ul>
<?php foreach($artistes as $artiste): ?>
<li><?php echo $artiste->name; ?></li>
<?php endforeach; ?>
</ul>
<?php endif; ?>
<?php if (empty($musiques) && empty($albums) && empty($genres) && empty($artistes)): ?>
<p>Aucun résultat trouvé.</p>
<?php endif; ?>
</body>
</html>

View File

@ -81,3 +81,28 @@ body {
display: flex; display: flex;
} }
} }
.search-form {
margin-right: 20px; /* Espace entre la barre de recherche et les boutons de navigation */
display: flex; /* Permet d'aligner les éléments horizontalement */
align-items: center; /* Alignement vertical */
}
.search-form input[type="text"] {
padding: 10px;
border: 2px solid white; /* Bordure blanche */
background-color: rgba(255, 255, 255, 0.1); /* Fond légèrement transparent */
color: white; /* Couleur du texte */
border-radius: 5px; /* Coins arrondis */
vertical-align: middle; /* Alignement vertical */
}
.search-form button[type="submit"] {
padding: 10px;
background-color: transparent; /* Fond transparent */
border: 2px solid white; /* Bordure blanche */
color: white; /* Couleur du texte */
border-radius: 5px; /* Coins arrondis */
cursor: pointer;
vertical-align: middle; /* Alignement vertical */
}

View File

@ -0,0 +1,31 @@
body {
font-family: Arial, sans-serif;
margin: 0;
padding: 0;
}
header {
background-color: #490a56;
color: #fff;
padding: 20px;
text-align: center;
}
main {
padding: 20px;
}
section {
margin-bottom: 20px;
}
h2 {
color: #490a56;
}
footer {
background-color: #490a56;
color: #fff;
padding: 10px 20px;
text-align: center;
}