ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ilADTLocationFormBridge Class Reference
+ Inheritance diagram for ilADTLocationFormBridge:
+ Collaboration diagram for ilADTLocationFormBridge:

Public Member Functions

 addToForm ()
 Add ADT-specific fields to form. More...
 
 importFromPost ()
 Import values from form request POST data. More...
 
- Public Member Functions inherited from ilADTFormBridge
 __construct (ilADT $a_adt)
 
 getADT ()
 
 setForm (ilPropertyFormGUI $a_form)
 
 getForm ()
 
 setElementId (string $a_value)
 Set element id (aka form field) More...
 
 getElementId ()
 
 setTitle (string $a_value)
 
 getTitle ()
 
 setInfo (string $a_value)
 
 getInfo ()
 
 setParentElement ($a_value)
 
 getParentElement ()
 Get parent element. More...
 
 setDisabled (bool $a_value)
 
 isDisabled ()
 
 setRequired (bool $a_value)
 
 isRequired ()
 
 addToForm ()
 Add ADT-specific fields to form. More...
 
 addJS (ilGlobalTemplateInterface $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 ()
 
 setExternalErrors (array $a_errors)
 

Protected Member Functions

 isValidADT (ilADT $a_adt)
 
- Protected Member Functions inherited from ilADTFormBridge
 isValidADT (ilADT $a_adt)
 
 setADT (ilADT $a_adt)
 
 addBasicFieldProperties (ilFormPropertyGUI $a_field, ilADTDefinition $a_def)
 Helper method to handle generic properties like setRequired(), setInfo() More...
 
 findParentElementInForm ()
 
 addToParentElement (ilFormPropertyGUI $a_field)
 
 isActiveForSubItems ($a_parent_option=null)
 Check if element is currently active for subitem(s) More...
 

Additional Inherited Members

- Protected Attributes inherited from ilADTFormBridge
ilADT $adt
 
ilPropertyFormGUI $form
 
 $parent
 
string $id = null
 
string $title = ''
 
string $info = ''
 
 $parent_element
 
bool $required = false
 
bool $disabled = false
 
ilLanguage $lng
 

Detailed Description

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

Member Function Documentation

◆ addToForm()

ilADTLocationFormBridge::addToForm ( )

Add ADT-specific fields to form.

Reimplemented from ilADTFormBridge.

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

28 : void
29 {
30 $adt = $this->getADT();
31
32 $default = false;
33 if ($adt->isNull()) {
34 // see ilPersonalProfileGUI::addLocationToForm()
35 // use installation default
37 $adt->setLatitude((float) $def["latitude"]);
38 $adt->setLongitude((float) $def["longitude"]);
39 $adt->setZoom((int) $def["zoom"]);
40
41 $default = true;
42 }
43
44 // :TODO: title?
45 $title = $this->isRequired()
46 ? $this->getTitle()
47 : $this->lng->txt("location");
48
49 $loc = new ilLocationInputGUI($title, $this->getElementId());
50 $loc->setLongitude($adt->getLongitude());
51 $loc->setLatitude($adt->getLatitude());
52 $loc->setZoom($adt->getZoom());
53
55
56 if (!$this->isRequired()) {
57 $optional = new ilCheckboxInputGUI($this->getTitle(), $this->getElementId() . "_tgl");
58 $optional->addSubItem($loc);
59 $this->addToParentElement($optional);
60
61 if (!$default && !$adt->isNull()) {
62 $optional->setChecked(true);
63 }
64 } else {
65 $this->addToParentElement($loc);
66 }
67 }
addBasicFieldProperties(ilFormPropertyGUI $a_field, ilADTDefinition $a_def)
Helper method to handle generic properties like setRequired(), setInfo()
addToParentElement(ilFormPropertyGUI $a_field)
isNull()
Is currently null.
getCopyOfDefinition()
Get copy of definition.
This class represents a checkbox property in a property form.
This class represents a location property in a property form.
static getDefaultSettings()
Get default longitude, latitude and zoom.

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

+ Here is the call graph for this function:

◆ importFromPost()

ilADTLocationFormBridge::importFromPost ( )

Import values from form request POST data.

Reimplemented from ilADTFormBridge.

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

69 : void
70 {
71 $do_import = true;
72 if (!$this->isRequired()) {
73 $toggle = $this->getForm()->getInput($this->getElementId() . "_tgl");
74 if (!$toggle) {
75 $do_import = false;
76 }
77 }
78
79 if ($do_import) {
80 // ilPropertyFormGUI::checkInput() is pre-requisite
81 $incoming = $this->getForm()->getInput($this->getElementId());
82 $this->getADT()->setLongitude((float) $incoming["longitude"]);
83 $this->getADT()->setLatitude((float) $incoming["latitude"]);
84 $this->getADT()->setZoom((int) $incoming["zoom"]);
85 } else {
86 $this->getADT()->setLongitude(null);
87 $this->getADT()->setLatitude(null);
88 $this->getADT()->setZoom(null);
89 }
90
91 $field = $this->getForm()->getItemByPostVar($this->getElementId());
92 $field->setLongitude($this->getADT()->getLongitude());
93 $field->setLatitude($this->getADT()->getLatitude());
94 $field->setZoom($this->getADT()->getZoom());
95 }

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

+ Here is the call graph for this function:

◆ isValidADT()

ilADTLocationFormBridge::isValidADT ( ilADT  $a_adt)
protected

Reimplemented from ilADTFormBridge.

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

23 : bool
24 {
25 return ($a_adt instanceof ilADTLocation);
26 }

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