ajout du CSS sur les vues manquantes et formulaire d'ajout complet
This commit is contained in:
@@ -1,68 +1,113 @@
|
||||
<?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>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
</html>
|
||||
@@ -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; }
|
||||
|
||||
.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; }
|
||||
|
||||
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>
|
||||
|
||||
<p><?php echo $contenu_message; ?></p>
|
||||
<div class="container">
|
||||
<?php if (strpos(strtolower($titre_message), 'succès') !== false): ?>
|
||||
<div class="icon">✅</div>
|
||||
<?php else: ?>
|
||||
<div class="icon">⚠️</div>
|
||||
<?php endif; ?>
|
||||
|
||||
<p>
|
||||
<a href="<?php echo site_url($lien_retour); ?>">Retour</a>
|
||||
</p>
|
||||
<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