ILIAS  release_7 Revision v7.30-3-g800a261c036
ilPluginAdmin Class Reference

Administration class for plugins. More...

+ Collaboration diagram for ilPluginAdmin:

Public Member Functions

 __construct ()
 ilPluginAdmin 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...
 
 getRawPluginDataFor (string $name)
 
 clearCachedData ()
 

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 getAllPlugins ()
 Get info for all plugins. More...
 
static getActivePlugins ()
 Get info for all active plugins. More...
 
static isPluginActive ($id)
 Check, if a plugin is active. More...
 
static getPluginObjectById ($id)
 Get a plugin-object by id. More...
 
static getAllGlobalScreenProviders ()
 

Static Public Attributes

static $active_plugins = array()
 

Protected Member Functions

 pluginSupportCurrentILIAS (array &$plugin_data)
 Plugin supports current ILIAS. More...
 
 updateRequired (array &$plugin_data, $last_update_version)
 Should the plugin be updated. More...
 
 setMustInstall (array &$plugin_data)
 Set plugin data for intall. More...
 
 setCurrentState (array &$plugin_data, $active)
 Set current state to static values, excluding active and activatoin possible. More...
 
 parsePluginPhp ($plugin_php_file)
 Get informations from plugin php file. More...
 
 getPluginSlots (array $components, string $type)
 
 getComponentSlotsByType (array $components, string $type)
 

Protected Attributes

 $data
 
 $got_data = false
 
 $lng
 

Static Protected Attributes

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.

This class currently needs refactoring. There are a lot of methods which are related to some specific slots.

Author
Alex Killing alex..nosp@m.kill.nosp@m.ing@g.nosp@m.mx.d.nosp@m.e
Fabian Schmid fs@st.nosp@m.uder.nosp@m.-raim.nosp@m.ann..nosp@m.ch

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

Constructor & Destructor Documentation

◆ __construct()

ilPluginAdmin::__construct ( )

ilPluginAdmin constructor.

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

References $DIC.

50  {
51  global $DIC;
52  $this->lng = $DIC->language();
53  $this->lng->loadLanguageModule("cmps");
54  }
global $DIC
Definition: goto.php:24

Member Function Documentation

◆ clearCachedData()

ilPluginAdmin::clearCachedData ( )
final

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

References ilCachedComponentData\flush().

Referenced by getRawPluginDataFor().

