ILIAS  release_4-4 Revision
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...
 
 getActivePluginsForSlot ($a_ctype, $a_cname, $a_slot_id)
 Get all active plugins for a slot. More...
 
 hasLearningProgress ($a_ctype, $a_cname, $a_slot_id, $a_pname)
 Checks whether plugin has active learning progress. More...
 

Static Public Member Functions

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 235 of file class.ilPluginAdmin.php.

References getPluginData().

236  {
237  $this->getPluginData($a_ctype, $a_cname, $a_slot_id, $a_pname);
238  return isset($this->data[$a_ctype][$a_cname][$a_slot_id][$a_pname]);
239  }
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()

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

Get all active plugins for a slot.

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

References ilPlugin\getActivePluginsForSlot().

Referenced by ilAppEventHandler\raise().

273  {
274  // cache the list of active plugins
275  if (!isset(self::$active_plugins[$a_ctype][$a_cname][$a_slot_id]))
276  {
277  include_once "./Services/Component/classes/class.ilPlugin.php";
278 
279  self::$active_plugins[$a_ctype][$a_cname][$a_slot_id] =
280  ilPlugin::getActivePluginsForSlot($a_ctype, $a_cname, $a_slot_id);
281  }
282  return self::$active_plugins[$a_ctype][$a_cname][$a_slot_id];
283  }
static getActivePluginsForSlot($a_ctype, $a_cname, $a_slot_id)
Get all active plugins 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 263 of file class.ilPluginAdmin.php.

References getPluginData().

264  {
265  $this->getPluginData($a_ctype, $a_cname, $a_slot_id, $a_pname);
266  return $this->data[$a_ctype][$a_cname][$a_slot_id][$a_pname];
267  }
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 207 of file class.ilPluginAdmin.php.

References getPluginData().

208  {
209  $this->getPluginData($a_ctype, $a_cname, $a_slot_id, $a_pname);
210  return $this->data[$a_ctype][$a_cname][$a_slot_id][$a_pname]["id"];
211  }
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 193 of file class.ilPluginAdmin.php.

References getPluginData().

194  {
195  $this->getPluginData($a_ctype, $a_cname, $a_slot_id, $a_pname);
196  return $this->data[$a_ctype][$a_cname][$a_slot_id][$a_pname]["ilias_max_version"];
197  }
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 179 of file class.ilPluginAdmin.php.

References getPluginData().

