ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
ilADTDateFormBridge Class Reference
+ Inheritance diagram for ilADTDateFormBridge:
+ Collaboration diagram for ilADTDateFormBridge:

Public Member Functions

 setTextInputMode ($a_value)
 
 addToForm ()
 Add ADT-specific fields to form. More...
 
 importFromPost ()
 Import values from form request POST data. More...
 
 validate ()
 Validate ADT and parse error codes. More...
 
- Public Member Functions inherited from ilADTFormBridge
 __construct (ilADT $a_adt)
 Constructor. More...
 
 getADT ()
 Get ADT. More...
 
 setForm (ilPropertyFormGUI $a_form)
 Set form. More...
 
 getForm ()
 Get form. More...
 
 setElementId ($a_value)
 Set element id (aka form field) More...
 
 getElementId ()
 Get element id. More...
 
 setTitle ($a_value)
 Set title (aka form field caption) More...
 
 getTitle ()
 Get title. More...
 
 setInfo ($a_value)
 Set info (aka form field info text) More...
 
 getInfo ()
 Get info. More...
 
 setParentElement ($a_value)
 Set parent element. More...
 
 getParentElement ()
 Get parent element. More...
 
 setDisabled ($a_value)
 Set disabled. More...
 
 isDisabled ()
 Get disabled. More...
 
 setRequired ($a_value)
 Set required. More...
 
 isRequired ()
 Get required. More...
 
 addToForm ()
 Add ADT-specific fields to form. More...
 
 addJS (ilTemplate $a_tpl)
 Add ADT-specific JS-files to template. More...
 
 shouldBeImportedFromPost (ilADTFormBridge $a_parent_adt=null)
 Check if incoming values should be imported at all. More...
 
 importFromPost ()
 Import values from form request POST data. More...
 
 validate ()
 Validate ADT and parse error codes. More...
 
 setExternalErrors ($a_errors)
 

Protected Member Functions

 isValidADT (ilADT $a_adt)
 Check if given ADT is valid. More...
 
 addToElementId ($a_add)
 
- Protected Member Functions inherited from ilADTFormBridge
 isValidADT (ilADT $a_adt)
 Check if given ADT is valid. More...
 
 setADT (ilADT $a_adt)
 Set ADT. More...
 
 addBasicFieldProperties (ilFormPropertyGUI $a_field, ilADTDefinition $a_def)
 Helper method to handle generic properties like setRequired(), setInfo() More...
 
 findParentElementInForm ()
 Try to find parent element in form (could be option) More...
 
 addToParentElement (ilFormPropertyGUI $a_field)
 Add form field to parent element. More...
 
 isActiveForSubItems ($a_parent_option=null)
 Check if element is currently active for subitem(s) More...
 

Protected Attributes

 $invalid_input
 
 $text_input
 
- Protected Attributes inherited from ilADTFormBridge
 $adt
 
 $form
 
 $id
 
 $title
 
 $info
 
 $parent_element
 
 $required
 
 $disabled
 

Detailed Description

Definition at line 5 of file class.ilADTDateFormBridge.php.

Member Function Documentation

◆ addToElementId()

ilADTDateFormBridge::addToElementId (   $a_add)
protected

Definition at line 20 of file class.ilADTDateFormBridge.php.

21 {
22 return $this->getElementId()."[".$a_add."]";
23 }
getElementId()
Get element id.

References ilADTFormBridge\getElementId().

+ Here is the call graph for this function:

◆ addToForm()

ilADTDateFormBridge::addToForm ( )

Add ADT-specific fields to form.

Reimplemented from ilADTFormBridge.

Definition at line 25 of file class.ilADTDateFormBridge.php.

