ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
All Data Structures Namespaces Files Functions Variables Modules Pages
ilPlugin Class Reference

Abstract Class ilPlugin. More...

+ Inheritance diagram for ilPlugin:
+ Collaboration diagram for ilPlugin:

Public Member Functions

 __construct ()
 
 getComponentType ()
 Get Component Type. More...
 
 getComponentName ()
 Get Component Name. More...
 
 getSlot ()
 Get Slot Name. More...
 
 getSlotId ()
 Get Slot ID. More...
 
 getPluginName ()
 Get Plugin Name. More...
 
 getId ()
 
 getLastUpdateVersion ()
 Get Version of last update. More...
 
 getVersion ()
 
 getIliasMinVersion ()
 
 getIliasMaxVersion ()
 Get Required ILIAS max. More...
 
 getActive ()
 
 setDBVersion (int $a_dbversion)
 
 getDBVersion ()
 
 writeDBVersion (int $a_dbversion)
 
 getDirectory ()
 Get Plugin Directory. More...
 
 includeClass ($a_class_file_name)
 Include (once) a class file. More...
 
 getPrefix ()
 Get plugin prefix, used for lang vars. More...
 
 getTablePrefix ()
 Get db table plugin prefix. More...
 
 updateLanguages ($a_lang_keys=null)
 
 updateDatabase ()
 Update database. More...
 
 loadLanguageModule ()
 Load language module for plugin. More...
 
 txt (string $a_var)
 Get Language Variable (prefix will be prepended automatically) More...
 
 getTemplate (string $a_template, bool $a_par1=true, bool $a_par2=true)
 gets a ilTemplate instance of a html-file in the plugin /templates More...
 
 getImagePath (string $a_img)
 Get image path. More...
 
 getStyleSheetLocation (string $a_css_file)
 
 addBlockFile ($a_tpl, $a_var, $a_block, $a_tplname)
 Add template content to placeholder variable. More...
 
 isActive ()
 Check whether plugin is active. More...
 
 needsUpdate ()
 Check whether update is needed. More...
 
 install ()
 
 activate ()
 Activate. More...
 
 deactivate ()
 Deactivate. More...
 
 uninstall ()
 
 update ()
 Update plugin. More...
 
 promoteGlobalScreenProvider ()
 
 getGlobalScreenProviderCollection ()
 
 exchangeUIRendererAfterInitialization (\ILIAS\DI\Container $dic)
 This methods allows to replace the UI Renderer (see src/UI) of ILIAS after initialization by returning a closure returning a custom renderer. More...
 
 exchangeUIFactoryAfterInitialization (string $dic_key, \ILIAS\DI\Container $dic)
 This methods allows to replace some factory for UI Components (see src/UI) of ILIAS after initialization by returning a closure returning a custom factory. More...
 

Static Public Member Functions

static _getDirectory (string $a_ctype, string $a_cname, string $a_slot_id, string $a_pname)
 Get plugin directory. More...
 
static getAvailableLangFiles (string $a_lang_directory)
 Get array of all language files in the plugin. More...
 
static hasConfigureClass (string $a_slot_dir, array $plugin_data, array $plugin_db_data)
 Has the plugin a configure class? More...
 
static getConfigureClassName (array $plugin_data)
 Get plugin configure class name. More...
 
static getDBUpdateScriptName (string $a_ctype, string $a_cname, string $a_slot_name, string $a_pname)
 
static lookupTxt (string $a_mod_prefix, string $a_pl_id, string $a_lang_var)
 
static langExitsById (string $pluginId, string $langVar)
 Is searched lang var available in plugin lang files. More...
 
static _getImagePath (string $a_ctype, string $a_cname, string $a_slot_id, string $a_pname, string $a_img)
 
static createPluginRecord (string $a_ctype, string $a_cname, string $a_slot_id, string $a_pname)
 
static getPluginRecord (string $a_ctype, string $a_cname, string $a_slot_id, string $a_pname)
 
static getPluginObject (string $a_ctype, string $a_cname, string $a_slot_id, string $a_pname)
 
static lookupStoredData (string $a_ctype, string $a_cname, string $a_slot_id, string $a_pname)
 Lookup information data in il_plugin. More...
 
static getActivePluginsForSlot (string $a_ctype, string $a_cname, string $a_slot_id)
 
static getActivePluginIdsForSlot (string $a_ctype, string $a_cname, string $a_slot_id)
 Get All active plugin ids for a slot. More...
 
static lookupNameForId (string $a_ctype, string $a_cname, string $a_slot_id, string $a_plugin_id)
 
static lookupIdForName (string $a_ctype, string $a_cname, string $a_slot_id, string $a_plugin_name)
 
static lookupTypeInformationsForId (string $id)
 

Protected Member Functions

 setSlotObject (ilPluginSlot $a_slot)
 
 getSlotObject ()
 
 getClassesDirectory ()
 
 getLanguageDirectory ()
 
 slotInit ()
 Object initialization done by slot. More...
 
 init ()
 Object initialization. More...
 
 afterInstall ()
 After install processing. More...
 
 beforeActivation ()
 Before activation processing. More...
 
 afterActivation ()
 After activation processing. More...
 
 afterDeactivation ()
 After deactivation processing. More...
 
 beforeUninstall ()
 
 afterUninstall ()
 This is Plugin-Specific and is triggered after the uninstall command of a plugin. More...
 
 readEventListening ()
 Read the event listening definitions from the plugin.xml (if file exists) More...
 
 clearEventListening ()
 Clear the entries of this plugin in the event handling table. More...
 
 beforeUpdate ()
 Before update processing. More...
 
 afterUpdate ()
 After update processing. More...
 

Protected Attributes

 $slot
 
 $active = false
 
 $iliasmaxversion = ""
 
 $iliasminversion = ""
 
 $version = ""
 
 $lastupdateversion = ""
 
 $dbversion = 0
 
 $lang_initialised = false
 
 $id = ''
 
 $provider_collection
 

Private Member Functions

 setId ($a_id)
 Set Id. More...
 
 setLastUpdateVersion (string $a_lastupdateversion)
 Set Version of last update. More...
 
 setVersion (string $a_version)
 
 setIliasMinVersion (string $a_iliasminversion)
 
 setIliasMaxVersion (string $a_iliasmaxversion)
 
 setActive (bool $a_active)
 
 __init ()
 Default initialization. More...
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilPlugin::__construct ( )

Definition at line 59 of file class.ilPlugin.php.

References __init(), getComponentName(), getComponentType(), getPluginName(), getSlot(), and getSlotId().

60  {
61  $this->__init();
62  $this->provider_collection = new PluginProviderCollection();
63  }
__init()
Default initialization.
+ Here is the call graph for this function:

Member Function Documentation

◆ __init()

ilPlugin::__init ( )
private

Default initialization.

Definition at line 743 of file class.ilPlugin.php.

References $DIC, getComponentName(), getComponentType(), getPluginName(), getPluginRecord(), getSlotId(), init(), loadLanguageModule(), setActive(), setDBVersion(), setId(), setIliasMaxVersion(), setIliasMinVersion(), setLastUpdateVersion(), setSlotObject(), setVersion(), and slotInit().

Referenced by __construct().

744  {
745  global $DIC;
746  $ilPluginAdmin = $DIC['ilPluginAdmin'];
747 
748  // read/set basic data
750  $this->getComponentType(),
751  $this->getComponentName(),
752  $this->getSlotId(),
753  $this->getPluginName()
754  );
755  $this->setLastUpdateVersion((string) $rec["last_update_version"]);
756  $this->setDBVersion((int) $rec["db_version"]);
757  $this->setActive((bool) $rec["active"]);
758 
759  // get id
760  $this->setId(
761  $ilPluginAdmin->getId(
762  $this->getComponentType(),
763  $this->getComponentName(),
764  $this->getSlotId(),
765  $this->getPluginName()
766  )
767  );
768 
769  // get version
770  $this->setVersion(
771  $ilPluginAdmin->getVersion(
772  $this->getComponentType(),
773  $this->getComponentName(),
774  $this->getSlotId(),
775  $this->getPluginName()
776  )
777  );
778 
779  // get ilias min version
780  $this->setIliasMinVersion(
781  $ilPluginAdmin->getIliasMinVersion(
782  $this->getComponentType(),
783  $this->getComponentName(),
784  $this->getSlotId(),
785  $this->getPluginName()
786  )
787  );
788 
789  // get ilias max version
790  $this->setIliasMaxVersion(
791  $ilPluginAdmin->getIliasMaxVersion(
792  $this->getComponentType(),
793  $this->getComponentName(),
794  $this->getSlotId(),
795  $this->getPluginName()
796  )
797  );
798 
799  // get slot object
800  $this->setSlotObject(
801  new ilPluginSlot(
802  $this->getComponentType(),
803  $this->getComponentName(),
804  $this->getSlotId()
805  )
806  );
807 
808  // load language module
809 
810  // Fix for authentication plugins
811  $this->loadLanguageModule();
812 
813  // call slot and plugin init methods
814  $this->slotInit();
815  $this->init();
816  }
loadLanguageModule()
Load language module for plugin.
setActive(bool $a_active)
setId($a_id)
Set Id.
static getPluginRecord(string $a_ctype, string $a_cname, string $a_slot_id, string $a_pname)
getComponentName()
Get Component Name.
getComponentType()
Get Component Type.
init()
Object initialization.
setDBVersion(int $a_dbversion)
Plugin Slot.
setIliasMinVersion(string $a_iliasminversion)
setIliasMaxVersion(string $a_iliasmaxversion)
setSlotObject(ilPluginSlot $a_slot)
getSlotId()
Get Slot ID.
slotInit()
Object initialization done by slot.
getPluginName()
Get Plugin Name.
$DIC
Definition: xapitoken.php:46
setLastUpdateVersion(string $a_lastupdateversion)
Set Version of last update.
setVersion(string $a_version)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _getDirectory()

