ILIAS  release_4-4 Revision
ilGoogleMapGUI Class Reference

User interface class for google maps. More...

+ Collaboration diagram for ilGoogleMapGUI:

Public Member Functions

 ilGoogleMapGUI ()
 
 setMapId ($a_mapid)
 Set Map ID. More...
 
 getMapId ()
 Get Map ID. More...
 
 setWidth ($a_width)
 Set Width. More...
 
 getWidth ()
 Get Width. More...
 
 setHeight ($a_height)
 Set Height. More...
 
 getHeight ()
 Get Height. 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...
 
 setEnableTypeControl ($a_enabletypecontrol)
 Set Use Map Type Control. More...
 
 getEnableTypeControl ()
 Get Use Map Type Control. More...
 
 setEnableNavigationControl ($a_enablenavigationcontrol)
 Set Use Navigation Control. More...
 
 getEnableNavigationControl ()
 Get Use Navigation Control. More...
 
 setEnableUpdateListener ($a_enableupdatelistener)
 Set Activate Update Listener. More...
 
 getEnableUpdateListener ()
 Get Activate Update Listener. More...
 
 setEnableLargeMapControl ($a_largemapcontrol)
 Set Large Map Control. More...
 
 getEnableLargeMapControl ()
 Get Large Map Control. More...
 
 setEnableCentralMarker ($a_centralmarker)
 Enable Central Marker. More...
 
 getEnableCentralMarker ()
 Get Enable Central Marker. More...
 
 addUserMarker ($a_user_id)
 Add user marker. More...
 
 getHtml ()
 Get HTML. More...
 
 getUserListHtml ()
 Get User List HTML (to be displayed besides the map) More...
 

Protected Attributes

 $enabletypecontrol = false
 
 $enableupdatelistener = false
 
 $enablenavigationcontrol = false
 
 $enablelargemapcontrol = false
 
 $width = "500px"
 
 $height = "300px"
 
 $user_marker = array()
 

Detailed Description

User interface class for google maps.

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

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

Member Function Documentation

◆ addUserMarker()

ilGoogleMapGUI::addUserMarker (   $a_user_id)

Add user marker.

Parameters
int$a_user_idUser ID

Definition at line 279 of file class.ilGoogleMapGUI.php.

280  {
281  return $this->user_marker[] = $a_user_id;
282  }

◆ getEnableCentralMarker()

ilGoogleMapGUI::getEnableCentralMarker ( )

Get Enable Central Marker.

Returns
boolean Central Marker

Definition at line 269 of file class.ilGoogleMapGUI.php.

Referenced by getHtml().

270  {
271  return $this->centralmarker;
272  }
+ Here is the caller graph for this function:

◆ getEnableLargeMapControl()

ilGoogleMapGUI::getEnableLargeMapControl ( )

Get Large Map Control.

Returns
boolean Large Map Control

Definition at line 249 of file class.ilGoogleMapGUI.php.

Referenced by getHtml().

250  {
251  return $this->largemapcontrol;
252  }
+ Here is the caller graph for this function:

◆ getEnableNavigationControl()

ilGoogleMapGUI::getEnableNavigationControl ( )

Get Use Navigation Control.

Returns
boolean Use Navigation Control

Definition at line 209 of file class.ilGoogleMapGUI.php.

References $enablenavigationcontrol.

Referenced by getHtml().

210  {
212  }
+ Here is the caller graph for this function:

◆ getEnableTypeControl()

ilGoogleMapGUI::getEnableTypeControl ( )

Get Use Map Type Control.

Returns
boolean Use Map Type Control

Definition at line 189 of file class.ilGoogleMapGUI.php.

References $enabletypecontrol.

Referenced by getHtml().

190  {
192  }
+ Here is the caller graph for this function:

◆ getEnableUpdateListener()

ilGoogleMapGUI::getEnableUpdateListener ( )

Get Activate Update Listener.

Returns
boolean Activate Update Listener

Definition at line 229 of file class.ilGoogleMapGUI.php.

References $enableupdatelistener.

Referenced by getHtml().

230  {
232  }
+ Here is the caller graph for this function:

◆ getHeight()

ilGoogleMapGUI::getHeight ( )

Get Height.

Returns
string Height

Definition at line 109 of file class.ilGoogleMapGUI.php.

References $height.

Referenced by getHtml().

110  {
111  return $this->height;
112  }
+ Here is the caller graph for this function:

◆ getHtml()

ilGoogleMapGUI::getHtml ( )

Get HTML.

