ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
class.ilADTDateTimeFormBridge.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
21{
22 protected bool $invalid_input = false;
23 protected bool $text_input = false;
24
25 protected function isValidADT(ilADT $a_adt): bool
26 {
27 return ($a_adt instanceof ilADTDateTime);
28 }
29
30 public function setTextInputMode(bool $a_value): void
31 {
32 $this->text_input = $a_value;
33 }
34
35 public function addToForm(): void
36 {
37 $adt_date = $this->getADT()->getDate();
38 $date = new ilDateTimeInputGUI($this->getTitle(), $this->getElementId());
39 $date->setShowTime(true);
40 $this->addBasicFieldProperties($date, $this->getADT()->getCopyOfDefinition());
41 $date->setDate($adt_date);
42 $this->addToParentElement($date);
43 }
44
45 public function importFromPost(): void
46 {
47 $field = $this->getForm()->getItemByPostVar($this->getElementId());
48
49 // because of ilDateTime the ADT can only have valid dates
50 if (!$field->hasInvalidInput()) {
51 // ilPropertyFormGUI::checkInput() is pre-requisite
52 $this->getADT()->setDate($field->getDate());
53
54 $field->setDate($this->getADT()->getDate());
55 } else {
56 $this->invalid_input = true;
57 }
58 }
59
60 public function validate(): bool
61 {
62 // :TODO: error handling is done by ilDateTimeInputGUI
64 }
65}
importFromPost()
Import values from form request POST data.
addToForm()
Add ADT-specific fields to form.
ADT form bridge base class.
addBasicFieldProperties(ilFormPropertyGUI $a_field, ilADTDefinition $a_def)
Helper method to handle generic properties like setRequired(), setInfo()
addToParentElement(ilFormPropertyGUI $a_field)
ADT base class.
Definition: class.ilADT.php:26
This class represents a date/time property in a property form.