19declare(strict_types=1);
28use ILIAS\UI\Implementation\Component\ComponentHelper;
50 DataFactory $data_factory,
58 $field_factory->dateTime(
$lng->txt(
'duration_default_label_start'),
null)->withDedicatedName(
'start'),
59 $field_factory->dateTime(
$lng->txt(
'duration_default_label_end'),
null)->withDedicatedName(
'end')
77 list($from, $until) = $v;
78 if ($from && $until) {
79 return [
'start' => $from,
'end' => $until,
'interval' => $from->diff($until)];
83 $this->setAdditionalTransformation(
$duration);
91 $txt_id =
'duration_end_must_not_be_earlier_than_start';
93 $is_ok =
function ($v) {
97 return $v[
'start'] <= $v[
'end'];
100 $from_before_until = $this->
refinery->custom()->constraint($is_ok,
$error);
101 $this->setAdditionalTransformation($from_before_until);
109 $clone = clone $this;
111 $clone->applyFormat();
128 $this->inputs = array_map(
129 fn($input) => $input->withFormat($this->getFormat()),
139 $clone = clone $this;
140 $clone->min_date = $date;
150 $this->inputs = array_map(
151 fn($input) => $input->withMinValue($this->getMinValue()),
169 $clone = clone $this;
170 $clone->max_date = $date;
180 $this->inputs = array_map(
181 fn($inpt) => $inpt->withMaxValue($this->getMaxValue()),
199 $clone = clone $this;
200 $clone->with_time_only = $time_only;
210 $this->inputs = array_map(
211 fn($input) => $input->withTimeOnly($this->getTimeOnly()),
229 $clone = clone $this;
231 $clone->applyWithUseTime();
248 $this->inputs = array_map(
249 fn($input) => $input->withUseTime($this->getUseTime()),
259 $clone = clone $this;
260 $clone->timezone = $tz;
261 $clone->inputs = array_map(
262 fn($input) => $input->withTimezone($tz),
289 if ($this->requirement_constraint !==
null) {
290 return $this->requirement_constraint;
301 return fn(
$id) =>
"var combinedDuration = function() {
303 $('#$id').find('input').each(function() {
304 options.push($(this).val());
306 return options.join(' - ');
308 $('#$id').on('input', function(event) {
309 il.UI.input.onFieldUpdate(event, '$id', combinedDuration());
311 il.UI.input.onFieldUpdate(event, '$id', combinedDuration());";
316 $clone = clone $this;
318 $clone->inputs[0]->withLabel($start_label),
319 $clone->inputs[1]->withLabel($end_label)
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
A constraint encodes some resrtictions on values.
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
trait JavaScriptBindable
Trait for components implementing JavaScriptBindable providing standard implementation.
Interface Observer \BackgroundTasks Contains several chained tasks and infos about them.