Files
sae_r301_g12/codeigniter-develop/application/views/game_detail_view.php
T

114 lines
5.3 KiB
PHP

<!DOCTYPE html>
<html lang="fr">
<head>
<meta charset="UTF-8">
<title>Détails du jeu - <?= html_escape($game['name']) ?></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: 40px auto; background: #fff; padding: 40px; border-radius: 8px; box-shadow: 0 4px 15px rgba(0,0,0,0.05); }
.back-link { display: inline-block; background: #ecf0f1; padding: 8px 15px; border-radius: 5px; color: #2c3e50; text-decoration: none; margin-bottom: 20px; font-weight: bold; transition: background 0.3s; }
.back-link:hover { background: #bdc3c7; }
.game-header { display: flex; gap: 40px; margin-bottom: 30px; align-items: flex-start; flex-wrap: wrap; }
.game-poster { flex-shrink: 0; max-width: 300px; width: 100%; }
.game-poster img { width: 100%; border-radius: 8px; box-shadow: 0 4px 10px rgba(0,0,0,0.1); object-fit: cover; }
.game-poster-empty { width: 100%; height: 350px; background: #ecf0f1; display: flex; align-items: center; justify-content: center; color: #7f8c8d; border-radius: 8px; text-align: center; padding: 20px; box-sizing: border-box; }
.game-info { flex: 1; min-width: 250px; }
h1 { color: #2c3e50; margin-top: 0; margin-bottom: 10px; font-size: 32px; }
h3 { color: #34495e; border-bottom: 2px solid #ecf0f1; padding-bottom: 10px; margin-top: 30px; }
p { line-height: 1.6; }
.price-tag { display: inline-block; background: #e8f4fd; border: 1px solid #bde0fe; padding: 10px 20px; border-radius: 6px; font-size: 24px; font-weight: bold; color: #2ecc71; margin: 15px 0; }
.description-box { line-height: 1.6; color: #444; background: #f9f9f9; padding: 20px; border-left: 4px solid #3498db; border-radius: 4px; }
.lists-container { display: flex; gap: 40px; flex-wrap: wrap; margin-top: 20px; }
.list-section { flex: 1; min-width: 250px; }
ul { list-style: none; padding: 0; margin: 0; }
li { background: #f9f9f9; margin-bottom: 8px; padding: 12px 15px; border-radius: 5px; border-left: 4px solid #3498db; transition: transform 0.2s; }
li:hover { transform: translateX(5px); background: #f1f1f1; }
li a { color: #2c3e50; font-weight: bold; text-decoration: none; display: block; }
li a:hover { color: #3498db; }
li.empty-list { background: transparent; border: none; padding: 0; color: #7f8c8d; font-style: italic; }
li.empty-list:hover { transform: none; background: transparent; }
</style>
</head>
<body>
<div class="container">
<a href="<?= site_url('home') ?>" class="back-link">⬅ Retour à l'accueil</a>
<div class="game-header">
<div class="game-poster">
<?php if (!empty($game['poster_url'])): ?>
<img src="data:image/jpeg;base64,<?= base64_encode($game['poster_url']) ?>" alt="Poster de <?= html_escape($game['name']) ?>">
<?php else: ?>
<div class="game-poster-empty">
<p>Aucun poster disponible pour ce jeu.</p>
</div>
<?php endif; ?>
</div>
<div class="game-info">
<h1><?= html_escape($game['name']) ?> (<?= html_escape($game['releaseYear']) ?>)</h1>
<p style="font-size: 18px; color: #7f8c8d;">
<strong>Développeur :</strong> <?= !empty($game['developer_name']) ? html_escape($game['developer_name']) : 'Inconnu' ?>
</p>
<div class="price-tag">
<?= !empty($game['price']) ? number_format($game['price'] / 100, 2, ',', ' ') . ' €' : 'Gratuit / Non renseigné' ?>
</div>
<h3>Description</h3>
<div class="description-box">
<?= nl2br(html_escape($game['shortDescription'])) ?>
</div>
</div>
</div>
<div class="lists-container">
<div class="list-section">
<h3>Catégories associées</h3>
<ul>
<?php if (!empty($categories)): ?>
<?php foreach ($categories as $cat): ?>
<li>
<a href="<?= site_url('category/view/' . $cat['id']) ?>">
<?= html_escape($cat['description']) ?>
</a>
</li>
<?php endforeach; ?>
<?php else: ?>
<li class="empty-list">Aucune catégorie pour ce jeu.</li>
<?php endif; ?>
</ul>
</div>
<div class="list-section">
<h3>Genres associés</h3>
<ul>
<?php if (!empty($genres)): ?>
<?php foreach ($genres as $gen): ?>
<li>
<a href="<?= site_url('genre/view/' . $gen['id']) ?>">
<?= html_escape($gen['description']) ?>
</a>
</li>
<?php endforeach; ?>
<?php else: ?>
<li class="empty-list">Aucun genre pour ce jeu.</li>
<?php endif; ?>
</ul>
</div>
</div>
</div>
</body>
</html>