ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
ilADTLocationFormBridge Class Reference
+ Inheritance diagram for ilADTLocationFormBridge:
+ Collaboration diagram for ilADTLocationFormBridge:

Public Member Functions

 addToForm ()
 
 importFromPost ()
 
- 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)
 
- 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...
 

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

◆ addToForm()

ilADTLocationFormBridge::addToForm ( )

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

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

13  {
14  global $lng;
15 
16  $adt = $this->getADT();
17 
18  $default = false;
19  if ($adt->isNull()) {
20  // see ilPersonalProfileGUI::addLocationToForm()
21 
22  // use installation default
23  include_once("./Services/Maps/classes/class.ilMapUtil.php");
25  $adt->setLatitude($def["latitude"]);
26  $adt->setLongitude($def["longitude"]);
27  $adt->setZoom($def["zoom"]);
28 
29  $default = true;
30  }
31 
32  // :TODO: title?
33  $title = $this->isRequired()
34  ? $this->getTitle()
35  : $lng->txt("location");
36 
37  $loc = new ilLocationInputGUI($title, $this->getElementId());
38  $loc->setLongitude($adt->getLongitude());
39  $loc->setLatitude($adt->getLatitude());
40  $loc->setZoom($adt->getZoom());
41 
42  $this->addBasicFieldProperties($loc, $adt->getCopyOfDefinition());
43 
44  if (!$this->isRequired()) {
45  $optional = new ilCheckboxInputGUI($this->getTitle(), $this->getElementId() . "_tgl");
46  $optional->addSubItem($loc);
47  $this->addToParentElement($optional);
48 
49  if (!$default && !$adt->isNull()) {
50  $optional->setChecked(true);
51  }
52  } else {
53  $this->addToParentElement($loc);
54  }
55  }
addToParentElement(ilFormPropertyGUI $a_field)
Add form field to parent element.
isRequired()
Get required.
This class represents a checkbox property in a property form.
addBasicFieldProperties(ilFormPropertyGUI $a_field, ilADTDefinition $a_def)
Helper method to handle generic properties like setRequired(), setInfo()
static getDefaultSettings()
Get default longitude, latitude and zoom.
This class represents a location property in a property form.
getElementId()
Get element id.
global $lng
Definition: privfeed.php:17
$def
Definition: croninfo.php:21
+ Here is the call graph for this function:

◆ importFromPost()

ilADTLocationFormBridge::importFromPost ( )

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

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

58  {
59  $do_import = true;
60  if (!$this->isRequired()) {
61  $toggle = $this->getForm()->getInput($this->getElementId() . "_tgl");
62  if (!$toggle) {
63  $do_import = false;
64  }
65  }
66 
67  if ($do_import) {
68  // ilPropertyFormGUI::checkInput() is pre-requisite
69  $incoming = $this->getForm()->getInput($this->getElementId());
70  $this->getADT()->setLongitude($incoming["longitude"]);
71  $this->getADT()->setLatitude($incoming["latitude"]);
72  $this->getADT()->setZoom($incoming["zoom"]);
73  } else {
74  $this->getADT()->setLongitude(null);
75  $this->getADT()->setLatitude(null);
76  $this->getADT()->setZoom(null);
77  }
78 
79  $field = $this->getForm()->getItemByPostvar($this->getElementId());
80  $field->setLongitude($this->getADT()->getLongitude());
81  $field->setLatitude($this->getADT()->getLatitude());
82  $field->setZoom($this->getADT()->getZoom());
83  }
isRequired()
Get required.
getElementId()
Get element id.
+ Here is the call graph for this function:

◆ isValidADT()

ilADTLocationFormBridge::isValidADT ( ilADT  $a_adt)
protected

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

8  {
9  return ($a_adt instanceof ilADTLocation);
10  }

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