180  {
181  $this->getPluginData($a_ctype, $a_cname, $a_slot_id, $a_pname);
182  return $this->data[$a_ctype][$a_cname][$a_slot_id][$a_pname]["ilias_min_version"];
183  }
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 $lng, ilPlugin\getPluginRecord(), ILIAS_VERSION_NUMERIC, ilComponent\isVersionGreaterString(), and ilPluginSlot\lookupSlotName().

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

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  }
73 
74  $active = $rec["active"];
75  $needs_update = false;
76  $activation_possible = !$active;
77  $inactive_reason = "";
78 
79  // version checks
81  {
82  $active = false;
83  if (is_object($lng))
84  {
85  $inactive_reason = $lng->txt("cmps_needs_newer_ilias_version");
86  }
87  else
88  {
89  $inactive_reason = "Plugin needs a newer version of ILIAS.";
90  }
91  $activation_possible = false;
92  }
93  else if (ilComponent::isVersionGreaterString(ILIAS_VERSION_NUMERIC, $ilias_max_version))
94  {
95  $active = false;
96  if (is_object($lng))
97  {
98  $inactive_reason = $lng->txt("cmps_needs_newer_plugin_version");
99  }
100  else
101  {
102  $inactive_reason = "Plugin does not support current version of ILIAS. Newer version of plugin needed.";
103  }
104  $activation_possible = false;
105  }
106  else if ($rec["last_update_version"] == "")
107  {
108  $active = false;
109  if (is_object($lng))
110  {
111  $inactive_reason = $lng->txt("cmps_needs_update");
112  }
113  else
114  {
115  $inactive_reason = "Update needed.";
116  }
117  $needs_update = true;
118  $activation_possible = false;
119  }
120  else if (ilComponent::isVersionGreaterString($rec["last_update_version"], $version))
121  {
122  $active = false;
123  if (is_object($lng))
124  {
125  $inactive_reason = $lng->txt("cmps_needs_upgrade");
126  }
127  else
128  {
129  $inactive_reason = "Upgrade needed.";
130  }
131  $activation_possible = false;
132  }
133  else if ($rec["last_update_version"] != $version)
134  {
135  $active = false;
136  if (is_object($lng))
137  {
138  $inactive_reason = $lng->txt("cmps_needs_update");
139  }
140  else
141  {
142  $inactive_reason = "Update needed.";
143  }
144  $needs_update = true;
145  $activation_possible = false;
146  }
147 
148  $this->data[$a_ctype][$a_cname][$a_slot_id][$a_pname]["is_active"] = $active;
149  $this->data[$a_ctype][$a_cname][$a_slot_id][$a_pname]["inactive_reason"] = $inactive_reason;
150  $this->data[$a_ctype][$a_cname][$a_slot_id][$a_pname]["needs_update"] = $needs_update;
151  $this->data[$a_ctype][$a_cname][$a_slot_id][$a_pname]["activation_possible"] = $activation_possible;
152 
153  $this->got_data[$a_ctype][$a_cname][$a_slot_id][$a_pname] = true;
154  }
155  }
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.
global $lng
Definition: privfeed.php:40
+ 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 294 of file class.ilPluginAdmin.php.

References ilPlugin\getPluginObject().

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

295  {
296  // cache the plugin objects
297  if (!isset(self::$plugin_objects[$a_ctype][$a_cname][$a_slot_id][$a_pname]))
298  {
299  self::$plugin_objects[$a_ctype][$a_cname][$a_slot_id][$a_pname] =
300  ilPlugin::getPluginObject($a_ctype, $a_cname, $a_slot_id, $a_pname);
301  }
302  return self::$plugin_objects[$a_ctype][$a_cname][$a_slot_id][$a_pname];
303  }
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 165 of file class.ilPluginAdmin.php.

References getPluginData().

166  {
167  $this->getPluginData($a_ctype, $a_cname, $a_slot_id, $a_pname);
168  return $this->data[$a_ctype][$a_cname][$a_slot_id][$a_pname]["version"];
169  }
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

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

References getPluginData().

336  {
337  $this->getPluginData($a_ctype, $a_cname, $a_slot_id, $a_pname);
338  return $this->data[$a_ctype][$a_cname][$a_slot_id][$a_pname]["learning_progress"];
339  }
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 314 of file class.ilPluginAdmin.php.

References ilPlugin\getPluginObject().

316  {
317  // cache the plugin objects
318  if (!isset(self::$plugin_objects[$a_ctype][$a_cname][$a_slot_id][$a_pname]))
319  {
320  self::$plugin_objects[$a_ctype][$a_cname][$a_slot_id][$a_pname] =
321  ilPlugin::getPluginObject($a_ctype, $a_cname, $a_slot_id, $a_pname);
322  }
323  $pl = self::$plugin_objects[$a_ctype][$a_cname][$a_slot_id][$a_pname];
324  $pl->includeClass($a_class_file_name);
325  }
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 221 of file class.ilPluginAdmin.php.

References getPluginData().

222  {
223  $this->getPluginData($a_ctype, $a_cname, $a_slot_id, $a_pname);
224  return $this->data[$a_ctype][$a_cname][$a_slot_id][$a_pname]["is_active"];
225  }
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 249 of file class.ilPluginAdmin.php.

References getPluginData().

250  {
251  $this->getPluginData($a_ctype, $a_cname, $a_slot_id, $a_pname);
252  return $this->data[$a_ctype][$a_cname][$a_slot_id][$a_pname]["needs_update"];
253  }
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: