Add files via upload

This commit is contained in:
tips-of-mine
2025-06-14 19:03:54 +02:00
committed by GitHub
parent 2df60f551b
commit b17c666c5a
51 changed files with 4363 additions and 0 deletions

View File

@ -0,0 +1,71 @@
<?php
// Variables attendues du contrôleur: $groupedCertificates, $translations, $currentLang, $darkModeClass, $successMessage, $errorMessage, $userRole
require_once APP_ROOT_DIR . '/src/Views/shared/header.php';
?>
<div class="container">
<h1><?= htmlspecialchars($translations['certificates']) ?></h1>
<div class="actions-bar">
<a href="/dashboard" class="button secondary-button"><?= htmlspecialchars($translations['back_to_dashboard']) ?></a>
<a href="/certificates/create" class="button primary-button"><?= htmlspecialchars($translations['create_new_certificate']) ?></a>
</div>
<?php if (isset($successMessage)): ?>
<p class="success-message"><?= htmlspecialchars($successMessage); ?></p>
<?php endif; ?>
<?php if (isset($errorMessage)): ?>
<p class="error-message"><?= htmlspecialchars($errorMessage); ?></p>
<?php endif; ?>
<?php if (empty($groupedCertificates)): ?>
<p><?= htmlspecialchars($translations['no_certificates_yet']) ?></p>
<?php else: ?>
<?php foreach ($groupedCertificates as $perimeterName => $certsInPerimeter): ?>
<h2 class="perimeter-heading"><?= htmlspecialchars($perimeterName) ?></h2>
<div class="table-responsive">
<table>
<thead>
<tr>
<th><?= htmlspecialchars($translations['certificate_name']) ?></th>
<th><?= htmlspecialchars($translations['type']) ?></th>
<th><?= htmlspecialchars($translations['expiration_date']) ?></th>
<th><?= htmlspecialchars($translations['status']) ?></th>
<th><?= htmlspecialchars($translations['actions']) ?></th>
</tr>
</thead>
<tbody>
<?php foreach ($certsInPerimeter as $cert): ?>
<tr class="<?= $cert['is_revoked'] ? 'revoked-cert' : '' ?>">
<td><?= htmlspecialchars($cert['name']) ?></td>
<td><?= htmlspecialchars($translations[$cert['type']] ?? $cert['type']) ?></td>
<td><?= htmlspecialchars((new DateTime($cert['expiration_date']))->format('Y-m-d')) ?></td>
<td>
<?php if ($cert['is_revoked']): ?>
<span class="status-revoked"><?= htmlspecialchars($translations['revoked']) ?></span>
(<?= htmlspecialchars((new DateTime($cert['revoked_at']))->format('Y-m-d')) ?>)
<?php else: ?>
<span class="status-active"><?= htmlspecialchars($translations['active']) ?></span>
<?php endif; ?>
</td>
<td>
<?php
// Seuls les certificats 'simple' et non révoqués peuvent être révoqués via l'interface
if (!$cert['is_revoked'] && $cert['type'] === 'simple'): ?>
<form action="/certificates/revoke" method="post" class="inline-form" onsubmit="return confirm('<?= htmlspecialchars($translations['confirm_revoke']) ?>');">
<input type="hidden" name="certificate_id" value="<?= htmlspecialchars($cert['id']) ?>">
<button type="submit" class="button danger-button"><?= htmlspecialchars($translations['revoke_certificate']) ?></button>
</form>
<?php endif; ?>
</td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
</div>
<?php endforeach; ?>
<?php endif; ?>
</div>
<?php
require_once APP_ROOT_DIR . '/src/Views/shared/footer.php';
?>