ILIAS  trunk Revision v11.0_alpha-1749-g1a06bdef097
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
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

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

Constructor & Destructor Documentation

◆ __construct()

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

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

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

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

Member Function Documentation

◆ checkInput()

ilLocationInputGUI::checkInput ( )

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

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

99  : bool
100  {
101  $lng = $this->lng;
102 
103  $val = $this->strArray($this->getPostVar());
104  if ($this->getRequired() && (
105  !isset($val["latitude"]) || trim($val["latitude"]) == "" ||
106  !isset($val["longitude"]) || trim($val["longitude"]) == ""
107  )) {
108  $this->setAlert($lng->txt("msg_input_is_required"));
109  return false;
110  }
111  return true;
112  }
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 202 of file class.ilLocationInputGUI.php.

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

Referenced by insert().

202  : bool
203  {
204  switch (ilMapUtil::getType()) {
205  case 'openlayers':
206  return (bool) ilMapUtil::getStdGeolocationServer();
207  case 'googlemaps':
208  return true;
209  default:
210  return false;
211  }
212  }
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 81 of file class.ilLocationInputGUI.php.

References $address.

Referenced by insert().

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

◆ getInput()

ilLocationInputGUI::getInput ( )

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

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

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

◆ getLatitude()

ilLocationInputGUI::getLatitude ( )

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

References $latitude.

Referenced by insert().

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

◆ getLongitude()

ilLocationInputGUI::getLongitude ( )

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

References $longitude.

Referenced by insert().

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

◆ getZoom()

ilLocationInputGUI::getZoom ( )

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

References $zoom.

Referenced by insert().

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

◆ insert()

ilLocationInputGUI::insert ( ilTemplate  $a_tpl)

Definition at line 125 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().

125  : void
126  {
127  $lng = $this->lng;
129  $levels = [];
130 
131  $lng->loadLanguageModule("maps");
132  $tpl = new ilTemplate("tpl.prop_location.html", true, true, "components/ILIAS/Form");
133  $tpl->setVariable("POST_VAR", $this->getPostVar());
134  $tpl->setVariable("TXT_ZOOM", $lng->txt("maps_zoom_level"));
135  $tpl->setVariable("TXT_LATITUDE", $lng->txt("maps_latitude"));
136  $tpl->setVariable("TXT_LONGITUDE", $lng->txt("maps_longitude"));
137  $tpl->setVariable("LOC_DESCRIPTION", $lng->txt("maps_std_location_desc"));
138 
139  $lat = is_numeric($this->getLatitude())
140  ? $this->getLatitude()
141  : 0;
142  $long = is_numeric($this->getLongitude())
143  ? $this->getLongitude()
144  : 0;
145  $tpl->setVariable("PROPERTY_VALUE_LAT", $lat);
146  $tpl->setVariable("PROPERTY_VALUE_LONG", $long);
147  for ($i = 0; $i <= 18; $i++) {
148  $levels[$i] = $i;
149  }
150 
151  $map_id = "map_" . md5(uniqid());
152 
153  $tpl->setVariable(
154  "ZOOM_SELECT",
156  $this->getZoom(),
157  $this->getPostVar() . "[zoom]",
158  $levels,
159  false,
160  true,
161  0,
162  "",
163  array("id" => $map_id . "_zoom",
164  "onchange" => "ilUpdateMap('" . $map_id . "');")
165  )
166  );
167  $tpl->setVariable("MAP_ID", $map_id);
168  $tpl->setVariable("ID", $this->getPostVar());
169 
170  // only show address input if geolocation url available
171  // else, if admin: show warning.
172 
173  if ($this->geolocationAvailiable()) {
174  $tpl->setVariable("TXT_ADDR", $lng->txt("address"));
175  $tpl->setVariable("TXT_LOOKUP", $lng->txt("maps_lookup_address"));
176  $tpl->setVariable("TXT_ADDRESS", $this->getAddress());
177  $tpl->setVariable("MAP_ID_ADDR", $map_id);
178  $tpl->setVariable("POST_VAR_ADDR", $this->getPostVar());
179  } else {
180  if ($rbacsystem->checkAccess("visible", SYSTEM_FOLDER_ID)) {
181  $tpl->setVariable("TEXT", $lng->txt("configure_geolocation"));
182  }
183  }
184 
185  $map_gui = ilMapUtil::getMapGUI();
186  $map_gui->setMapId($map_id)
187  ->setLatitude((string) $lat)
188  ->setLongitude((string) $long)
189  ->setZoom($this->getZoom())
190  ->setEnableTypeControl(true)
191  ->setEnableLargeMapControl(true)
192  ->setEnableUpdateListener(true)
193  ->setEnableCentralMarker(true);
194 
195  $tpl->setVariable("MAP", $map_gui->getHtml());
196 
197  $a_tpl->setCurrentBlock("prop_generic");
198  $a_tpl->setVariable("PROP_GENERIC", $tpl->get());
199  $a_tpl->parseCurrentBlock();
200  }
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 76 of file class.ilLocationInputGUI.php.

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

◆ setLatitude()

ilLocationInputGUI::setLatitude ( ?float  $a_latitude)

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

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

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

◆ setLongitude()

ilLocationInputGUI::setLongitude ( ?float  $a_longitude)

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

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

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

◆ setValueByArray()

ilLocationInputGUI::setValueByArray ( array  $a_values)

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

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

86  : void
87  {
88  $lat = (isset($a_values[$this->getPostVar()]["latitude"]) && $a_values[$this->getPostVar()]["latitude"] != "")
89  ? (float) $a_values[$this->getPostVar()]["latitude"]
90  : null;
91  $lon = (isset($a_values[$this->getPostVar()]["longitude"]) && $a_values[$this->getPostVar()]["longitude"] != "")
92  ? (float) $a_values[$this->getPostVar()]["longitude"]
93  : null;
94  $this->setLatitude($lat);
95  $this->setLongitude($lon);
96  $this->setZoom((int) $a_values[$this->getPostVar()]["zoom"]);
97  }
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 66 of file class.ilLocationInputGUI.php.

Referenced by setValueByArray().

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

Field Documentation

◆ $address

string ilLocationInputGUI::$address = ""
protected

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

Referenced by getAddress().

◆ $latitude

float ilLocationInputGUI::$latitude = null
protected

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

Referenced by getLatitude().

◆ $longitude

float ilLocationInputGUI::$longitude = null
protected

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

Referenced by getLongitude().

◆ $rbacsystem

ilRbacSystem ilLocationInputGUI::$rbacsystem
protected

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

Referenced by insert().

◆ $zoom

int ilLocationInputGUI::$zoom = null
protected

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

Referenced by getZoom().


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