Definition at line 287 of file class.ilGoogleMapGUI.php.

References $tpl, ilObject\_exists(), getEnableCentralMarker(), getEnableLargeMapControl(), getEnableNavigationControl(), getEnableTypeControl(), getEnableUpdateListener(), getHeight(), getLatitude(), getLongitude(), getMapId(), getWidth(), and getZoom().

288  {
289  global $tpl;
290 
291  $this->tpl = new ilTemplate("tpl.google_map.html",
292  true, true, "Services/GoogleMaps");
293 
294  $tpl->addJavaScript("//maps.google.com/maps/api/js?sensor=false", false);
295  $tpl->addJavaScript("Services/GoogleMaps/js/ServiceGoogleMaps.js");
296 
297  // add user markers
298  $cnt = 0;
299  foreach($this->user_marker as $user_id)
300  {
301  if (ilObject::_exists($user_id))
302  {
303  $user = new ilObjUser($user_id);
304  if ($user->getLatitude() != 0 && $user->getLongitude() != 0 &&
305  $user->getPref("public_location") == "y")
306  {
307  $this->tpl->setCurrentBlock("user_marker");
308  $this->tpl->setVariable("UMAP_ID",
309  $this->getMapId());
310  $this->tpl->setVariable("CNT", $cnt);
311 
312  $this->tpl->setVariable("ULAT", htmlspecialchars($user->getLatitude()));
313  $this->tpl->setVariable("ULONG", htmlspecialchars($user->getLongitude()));
314  $info = htmlspecialchars($user->getFirstName()." ".$user->getLastName());
315  $delim = "<br \/>";
316  if ($user->getPref("public_institution") == "y")
317  {
318  $info.= $delim.htmlspecialchars($user->getInstitution());
319  $delim = ", ";
320  }
321  if ($user->getPref("public_department") == "y")
322  {
323  $info.= $delim.htmlspecialchars($user->getDepartment());
324  }
325  $delim = "<br \/>";
326  if ($user->getPref("public_street") == "y")
327  {
328  $info.= $delim.htmlspecialchars($user->getStreet());
329  }
330  if ($user->getPref("public_zip") == "y")
331  {
332  $info.= $delim.htmlspecialchars($user->getZipcode());
333  $delim = " ";
334  }
335  if ($user->getPref("public_city") == "y")
336  {
337  $info.= $delim.htmlspecialchars($user->getCity());
338  }
339  $delim = "<br \/>";
340  if ($user->getPref("public_country") == "y")
341  {
342  $info.= $delim.htmlspecialchars($user->getCountry());
343  }
344  $this->tpl->setVariable("USER_INFO",
345  $info);
346  $this->tpl->setVariable("IMG_USER",
347  $user->getPersonalPicturePath("xsmall"));
348  $this->tpl->parseCurrentBlock();
349  $cnt++;
350  }
351  }
352  }
353 
354  $this->tpl->setVariable("MAP_ID", $this->getMapId());
355  $this->tpl->setVariable("WIDTH", $this->getWidth());
356  $this->tpl->setVariable("HEIGHT", $this->getHeight());
357  $this->tpl->setVariable("LAT", $this->getLatitude());
358  $this->tpl->setVariable("LONG", $this->getLongitude());
359  $this->tpl->setVariable("ZOOM", (int) $this->getZoom());
360  $type_control = $this->getEnableTypeControl()
361  ? "true"
362  : "false";
363  $this->tpl->setVariable("TYPE_CONTROL", $type_control);
364  $nav_control = $this->getEnableNavigationControl()
365  ? "true"
366  : "false";
367  $this->tpl->setVariable("NAV_CONTROL", $nav_control);
368  $update_listener = $this->getEnableUpdateListener()
369  ? "true"
370  : "false";
371  $this->tpl->setVariable("UPDATE_LISTENER", $update_listener);
372  $large_map_control = $this->getEnableLargeMapControl()
373  ? "true"
374  : "false";
375  $this->tpl->setVariable("LARGE_CONTROL", $large_map_control);
376  $central_marker = $this->getEnableCentralMarker()
377  ? "true"
378  : "false";
379  $this->tpl->setVariable("CENTRAL_MARKER", $central_marker);
380 
381  return $this->tpl->get();
382  }
getEnableCentralMarker()
Get Enable Central Marker.
getEnableLargeMapControl()
Get Large Map Control.
static _exists($a_id, $a_reference=false, $a_type=null)
checks if an object exists in object_data
getHeight()
Get Height.
getLongitude()
Get Longitude.
getEnableUpdateListener()
Get Activate Update Listener.
getLatitude()
Get Latitude.
getEnableNavigationControl()
Get Use Navigation Control.
getMapId()
Get Map ID.
special template class to simplify handling of ITX/PEAR
if(isset($_FILES['img_file']['size']) && $_FILES['img_file']['size'] > 0) $tpl
getEnableTypeControl()
Get Use Map Type Control.
+ Here is the call graph for this function:

◆ getLatitude()

ilGoogleMapGUI::getLatitude ( )

Get Latitude.

Returns
string Latitude

Definition at line 129 of file class.ilGoogleMapGUI.php.

Referenced by getHtml().

130  {
131  return $this->latitude;
132  }
+ Here is the caller graph for this function:

◆ getLongitude()

ilGoogleMapGUI::getLongitude ( )

Get Longitude.

Returns
string Longitude

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

Referenced by getHtml().

150  {
151  return $this->longitude;
152  }
+ Here is the caller graph for this function:

◆ getMapId()

ilGoogleMapGUI::getMapId ( )

Get Map ID.

Returns
string Map ID

Definition at line 69 of file class.ilGoogleMapGUI.php.

Referenced by getHtml(), and getUserListHtml().

70  {
71  return $this->mapid;
72  }
+ Here is the caller graph for this function:

◆ getUserListHtml()

ilGoogleMapGUI::getUserListHtml ( )

Get User List HTML (to be displayed besides the map)

Definition at line 387 of file class.ilGoogleMapGUI.php.

References $tpl, ilObject\_exists(), and getMapId().

388  {
389  global $tpl;
390 
391  $list_tpl = new ilTemplate("tpl.google_map_user_list.html",
392  true, true, "Services/GoogleMaps");
393 
394  $cnt = 0;
395  foreach($this->user_marker as $user_id)
396  {
397  if (ilObject::_exists($user_id))
398  {
399  $user = new ilObjUser($user_id);
400  $this->css_row = ($this->css_row != "tblrow1_mo")
401  ? "tblrow1_mo"
402  : "tblrow2_mo";
403  if ($user->getLatitude() != 0 && $user->getLongitude() != 0
404  && $user->getPref("public_location") == "y")
405  {
406  $list_tpl->setCurrentBlock("item");
407  $list_tpl->setVariable("MARKER_CNT", $cnt);
408  $list_tpl->setVariable("MAP_ID", $this->getMapId());
409  $cnt++;
410  }
411  else
412  {
413  $list_tpl->setCurrentBlock("item_no_link");
414  }
415  $list_tpl->setVariable("CSS_ROW", $this->css_row);
416  $list_tpl->setVariable("TXT_USER", $user->getLogin());
417  $list_tpl->setVariable("IMG_USER",
418  $user->getPersonalPicturePath("xxsmall"));
419  $list_tpl->parseCurrentBlock();
420  $list_tpl->touchBlock("row");
421  }
422  }
423 
424  return $list_tpl->get();
425  }
static _exists($a_id, $a_reference=false, $a_type=null)
checks if an object exists in object_data
getMapId()
Get Map ID.
special template class to simplify handling of ITX/PEAR
if(isset($_FILES['img_file']['size']) && $_FILES['img_file']['size'] > 0) $tpl
+ Here is the call graph for this function:

◆ getWidth()

ilGoogleMapGUI::getWidth ( )

Get Width.

Returns
string Width

Definition at line 89 of file class.ilGoogleMapGUI.php.

References $width.

Referenced by getHtml().

90  {
91  return $this->width;
92  }
+ Here is the caller graph for this function:

◆ getZoom()

ilGoogleMapGUI::getZoom ( )

Get Zoom.

Returns
int Zoom

Definition at line 169 of file class.ilGoogleMapGUI.php.

Referenced by getHtml().

170  {
171  return $this->zoom;
172  }
+ Here is the caller graph for this function:

◆ ilGoogleMapGUI()

ilGoogleMapGUI::ilGoogleMapGUI ( )

Definition at line 43 of file class.ilGoogleMapGUI.php.

References $lng, and $tpl.

44  {
45  global $lng, $tpl;
46 
47  $lng->loadLanguageModule("gmaps");
48 
49  $tpl->addJavaScript("//maps.google.com/maps/api/js?sensor=false", false);
50  $tpl->addJavaScript("Services/GoogleMaps/js/ServiceGoogleMaps.js");
51 
52  }
if(isset($_FILES['img_file']['size']) && $_FILES['img_file']['size'] > 0) $tpl
global $lng
Definition: privfeed.php:40

