ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
ilPluginAdmin Class Reference

Administration class for plugins. More...

+ Collaboration diagram for ilPluginAdmin:

Public Member Functions

 __construct ()
 Constructor. More...
 
 getVersion ($a_ctype, $a_cname, $a_slot_id, $a_pname)
 Get version of plugin. More...
 
 getIliasMinVersion ($a_ctype, $a_cname, $a_slot_id, $a_pname)
 Get Ilias Min Version. More...
 
 getIliasMaxVersion ($a_ctype, $a_cname, $a_slot_id, $a_pname)
 Get Ilias Max Version. More...
 
 getId ($a_ctype, $a_cname, $a_slot_id, $a_pname)
 Get ID. More...
 
 isActive ($a_ctype, $a_cname, $a_slot_id, $a_pname)
 Checks whether plugin is active (include version checks) More...
 
 exists ($a_ctype, $a_cname, $a_slot_id, $a_pname)
 Checks whether plugin exists. More...
 
 needsUpdate ($a_ctype, $a_cname, $a_slot_id, $a_pname)
 Get version. More...
 
 getAllData ($a_ctype, $a_cname, $a_slot_id, $a_pname)
 Get all data from file in an array. More...
 
 hasLearningProgress ($a_ctype, $a_cname, $a_slot_id, $a_pname)
 Checks whether plugin has active learning progress. More...
 
 supportsExport ($a_ctype, $a_cname, $a_slot_id, $a_pname)
 Checks whether plugin supports export/import. More...
 

Static Public Member Functions

static getActivePluginsForSlot ($a_ctype, $a_cname, $a_slot_id)
 Get all active plugins for a slot. More...
 
static getPluginObject ($a_ctype, $a_cname, $a_slot_id, $a_pname)
 Get Plugin Object. More...
 
static includeClass ($a_ctype, $a_cname, $a_slot_id, $a_pname, $a_class_file_name)
 Get Plugin Object. More...
 

Data Fields

 $got_data = false
 

Static Public Attributes

static $active_plugins = array()
 
static $plugin_objects = array()
 

Private Member Functions

 getPluginData ($a_ctype, $a_cname, $a_slot_id, $a_pname)
 Get basic data of plugin from plugin.php. More...
 

Detailed Description

Administration class for plugins.

Handles basic data from plugin.php files.

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

Definition at line 16 of file class.ilPluginAdmin.php.

Constructor & Destructor Documentation

◆ __construct()

ilPluginAdmin::__construct ( )

Constructor.

Definition at line 36 of file class.ilPluginAdmin.php.

37  {
38  }

Member Function Documentation

◆ exists()

ilPluginAdmin::exists (   $a_ctype,
  $a_cname,
  $a_slot_id,
  $a_pname 
)

Checks whether plugin exists.

Parameters
string$a_ctypeComponent Type
string$a_cnameComponent Name
string$a_slot_idSlot ID
string$a_pnamePlugin Name

Definition at line 243 of file class.ilPluginAdmin.php.

References data, and getPluginData().

244  {
245  $this->getPluginData($a_ctype, $a_cname, $a_slot_id, $a_pname);
246  return isset($this->data[$a_ctype][$a_cname][$a_slot_id][$a_pname]);
247  }
Add some data
getPluginData($a_ctype, $a_cname, $a_slot_id, $a_pname)
Get basic data of plugin from plugin.php.
+ Here is the call graph for this function:

◆ getActivePluginsForSlot()

static ilPluginAdmin::getActivePluginsForSlot (   $a_ctype,
  $a_cname,
  $a_slot_id 
)
static

Get all active plugins for a slot.

Definition at line 280 of file class.ilPluginAdmin.php.

References ilPlugin\getActivePluginsForSlot().

Referenced by ilDclPluginFieldRepresentation\buildFieldCreationInput(), and ilAppEventHandler\raise().

