ILIAS  release_8 Revision v8.24
class.ilADTDateTimeFormBridge.php
Go to the documentation of this file.
1<?php
2
3declare(strict_types=1);
22{
23 protected bool $invalid_input = false;
24 protected bool $text_input = false;
25
26 protected function isValidADT(ilADT $a_adt): bool
27 {
28 return ($a_adt instanceof ilADTDateTime);
29 }
30
31 public function setTextInputMode(bool $a_value): void
32 {
33 $this->text_input = $a_value;
34 }
35
36 public function addToForm(): void
37 {
38 $adt_date = $this->getADT()->getDate();
39 $date = new ilDateTimeInputGUI($this->getTitle(), $this->getElementId());
40 $date->setShowTime(true);
41 $this->addBasicFieldProperties($date, $this->getADT()->getCopyOfDefinition());
42 $date->setDate($adt_date);
43 $this->addToParentElement($date);
44 }
45
46 public function importFromPost(): void
47 {
48 $field = $this->getForm()->getItemByPostVar($this->getElementId());
49
50 // because of ilDateTime the ADT can only have valid dates
51 if (!$field->hasInvalidInput()) {
52 // ilPropertyFormGUI::checkInput() is pre-requisite
53 $this->getADT()->setDate($field->getDate());
54
55 $field->setDate($this->getADT()->getDate());
56 } else {
57 $this->invalid_input = true;
58 }
59 }
60
61 public function validate(): bool
62 {
63 // :TODO: error handling is done by ilDateTimeInputGUI
65 }
66}
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
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:12
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...