◆ setEnableCentralMarker()

ilGoogleMapGUI::setEnableCentralMarker (   $a_centralmarker)

Enable Central Marker.

Parameters
boolean$a_centralmarkerCentral Marker

Definition at line 259 of file class.ilGoogleMapGUI.php.

260  {
261  $this->centralmarker = $a_centralmarker;
262  }

◆ setEnableLargeMapControl()

ilGoogleMapGUI::setEnableLargeMapControl (   $a_largemapcontrol)

Set Large Map Control.

Parameters
boolean$a_largemapcontrolLarge Map Control

Definition at line 239 of file class.ilGoogleMapGUI.php.

240  {
241  $this->largemapcontrol = $a_largemapcontrol;
242  }

◆ setEnableNavigationControl()

ilGoogleMapGUI::setEnableNavigationControl (   $a_enablenavigationcontrol)

Set Use Navigation Control.

Parameters
boolean$a_enablenavigationcontrolUse Navigation Control

Definition at line 199 of file class.ilGoogleMapGUI.php.

200  {
201  $this->enablenavigationcontrol = $a_enablenavigationcontrol;
202  }

◆ setEnableTypeControl()

ilGoogleMapGUI::setEnableTypeControl (   $a_enabletypecontrol)

Set Use Map Type Control.

Parameters
boolean$a_enabletypecontrolUse Map Type Control

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

180  {
181  $this->enabletypecontrol = $a_enabletypecontrol;
182  }

◆ setEnableUpdateListener()

ilGoogleMapGUI::setEnableUpdateListener (   $a_enableupdatelistener)

Set Activate Update Listener.

Parameters
boolean$a_enableupdatelistenerActivate Update Listener

Definition at line 219 of file class.ilGoogleMapGUI.php.

220  {
221  $this->enableupdatelistener = $a_enableupdatelistener;
222  }

◆ setHeight()

ilGoogleMapGUI::setHeight (   $a_height)

Set Height.

Parameters
string$a_heightHeight

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

100  {
101  $this->height = $a_height;
102  }

◆ setLatitude()

ilGoogleMapGUI::setLatitude (   $a_latitude)

Set Latitude.

Parameters
string$a_latitudeLatitude

Definition at line 119 of file class.ilGoogleMapGUI.php.

120  {
121  $this->latitude = $a_latitude;
122  }

◆ setLongitude()

ilGoogleMapGUI::setLongitude (   $a_longitude)

Set Longitude.

Parameters
string$a_longitudeLongitude

Definition at line 139 of file class.ilGoogleMapGUI.php.

140  {
141  $this->longitude = $a_longitude;
142  }

◆ setMapId()

ilGoogleMapGUI::setMapId (   $a_mapid)

Set Map ID.

Parameters
string$a_mapidMap ID

Definition at line 59 of file class.ilGoogleMapGUI.php.

60  {
61  $this->mapid = $a_mapid;
62  }

◆ setWidth()

ilGoogleMapGUI::setWidth (   $a_width)

Set Width.

Parameters
string$a_widthWidth

Definition at line 79 of file class.ilGoogleMapGUI.php.

80  {
81  $this->width = $a_width;
82  }

◆ setZoom()

ilGoogleMapGUI::setZoom (   $a_zoom)

Set Zoom.

Parameters
int$a_zoomZoom

Definition at line 159 of file class.ilGoogleMapGUI.php.

160  {
161  $this->zoom = $a_zoom;
162  }

Field Documentation

◆ $enablelargemapcontrol

ilGoogleMapGUI::$enablelargemapcontrol = false
protected

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

◆ $enablenavigationcontrol

ilGoogleMapGUI::$enablenavigationcontrol = false
protected

Definition at line 37 of file class.ilGoogleMapGUI.php.

Referenced by getEnableNavigationControl().

◆ $enabletypecontrol

ilGoogleMapGUI::$enabletypecontrol = false
protected

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

Referenced by getEnableTypeControl().

◆ $enableupdatelistener

ilGoogleMapGUI::$enableupdatelistener = false
protected

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

Referenced by getEnableUpdateListener().

◆ $height

ilGoogleMapGUI::$height = "300px"
protected

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

Referenced by getHeight().

◆ $user_marker

ilGoogleMapGUI::$user_marker = array()
protected

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

◆ $width

ilGoogleMapGUI::$width = "500px"
protected

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

Referenced by getWidth().


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