281  {
282  // cache the list of active plugins
283  if (!isset(self::$active_plugins[$a_ctype][$a_cname][$a_slot_id]))
284  {
285  include_once "./Services/Component/classes/class.ilPlugin.php";
286 
287  self::$active_plugins[$a_ctype][$a_cname][$a_slot_id] =
288  ilPlugin::getActivePluginsForSlot($a_ctype, $a_cname, $a_slot_id);
289  }
290  return self::$active_plugins[$a_ctype][$a_cname][$a_slot_id];
291  }
static getActivePluginsForSlot($a_ctype, $a_cname, $a_slot_id)
Get all active plugin names for a slot.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getAllData()

ilPluginAdmin::getAllData (   $a_ctype,
  $a_cname,
  $a_slot_id,
  $a_pname 
)

Get all data from file in an array.

Parameters
string$a_ctypeComponent Type
string$a_cnameComponent Name
string$a_slot_idSlot ID
string$a_pnamePlugin Name

Definition at line 271 of file class.ilPluginAdmin.php.

References data, and getPluginData().

272  {
273  $this->getPluginData($a_ctype, $a_cname, $a_slot_id, $a_pname);
274  return $this->data[$a_ctype][$a_cname][$a_slot_id][$a_pname];
275  }
Add some data
getPluginData($a_ctype, $a_cname, $a_slot_id, $a_pname)
Get basic data of plugin from plugin.php.
+ Here is the call graph for this function:

◆ getId()

ilPluginAdmin::getId (   $a_ctype,
  $a_cname,
  $a_slot_id,
  $a_pname 
)

Get ID.

Parameters
string$a_ctypeComponent Type
string$a_cnameComponent Name
string$a_slot_idSlot ID
string$a_pnamePlugin Name

Definition at line 208 of file class.ilPluginAdmin.php.

References data, and getPluginData().

209  {
210  $this->getPluginData($a_ctype, $a_cname, $a_slot_id, $a_pname);
211  return $this->data[$a_ctype][$a_cname][$a_slot_id][$a_pname]["id"];
212  }
Add some data
getPluginData($a_ctype, $a_cname, $a_slot_id, $a_pname)
Get basic data of plugin from plugin.php.
+ Here is the call graph for this function:

◆ getIliasMaxVersion()

ilPluginAdmin::getIliasMaxVersion (   $a_ctype,
  $a_cname,
  $a_slot_id,
  $a_pname 
)

Get Ilias Max Version.

Parameters
string$a_ctypeComponent Type
string$a_cnameComponent Name
string$a_slot_idSlot ID
string$a_pnamePlugin Name

Definition at line 194 of file class.ilPluginAdmin.php.

References data, and getPluginData().

195  {
196  $this->getPluginData($a_ctype, $a_cname, $a_slot_id, $a_pname);
197  return $this->data[$a_ctype][$a_cname][$a_slot_id][$a_pname]["ilias_max_version"];
198  }
Add some data
getPluginData($a_ctype, $a_cname, $a_slot_id, $a_pname)
Get basic data of plugin from plugin.php.
+ Here is the call graph for this function:

◆ getIliasMinVersion()

ilPluginAdmin::getIliasMinVersion (   $a_ctype,
  $a_cname,
  $a_slot_id,
  $a_pname 
)

Get Ilias Min Version.

Parameters
string$a_ctypeComponent Type
string$a_cnameComponent Name
string$a_slot_idSlot ID
string$a_pnamePlugin Name

Definition at line 180 of file class.ilPluginAdmin.php.

References data, and getPluginData().

181  {
182  $this->getPluginData($a_ctype, $a_cname, $a_slot_id, $a_pname);
183  return $this->data[$a_ctype][$a_cname][$a_slot_id][$a_pname]["ilias_min_version"];
184  }
Add some data
getPluginData($a_ctype, $a_cname, $a_slot_id, $a_pname)
Get basic data of plugin from plugin.php.
+ Here is the call graph for this function:

◆ getPluginData()

ilPluginAdmin::getPluginData (   $a_ctype,
  $a_cname,
  $a_slot_id,
  $a_pname 
)
finalprivate

Get basic data of plugin from plugin.php.

Parameters
string$a_ctypeComponent Type
string$a_cnameComponent Name
string$a_slot_idSlot ID
string$a_pnamePlugin Name

Definition at line 48 of file class.ilPluginAdmin.php.

