added statistic and remove froms school

This commit is contained in:
2026-01-16 21:40:19 +01:00
parent 39fb15c649
commit f911b82716
10 changed files with 371 additions and 63 deletions
+23 -4
View File
@@ -50,10 +50,11 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_FILES['certificate']) && $_
(user_id, filename, stored_path, document_name, expiry_date, notes, uploaded_at)
VALUES (?, ?, ?, ?, ?, ?, NOW())
");
$stmt->execute([
$iduserlogin,
$file['name'],
'certificate/' . $new_filename,
'userarea/certificate/' . $new_filename, // ← solo questo
$document_name,
$expiry_date,
$notes
@@ -151,6 +152,21 @@ $user = $stmt->fetch();
.file-link:hover {
color: #0056b3;
}
/* Riga rosa tenue per scaduti */
tr.expired-row {
background-color: #ffebee !important;
/* rosa molto chiaro / rosso tenue */
}
/* Badge scaduto */
.badge-expired {
background-color: #dc3545;
color: white;
font-size: 0.8rem;
padding: 0.4em 0.8em;
border-radius: 50px;
}
</style>
</head>
@@ -238,10 +254,11 @@ $user = $stmt->fetch();
</thead>
<tbody>
<?php foreach ($certificates as $cert):
$file_url = '../' . $cert['stored_path'];
$file_url = '/' . $cert['stored_path']; // usa percorso root-relative come consigliato prima
$expired = $cert['expiry_date'] && strtotime($cert['expiry_date']) < time();
$row_class = $expired ? 'expired-row' : '';
?>
<tr>
<tr class="<?= $row_class ?>">
<td><?= date('d/m/Y H:i', strtotime($cert['uploaded_at'])) ?></td>
<td>
<a href="<?= htmlspecialchars($file_url) ?>" target="_blank" class="file-link">
@@ -252,7 +269,9 @@ $user = $stmt->fetch();
</td>
<td class="<?= $expired ? 'expired' : '' ?>">
<?= $cert['expiry_date'] ? date('d/m/Y', strtotime($cert['expiry_date'])) : '—' ?>
<?= $expired ? '<br><small>SCADUTO</small>' : '' ?>
<?php if ($expired): ?>
<span class="badge-expired ms-2">SCADUTO</span>
<?php endif; ?>
</td>
<td><?= $cert['notes'] ? nl2br(htmlspecialchars(substr($cert['notes'], 0, 100))) . (strlen($cert['notes']) > 100 ? '...' : '') : '—' ?></td>
<td class="text-center">