Files
xamxam/app/templates/admin/add.php
Pontoporeia bdd95341b0 Extract shared TFE form partial — single source of truth for add/edit/partage
Created templates/partials/form/form.php as the unified form template driven by
$mode ('add'|'edit'|'partage') and boolean flags for optional sections.

The three calling templates (templates/admin/add.php, templates/admin/edit.php,
partage/index.php renderShareLinkForm) now only set variables then include the
shared partial. ~200 lines of duplicated fieldset HTML eliminated.
2026-05-07 23:39:41 +02:00

50 lines
1.7 KiB
PHP

<main id="main-content">
<h1>Ajouter un TFE</h1>
<?php
// ── Variables for the shared form partial ─────────────────────────────────
$mode = 'add';
$formAction = 'actions/formulaire.php';
$hiddenFields = '<input type="hidden" name="csrf_token" value="' . htmlspecialchars($_SESSION["csrf_token"]) . '">';
$synopsisExtra = '';
// Jury: fresh add (all empty)
$juryPromoteur = null;
$juryPromoteurUlb = null;
$lecteursInternes = [];
$lecteursExternes = [];
$juryPresident = null;
$showPresident = false;
$showPromoteurUlb = true;
$promoteurUlbConditional = false;
// Licence / access
$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;
// Optional sections
$showContact = true;
$showContextNote = true;
$showBackoffice = true;
// Files: add mode
$filesMode = 'add';
// Website URL (repopulation)
$existingWebsiteUrl = $formData['website_url'] ?? '';
$existingWebsiteLabel = $formData['website_label'] ?? '';
// Backoffice (add mode: null → falls back to formData)
$currentRaw = [];
$currentAuthorEmail = null;
$currentAuthorShowContact = false;
$currentContextNote = null;
include APP_ROOT . '/templates/partials/form/form.php';
?>
</main>