mirror of
https://codeberg.org/PostERG/xamxam.git
synced 2026-06-25 16:19:19 +02:00
79 lines
3.6 KiB
PHP
79 lines
3.6 KiB
PHP
<dialog id="import-dialog" class="admin-dialog" aria-labelledby="import-dialog-title">
|
|
<div class="admin-dialog__header">
|
|
<h3 id="import-dialog-title">Importer une liste de TFE</h3>
|
|
<button type="button" class="admin-dialog__close" aria-label="Fermer"
|
|
onclick="document.getElementById('import-dialog').close()">✕</button>
|
|
</div>
|
|
|
|
<?php if ($importMessage || !empty($importErrors)): ?>
|
|
<div class="admin-import-status-card">
|
|
<?php if (!empty($importErrors)): ?>
|
|
<div class="toast admin-import-status-card__errors" role="alert" data-type="error">
|
|
<strong>⚠ Erreurs :</strong>
|
|
<ul class="admin-error-list">
|
|
<?php foreach ($importErrors as $err): ?>
|
|
<li><?= htmlspecialchars($err) ?></li>
|
|
<?php endforeach; ?>
|
|
</ul>
|
|
</div>
|
|
<?php endif; ?>
|
|
<?php if ($importMessage): ?>
|
|
<p class="admin-import-status-card__success" role="status">✓ <?= htmlspecialchars($importMessage) ?></p>
|
|
<?php endif; ?>
|
|
</div>
|
|
<?php endif; ?>
|
|
|
|
<?php if ($importMessage): ?>
|
|
<?php if (!empty($importResults)): ?>
|
|
<details class="admin-import-log-details">
|
|
<summary>Logs d'importation (<?= count($importResults) ?> entrées)</summary>
|
|
<ul class="admin-import-log">
|
|
<?php foreach ($importResults as $r): ?>
|
|
<li class="admin-import-log__item admin-import-log__item--<?= $r['type'] ?>"><?= htmlspecialchars($r['msg']) ?></li>
|
|
<?php endforeach; ?>
|
|
</ul>
|
|
</details>
|
|
<?php endif; ?>
|
|
<div class="admin-form-footer">
|
|
<button type="button" class="btn btn--primary"
|
|
onclick="document.getElementById('import-dialog').close(); window.location.href = window.location.pathname">Terminé</button>
|
|
</div>
|
|
<?php else: ?>
|
|
<form method="post" enctype="multipart/form-data" class="admin-form">
|
|
<input type="hidden" name="csrf_token" value="<?= htmlspecialchars($_SESSION['csrf_token']) ?>">
|
|
|
|
<div>
|
|
<label for="csv_file">Fichier CSV</label>
|
|
<div class="admin-file-input">
|
|
<input type="file" id="csv_file"
|
|
name="csv_file"
|
|
class="tfe-file-picker"
|
|
data-queue-type="csv_import"
|
|
required>
|
|
<small class="admin-file-hint">
|
|
Colonnes : Identifiant, Titre, Sous-titre, Auteur·ice(s), Contact, Promoteur·ice(s), Format, Année, AP, Orientation, Finalité, Mots-clés, Synopsis, Contexte, Remarques, Langue, Autorisation, License, taille, Points sur 20, lien BAIU<br>
|
|
Quatre premières lignes ignorées — Séparateur : virgule — UTF-8
|
|
</small>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="admin-form-footer">
|
|
<button type="submit" class="btn btn--primary">Importer</button>
|
|
<button type="button" class="btn btn--secondary"
|
|
onclick="document.getElementById('import-dialog').close()">Annuler</button>
|
|
</div>
|
|
</form>
|
|
|
|
<?php if (!empty($importResults)): ?>
|
|
<details class="admin-import-log-details">
|
|
<summary>Logs d'importation (<?= count($importResults) ?> entrées)</summary>
|
|
<ul class="admin-import-log">
|
|
<?php foreach ($importResults as $r): ?>
|
|
<li class="admin-import-log__item admin-import-log__item--<?= $r['type'] ?>"><?= htmlspecialchars($r['msg']) ?></li>
|
|
<?php endforeach; ?>
|
|
</ul>
|
|
</details>
|
|
<?php endif; ?>
|
|
<?php endif; ?>
|
|
</dialog>
|