ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
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 ($a_title="", $a_postvar="")
 Constructor. More...
 
 setLatitude ($a_latitude)
 Set Latitude. More...
 
 getLatitude ()
 Get Latitude. More...
 
 setLongitude ($a_longitude)
 Set Longitude. More...
 
 getLongitude ()
 Get Longitude. More...
 
 setZoom ($a_zoom)
 Set Zoom. More...
 
 getZoom ()
 Get Zoom. More...
 
 setAddress ($a_address)
 Set Address. More...
 
 getAddress ()
 Get Address. More...
 
 setValueByArray ($a_values)
 Set value by array. More...
 
 checkInput ()
 Check input, strip slashes etc. More...
 
 insert ($a_tpl)
 Insert property html. More...
 
- Public Member Functions inherited from ilFormPropertyGUI
 __construct ($a_title="", $a_postvar="")
 Constructor. More...
 
 executeCommand ()
 Execute command. More...
 
 getType ()
 Get Type. More...
 
 setTitle ($a_title)
 Set Title. More...
 
 getTitle ()
 Get Title. More...
 
 setPostVar ($a_postvar)
 Set Post Variable. More...
 
 getPostVar ()
 Get Post Variable. More...
 
 getFieldId ()
 Get Post Variable. More...
 
 setInfo ($a_info)
 Set Information Text. More...
 
 getInfo ()
 Get Information Text. More...
 
 setAlert ($a_alert)
 Set Alert Text. More...
 
 getAlert ()
 Get Alert Text. More...
 
 setRequired ($a_required)
 Set Required. More...
 
 getRequired ()
 Get Required. More...
 
 setDisabled ($a_disabled)
 Set Disabled. More...
 
 getDisabled ()
 Get Disabled. More...
 
 checkInput ()
 Check input, strip slashes etc. More...
 
 setParentForm ($a_parentform)
 Set Parent Form. More...
 
 getParentForm ()
 Get Parent Form. More...
 
 setParent ($a_val)
 Set Parent GUI object. More...
 
 getParent ()
 Get Parent GUI object. More...
 
 getSubForm ()
 Get sub form html. More...
 
 hideSubForm ()
 Sub form hidden on init? More...
 
 setHiddenTitle ($a_val)
 Set hidden title (for screenreaders) More...
 
 getHiddenTitle ()
 Get hidden title. More...
 
 getItemByPostVar ($a_post_var)
 Get item by post var. More...
 
 serializeData ()
 serialize data More...
 
 unserializeData ($a_data)
 unserialize data More...
 
 writeToSession ()
 Write to session. More...
 
 clearFromSession ()
 Clear session value. More...
 
 readFromSession ()
 Read from session. More...
 
 getHiddenTag ($a_post_var, $a_value)
 Get hidden tag (used for disabled properties) More...
 
 setMulti ($a_multi, $a_sortable=false, $a_addremove=true)
 Set Multi. More...
 
 getMulti ()
 Get Multi. More...
 
 setMultiValues (array $a_values)
 Set multi values. More...
 
 getMultiValues ()
 Get multi values. More...
 
 getContentOutsideFormTag ()
 Get content that has to reside outside of the parent form tag, e.g. More...
 
 stripSlashesAddSpaceFallback ($a_str)
 Strip slashes with add space fallback, see https://www.ilias.de/mantis/view.php?id=19727. More...
 

Protected Member Functions

 geolocationAvailiable ()
 Is geolocation configured? More...
 
- Protected Member Functions inherited from ilFormPropertyGUI
 setType ($a_type)
 Set Type. More...
 
 getMultiIconsHTML ()
 Get HTML for multiple value icons. More...
 

Protected Attributes

 $latitude
 
 $longitude
 
 $zoom
 
 $address
 
- Protected Attributes inherited from ilFormPropertyGUI
 $type
 
 $title
 
 $postvar
 
 $info
 
 $alert
 
 $required = false
 
 $parentgui
 
 $parentform
 
 $hidden_title = ""
 
 $multi = false
 
 $multi_sortable = false
 
 $multi_addremove = true
 
 $multi_values
 

Additional Inherited Members

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

Detailed Description

This class represents a location property in a property form.

Author
Alex Killing alex..nosp@m.kill.nosp@m.ing@g.nosp@m.mx.d.nosp@m.e
Version
$Id$

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

Constructor & Destructor Documentation

◆ __construct()

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

Constructor.

Parameters
string$a_titleTitle
string$a_postvarPost Variable

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

References ilFormPropertyGUI\setType().

45  {
46  parent::__construct($a_title, $a_postvar);
47  $this->setType("location");
48  }
setType($a_type)
Set Type.
+ Here is the call graph for this function:

Member Function Documentation

◆ checkInput()

ilLocationInputGUI::checkInput ( )

Check input, strip slashes etc.

set alert, if input is not ok.

Returns
boolean Input ok, true/false

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

References $_POST, $lng, ilFormPropertyGUI\getPostVar(), ilFormPropertyGUI\getRequired(), ilFormPropertyGUI\setAlert(), and ilUtil\stripSlashes().

150  {
151  global $lng;
152 
153  $_POST[$this->getPostVar()]["latitude"] =
154  ilUtil::stripSlashes($_POST[$this->getPostVar()]["latitude"]);
155  $_POST[$this->getPostVar()]["longitude"] =
156  ilUtil::stripSlashes($_POST[$this->getPostVar()]["longitude"]);
157  if ($this->getRequired() &&
158  (trim($_POST[$this->getPostVar()]["latitude"]) == "" || trim($_POST[$this->getPostVar()]["longitude"]) == ""))
159  {
160  $this->setAlert($lng->txt("msg_input_is_required"));
161 
162  return false;
163  }
164  return true;
165  }
getPostVar()
Get Post Variable.
setAlert($a_alert)
Set Alert Text.
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
global $lng
Definition: privfeed.php:17
$_POST["username"]
+ Here is the call graph for this function:

◆ geolocationAvailiable()

ilLocationInputGUI::geolocationAvailiable ( )
protected

Is geolocation configured?

Returns
bool

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

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

Referenced by insert().

242  {
243  include_once("./Services/Maps/classes/class.ilMapUtil.php");
244  switch(ilMapUtil::getType()) {
245  case 'openlayers':
246  return ilMapUtil::getStdGeolocationServer() ? true : false;
247  case 'googlemaps':
248  return true;
249  default:
250  return false;
251  }
252  }
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 ( )

Get Address.

Returns
string Address

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

References $address.

Referenced by insert().

128  {
129  return $this->address;
130  }
+ Here is the caller graph for this function:

◆ getLatitude()

ilLocationInputGUI::getLatitude ( )

Get Latitude.

Returns
real Latitude

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

References $latitude.

Referenced by insert().

66  {
67  return $this->latitude;
68  }
+ Here is the caller graph for this function:

◆ getLongitude()

ilLocationInputGUI::getLongitude ( )

Get Longitude.

Returns
real Longitude

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

References $longitude.

Referenced by insert().

88  {
89  return $this->longitude;
90  }
+ Here is the caller graph for this function:

◆ getZoom()

ilLocationInputGUI::getZoom ( )

Get Zoom.

Returns
int Zoom

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

References $zoom.

Referenced by insert().

108  {
109  return $this->zoom;
110  }
+ Here is the caller graph for this function:

◆ insert()

ilLocationInputGUI::insert (   $a_tpl)

Insert property html.

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

References $lng, $tpl, array, ilUtil\formSelect(), geolocationAvailiable(), getAddress(), getLatitude(), getLongitude(), ilMapUtil\getMapGUI(), ilFormPropertyGUI\getPostVar(), and getZoom().