References $ilDB, $lng, $version, array, data, ilPlugin\getPluginRecord(), ILIAS_VERSION_NUMERIC, ilComponent\isVersionGreaterString(), and ilPluginSlot\lookupSlotName().

Referenced by exists(), getAllData(), getId(), getIliasMaxVersion(), getIliasMinVersion(), getVersion(), hasLearningProgress(), isActive(), needsUpdate(), and supportsExport().

49  {
50  global $ilDB, $lng;
51 
52  if (!isset($this->got_data[$a_ctype][$a_cname][$a_slot_id][$a_pname]))
53  {
54  include_once "./Services/Component/classes/class.ilPluginSlot.php";
55  $slot_name = ilPluginSlot::lookupSlotName($a_ctype, $a_cname, $a_slot_id);
56 
57  $plugin_php_file = "./Customizing/global/plugins/".$a_ctype."/".
58  $a_cname."/".$slot_name."/".$a_pname."/plugin.php";
59 
60  $rec = ilPlugin::getPluginRecord($a_ctype, $a_cname, $a_slot_id, $a_pname);
61 
62  if (is_file($plugin_php_file))
63  {
64  include_once($plugin_php_file);
65  $this->data[$a_ctype][$a_cname][$a_slot_id][$a_pname] =
66  array("version" => $version, "id" => $id,
67  "ilias_min_version" => $ilias_min_version,
68  "ilias_max_version" => $ilias_max_version,
69  "responsible" => $responsible,
70  "responsible_mail" => $responsible_mail,
71  "learning_progress" => (bool)$learning_progress,
72  "supports_export" => (bool)$supports_export);
73  }
74 
75  $active = $rec["active"];
76  $needs_update = false;
77  $activation_possible = !$active;
78  $inactive_reason = "";
79 
80  // version checks
82  {
83  $active = false;
84  if (is_object($lng))
85  {
86  $inactive_reason = $lng->txt("cmps_needs_newer_ilias_version");
87  }
88  else
89  {
90  $inactive_reason = "Plugin needs a newer version of ILIAS.";
91  }
92  $activation_possible = false;
93  }
94  else if (ilComponent::isVersionGreaterString(ILIAS_VERSION_NUMERIC, $ilias_max_version))
95  {
96  $active = false;
97  if (is_object($lng))
98  {
99  $inactive_reason = $lng->txt("cmps_needs_newer_plugin_version");
100  }
101  else
102  {
103  $inactive_reason = "Plugin does not support current version of ILIAS. Newer version of plugin needed.";
104  }
105  $activation_possible = false;
106  }
107  else if ($rec["last_update_version"] == "")
108  {
109  $active = false;
110  if (is_object($lng))
111  {
112  $inactive_reason = $lng->txt("cmps_needs_update");
113  }
114  else
115  {
116  $inactive_reason = "Update needed.";
117  }
118  $needs_update = true;
119  $activation_possible = false;
120  }
121  else if (ilComponent::isVersionGreaterString($rec["last_update_version"], $version))
122  {
123  $active = false;
124  if (is_object($lng))
125  {
126  $inactive_reason = $lng->txt("cmps_needs_upgrade");
127  }
128  else
129  {
130  $inactive_reason = "Upgrade needed.";
131  }
132  $activation_possible = false;
133  }
134  else if ($rec["last_update_version"] != $version)
135  {
136  $active = false;
137  if (is_object($lng))
138  {
139  $inactive_reason = $lng->txt("cmps_needs_update");
140  }
141  else
142  {
143  $inactive_reason = "Update needed.";
144  }
145  $needs_update = true;
146  $activation_possible = false;
147  }
148 
149  $this->data[$a_ctype][$a_cname][$a_slot_id][$a_pname]["is_active"] = $active;
150  $this->data[$a_ctype][$a_cname][$a_slot_id][$a_pname]["inactive_reason"] = $inactive_reason;
151  $this->data[$a_ctype][$a_cname][$a_slot_id][$a_pname]["needs_update"] = $needs_update;
152  $this->data[$a_ctype][$a_cname][$a_slot_id][$a_pname]["activation_possible"] = $activation_possible;
153 
154  $this->got_data[$a_ctype][$a_cname][$a_slot_id][$a_pname] = true;
155  }
156  }
Add some data
const ILIAS_VERSION_NUMERIC
static isVersionGreaterString($a_ver1, $a_ver2)
static lookupSlotName($a_ctype, $a_cname, $a_slot_id)
Lookup slot name for component and slot id.
static getPluginRecord($a_ctype, $a_cname, $a_slot_id, $a_pname)
Get record from il_plugin table.
Create styles array
The data for the language used.
global $lng
Definition: privfeed.php:17
global $ilDB
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getPluginObject()

static ilPluginAdmin::getPluginObject (   $a_ctype,
  $a_cname,
  $a_slot_id,
  $a_pname 
)
static

Get Plugin Object.

Parameters
string$a_ctypeComponent Type
string$a_cnameComponent Name
string$a_slot_idSlot ID
string$a_pnamePlugin Name
Returns
ilPlugin the plugin

Definition at line 302 of file class.ilPluginAdmin.php.

References ilPlugin\getPluginObject().

Referenced by ilUIHookProcessor\__construct(), ilTestSignatureGUI\__construct(), ilTabsGUI\__getHTML(), ilStartUpGUI\_checkGoto(), ilTemplate\addBlockFile(), ilDclPluginFieldRepresentation\buildFieldCreationInput(), ilObjComponentSettingsGUI\executeCommand(), ilTemplate\get(), ilContainerGUI\getAsynchItemListObject(), ilInitialisation\initStyle(), ilRendererFactory\loadAvailableRenderers(), ilTemplate\loadTemplatefile(), ilAppEventHandler\raise(), ilUtil\redirect(), ilObjContentObjectGUI\setilLMMenu(), and ilTemplate\show().

303  {
304  // cache the plugin objects
305  if (!isset(self::$plugin_objects[$a_ctype][$a_cname][$a_slot_id][$a_pname]))
306  {
307  self::$plugin_objects[$a_ctype][$a_cname][$a_slot_id][$a_pname] =
308  ilPlugin::getPluginObject($a_ctype, $a_cname, $a_slot_id, $a_pname);
309  }
310  return self::$plugin_objects[$a_ctype][$a_cname][$a_slot_id][$a_pname];
311  }
static getPluginObject($a_ctype, $a_cname, $a_slot_id, $a_pname)
Get plugin object.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getVersion()

ilPluginAdmin::getVersion (   $a_ctype,
  $a_cname,
  $a_slot_id,
  $a_pname 
)

Get version of plugin.

Parameters
string$a_ctypeComponent Type
string$a_cnameComponent Name
string$a_slot_idSlot ID
string$a_pnamePlugin Name

Definition at line 166 of file class.ilPluginAdmin.php.

References data, and getPluginData().

167  {
168  $this->getPluginData($a_ctype, $a_cname, $a_slot_id, $a_pname);
169  return $this->data[$a_ctype][$a_cname][$a_slot_id][$a_pname]["version"];
170  }
Add some data
getPluginData($a_ctype, $a_cname, $a_slot_id, $a_pname)
Get basic data of plugin from plugin.php.
+ Here is the call graph for this function:

◆ hasLearningProgress()

ilPluginAdmin::hasLearningProgress (   $a_ctype,
  $a_cname,
  $a_slot_id,
  $a_pname 
)

Checks whether plugin has active learning progress.

Parameters
string$a_ctypeComponent Type
string$a_cnameComponent Name
string$a_slot_idSlot ID
string$a_pnamePlugin Name
Returns
bool

Definition at line 344 of file class.ilPluginAdmin.php.

References data, and getPluginData().

345  {
346  $this->getPluginData($a_ctype, $a_cname, $a_slot_id, $a_pname);
347  return $this->data[$a_ctype][$a_cname][$a_slot_id][$a_pname]["learning_progress"];
348  }
Add some data
getPluginData($a_ctype, $a_cname, $a_slot_id, $a_pname)
Get basic data of plugin from plugin.php.
+ Here is the call graph for this function:

◆ includeClass()

