Subject CRUD

This commit is contained in:
2026-04-18 15:26:04 +03:00
parent d2e5cc8b2b
commit 0550ffe923
11 changed files with 557 additions and 36 deletions
+12 -3
View File
@@ -9,7 +9,12 @@ if (!isset($_GET['id']) || !is_numeric($_GET['id'])) {
$error = 'ID non valido.';
} else {
$id = (int)$_GET['id'];
$stmt = $pdo->prepare("SELECT * FROM scad_deadlines WHERE id = ?");
$stmt = $pdo->prepare("
SELECT d.*, s.name AS subject_name, s.color AS subject_color
FROM scad_deadlines d
LEFT JOIN scad_subjects s ON s.id = d.subject_id
WHERE d.id = ?
");
$stmt->execute([$id]);
$deadline = $stmt->fetch(PDO::FETCH_ASSOC);
@@ -263,9 +268,13 @@ if (!isset($_GET['id']) || !is_numeric($_GET['id'])) {
<div class="row">
<!-- Left Column -->
<div class="col-12 col-md-6">
<?php if ($deadline['category']): ?>
<?php if (!empty($deadline['subject_name'])): ?>
<div class="detail-label">Argomento</div>
<div class="detail-value" style="font-weight:600;"><?= htmlspecialchars($deadline['category'], ENT_QUOTES, 'UTF-8') ?></div>
<div class="detail-value">
<span style="display:inline-block;padding:0.25rem 0.7rem;border-radius:1rem;color:#fff;font-weight:600;font-size:0.85rem;background: <?= htmlspecialchars($deadline['subject_color'] ?: '#6c757d', ENT_QUOTES, 'UTF-8') ?>">
<?= htmlspecialchars($deadline['subject_name'], ENT_QUOTES, 'UTF-8') ?>
</span>
</div>
<?php endif; ?>
<div class="detail-label">Dettaglio</div>