Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 38 additions & 0 deletions components/ILIAS/UI/src/Component/Input/Field/Factory.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
56 changes: 56 additions & 0 deletions components/ILIAS/UI/src/Component/Input/Field/LengthOfTime.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
<?php


/**
* This file is part of ILIAS, a powerful learning management system
* published by ILIAS open source e-Learning e.V.
*
* ILIAS is licensed with the GPL-3.0,
* see https://www.gnu.org/licenses/gpl-3.0.en.html
* You should have received a copy of said license along with the
* source code, too.
*
* If this is not the case or you just want to try ILIAS, you'll find
* us at:
* https://www.ilias.de
* https://github.com/ILIAS-eLearning
*
*********************************************************************/

declare(strict_types=1);

namespace ILIAS\UI\Component\Input\Field;

use ILIAS\UI\Component\Input\Container\Filter\FilterInput;
use DateInterval;

/**
* This describes the duration input.
*/
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 length of time
*/
public function withMinValue(DateInterval $date): self;


public function getMinValue(): ?DateInterval;

/**
* Maximum length of time
*/
public function withMaxValue(DateInterval $date): self;

/**
* Return the maximum date the input accepts.
*/
public function getMaxValue(): ?self;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<?php

/**
* This file is part of ILIAS, a powerful learning management system
* published by ILIAS open source e-Learning e.V.
*
* ILIAS is licensed with the GPL-3.0,
* see https://www.gnu.org/licenses/gpl-3.0.en.html
* You should have received a copy of said license along with the
* source code, too.
*
* If this is not the case or you just want to try ILIAS, you'll find
* us at:
* https://www.ilias.de
* https://github.com/ILIAS-eLearning
*
*********************************************************************/

declare(strict_types=1);

namespace ILIAS\UI\Component\Input\Field;

enum LengthOfTimeFieldPatterns: string {
case minutesSeconds = 'minutesSeconds';
case hoursMinutes = 'hoursMinutes';
case hoursMinutesSeconds = 'hoursMinutesSeconds';
case daysHoursMinutes = 'daysHoursMinutes';
}
Loading