link creation: fieldset with checkboxes for objet restriction, TFE checked by default

link creation: fieldset with checkboxes for objet restriction, TFE checked by default; password/expiration in second fieldset 'Accès'
This commit is contained in:
Pontoporeia
2026-05-09 16:11:11 +02:00
parent 21c2b55bfb
commit 013317c97f
5 changed files with 37 additions and 39 deletions

View File

@@ -39,7 +39,7 @@
$statusLabel = $isExpired ? 'Expiré' : ($link['is_active'] ? 'Actif' : 'Désactivé');
$fullUrl = $baseUrl . '/partage/' . htmlspecialchars($link['slug']);
$created = date('d/m/Y H:i', strtotime($link['created_at']));
$expires = $link['expires_at'] ? date('d/m/Y', strtotime($link['expires_at'])) : '-';
$expires = $link['expires_at'] ? date('d/m/Y H:i', strtotime($link['expires_at'])) : '-';
$hasLinkPassword = !empty($link['password_hash']);
$linkName = $link['name'] ?? '';
$linkExpiresVal = $link['expires_at'] ? date('Y-m-d\TH:i', strtotime($link['expires_at'])) : '';
@@ -144,7 +144,7 @@
<?php foreach ($archivedLinks as $link): ?>
<?php
$created = date('d/m/Y H:i', strtotime($link['created_at']));
$expires = $link['expires_at'] ? date('d/m/Y', strtotime($link['expires_at'])) : '-';
$expires = $link['expires_at'] ? date('d/m/Y H:i', strtotime($link['expires_at'])) : '-';
?>
<tr>
<td>
@@ -320,37 +320,30 @@
<form method="post" action="actions/acces-etudiante.php" class="admin-form">
<input type="hidden" name="csrf_token" value="<?= htmlspecialchars($_SESSION['csrf_token']) ?>">
<input type="hidden" name="action" value="create">
<div>
<label for="create-objet">Type d'objet (optionnel)</label>
<select id="create-objet" name="objet_restriction">
<option value="">- Tous les types -</option>
<option value="tfe">TFE</option>
<option value="thèse">Thèse</option>
<option value="frart">Frart</option>
</select>
<small>Restreint ce lien à un seul type de soumission.</small>
</div>
<div>
<label for="create-password">Mot de passe (optionnel)</label>
<input type="password" id="create-password" name="password" autocomplete="new-password">
<small>Laissez vide pour un lien sans mot de passe.</small>
</div>
<div>
<label for="create-expires">Expiration (optionnel)</label>
<input type="datetime-local" id="create-expires" name="expires_at">
<small>Laissez vide pour qu'il n'expire jamais.</small>
</div>
<fieldset>
<legend>Année académique verrouillée</legend>
<legend>Type d'objet</legend>
<label style="display:flex;align-items:center;gap:var(--space-2xs);font-weight:400;">
<input type="checkbox" name="objet_restriction[]" value="tfe" checked> TFE (par défaut)
</label>
<label style="display:flex;align-items:center;gap:var(--space-2xs);font-weight:400;">
<input type="checkbox" name="objet_restriction[]" value="thèse"> Thèse
</label>
<label style="display:flex;align-items:center;gap:var(--space-2xs);font-weight:400;">
<input type="checkbox" name="objet_restriction[]" value="frart"> Frart
</label>
<small>Le lien sera restreint aux types cochés. Par défaut : TFE uniquement.</small>
</fieldset>
<fieldset>
<legend>Accès</legend>
<div>
<label for="create-locked-year">Année (optionnel)</label>
<input type="number" id="create-locked-year" name="locked_year"
min="2000" max="<?= date('Y') + 3 ?>" placeholder="<?= date('Y') ?>">
<small style="max-width:42ch;">
Si renseignée, le formulaire masquera le champ Année et forcera cette valeur.
Ainsi les identifiants TFE (ex: <strong><?= date('Y') ?>-001</strong>) correspondront
à la bonne année. Laissez vide pour laisser l'étudiant·e choisir.
</small>
<label for="create-password">Mot de passe (optionnel)</label>
<input type="password" id="create-password" name="password" autocomplete="new-password">
<small>Laissez vide pour un lien sans mot de passe.</small>
</div>
<div>
<label for="create-expires">Expiration (optionnel)</label>
<input type="datetime-local" id="create-expires" name="expires_at">
<small>Laissez vide pour qu'il n'expire jamais.</small>
</div>
</fieldset>
<div class="admin-form-footer">