ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
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 242 of file class.ilPluginAdmin.php.

243 {
244 $this->getPluginData($a_ctype, $a_cname, $a_slot_id, $a_pname);
245 return isset($this->data[$a_ctype][$a_cname][$a_slot_id][$a_pname]);
246 }
getPluginData($a_ctype, $a_cname, $a_slot_id, $a_pname)
Get basic data of plugin from plugin.php.

References getPluginData().

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

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

References ilPlugin\getActivePluginsForSlot().

Referenced by ilAppEventHandler\raise().

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

271 {
272 $this->getPluginData($a_ctype, $a_cname, $a_slot_id, $a_pname);
273 return $this->data[$a_ctype][$a_cname][$a_slot_id][$a_pname];
274 }

References getPluginData().

+ 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.

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 }

References getPluginData().

+ 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.

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 }

References getPluginData().

+ 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.

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 }

References getPluginData().

+ 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.

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 }
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 }
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.
const ILIAS_VERSION_NUMERIC
global $lng
Definition: privfeed.php:40
global $ilDB

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

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

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

302 {
303 // cache the plugin objects
304 if (!isset(self::$plugin_objects[$a_ctype][$a_cname][$a_slot_id][$a_pname]))
305 {
306 self::$plugin_objects[$a_ctype][$a_cname][$a_slot_id][$a_pname] =
307 ilPlugin::getPluginObject($a_ctype, $a_cname, $a_slot_id, $a_pname);
308 }
309 return self::$plugin_objects[$a_ctype][$a_cname][$a_slot_id][$a_pname];
310 }
static getPluginObject($a_ctype, $a_cname, $a_slot_id, $a_pname)
Get plugin object.

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().

+ 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.

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 }

References getPluginData().

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

343 {
344 $this->getPluginData($a_ctype, $a_cname, $a_slot_id, $a_pname);
345 return $this->data[$a_ctype][$a_cname][$a_slot_id][$a_pname]["learning_progress"];
346 }

References getPluginData().

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

323 {
324 // cache the plugin objects
325 if (!isset(self::$plugin_objects[$a_ctype][$a_cname][$a_slot_id][$a_pname]))
326 {
327 self::$plugin_objects[$a_ctype][$a_cname][$a_slot_id][$a_pname] =
328 ilPlugin::getPluginObject($a_ctype, $a_cname, $a_slot_id, $a_pname);
329 }
330 $pl = self::$plugin_objects[$a_ctype][$a_cname][$a_slot_id][$a_pname];
331 $pl->includeClass($a_class_file_name);
332 }

References ilPlugin\getPluginObject().

+ 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.

222 {
223 try
224 {
225 $this->getPluginData($a_ctype, $a_cname, $a_slot_id, $a_pname);
226 }
227 catch (ilPluginException $e)
228 {
229 return false;
230 }
231 return $this->data[$a_ctype][$a_cname][$a_slot_id][$a_pname]["is_active"];
232 }

References getPluginData().

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

257 {
258 $this->getPluginData($a_ctype, $a_cname, $a_slot_id, $a_pname);
259 return $this->data[$a_ctype][$a_cname][$a_slot_id][$a_pname]["needs_update"];
260 }

References getPluginData().

+ 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: