ajout du CSS sur les vues manquantes et formulaire d'ajout complet
This commit is contained in:
@@ -3,71 +3,43 @@ defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
|
||||
class Jeux extends CI_Controller {
|
||||
|
||||
public function ajouter(){
|
||||
$this->load->helper('url');
|
||||
$this->load->helper('form');
|
||||
$this->load->view("formulaire_ajout");
|
||||
public function ajouter() {
|
||||
$this->load->helper(array('url', 'form'));
|
||||
$this->load->model('Category_model');
|
||||
$this->load->model('Genre_model');
|
||||
|
||||
$donnees['categories'] = $this->Category_model->get_all();
|
||||
$donnees['genres'] = $this->Genre_model->get_all();
|
||||
|
||||
$this->load->view("formulaire_ajout", $donnees);
|
||||
}
|
||||
|
||||
public function sauvegarder() {
|
||||
$this->load->helper('url');
|
||||
$titre = $this->input->post('titre');
|
||||
$annee = $this->input->post('annee');
|
||||
$description = $this->input->post('description');
|
||||
$prix = $this->input->post('prix');
|
||||
|
||||
$titre = $this->input->post('name');
|
||||
$annee = $this->input->post('releaseYear');
|
||||
$description = $this->input->post('shortDescription');
|
||||
$prix = $this->input->post('price');
|
||||
$developer_name = $this->input->post('developer_name');
|
||||
$categories = $this->input->post('categories');
|
||||
$genres = $this->input->post('genres');
|
||||
|
||||
$jpeg_data = NULL;
|
||||
if (!empty($_FILES['poster']['tmp_name'])) {
|
||||
$jpeg_data = file_get_contents($_FILES['poster']['tmp_name']);
|
||||
}
|
||||
|
||||
$this->load->model('Game_model');
|
||||
|
||||
$insertion_reussie = $this->Game_model->ajouter_jeu($titre, $annee, $description, $prix);
|
||||
$insertion_reussie = $this->Game_model->ajouter_jeu($titre, $annee, $description, $prix, $developer_name, $categories, $genres, $jpeg_data);
|
||||
|
||||
if ($insertion_reussie) {
|
||||
$donnees['titre_message'] = "Succès !";
|
||||
$donnees['contenu_message'] = "Le jeu " . html_escape($titre) . " a bien été ajouté à la base de données.";
|
||||
$donnees['lien_retour'] = 'jeux/ajouter';
|
||||
$donnees['contenu_message'] = "Le jeu a bien été ajouté à la base de données avec toutes ses informations.";
|
||||
$donnees['lien_retour'] = 'jeux/lister';
|
||||
} else {
|
||||
$donnees['titre_message'] = "Erreur";
|
||||
$donnees['contenu_message'] = "impossible d'ajouter le jeu.";
|
||||
$donnees['lien_retour'] = 'jeux/ajouter';
|
||||
}
|
||||
|
||||
$this->load->view('message_vue', $donnees);
|
||||
}
|
||||
|
||||
|
||||
public function mettre_a_jour($id) {
|
||||
$titre = $this->input->post('titre');
|
||||
$annee = $this->input->post('annee');
|
||||
$description = $this->input->post('description');
|
||||
$prix = $this->input->post('prix');
|
||||
|
||||
$this->load->model('Game_model');
|
||||
$succes = $this->Game_model->modifier_jeu($id, $titre, $annee, $description, $prix);
|
||||
|
||||
if ($succes) {
|
||||
$donnees['titre_message'] = "Succès !";
|
||||
$donnees['contenu_message'] = "Le jeu " . html_escape($titre) . " a bien été modifié.";
|
||||
$donnees['lien_retour'] = 'jeux/modifier/' . $id;
|
||||
} else {
|
||||
$donnees['titre_message'] = "Erreur";
|
||||
$donnees['contenu_message'] = "Erreur lors de la modification du jeu.";
|
||||
$donnees['lien_retour'] = 'jeux/modifier/' . $id;
|
||||
}
|
||||
|
||||
$this->load->view('message_vue', $donnees);
|
||||
}
|
||||
|
||||
|
||||
public function supprimer($id) {
|
||||
$this->load->model('Game_model');
|
||||
$succes = $this->Game_model->supprimer_jeu($id);
|
||||
|
||||
if ($succes) {
|
||||
$donnees['titre_message'] = "Succès !";
|
||||
$donnees['contenu_message'] = "Le jeu numéro " . $id . " a bien été supprimé de la base de données.";
|
||||
$donnees['lien_retour'] = 'jeux/ajouter';
|
||||
} else {
|
||||
$donnees['titre_message'] = "Erreur";
|
||||
$donnees['contenu_message'] = "Aïe, impossible de supprimer le jeu.";
|
||||
$donnees['contenu_message'] = "Impossible d'ajouter le jeu.";
|
||||
$donnees['lien_retour'] = 'jeux/ajouter';
|
||||
}
|
||||
|
||||
@@ -75,24 +47,69 @@ class Jeux extends CI_Controller {
|
||||
}
|
||||
|
||||
public function modifier($id) {
|
||||
$this->load->helper(array('url', 'form'));
|
||||
$this->load->model('Game_model');
|
||||
$this->load->model('Category_model');
|
||||
$this->load->model('Genre_model');
|
||||
|
||||
$donnees['jeu'] = $this->Game_model->get_jeu($id);
|
||||
$donnees['jeu'] = $this->Game_model->get_by_id($id);
|
||||
if (empty($donnees['jeu'])) { show_404(); }
|
||||
|
||||
if (empty($donnees['jeu'])) {
|
||||
show_404();
|
||||
}
|
||||
$donnees['categories'] = $this->Category_model->get_all();
|
||||
$donnees['genres'] = $this->Genre_model->get_all();
|
||||
|
||||
$donnees['jeu_categories'] = array_column($this->Category_model->get_by_game($id), 'id');
|
||||
$donnees['jeu_genres'] = array_column($this->Genre_model->get_by_game($id), 'id');
|
||||
|
||||
$this->load->view('formulaire_ajout', $donnees);
|
||||
}
|
||||
|
||||
public function lister($tri = 'name') {
|
||||
public function mettre_a_jour($id) {
|
||||
$this->load->helper('url');
|
||||
|
||||
$titre = $this->input->post('name');
|
||||
$annee = $this->input->post('releaseYear');
|
||||
$description = $this->input->post('shortDescription');
|
||||
$prix = $this->input->post('price');
|
||||
$developer_name = $this->input->post('developer_name');
|
||||
$categories = $this->input->post('categories');
|
||||
$genres = $this->input->post('genres');
|
||||
|
||||
$this->load->model('Game_model');
|
||||
$succes = $this->Game_model->modifier_jeu($id, $titre, $annee, $description, $prix, $developer_name, $categories, $genres);
|
||||
|
||||
$donnees['jeux'] = $this->Game_model->get_tous_les_jeux($tri);
|
||||
if ($succes) {
|
||||
$donnees['titre_message'] = "Succès !";
|
||||
$donnees['contenu_message'] = "Le jeu a bien été mis à jour.";
|
||||
$donnees['lien_retour'] = 'jeux/lister';
|
||||
} else {
|
||||
$donnees['titre_message'] = "Erreur";
|
||||
$donnees['contenu_message'] = "Erreur lors de la modification.";
|
||||
$donnees['lien_retour'] = 'jeux/modifier/' . $id;
|
||||
}
|
||||
|
||||
$this->load->view('liste_jeux_vue', $donnees);
|
||||
$this->load->view('message_vue', $donnees);
|
||||
}
|
||||
|
||||
public function supprimer($id) {
|
||||
$this->load->model('Game_model');
|
||||
$succes = $this->Game_model->supprimer_jeu($id);
|
||||
|
||||
if ($succes) {
|
||||
$donnees['titre_message'] = "Succès !";
|
||||
$donnees['contenu_message'] = "Le jeu a bien été supprimé.";
|
||||
$donnees['lien_retour'] = 'jeux/lister';
|
||||
} else {
|
||||
$donnees['titre_message'] = "Erreur";
|
||||
$donnees['contenu_message'] = "Impossible de supprimer le jeu.";
|
||||
$donnees['lien_retour'] = 'jeux/lister';
|
||||
}
|
||||
$this->load->view('message_vue', $donnees);
|
||||
}
|
||||
|
||||
public function lister($tri = 'name') {
|
||||
$this->load->model('Game_model');
|
||||
$donnees['jeux'] = $this->Game_model->get_tous_les_jeux($tri);
|
||||
$this->load->view('liste_jeux_vue', $donnees);
|
||||
}
|
||||
}
|
||||
@@ -7,29 +7,24 @@ class Game_model extends CI_Model {
|
||||
$this->db->select('*');
|
||||
$this->db->from('game');
|
||||
$this->db->like('name', $keyword);
|
||||
|
||||
$query = $this->db->get();
|
||||
return $query->result_array();
|
||||
}
|
||||
|
||||
|
||||
public function get_by_category($category_id) {
|
||||
$this->db->select('game.*');
|
||||
$this->db->from('game');
|
||||
$this->db->join('game_category', 'game_category.gameId = game.id'); // C'était ICI l'erreur !
|
||||
$this->db->join('game_category', 'game_category.gameId = game.id');
|
||||
$this->db->where('game_category.categoryId', $category_id);
|
||||
|
||||
$query = $this->db->get();
|
||||
return $query->result_array();
|
||||
}
|
||||
|
||||
|
||||
public function get_by_genre($genre_id) {
|
||||
$this->db->select('game.*');
|
||||
$this->db->from('game');
|
||||
$this->db->join('game_genre', 'game_genre.gameId = game.id'); // Et ICI !
|
||||
$this->db->join('game_genre', 'game_genre.gameId = game.id');
|
||||
$this->db->where('game_genre.genreId', $genre_id);
|
||||
|
||||
$query = $this->db->get();
|
||||
return $query->result_array();
|
||||
}
|
||||
@@ -37,59 +32,110 @@ class Game_model extends CI_Model {
|
||||
public function get_by_id($game_id) {
|
||||
$this->db->select('game.*, developer.name as developer_name, poster.jpeg as poster_url');
|
||||
$this->db->from('game');
|
||||
|
||||
$this->db->join('developer', 'developer.id = game.developerId', 'left');
|
||||
$this->db->join('poster', 'poster.id = game.posterId', 'left');
|
||||
|
||||
$this->db->where('game.id', $game_id);
|
||||
|
||||
$query = $this->db->get();
|
||||
return $query->row_array();
|
||||
}
|
||||
|
||||
|
||||
public function ajouter_jeu($titre, $annee, $description, $prix) {
|
||||
public function ajouter_jeu($titre, $annee, $description, $prix, $developer_name = null, $categories = [], $genres = [], $jpeg_data = null) {
|
||||
// 1. Gérer le développeur
|
||||
$dev_id = NULL;
|
||||
if (!empty($developer_name)) {
|
||||
$dev = $this->db->get_where('developer', array('name' => $developer_name))->row_array();
|
||||
if ($dev) {
|
||||
$dev_id = $dev['id']; // Il existe déjà
|
||||
} else {
|
||||
$this->db->insert('developer', array('name' => $developer_name));
|
||||
$dev_id = $this->db->insert_id(); // On le crée
|
||||
}
|
||||
}
|
||||
|
||||
$poster_id = NULL;
|
||||
if (!empty($jpeg_data)) {
|
||||
$this->db->insert('poster', array('jpeg' => $jpeg_data));
|
||||
$poster_id = $this->db->insert_id();
|
||||
}
|
||||
|
||||
$donnees = array(
|
||||
'name' => $titre,
|
||||
'releaseYear' => $annee,
|
||||
'shortDescription' => $description,
|
||||
'price' => empty($prix) ? NULL : $prix
|
||||
'price' => empty($prix) ? NULL : $prix,
|
||||
'developerId' => $dev_id,
|
||||
'posterId' => $poster_id
|
||||
);
|
||||
return $this->db->insert('game', $donnees);
|
||||
$this->db->insert('game', $donnees);
|
||||
$game_id = $this->db->insert_id();
|
||||
|
||||
if (!empty($categories)) {
|
||||
foreach ($categories as $cat_id) {
|
||||
$this->db->insert('game_category', array('gameId' => $game_id, 'categoryId' => $cat_id));
|
||||
}
|
||||
}
|
||||
|
||||
if (!empty($genres)) {
|
||||
foreach ($genres as $gen_id) {
|
||||
$this->db->insert('game_genre', array('gameId' => $game_id, 'genreId' => $gen_id));
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
public function modifier_jeu($id, $titre, $annee, $description, $prix, $developer_name = null, $categories = [], $genres = []) {
|
||||
$dev_id = NULL;
|
||||
if (!empty($developer_name)) {
|
||||
$dev = $this->db->get_where('developer', array('name' => $developer_name))->row_array();
|
||||
if ($dev) {
|
||||
$dev_id = $dev['id'];
|
||||
} else {
|
||||
$this->db->insert('developer', array('name' => $developer_name));
|
||||
$dev_id = $this->db->insert_id();
|
||||
}
|
||||
}
|
||||
|
||||
$donnees = array(
|
||||
'name' => $titre,
|
||||
'releaseYear' => $annee,
|
||||
'shortDescription' => $description,
|
||||
'price' => empty($prix) ? NULL : $prix,
|
||||
'developerId' => $dev_id
|
||||
);
|
||||
$this->db->where('id', $id);
|
||||
$this->db->update('game', $donnees);
|
||||
|
||||
$this->db->delete('game_category', array('gameId' => $id));
|
||||
if (!empty($categories)) {
|
||||
foreach ($categories as $cat_id) {
|
||||
$this->db->insert('game_category', array('gameId' => $id, 'categoryId' => $cat_id));
|
||||
}
|
||||
}
|
||||
|
||||
$this->db->delete('game_genre', array('gameId' => $id));
|
||||
if (!empty($genres)) {
|
||||
foreach ($genres as $gen_id) {
|
||||
$this->db->insert('game_genre', array('gameId' => $id, 'genreId' => $gen_id));
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public function supprimer_jeu($id) {
|
||||
return $this->db->delete('game', array('id' => $id));
|
||||
}
|
||||
|
||||
public function get_jeu($id) {
|
||||
$leJeu = $this->db->get_where('game', array('id' => $id));
|
||||
return $leJeu->row_array();
|
||||
}
|
||||
|
||||
public function modifier_jeu($id, $titre, $annee, $description, $prix) {
|
||||
$donnees = array(
|
||||
'name' => $titre,
|
||||
'releaseYear' => $annee,
|
||||
'shortDescription' => $description,
|
||||
'price' => empty($prix) ? NULL : $prix
|
||||
);
|
||||
|
||||
$this->db->where('id', $id);
|
||||
return $this->db->update('game', $donnees);
|
||||
}
|
||||
|
||||
|
||||
public function get_tous_les_jeux($critere_tri = 'id') {
|
||||
$tris_autorises = array('id', 'name', 'releaseYear', 'price');
|
||||
|
||||
if (!in_array($critere_tri, $tris_autorises)) {
|
||||
$critere_tri = 'id';
|
||||
}
|
||||
|
||||
$this->db->order_by($critere_tri, 'ASC');
|
||||
$query = $this->db->get('game');
|
||||
|
||||
return $query->result_array();
|
||||
}
|
||||
|
||||
|
||||
@@ -1,65 +1,110 @@
|
||||
<?php
|
||||
$est_modification = isset($jeu);
|
||||
$action_url = $est_modification ? site_url('jeux/mettre_a_jour/' . $jeu['id']) : site_url('jeux/sauvegarder');
|
||||
?>
|
||||
<!DOCTYPE html>
|
||||
<html lang="fr">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>Ajouter un nouveau jeu</title>
|
||||
<title><?= $est_modification ? 'Modifier le jeu' : 'Ajouter un nouveau jeu' ?></title>
|
||||
<style>
|
||||
/* === LE CSS POUR UN BEAU FORMULAIRE PROPRE === */
|
||||
body { font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; background-color: #f4f7f6; color: #333; margin: 0; padding: 20px; }
|
||||
.container { max-width: 650px; margin: 40px auto; background: #fff; padding: 40px; border-radius: 8px; box-shadow: 0 4px 15px rgba(0,0,0,0.05); }
|
||||
.container { max-width: 700px; margin: 40px auto; background: #fff; padding: 40px; border-radius: 8px; box-shadow: 0 4px 15px rgba(0,0,0,0.05); }
|
||||
|
||||
/* Style du bouton retour */
|
||||
.back-link { display: inline-block; background: #ecf0f1; padding: 8px 15px; border-radius: 5px; color: #2c3e50; text-decoration: none; margin-bottom: 25px; font-weight: bold; transition: background 0.3s; }
|
||||
.back-link:hover { background: #bdc3c7; }
|
||||
|
||||
h2 { color: #2c3e50; border-bottom: 2px solid #ecf0f1; padding-bottom: 10px; margin-bottom: 30px; margin-top: 0; }
|
||||
h3 { color: #34495e; font-size: 18px; margin-top: 30px; border-bottom: 1px solid #eee; padding-bottom: 5px; }
|
||||
|
||||
/* Style du formulaire */
|
||||
.form-group { margin-bottom: 20px; }
|
||||
.form-group label { display: block; margin-bottom: 8px; font-weight: 600; color: #34495e; }
|
||||
.form-group input[type="text"],
|
||||
.form-group input[type="number"],
|
||||
.form-group textarea { width: 100%; padding: 11px; border: 1px solid #bdc3c7; border-radius: 4px; font-size: 16px; box-sizing: border-box; outline: none; font-family: inherit; }
|
||||
.form-group textarea { width: 100%; padding: 12px; border: 1px solid #bdc3c7; border-radius: 4px; font-size: 16px; box-sizing: border-box; outline: none; font-family: inherit; transition: border-color 0.3s; }
|
||||
.form-group input:focus, .form-group textarea:focus { border-color: #3498db; box-shadow: 0 0 5px rgba(52, 152, 219, 0.3); }
|
||||
|
||||
.btn-submit { display: inline-block; background-color: #2ecc71; color: white; padding: 12px 25px; border: none; border-radius: 5px; font-size: 16px; font-weight: bold; cursor: pointer; transition: background 0.3s; width: 100%; margin-top: 10px; }
|
||||
.checkbox-group { display: flex; flex-wrap: wrap; gap: 15px; margin-top: 15px; }
|
||||
.checkbox-item { background: #f8f9fa; padding: 10px 15px; border-radius: 6px; border: 1px solid #e0e0e0; font-size: 14px; cursor: pointer; transition: background 0.2s; display: flex; align-items: center; gap: 8px; }
|
||||
.checkbox-item:hover { background: #eef2f5; }
|
||||
.checkbox-item input[type="checkbox"] { cursor: pointer; width: 16px; height: 16px; }
|
||||
|
||||
.btn-submit { display: block; background-color: #2ecc71; color: white; padding: 15px 25px; border: none; border-radius: 5px; font-size: 18px; font-weight: bold; cursor: pointer; transition: background 0.3s; width: 100%; margin-top: 40px; text-align: center; }
|
||||
.btn-submit:hover { background-color: #27ae60; }
|
||||
|
||||
.info-text { color: #7f8c8d; font-size: 13px; font-style: italic; margin-top: 5px; display: block; }
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<div class="container">
|
||||
<a href="<?= site_url('home') ?>" class="back-link">⬅ Retour à l'accueil</a>
|
||||
<a href="<?= site_url('jeux/lister') ?>" class="back-link">⬅ Retour à la liste des jeux</a>
|
||||
|
||||
<h2>Ajouter un nouveau jeu vidéo</h2>
|
||||
<h2><?= $est_modification ? '✏️ Modifier le jeu' : '➕ Ajouter un nouveau jeu' ?></h2>
|
||||
|
||||
<form action="<?= site_url('jeux/ajouter') ?>" method="POST" enctype="multipart/form-data">
|
||||
<form action="<?= $action_url ?>" method="POST" enctype="multipart/form-data">
|
||||
|
||||
<div class="form-group">
|
||||
<label for="name">Nom du jeu :</label>
|
||||
<input type="text" id="name" name="name" required placeholder="Ex: Zelda: Breath of the Wild">
|
||||
<input type="text" id="name" name="name" required value="<?= $est_modification ? html_escape($jeu['name']) : '' ?>" placeholder="Ex: Elden Ring">
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="releaseYear">Année de sortie :</label>
|
||||
<input type="number" id="releaseYear" name="releaseYear" required placeholder="Ex: 2017">
|
||||
<input type="number" id="releaseYear" name="releaseYear" required value="<?= $est_modification ? html_escape($jeu['releaseYear']) : '' ?>" placeholder="Ex: 2022">
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="developer_name">Développeur :</label>
|
||||
<input type="text" id="developer_name" name="developer_name" placeholder="Ex: Nintendo">
|
||||
<input type="text" id="developer_name" name="developer_name" value="<?= $est_modification && !empty($jeu['developer_name']) ? html_escape($jeu['developer_name']) : '' ?>" placeholder="Ex: FromSoftware">
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="price">Prix (en centimes, ex: 4999 pour 49,99 €) :</label>
|
||||
<input type="number" id="price" name="price" placeholder="Ex: 4999">
|
||||
<label for="price">Prix (en centimes) :</label>
|
||||
<input type="number" id="price" name="price" value="<?= $est_modification ? html_escape($jeu['price']) : '' ?>" placeholder="Ex: 5999 (pour 59,99 €)">
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="shortDescription">Description courte :</label>
|
||||
<textarea id="shortDescription" name="shortDescription" rows="5" placeholder="Écrivez le résumé du jeu ici..."></textarea>
|
||||
<textarea id="shortDescription" name="shortDescription" rows="5" placeholder="Résumé du jeu..."><?= $est_modification ? html_escape($jeu['shortDescription']) : '' ?></textarea>
|
||||
</div>
|
||||
|
||||
<button type="submit" class="btn-submit">➕ Valider et ajouter le jeu</button>
|
||||
<?php if (!$est_modification): ?>
|
||||
<div class="form-group">
|
||||
<label for="poster">Image du jeu (Poster) :</label>
|
||||
<input type="file" id="poster" name="poster" accept="image/jpeg, image/png">
|
||||
<span class="info-text">L'image est facultative et ne peut être ajoutée qu'à la création du jeu.</span>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
<h3>Catégories associées :</h3>
|
||||
<div class="checkbox-group">
|
||||
<?php foreach ($categories as $cat): ?>
|
||||
<?php
|
||||
$checked = ($est_modification && in_array($cat['id'], $jeu_categories)) ? 'checked' : '';
|
||||
?>
|
||||
<label class="checkbox-item">
|
||||
<input type="checkbox" name="categories[]" value="<?= $cat['id'] ?>" <?= $checked ?>>
|
||||
<?= html_escape($cat['description']) ?>
|
||||
</label>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
|
||||
<h3>Genres associés :</h3>
|
||||
<div class="checkbox-group">
|
||||
<?php foreach ($genres as $gen): ?>
|
||||
<?php
|
||||
$checked = ($est_modification && in_array($gen['id'], $jeu_genres)) ? 'checked' : '';
|
||||
?>
|
||||
<label class="checkbox-item">
|
||||
<input type="checkbox" name="genres[]" value="<?= $gen['id'] ?>" <?= $checked ?>>
|
||||
<?= html_escape($gen['description']) ?>
|
||||
</label>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
|
||||
<button type="submit" class="btn-submit"><?= $est_modification ? '💾 Mettre à jour le jeu' : '➕ Ajouter le jeu à la base' ?></button>
|
||||
|
||||
</form>
|
||||
</div>
|
||||
|
||||
@@ -2,28 +2,47 @@
|
||||
<html lang="fr">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>Jeux du genre</title>
|
||||
<title>Jeux du genre <?php echo isset($genre) ? html_escape($genre['description']) : ''; ?></title>
|
||||
<style>
|
||||
body { font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; background-color: #f4f7f6; color: #333; margin: 0; padding: 20px; }
|
||||
.container { max-width: 900px; margin: 0 auto; background: #fff; padding: 30px; border-radius: 8px; box-shadow: 0 4px 15px rgba(0,0,0,0.05); }
|
||||
h1 { color: #2c3e50; border-bottom: 2px solid #ecf0f1; padding-bottom: 10px; margin-bottom: 20px; }
|
||||
a { color: #3498db; text-decoration: none; }
|
||||
a:hover { text-decoration: underline; }
|
||||
ul { list-style: none; padding: 0; }
|
||||
li { background: #f9f9f9; margin-bottom: 10px; padding: 15px; border-radius: 5px; border-left: 4px solid #3498db; transition: transform 0.2s; display: flex; justify-content: space-between; align-items: center; }
|
||||
li:hover { transform: translateX(5px); background: #f1f1f1; }
|
||||
li a { font-weight: bold; color: #2c3e50; text-decoration: none; }
|
||||
li a:hover { color: #3498db; }
|
||||
.price-tag { background: #2ecc71; color: white; padding: 4px 10px; border-radius: 4px; font-weight: bold; font-size: 14px; }
|
||||
.empty-msg { color: #7f8c8d; font-style: italic; }
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<p><a href="<?php echo site_url('home'); ?>">← Retour à l'accueil</a></p>
|
||||
<div class="container">
|
||||
<p><a href="<?= site_url('home') ?>">⬅ Retour à l'accueil</a></p>
|
||||
|
||||
<h1>Jeux du genre</h1>
|
||||
<h1>Jeux du genre <?= isset($genre) ? ' : ' . html_escape($genre['description']) : '' ?></h1>
|
||||
|
||||
<?php if (empty($games)): ?>
|
||||
<p>Aucun jeu trouvé pour ce genre pour le moment.</p>
|
||||
<p class="empty-msg">Aucun jeu trouvé pour ce genre pour le moment.</p>
|
||||
<?php else: ?>
|
||||
<ul>
|
||||
<?php foreach ($games as $game): ?>
|
||||
<li>
|
||||
<a href="<?php echo site_url('game/detail/' . $game['id']); ?>">
|
||||
<strong><?php echo html_escape($game['name']); ?></strong>
|
||||
</a>
|
||||
(<?php echo html_escape($game['releaseYear']); ?>)
|
||||
</li>
|
||||
<?php endforeach; ?>
|
||||
<?php foreach ($games as $game): ?>
|
||||
<li>
|
||||
<a href="<?= site_url('game/detail/' . $game['id']) ?>">
|
||||
<?= html_escape($game['name']) ?> <span style="color: #7f8c8d; font-weight: normal;">(<?= html_escape($game['releaseYear']) ?>)</span>
|
||||
</a>
|
||||
|
||||
<?php if (isset($game['price'])): ?>
|
||||
<span class="price-tag"><?= number_format($game['price'] / 100, 2, ',', ' ') ?> €</span>
|
||||
<?php endif; ?>
|
||||
</li>
|
||||
<?php endforeach; ?>
|
||||
</ul>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,7 +1,37 @@
|
||||
<h2><?php echo $titre_message; ?></h2>
|
||||
<!DOCTYPE html>
|
||||
<html lang="fr">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title><?= html_escape($titre_message) ?></title>
|
||||
<style>
|
||||
body { font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; background-color: #f4f7f6; color: #333; margin: 0; padding: 20px; display: flex; justify-content: center; align-items: center; min-height: 80vh; }
|
||||
|
||||
<p><?php echo $contenu_message; ?></p>
|
||||
.container { max-width: 500px; width: 100%; background: #fff; padding: 40px; border-radius: 8px; box-shadow: 0 4px 15px rgba(0,0,0,0.05); text-align: center; }
|
||||
|
||||
<p>
|
||||
<a href="<?php echo site_url($lien_retour); ?>">Retour</a>
|
||||
</p>
|
||||
h1 { color: #2c3e50; margin-top: 10px; margin-bottom: 15px; }
|
||||
|
||||
p { font-size: 16px; color: #555; line-height: 1.5; margin-bottom: 35px; }
|
||||
|
||||
.btn-retour { display: inline-block; background-color: #3498db; color: white; padding: 12px 30px; text-decoration: none; border-radius: 5px; font-weight: bold; transition: background 0.3s; }
|
||||
.btn-retour:hover { background-color: #2980b9; }
|
||||
|
||||
.icon { font-size: 60px; margin-bottom: 10px; }
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<div class="container">
|
||||
<?php if (strpos(strtolower($titre_message), 'succès') !== false): ?>
|
||||
<div class="icon">✅</div>
|
||||
<?php else: ?>
|
||||
<div class="icon">⚠️</div>
|
||||
<?php endif; ?>
|
||||
|
||||
<h1><?= html_escape($titre_message) ?></h1>
|
||||
<p><?= html_escape($contenu_message) ?></p>
|
||||
|
||||
<a href="<?= site_url($lien_retour) ?>" class="btn-retour">Continuer</a>
|
||||
</div>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user