ILIAS  release_7 Revision v7.30-3-g800a261c036
class.ilADTDateTimeFormBridge.php
Go to the documentation of this file.
1<?php
2
3require_once "Services/ADT/classes/Bridges/class.ilADTFormBridge.php";
4
6{
7 protected $invalid_input; // [bool]
8 protected $text_input; // [bool]
9
10 protected function isValidADT(ilADT $a_adt)
11 {
12 return ($a_adt instanceof ilADTDateTime);
13 }
14
15 public function setTextInputMode($a_value)
16 {
17 $this->text_input = (bool) $a_value;
18 }
19
20 public function addToForm()
21 {
22 global $DIC;
23
24 $lng = $DIC['lng'];
25
26 $adt_date = $this->getADT()->getDate();
27
28 $date = new ilDateTimeInputGUI($this->getTitle(), $this->getElementId());
29 $date->setShowTime(true);
30
31 $this->addBasicFieldProperties($date, $this->getADT()->getCopyOfDefinition());
32
33 $date->setDate($adt_date);
34
35 $this->addToParentElement($date);
36 }
37
38 public function importFromPost()
39 {
40 $field = $this->getForm()->getItemByPostvar($this->getElementId());
41
42 // because of ilDateTime the ADT can only have valid dates
43 if (!$field->hasInvalidInput()) {
44 // ilPropertyFormGUI::checkInput() is pre-requisite
45 $this->getADT()->setDate($field->getDate());
46
47 $field->setDate($this->getADT()->getDate());
48 } else {
49 $this->invalid_input = true;
50 }
51 }
52
53 public function validate()
54 {
55 // :TODO: error handling is done by ilDateTimeInputGUI
56 return !(bool) $this->invalid_input;
57 }
58}
An exception for terminatinating execution or to throw for unit testing.
importFromPost()
Import values from form request POST data.
validate()
Validate ADT and parse error codes.
addToForm()
Add ADT-specific fields to form.
isValidADT(ilADT $a_adt)
Check if given ADT is valid.
ADT form bridge base class.
addBasicFieldProperties(ilFormPropertyGUI $a_field, ilADTDefinition $a_def)
Helper method to handle generic properties like setRequired(), setInfo()
getElementId()
Get element id.
addToParentElement(ilFormPropertyGUI $a_field)
Add form field to parent element.
ADT base class.
Definition: class.ilADT.php:12
This class represents a date/time property in a property form.
global $DIC
Definition: goto.php:24
$lng