mirror of
https://codeberg.org/PostERG/xamxam.git
synced 2026-06-25 16:19:19 +02:00
205 lines
10 KiB
PHP
205 lines
10 KiB
PHP
<main id="main-content">
|
|
<div class="thesis-add-header">
|
|
<h1>Ajouter un TFE</h1>
|
|
</div>
|
|
|
|
<p class="required-note"><span class="asterisk">*</span> Champs obligatoires</p>
|
|
<form action="actions/formulaire.php" method="post" enctype="multipart/form-data" class="admin-form">
|
|
<input type="hidden" name="csrf_token" value="<?= htmlspecialchars($_SESSION["csrf_token"]) ?>">
|
|
|
|
<!-- ═══════════════════ Informations du TFE ═══════════════════ -->
|
|
<?php
|
|
$oldFn = 'old';
|
|
$withAutofocusFn = 'withAutofocus';
|
|
$allowedObjet = [];
|
|
$synopsisExtra = '';
|
|
include APP_ROOT . '/templates/partials/form/fieldset-tfe-info.php';
|
|
?>
|
|
|
|
<!-- ═══════════════════ Contact ═══════════════════ -->
|
|
<fieldset>
|
|
<legend>Contact</legend>
|
|
<div class="admin-form-group">
|
|
<label class="admin-checkbox-label">
|
|
<input type="checkbox" name="contact_public" value="1"
|
|
<?= !empty($formData['contact_public']) ? 'checked' : '' ?>>
|
|
Rendre le contact visible publiquement sur la fiche du TFE
|
|
</label>
|
|
<small>L'adresse est toujours conservée en interne comme contact de référence.</small>
|
|
</div>
|
|
</fieldset>
|
|
|
|
<!-- ═══════════════════ Langue(s) ═══════════════════ -->
|
|
<fieldset>
|
|
<legend>Langue(s)</legend>
|
|
<?php $name = 'languages'; $label = 'Langue(s) du TFE :'; $options = $languages; $checked = $formData['languages'] ?? []; $required = true; include APP_ROOT . '/templates/partials/form/checkbox-list.php'; ?>
|
|
<?php $name = 'language_autre'; $label = 'Autre(s) langue(s) :'; $value = old('language_autre'); $hint = 'Si votre TFE contient une langue absente de la liste, précisez-la ici.'; include APP_ROOT . '/templates/partials/form/text-field.php'; ?>
|
|
</fieldset>
|
|
|
|
<!-- ═══════════════════ Mots-clés ═══════════════════ -->
|
|
<fieldset>
|
|
<legend>Mots-clés</legend>
|
|
<?php
|
|
$name = 'tag'; $label = 'Mots-clés (max 10) :'; $value = old('tag');
|
|
$placeholder = 'sociologie, anthropologie, ...';
|
|
$hint = 'Séparez par des virgules. Max 10 mots-clés.';
|
|
$attrs = withAutofocus('tag');
|
|
include APP_ROOT . '/templates/partials/form/text-field.php';
|
|
?>
|
|
</fieldset>
|
|
|
|
<!-- ═══════════════════ Cadre académique ═══════════════════ -->
|
|
<?php
|
|
$oldFn = 'old';
|
|
$withAutofocusFn = 'withAutofocus';
|
|
include APP_ROOT . '/templates/partials/form/fieldset-academic.php';
|
|
?>
|
|
|
|
<!-- ═══════════════════ Composition du jury ═══════════════════ -->
|
|
<?php
|
|
$juryPromoteur = null;
|
|
$juryPromoteurUlb = null;
|
|
$lecteursInternes = [];
|
|
$lecteursExternes = [];
|
|
$juryPresident = null;
|
|
$showPresident = false;
|
|
$showPromoteurUlb = true;
|
|
$promoteurUlbConditional = false;
|
|
require APP_ROOT . '/templates/partials/form/jury-fieldset.php';
|
|
?>
|
|
|
|
<!-- ═══════════════════ Format(s) ═══════════════════ -->
|
|
<fieldset>
|
|
<legend>Format(s)</legend>
|
|
<?php
|
|
$name = 'formats'; $label = 'Format(s) du TFE :'; $options = $formatTypes; $checked = $formData['formats'] ?? []; $required = true;
|
|
$hxPost = '/partage/format-website-fragment';
|
|
$hxTarget = '#website-url-fieldset';
|
|
// Capture before include unsets it
|
|
$_checkedFormatsForSiteWeb = $checked;
|
|
include APP_ROOT . '/templates/partials/form/checkbox-list.php';
|
|
?>
|
|
</fieldset>
|
|
|
|
<!-- ═══════════════════ Fichiers ═══════════════════ -->
|
|
<?php include APP_ROOT . '/templates/partials/form/fieldset-files.php'; ?>
|
|
|
|
<!-- Website URL fieldset — shown/hidden via HTMX when "Site web" checked -->
|
|
<fieldset id="website-url-fieldset" style="display:none">
|
|
<legend>Site web</legend>
|
|
|
|
<div class="admin-form-group">
|
|
<label for="website_url">URL du site :</label>
|
|
<div class="admin-file-input">
|
|
<input type="url"
|
|
id="website_url"
|
|
name="website_url"
|
|
value="<?= htmlspecialchars($formData['website_url'] ?? '') ?>"
|
|
placeholder="https://mon-tfe.erg.be">
|
|
<small>Si le TFE est un site web, entrez son URL ici. Il sera affiché comme un site embarqué sur la page du TFE.</small>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="admin-form-group">
|
|
<label for="website_label">Légende :</label>
|
|
<input type="text"
|
|
id="website_label"
|
|
name="website_label"
|
|
value="<?= htmlspecialchars($formData['website_label'] ?? '') ?>"
|
|
placeholder="Description du site (optionnel)"
|
|
class="admin-file-label-input"
|
|
style="max-width:400px;">
|
|
</div>
|
|
</fieldset>
|
|
<?php
|
|
// Server-side: show if Site web already checked (e.g. on error redirect)
|
|
$_stmt = Database::getInstance()->getConnection()->prepare('SELECT id FROM format_types WHERE name = ? LIMIT 1');
|
|
$_stmt->execute(['Site web']);
|
|
$_siteWebId = $_stmt->fetchColumn();
|
|
if ($_siteWebId && in_array((string)$_siteWebId, array_map('strval', $_checkedFormatsForSiteWeb), true)) {
|
|
echo '<script>document.getElementById("website-url-fieldset").style.display=""</script>';
|
|
}
|
|
?>
|
|
|
|
<!-- ═══════════════════ Métadonnées complémentaires ═══════════════════ -->
|
|
<?php
|
|
$oldFn = 'old';
|
|
$withAutofocusFn = 'withAutofocus';
|
|
include APP_ROOT . '/templates/partials/form/fieldset-metadata.php';
|
|
?>
|
|
|
|
<!-- ═══════════════════ Degrés d'ouverture et licences ═══════════════════ -->
|
|
<?php
|
|
$formData = $_SESSION['form_data'] ?? [];
|
|
$libreEnabled = ($siteSettings['access_type_libre_enabled'] ?? '0') === '1';
|
|
$interneEnabled = ($siteSettings['access_type_interne_enabled'] ?? '1') === '1';
|
|
$interditEnabled = ($siteSettings['access_type_interdit_enabled'] ?? '1') === '1';
|
|
$generalitiesHtml = $helpBlocks['fieldset_generalites'] ?? '';
|
|
$defaultAccessTypeId = 2;
|
|
include APP_ROOT . '/templates/partials/form/fieldset-licence-explanation.php';
|
|
?>
|
|
|
|
<!-- ═══════════════════ Note contextuelle ═══════════════════ -->
|
|
<fieldset>
|
|
<legend>Note contextuelle</legend>
|
|
<div>
|
|
<label for="context_note">Note contextuelle :</label>
|
|
<div>
|
|
<textarea id="context_note" name="context_note"
|
|
rows="4" maxlength="1500"><?= htmlspecialchars($formData['context_note'] ?? '') ?></textarea>
|
|
<small>Visible publiquement pour les TFE Interne ou Interdit. Max 1 500 caractères.</small>
|
|
</div>
|
|
</div>
|
|
</fieldset>
|
|
|
|
<!-- ═══════════════════ Backoffice ═══════════════════ -->
|
|
<fieldset>
|
|
<legend>Backoffice</legend>
|
|
|
|
<div class="admin-form-group">
|
|
<label for="jury_points">Points :</label>
|
|
<input type="number" id="jury_points" name="jury_points"
|
|
value="<?= htmlspecialchars($formData['jury_points'] ?? '') ?>"
|
|
step="0.01" min="0" max="20" placeholder="sur 20">
|
|
<small>Note du jury (interne, non visible publiquement).</small>
|
|
</div>
|
|
|
|
<div class="admin-form-group">
|
|
<label for="remarks">Remarques :</label>
|
|
<textarea id="remarks" name="remarks" rows="4"><?= htmlspecialchars($formData['remarks'] ?? '') ?></textarea>
|
|
<small>Notes internes (non visibles publiquement).</small>
|
|
</div>
|
|
|
|
<div class="admin-form-group">
|
|
<label for="contact_interne">Contact interne :</label>
|
|
<input type="email" id="contact_interne" name="contact_interne"
|
|
value="<?= htmlspecialchars($formData['contact_interne'] ?? '') ?>"
|
|
placeholder="ton.email@exemple.be">
|
|
<small>Adresse de contact interne (non visible publiquement).</small>
|
|
</div>
|
|
|
|
<div class="admin-form-group">
|
|
<label class="admin-checkbox-label">
|
|
<input type="checkbox" name="exemplaire_baiu" value="1"
|
|
<?= !empty($formData['exemplaire_baiu']) ? 'checked' : '' ?>>
|
|
Exemplaire physique BAIU
|
|
</label>
|
|
<small>Case logistique : cocher si un exemplaire physique est disponible à la BAIU.</small>
|
|
</div>
|
|
|
|
<div class="admin-form-group">
|
|
<label class="admin-checkbox-label">
|
|
<input type="checkbox" name="exemplaire_erg" value="1"
|
|
<?= !empty($formData['exemplaire_erg']) ? 'checked' : '' ?>>
|
|
Exemplaire physique ERG
|
|
</label>
|
|
<small>Case logistique : cocher si un exemplaire physique est disponible à l'ERG.</small>
|
|
</div>
|
|
</fieldset>
|
|
|
|
<div class="form-footer">
|
|
<button type="submit" name="go" class="btn btn--primary">Soumettre</button>
|
|
</div>
|
|
</form>
|
|
</main>
|