ILIAS  Release_3_10_x_branch Revision 61812
 All Data Structures Namespaces Files Functions Variables Groups Pages
class.ilPluginAdmin.php
Go to the documentation of this file.
1 <?php
2 /*
3  +-----------------------------------------------------------------------------+
4  | ILIAS open source |
5  +-----------------------------------------------------------------------------+
6  | Copyright (c) 1998-2008 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 
24 
25 include_once("./Services/Component/classes/class.ilComponent.php");
26 
36 {
40  function __construct()
41  {
42  }
43 
52  private final function getPluginData($a_ctype, $a_cname, $a_slot_id, $a_pname)
53  {
54  global $ilDB, $lng;
55 
56  if (!$this->got_data[$a_ctype][$a_cname][$a_slot_id][$a_pname])
57  {
58  include_once "./Services/Component/classes/class.ilPluginSlot.php";
59  $slot_name = ilPluginSlot::lookupSlotName($a_ctype, $a_cname, $a_slot_id);
60 
61  $plugin_php_file = "./Customizing/global/plugins/".$a_ctype."/".
62  $a_cname."/".$slot_name."/".$a_pname."/plugin.php";
63 
64  $rec = ilPlugin::getPluginRecord($a_ctype, $a_cname, $a_slot_id, $a_pname);
65 
66  if (is_file($plugin_php_file))
67  {
68  include_once($plugin_php_file);
69  $this->data[$a_ctype][$a_cname][$a_slot_id][$a_pname] =
70  array("version" => $version, "id" => $id,
71  "ilias_min_version" => $ilias_min_version,
72  "ilias_max_version" => $ilias_max_version,
73  "responsible" => $responsible,
74  "responsible_mail" => $responsible_mail);
75  }
76 
77  $active = $rec["active"];
78  $needs_update = false;
79  $activation_possible = !$active;
80 
81  // version checks
83  {
84  $active = false;
85  $inactive_reason = $lng->txt("cmps_needs_newer_ilias_version");
86  $activation_possible = false;
87  }
88  else if (ilComponent::isVersionGreaterString(ILIAS_VERSION_NUMERIC, $ilias_max_version))
89  {
90  $active = false;
91  $inactive_reason = $lng->txt("cmps_needs_newer_plugin_version");
92  $activation_possible = false;
93  }
94  else if ($rec["last_update_version"] == "")
95  {
96  $active = false;
97  $inactive_reason = $lng->txt("cmps_needs_update");
98  $needs_update = true;
99  $activation_possible = false;
100  }
101  else if (ilComponent::isVersionGreaterString($rec["last_update_version"], $version))
102  {
103  $active = false;
104  $inactive_reason = $lng->txt("cmps_needs_upgrade");
105  $activation_possible = false;
106  }
107  else if ($rec["last_update_version"] != $version)
108  {
109  $active = false;
110  $inactive_reason = $lng->txt("cmps_needs_update");
111  $needs_update = true;
112  $activation_possible = false;
113  }
114 
115  $this->data[$a_ctype][$a_cname][$a_slot_id][$a_pname]["is_active"] = $active;
116  $this->data[$a_ctype][$a_cname][$a_slot_id][$a_pname]["inactive_reason"] = $inactive_reason;
117  $this->data[$a_ctype][$a_cname][$a_slot_id][$a_pname]["needs_update"] = $needs_update;
118  $this->data[$a_ctype][$a_cname][$a_slot_id][$a_pname]["activation_possible"] = $activation_possible;
119 
120  $this->got_data[$a_ctype][$a_cname][$a_slot_id][$a_pname] = true;
121  }
122  }
123 
132  function getVersion($a_ctype, $a_cname, $a_slot_id, $a_pname)
133  {
134  $this->getPluginData($a_ctype, $a_cname, $a_slot_id, $a_pname);
135  return $this->data[$a_ctype][$a_cname][$a_slot_id][$a_pname]["version"];
136  }
137 
146  function getIliasMinVersion($a_ctype, $a_cname, $a_slot_id, $a_pname)
147  {
148  $this->getPluginData($a_ctype, $a_cname, $a_slot_id, $a_pname);
149  return $this->data[$a_ctype][$a_cname][$a_slot_id][$a_pname]["ilias_min_version"];
150  }
151 
160  function getIliasMaxVersion($a_ctype, $a_cname, $a_slot_id, $a_pname)
161  {
162  $this->getPluginData($a_ctype, $a_cname, $a_slot_id, $a_pname);
163  return $this->data[$a_ctype][$a_cname][$a_slot_id][$a_pname]["ilias_max_version"];
164  }
165 
174  function getId($a_ctype, $a_cname, $a_slot_id, $a_pname)
175  {
176  $this->getPluginData($a_ctype, $a_cname, $a_slot_id, $a_pname);
177  return $this->data[$a_ctype][$a_cname][$a_slot_id][$a_pname]["id"];
178  }
179 
188  function isActive($a_ctype, $a_cname, $a_slot_id, $a_pname)
189  {
190  $this->getPluginData($a_ctype, $a_cname, $a_slot_id, $a_pname);
191  return $this->data[$a_ctype][$a_cname][$a_slot_id][$a_pname]["is_active"];
192  }
193 
202  function needsUpdate($a_ctype, $a_cname, $a_slot_id, $a_pname)
203  {
204  $this->getPluginData($a_ctype, $a_cname, $a_slot_id, $a_pname);
205  return $this->data[$a_ctype][$a_cname][$a_slot_id][$a_pname]["needs_update"];
206  }
207 
216  function getAllData($a_ctype, $a_cname, $a_slot_id, $a_pname)
217  {
218  $this->getPluginData($a_ctype, $a_cname, $a_slot_id, $a_pname);
219  return $this->data[$a_ctype][$a_cname][$a_slot_id][$a_pname];
220  }
221 
225  function getActivePluginsForSlot($a_ctype, $a_cname, $a_slot_id)
226  {
227  include_once "./Services/Component/classes/class.ilPlugin.php";
228  return ilPlugin::getActivePluginsForSlot($a_ctype, $a_cname, $a_slot_id);
229  }
230 
239  static function getPluginObject($a_ctype, $a_cname, $a_slot_id, $a_pname)
240  {
241  return ilPlugin::getPluginObject($a_ctype, $a_cname, $a_slot_id, $a_pname);
242  }
243 }
244 
245 ?>