682  {
683  unset($this->data);
684  unset($this->got_data);
686  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ 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
Returns
bool
Exceptions
ilPluginException

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

References getPluginData().

364  {
365  $this->getPluginData($a_ctype, $a_cname, $a_slot_id, $a_pname);
366 
367  return isset($this->data[$a_ctype][$a_cname][$a_slot_id][$a_pname]);
368  }
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:

◆ getActivePlugins()

static ilPluginAdmin::getActivePlugins ( )
static

Get info for all active plugins.

Returns
array

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

References $active_plugins, and ilCachedComponentData\getInstance().

Referenced by ilAppEventHandler\initListeners(), and ilInitialisation\initUIFramework().

539  {
540  static $active_plugins;
541  if (!isset($active_plugins)) {
542  $cached_component = ilCachedComponentData::getInstance();
543  $plugins = $cached_component->getIlPluginActive();
544  $buf = array();
545  foreach ($plugins as $slot => $plugs) {
546  $buf[] = $plugs;
547  }
548 
549  $active_plugins = array_merge([], ...$buf);
550  }
551 
552  return $active_plugins;
553  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getActivePluginsForSlot()

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

Get all active plugins for a slot.

Parameters
string$a_ctype
string$a_cname
string$a_slot_id
Returns
array

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

References ilPlugin\getActivePluginsForSlot().

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

419  {
420  // cache the list of active plugins
421  if (!isset(self::$active_plugins[$a_ctype][$a_cname][$a_slot_id])) {
422  self::$active_plugins[$a_ctype][$a_cname][$a_slot_id]
423  = ilPlugin::getActivePluginsForSlot($a_ctype, $a_cname, $a_slot_id);
424  }
425 
426  return self::$active_plugins[$a_ctype][$a_cname][$a_slot_id];
427  }
static getActivePluginsForSlot(string $a_ctype, string $a_cname, string $a_slot_id)
+ 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
Returns
array
Exceptions
ilPluginException

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

References getPluginData().

402  {
403  $this->getPluginData($a_ctype, $a_cname, $a_slot_id, $a_pname);
404 
405  return $this->data[$a_ctype][$a_cname][$a_slot_id][$a_pname];
406  }
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:

◆ getAllGlobalScreenProviders()

static ilPluginAdmin::getAllGlobalScreenProviders ( )
static
Deprecated:
Returns
[]

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

References XapiProxy\$plugin.

Referenced by ilGSProviderFactory\appendPlugins().

606  : array
607  {
608  $providers = array();
609  // return array(); // current fix
610  foreach (self::getActivePlugins() as $plugin) {
611  $pl = self::getPluginObjectById($plugin['plugin_id']);
612  if ($pl->isActive()) {
613  array_push($providers, $pl->promoteGlobalScreenProvider());
614  }
615  }
616 
617  return $providers;
618  }
+ Here is the caller graph for this function:

◆ getAllPlugins()

static ilPluginAdmin::getAllPlugins ( )
static

Get info for all plugins.

Returns
array<string, array>

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

References ilCachedComponentData\getInstance().

522  {
523  static $all_plugins;
524  if (!isset($all_plugins)) {
525  $cached_component = ilCachedComponentData::getInstance();
526  $all_plugins = $cached_component->getIlPluginById();
527  }
528 
529  return $all_plugins;
530  }
+ Here is the call graph for this function:

◆ getComponentSlotsByType()

ilPluginAdmin::getComponentSlotsByType ( array  $components,
string  $type 
)
protected

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

References ilComponent\lookupPluginSlots().

Referenced by getPluginSlots().

669  : \Iterator
670  {
671  foreach ($components as $component) {
672  $component_slots = ilComponent::lookupPluginSlots($type, $component["subdir"]);
673  foreach ($component_slots as $component_slot) {
674  if (count($component_slot) > 0) {
675  yield $component_slot;
676  }
677  }
678  }
679  }
$type
static lookupPluginSlots($a_type, $a_name)
Lookup all plugin slots of a component.
+ Here is the call graph for this function:
+ Here is the caller 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
Returns
string
Exceptions
ilPluginException

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

References getPluginData().

323  {
324  $this->getPluginData($a_ctype, $a_cname, $a_slot_id, $a_pname);
325 
326  return $this->data[$a_ctype][$a_cname][$a_slot_id][$a_pname]["id"];
327  }
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
Returns
string
Exceptions
ilPluginException

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

References getPluginData().

304  {
305  $this->getPluginData($a_ctype, $a_cname, $a_slot_id, $a_pname);
306 
307  return $this->data[$a_ctype][$a_cname][$a_slot_id][$a_pname]["ilias_max_version"];
308  }
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
Returns
string
Exceptions
ilPluginException

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

References getPluginData().

285  {
286  $this->getPluginData($a_ctype, $a_cname, $a_slot_id, $a_pname);
287 
288  return $this->data[$a_ctype][$a_cname][$a_slot_id][$a_pname]["ilias_min_version"];
289  }
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 
)
private

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
Exceptions
ilPluginException

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

References ilPlugin\getPluginRecord(), ilPluginSlot\lookupSlotName(), parsePluginPhp(), pluginSupportCurrentILIAS(), setCurrentState(), setMustInstall(), and updateRequired().

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

68  {
69  if (!isset($this->got_data[$a_ctype][$a_cname][$a_slot_id][$a_pname])) {
70  $slot_name = ilPluginSlot::lookupSlotName($a_ctype, $a_cname, $a_slot_id);
71 
72  $plugin_php_file = "./Customizing/global/plugins/" . $a_ctype . "/" . $a_cname . "/" . $slot_name . "/" . $a_pname . "/plugin.php";
73 
74  if (!is_file($plugin_php_file)) {
75  throw new ilPluginException("No plugin.php file found for Plugin :" . $a_pname . ".");
76  }
77  $plugin_db_data = ilPlugin::getPluginRecord($a_ctype, $a_cname, $a_slot_id, $a_pname);
78  $plugin_data = $this->parsePluginPhp($plugin_php_file);
79 
80  if ($plugin_db_data["plugin_id"] === null) {
81  $this->setMustInstall($plugin_data);
82  } else {
83  $this->setCurrentState($plugin_data, (bool) $plugin_db_data["active"]);
84  if ($this->pluginSupportCurrentILIAS($plugin_data)) {
85  $this->updateRequired($plugin_data, $plugin_db_data["last_update_version"]);
86  }
87  }
88 
89  $this->data[$a_ctype][$a_cname][$a_slot_id][$a_pname] = $plugin_data;
90  $this->got_data[$a_ctype][$a_cname][$a_slot_id][$a_pname] = true;
91  }
92  }
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.
static getPluginRecord(string $a_ctype, string $a_cname, string $a_slot_id, string $a_pname)
pluginSupportCurrentILIAS(array &$plugin_data)
Plugin supports current ILIAS.
updateRequired(array &$plugin_data, $last_update_version)
Should the plugin be updated.
setCurrentState(array &$plugin_data, $active)
Set current state to static values, excluding active and activatoin possible.
+ 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 440 of file class.ilPluginAdmin.php.

References ilPlugin\getPluginObject().

Referenced by ilSoapHook\__construct(), ilTestSignatureGUI\__construct(), ilTabsGUI\__getHTML(), ilStartUpGUI\_checkGoto(), ilTemplate\addBlockFile(), ilDclPluginFieldRepresentation\buildFieldCreationInput(), ilObjComponentSettingsGUI\executeCommand(), ilTemplate\get(), ilContainerGUI\getAsynchItemListObject(), ilAppEventHandler\initListeners(), ilInitialisation\initStyle(), ilInitialisation\initUIFramework(), ilRendererFactory\loadAvailableRenderers(), ilTemplate\loadTemplatefile(), ilCOPageGlobalTemplate\printToStdout(), ilRTEGlobalTemplate\printToStdout(), ilDataCollectionGlobalTemplate\printToStdout(), ilCtrl\redirectToURL(), ILIAS\ResourceStorage\Services\UICore\MetaTemplate\PageContentGUI\renderPage(), ilGlobalTemplate\renderPage(), and ilObjContentObjectGUI\setilLMMenu().

441  {
442  // cache the plugin objects
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]
445  = ilPlugin::getPluginObject($a_ctype, $a_cname, $a_slot_id, $a_pname);
446  }
447 
448  return self::$plugin_objects[$a_ctype][$a_cname][$a_slot_id][$a_pname];
449  }
static getPluginObject(string $a_ctype, string $a_cname, string $a_slot_id, string $a_pname)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getPluginObjectById()

