ILIAS  release_5-0 Revision 5.0.0-1144-gc4397b1f870
class.ilOpenLayersMapGUI.php
Go to the documentation of this file.
1<?php
2/*
3 +-----------------------------------------------------------------------------+
4 | ILIAS open source |
5 +-----------------------------------------------------------------------------+
6 | Copyright (c) 1998-2006 ILIAS open source, University of Cologne |
7 | |
8 | This program is free software; you can redistribute it and/or |
9 | modify it under the terms of the GNU General Public License |
10 | as published by the Free Software Foundation; either version 2 |
11 | of the License, or (at your option) any later version. |
12 | |
13 | This program is distributed in the hope that it will be useful, |
14 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
16 | GNU General Public License for more details. |
17 | |
18 | You should have received a copy of the GNU General Public License |
19 | along with this program; if not, write to the Free Software |
20 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
21 +-----------------------------------------------------------------------------+
22*/
23
33require_once("Services/Maps/classes/class.ilMapGUI.php");
34
36{
37 function __construct()
38 {
39 parent::__construct();
40 }
41
45 function getHtml()
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 }
136
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 }
177
178}
179?>
global $tpl
Definition: ilias.php:8
User interface class for maps.
getMapId()
Get Map ID.
getWidth()
Get Width.
getEnableCentralMarker()
Get Enable Central Marker.
getHeight()
Get Height.
getLongitude()
Get Longitude.
getEnableNavigationControl()
Get Use Navigation Control.
getLatitude()
Get Latitude.
getZoom()
Get Zoom.
getEnableUpdateListener()
Get Activate Update Listener.
static _exists($a_id, $a_reference=false, $a_type=null)
checks if an object exists in object_data@access public
User interface class for OpenLayers maps.
getUserListHtml()
Get User List HTML (to be displayed besides the map)
special template class to simplify handling of ITX/PEAR
global $lng
Definition: privfeed.php:40
global $https
Definition: imgupload.php:15