ILIAS  trunk Revision v11.0_alpha-2638-g80c1d007f79
ilLocationInputGUI Class Reference

This class represents a location property in a property form. More...

+ Inheritance diagram for ilLocationInputGUI:
+ Collaboration diagram for ilLocationInputGUI:

Public Member Functions

 __construct (string $a_title="", string $a_postvar="")
 
 setLatitude (?float $a_latitude)
 
 getLatitude ()
 
 setLongitude (?float $a_longitude)
 
 getLongitude ()
 
 setZoom (?int $a_zoom)
 
 getZoom ()
 
 setAddress (string $a_address)
 
 getAddress ()
 
 setValueByArray (array $a_values)
 
 checkInput ()
 
 getInput ()
 
 insert (ilTemplate $a_tpl)
 
- Public Member Functions inherited from ilFormPropertyGUI
 __construct (string $a_title="", string $a_postvar="")
 
 executeCommand ()
 
 getType ()
 
 setTitle (string $a_title)
 
 getTitle ()
 
 setPostVar (string $a_postvar)
 
 getPostVar ()
 
 getFieldId ()
 
 setInfo (string $a_info)
 
 getInfo ()
 
 setAlert (string $a_alert)
 
 getAlert ()
 
 setRequired (bool $a_required)
 
 getRequired ()
 
 setDisabled (bool $a_disabled)
 
 getDisabled ()
 
 checkInput ()
 Check input, strip slashes etc. More...
 
 setParentForm (ilPropertyFormGUI $a_parentform)
 
 getParentForm ()
 
 setParent (ilFormPropertyGUI $a_val)
 
 getParent ()
 
 getSubForm ()
 
 hideSubForm ()
 
 setHiddenTitle (string $a_val)
 
 getHiddenTitle ()
 
 getItemByPostVar (string $a_post_var)
 Get item by post var. More...
 
 serializeData ()
 
 unserializeData (string $a_data)
 
 setParentTable ($a_val)
 Set parent table. More...
 
 getParentTable ()
 Get parent table. More...
 
 writeToSession ()
 
 clearFromSession ()
 
 readFromSession ()
 
 getHiddenTag (string $a_post_var, string $a_value)
 
 setMulti (bool $a_multi, bool $a_sortable=false, bool $a_addremove=true)
 
 getMulti ()
 
 setMultiValues (array $a_values)
 
 getMultiValues ()
 
 getContentOutsideFormTag ()
 Get content that has to reside outside of the parent form tag, e.g. More...
 
 stripSlashesAddSpaceFallback (string $a_str)
 Strip slashes with add space fallback, see https://www.ilias.de/mantis/view.php?id=19727. More...
 
 getTableFilterLabelFor ()
 Get label "for" attribute value for filter. More...
 
 getFormLabelFor ()
 Get label "for" attribute value for form. More...
 
 setRequestParam (string $key, $val)
 This writes the request (aka post) values. More...
 

Protected Member Functions

 geolocationAvailiable ()
 
- Protected Member Functions inherited from ilFormPropertyGUI
 symbol ()
 
 setType (string $a_type)
 
 checkParentFormTable ()
 
 getSessionKey ()
 
 getMultiIconsHTML ()
 
 int ($key)
 
 intArray ($key)
 
 str ($key)
 
 raw ($key)
 
 strArray ($key)
 
 arrayArray ($key)
 
 isRequestParamArray (string $key)
 
 getRequestParam (string $key, Refinery\Transformation $t)
 

Protected Attributes

ilRbacSystem $rbacsystem
 
float $latitude = null
 
float $longitude = null
 
int $zoom = null
 
string $address = ""
 
- Protected Attributes inherited from ilFormPropertyGUI
array $set_params = []
 
ilTable2GUI $parent_table = null
 
ilFormPropertyGUI $parent_gui = null
 
ilCtrl $ctrl
 
ilLanguage $lng
 
string $type = ""
 
string $title = ""
 
string $postvar = ""
 
string $info = ""
 
string $alert = ""
 
bool $required = false
 
ilPropertyFormGUI $parentform = null
 
string $hidden_title = ""
 
bool $multi = false
 
bool $multi_sortable = false
 
bool $multi_addremove = true
 
array $multi_values = []
 
RequestInterface $request
 
HTTP Services $http
 