static ilPlugin::_getDirectory ( string  $a_ctype,
string  $a_cname,
string  $a_slot_id,
string  $a_pname 
)
static

Get plugin directory.

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

References ilPluginSlot\_getPluginsDirectory().

Referenced by _getImagePath(), and ilObjectDefinition\parsePluginData().

303  : string
304  {
305  return ilPluginSlot::_getPluginsDirectory($a_ctype, $a_cname, $a_slot_id) . "/" . $a_pname;
306  }
static _getPluginsDirectory($a_ctype, $a_cname, $a_slot_id)
Get plugins directory.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _getImagePath()

static ilPlugin::_getImagePath ( string  $a_ctype,
string  $a_cname,
string  $a_slot_id,
string  $a_pname,
string  $a_img 
)
static
Parameters
string$a_ctype
string$a_cname
string$a_slot_id
string$a_pname
string$a_img
Returns
string

Definition at line 630 of file class.ilPlugin.php.

References $d, $img, _getDirectory(), ilUtil\getImagePath(), ilComponent\lookupId(), and lookupIdForName().

Referenced by ilOrgUnitExtensionPlugin\_getIcon(), and ilRepositoryObjectPlugin\_getIcon().

630  : string
631  {
632  $d2 = ilComponent::lookupId($a_ctype, $a_cname) . "_" . $a_slot_id . "_" .
633  ilPlugin::lookupIdForName($a_ctype, $a_cname, $a_slot_id, $a_pname);
634 
635  $img = ilUtil::getImagePath($d2 . "/" . $a_img);
636  if (is_int(strpos($img, "Customizing"))) {
637  return $img;
638  }
639 
640  $d = ilPlugin::_getDirectory($a_ctype, $a_cname, $a_slot_id, $a_pname);
641 
642  return $d . "/templates/images/" . $a_img;
643  }
static lookupId($a_type, $a_name)
Lookup ID of a component.
static lookupIdForName(string $a_ctype, string $a_cname, string $a_slot_id, string $a_plugin_name)
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
static _getDirectory(string $a_ctype, string $a_cname, string $a_slot_id, string $a_pname)
Get plugin directory.
for($i=6; $i< 13; $i++) for($i=1; $i< 13; $i++) $d
Definition: date.php:296
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ activate()

ilPlugin::activate ( )

Activate.

Definition at line 891 of file class.ilPlugin.php.

References $DIC, $ilDB, $result, afterActivation(), beforeActivation(), ilCachedComponentData\flush(), getComponentName(), getComponentType(), getPluginName(), getSlotId(), needsUpdate(), and update().

892  {
893  global $DIC;
894  $ilDB = $DIC->database();
895 
897 
898  $result = true;
899 
900  // check whether update is necessary
901  if ($this->needsUpdate()) {
902  //$result = $this->isUpdatePossible();
903 
904  // do update
905  if ($result === true) {
906  $result = $this->update();
907  }
908  }
909  if ($result === true) {
910  $result = $this->beforeActivation();
911  // activate plugin
912  if ($result === true) {
913  $q = "UPDATE il_plugin SET active = " . $ilDB->quote(1, "integer") .
914  " WHERE component_type = " . $ilDB->quote($this->getComponentType(), "text") .
915  " AND component_name = " . $ilDB->quote($this->getComponentName(), "text") .
916  " AND slot_id = " . $ilDB->quote($this->getSlotId(), "text") .
917  " AND name = " . $ilDB->quote($this->getPluginName(), "text");
918 
919  $ilDB->manipulate($q);
920  $this->afterActivation();
921  }
922  }
924 
925  return $result;
926  }
$result
update()
Update plugin.
needsUpdate()
Check whether update is needed.
getComponentName()
Get Component Name.
beforeActivation()
Before activation processing.
getComponentType()
Get Component Type.
afterActivation()
After activation processing.
getSlotId()
Get Slot ID.
global $ilDB
getPluginName()
Get Plugin Name.
$DIC
Definition: xapitoken.php:46
+ Here is the call graph for this function:

◆ addBlockFile()

ilPlugin::addBlockFile (   $a_tpl,
  $a_var,
  $a_block,
  $a_tplname 
)

Add template content to placeholder variable.

Definition at line 683 of file class.ilPlugin.php.

References getDirectory().

684  {
685  $a_tpl->addBlockFile(
686  $a_var,
687  $a_block,
688  $this->getDirectory() . "/templates/" . $a_tplname
689  );
690  }
getDirectory()
Get Plugin Directory.
+ Here is the call graph for this function:

◆ afterActivation()

ilPlugin::afterActivation ( )
protected

After activation processing.

Definition at line 954 of file class.ilPlugin.php.

Referenced by activate().

955  {
956  }
+ Here is the caller graph for this function:

◆ afterDeactivation()

ilPlugin::afterDeactivation ( )
protected

After deactivation processing.

Definition at line 987 of file class.ilPlugin.php.

Referenced by deactivate().

988  {
989  }
+ Here is the caller graph for this function:

◆ afterInstall()

ilPlugin::afterInstall ( )
protected

After install processing.

Returns
void

Definition at line 934 of file class.ilPlugin.php.

Referenced by install().

935  {
936  }
+ Here is the caller graph for this function:

◆ afterUninstall()

ilPlugin::afterUninstall ( )
protected

This is Plugin-Specific and is triggered after the uninstall command of a plugin.

Definition at line 1048 of file class.ilPlugin.php.

Referenced by uninstall().

1049  {
1050  }
+ Here is the caller graph for this function:

◆ afterUpdate()

ilPlugin::afterUpdate ( )
protected

After update processing.

Definition at line 1160 of file class.ilPlugin.php.

Referenced by update().

1161  {
1162  }
+ Here is the caller graph for this function:

◆ beforeActivation()

ilPlugin::beforeActivation ( )
protected

Before activation processing.

Definition at line 942 of file class.ilPlugin.php.

Referenced by activate().

943  {
944  return true; // false would indicate that anything went wrong
945  // activation would not proceed
946  // throw an exception in this case
947  //throw new ilPluginException($lng->txt(""));
948  }
+ Here is the caller graph for this function:

◆ beforeUninstall()

ilPlugin::beforeUninstall ( )
protected

Definition at line 992 of file class.ilPlugin.php.

Referenced by uninstall().

993  {
994  // plugin-specific
995  // false would indicate that anything went wrong
996  return true;
997  }
+ Here is the caller graph for this function:

◆ beforeUpdate()

ilPlugin::beforeUpdate ( )
protected

Before update processing.

Definition at line 1148 of file class.ilPlugin.php.

Referenced by update().

1149  {
1150  return true; // false would indicate that anything went wrong
1151  // update would not proceed
1152  // throw an exception in this case
1153  //throw new ilPluginException($lng->txt(""));
1154  }
+ Here is the caller graph for this function:

◆ clearEventListening()

ilPlugin::clearEventListening ( )
protected

Clear the entries of this plugin in the event handling table.

Definition at line 1132 of file class.ilPlugin.php.

References $reader, getComponentName(), getComponentType(), getDirectory(), getPluginName(), and getSlotId().

Referenced by uninstall().

1133  {
1134  $reader = new ilPluginReader(
1135  $this->getDirectory() . '/plugin.xml',
1136  $this->getComponentType(),
1137  $this->getComponentName(),
1138  $this->getSlotId(),
1139  $this->getPluginName()
1140  );
1141  $reader->clearEvents();
1142  }
getComponentName()
Get Component Name.
getComponentType()
Get Component Type.
getDirectory()
Get Plugin Directory.
getSlotId()
Get Slot ID.
getPluginName()
Get Plugin Name.
Class ilPluginReader.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ createPluginRecord()

