ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
ilGoogleMapGUI Class Reference

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V. More...

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

Public Member Functions

 __construct ()
 
 getHtml ()
 
 getUserListHtml ()
 Get User List HTML (to be displayed besides the map) More...
 
- Public Member Functions inherited from ilMapGUI
 __construct ()
 
 setMapId (string $map_id)
 
 getMapId ()
 
 setWidth (string $width)
 
 getWidth ()
 
 setHeight (string $height)
 
 getHeight ()
 
 setLatitude (string $latitude)
 
 getLatitude ()
 
 setLongitude (string $longitude)
 
 getLongitude ()
 
 setZoom (?int $zoom)
 
 getZoom ()
 
 setEnableTypeControl (bool $enable_type_control)
 
 getEnableTypeControl ()
 
 setEnableNavigationControl (bool $enable_navigation_control)
 
 getEnableNavigationControl ()
 
 setEnableUpdateListener (bool $enable_update_listener)
 
 getEnableUpdateListener ()
 
 setEnableLargeMapControl (bool $large_map_control)
 
 getEnableLargeMapControl ()
 
 setEnableCentralMarker (bool $central_marker)
 
 getEnableCentralMarker ()
 
 addUserMarker (int $user_id)
 
 getHtml ()
 
 getUserListHtml ()
 Get User List HTML (to be displayed besides the map) More...
 

Protected Attributes

string $css_row = ""
 
- Protected Attributes inherited from ilMapGUI
ilGlobalTemplateInterface $tpl
 
ilLanguage $lng
 
string $map_id
 
string $width
 
string $height
 
string $latitude
 
string $longitude
 
int $zoom
 
bool $enable_type_control
 
bool $enable_update_listener
 
bool $enable_navigation_control
 
array $user_marker
 
bool $large_map_control
 
bool $central_marker
 

Detailed Description

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V.

ILIAS is licensed with the GPL-3.0, see https://www.gnu.org/licenses/gpl-3.0.en.html You should have received a copy of said license along with the source code, too.

If this is not the case or you just want to try ILIAS, you'll find us at: https://www.ilias.de https://github.com/ILIAS-eLearning User interface class for Google Maps

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

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

Constructor & Destructor Documentation

◆ __construct()

ilGoogleMapGUI::__construct ( )

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

References ILIAS\GlobalScreen\Provider\__construct().

31  {
33  }
__construct(Container $dic, ilPlugin $plugin)
+ Here is the call graph for this function:

Member Function Documentation

◆ getHtml()

ilGoogleMapGUI::getHtml ( )

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

References ilMapGUI\$central_marker, ilMapGUI\$large_map_control, 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().

