ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
class.ilADTDateTimeFormBridge.php
Go to the documentation of this file.
1 <?php
2 
3 require_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 $lng;
23 
24  $adt_date = $this->getADT()->getDate();
25 
26  $date = new ilDateTimeInputGUI($this->getTitle(), $this->getElementId());
27  $date->setShowTime(true);
28 
29  $this->addBasicFieldProperties($date, $this->getADT()->getCopyOfDefinition());
30 
31  $date->setDate($adt_date);
32 
33  $this->addToParentElement($date);
34  }
35 
36  public function importFromPost()
37  {
38  $field = $this->getForm()->getItemByPostvar($this->getElementId());
39 
40  // because of ilDateTime the ADT can only have valid dates
41  if(!$field->hasInvalidInput())
42  {
43  // ilPropertyFormGUI::checkInput() is pre-requisite
44  $this->getADT()->setDate($field->getDate());
45 
46  $field->setDate($this->getADT()->getDate());
47  }
48  else
49  {
50  $this->invalid_input = true;
51  }
52  }
53 
54  public function validate()
55  {
56  // :TODO: error handling is done by ilDateTimeInputGUI
57  return !(bool)$this->invalid_input;
58  }
59 }
60 
61 ?>
addToParentElement(ilFormPropertyGUI $a_field)
Add form field to parent element.
ADT form bridge base class.
ADT base class.
Definition: class.ilADT.php:11
addBasicFieldProperties(ilFormPropertyGUI $a_field, ilADTDefinition $a_def)
Helper method to handle generic properties like setRequired(), setInfo()
This class represents a date/time property in a property form.
getElementId()
Get element id.
global $lng
Definition: privfeed.php:17