mirror of
https://codeberg.org/PostERG/xamxam.git
synced 2026-08-10 15:21:22 +02:00
refactor: combined duration (pages + minutes), has_annexes checkbox, remove Mo
- Remove Mo option from duration, keep only pages and minutes - Redesign duration fieldset: separate Pages input + Durée h:m inputs, both can be set together - Fix minutes input visibility: wider inputs (6ch), proper CSS layout - Add has_annexes checkbox to fichiers fragment + DB column + controllers - Display duration on admin backoffice recap page - Display duration on public partage recap page - Update public TFE page for new combined duration format - Migration 041: add duration_pages, duration_minutes, has_annexes columns; migrate data; recreate views
This commit is contained in:
@@ -46,29 +46,23 @@
|
||||
</p>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if (!empty($data["duration_value"]) && !empty($data["duration_unit"])): ?>
|
||||
<?php
|
||||
$_dVal = (float)$data["duration_value"];
|
||||
$_dUnit = $data["duration_unit"];
|
||||
$_label = match($_dUnit) {
|
||||
'pages' => 'pages',
|
||||
'mo' => 'Mo',
|
||||
'durée' => '',
|
||||
default => $_dUnit,
|
||||
};
|
||||
if ($_dUnit === 'durée') {
|
||||
$_hours = (int)floor($_dVal);
|
||||
$_mins = (int)round(($_dVal - $_hours) * 60);
|
||||
$_display = ($_mins > 0) ? "{$_hours}h{$_mins}" : "{$_hours}h";
|
||||
} else {
|
||||
$_display = ($_dVal == (int)$_dVal) ? (int)$_dVal : $_dVal;
|
||||
}
|
||||
$_hasPages = isset($data["duration_pages"]) && $data["duration_pages"] !== null;
|
||||
$_hasMins = isset($data["duration_minutes"]) && $data["duration_minutes"] !== null;
|
||||
if ($_hasPages || $_hasMins):
|
||||
$_parts = [];
|
||||
if ($_hasPages) $_parts[] = $data['duration_pages'] . ' pages';
|
||||
if ($_hasMins) {
|
||||
$_h = (int)floor($data['duration_minutes'] / 60);
|
||||
$_m = $data['duration_minutes'] % 60;
|
||||
$_parts[] = $_h . 'h' . str_pad((string)$_m, 2, '0', STR_PAD_LEFT);
|
||||
}
|
||||
?>
|
||||
<p class="tfe-meta-item">
|
||||
<span class="tfe-meta-label">Durée :</span>
|
||||
<?= $_display ?><?= $_label ? ' ' . htmlspecialchars($_label) : '' ?>
|
||||
<?= htmlspecialchars(implode(', ', $_parts)) ?>
|
||||
</p>
|
||||
<?php unset($_dVal, $_dUnit, $_label, $_display, $_hours, $_mins); endif; ?>
|
||||
<?php unset($_hasPages, $_hasMins, $_parts, $_h, $_m); endif; ?>
|
||||
|
||||
<?php if (!empty($data["languages"])): ?>
|
||||
<p class="tfe-meta-item">
|
||||
|
||||
Reference in New Issue
Block a user