ILIAS  release_5-0 Revision 5.0.0-1144-gc4397b1f870
All Data Structures Namespaces Files Functions Variables Modules Pages
ilOpenLayersMapGUI Class Reference

User interface class for OpenLayers maps. More...

+ Inheritance diagram for ilOpenLayersMapGUI:
+ Collaboration diagram for ilOpenLayersMapGUI:

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 OpenLayers maps.

Author
Richard Klees richa.nosp@m.rd.k.nosp@m.lees@.nosp@m.conc.nosp@m.epts-.nosp@m.and-.nosp@m.train.nosp@m.ing..nosp@m.de
Version
$Id$

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

Constructor & Destructor Documentation

◆ __construct()

ilOpenLayersMapGUI::__construct ( )

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

38  {
39  parent::__construct();
40  }

Member Function Documentation

◆ getHtml()

ilOpenLayersMapGUI::getHtml ( )

Get HTML.

Definition at line 45 of file class.ilOpenLayersMapGUI.php.

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

46  {
47  global $tpl, $lng, $https;
48 
49  $this->tpl = new ilTemplate("tpl.openlayers_map.html",
50  true, true, "Services/Maps");
51 
52 
53  $lng->loadLanguageModule("maps");
54  $tpl->addJavaScript("Services/Maps/js/OpenLayers.js");
55  $tpl->addJavaScript("Services/Maps/js/ServiceOpenLayers.js");
56 
57  // add user markers
58  $cnt = 0;
59  foreach($this->user_marker as $user_id)
60  {
61  if (ilObject::_exists($user_id))
62  {
63  $user = new ilObjUser($user_id);
64  if ($user->getLatitude() != 0 && $user->getLongitude() != 0 &&
65  $user->getPref("public_location") == "y")
66  {
67  $this->tpl->setCurrentBlock("user_marker");
68  $this->tpl->setVariable("UMAP_ID",
69  $this->getMapId());
70  $this->tpl->setVariable("CNT", $cnt);
71 
72  $this->tpl->setVariable("ULAT", htmlspecialchars($user->getLatitude()));
73  $this->tpl->setVariable("ULONG", htmlspecialchars($user->getLongitude()));
74  $info = htmlspecialchars($user->getFirstName()." ".$user->getLastName());
75  $delim = "<br \/>";
76  if ($user->getPref("public_institution") == "y")
77  {
78  $info.= $delim.htmlspecialchars($user->getInstitution());
79  $delim = ", ";
80  }
81  if ($user->getPref("public_department") == "y")
82  {
83  $info.= $delim.htmlspecialchars($user->getDepartment());
84  }
85  $delim = "<br \/>";
86  if ($user->getPref("public_street") == "y")
87  {
88  $info.= $delim.htmlspecialchars($user->getStreet());
89  }
90  if ($user->getPref("public_zip") == "y")
91  {
92  $info.= $delim.htmlspecialchars($user->getZipcode());
93  $delim = " ";
94  }
95  if ($user->getPref("public_city") == "y")
96  {
97  $info.= $delim.htmlspecialchars($user->getCity());
98  }
99  $delim = "<br \/>";
100  if ($user->getPref("public_country") == "y")
101  {
102  $info.= $delim.htmlspecialchars($user->getCountry());
103  }
104  $this->tpl->setVariable("USER_INFO",
105  $info);
106  $this->tpl->setVariable("IMG_USER",
107  $user->getPersonalPicturePath("xsmall"));
108  $this->tpl->parseCurrentBlock();
109  $cnt++;
110  }
111  }
112  }
113 
114  $this->tpl->setVariable("MAP_ID", $this->getMapId());
115  $this->tpl->setVariable("WIDTH", $this->getWidth());
116  $this->tpl->setVariable("HEIGHT", $this->getHeight());
117  $this->tpl->setVariable("LAT", $this->getLatitude());
118  $this->tpl->setVariable("LONG", $this->getLongitude());
119  $this->tpl->setVariable("ZOOM", (int) $this->getZoom());
120  $nav_control = $this->getEnableNavigationControl()
121  ? "true"
122  : "false";
123  $this->tpl->setVariable("NAV_CONTROL", $nav_control);
124  $central_marker = $this->getEnableCentralMarker()
125  ? "true"
126  : "false";
127  $this->tpl->setVariable("CENTRAL_MARKER", $central_marker);
128  $replace_marker = $this->getEnableUpdateListener()
129  ? "true"
130  : "false";
131  $this->tpl->setVariable("REPLACE_MARKER", $replace_marker);
132  $this->tpl->setVariable("INVALID_ADDRESS_STRING", $lng->txt("invalid_address"));
133 
134  return $this->tpl->get();
135  }
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.
global $tpl
Definition: ilias.php:8
getEnableNavigationControl()
Get Use Navigation Control.
global $https
Definition: imgupload.php:15
special template class to simplify handling of ITX/PEAR
getHeight()
Get Height.
getLongitude()
Get Longitude.
global $lng
Definition: privfeed.php:40
+ Here is the call graph for this function:

◆ getUserListHtml()

ilOpenLayersMapGUI::getUserListHtml ( )

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

Definition at line 140 of file class.ilOpenLayersMapGUI.php.

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

141  {
142  $list_tpl = new ilTemplate("tpl.openlayers_map_user_list.html",
143  true, true, "Services/Maps");
144 
145  $cnt = 0;
146  foreach($this->user_marker as $user_id)
147  {
148  if (ilObject::_exists($user_id))
149  {
150  $user = new ilObjUser($user_id);
151  $this->css_row = ($this->css_row != "tblrow1_mo")
152  ? "tblrow1_mo"
153  : "tblrow2_mo";
154  if ($user->getLatitude() != 0 && $user->getLongitude() != 0
155  && $user->getPref("public_location") == "y")
156  {
157  $list_tpl->setCurrentBlock("item");
158  $list_tpl->setVariable("MARKER_CNT", $cnt);
159  $list_tpl->setVariable("MAP_ID", $this->getMapId());
160  $cnt++;
161  }
162  else
163  {
164  $list_tpl->setCurrentBlock("item_no_link");
165  }
166  $list_tpl->setVariable("CSS_ROW", $this->css_row);
167  $list_tpl->setVariable("TXT_USER", $user->getLogin());
168  $list_tpl->setVariable("IMG_USER",
169  $user->getPersonalPicturePath("xxsmall"));
170  $list_tpl->parseCurrentBlock();
171  $list_tpl->touchBlock("row");
172  }
173  }
174 
175  return $list_tpl->get();
176  }
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
+ Here is the call graph for this function:

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