172  {
173  global $lng, $rbacsystem;
174 
175  $lng->loadLanguageModule("maps");
176  $tpl = new ilTemplate("tpl.prop_location.html", true, true, "Services/Form");
177  $tpl->setVariable("POST_VAR", $this->getPostVar());
178  $tpl->setVariable("TXT_ZOOM", $lng->txt("maps_zoom_level"));
179  $tpl->setVariable("TXT_LATITUDE", $lng->txt("maps_latitude"));
180  $tpl->setVariable("TXT_LONGITUDE", $lng->txt("maps_longitude"));
181  $tpl->setVariable("LOC_DESCRIPTION", $lng->txt("maps_std_location_desc"));
182 
183  $lat = is_numeric($this->getLatitude())
184  ? $this->getLatitude()
185  : 0;
186  $long = is_numeric($this->getLongitude())
187  ? $this->getLongitude()
188  : 0;
189  $tpl->setVariable("PROPERTY_VALUE_LAT", $lat);
190  $tpl->setVariable("PROPERTY_VALUE_LONG", $long);
191  for($i = 0; $i <= 18; $i++)
192  {
193  $levels[$i] = $i;
194  }
195 
196  $map_id = "map_".md5(uniqid());
197 
198  $tpl->setVariable("ZOOM_SELECT",
199  ilUtil::formSelect($this->getZoom(), $this->getPostVar()."[zoom]",
200  $levels, false, true, 0, "", array("id" => $map_id."_zoom",
201  "onchange" => "ilUpdateMap('".$map_id."');")));
202  $tpl->setVariable("MAP_ID", $map_id);
203  $tpl->setVariable("ID", $this->getPostVar());
204 
205  // only show address input if geolocation url available
206  // else, if admin: show warning.
207 
208  if($this->geolocationAvailiable()) {
209  $tpl->setVariable("TXT_ADDR", $lng->txt("address"));
210  $tpl->setVariable("TXT_LOOKUP", $lng->txt("maps_lookup_address"));
211  $tpl->setVariable("TXT_ADDRESS", $this->getAddress());
212  $tpl->setVariable("MAP_ID_ADDR", $map_id);
213  $tpl->setVariable("POST_VAR_ADDR", $this->getPostVar());
214  } else {
215  if($rbacsystem->checkAccess("visible", SYSTEM_FOLDER_ID)) {
216  $tpl->setVariable("TEXT", $lng->txt("configure_geolocation"));
217  }
218  }
219 
220  include_once("./Services/Maps/classes/class.ilMapUtil.php");
221  $map_gui = ilMapUtil::getMapGUI();
222  $map_gui->setMapId($map_id)
223  ->setLatitude($lat)
224  ->setLongitude($long)
225  ->setZoom($this->getZoom())
226  ->setEnableTypeControl(true)
227  ->setEnableLargeMapControl(true)
228  ->setEnableUpdateListener(true)
229  ->setEnableCentralMarker(true);
230 
231  $tpl->setVariable("MAP", $map_gui->getHtml());
232 
233  $a_tpl->setCurrentBlock("prop_generic");
234  $a_tpl->setVariable("PROP_GENERIC", $tpl->get());
235  $a_tpl->parseCurrentBlock();
236  }
getPostVar()
Get Post Variable.
geolocationAvailiable()
Is geolocation configured?
global $tpl
Definition: ilias.php:8
static getMapGUI()
Get an instance of the GUI class.
static formSelect($selected, $varname, $options, $multiple=false, $direct_text=false, $size="0", $style_class="", $attribs="", $disabled=false)
Builds a select form field with options and shows the selected option first.
special template class to simplify handling of ITX/PEAR
Create styles array
The data for the language used.
global $lng
Definition: privfeed.php:17
+ Here is the call graph for this function:

◆ setAddress()

ilLocationInputGUI::setAddress (   $a_address)

Set Address.

Parameters
string$a_AddressAddress

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

118  {
119  $this->address = $a_address;
120  }

◆ setLatitude()

ilLocationInputGUI::setLatitude (   $a_latitude)

Set Latitude.

Parameters
real$a_latitudeLatitude

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

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

56  {
57  $this->latitude = $a_latitude;
58  }
+ Here is the caller graph for this function:

◆ setLongitude()

ilLocationInputGUI::setLongitude (   $a_longitude)

Set Longitude.

Parameters
real$a_longitudeLongitude

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

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

78  {
79  $this->longitude = $a_longitude;
80  }
+ Here is the caller graph for this function:

◆ setValueByArray()

ilLocationInputGUI::setValueByArray (   $a_values)

Set value by array.

Parameters
array$a_valuesvalue array

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

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

138  {
139  $this->setLatitude($a_values[$this->getPostVar()]["latitude"]);
140  $this->setLongitude($a_values[$this->getPostVar()]["longitude"]);
141  $this->setZoom($a_values[$this->getPostVar()]["zoom"]);
142  }
setLatitude($a_latitude)
Set Latitude.
setLongitude($a_longitude)
Set Longitude.
getPostVar()
Get Post Variable.
setZoom($a_zoom)
Set Zoom.
+ Here is the call graph for this function:

◆ setZoom()

ilLocationInputGUI::setZoom (   $a_zoom)

Set Zoom.

Parameters
int$a_zoomZoom

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

Referenced by setValueByArray().

98  {
99  $this->zoom = $a_zoom;
100  }
+ Here is the caller graph for this function:

Field Documentation

◆ $address

ilLocationInputGUI::$address
protected

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

Referenced by getAddress().

◆ $latitude

ilLocationInputGUI::$latitude
protected

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

Referenced by getLatitude().

◆ $longitude

ilLocationInputGUI::$longitude
protected

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

Referenced by getLongitude().

◆ $zoom

ilLocationInputGUI::$zoom
protected

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

Referenced by getZoom().


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