refactor form structure per new spec + fix

- split jury into interne/externe/ULB,
- remove president from student form,
- add language_autre,
- split duration into pages+minutes+annexes,
- move licence to degrés d'ouverture with CC2r,
- add license_custom,
- filter PACS from student AP list,
- editable généralités help block,
- Libre toggle per settings

Fix:
- missing comma after cc4r column in schema.sql
- remove duplicate form footer from partage template
- remove couverture from student files fieldset; add promoteur ULB conditional disable via JS on Approfondi
- promoteur ULB: remove 'si applicable', make required when visible
This commit is contained in:
Pontoporeia
2026-05-07 17:52:46 +02:00
parent dce0e0b301
commit 24d68dda59
21 changed files with 694 additions and 381 deletions

View File

@@ -23,6 +23,12 @@ $formData = $_SESSION['form_data'] ?? [];
unset($_SESSION['form_data']);
$autofocusField = App::consumeAutofocus();
// Site settings for licence / access type toggles
$siteSettings = Database::getInstance()->getAllSettings();
// Form help blocks
$helpBlocks = Database::getInstance()->getAllFormHelpBlocks();
$helpFn = fn(string $key) => $helpBlocks[$key]['content'] ?? '';
function withAutofocus(string $fieldName, array $attrs = []): array {
global $autofocusField;
if ($autofocusField === $fieldName) {

View File

@@ -17,6 +17,10 @@ if ($thesisId <= 0) {
$autofocusField = App::consumeAutofocus();
// Form help blocks for editable généralités
$helpBlocks = Database::getInstance()->getAllFormHelpBlocks();
$helpFn = fn(string $key) => $helpBlocks[$key]['content'] ?? '';
try {
$ctrl = ThesisEditController::create();
$view = $ctrl->load($thesisId);

View File

@@ -284,7 +284,6 @@ function renderShareLinkForm(string $slug, array $link): void
<?php
$oldFn = $shareOldFn;
$withAutofocusFn = $shareWithAutofocusFn;
// Inject fieldset intro note and synopsis-specific note via the partial's hook.
ob_start();
$helpContent = $helpFn('fieldset_synopsis');
include APP_ROOT . '/templates/partials/form/form-help-block.php';
@@ -294,26 +293,29 @@ function renderShareLinkForm(string $slug, array $link): void
include APP_ROOT . '/templates/partials/form/fieldset-tfe-info.php';
?>
<!-- ═══════════════════ Composition du jury ═══════════════════ -->
<?php
// Seed jury partial from repopulated $formData (share add-mode).
$juryPresident = old($formData, 'jury_president');
$juryPromoteur = old($formData, 'jury_promoteur');
$juryPromoteurExt = !empty($formData['jury_promoteur_ext']) ? 1 : 0;
$juryLecteurs = [];
for ($i = 0; $i < 4; $i++) {
$name = old($formData, "jury_lecteurs:$i");
if ($name !== '') {
$juryLecteurs[] = [
'name' => $name,
'is_external' => !empty($formData["jury_lecteurs_ext:$i"]) ? 1 : 0,
];
}
}
$helpContent = $helpFn('fieldset_jury');
include APP_ROOT . '/templates/partials/form/form-help-block.php';
require APP_ROOT . '/templates/partials/form/jury-fieldset.php';
?>
<!-- ═══════════════════ 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($formData, '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>
<!-- ═══════════════════ Format(s) ═══════════════════ -->
<fieldset>
<legend>Format(s)</legend>
<?php $name = 'formats'; $label = 'Format(s) du TFE :'; $options = $formatTypes; $checked = $formData['formats'] ?? []; include APP_ROOT . '/templates/partials/form/checkbox-list.php'; ?>
</fieldset>
<!-- ═══════════════════ Mots-clés ═══════════════════ -->
<fieldset>
<legend>Mots-clés</legend>
<?php
$name = 'tag'; $label = 'Mots-clés (max 10) :'; $value = old($formData, 'tag');
$placeholder = 'sociologie, anthropologie, ...';
$hint = 'Séparez par des virgules. Max 10 mots-clés.';
include APP_ROOT . '/templates/partials/form/text-field.php';
?>
</fieldset>
<!-- ═══════════════════ Cadre académique ═══════════════════ -->
<?php
@@ -324,6 +326,29 @@ function renderShareLinkForm(string $slug, array $link): void
include APP_ROOT . '/templates/partials/form/fieldset-academic.php';
?>
<!-- ═══════════════════ Composition du jury ═══════════════════ -->
<?php
$juryPromoteur = old($formData, 'jury_promoteur');
$juryPromoteurUlb = old($formData, 'jury_promoteur_ulb_name');
$lecteursInternes = [];
$lecteursExternes = [];
for ($i = 0; $i < 10; $i++) {
$n = old($formData, "jury_lecteur_interne:$i");
if ($n !== '') $lecteursInternes[] = ['name' => $n];
}
for ($i = 0; $i < 10; $i++) {
$n = old($formData, "jury_lecteur_externe:$i");
if ($n !== '') $lecteursExternes[] = ['name' => $n];
}
$juryPresident = null;
$showPresident = false;
$showPromoteurUlb = true;
$promoteurUlbConditional = true;
$helpContent = $helpFn('fieldset_jury');
include APP_ROOT . '/templates/partials/form/form-help-block.php';
require APP_ROOT . '/templates/partials/form/jury-fieldset.php';
?>
<!-- ═══════════════════ Fichiers ═══════════════════ -->
<?php
$helpContent = $helpFn('fieldset_files');
@@ -333,17 +358,22 @@ function renderShareLinkForm(string $slug, array $link): void
<!-- ═══════════════════ Métadonnées complémentaires ═══════════════════ -->
<?php
$oldFn = $shareOldFn;
$withAutofocusFn = $shareWithAutofocusFn;
$showDescription = false;
$defaultAccessTypeId = 2;
$helpContent = $helpFn('fieldset_access');
include APP_ROOT . '/templates/partials/form/form-help-block.php';
$oldFn = $shareOldFn;
$withAutofocusFn = $shareWithAutofocusFn;
include APP_ROOT . '/templates/partials/form/fieldset-metadata.php';
?>
<!-- ═══════════════════ Degrés d'ouverture et licences ═══════════════════ -->
<?php include APP_ROOT . '/templates/partials/form/fieldset-licence-explanation.php'; ?>
<?php
$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 = $helpFn('fieldset_generalites');
$defaultAccessTypeId = 2;
$helpContent = $helpFn('fieldset_access');
include APP_ROOT . '/templates/partials/form/form-help-block.php';
include APP_ROOT . '/templates/partials/form/fieldset-licence-explanation.php';
?>
<!-- ═══════════════════ E-mail de confirmation ═══════════ -->
<fieldset>
@@ -351,7 +381,7 @@ function renderShareLinkForm(string $slug, array $link): void
<?php $helpContent = $helpFn('fieldset_email'); include APP_ROOT . '/templates/partials/form/form-help-block.php'; ?>
<?php
$name = 'confirmation_email';
$label = 'Adresse e-mail * :';
$label = 'Adresse e-mail :';
$value = old($formData, 'confirmation_email');
$type = 'email';
$required = true;