ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
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...
 
 getTableFilterLabelFor ()
 Get label "for" attribute value for filter. More...
 
 getFormLabelFor ()
 Get label "for" attribute value for form. 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

 $rbacsystem
 
 $latitude
 
 $longitude
 
 $zoom
 
 $address
 
- Protected Attributes inherited from ilFormPropertyGUI
 $ctrl
 
 $lng
 
 $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

Reimplemented from ilFormPropertyGUI.

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

50 {
51 global $DIC;
52
53 $this->lng = $DIC->language();
54 $this->rbacsystem = $DIC->rbac()->system();
55 parent::__construct($a_title, $a_postvar);
56 $this->setType("location");
57 }
setType($a_type)
Set Type.
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
$DIC
Definition: xapitoken.php:46

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

+ 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

Reimplemented from ilFormPropertyGUI.

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

159 {
161
162 $_POST[$this->getPostVar()]["latitude"] =
163 ilUtil::stripSlashes($_POST[$this->getPostVar()]["latitude"]);
164 $_POST[$this->getPostVar()]["longitude"] =
165 ilUtil::stripSlashes($_POST[$this->getPostVar()]["longitude"]);
166 if ($this->getRequired() &&
167 (trim($_POST[$this->getPostVar()]["latitude"]) == "" || trim($_POST[$this->getPostVar()]["longitude"]) == "")) {
168 $this->setAlert($lng->txt("msg_input_is_required"));
169
170 return false;
171 }
172 return true;
173 }
$_POST["username"]
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

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

+ Here is the call graph for this function:

◆ geolocationAvailiable()

ilLocationInputGUI::geolocationAvailiable ( )
protected

Is geolocation configured?

Returns
bool

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

261 {
262 include_once("./Services/Maps/classes/class.ilMapUtil.php");
263 switch (ilMapUtil::getType()) {
264 case 'openlayers':
265 return ilMapUtil::getStdGeolocationServer() ? true : false;
266 case 'googlemaps':
267 return true;
268 default:
269 return false;
270 }
271 }
static getStdGeolocationServer()
Returns the reverse geolocation server to be used in the installation.
static getType()

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

Referenced by insert().

+ 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 136 of file class.ilLocationInputGUI.php.

References $address.

Referenced by insert().

+ Here is the caller graph for this function:

◆ getLatitude()

ilLocationInputGUI::getLatitude ( )

Get Latitude.

Returns
real Latitude

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

References $latitude.

Referenced by insert().

+ Here is the caller graph for this function:

◆ getLongitude()

ilLocationInputGUI::getLongitude ( )

Get Longitude.

Returns
real Longitude

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

References $longitude.

Referenced by insert().

+ Here is the caller graph for this function:

◆ getZoom()

ilLocationInputGUI::getZoom ( )

Get Zoom.

Returns
int Zoom

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

117 {
118 return $this->zoom;
119 }

References $zoom.

Referenced by insert().

+ Here is the caller graph for this function:

◆ insert()

ilLocationInputGUI::insert (   $a_tpl)

Insert property html.

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

