ILIAS  Release_5_0_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
class.ilMapUtil.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 
32 class ilMapUtil
33 {
34  static $_settings = null;
35 
36  // Settings
37 
38  static function settings()
39  {
40  if (self::$_settings === null) {
41  self::$_settings = new ilSetting("maps");
42  }
43  return self::$_settings;
44  }
45 
46 
47 
54  static function isActivated()
55  {
56  return self::settings()->get("enable") == 1;
57  }
58 
59  // RK TODO: check inputs of setters
60 
61  static function setActivated($a_activated)
62  {
63  self::settings()->set("enable", $a_activated?"1":"0");
64  }
65 
66  static function setType($a_type)
67  {
68  self::settings()->set("type", $a_type);
69  }
70 
71  static function getType() {
72  return self::settings()->get("type");
73  }
74 
75  static function setStdLatitude($a_lat)
76  {
77  self::settings()->set("std_latitude", $a_lat);
78  }
79 
80  static function getStdLatitude()
81  {
82  return self::settings()->get("std_latitude");
83  }
84 
85  static function setStdLongitude($a_lon)
86  {
87  self::settings()->set("std_longitude", $a_lon);
88  }
89 
90  static function getStdLongitude()
91  {
92  return self::settings()->get("std_longitude");
93  }
94 
95  static function setStdZoom($a_zoom)
96  {
97  self::settings()->set("std_zoom", $a_zoom);
98  }
99 
100  static function getStdZoom()
101  {
102  return self::settings()->get("std_zoom");
103  }
104 
110  static function getDefaultSettings()
111  {
112  return array(
113  "longitude" => self::settings()->get("std_longitude"),
114  "latitude" => self::settings()->get("std_latitude"),
115  "zoom" => self::settings()->get("std_zoom"));
116  }
117 
121  static public function getMapGUI()
122  {
123  $type = self::getType();
124  switch ($type) {
125  case "googlemaps":
126  require_once("Services/Maps/classes/class.ilGoogleMapGUI.php");
127  return new ilGoogleMapGUI();
128  case "openlayers":
129  require_once("Services/Maps/classes/class.ilOpenLayersMapGUI.php");
130  return new ilOpenLayersMapGUI();
131  default:
132  require_once("Services/Maps/classes/class.ilGoogleMapGUI.php");
133  return new ilGoogleMapGUI();
134  }
135  }
136 
142  static public function getAvailableMapTypes()
143  {
144  global $lng;
145  $lng->loadLanguageModule("maps");
146  return array( "openlayers" => $lng->txt("maps_open_layers_maps")
147  , "googlemaps" => $lng->txt("maps_google_maps")
148  );
149  }
150 }
151 ?>