static ilPluginAdmin::includeClass (   $a_ctype,
  $a_cname,
  $a_slot_id,
  $a_pname,
  $a_class_file_name 
)
static

Get Plugin Object.

Parameters
string$a_ctypeComponent Type
string$a_cnameComponent Name
string$a_slot_idSlot ID
string$a_pnamePlugin Name
Returns
ilPlugin the plugin

Definition at line 322 of file class.ilPluginAdmin.php.

References ilPlugin\getPluginObject().

324  {
325  // cache the plugin objects
326  if (!isset(self::$plugin_objects[$a_ctype][$a_cname][$a_slot_id][$a_pname]))
327  {
328  self::$plugin_objects[$a_ctype][$a_cname][$a_slot_id][$a_pname] =
329  ilPlugin::getPluginObject($a_ctype, $a_cname, $a_slot_id, $a_pname);
330  }
331  $pl = self::$plugin_objects[$a_ctype][$a_cname][$a_slot_id][$a_pname];
332  $pl->includeClass($a_class_file_name);
333  }
static getPluginObject($a_ctype, $a_cname, $a_slot_id, $a_pname)
Get plugin object.
+ Here is the call graph for this function:

◆ isActive()

ilPluginAdmin::isActive (   $a_ctype,
  $a_cname,
  $a_slot_id,
  $a_pname 
)

Checks whether plugin is active (include version checks)

Parameters
string$a_ctypeComponent Type
string$a_cnameComponent Name
string$a_slot_idSlot ID
string$a_pnamePlugin Name

Definition at line 222 of file class.ilPluginAdmin.php.

References data, and getPluginData().

223  {
224  try
225  {
226  $this->getPluginData($a_ctype, $a_cname, $a_slot_id, $a_pname);
227  }
228  catch (ilPluginException $e)
229  {
230  return false;
231  }
232  return $this->data[$a_ctype][$a_cname][$a_slot_id][$a_pname]["is_active"];
233  }
Add some data
getPluginData($a_ctype, $a_cname, $a_slot_id, $a_pname)
Get basic data of plugin from plugin.php.
+ Here is the call graph for this function:

◆ needsUpdate()

ilPluginAdmin::needsUpdate (   $a_ctype,
  $a_cname,
  $a_slot_id,
  $a_pname 
)

Get version.

Parameters
string$a_ctypeComponent Type
string$a_cnameComponent Name
string$a_slot_idSlot ID
string$a_pnamePlugin Name

Definition at line 257 of file class.ilPluginAdmin.php.

References data, and getPluginData().

258  {
259  $this->getPluginData($a_ctype, $a_cname, $a_slot_id, $a_pname);
260  return $this->data[$a_ctype][$a_cname][$a_slot_id][$a_pname]["needs_update"];
261  }
Add some data
getPluginData($a_ctype, $a_cname, $a_slot_id, $a_pname)
Get basic data of plugin from plugin.php.
+ Here is the call graph for this function:

◆ supportsExport()

ilPluginAdmin::supportsExport (   $a_ctype,
  $a_cname,
  $a_slot_id,
  $a_pname 
)

Checks whether plugin supports export/import.

Parameters
string$a_ctypeComponent Type
string$a_cnameComponent Name
string$a_slot_idSlot ID
string$a_pnamePlugin Name
Returns
bool

Definition at line 359 of file class.ilPluginAdmin.php.

References data, and getPluginData().

360  {
361  $this->getPluginData($a_ctype, $a_cname, $a_slot_id, $a_pname);
362  return $this->data[$a_ctype][$a_cname][$a_slot_id][$a_pname]["supports_export"];
363  }
Add some data
getPluginData($a_ctype, $a_cname, $a_slot_id, $a_pname)
Get basic data of plugin from plugin.php.
+ Here is the call graph for this function:

Field Documentation

◆ $active_plugins

ilPluginAdmin::$active_plugins = array()
static

Definition at line 24 of file class.ilPluginAdmin.php.

◆ $got_data

ilPluginAdmin::$got_data = false

Definition at line 18 of file class.ilPluginAdmin.php.

◆ $plugin_objects

ilPluginAdmin::$plugin_objects = array()
static

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


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