35  : string
36  {
37  $html_tpl = new ilTemplate(
38  "tpl.google_map.html",
39  true,
40  true,
41  "Services/Maps"
42  );
43 
44  $js_tpl = new ilTemplate(
45  "tpl.google_map.js",
46  true,
47  true,
48  "Services/Maps"
49  );
50 
51  $this->tpl->addJavaScript("//maps.google.com/maps/api/js?key=" . ilMapUtil::getApiKey(), false);
52 
53  // add user markers
54  $cnt = 0;
55  foreach ($this->user_marker as $user_id) {
56  if (ilObject::_exists($user_id)) {
57  $user = new ilObjUser($user_id);
58  if ($user->getLatitude() != 0 && $user->getLongitude() != 0 &&
59  $user->getPref("public_location") == "y") {
60  $js_tpl->setCurrentBlock("user_marker");
61  $js_tpl->setVariable(
62  "UMAP_ID",
63  $this->getMapId()
64  );
65  $js_tpl->setVariable("CNT", $cnt);
66 
67  $js_tpl->setVariable("ULAT", htmlspecialchars($user->getLatitude()));
68  $js_tpl->setVariable("ULONG", htmlspecialchars($user->getLongitude()));
69  $info = htmlspecialchars($user->getFirstName() . " " . $user->getLastName());
70  $delim = "<br />";
71  if ($user->getPref("public_institution") == "y") {
72  $info .= $delim . htmlspecialchars($user->getInstitution());
73  $delim = ", ";
74  }
75  if ($user->getPref("public_department") == "y") {
76  $info .= $delim . htmlspecialchars($user->getDepartment());
77  }
78  $delim = "<br />";
79  if ($user->getPref("public_street") == "y") {
80  $info .= $delim . htmlspecialchars($user->getStreet());
81  }
82  if ($user->getPref("public_zip") == "y") {
83  $info .= $delim . htmlspecialchars($user->getZipcode());
84  $delim = " ";
85  }
86  if ($user->getPref("public_city") == "y") {
87  $info .= $delim . htmlspecialchars($user->getCity());
88  }
89  $delim = "<br />";
90  if ($user->getPref("public_country") == "y") {
91  $info .= $delim . htmlspecialchars($user->getCountry());
92  }
93  $js_tpl->setVariable(
94  "USER_INFO",
95  $info
96  );
97  $js_tpl->setVariable(
98  "IMG_USER",
99  $user->getPersonalPicturePath("xsmall")
100  );
101  $js_tpl->parseCurrentBlock();
102  $cnt++;
103  }
104  }
105  }
106 
107  $html_tpl->setVariable("MAP_ID", $this->getMapId());
108  $html_tpl->setVariable("WIDTH", $this->getWidth());
109  $html_tpl->setVariable("HEIGHT", $this->getHeight());
110 
111  $js_tpl->setVariable("MAP_ID", $this->getMapId());
112  $js_tpl->setVariable("LAT", $this->getLatitude());
113  $js_tpl->setVariable("LONG", $this->getLongitude());
114  $js_tpl->setVariable("ZOOM", (int) $this->getZoom());
115  $type_control = $this->getEnableTypeControl()
116  ? "true"
117  : "false";
118  $js_tpl->setVariable("TYPE_CONTROL", $type_control);
119  $nav_control = $this->getEnableNavigationControl()
120  ? "true"
121  : "false";
122  $js_tpl->setVariable("NAV_CONTROL", $nav_control);
123  $update_listener = $this->getEnableUpdateListener()
124  ? "true"
125  : "false";
126  $js_tpl->setVariable("UPDATE_LISTENER", $update_listener);
128  ? "true"
129  : "false";
130  $js_tpl->setVariable("LARGE_CONTROL", $large_map_control);
132  ? "true"
133  : "false";
134  $js_tpl->setVariable("CENTRAL_MARKER", $central_marker);
135 
136  $this->tpl->addOnLoadCode($js_tpl->get());
137 
138  return $html_tpl->get();
139  }
bool $central_marker
getEnableCentralMarker()
getEnableUpdateListener()
getEnableLargeMapControl()
static getApiKey()
getEnableNavigationControl()
static _exists(int $id, bool $reference=false, ?string $type=null)
checks if an object exists in object_data
bool $large_map_control
getEnableTypeControl()
+ Here is the call graph for this function:

◆ getUserListHtml()

ilGoogleMapGUI::getUserListHtml ( )

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

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

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

144  : string
145  {
146  $list_tpl = new ilTemplate(
147  "tpl.google_map_user_list.html",
148  true,
149  true,
150  "Services/Maps"
151  );
152 
153  $cnt = 0;
154  foreach ($this->user_marker as $user_id) {
155  if (ilObject::_exists($user_id)) {
156  $user = new ilObjUser($user_id);
157  $this->css_row = ($this->css_row != "tblrow1_mo")
158  ? "tblrow1_mo"
159  : "tblrow2_mo";
160  if ($user->getLatitude() != 0 && $user->getLongitude() != 0
161  && $user->getPref("public_location") == "y") {
162  $list_tpl->setCurrentBlock("item");
163  $list_tpl->setVariable("MARKER_CNT", $cnt);
164  $list_tpl->setVariable("MAP_ID", $this->getMapId());
165  $cnt++;
166  } else {
167  $list_tpl->setCurrentBlock("item_no_link");
168  }
169  $list_tpl->setVariable("CSS_ROW", $this->css_row);
170  $list_tpl->setVariable("TXT_USER", $user->getLogin());
171  $list_tpl->setVariable(
172  "IMG_USER",
173  $user->getPersonalPicturePath("xxsmall")
174  );
175  $list_tpl->parseCurrentBlock();
176  $list_tpl->touchBlock("row");
177  }
178  }
179 
180  return $list_tpl->get();
181  }
static _exists(int $id, bool $reference=false, ?string $type=null)
checks if an object exists in object_data
+ Here is the call graph for this function:

Field Documentation

◆ $css_row

string ilGoogleMapGUI::$css_row = ""
protected

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


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