static ilPluginAdmin::getPluginObjectById (   $id)
static

Get a plugin-object by id.

Parameters
string$idid of the plugin
Returns
ilPlugin
Exceptions
InvalidArgumentExceptionif no plugin with that id is found

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

585  {
586  assert(is_string($id));
587  $plugs = self::getAllPlugins();
588  if (!array_key_exists($id, $plugs)) {
589  throw new \InvalidArgumentException("Plugin does not exist: " . $id, 1);
590  }
591  $pdata = $plugs[$id];
592 
593  return self::getPluginObject(
594  $pdata['component_type'],
595  $pdata['component_name'],
596  $pdata['slot_id'],
597  $pdata['name']
598  );
599  }

◆ getPluginSlots()

ilPluginAdmin::getPluginSlots ( array  $components,
string  $type 
)
protected

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

References getComponentSlotsByType().

Referenced by getRawPluginDataFor().

661  : \Iterator
662  {
663  foreach ($this->getComponentSlotsByType($components, $type) as $slot) {
664  $subdir = (explode('/', $slot['component']))[1];
665  yield new ilPluginSlot($type, $subdir, $slot['id']);
666  }
667  }
$type
getComponentSlotsByType(array $components, string $type)
Plugin Slot.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getRawPluginDataFor()

ilPluginAdmin::getRawPluginDataFor ( string  $name)

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

References XapiProxy\$plugin, clearCachedData(), ilModule\getAvailableCoreModules(), ilService\getAvailableCoreServices(), getPluginSlots(), IL_COMP_MODULE, and IL_COMP_SERVICE.

637  : ?array
638  {
639  $this->clearCachedData();
640 
643 
644  foreach ($this->getPluginSlots($modules, IL_COMP_MODULE) as $plugin_slot) {
645  $plugin = $plugin_slot->getPluginInformationFor($name);
646  if (!is_null($plugin)) {
647  return $plugin;
648  }
649  }
650 
651  foreach ($this->getPluginSlots($services, IL_COMP_SERVICE) as $plugin_slot) {
652  $plugin = $plugin_slot->getPluginInformationFor($name);
653  if (!is_null($plugin)) {
654  return $plugin;
655  }
656  }
657 
658  return null;
659  }
if($format !==null) $name
Definition: metadata.php:230
static getAvailableCoreServices()
Get all available core services.
const IL_COMP_MODULE
getPluginSlots(array $components, string $type)
const IL_COMP_SERVICE
static getAvailableCoreModules()
Get all available core modules.
+ Here is the call 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
Returns
string
Exceptions
ilPluginException

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

References getPluginData().

266  {
267  $this->getPluginData($a_ctype, $a_cname, $a_slot_id, $a_pname);
268 
269  return $this->data[$a_ctype][$a_cname][$a_slot_id][$a_pname]["version"];
270  }
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
Exceptions
ilPluginException

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

References getPluginData().

491  {
492  $this->getPluginData($a_ctype, $a_cname, $a_slot_id, $a_pname);
493 
494  return $this->data[$a_ctype][$a_cname][$a_slot_id][$a_pname]["learning_progress"];
495  }
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:

◆ 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
Returns
bool

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

References Vendor\Package\$e, and getPluginData().

341  {
342  try {
343  $this->getPluginData($a_ctype, $a_cname, $a_slot_id, $a_pname);
344  } catch (ilPluginException $e) {
345  return false;
346  }
347 
348  return (bool) $this->data[$a_ctype][$a_cname][$a_slot_id][$a_pname]["is_active"];
349  }
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:

◆ isPluginActive()

static ilPluginAdmin::isPluginActive (   $id)
static

Check, if a plugin is active.

Parameters
string$idid of the plugin
Returns
boolean

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

References ilCachedComponentData\getInstance().

564  {
565  assert(is_string($id));
566  $cached_component = ilCachedComponentData::getInstance();
567  $plugs = $cached_component->getIlPluginById();
568  if (array_key_exists($id, $plugs) && $plugs[$id]['active']) {
569  return true;
570  }
571 
572  return false;
573  }
+ 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
Returns
bool
Exceptions
ilPluginException

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

References getPluginData().

383  {
384  $this->getPluginData($a_ctype, $a_cname, $a_slot_id, $a_pname);
385 
386  return (bool) $this->data[$a_ctype][$a_cname][$a_slot_id][$a_pname]["needs_update"];
387  }
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:

◆ parsePluginPhp()

ilPluginAdmin::parsePluginPhp (   $plugin_php_file)
protected

Get informations from plugin php file.

Parameters
string$plugin_php_file
Returns
string[]

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

Referenced by getPluginData().

235  {
236  include($plugin_php_file);
237 
238  $values = [
239  "version" => $version,
240  "id" => $id,
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 ?? false),
246  "supports_export" => (bool) ($supports_export ?? false),
247  "supports_cli_setup" => (bool) ($supports_cli_setup ?? true)
248  ];
249 
250  return $values;
251  }
+ Here is the caller graph for this function:

◆ pluginSupportCurrentILIAS()

ilPluginAdmin::pluginSupportCurrentILIAS ( array &  $plugin_data)
protected

Plugin supports current ILIAS.

Parameters
string[]&$plugin_data
Returns
bool

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

References ILIAS_VERSION_NUMERIC, and ilComponent\isVersionGreaterString().

Referenced by getPluginData().

103  {
104  if (ilComponent::isVersionGreaterString($plugin_data["ilias_min_version"], ILIAS_VERSION_NUMERIC)) {
105  $plugin_data["is_active"] = false;
106  $plugin_data["needs_update"] = false;
107  $plugin_data["activation_possible"] = false;
108 
109  if ($this->lng instanceof ilLanguage) {
110  $inactive_reason = $this->lng->txt("cmps_needs_newer_ilias_version");
111  } else {
112  $inactive_reason = "Plugin needs a newer version of ILIAS.";
113  }
114  $plugin_data["inactive_reason"] = $inactive_reason;
115 
116  return false;
117  }
118 
119  if (ilComponent::isVersionGreaterString(ILIAS_VERSION_NUMERIC, $plugin_data["ilias_max_version"])) {
120  $plugin_data["is_active"] = false;
121  $plugin_data["needs_update"] = false;
122  $plugin_data["activation_possible"] = false;
123  if ($this->lng instanceof ilLanguage) {
124  $inactive_reason = $this->lng->txt("cmps_needs_newer_plugin_version");
125  } else {
126  $inactive_reason = "Plugin does not support current version of ILIAS. Newer version of plugin needed.";
127  }
128  $plugin_data["inactive_reason"] = $inactive_reason;
129 
130  return false;
131  }
132 
133  return true;
134  }
const ILIAS_VERSION_NUMERIC
static isVersionGreaterString($a_ver1, $a_ver2)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setCurrentState()