Refinery Factory $refinery = null
 
bool $disabled = false
 
ilGlobalTemplateInterface $global_tpl = null
 

Additional Inherited Members

- Static Public Member Functions inherited from ilFormPropertyGUI
static removeProhibitedCharacters (string $a_text)
 Remove prohibited characters see #19159. More...
 

Detailed Description

This class represents a location property in a property form.

Author
Alexander Killing killi.nosp@m.ng@l.nosp@m.eifos.nosp@m..de
Deprecated:
12 This component will be removed with ILIAS 12

Definition at line 27 of file class.ilLocationInputGUI.php.

Constructor & Destructor Documentation

◆ __construct()

ilLocationInputGUI::__construct ( string  $a_title = "",
string  $a_postvar = "" 
)

Definition at line 35 of file class.ilLocationInputGUI.php.

References $DIC, ILIAS\GlobalScreen\Provider\__construct(), ILIAS\Repository\lng(), and ilFormPropertyGUI\setType().

38  {
39  global $DIC;
40 
41  $this->lng = $DIC->language();
42  $this->rbacsystem = $DIC->rbac()->system();
43  parent::__construct($a_title, $a_postvar);
44  $this->setType("location");
45  }
global $DIC
Definition: shib_login.php:26
__construct(Container $dic, ilPlugin $plugin)
+ Here is the call graph for this function:

Member Function Documentation

◆ checkInput()

ilLocationInputGUI::checkInput ( )

Definition at line 100 of file class.ilLocationInputGUI.php.

References ilFormPropertyGUI\$lng, ilFormPropertyGUI\getPostVar(), ilFormPropertyGUI\getRequired(), ilFormPropertyGUI\setAlert(), ilFormPropertyGUI\strArray(), and ilLanguage\txt().