static ilPlugin::createPluginRecord ( string  $a_ctype,
string  $a_cname,
string  $a_slot_id,
string  $a_pname 
)
static
Parameters
$a_ctype
$a_cname
$a_slot_id
$a_pnameCreate plugin record

Definition at line 701 of file class.ilPlugin.php.

References $DIC, $ilDB, and ilCachedComponentData\flush().

Referenced by ilPluginSlot\getPluginsInformation().

702  {
703  global $DIC;
704  $ilDB = $DIC->database();
705 
707 
708  $q = "INSERT INTO il_plugin (component_type, component_name, slot_id, name)" .
709  " VALUES (" . $ilDB->quote($a_ctype, "text") . "," .
710  $ilDB->quote($a_cname, "text") . "," .
711  $ilDB->quote($a_slot_id, "text") . "," .
712  $ilDB->quote($a_pname, "text") . ")";
713 
714  $ilDB->manipulate($q);
715  }
global $ilDB
$DIC
Definition: xapitoken.php:46
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ deactivate()

ilPlugin::deactivate ( )

Deactivate.

Definition at line 962 of file class.ilPlugin.php.

References $DIC, $ilDB, $result, afterDeactivation(), ilCachedComponentData\flush(), getComponentName(), getComponentType(), getPluginName(), and getSlotId().

963  {
964  global $DIC;
965  $ilDB = $DIC->database();
966 
968 
969  $result = true;
970 
971  $q = "UPDATE il_plugin SET active = " . $ilDB->quote(0, "integer") .
972  " WHERE component_type = " . $ilDB->quote($this->getComponentType(), "text") .
973  " AND component_name = " . $ilDB->quote($this->getComponentName(), "text") .
974  " AND slot_id = " . $ilDB->quote($this->getSlotId(), "text") .
975  " AND name = " . $ilDB->quote($this->getPluginName(), "text");
976 
977  $ilDB->manipulate($q);
978  $this->afterDeactivation();
979 
980  return $result;
981  }
$result
getComponentName()
Get Component Name.
getComponentType()
Get Component Type.
getSlotId()
Get Slot ID.
global $ilDB
getPluginName()
Get Plugin Name.
$DIC
Definition: xapitoken.php:46
afterDeactivation()
After deactivation processing.
+ Here is the call graph for this function:

◆ exchangeUIFactoryAfterInitialization()

ilPlugin::exchangeUIFactoryAfterInitialization ( string  $dic_key,
\ILIAS\DI\Container  $dic 
)

This methods allows to replace some factory for UI Components (see src/UI) of ILIAS after initialization by returning a closure returning a custom factory.

E.g:

if($key == "ui.factory.nameOfFactory"){ return function( $c){ return new CustomFactory($c['ui.signal_generator'],$c['ui.factory.maincontrols.slate']); }; }

Note: Note that plugins might conflict by replacing the same factory, so only use if you are sure, that no other plugin will do this for a given context.

Parameters
string$dic_key
\ILIAS\DI\Container$dic
Returns
Closure

Definition at line 1426 of file class.ilPlugin.php.

1426  : Closure
1427  {
1428  //This returns the callable of $c[$key] without executing it.
1429  return $dic->raw($dic_key);
1430  }
$dic
Definition: result.php:13

◆ exchangeUIRendererAfterInitialization()

ilPlugin::exchangeUIRendererAfterInitialization ( \ILIAS\DI\Container  $dic)

This methods allows to replace the UI Renderer (see src/UI) of ILIAS after initialization by returning a closure returning a custom renderer.

E.g:

return function( $c){ return new CustomRenderer(); };

Note: Note that plugins might conflict by replacing the renderer, so only use if you are sure, that no other plugin will do this for a given context.

Parameters
\ILIAS\DI\Container$dic
Returns
Closure

Definition at line 1401 of file class.ilPlugin.php.

1401  : Closure
1402  {
1403  //This returns the callable of $c['ui.renderer'] without executing it.
1404  return $dic->raw('ui.renderer');
1405  }
$dic
Definition: result.php:13

◆ getActive()

ilPlugin::getActive ( )
Returns
bool

Definition at line 227 of file class.ilPlugin.php.

References $active.

227  : bool
228  {
229  return $this->active;
230  }

◆ getActivePluginIdsForSlot()

static ilPlugin::getActivePluginIdsForSlot ( string  $a_ctype,
string  $a_cname,
string  $a_slot_id 
)
static

Get All active plugin ids for a slot.

Parameters
$a_ctype
$a_cname
$a_slot_id
Returns
array

Definition at line 1265 of file class.ilPlugin.php.

References $DIC, and ilCachedComponentData\getInstance().

Referenced by ilOrgUnitExtension\__construct().

1265  : array
1266  {
1267  global $DIC;
1268  $ilPluginAdmin = $DIC['ilPluginAdmin'];
1269 
1270  $plugins = array();
1271  $cached_component = ilCachedComponentData::getInstance();
1272  $lookupActivePluginsBySlotId = $cached_component->lookupActivePluginsBySlotId($a_slot_id);
1273  foreach ($lookupActivePluginsBySlotId as $rec) {
1274  if ($ilPluginAdmin->isActive($a_ctype, $a_cname, $a_slot_id, $rec["name"])) {
1275  $plugins[] = $rec["plugin_id"];
1276  }
1277  }
1278 
1279  return $plugins;
1280  }
$DIC
Definition: xapitoken.php:46
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getActivePluginsForSlot()

static ilPlugin::getActivePluginsForSlot ( string  $a_ctype,
string  $a_cname,
string  $a_slot_id 
)
static
Parameters
string$a_ctype
string$a_cname
string$a_slot_id
Returns
array

Definition at line 1236 of file class.ilPlugin.php.

References $DIC, and ilCachedComponentData\getInstance().

Referenced by ilPluginAdmin\getActivePluginsForSlot().

1236  : array
1237  {
1238  global $DIC;
1239  $ilPluginAdmin = $DIC['ilPluginAdmin'];
1240 
1241  $plugins = array();
1242 
1243  $cached_component = ilCachedComponentData::getInstance();
1244 
1245  $lookupActivePluginsBySlotId = $cached_component->lookupActivePluginsBySlotId($a_slot_id);
1246  foreach ($lookupActivePluginsBySlotId as $rec) {
1247  if ($ilPluginAdmin->isActive($a_ctype, $a_cname, $a_slot_id, $rec["name"])) {
1248  $plugins[] = $rec["name"];
1249  }
1250  }
1251 
1252  return $plugins;
1253  }
$DIC
Definition: xapitoken.php:46
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getAvailableLangFiles()

static ilPlugin::getAvailableLangFiles ( string  $a_lang_directory)
static

Get array of all language files in the plugin.

Definition at line 339 of file class.ilPlugin.php.

Referenced by ilPluginsOverviewTableGUI\gatherPluginData(), ilObjComponentSettingsGUI\showPlugin(), and updateLanguages().

339  : array
340  {
341  $langs = array();
342 
343  if (!@is_dir($a_lang_directory)) {
344  return array();
345  }
346 
347  $dir = opendir($a_lang_directory);
348  while ($file = readdir($dir)) {
349  if ($file != "." and
350  $file != ".."
351  ) {
352  // directories
353  if (@is_file($a_lang_directory . "/" . $file)) {
354  if (substr($file, 0, 6) == "ilias_"
355  && substr($file, strlen($file) - 5) == ".lang"
356  ) {
357  $langs[] = array(
358  "key" => substr($file, 6, 2),
359  "file" => $file,
360  "path" => $a_lang_directory . "/" . $file,
361  );
362  }
363  }
364  }
365  }
366 
367  return $langs;
368  }
+ Here is the caller graph for this function:

◆ getClassesDirectory()

ilPlugin::getClassesDirectory ( )
protected
Returns
string

Definition at line 312 of file class.ilPlugin.php.

References getDirectory().

Referenced by includeClass().

312  : string
313  {
314  return $this->getDirectory() . "/classes";
315  }
getDirectory()
Get Plugin Directory.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getComponentName()

ilPlugin::getComponentName ( )
abstract

Get Component Name.

Must be overwritten in plugin class of plugin slot.

Returns
string Component Name

Referenced by __construct(), __init(), activate(), clearEventListening(), deactivate(), getImagePath(), getStyleSheetLocation(), install(), isActive(), needsUpdate(), readEventListening(), uninstall(), update(), updateDatabase(), and writeDBVersion().

+ Here is the caller graph for this function:

◆ getComponentType()

ilPlugin::getComponentType ( )
abstract

Get Component Type.

Must be overwritten in plugin class of plugin slot.

Returns
string Component Type

Referenced by __construct(), __init(), activate(), clearEventListening(), deactivate(), getImagePath(), getStyleSheetLocation(), install(), isActive(), needsUpdate(), readEventListening(), uninstall(), update(), updateDatabase(), and writeDBVersion().

+ Here is the caller graph for this function:

◆ getConfigureClassName()

static ilPlugin::getConfigureClassName ( array  $plugin_data)
static

Get plugin configure class name.

Parameters
array$plugin_data
Returns
string

Definition at line 403 of file class.ilPlugin.php.

Referenced by ilPluginsOverviewTableGUI\gatherPluginData(), ilObjComponentSettingsGUI\showPlugin(), and update().

403  : string
404  {
405  return "il" . $plugin_data["name"] . "ConfigGUI";
406  }
+ Here is the caller graph for this function:

◆ getDBUpdateScriptName()

static ilPlugin::getDBUpdateScriptName ( string  $a_ctype,
string  $a_cname,
string  $a_slot_name,
string  $a_pname 
)
static
Parameters
string$a_ctype
string$a_cname
string$a_slot_name
string$a_pname
Returns
string

Definition at line 426 of file class.ilPlugin.php.

Referenced by ilPluginDBUpdate\__construct(), and ilObjComponentSettingsGUI\showPlugin().

426  : string
427  {
428  return "Customizing/global/plugins/" . $a_ctype . "/" . $a_cname . "/" .
429  $a_slot_name . "/" . $a_pname . "/sql/dbupdate.php";
430  }
+ Here is the caller graph for this function:

◆ getDBVersion()

ilPlugin::getDBVersion ( )
Returns
int

Definition at line 263 of file class.ilPlugin.php.

References $dbversion.

Referenced by writeDBVersion().

263  : int
264  {
265  return $this->dbversion;
266  }
+ Here is the caller graph for this function:

◆ getDirectory()

ilPlugin::getDirectory ( )

Get Plugin Directory.

Returns
object Plugin Slot

Definition at line 294 of file class.ilPlugin.php.

References getPluginName(), and getSlotObject().

Referenced by addBlockFile(), clearEventListening(), getClassesDirectory(), getLanguageDirectory(), getStyleSheetLocation(), getTemplate(), readEventListening(), and update().

294  : string
295  {
296  return $this->getSlotObject()->getPluginsDirectory() . "/" . $this->getPluginName();
297  }
getPluginName()
Get Plugin Name.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getGlobalScreenProviderCollection()

ilPlugin::getGlobalScreenProviderCollection ( )
final
Returns
PluginProviderCollection

Definition at line 1376 of file class.ilPlugin.php.

References $provider_collection, promoteGlobalScreenProvider(), and ILIAS\GlobalScreen\Provider\PluginProviderCollection\setMainBarProvider().

1377  {
1379  $this->provider_collection->setMainBarProvider($this->promoteGlobalScreenProvider());
1380  }
1381 
1383  }
Class ilPluginGlobalScreenNullProvider.
promoteGlobalScreenProvider()
setMainBarProvider(AbstractStaticMainMenuPluginProvider $static_mai_menu_provider)
+ Here is the call graph for this function:

◆ getId()

◆ getIliasMaxVersion()

ilPlugin::getIliasMaxVersion ( )

Get Required ILIAS max.

release.

Returns
string Required ILIAS max. release

Definition at line 209 of file class.ilPlugin.php.

References $iliasmaxversion.

210  {
211  return $this->iliasmaxversion;
212  }

◆ getIliasMinVersion()

ilPlugin::getIliasMinVersion ( )
Returns
string

Definition at line 189 of file class.ilPlugin.php.

References $iliasminversion.

189  : string
190  {
191  return $this->iliasminversion;
192  }

◆ getImagePath()

ilPlugin::getImagePath ( string  $a_img)

Get image path.

Definition at line 649 of file class.ilPlugin.php.

References getComponentName(), getComponentType(), getPluginName(), and getSlotId().

649  : string
650  {
651  return self::_getImagePath(
652  $this->getComponentType(),
653  $this->getComponentName(),
654  $this->getSlotId(),
655  $this->getPluginName(),
656  $a_img
657  );
658  }
getComponentName()
Get Component Name.
getComponentType()
Get Component Type.
getSlotId()
Get Slot ID.
getPluginName()
Get Plugin Name.
+ Here is the call graph for this function:

◆ getLanguageDirectory()

ilPlugin::getLanguageDirectory ( )
protected
Returns
string

Definition at line 330 of file class.ilPlugin.php.

References getDirectory().

Referenced by updateLanguages().

330  : string
331  {
332  return $this->getDirectory() . "/lang";
333  }
getDirectory()
Get Plugin Directory.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getLastUpdateVersion()

ilPlugin::getLastUpdateVersion ( )

Get Version of last update.

Returns
string Version of last update

Definition at line 153 of file class.ilPlugin.php.

References $lastupdateversion.

153  : string
154  {
156  }

◆ getPluginName()

ilPlugin::getPluginName ( )
abstract

◆ getPluginObject()

static ilPlugin::getPluginObject ( string  $a_ctype,
string  $a_cname,
string  $a_slot_id,
string  $a_pname 
)
static
Parameters
string$a_ctype
string$a_cname
string$a_slot_id
string$a_pname
Returns
ilPlugin
Exceptions
ilPluginException

Definition at line 1172 of file class.ilPlugin.php.

References XapiProxy\$plugin, ilCachedComponentData\getInstance(), and ilPluginSlot\lookupSlotName().

Referenced by SurveyQuestion\_getQuestionTypeName(), assQuestion\_getQuestionTypeName(), ilObjSurveyQuestionPool\_getQuestiontypes(), ilObjQuestionPool\_getQuestionTypes(), ilObjSurveyQuestionPool\_getQuestionTypeTranslations(), SurveyQuestion\_includeClass(), ilObjComponentSettingsGUI\activatePlugin(), ilObjComponentSettingsGUI\confirmUninstallPlugin(), ilObjComponentSettingsGUI\deactivatePlugin(), ilObjTest\getAvailableQuestions(), ilDclFieldFactory\getClassPathByInstance(), ilDclFieldFactory\getFieldTypeByInstance(), ilOrgUnitExtensionListGUI\getPlugin(), ilOrgUnitExtensionGUI\getPlugin(), ilObjectPluginListGUI\getPlugin(), ilOrgUnitExtension\getPlugin(), ilObjectPlugin\getPlugin(), ilObjectPluginGUI\getPlugin(), ilPluginAdmin\getPluginObject(), ilObjQuestionPool\getQuestionTypeTranslations(), assQuestion\includePluginClass(), ilObjComponentSettingsGUI\installPlugin(), ilObjQuestionPool\isPluginActive(), ilObjectPlugin\loadOrgUnitPlugin(), ilObjectPlugin\loadRepoPlugin(), ilObjComponentSettingsGUI\refreshLanguages(), ilObjLanguage\refreshPlugins(), ilObjComponentSettingsGUI\uninstallPlugin(), ilObjComponentSettingsGUI\updatePlugin(), and ilObjQuestionPoolGUI\uploadQplObject().

1172  : ilPlugin
1173  {
1174  $slot_name = ilPluginSlot::lookupSlotName($a_ctype, $a_cname, $a_slot_id);
1175 
1176  $cached_component = ilCachedComponentData::getInstance();
1177  $rec = $cached_component->lookCompId($a_ctype, $a_cname);
1178  if (!$rec) {
1179  return null;
1180  }
1181 
1182  $file = "./Customizing/global/plugins/" . $a_ctype . "/" .
1183  $a_cname . "/" . $slot_name . "/" .
1184  $a_pname . "/classes/class.il" . $a_pname . "Plugin.php";
1185 
1186  if (is_file($file)) {
1187  include_once($file);
1188  $class = "il" . $a_pname . "Plugin";
1189  $plugin = new $class();
1190 
1191  return $plugin;
1192  }
1193  throw new ilPluginException("File : ".$file. " . does not Exist for plugin: ".$a_pname. " Check if your
1194  plugin is still marked as active in the DB Table 'il_plugin' but not installed anymore.");
1195  }
static lookupSlotName($a_ctype, $a_cname, $a_slot_id)
Lookup slot name for component and slot id.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getPluginRecord()

static ilPlugin::getPluginRecord ( string  $a_ctype,
string  $a_cname,
string  $a_slot_id,
string  $a_pname 
)
static
Parameters
string$a_ctype
string$a_cname
string$a_slot_id
string$a_pname
Returns
array
Exceptions
ilPluginException

Definition at line 727 of file class.ilPlugin.php.

References ilCachedComponentData\getInstance().

Referenced by __init(), ilPluginsOverviewTableGUI\gatherPluginData(), ilPluginAdmin\getPluginData(), ilCloudHookPlugin\getPluginTablePrefix(), ilDclFieldTypePlugin\getPluginTablePrefix(), and ilObjComponentSettingsGUI\showPlugin().

727  : array
728  {
729  $cached_component = ilCachedComponentData::getInstance();
730  $rec = $cached_component->lookupPluginByName($a_pname);
731 
732  if ($rec['component_type'] == $a_ctype and $rec['component_name'] == $a_cname and $rec['slot_id'] == $a_slot_id) {
733  return $rec;
734  } else {
735  throw new ilPluginException("No plugin record found for '{$a_ctype}', '{$a_cname}', '{$a_slot_id}', '{$a_pname}");
736  }
737  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getPrefix()

ilPlugin::getPrefix ( )

Get plugin prefix, used for lang vars.

Definition at line 412 of file class.ilPlugin.php.

References getId(), and getSlotObject().

Referenced by getTablePrefix(), loadLanguageModule(), txt(), uninstall(), update(), and updateLanguages().

412  : string
413  {
414  return $this->getSlotObject()->getPrefix() . "_" . $this->getId();
415  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getSlot()

ilPlugin::getSlot ( )
abstract

Get Slot Name.

Must be overwritten in plugin class of plugin slot.

Returns
string Slot Name

Referenced by __construct().

+ Here is the caller graph for this function:

◆ getSlotId()

ilPlugin::getSlotId ( )
abstract

Get Slot ID.

Must be overwritten in plugin class of plugin slot.

Returns
string Slot Id

Referenced by __construct(), __init(), activate(), clearEventListening(), deactivate(), getImagePath(), getStyleSheetLocation(), install(), isActive(), needsUpdate(), readEventListening(), uninstall(), update(), updateDatabase(), and writeDBVersion().

+ Here is the caller graph for this function:

◆ getSlotObject()

ilPlugin::getSlotObject ( )
protected
Returns
ilPluginSlot

Definition at line 245 of file class.ilPlugin.php.

References $slot.

Referenced by getDirectory(), ilCloudHookPlugin\getPluginTablePrefix(), ilDclFieldTypePlugin\getPluginTablePrefix(), and getPrefix().

245  : ilPluginSlot
246  {
247  return $this->slot;
248  }
Plugin Slot.
+ Here is the caller graph for this function:

◆ getStyleSheetLocation()

ilPlugin::getStyleSheetLocation ( string  $a_css_file)
Parameters
string$a_css_file
Returns
string

Definition at line 666 of file class.ilPlugin.php.

References getComponentName(), getComponentType(), getDirectory(), getPluginName(), getSlotId(), ilUtil\getStyleSheetLocation(), ilComponent\lookupId(), and lookupIdForName().

666  : string
667  {
668  $d2 = ilComponent::lookupId($this->getComponentType(), $this->getComponentName()) . "_" . $this->getSlotId() . "_" .
670 
671  $css = ilUtil::getStyleSheetLocation("output", $a_css_file, $d2);
672  if (is_int(strpos($css, "Customizing"))) {
673  return $css;
674  }
675 
676  return $this->getDirectory() . "/templates/" . $a_css_file;
677  }
static lookupId($a_type, $a_name)
Lookup ID of a component.
static getStyleSheetLocation($mode="output", $a_css_name="", $a_css_location="")
get full style sheet file name (path inclusive) of current user
getComponentName()
Get Component Name.
static lookupIdForName(string $a_ctype, string $a_cname, string $a_slot_id, string $a_plugin_name)
getComponentType()
Get Component Type.
getDirectory()
Get Plugin Directory.
getSlotId()
Get Slot ID.
getPluginName()
Get Plugin Name.
+ Here is the call graph for this function:

◆ getTablePrefix()

ilPlugin::getTablePrefix ( )

Get db table plugin prefix.

Definition at line 436 of file class.ilPlugin.php.

References getPrefix().

Referenced by updateDatabase().

437  {
438  return $this->getPrefix();
439  }
getPrefix()
Get plugin prefix, used for lang vars.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getTemplate()

ilPlugin::getTemplate ( string  $a_template,
bool  $a_par1 = true,
bool  $a_par2 = true 
)

gets a ilTemplate instance of a html-file in the plugin /templates

Parameters
string$a_template
bool$a_par1
bool$a_par2
Returns
ilTemplate

Definition at line 615 of file class.ilPlugin.php.

References getDirectory().

615  : ilTemplate
616  {
617  return new ilTemplate($this->getDirectory() . "/templates/" . $a_template, $a_par1, $a_par2);
618  }
getDirectory()
Get Plugin Directory.
+ Here is the call graph for this function:

◆ getVersion()

ilPlugin::getVersion ( )
Returns
string

Definition at line 171 of file class.ilPlugin.php.

References $version.

Referenced by update().

171  : string
172  {
173  return $this->version;
174  }
+ Here is the caller graph for this function:

◆ hasConfigureClass()

static ilPlugin::hasConfigureClass ( string  $a_slot_dir,
array  $plugin_data,
array  $plugin_db_data 
)
static

Has the plugin a configure class?

Parameters
string$a_slot_dirslot directory
array$plugin_dataplugin data
array$plugin_db_dataplugin db data
Returns
boolean true/false

Definition at line 380 of file class.ilPlugin.php.

References ILIAS_VERSION_NUMERIC, and ilComponent\isVersionGreaterString().

Referenced by ilPluginsOverviewTableGUI\gatherPluginData(), and ilObjComponentSettingsGUI\showPlugin().

380  : bool
381  {
382  // Mantis: 23282: Disable plugin config page for incompatible plugins
383  if (!(ilComponent::isVersionGreaterString($plugin_data["ilias_min_version"], ILIAS_VERSION_NUMERIC)
384  || ilComponent::isVersionGreaterString(ILIAS_VERSION_NUMERIC, $plugin_data["ilias_max_version"])
385  || ilComponent::isVersionGreaterString($plugin_db_data["last_update_version"], $plugin_data["version"]))
386  ) {
387  if (is_file($a_slot_dir . "/" . $plugin_data["name"] . "/classes/class.il" . $plugin_data["name"] . "ConfigGUI.php")) {
388  return true;
389  }
390  }
391 
392  return false;
393  }
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:

◆ includeClass()

ilPlugin::includeClass (   $a_class_file_name)

Include (once) a class file.

Definition at line 321 of file class.ilPlugin.php.

References getClassesDirectory().

Referenced by ilPreviewRendererPlugin\getRendererClassInstance(), ilPageComponentPlugin\getUIClassInstance(), and ilUserInterfaceHookPlugin\slotInit().

322  {
323  include_once($this->getClassesDirectory() . "/" . $a_class_file_name);
324  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ init()

ilPlugin::init ( )
protected

Object initialization.

Can be overwritten by plugin class (and should be made protected)

Definition at line 832 of file class.ilPlugin.php.

Referenced by __init().

833  {
834  }
+ Here is the caller graph for this function:

◆ install()

ilPlugin::install ( )

Definition at line 871 of file class.ilPlugin.php.

References $DIC, $ilDB, afterInstall(), ilCachedComponentData\flush(), getComponentName(), getComponentType(), getId(), getPluginName(), and getSlotId().

872  {
873  global $DIC;
874  $ilDB = $DIC->database();
875 
877  $q = "UPDATE il_plugin SET plugin_id = " . $ilDB->quote($this->getId(), "text") .
878  " WHERE component_type = " . $ilDB->quote($this->getComponentType(), "text") .
879  " AND component_name = " . $ilDB->quote($this->getComponentName(), "text") .
880  " AND slot_id = " . $ilDB->quote($this->getSlotId(), "text") .
881  " AND name = " . $ilDB->quote($this->getPluginName(), "text");
882 
883  $ilDB->manipulate($q);
884  $this->afterInstall();
885  }
getComponentName()
Get Component Name.
getComponentType()
Get Component Type.
afterInstall()
After install processing.
getSlotId()
Get Slot ID.
global $ilDB
getPluginName()
Get Plugin Name.
$DIC
Definition: xapitoken.php:46
+ Here is the call graph for this function:

◆ isActive()

ilPlugin::isActive ( )

Check whether plugin is active.

Definition at line 840 of file class.ilPlugin.php.

References $DIC, getComponentName(), getComponentType(), getPluginName(), and getSlotId().

Referenced by ExamplePlugin\exchangeUIRendererAfterInitialization().

841  {
842  global $DIC;
843  $ilPluginAdmin = $DIC['ilPluginAdmin'];
844 
845  return $ilPluginAdmin->isActive(
846  $this->getComponentType(),
847  $this->getComponentName(),
848  $this->getSlotId(),
849  $this->getPluginName()
850  );
851  }
getComponentName()
Get Component Name.
getComponentType()
Get Component Type.
getSlotId()
Get Slot ID.
getPluginName()
Get Plugin Name.
$DIC
Definition: xapitoken.php:46
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ langExitsById()

static ilPlugin::langExitsById ( string  $pluginId,
string  $langVar 
)
static

Is searched lang var available in plugin lang files.

Parameters
string$pluginId
string$langVar
Returns
bool

Definition at line 594 of file class.ilPlugin.php.

References $DIC, $lng, and ilObjectPlugin\getPluginObjectByType().

Referenced by ilObjectRolePermissionTableGUI\fillRow().

594  : bool
595  {
596  global $DIC;
597  $lng = $DIC->language();
598 
599  $pl = ilObjectPlugin::getPluginObjectByType($pluginId);
600  $pl->loadLanguageModule();
601 
602  return $lng->exists($pl->getPrefix() . "_" . $langVar);
603  }
static getPluginObjectByType($type)
Return either a repoObject plugin or a orgunit extension plugin or null if the type is not a plugin...
$lng
$DIC
Definition: xapitoken.php:46
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ loadLanguageModule()

ilPlugin::loadLanguageModule ( )

Load language module for plugin.

Definition at line 542 of file class.ilPlugin.php.

References $DIC, $lng, and getPrefix().

Referenced by __init(), and txt().

543  {
544  global $DIC;
545  $lng = $DIC->language();
546 
547  if (!$this->lang_initialised && is_object($lng)) {
548  $lng->loadLanguageModule($this->getPrefix());
549  $this->lang_initialised = true;
550  }
551  }
$lng
getPrefix()
Get plugin prefix, used for lang vars.
$DIC
Definition: xapitoken.php:46
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ lookupIdForName()

static ilPlugin::lookupIdForName ( string  $a_ctype,
string  $a_cname,
string  $a_slot_id,
string  $a_plugin_name 
)
static
Parameters
$a_ctype
$a_cname
$a_slot_id
$a_plugin_name
Returns
string

Definition at line 1317 of file class.ilPlugin.php.

References $DIC, and $ilDB.

Referenced by _getImagePath(), ilObjRepositorySettings\getAllObjTypes(), ilObjectDefinition\getGroupedPluginObjectTypes(), ilModulesTableGUI\getPluginComponents(), getStyleSheetLocation(), and ilObjectDefinition\parsePluginData().

1317  : string
1318  {
1319  global $DIC;
1320  $ilDB = $DIC->database();
1321 
1322  $q = "SELECT plugin_id FROM il_plugin " .
1323  " WHERE component_type = " . $ilDB->quote($a_ctype, "text") .
1324  " AND component_name = " . $ilDB->quote($a_cname, "text") .
1325  " AND slot_id = " . $ilDB->quote($a_slot_id, "text") .
1326  " AND name = " . $ilDB->quote($a_plugin_name, "text");
1327 
1328  $set = $ilDB->query($q);
1329  if ($rec = $ilDB->fetchAssoc($set)) {
1330  return $rec["plugin_id"];
1331  }
1332  }
global $ilDB
$DIC
Definition: xapitoken.php:46
+ Here is the caller graph for this function:

◆ lookupNameForId()

static ilPlugin::lookupNameForId ( string  $a_ctype,
string  $a_cname,
string  $a_slot_id,
string  $a_plugin_id 
)
static
Parameters
$a_ctype
$a_cname
$a_slot_id
$a_plugin_id
Returns
string | null

Definition at line 1291 of file class.ilPlugin.php.

References $DIC, and $ilDB.

Referenced by ilOrgUnitExtensionPlugin\_getIcon(), ilRepositoryObjectPlugin\_getIcon(), ilOrgUnitExtensionPlugin\_getName(), ilRepositoryObjectPlugin\_getName(), ilNavigationHistory\getItems(), ilOrgUnitExtensionListGUI\getPlugin(), ilOrgUnitExtensionGUI\getPlugin(), ilObjectPluginListGUI\getPlugin(), ilOrgUnitExtension\getPlugin(), ilObjectPlugin\getPlugin(), ilObjectPluginGUI\getPlugin(), ilObjectDefinition\isActivePluginType(), ilRepositoryObjectPluginSlot\isTypePlugin(), ilRepositoryObjectPluginSlot\isTypePluginWithLP(), ilObjectPlugin\loadOrgUnitPlugin(), and ilObjectPlugin\loadRepoPlugin().

1292  {
1293  global $DIC;
1294  $ilDB = $DIC->database();
1295 
1296  $q = "SELECT name FROM il_plugin " .
1297  " WHERE component_type = " . $ilDB->quote($a_ctype, "text") .
1298  " AND component_name = " . $ilDB->quote($a_cname, "text") .
1299  " AND slot_id = " . $ilDB->quote($a_slot_id, "text") .
1300  " AND plugin_id = " . $ilDB->quote($a_plugin_id, "text");
1301 
1302  $set = $ilDB->query($q);
1303  if ($rec = $ilDB->fetchAssoc($set)) {
1304  return $rec["name"];
1305  }
1306  }
global $ilDB
$DIC
Definition: xapitoken.php:46
+ Here is the caller graph for this function:

◆ lookupStoredData()

static ilPlugin::lookupStoredData ( string  $a_ctype,
string  $a_cname,
string  $a_slot_id,
string  $a_pname 
)
static

Lookup information data in il_plugin.

Parameters
string$a_ctype
string$a_cname
string$a_slot_id
string$a_pname
Returns
string[]

Definition at line 1208 of file class.ilPlugin.php.

References $DIC, and $ilDB.

Referenced by ilPluginSlot\getPluginsInformation().

1208  : array
1209  {
1210  global $DIC;
1211  $ilDB = $DIC->database();
1212 
1213  $q = "SELECT * FROM il_plugin WHERE" .
1214  " component_type = " . $ilDB->quote($a_ctype, "text") . " AND" .
1215  " component_name = " . $ilDB->quote($a_cname, "text") . " AND" .
1216  " slot_id = " . $ilDB->quote($a_slot_id, "text") . " AND" .
1217  " name = " . $ilDB->quote($a_pname, "text");
1218 
1219  $set = $ilDB->query($q);
1220 
1221  if ($ilDB->numRows($set) == 0) {
1222  return array();
1223  }
1224 
1225  return $ilDB->fetchAssoc($set);
1226  }
global $ilDB
$DIC
Definition: xapitoken.php:46
+ Here is the caller graph for this function:

◆ lookupTxt()

static ilPlugin::lookupTxt ( string  $a_mod_prefix,
string  $a_pl_id,
string  $a_lang_var 
)
static
Parameters
string$a_mod_prefix
string$a_pl_id
string$a_lang_var
Returns
string

Definition at line 574 of file class.ilPlugin.php.

References $DIC, and $lng.

574  : string
575  {
576  global $DIC;
577  $lng = $DIC->language();
578 
579  // this enables default language fallback
580  $prefix = $a_mod_prefix . "_" . $a_pl_id;
581 
582  return $lng->txt($prefix . "_" . $a_lang_var, $prefix);
583  }
$lng
$DIC
Definition: xapitoken.php:46

◆ lookupTypeInformationsForId()

static ilPlugin::lookupTypeInformationsForId ( string  $id)
static
Parameters
string$id
Returns
string[] | null

Definition at line 1340 of file class.ilPlugin.php.

References $DIC, and $ilDB.

Referenced by ilObjectPlugin\getPluginObjectByType().

1341  {
1342  global $DIC;
1343  $ilDB = $DIC->database();
1344 
1345  $q = "SELECT component_type, component_name, slot_id FROM il_plugin "
1346  . " WHERE plugin_id = " . $ilDB->quote($id, "text");
1347 
1348  $set = $ilDB->query($q);
1349  if ($rec = $ilDB->fetchAssoc($set)) {
1350  return [
1351  $rec["component_type"],
1352  $rec["component_name"],
1353  $rec["slot_id"],
1354  ];
1355  }
1356  }
global $ilDB
$DIC
Definition: xapitoken.php:46
+ Here is the caller graph for this function:

◆ needsUpdate()

ilPlugin::needsUpdate ( )

Check whether update is needed.

Definition at line 857 of file class.ilPlugin.php.

References $DIC, getComponentName(), getComponentType(), getPluginName(), and getSlotId().

Referenced by activate().

858  {
859  global $DIC;
860  $ilPluginAdmin = $DIC['ilPluginAdmin'];
861 
862  return $ilPluginAdmin->needsUpdate(
863  $this->getComponentType(),
864  $this->getComponentName(),
865  $this->getSlotId(),
866  $this->getPluginName()
867  );
868  }
getComponentName()
Get Component Name.
getComponentType()
Get Component Type.
getSlotId()
Get Slot ID.
getPluginName()
Get Plugin Name.
$DIC
Definition: xapitoken.php:46
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ promoteGlobalScreenProvider()

ilPlugin::promoteGlobalScreenProvider ( )
Returns
AbstractStaticPluginMainMenuProvider
Deprecated:
See also
getGlobalScreenProviderCollection instead

Definition at line 1365 of file class.ilPlugin.php.

References $DIC.

Referenced by getGlobalScreenProviderCollection().

1366  {
1367  global $DIC;
1368 
1369  return new ilPluginGlobalScreenNullProvider($DIC, $this);
1370  }
Class ilPluginGlobalScreenNullProvider.
$DIC
Definition: xapitoken.php:46
+ Here is the caller graph for this function:

◆ readEventListening()

ilPlugin::readEventListening ( )
protected

Read the event listening definitions from the plugin.xml (if file exists)

Definition at line 1115 of file class.ilPlugin.php.

References $reader, getComponentName(), getComponentType(), getDirectory(), getPluginName(), and getSlotId().

Referenced by update().

1116  {
1117  $reader = new ilPluginReader(
1118  $this->getDirectory() . '/plugin.xml',
1119  $this->getComponentType(),
1120  $this->getComponentName(),
1121  $this->getSlotId(),
1122  $this->getPluginName()
1123  );
1124  $reader->clearEvents();
1125  $reader->startParsing();
1126  }
getComponentName()
Get Component Name.
getComponentType()
Get Component Type.
getDirectory()
Get Plugin Directory.
getSlotId()
Get Slot ID.
getPluginName()
Get Plugin Name.
Class ilPluginReader.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setActive()

ilPlugin::setActive ( bool  $a_active)
private
Parameters
bool$a_active

Definition at line 218 of file class.ilPlugin.php.

Referenced by __init().

219  {
220  $this->active = $a_active;
221  }
+ Here is the caller graph for this function:

◆ setDBVersion()

ilPlugin::setDBVersion ( int  $a_dbversion)
Parameters
int$a_dbversion

Definition at line 254 of file class.ilPlugin.php.

Referenced by __init(), and writeDBVersion().

255  {
256  $this->dbversion = $a_dbversion;
257  }
+ Here is the caller graph for this function:

◆ setId()

ilPlugin::setId (   $a_id)
private

Set Id.

Parameters
string$a_idId

Definition at line 122 of file class.ilPlugin.php.

Referenced by __init().

123  {
124  $this->id = $a_id;
125  }
+ Here is the caller graph for this function:

◆ setIliasMaxVersion()

ilPlugin::setIliasMaxVersion ( string  $a_iliasmaxversion)
private
Parameters
$a_iliasmaxversion

Definition at line 198 of file class.ilPlugin.php.

Referenced by __init().

199  {
200  $this->iliasmaxversion = $a_iliasmaxversion;
201  }
+ Here is the caller graph for this function:

◆ setIliasMinVersion()

ilPlugin::setIliasMinVersion ( string  $a_iliasminversion)
private
Parameters
$a_iliasminversion

Definition at line 180 of file class.ilPlugin.php.

Referenced by __init().

181  {
182  $this->iliasminversion = $a_iliasminversion;
183  }
+ Here is the caller graph for this function:

◆ setLastUpdateVersion()

ilPlugin::setLastUpdateVersion ( string  $a_lastupdateversion)
private

Set Version of last update.

Parameters
string$a_lastupdateversionVersion of last update

Definition at line 142 of file class.ilPlugin.php.

Referenced by __init().

143  {
144  $this->lastupdateversion = $a_lastupdateversion;
145  }
+ Here is the caller graph for this function:

◆ setSlotObject()

ilPlugin::setSlotObject ( ilPluginSlot  $a_slot)
protected
Parameters
ilPluginSlot$a_slot

Definition at line 236 of file class.ilPlugin.php.

Referenced by __init().

237  {
238  $this->slot = $a_slot;
239  }
+ Here is the caller graph for this function:

◆ setVersion()

ilPlugin::setVersion ( string  $a_version)
private
Parameters
string$a_version

Definition at line 162 of file class.ilPlugin.php.

Referenced by __init().

163  {
164  $this->version = $a_version;
165  }
+ Here is the caller graph for this function:

◆ slotInit()

ilPlugin::slotInit ( )
abstractprotected

Object initialization done by slot.

Must be overwritten in plugin class of plugin slot.

(and should be made protected)

Referenced by __init().

+ Here is the caller graph for this function:

◆ txt()

ilPlugin::txt ( string  $a_var)

Get Language Variable (prefix will be prepended automatically)

Definition at line 557 of file class.ilPlugin.php.

References $DIC, $lng, getPrefix(), and loadLanguageModule().

Referenced by ilTestExportPlugin\getFormat().

557  : string
558  {
559  global $DIC;
560  $lng = $DIC->language();
561  $this->loadLanguageModule();
562 
563  return $lng->txt($this->getPrefix() . "_" . $a_var, $this->getPrefix());
564  }
loadLanguageModule()
Load language module for plugin.
$lng
getPrefix()
Get plugin prefix, used for lang vars.
$DIC
Definition: xapitoken.php:46
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ uninstall()

ilPlugin::uninstall ( )
final

Definition at line 1000 of file class.ilPlugin.php.

References $DIC, $ilDB, afterUninstall(), beforeUninstall(), clearEventListening(), ilCachedComponentData\flush(), getComponentName(), getComponentType(), getPluginName(), getPrefix(), getSlotId(), and ilDBConstants\T_TEXT.

1001  {
1002  global $DIC;
1003  $ilDB = $DIC->database();
1004 
1005  if ($this->beforeUninstall()) {
1006  // remove all language entries (see ilObjLanguage)
1007  // see updateLanguages
1008  $prefix = $this->getPrefix();
1009  if ($prefix) {
1010  $ilDB->manipulate(
1011  "DELETE FROM lng_data" .
1012  " WHERE module = " . $ilDB->quote($prefix, "text")
1013  );
1014  $ilDB->manipulate(
1015  "DELETE FROM lng_modules" .
1016  " WHERE module = " . $ilDB->quote($prefix, "text")
1017  );
1018  }
1019 
1020  $this->clearEventListening();
1021 
1022  // db version is kept in il_plugin - will be deleted, too
1023 
1024  $q = "DELETE FROM il_plugin" .
1025  " WHERE component_type = " . $ilDB->quote($this->getComponentType(), "text") .
1026  " AND component_name = " . $ilDB->quote($this->getComponentName(), "text") .
1027  " AND slot_id = " . $ilDB->quote($this->getSlotId(), "text") .
1028  " AND name = " . $ilDB->quote($this->getPluginName(), "text");
1029  $ilDB->manipulate($q);
1030 
1031  $ilDB->manipulateF('DELETE FROM ctrl_classfile WHERE comp_prefix=%s', [ilDBConstants::T_TEXT], [$this->getPrefix()]);
1032  $ilDB->manipulateF('DELETE FROM ctrl_calls WHERE comp_prefix=%s', [ilDBConstants::T_TEXT], [$this->getPrefix()]);
1033 
1034  $this->afterUninstall();
1035 
1037 
1038  return true;
1039  }
1040 
1041  return false;
1042  }
afterUninstall()
This is Plugin-Specific and is triggered after the uninstall command of a plugin. ...
getComponentName()
Get Component Name.
getComponentType()
Get Component Type.
getPrefix()
Get plugin prefix, used for lang vars.
getSlotId()
Get Slot ID.
global $ilDB
getPluginName()
Get Plugin Name.
$DIC
Definition: xapitoken.php:46
clearEventListening()
Clear the entries of this plugin in the event handling table.
+ Here is the call graph for this function:

◆ update()

ilPlugin::update ( )

Update plugin.

Definition at line 1056 of file class.ilPlugin.php.

References $DIC, $ilCtrl, $ilDB, $result, afterUpdate(), beforeUpdate(), getComponentName(), getComponentType(), getConfigureClassName(), getDirectory(), getPluginName(), getPrefix(), getSlotId(), getVersion(), readEventListening(), updateDatabase(), and updateLanguages().

Referenced by activate(), and ilObjComponentSettingsGUI\update().

1057  {
1058  global $DIC;
1059  $ilDB = $DIC->database();
1060  $ilCtrl = $DIC->ctrl();
1061 
1062  ilGlobalCache::flushAll();
1063 
1064  $result = $this->beforeUpdate();
1065  if ($result === false) {
1066  return false;
1067  }
1068 
1069  // Load language files
1070  $this->updateLanguages();
1071 
1072  // DB update
1073  if ($result === true) {
1074  $result = $this->updateDatabase();
1075  }
1076 
1077  // load control structure
1078  $structure_reader = new ilCtrlStructureReader();
1079  $structure_reader->readStructure(
1080  true,
1081  "./" . $this->getDirectory(),
1082  $this->getPrefix(),
1083  $this->getDirectory()
1084  );
1085 
1086  // add config gui to the ctrl calls
1087  $ilCtrl->insertCtrlCalls(
1088  "ilobjcomponentsettingsgui",
1089  ilPlugin::getConfigureClassName(["name" => $this->getPluginName()]),
1090  $this->getPrefix()
1091  );
1092 
1093  $this->readEventListening();
1094 
1095  // set last update version to current version
1096  if ($result === true) {
1097  $q = "UPDATE il_plugin SET last_update_version = " . $ilDB->quote($this->getVersion(), "text") .
1098  " WHERE component_type = " . $ilDB->quote($this->getComponentType(), "text") .
1099  " AND component_name = " . $ilDB->quote($this->getComponentName(), "text") .
1100  " AND slot_id = " . $ilDB->quote($this->getSlotId(), "text") .
1101  " AND name = " . $ilDB->quote($this->getPluginName(), "text");
1102 
1103  $ilDB->manipulate($q);
1104  $this->afterUpdate();
1105  }
1106  ilGlobalCache::flushAll();
1107 
1108  return $result;
1109  }
$result
updateLanguages($a_lang_keys=null)
readEventListening()
Read the event listening definitions from the plugin.xml (if file exists)
getComponentName()
Get Component Name.
Class ilCtrlStructureReader.
global $ilCtrl
Definition: ilias.php:18
getComponentType()
Get Component Type.
updateDatabase()
Update database.
getDirectory()
Get Plugin Directory.
getPrefix()
Get plugin prefix, used for lang vars.
static getConfigureClassName(array $plugin_data)
Get plugin configure class name.
afterUpdate()
After update processing.
getSlotId()
Get Slot ID.
global $ilDB
getPluginName()
Get Plugin Name.
$DIC
Definition: xapitoken.php:46
beforeUpdate()
Before update processing.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ updateDatabase()

ilPlugin::updateDatabase ( )

Update database.

Definition at line 504 of file class.ilPlugin.php.

References $DIC, $ilDB, $lng, $message, $result, getComponentName(), getComponentType(), getPluginName(), getSlotId(), and getTablePrefix().

Referenced by update().

505  {
506  global $DIC;
507  $ilDB = $DIC->database();
508  $lng = $DIC->language();
509 
510  ilGlobalCache::flushAll();
511 
512  $dbupdate = new ilPluginDBUpdate(
513  $this->getComponentType(),
514  $this->getComponentName(),
515  $this->getSlotId(),
516  $this->getPluginName(),
517  $ilDB,
518  true,
519  $this->getTablePrefix()
520  );
521 
522  $result = $dbupdate->applyUpdate();
523  $message = '';
524  if ($dbupdate->updateMsg == "no_changes") {
525  $message = $lng->txt("no_changes") . ". " . $lng->txt("database_is_uptodate");
526  } else {
527  foreach ($dbupdate->updateMsg as $row) {
528  $message .= $lng->txt($row["msg"]) . ": " . $row["nr"] . "<br/>";
529  }
530  }
531 
532  $this->message .= $message;
533  ilGlobalCache::flushAll();
534 
535  return $result;
536  }
getTablePrefix()
Get db table plugin prefix.
$result
Database Update class.
getComponentName()
Get Component Name.
getComponentType()
Get Component Type.
$lng
getSlotId()
Get Slot ID.
global $ilDB
getPluginName()
Get Plugin Name.
$DIC
Definition: xapitoken.php:46
$message
Definition: xapiexit.php:14
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ updateLanguages()

ilPlugin::updateLanguages (   $a_lang_keys = null)

Definition at line 447 of file class.ilPlugin.php.

References Vendor\Package\$a, $lang, $txt, ilObjLanguage\_getLocalChangesByModule(), getAvailableLangFiles(), ilObjLanguage\getInstalledLanguages(), getLanguageDirectory(), getPrefix(), and ilObjLanguage\replaceLangEntry().

Referenced by update().

448  {
449  ilGlobalCache::flushAll();
450 
451  // get the keys of all installed languages if keys are not provided
452  if (!isset($a_lang_keys)) {
453  $a_lang_keys = array();
454  foreach (ilObjLanguage::getInstalledLanguages() as $langObj) {
455  if ($langObj->isInstalled()) {
456  $a_lang_keys[] = $langObj->getKey();
457  }
458  }
459  }
460 
461  $langs = $this->getAvailableLangFiles($this->getLanguageDirectory());
462 
463  $prefix = $this->getPrefix();
464 
465  foreach ($langs as $lang) {
466  // check if the language should be updated, otherwise skip it
467  if (!in_array($lang['key'], $a_lang_keys)) {
468  continue;
469  }
470 
471  $txt = file($this->getLanguageDirectory() . "/" . $lang["file"]);
472  $lang_array = array();
473 
474  // get locally changed variables of the module (these should be kept)
475  $local_changes = ilObjLanguage::_getLocalChangesByModule($lang['key'], $prefix);
476 
477  // get language data
478  if (is_array($txt)) {
479  foreach ($txt as $row) {
480  if ($row[0] != "#" && strpos($row, "#:#") > 0) {
481  $a = explode("#:#", trim($row));
482  $identifier = $prefix . "_" . trim($a[0]);
483  $value = trim($a[1]);
484 
485  if (isset($local_changes[$identifier])) {
486  $lang_array[$identifier] = $local_changes[$identifier];
487  } else {
488  $lang_array[$identifier] = $value;
489  ilObjLanguage::replaceLangEntry($prefix, $identifier, $lang["key"], $value);
490  }
491  //echo "<br>-$prefix-".$prefix."_".trim($a[0])."-".$lang["key"]."-";
492  }
493  }
494  }
495 
496  ilObjLanguage::replaceLangModule($lang["key"], $prefix, $lang_array);
497  }
498  }
static getInstalledLanguages()
Get the language objects of the installed languages.
static getAvailableLangFiles(string $a_lang_directory)
Get array of all language files in the plugin.
static _getLocalChangesByModule($a_key, $a_module)
Get the local changes of a language module.
$txt
Definition: error.php:13
getPrefix()
Get plugin prefix, used for lang vars.
$lang
Definition: xapiexit.php:8
$a
thx to https://mlocati.github.io/php-cs-fixer-configurator for the examples
getLanguageDirectory()
static replaceLangEntry( $a_module, $a_identifier, $a_lang_key, $a_value, $a_local_change=null, $a_remarks=null)
Replace lang entry.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ writeDBVersion()

ilPlugin::writeDBVersion ( int  $a_dbversion)
Parameters
string$a_dbversion

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

References $DIC, $ilDB, getComponentName(), getComponentType(), getDBVersion(), getPluginName(), getSlotId(), and setDBVersion().

273  {
274  global $DIC;
275  $ilDB = $DIC->database();
276 
277  $this->setDBVersion($a_dbversion);
278 
279  $q = "UPDATE il_plugin SET db_version = " . $ilDB->quote((int) $this->getDBVersion(), "integer") .
280  " WHERE component_type = " . $ilDB->quote($this->getComponentType(), "text") .
281  " AND component_name = " . $ilDB->quote($this->getComponentName(), "text") .
282  " AND slot_id = " . $ilDB->quote($this->getSlotId(), "text") .
283  " AND name = " . $ilDB->quote($this->getPluginName(), "text");
284 
285  $ilDB->manipulate($q);
286  }
getComponentName()
Get Component Name.
getComponentType()
Get Component Type.
setDBVersion(int $a_dbversion)
getSlotId()
Get Slot ID.
global $ilDB
getPluginName()
Get Plugin Name.
$DIC
Definition: xapitoken.php:46
+ Here is the call graph for this function:

Field Documentation

◆ $active

ilPlugin::$active = false
protected

Definition at line 24 of file class.ilPlugin.php.

Referenced by getActive().

◆ $dbversion

ilPlugin::$dbversion = 0
protected

Definition at line 44 of file class.ilPlugin.php.

Referenced by getDBVersion().

◆ $id

◆ $iliasmaxversion

ilPlugin::$iliasmaxversion = ""
protected

Definition at line 28 of file class.ilPlugin.php.

Referenced by getIliasMaxVersion().

◆ $iliasminversion

ilPlugin::$iliasminversion = ""
protected

Definition at line 32 of file class.ilPlugin.php.

Referenced by getIliasMinVersion().

◆ $lang_initialised

ilPlugin::$lang_initialised = false
protected

Definition at line 48 of file class.ilPlugin.php.

◆ $lastupdateversion

ilPlugin::$lastupdateversion = ""
protected

Definition at line 40 of file class.ilPlugin.php.

Referenced by getLastUpdateVersion().

◆ $provider_collection

ilPlugin::$provider_collection
protected

Definition at line 56 of file class.ilPlugin.php.

Referenced by getGlobalScreenProviderCollection().

◆ $slot

ilPlugin::$slot
protected

Definition at line 20 of file class.ilPlugin.php.

Referenced by getSlotObject().

◆ $version

ilPlugin::$version = ""
protected

Definition at line 36 of file class.ilPlugin.php.

Referenced by getVersion().


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