getConnection(); $error = null; $deadline = null; if (!isset($_GET['id']) || !is_numeric($_GET['id'])) { $error = 'ID non valido.'; } else { $id = (int)$_GET['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); if (!$deadline) { $error = 'Scadenza non trovata.'; } else { $empStmt = $pdo->prepare(" SELECT e.first_name, e.last_name, e.department FROM scad_deadline_employee de JOIN employees e ON e.id = de.employee_id WHERE de.deadline_id = ? ORDER BY e.first_name "); $empStmt->execute([$id]); $employees = $empStmt->fetchAll(PDO::FETCH_ASSOC); $attStmt = $pdo->prepare("SELECT * FROM scad_deadline_attachments WHERE deadline_id = ? ORDER BY created_at DESC"); $attStmt->execute([$id]); $attachments = $attStmt->fetchAll(PDO::FETCH_ASSOC); $histStmt = $pdo->prepare(" SELECT h.*, au.first_name as user_fname, au.last_name as user_lname FROM scad_deadline_histories h LEFT JOIN auth_users au ON au.id = h.user_id WHERE h.deadline_id = ? ORDER BY h.created_at DESC "); $histStmt->execute([$id]); $history = $histStmt->fetchAll(PDO::FETCH_ASSOC); $today = date('Y-m-d'); $isCompleted = $deadline['status'] === 'completed'; $isOverdue = !$isCompleted && $deadline['due_date'] < $today; $approachDate = date('Y-m-d', strtotime($today . ' + ' . (int)$deadline['notification_days'] . ' days')); $isApproaching = !$isCompleted && !$isOverdue && $deadline['due_date'] <= $approachDate; if ($isCompleted) { $statusLabel = 'Completata'; $statusClass = 'badge-completata'; } elseif ($isOverdue) { $statusLabel = 'Scaduta'; $statusClass = 'badge-scaduta'; } elseif ($isApproaching) { $statusLabel = 'In scadenza'; $statusClass = 'badge-in-scadenza'; } else { $statusLabel = 'Attiva'; $statusClass = 'badge-attiva'; } $recurrenceLabels = ['once' => 'Una tantum', 'monthly' => 'Mensile', 'quarterly' => 'Trimestrale', 'semiannual' => 'Semestrale', 'annual' => 'Annuale', 'biennial' => 'Biennale', 'triennial' => 'Triennale', 'quadriennial' => 'Quadriennale', 'quinquennial' => 'Quinquennale', 'decennial' => 'Decennale', 'quindecennial' => 'Quindicennale']; $actionLabels = ['created' => 'Creata', 'updated' => 'Modificata', 'completed' => 'Completata', 'attachment_added' => 'Allegato aggiunto', 'attachment_removed' => 'Allegato rimosso', 'attachment_linked' => 'Allegato collegato', 'attachment_unlinked' => 'Collegamento rimosso', 'notification_sent' => 'Notifica inviata']; $actionColors = ['created' => '#198754', 'updated' => '#5a8fd8', 'completed' => '#6f42c1', 'attachment_added' => '#e8930c', 'attachment_removed' => '#e8930c', 'attachment_linked' => '#0dcaf0', 'attachment_unlinked' => '#adb5bd', 'notification_sent' => '#adb5bd']; $actionIcons = ['created' => 'fa-plus', 'updated' => 'fa-pen', 'completed' => 'fa-check', 'attachment_added' => 'fa-paperclip', 'attachment_removed' => 'fa-trash', 'attachment_linked' => 'fa-link', 'attachment_unlinked' => 'fa-link-slash', 'notification_sent' => 'fa-bell']; } } ?> <?= $deadline ? htmlspecialchars($deadline['topic'], ENT_QUOTES, 'UTF-8') . ' — ' : '' ?>Scadenzario
Torna alla lista
Dettagli Scadenza
Argomento
Dettaglio
Legge / Articolo
AI
Periodicità
Stato
Data scadenza
(scaduta)
Data documento
Data ultimo controllo
Giorni preavviso notifica
giorni
Luogo archiviazione
Note
Alert
Attivo Non attivo
In caso di variazioni
No

Reparti responsabili
Singoli responsabili
()
Allegati ()
= 1024 ? round($sizeKB / 1024, 1) . ' MB' : $sizeKB . ' KB'; ?>
·
Cronologia
da
$vals): ?>
: