ILIAS  Release_5_0_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
ilADTDateTimeFormBridge Class Reference
+ Inheritance diagram for ilADTDateTimeFormBridge:
+ Collaboration diagram for ilADTDateTimeFormBridge:

Public Member Functions

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

Protected Member Functions

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

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.ilADTDateTimeFormBridge.php.

Member Function Documentation

ilADTDateTimeFormBridge::addToForm ( )

Add ADT-specific fields to form.

Reimplemented from ilADTFormBridge.

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

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

{
global $lng;
$adt_date = $this->getADT()->getDate();
$date = new ilDateTimeInputGUI($this->getTitle(), $this->getElementId());
$date->setShowTime(true);
$this->addBasicFieldProperties($date, $this->getADT()->getCopyOfDefinition());
if((bool)$this->text_input)
{
}
else
{
if(!$this->isRequired())
{
$date->enableDateActivation("", $this->getElementId()."_tgl", !(!$adt_date || $adt_date->isNull()));
}
}
$date->setDate($adt_date);
$this->addToParentElement($date);
}

+ Here is the call graph for this function:

ilADTDateTimeFormBridge::importFromPost ( )

Import values from form request POST data.

Reimplemented from ilADTFormBridge.

Definition at line 48 of file class.ilADTDateTimeFormBridge.php.

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

{
$field = $this->getForm()->getItemByPostvar($this->getElementId());
// :TODO: refactor ilDateTimeInputGUI
// because of ilDateTime the ADT can only have valid dates
if(!$field->invalid_input)
{
$date = null;
$toggle = true;
if(!$this->isRequired() &&
!(bool)$this->text_input)
{
// :TODO: should be handle by ilDateTimeInputGUI
$toggle = $_POST[$field->getActivationPostVar()];
}
if($toggle)
{
// ilPropertyFormGUI::checkInput() is pre-requisite
$incoming = $this->getForm()->getInput($this->getElementId());
if($incoming["date"] && $incoming["time"])
{
$date = new ilDateTime($incoming["date"]." ".$incoming["time"], IL_CAL_DATETIME);
}
}
$this->getADT()->setDate($date);
$field->setDate($this->getADT()->getDate());
}
else
{
$this->invalid_input = true;
}
}

+ Here is the call graph for this function:

ilADTDateTimeFormBridge::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.ilADTDateTimeFormBridge.php.

{
return ($a_adt instanceof ilADTDateTime);
}
ilADTDateTimeFormBridge::setTextInputMode (   $a_value)

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

{
$this->text_input = (bool)$a_value;
}
ilADTDateTimeFormBridge::validate ( )

Validate ADT and parse error codes.

Returns
boolean

Reimplemented from ilADTFormBridge.

Definition at line 89 of file class.ilADTDateTimeFormBridge.php.

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

Field Documentation

ilADTDateTimeFormBridge::$invalid_input
protected

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

ilADTDateTimeFormBridge::$text_input
protected

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


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