26 {
27 $adt_date = $this->getADT()->getDate();
28
29 $date = new ilDateTimeInputGUI($this->getTitle(), $this->getElementId());
30 $date->setShowTime(false);
31
32 $this->addBasicFieldProperties($date, $this->getADT()->getCopyOfDefinition());
33
34 if((bool)$this->text_input)
35 {
36 $date->setMode(ilDateTimeInputGUI::MODE_INPUT);
37 }
38 else
39 {
40 if(!$this->isRequired())
41 {
42 $date->enableDateActivation("", $this->getElementId()."_tgl", !(!$adt_date || $adt_date->isNull()));
43 }
44 }
45
46 $date->setDate($adt_date);
47
48 $this->addToParentElement($date);
49 }
addBasicFieldProperties(ilFormPropertyGUI $a_field, ilADTDefinition $a_def)
Helper method to handle generic properties like setRequired(), setInfo()
addToParentElement(ilFormPropertyGUI $a_field)
Add form field to parent element.
isRequired()
Get required.
This class represents a date/time property in a property form.

References ilADTFormBridge\addBasicFieldProperties(), ilADTFormBridge\addToParentElement(), ilADTFormBridge\getADT(), ilADTFormBridge\getElementId(), ilADTFormBridge\getTitle(), ilADTFormBridge\isRequired(), and ilDateTimeInputGUI\MODE_INPUT.

+ Here is the call graph for this function:

◆ importFromPost()

ilADTDateFormBridge::importFromPost ( )

Import values from form request POST data.

Reimplemented from ilADTFormBridge.

Definition at line 51 of file class.ilADTDateFormBridge.php.

52 {
53 $field = $this->getForm()->getItemByPostvar($this->getElementId());
54
55 // :TODO: refactor ilDateTimeInputGUI
56
57 // because of ilDate the ADT can only have valid dates
58
59 if(!$field->invalid_input)
60 {
61 $date = null;
62
63 $toggle = true;
64
65 if(!$this->isRequired() &&
66 !(bool)$this->text_input)
67 {
68 // :TODO: should be handle by ilDateTimeInputGUI
69 $toggle = $_POST[$field->getActivationPostVar()];
70 }
71
72 if($toggle)
73 {
74 // ilPropertyFormGUI::checkInput() is pre-requisite
75 $incoming = $this->getForm()->getInput($this->getElementId());
76 if($incoming["date"])
77 {
78 $date = new ilDate($incoming["date"], IL_CAL_DATE);
79 }
80 }
81
82 $this->getADT()->setDate($date);
83
84 $field->setDate($this->getADT()->getDate());
85 }
86 else
87 {
88 $this->invalid_input = true;
89 }
90 }
const IL_CAL_DATE
Class for single dates.
$_POST['username']
Definition: cron.php:12

References $_POST, ilADTFormBridge\getADT(), ilADTFormBridge\getElementId(), ilADTFormBridge\getForm(), IL_CAL_DATE, and ilADTFormBridge\isRequired().

+ Here is the call graph for this function:

◆ isValidADT()

ilADTDateFormBridge::isValidADT ( ilADT  $a_adt)
protected

Check if given ADT is valid.

:TODO: This could be avoided with type-specifc constructors :TODO: bridge base class?

Parameters
ilADT$a_adt

Reimplemented from ilADTFormBridge.

Definition at line 10 of file class.ilADTDateFormBridge.php.

11 {
12 return ($a_adt instanceof ilADTDate);
13 }

◆ setTextInputMode()

ilADTDateFormBridge::setTextInputMode (   $a_value)

Definition at line 15 of file class.ilADTDateFormBridge.php.

16 {
17 $this->text_input = (bool)$a_value;
18 }

◆ validate()

ilADTDateFormBridge::validate ( )

Validate ADT and parse error codes.

Returns
boolean

Reimplemented from ilADTFormBridge.

Definition at line 92 of file class.ilADTDateFormBridge.php.

93 {
94 // :TODO: error handling is done by ilDateTimeInputGUI
95 return !(bool)$this->invalid_input;
96 }

Field Documentation

◆ $invalid_input

ilADTDateFormBridge::$invalid_input
protected

Definition at line 7 of file class.ilADTDateFormBridge.php.

◆ $text_input

ilADTDateFormBridge::$text_input
protected

Definition at line 8 of file class.ilADTDateFormBridge.php.


The documentation for this class was generated from the following file: