From b5f502ecb803ebf4d4d4a3ce43e77bbccfcf599b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ferdinand=20Engl=C3=A4nder?= Date: Wed, 27 May 2026 10:10:34 +0200 Subject: [PATCH 1/2] WIP --- .../Component/Input/Field/LengthOfTime.php | 56 +++++++++++++++++++ .../Input/Field/LengthOfTimeFieldPatterns.php | 28 ++++++++++ 2 files changed, 84 insertions(+) create mode 100644 components/ILIAS/UI/src/Component/Input/Field/LengthOfTime.php create mode 100644 components/ILIAS/UI/src/Component/Input/Field/LengthOfTimeFieldPatterns.php diff --git a/components/ILIAS/UI/src/Component/Input/Field/LengthOfTime.php b/components/ILIAS/UI/src/Component/Input/Field/LengthOfTime.php new file mode 100644 index 000000000000..1c3fd28e689f --- /dev/null +++ b/components/ILIAS/UI/src/Component/Input/Field/LengthOfTime.php @@ -0,0 +1,56 @@ + Date: Tue, 2 Jun 2026 13:54:34 +0200 Subject: [PATCH 2/2] WIP --- .../UI/src/Component/Input/Field/Factory.php | 38 +++++++++++++++++++ .../Component/Input/Field/LengthOfTime.php | 12 +++--- .../Input/Field/LengthOfTimeFieldPatterns.php | 8 ++-- 3 files changed, 48 insertions(+), 10 deletions(-) diff --git a/components/ILIAS/UI/src/Component/Input/Field/Factory.php b/components/ILIAS/UI/src/Component/Input/Field/Factory.php index bc4c5e192525..492baf89d08b 100755 --- a/components/ILIAS/UI/src/Component/Input/Field/Factory.php +++ b/components/ILIAS/UI/src/Component/Input/Field/Factory.php @@ -797,4 +797,42 @@ public function markdown(MarkdownRenderer $md_renderer, string $label, string $b * @return \ILIAS\UI\Component\Input\Field\Rating */ public function rating(string $label, ?string $byline = null): Rating; + + /** + * --- + * description: + * purpose: > + * Use the Length of Time input to ask about durations in various units of time. + * composition: > + * Internally, the input consist of multiple numeric inputs to separate Days, Hours, Minutes etc. into + * multiple fields. + * effect: > + * The fields can be operated like any number field. When a field looses focus, the inputs are transformed to + * show the entered time in a human-readable form given the current field pattern. + * For example: 0 hours, 135 minutes would turn into 2 hours, 15 minutes. + * rivals: > + * Duration: > + * This field offers inputs to enter a start and end date (and optionally time). It's the better choice for + * "big picture" planning of events. The Length of Time Field is the right choice for durations with a + * flexible or an unknown start date. It is a good choice for timetable and schedule related items + * where duration matters more than the specific time of day. + * + * rules: + * wording: + * 1: > + * Internally, we avoid calling this Field by the name Duration as it already exists. However, in many + * cases "duration" is actually the best possible label to give. On the frontend you MAY call this field + * using the word "duration". + * accessibility: + * 1: > + * Aria Live Updates inform Screen Readers about the complete length of time entered throughout all input + * fields after a re-calculation into the more optimal format. + * + * --- + * @param string $label + * @param string|null $byline + * @param LengthOfTimeFieldPatterns $fieldPattern + * @return LengthOfTime + */ + public function lengthOfTime(string $label, ?string $byline = null, LengthOfTimeFieldPatterns $fieldPattern = LengthOfTimeFieldPatterns::hoursMinutes): LengthOfTime; } diff --git a/components/ILIAS/UI/src/Component/Input/Field/LengthOfTime.php b/components/ILIAS/UI/src/Component/Input/Field/LengthOfTime.php index 1c3fd28e689f..57462d384c40 100644 --- a/components/ILIAS/UI/src/Component/Input/Field/LengthOfTime.php +++ b/components/ILIAS/UI/src/Component/Input/Field/LengthOfTime.php @@ -30,27 +30,27 @@ interface LengthOfTime extends Group, FilterInput { /** - * + * Controls which of the fields (days, hours, minutes, seconds) are visible. * @param LengthOfTimeFieldPatterns $fieldPattern * @return self */ public function withFieldPattern(LengthOfTimeFieldPatterns $fieldPattern): self; /** - * Minimum duration length + * Minimum length of time */ - public function withMinValue(DateInterval $date): Duration; + public function withMinValue(DateInterval $date): self; public function getMinValue(): ?DateInterval; /** - * Maximum Duration Length + * Maximum length of time */ - public function withMaxValue(DateInterval $date): Duration; + public function withMaxValue(DateInterval $date): self; /** * Return the maximum date the input accepts. */ - public function getMaxValue(): ?DateInterval; + public function getMaxValue(): ?self; } diff --git a/components/ILIAS/UI/src/Component/Input/Field/LengthOfTimeFieldPatterns.php b/components/ILIAS/UI/src/Component/Input/Field/LengthOfTimeFieldPatterns.php index 5ebdd5682951..c9e5e8363305 100644 --- a/components/ILIAS/UI/src/Component/Input/Field/LengthOfTimeFieldPatterns.php +++ b/components/ILIAS/UI/src/Component/Input/Field/LengthOfTimeFieldPatterns.php @@ -21,8 +21,8 @@ namespace ILIAS\UI\Component\Input\Field; enum LengthOfTimeFieldPatterns: string { - case secondsMinutes = 'secondsMinutes'; - case minutesHours = 'minutesHours'; - case secondsMinutesHours = 'secondsMinutesHours'; - case minutesHoursDays = 'minutesHoursDays'; + case minutesSeconds = 'minutesSeconds'; + case hoursMinutes = 'hoursMinutes'; + case hoursMinutesSeconds = 'hoursMinutesSeconds'; + case daysHoursMinutes = 'daysHoursMinutes'; }