5 include_once(
"./Services/Component/classes/class.ilComponent.php");
52 $this->lng = $DIC->language();
53 $this->lng->loadLanguageModule(
"cmps");
67 final 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);
241 "ilias_min_version" => $ilias_min_version,
242 "ilias_max_version" => $ilias_max_version,
243 "responsible" => $responsible,
244 "responsible_mail" => $responsible_mail,
245 "learning_progress" => (bool) $learning_progress,
246 "supports_export" => (
bool) $supports_export];
263 public function getVersion($a_ctype, $a_cname, $a_slot_id, $a_pname)
265 $this->
getPluginData($a_ctype, $a_cname, $a_slot_id, $a_pname);
267 return $this->
data[$a_ctype][$a_cname][$a_slot_id][$a_pname][
"version"];
284 $this->
getPluginData($a_ctype, $a_cname, $a_slot_id, $a_pname);
286 return $this->
data[$a_ctype][$a_cname][$a_slot_id][$a_pname][
"ilias_min_version"];
303 $this->
getPluginData($a_ctype, $a_cname, $a_slot_id, $a_pname);
305 return $this->
data[$a_ctype][$a_cname][$a_slot_id][$a_pname][
"ilias_max_version"];
320 public function getId($a_ctype, $a_cname, $a_slot_id, $a_pname)
322 $this->
getPluginData($a_ctype, $a_cname, $a_slot_id, $a_pname);
324 return $this->
data[$a_ctype][$a_cname][$a_slot_id][$a_pname][
"id"];
338 public function isActive($a_ctype, $a_cname, $a_slot_id, $a_pname)
341 $this->
getPluginData($a_ctype, $a_cname, $a_slot_id, $a_pname);
346 return (
bool) $this->
data[$a_ctype][$a_cname][$a_slot_id][$a_pname][
"is_active"];
361 public function exists($a_ctype, $a_cname, $a_slot_id, $a_pname)
363 $this->
getPluginData($a_ctype, $a_cname, $a_slot_id, $a_pname);
365 return isset($this->
data[$a_ctype][$a_cname][$a_slot_id][$a_pname]);
380 public function needsUpdate($a_ctype, $a_cname, $a_slot_id, $a_pname)
382 $this->
getPluginData($a_ctype, $a_cname, $a_slot_id, $a_pname);
384 return (
bool) $this->
data[$a_ctype][$a_cname][$a_slot_id][$a_pname][
"needs_update"];
399 public function getAllData($a_ctype, $a_cname, $a_slot_id, $a_pname)
401 $this->
getPluginData($a_ctype, $a_cname, $a_slot_id, $a_pname);
403 return $this->
data[$a_ctype][$a_cname][$a_slot_id][$a_pname];
419 if (!isset(self::$active_plugins[$a_ctype][$a_cname][$a_slot_id])) {
420 self::$active_plugins[$a_ctype][$a_cname][$a_slot_id]
424 return self::$active_plugins[$a_ctype][$a_cname][$a_slot_id];
441 if (!isset(self::$plugin_objects[$a_ctype][$a_cname][$a_slot_id][$a_pname])) {
442 self::$plugin_objects[$a_ctype][$a_cname][$a_slot_id][$a_pname]
446 return self::$plugin_objects[$a_ctype][$a_cname][$a_slot_id][$a_pname];
462 public static function includeClass($a_ctype, $a_cname, $a_slot_id, $a_pname, $a_class_file_name)
465 if (!isset(self::$plugin_objects[$a_ctype][$a_cname][$a_slot_id][$a_pname])) {
466 self::$plugin_objects[$a_ctype][$a_cname][$a_slot_id][$a_pname]
472 $pl = self::$plugin_objects[$a_ctype][$a_cname][$a_slot_id][$a_pname];
473 $pl->includeClass($a_class_file_name);
490 $this->
getPluginData($a_ctype, $a_cname, $a_slot_id, $a_pname);
492 return $this->
data[$a_ctype][$a_cname][$a_slot_id][$a_pname][
"learning_progress"];
509 $this->
getPluginData($a_ctype, $a_cname, $a_slot_id, $a_pname);
511 return $this->
data[$a_ctype][$a_cname][$a_slot_id][$a_pname][
"supports_export"];
524 return $cached_component->getIlPluginById();
536 $plugins = $cached_component->getIlPluginActive();
538 foreach ($plugins as $slot => $plugs) {
539 $buf = array_merge($buf, $plugs);
555 assert(is_string(
$id));
557 $plugs = $cached_component->getIlPluginById();
558 if (array_key_exists(
$id, $plugs) && $plugs[
$id][
'active']) {
576 assert(is_string(
$id));
577 $plugs = self::getAllPlugins();
578 if (!array_key_exists(
$id, $plugs)) {
579 throw new \InvalidArgumentException(
"Plugin does not exist: " .
$id, 1);
581 $pdata = $plugs[
$id];
583 return self::getPluginObject(
584 $pdata[
'component_type'],
585 $pdata[
'component_name'],
597 $providers = array();
598 foreach (self::getActivePlugins() as $plugin) {
599 $pl = self::getPluginObjectById($plugin[
'plugin_id']);
600 if ($pl instanceof
ilPlugin && $pl->isActive()) {
601 array_push($providers, $pl->promoteGlobalScreenProvider());
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.
if(!array_key_exists('StateId', $_REQUEST)) $id
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.