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

Public Member Functions

 addToForm ()
 Add ADT-specific fields to form.
 importFromPost ()
 Import values from form request POST data.
- 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.
 validate ()
 Validate ADT and parse error codes.
 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)

Additional Inherited Members

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

Detailed Description

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

Member Function Documentation

ilADTLocationFormBridge::addToForm ( )

Add ADT-specific fields to form.

Reimplemented from ilADTFormBridge.

Definition at line 12 of file class.ilADTLocationFormBridge.php.

References ilADTFormBridge\$adt, $lng, ilADTFormBridge\$title, ilADTFormBridge\addBasicFieldProperties(), ilADTFormBridge\addToParentElement(), ilADTFormBridge\getADT(), ilMapUtil\getDefaultSettings(), ilADTFormBridge\getElementId(), ilADTFormBridge\getTitle(), and ilADTFormBridge\isRequired().

{
global $lng;
$adt = $this->getADT();
$default = false;
if($adt->isNull())
{
// see ilPersonalProfileGUI::addLocationToForm()
// use installation default
include_once("./Services/Maps/classes/class.ilMapUtil.php");
$adt->setLatitude($def["latitude"]);
$adt->setLongitude($def["longitude"]);
$adt->setZoom($def["zoom"]);
$default = true;
}
// :TODO: title?
$title = $this->isRequired()
? $this->getTitle()
: $lng->txt("location");
$loc = new ilLocationInputGUI($title, $this->getElementId());
$loc->setLongitude($adt->getLongitude());
$loc->setLatitude($adt->getLatitude());
$loc->setZoom($adt->getZoom());
$this->addBasicFieldProperties($loc, $adt->getCopyOfDefinition());
if(!$this->isRequired())
{
$optional = new ilCheckboxInputGUI($this->getTitle(), $this->getElementId()."_tgl");
$optional->addSubItem($loc);
$this->addToParentElement($optional);
if(!$default && !$adt->isNull())
{
$optional->setChecked(true);
}
}
else
{
$this->addToParentElement($loc);
}
}

+ Here is the call graph for this function:

ilADTLocationFormBridge::importFromPost ( )

Import values from form request POST data.

Reimplemented from ilADTFormBridge.

Definition at line 62 of file class.ilADTLocationFormBridge.php.

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

{
$do_import = true;
if(!$this->isRequired())
{
$toggle = $this->getForm()->getInput($this->getElementId()."_tgl");
if(!$toggle)
{
$do_import = false;
}
}
if($do_import)
{
// ilPropertyFormGUI::checkInput() is pre-requisite
$incoming = $this->getForm()->getInput($this->getElementId());
$this->getADT()->setLongitude($incoming["longitude"]);
$this->getADT()->setLatitude($incoming["latitude"]);
$this->getADT()->setZoom($incoming["zoom"]);
}
else
{
$this->getADT()->setLongitude(null);
$this->getADT()->setLatitude(null);
$this->getADT()->setZoom(null);
}
$field = $this->getForm()->getItemByPostvar($this->getElementId());
$field->setLongitude($this->getADT()->getLongitude());
$field->setLatitude($this->getADT()->getLatitude());
$field->setZoom($this->getADT()->getZoom());
}

+ Here is the call graph for this function:

ilADTLocationFormBridge::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 7 of file class.ilADTLocationFormBridge.php.

{
return ($a_adt instanceof ilADTLocation);
}

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