mirror of
https://codeberg.org/PostERG/xamxam.git
synced 2026-06-25 16:19:19 +02:00
47 lines
1.5 KiB
PHP
47 lines
1.5 KiB
PHP
<?php
|
|
/**
|
|
* language-autre-fragment.php
|
|
*
|
|
* HTMX fragment: returns the "Autre(s) langue(s)" input row when no standard
|
|
* language checkbox is checked, or an empty hidden placeholder when at least
|
|
* one is checked.
|
|
*
|
|
* Expected POST:
|
|
* languages[] — selected language IDs (may be absent)
|
|
* language_autre — current free-text value (for repopulation)
|
|
*/
|
|
require_once __DIR__ . '/../bootstrap.php';
|
|
|
|
$selectedIds = isset($_POST['languages']) && is_array($_POST['languages'])
|
|
? $_POST['languages']
|
|
: [];
|
|
$currentValue = htmlspecialchars(trim($_POST['language_autre'] ?? ''));
|
|
$anyChecked = !empty($selectedIds);
|
|
?>
|
|
<div id="language-autre-row">
|
|
<?php if (!$anyChecked): ?>
|
|
<div>
|
|
<label for="language_autre">Autre(s) langue(s) : <span class="asterisk">*</span></label>
|
|
<div>
|
|
<input type="text"
|
|
id="language_autre"
|
|
name="language_autre"
|
|
value="<?= $currentValue ?>"
|
|
required>
|
|
<small>Si votre TFE contient une langue absente de la liste, précisez-la ici.</small>
|
|
</div>
|
|
</div>
|
|
<?php else: ?>
|
|
<div>
|
|
<label for="language_autre">Autre(s) langue(s) :</label>
|
|
<div>
|
|
<input type="text"
|
|
id="language_autre"
|
|
name="language_autre"
|
|
value="<?= $currentValue ?>">
|
|
<small>Si votre TFE contient une langue absente de la liste, précisez-la ici.</small>
|
|
</div>
|
|
</div>
|
|
<?php endif; ?>
|
|
</div>
|