ILIAS  release_7 Revision v7.30-3-g800a261c036
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 ( )

Reimplemented from ilMapGUI.

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

38 {
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 }
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc

References ILIAS\GlobalScreen\Provider\__construct().

+ Here is the call graph for this function:

Member Function Documentation

◆ getHtml()

ilGoogleMapGUI::getHtml ( )

Get HTML.

Reimplemented from ilMapGUI.

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

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

References $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().

+ Here is the call graph for this function:

◆ getUserListHtml()

ilGoogleMapGUI::getUserListHtml ( )

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

Reimplemented from ilMapGUI.

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

152 {
153 global $tpl;
154
155 $list_tpl = new ilTemplate(
156 "tpl.google_map_user_list.html",
157 true,
158 true,
159 "Services/Maps"
160 );
161
162 $cnt = 0;
163 foreach ($this->user_marker as $user_id) {
164 if (ilObject::_exists($user_id)) {
165 $user = new ilObjUser($user_id);
166 $this->css_row = ($this->css_row != "tblrow1_mo")
167 ? "tblrow1_mo"
168 : "tblrow2_mo";
169 if ($user->getLatitude() != 0 && $user->getLongitude() != 0
170 && $user->getPref("public_location") == "y") {
171 $list_tpl->setCurrentBlock("item");
172 $list_tpl->setVariable("MARKER_CNT", $cnt);
173 $list_tpl->setVariable("MAP_ID", $this->getMapId());
174 $cnt++;
175 } else {
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(
181 "IMG_USER",
182 $user->getPersonalPicturePath("xxsmall")
183 );
184 $list_tpl->parseCurrentBlock();
185 $list_tpl->touchBlock("row");
186 }
187 }
188
189 return $list_tpl->get();
190 }

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

+ Here is the call graph for this function:

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