100  : bool
101  {
102  $lng = $this->lng;
103 
104  $val = $this->strArray($this->getPostVar());
105  if ($this->getRequired() && (
106  !isset($val["latitude"]) || trim($val["latitude"]) == "" ||
107  !isset($val["longitude"]) || trim($val["longitude"]) == ""
108  )) {
109  $this->setAlert($lng->txt("msg_input_is_required"));
110  return false;
111  }
112  return true;
113  }
txt(string $a_topic, string $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
+ Here is the call graph for this function:

◆ geolocationAvailiable()

ilLocationInputGUI::geolocationAvailiable ( )
protected

Definition at line 203 of file class.ilLocationInputGUI.php.

References ilMapUtil\getStdGeolocationServer(), and ilMapUtil\getType().

Referenced by insert().

203  : bool
204  {
205  switch (ilMapUtil::getType()) {
206  case 'openlayers':
207  return (bool) ilMapUtil::getStdGeolocationServer();
208  case 'googlemaps':
209  return true;
210  default:
211  return false;
212  }
213  }
static getType()
static getStdGeolocationServer()
Returns the reverse geolocation server to be used in the installation.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getAddress()

ilLocationInputGUI::getAddress ( )

Definition at line 82 of file class.ilLocationInputGUI.php.

References $address.

Referenced by insert().

82  : string
83  {
84  return $this->address;
85  }
+ Here is the caller graph for this function:

◆ getInput()

ilLocationInputGUI::getInput ( )

Definition at line 115 of file class.ilLocationInputGUI.php.

References ilFormPropertyGUI\getPostVar(), ilFormPropertyGUI\int(), and ilFormPropertyGUI\strArray().

115  : array
116  {
117  $val = $this->strArray($this->getPostVar());
118  return [
119  "latitude" => (float) ($val["latitude"] ?? 0),
120  "longitude" => (float) ($val["longitude"] ?? 0),
121  "zoom" => (int) ($val["zoom"] ?? 0),
122  "address" => ($val["address"] ?? "")
123  ];
124  }
+ Here is the call graph for this function:

◆ getLatitude()

ilLocationInputGUI::getLatitude ( )

Definition at line 52 of file class.ilLocationInputGUI.php.

References $latitude.

Referenced by insert().

52  : ?float
53  {
54  return $this->latitude;
55  }
+ Here is the caller graph for this function:

◆ getLongitude()

ilLocationInputGUI::getLongitude ( )

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

References $longitude.

Referenced by insert().

62  : ?float
63  {
64  return $this->longitude;
65  }
+ Here is the caller graph for this function:

◆ getZoom()

ilLocationInputGUI::getZoom ( )

Definition at line 72 of file class.ilLocationInputGUI.php.

References $zoom.

Referenced by insert().

72  : ?int
73  {
74  return $this->zoom;
75  }
+ Here is the caller graph for this function:

◆ insert()

ilLocationInputGUI::insert ( ilTemplate  $a_tpl)

Definition at line 126 of file class.ilLocationInputGUI.php.

References ilFormPropertyGUI\$lng, $rbacsystem, ilRbacSystem\checkAccess(), ilLegacyFormElementsUtil\formSelect(), geolocationAvailiable(), getAddress(), getLatitude(), getLongitude(), ilMapUtil\getMapGUI(), ilFormPropertyGUI\getPostVar(), getZoom(), ilLanguage\loadLanguageModule(), ilTemplate\parseCurrentBlock(), ilTemplate\setCurrentBlock(), HTML_Template_IT\setVariable(), SYSTEM_FOLDER_ID, and ilLanguage\txt().

126  : void
127  {
128  $lng = $this->lng;
130  $levels = [];
131 
132  $lng->loadLanguageModule("maps");
133  $tpl = new ilTemplate("tpl.prop_location.html", true, true, "components/ILIAS/Form");
134  $tpl->setVariable("POST_VAR", $this->getPostVar());
135  $tpl->setVariable("TXT_ZOOM", $lng->txt("maps_zoom_level"));
136  $tpl->setVariable("TXT_LATITUDE", $lng->txt("maps_latitude"));
137  $tpl->setVariable("TXT_LONGITUDE", $lng->txt("maps_longitude"));
138  $tpl->setVariable("LOC_DESCRIPTION", $lng->txt("maps_std_location_desc"));
139 
140  $lat = is_numeric($this->getLatitude())
141  ? $this->getLatitude()
142  : 0;
143  $long = is_numeric($this->getLongitude())
144  ? $this->getLongitude()
145  : 0;
146  $tpl->setVariable("PROPERTY_VALUE_LAT", $lat);
147  $tpl->setVariable("PROPERTY_VALUE_LONG", $long);
148  for ($i = 0; $i <= 18; $i++) {
149  $levels[$i] = $i;
150  }
151 
152  $map_id = "map_" . md5(uniqid());
153 
154  $tpl->setVariable(
155  "ZOOM_SELECT",
157  $this->getZoom(),
158  $this->getPostVar() . "[zoom]",
159  $levels,
160  false,
161  true,
162  0,
163  "",
164  array("id" => $map_id . "_zoom",
165  "onchange" => "ilUpdateMap('" . $map_id . "');")
166  )
167  );
168  $tpl->setVariable("MAP_ID", $map_id);
169  $tpl->setVariable("ID", $this->getPostVar());
170 
171  // only show address input if geolocation url available
172  // else, if admin: show warning.
173 
174  if ($this->geolocationAvailiable()) {
175  $tpl->setVariable("TXT_ADDR", $lng->txt("address"));
176  $tpl->setVariable("TXT_LOOKUP", $lng->txt("maps_lookup_address"));
177  $tpl->setVariable("TXT_ADDRESS", $this->getAddress());
178  $tpl->setVariable("MAP_ID_ADDR", $map_id);
179  $tpl->setVariable("POST_VAR_ADDR", $this->getPostVar());
180  } else {
181  if ($rbacsystem->checkAccess("visible", SYSTEM_FOLDER_ID)) {
182  $tpl->setVariable("TEXT", $lng->txt("configure_geolocation"));
183  }
184  }
185 
186  $map_gui = ilMapUtil::getMapGUI();
187  $map_gui->setMapId($map_id)
188  ->setLatitude((string) $lat)
189  ->setLongitude((string) $long)
190  ->setZoom($this->getZoom())
191  ->setEnableTypeControl(true)
192  ->setEnableLargeMapControl(true)
193  ->setEnableUpdateListener(true)
194  ->setEnableCentralMarker(true);
195 
196  $tpl->setVariable("MAP", $map_gui->getHtml());
197 
198  $a_tpl->setCurrentBlock("prop_generic");
199  $a_tpl->setVariable("PROP_GENERIC", $tpl->get());
200  $a_tpl->parseCurrentBlock();
201  }
parseCurrentBlock(string $part=ilGlobalTemplateInterface::DEFAULT_BLOCK)
txt(string $a_topic, string $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
static formSelect( $selected, string $varname, array $options, bool $multiple=false, bool $direct_text=false, int $size=0, string $style_class="", array $attribs=[], bool $disabled=false)
Builds a select form field with options and shows the selected option first.
loadLanguageModule(string $a_module)
Load language module.
const SYSTEM_FOLDER_ID
Definition: constants.php:35
checkAccess(string $a_operations, int $a_ref_id, string $a_type="")
checkAccess represents the main method of the RBAC-system in ILIAS3 developers want to use With this ...
static getMapGUI()
Get an instance of the GUI class.
setVariable($variable, $value='')
Sets a variable value.
Definition: IT.php:544
setCurrentBlock(string $part=ilGlobalTemplateInterface::DEFAULT_BLOCK)
+ Here is the call graph for this function:

◆ setAddress()

ilLocationInputGUI::setAddress ( string  $a_address)

Definition at line 77 of file class.ilLocationInputGUI.php.

77  : void
78  {
79  $this->address = $a_address;
80  }

◆ setLatitude()

ilLocationInputGUI::setLatitude ( ?float  $a_latitude)

Definition at line 47 of file class.ilLocationInputGUI.php.

Referenced by ilPersonalProfileGUI\addLocationToForm(), ilObjGroupGUI\editMapSettingsObject(), ilObjCourseGUI\editMapSettingsObject(), ilObjExternalToolsSettingsGUI\getMapsForm(), and setValueByArray().

47  : void
48  {
49  $this->latitude = $a_latitude;
50  }
+ Here is the caller graph for this function:

◆ setLongitude()

ilLocationInputGUI::setLongitude ( ?float  $a_longitude)

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

Referenced by ilADTLocationSearchBridgeSingle\addToForm(), and setValueByArray().

57  : void
58  {
59  $this->longitude = $a_longitude;
60  }
+ Here is the caller graph for this function:

◆ setValueByArray()

ilLocationInputGUI::setValueByArray ( array  $a_values)

Definition at line 87 of file class.ilLocationInputGUI.php.

References ilFormPropertyGUI\getPostVar(), null, setLatitude(), setLongitude(), and setZoom().

87  : void
88  {
89  $lat = (isset($a_values[$this->getPostVar()]["latitude"]) && $a_values[$this->getPostVar()]["latitude"] != "")
90  ? (float) $a_values[$this->getPostVar()]["latitude"]
91  : null;
92  $lon = (isset($a_values[$this->getPostVar()]["longitude"]) && $a_values[$this->getPostVar()]["longitude"] != "")
93  ? (float) $a_values[$this->getPostVar()]["longitude"]
94  : null;
95  $this->setLatitude($lat);
96  $this->setLongitude($lon);
97  $this->setZoom((int) $a_values[$this->getPostVar()]["zoom"]);
98  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
setLatitude(?float $a_latitude)
setLongitude(?float $a_longitude)
+ Here is the call graph for this function:

◆ setZoom()

ilLocationInputGUI::setZoom ( ?int  $a_zoom)

Definition at line 67 of file class.ilLocationInputGUI.php.

Referenced by setValueByArray().

67  : void
68  {
69  $this->zoom = $a_zoom;
70  }
+ Here is the caller graph for this function:

Field Documentation

◆ $address

string ilLocationInputGUI::$address = ""
protected

Definition at line 33 of file class.ilLocationInputGUI.php.

Referenced by getAddress().

◆ $latitude

float ilLocationInputGUI::$latitude = null
protected

Definition at line 30 of file class.ilLocationInputGUI.php.

Referenced by getLatitude().

◆ $longitude

float ilLocationInputGUI::$longitude = null
protected

Definition at line 31 of file class.ilLocationInputGUI.php.

Referenced by getLongitude().

◆ $rbacsystem

ilRbacSystem ilLocationInputGUI::$rbacsystem
protected

Definition at line 29 of file class.ilLocationInputGUI.php.

Referenced by insert().

◆ $zoom

int ilLocationInputGUI::$zoom = null
protected

Definition at line 32 of file class.ilLocationInputGUI.php.

Referenced by getZoom().


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