5 include_once(
"./Services/Component/classes/class.ilComponent.php");
52 $this->lng = $DIC->language();
53 $this->lng->loadLanguageModule(
"cmps");
67 private function getPluginData($a_ctype, $a_cname, $a_slot_id, $a_pname)
69 if (!isset($this->got_data[$a_ctype][$a_cname][$a_slot_id][$a_pname])) {
72 $plugin_php_file =
"./Customizing/global/plugins/" . $a_ctype .
"/" . $a_cname .
"/" . $slot_name .
"/" . $a_pname .
"/plugin.php";
74 if (!is_file($plugin_php_file)) {
75 throw new ilPluginException(
"No plugin.php file found for Plugin :" . $a_pname .
".");
81 if ($plugin_db_data[
"plugin_id"] === null) {
86 $this->
updateRequired($plugin_data, $plugin_db_data[
"last_update_version"]);
90 $this->data[$a_ctype][$a_cname][$a_slot_id][$a_pname] = $plugin_data;
91 $this->got_data[$a_ctype][$a_cname][$a_slot_id][$a_pname] =
true;
106 $plugin_data[
"is_active"] =
false;
107 $plugin_data[
"needs_update"] =
false;
108 $plugin_data[
"activation_possible"] =
false;
111 $inactive_reason = $this->lng->txt(
"cmps_needs_newer_ilias_version");
113 $inactive_reason =
"Plugin needs a newer version of ILIAS.";
115 $plugin_data[
"inactive_reason"] = $inactive_reason;
121 $plugin_data[
"is_active"] =
false;
122 $plugin_data[
"needs_update"] =
false;
123 $plugin_data[
"activation_possible"] =
false;
125 $inactive_reason = $this->lng->txt(
"cmps_needs_newer_plugin_version");
127 $inactive_reason =
"Plugin does not support current version of ILIAS. Newer version of plugin needed.";
129 $plugin_data[
"inactive_reason"] = $inactive_reason;
148 if ($last_update_version ==
"") {
149 $plugin_data[
"is_active"] =
false;
151 $inactive_reason = $this->lng->txt(
"cmps_needs_update");
153 $inactive_reason =
"Update needed.";
155 $plugin_data[
"inactive_reason"] = $inactive_reason;
156 $plugin_data[
"needs_update"] =
true;
157 $plugin_data[
"activation_possible"] =
false;
160 $plugin_data[
"is_active"] =
false;
162 $inactive_reason = $this->lng->txt(
"cmps_needs_upgrade");
164 $inactive_reason =
"Upgrade needed.";
166 $plugin_data[
"inactive_reason"] = $inactive_reason;
167 $plugin_data[
"activation_possible"] =
false;
169 if ($last_update_version != $plugin_data[
"version"]) {
170 $plugin_data[
"is_active"] =
false;
172 $inactive_reason = $this->lng->txt(
"cmps_needs_update");
174 $inactive_reason =
"Update needed.";
176 $plugin_data[
"inactive_reason"] = $inactive_reason;
177 $plugin_data[
"needs_update"] =
true;
178 $plugin_data[
"activation_possible"] =
false;
194 $plugin_data[
"must_install"] =
true;
195 $plugin_data[
"is_active"] =
false;
196 $plugin_data[
"needs_update"] =
false;
197 $plugin_data[
"activation_possible"] =
false;
200 $inactive_reason = $this->lng->txt(
"cmps_must_installed");
202 $inactive_reason =
"Plugin must be installed.";
204 $plugin_data[
"inactive_reason"] = $inactive_reason;
220 $plugin_data[
"is_active"] = $active;
221 $plugin_data[
"activation_possible"] = !$active;
222 $plugin_data[
"must_install"] =
false;
223 $plugin_data[
"needs_update"] =
false;
224 $plugin_data[
"inactive_reason"] =
"";
237 include($plugin_php_file);
240 "version" => $version,
242 "ilias_min_version" => $ilias_min_version,
243 "ilias_max_version" => $ilias_max_version,
244 "responsible" => $responsible,
245 "responsible_mail" => $responsible_mail,
246 "learning_progress" => (bool) $learning_progress,
247 "supports_export" => (
bool) $supports_export,
265 public function getVersion($a_ctype, $a_cname, $a_slot_id, $a_pname)
267 $this->
getPluginData($a_ctype, $a_cname, $a_slot_id, $a_pname);
269 return $this->data[$a_ctype][$a_cname][$a_slot_id][$a_pname][
"version"];
286 $this->
getPluginData($a_ctype, $a_cname, $a_slot_id, $a_pname);
288 return $this->data[$a_ctype][$a_cname][$a_slot_id][$a_pname][
"ilias_min_version"];
305 $this->
getPluginData($a_ctype, $a_cname, $a_slot_id, $a_pname);
307 return $this->data[$a_ctype][$a_cname][$a_slot_id][$a_pname][
"ilias_max_version"];
322 public function getId($a_ctype, $a_cname, $a_slot_id, $a_pname)
324 $this->
getPluginData($a_ctype, $a_cname, $a_slot_id, $a_pname);
326 return $this->data[$a_ctype][$a_cname][$a_slot_id][$a_pname][
"id"];
340 public function isActive($a_ctype, $a_cname, $a_slot_id, $a_pname)
343 $this->
getPluginData($a_ctype, $a_cname, $a_slot_id, $a_pname);
348 return (
bool) $this->data[$a_ctype][$a_cname][$a_slot_id][$a_pname][
"is_active"];
363 public function exists($a_ctype, $a_cname, $a_slot_id, $a_pname)
365 $this->
getPluginData($a_ctype, $a_cname, $a_slot_id, $a_pname);
367 return isset($this->data[$a_ctype][$a_cname][$a_slot_id][$a_pname]);
382 public function needsUpdate($a_ctype, $a_cname, $a_slot_id, $a_pname)
384 $this->
getPluginData($a_ctype, $a_cname, $a_slot_id, $a_pname);
386 return (
bool) $this->data[$a_ctype][$a_cname][$a_slot_id][$a_pname][
"needs_update"];
401 public function getAllData($a_ctype, $a_cname, $a_slot_id, $a_pname)
403 $this->
getPluginData($a_ctype, $a_cname, $a_slot_id, $a_pname);
405 return $this->data[$a_ctype][$a_cname][$a_slot_id][$a_pname];
421 if (!isset(self::$active_plugins[$a_ctype][$a_cname][$a_slot_id])) {
422 self::$active_plugins[$a_ctype][$a_cname][$a_slot_id]
426 return self::$active_plugins[$a_ctype][$a_cname][$a_slot_id];
443 if (!isset(self::$plugin_objects[$a_ctype][$a_cname][$a_slot_id][$a_pname])) {
444 self::$plugin_objects[$a_ctype][$a_cname][$a_slot_id][$a_pname]
448 return self::$plugin_objects[$a_ctype][$a_cname][$a_slot_id][$a_pname];
464 public static function includeClass($a_ctype, $a_cname, $a_slot_id, $a_pname, $a_class_file_name)
467 if (!isset(self::$plugin_objects[$a_ctype][$a_cname][$a_slot_id][$a_pname])) {
468 self::$plugin_objects[$a_ctype][$a_cname][$a_slot_id][$a_pname]
474 $pl = self::$plugin_objects[$a_ctype][$a_cname][$a_slot_id][$a_pname];
475 $pl->includeClass($a_class_file_name);
492 $this->
getPluginData($a_ctype, $a_cname, $a_slot_id, $a_pname);
494 return $this->data[$a_ctype][$a_cname][$a_slot_id][$a_pname][
"learning_progress"];
511 $this->
getPluginData($a_ctype, $a_cname, $a_slot_id, $a_pname);
513 return $this->data[$a_ctype][$a_cname][$a_slot_id][$a_pname][
"supports_export"];
525 if (!isset($all_plugins)) {
527 $all_plugins = $cached_component->getIlPluginById();
544 $plugins = $cached_component->getIlPluginActive();
546 foreach ($plugins as $slot => $plugs) {
566 assert(is_string($id));
568 $plugs = $cached_component->getIlPluginById();
569 if (array_key_exists($id, $plugs) && $plugs[$id][
'active']) {
587 assert(is_string($id));
588 $plugs = self::getAllPlugins();
589 if (!array_key_exists($id, $plugs)) {
590 throw new \InvalidArgumentException(
"Plugin does not exist: " . $id, 1);
592 $pdata = $plugs[$id];
594 return self::getPluginObject(
595 $pdata[
'component_type'],
596 $pdata[
'component_name'],
609 $providers = array();
611 foreach (self::getActivePlugins() as
$plugin) {
612 $pl = self::getPluginObjectById($plugin[
'plugin_id']);
613 if ($pl->isActive()) {
614 array_push($providers, $pl->promoteGlobalScreenProvider());
625 public static function getGlobalScreenProviderCollections() :
Generator 630 foreach (self::getActivePlugins() as
$plugin) {
631 $pl = self::getPluginObjectById($plugin[
'plugin_id']);
632 if ($pl->isActive()) {
633 yield $pl->getGlobalScreenProviderCollection();
getVersion($a_ctype, $a_cname, $a_slot_id, $a_pname)
Get version of plugin.
static getPluginObject(string $a_ctype, string $a_cname, string $a_slot_id, string $a_pname)
__construct()
ilPluginAdmin constructor.
static getAllGlobalScreenProviders()
const ILIAS_VERSION_NUMERIC
static isVersionGreaterString($a_ver1, $a_ver2)
isActive($a_ctype, $a_cname, $a_slot_id, $a_pname)
Checks whether plugin is active (include version checks)
static getActivePluginsForSlot($a_ctype, $a_cname, $a_slot_id)
Get all active plugins for a slot.
static isPluginActive($id)
Check, if a plugin is active.
getIliasMaxVersion($a_ctype, $a_cname, $a_slot_id, $a_pname)
Get Ilias Max Version.
parsePluginPhp($plugin_php_file)
Get informations from plugin php file.
setMustInstall(array &$plugin_data)
Set plugin data for intall.
static lookupSlotName($a_ctype, $a_cname, $a_slot_id)
Lookup slot name for component and slot id.
needsUpdate($a_ctype, $a_cname, $a_slot_id, $a_pname)
Get version.
static getActivePlugins()
Get info for all active plugins.
static getPluginRecord(string $a_ctype, string $a_cname, string $a_slot_id, string $a_pname)
exists($a_ctype, $a_cname, $a_slot_id, $a_pname)
Checks whether plugin exists.
pluginSupportCurrentILIAS(array &$plugin_data)
Plugin supports current ILIAS.
getAllData($a_ctype, $a_cname, $a_slot_id, $a_pname)
Get all data from file in an array.
supportsExport($a_ctype, $a_cname, $a_slot_id, $a_pname)
Checks whether plugin supports export/import.
getPluginData($a_ctype, $a_cname, $a_slot_id, $a_pname)
Get basic data of plugin from plugin.php.
Administration class for plugins.
static getActivePluginsForSlot(string $a_ctype, string $a_cname, string $a_slot_id)
updateRequired(array &$plugin_data, $last_update_version)
Should the plugin be updated.
static getPluginObject($a_ctype, $a_cname, $a_slot_id, $a_pname)
Get Plugin Object.
static getAllPlugins()
Get info for all plugins.
hasLearningProgress($a_ctype, $a_cname, $a_slot_id, $a_pname)
Checks whether plugin has active learning progress.
static getPluginObjectById($id)
Get a plugin-object by id.
getIliasMinVersion($a_ctype, $a_cname, $a_slot_id, $a_pname)
Get Ilias Min Version.
getId($a_ctype, $a_cname, $a_slot_id, $a_pname)
Get ID.
setCurrentState(array &$plugin_data, $active)
Set current state to static values, excluding active and activatoin possible.