mirror of
https://codeberg.org/PostERG/xamxam.git
synced 2026-06-25 16:19:19 +02:00
47 lines
1.6 KiB
PHP
47 lines
1.6 KiB
PHP
<?php
|
|
/**
|
|
* HTMX fragment (admin): renders the licence section with conditional required states.
|
|
*
|
|
* POST: access_type_id, license_id, license_custom, cc2r, admin_mode
|
|
*
|
|
* Admin mode: never required.
|
|
*/
|
|
require_once __DIR__ . '/../../bootstrap.php';
|
|
require_once __DIR__ . '/../../src/AdminAuth.php';
|
|
AdminAuth::requireLogin();
|
|
|
|
$accessTypeId = $_POST['access_type_id'] ?? '2';
|
|
$licenseId = $_POST['license_id'] ?? '';
|
|
$licenseCustom = $_POST['license_custom'] ?? '';
|
|
$cc2r = !empty($_POST['cc2r']);
|
|
$adminMode = true;
|
|
|
|
require_once APP_ROOT . '/src/Database.php';
|
|
$db = Database::getInstance();
|
|
$licenseTypes = $db->getAllLicenseTypes();
|
|
?>
|
|
|
|
<div class="licence-license-choice">
|
|
<?php
|
|
$name = 'license_id'; $label = 'Licence :'; $options = $licenseTypes;
|
|
$selected = $licenseId; $placeholder = '— Sélectionner —'; $required = false;
|
|
include APP_ROOT . '/templates/partials/form/select-field.php';
|
|
?>
|
|
|
|
<?php
|
|
$name = 'license_custom'; $label = 'Ou précisez une autre licence :';
|
|
$value = htmlspecialchars($licenseCustom);
|
|
$hint = 'Ex: CC BY-NC 4.0, Tous droits réservés...';
|
|
include APP_ROOT . '/templates/partials/form/text-field.php';
|
|
?>
|
|
|
|
<div class="admin-form-group">
|
|
<label class="admin-checkbox-label">
|
|
<input type="checkbox" name="cc2r" value="1"
|
|
<?= $cc2r ? 'checked' : '' ?>>
|
|
J'accepte les Conditions Collectives de Réutilisation (CC2r)
|
|
</label>
|
|
<small><a href="https://cc2r.net/" target="_blank" rel="noopener">En savoir plus sur la CC2r ↗</a></small>
|
|
</div>
|
|
</div>
|