ilPluginAdmin::setCurrentState ( array &  $plugin_data,
  $active 
)
protected

Set current state to static values, excluding active and activatoin possible.

There will be set from db value $active

Parameters
string[]&$plugin_data
bool$active
Returns
void

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

Referenced by getPluginData().

218  {
219  $plugin_data["is_active"] = $active;
220  $plugin_data["activation_possible"] = !$active;
221  $plugin_data["must_install"] = false;
222  $plugin_data["needs_update"] = false;
223  $plugin_data["inactive_reason"] = "";
224  }
+ Here is the caller graph for this function:

◆ setMustInstall()

ilPluginAdmin::setMustInstall ( array &  $plugin_data)
protected

Set plugin data for intall.

Parameters
string[]&$plugin_data
Returns
void

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

Referenced by getPluginData().

192  {
193  $plugin_data["must_install"] = true;
194  $plugin_data["is_active"] = false;
195  $plugin_data["needs_update"] = false;
196  $plugin_data["activation_possible"] = false;
197 
198  if ($this->lng instanceof ilLanguage) {
199  $inactive_reason = $this->lng->txt("cmps_must_installed");
200  } else {
201  $inactive_reason = "Plugin must be installed.";
202  }
203  $plugin_data["inactive_reason"] = $inactive_reason;
204  }
+ Here is the caller 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
Exceptions
ilPluginException

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

References getPluginData().

510  {
511  $this->getPluginData($a_ctype, $a_cname, $a_slot_id, $a_pname);
512 
513  return $this->data[$a_ctype][$a_cname][$a_slot_id][$a_pname]["supports_export"];
514  }
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:

◆ updateRequired()

ilPluginAdmin::updateRequired ( array &  $plugin_data,
  $last_update_version 
)
protected

Should the plugin be updated.

Parameters
string[]&$plugin_data
string$last_update_version
Returns
void

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

References ilComponent\isVersionGreaterString().

Referenced by getPluginData().

146  {
147  if ($last_update_version == "") {
148  $plugin_data["is_active"] = false;
149  if ($this->lng instanceof ilLanguage) {
150  $inactive_reason = $this->lng->txt("cmps_needs_update");
151  } else {
152  $inactive_reason = "Update needed.";
153  }
154  $plugin_data["inactive_reason"] = $inactive_reason;
155  $plugin_data["needs_update"] = true;
156  $plugin_data["activation_possible"] = false;
157  } else {
158  if (ilComponent::isVersionGreaterString($last_update_version, $plugin_data["version"])) {
159  $plugin_data["is_active"] = false;
160  if ($this->lng instanceof ilLanguage) {
161  $inactive_reason = $this->lng->txt("cmps_needs_upgrade");
162  } else {
163  $inactive_reason = "Upgrade needed.";
164  }
165  $plugin_data["inactive_reason"] = $inactive_reason;
166  $plugin_data["activation_possible"] = false;
167  } else {
168  if ($last_update_version != $plugin_data["version"]) {
169  $plugin_data["is_active"] = false;
170  if ($this->lng instanceof ilLanguage) {
171  $inactive_reason = $this->lng->txt("cmps_needs_update");
172  } else {
173  $inactive_reason = "Update needed.";
174  }
175  $plugin_data["inactive_reason"] = $inactive_reason;
176  $plugin_data["needs_update"] = true;
177  $plugin_data["activation_possible"] = false;
178  }
179  }
180  }
181  }
static isVersionGreaterString($a_ver1, $a_ver2)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ $active_plugins

ilPluginAdmin::$active_plugins = array()
static

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

Referenced by getActivePlugins().

◆ $data

ilPluginAdmin::$data
protected

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

◆ $got_data

ilPluginAdmin::$got_data = false
protected

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

◆ $lng

ilPluginAdmin::$lng
protected

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

◆ $plugin_objects

ilPluginAdmin::$plugin_objects = array()
staticprotected

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


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