ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
ilGoogleMapGUI Class Reference

User interface class for google maps. More...

+ Inheritance diagram for ilGoogleMapGUI:
+ Collaboration diagram for ilGoogleMapGUI:

Public Member Functions

 __construct ()
 
 getHtml ()
 Get HTML. More...
 
 getUserListHtml ()
 Get User List HTML (to be displayed besides the map) More...
 
- Public Member Functions inherited from ilMapGUI
 __construct ()
 
 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...
 

Additional Inherited Members

- Protected Attributes inherited from ilMapGUI
 $mapid
 
 $width = "500px"
 
 $height = "300px"
 
 $latitude
 
 $longitude
 
 $zoom
 
 $enabletypecontrol = false
 
 $enableupdatelistener = false
 
 $enablenavigationcontrol = false
 
 $enablelargemapcontrol = false
 
 $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 35 of file class.ilGoogleMapGUI.php.

Constructor & Destructor Documentation

◆ __construct()

ilGoogleMapGUI::__construct ( )

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

38  {
39  parent::__construct();
40 
41  // it's in getHTML too. why is it there twice?
42  /*$tpl->addJavaScript("//maps.google.com/maps/api/js?sensor=false", false);
43  $tpl->addJavaScript("Services/Maps/js/ServiceGoogleMaps.js");*/
44  }

Member Function Documentation

◆ getHtml()

ilGoogleMapGUI::getHtml ( )

Get HTML.

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

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

50  {
51  global $tpl;
52 
53  $this->tpl = new ilTemplate("tpl.google_map.html",
54  true, true, "Services/Maps");
55 
56  require_once("Services/Maps/classes/class.ilMapUtil.php");
57  $tpl->addJavaScript("//maps.google.com/maps/api/js?key=".ilMapUtil::getApiKey(), false);
58  $tpl->addJavaScript("Services/Maps/js/ServiceGoogleMaps.js");
59 
60  // add user markers
61  $cnt = 0;
62  foreach($this->user_marker as $user_id)
63  {
64  if (ilObject::_exists($user_id))
65  {
66  $user = new ilObjUser($user_id);
67  if ($user->getLatitude() != 0 && $user->getLongitude() != 0 &&
68  $user->getPref("public_location") == "y")
69  {
70  $this->tpl->setCurrentBlock("user_marker");
71  $this->tpl->setVariable("UMAP_ID",
72  $this->getMapId());
73  $this->tpl->setVariable("CNT", $cnt);
74 
75  $this->tpl->setVariable("ULAT", htmlspecialchars($user->getLatitude()));
76  $this->tpl->setVariable("ULONG", htmlspecialchars($user->getLongitude()));
77  $info = htmlspecialchars($user->getFirstName()." ".$user->getLastName());
78  $delim = "<br \/>";
79  if ($user->getPref("public_institution") == "y")
80  {
81  $info.= $delim.htmlspecialchars($user->getInstitution());
82  $delim = ", ";
83  }
84  if ($user->getPref("public_department") == "y")
85  {
86  $info.= $delim.htmlspecialchars($user->getDepartment());
87  }
88  $delim = "<br \/>";
89  if ($user->getPref("public_street") == "y")
90  {
91  $info.= $delim.htmlspecialchars($user->getStreet());
92  }
93  if ($user->getPref("public_zip") == "y")
94  {
95  $info.= $delim.htmlspecialchars($user->getZipcode());
96  $delim = " ";
97  }
98  if ($user->getPref("public_city") == "y")
99  {
100  $info.= $delim.htmlspecialchars($user->getCity());
101  }
102  $delim = "<br \/>";
103  if ($user->getPref("public_country") == "y")
104  {
105  $info.= $delim.htmlspecialchars($user->getCountry());
106  }
107  $this->tpl->setVariable("USER_INFO",
108  $info);
109  $this->tpl->setVariable("IMG_USER",
110  $user->getPersonalPicturePath("xsmall"));
111  $this->tpl->parseCurrentBlock();
112  $cnt++;
113  }
114  }
115  }
116 
117  $this->tpl->setVariable("MAP_ID", $this->getMapId());
118  $this->tpl->setVariable("WIDTH", $this->getWidth());
119  $this->tpl->setVariable("HEIGHT", $this->getHeight());
120  $this->tpl->setVariable("LAT", $this->getLatitude());
121  $this->tpl->setVariable("LONG", $this->getLongitude());
122  $this->tpl->setVariable("ZOOM", (int) $this->getZoom());
123  $type_control = $this->getEnableTypeControl()
124  ? "true"
125  : "false";
126  $this->tpl->setVariable("TYPE_CONTROL", $type_control);
127  $nav_control = $this->getEnableNavigationControl()
128  ? "true"
129  : "false";
130  $this->tpl->setVariable("NAV_CONTROL", $nav_control);
131  $update_listener = $this->getEnableUpdateListener()
132  ? "true"
133  : "false";
134  $this->tpl->setVariable("UPDATE_LISTENER", $update_listener);
135  $large_map_control = $this->getEnableLargeMapControl()
136  ? "true"
137  : "false";
138  $this->tpl->setVariable("LARGE_CONTROL", $large_map_control);
139  $central_marker = $this->getEnableCentralMarker()
140  ? "true"
141  : "false";
142  $this->tpl->setVariable("CENTRAL_MARKER", $central_marker);
143 
144  return $this->tpl->get();
145  }
getLatitude()
Get Latitude.
getZoom()
Get Zoom.
static _exists($a_id, $a_reference=false, $a_type=null)
checks if an object exists in object_data
getMapId()
Get Map ID.
getEnableCentralMarker()
Get Enable Central Marker.
getEnableUpdateListener()
Get Activate Update Listener.
getWidth()
Get Width.
getEnableLargeMapControl()
Get Large Map Control.
global $tpl
Definition: ilias.php:8
static getApiKey()
getEnableNavigationControl()
Get Use Navigation Control.
$info
Definition: example_052.php:80
special template class to simplify handling of ITX/PEAR
getHeight()
Get Height.
getEnableTypeControl()
Get Use Map Type Control.
getLongitude()
Get Longitude.
+ Here is the call graph for this function:

◆ getUserListHtml()

ilGoogleMapGUI::getUserListHtml ( )

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

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

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

151  {
152  global $tpl;
153 
154  $list_tpl = new ilTemplate("tpl.google_map_user_list.html",
155  true, true, "Services/Maps");
156 
157  $cnt = 0;
158  foreach($this->user_marker as $user_id)
159  {
160  if (ilObject::_exists($user_id))
161  {
162  $user = new ilObjUser($user_id);
163  $this->css_row = ($this->css_row != "tblrow1_mo")
164  ? "tblrow1_mo"
165  : "tblrow2_mo";
166  if ($user->getLatitude() != 0 && $user->getLongitude() != 0
167  && $user->getPref("public_location") == "y")
168  {
169  $list_tpl->setCurrentBlock("item");
170  $list_tpl->setVariable("MARKER_CNT", $cnt);
171  $list_tpl->setVariable("MAP_ID", $this->getMapId());
172  $cnt++;
173  }
174  else
175  {
176  $list_tpl->setCurrentBlock("item_no_link");
177  }
178  $list_tpl->setVariable("CSS_ROW", $this->css_row);
179  $list_tpl->setVariable("TXT_USER", $user->getLogin());
180  $list_tpl->setVariable("IMG_USER",
181  $user->getPersonalPicturePath("xxsmall"));
182  $list_tpl->parseCurrentBlock();
183  $list_tpl->touchBlock("row");
184  }
185  }
186 
187  return $list_tpl->get();
188  }
static _exists($a_id, $a_reference=false, $a_type=null)
checks if an object exists in object_data
getMapId()
Get Map ID.
global $tpl
Definition: ilias.php:8
special template class to simplify handling of ITX/PEAR
+ Here is the call graph for this function:

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