180 {
183
184 $lng->loadLanguageModule("maps");
185 $tpl = new ilTemplate("tpl.prop_location.html", true, true, "Services/Form");
186 $tpl->setVariable("POST_VAR", $this->getPostVar());
187 $tpl->setVariable("TXT_ZOOM", $lng->txt("maps_zoom_level"));
188 $tpl->setVariable("TXT_LATITUDE", $lng->txt("maps_latitude"));
189 $tpl->setVariable("TXT_LONGITUDE", $lng->txt("maps_longitude"));
190 $tpl->setVariable("LOC_DESCRIPTION", $lng->txt("maps_std_location_desc"));
191
192 $lat = is_numeric($this->getLatitude())
193 ? $this->getLatitude()
194 : 0;
195 $long = is_numeric($this->getLongitude())
196 ? $this->getLongitude()
197 : 0;
198 $tpl->setVariable("PROPERTY_VALUE_LAT", $lat);
199 $tpl->setVariable("PROPERTY_VALUE_LONG", $long);
200 for ($i = 0; $i <= 18; $i++) {
201 $levels[$i] = $i;
202 }
203
204 $map_id = "map_" . md5(uniqid());
205
206 $tpl->setVariable(
207 "ZOOM_SELECT",
209 $this->getZoom(),
210 $this->getPostVar() . "[zoom]",
211 $levels,
212 false,
213 true,
214 0,
215 "",
216 array("id" => $map_id . "_zoom",
217 "onchange" => "ilUpdateMap('" . $map_id . "');")
218 )
219 );
220 $tpl->setVariable("MAP_ID", $map_id);
221 $tpl->setVariable("ID", $this->getPostVar());
222
223 // only show address input if geolocation url available
224 // else, if admin: show warning.
225
226 if ($this->geolocationAvailiable()) {
227 $tpl->setVariable("TXT_ADDR", $lng->txt("address"));
228 $tpl->setVariable("TXT_LOOKUP", $lng->txt("maps_lookup_address"));
229 $tpl->setVariable("TXT_ADDRESS", $this->getAddress());
230 $tpl->setVariable("MAP_ID_ADDR", $map_id);
231 $tpl->setVariable("POST_VAR_ADDR", $this->getPostVar());
232 } else {
233 if ($rbacsystem->checkAccess("visible", SYSTEM_FOLDER_ID)) {
234 $tpl->setVariable("TEXT", $lng->txt("configure_geolocation"));
235 }
236 }
237
238 include_once("./Services/Maps/classes/class.ilMapUtil.php");
239 $map_gui = ilMapUtil::getMapGUI();
240 $map_gui->setMapId($map_id)
241 ->setLatitude($lat)
242 ->setLongitude($long)
243 ->setZoom($this->getZoom())
244 ->setEnableTypeControl(true)
245 ->setEnableLargeMapControl(true)
246 ->setEnableUpdateListener(true)
247 ->setEnableCentralMarker(true);
248
249 $tpl->setVariable("MAP", $map_gui->getHtml());
250
251 $a_tpl->setCurrentBlock("prop_generic");
252 $a_tpl->setVariable("PROP_GENERIC", $tpl->get());
253 $a_tpl->parseCurrentBlock();
254 }
geolocationAvailiable()
Is geolocation configured?
static getMapGUI()
Get an instance of the GUI class.
special template class to simplify handling of ITX/PEAR
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.
$i
Definition: metadata.php:24
if(isset($_FILES['img_file']['size']) && $_FILES['img_file']['size'] > 0) $tpl

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

+ Here is the call graph for this function:

◆ setAddress()

ilLocationInputGUI::setAddress (   $a_address)

Set Address.

Parameters
string$a_AddressAddress

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

127 {
128 $this->address = $a_address;
129 }

◆ setLatitude()

ilLocationInputGUI::setLatitude (   $a_latitude)

Set Latitude.

Parameters
real$a_latitudeLatitude

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

65 {
66 $this->latitude = $a_latitude;
67 }

Referenced by setValueByArray().

+ Here is the caller graph for this function:

◆ setLongitude()

ilLocationInputGUI::setLongitude (   $a_longitude)

Set Longitude.

Parameters
real$a_longitudeLongitude

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

87 {
88 $this->longitude = $a_longitude;
89 }

Referenced by setValueByArray().

+ 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 146 of file class.ilLocationInputGUI.php.

147 {
148 $this->setLatitude($a_values[$this->getPostVar()]["latitude"]);
149 $this->setLongitude($a_values[$this->getPostVar()]["longitude"]);
150 $this->setZoom($a_values[$this->getPostVar()]["zoom"]);
151 }
setLatitude($a_latitude)
Set Latitude.
setLongitude($a_longitude)
Set Longitude.

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

+ Here is the call graph for this function:

◆ setZoom()

ilLocationInputGUI::setZoom (   $a_zoom)

Set Zoom.

Parameters
int$a_zoomZoom

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

107 {
108 $this->zoom = $a_zoom;
109 }

Referenced by setValueByArray().

+ Here is the caller graph for this function:

Field Documentation

◆ $address

ilLocationInputGUI::$address
protected

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

Referenced by getAddress().

◆ $latitude

ilLocationInputGUI::$latitude
protected

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

Referenced by getLatitude().

◆ $longitude

ilLocationInputGUI::$longitude
protected

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

Referenced by getLongitude().

◆ $rbacsystem

ilLocationInputGUI::$rbacsystem
protected

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

Referenced by insert().

◆ $zoom

ilLocationInputGUI::$zoom
protected

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

Referenced by getZoom().


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