ILIAS  release_7 Revision v7.30-3-g800a261c036
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...
 
 getMessage ()
 

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
 
 $message
 

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 63 of file class.ilPlugin.php.

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

64  {
65  $this->__init();
66  $this->provider_collection = new PluginProviderCollection();
67  }
__init()
Default initialization.
+ Here is the call graph for this function:

Member Function Documentation

◆ __init()

ilPlugin::__init ( )
private

Default initialization.

Definition at line 756 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().

757  {
758  global $DIC;
759  $ilPluginAdmin = $DIC['ilPluginAdmin'];
760 
761  // read/set basic data
763  $this->getComponentType(),
764  $this->getComponentName(),
765  $this->getSlotId(),
766  $this->getPluginName()
767  );
768  $this->setLastUpdateVersion((string) $rec["last_update_version"]);
769  $this->setDBVersion((int) $rec["db_version"]);
770  $this->setActive((bool) $rec["active"]);
771 
772  // get id
773  $this->setId(
774  $ilPluginAdmin->getId(
775  $this->getComponentType(),
776  $this->getComponentName(),
777  $this->getSlotId(),
778  $this->getPluginName()
779  )
780  );
781 
782  // get version
783  $this->setVersion(
784  $ilPluginAdmin->getVersion(
785  $this->getComponentType(),
786  $this->getComponentName(),
787  $this->getSlotId(),
788  $this->getPluginName()
789  )
790  );
791 
792  // get ilias min version
793  $this->setIliasMinVersion(
794  $ilPluginAdmin->getIliasMinVersion(
795  $this->getComponentType(),
796  $this->getComponentName(),
797  $this->getSlotId(),
798  $this->getPluginName()
799  )
800  );
801 
802  // get ilias max version
803  $this->setIliasMaxVersion(
804  $ilPluginAdmin->getIliasMaxVersion(
805  $this->getComponentType(),
806  $this->getComponentName(),
807  $this->getSlotId(),
808  $this->getPluginName()
809  )
810  );
811 
812  // get slot object
813  $this->setSlotObject(
814  new ilPluginSlot(
815  $this->getComponentType(),
816  $this->getComponentName(),
817  $this->getSlotId()
818  )
819  );
820 
821  // load language module
822 
823  // Fix for authentication plugins
824  $this->loadLanguageModule();
825 
826  // call slot and plugin init methods
827  $this->slotInit();
828  $this->init();
829  }
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)
global $DIC
Definition: goto.php:24
setSlotObject(ilPluginSlot $a_slot)
getSlotId()
Get Slot ID.
slotInit()
Object initialization done by slot.
getPluginName()
Get Plugin Name.
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 307 of file class.ilPlugin.php.

References ilPluginSlot\_getPluginsDirectory().

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

307  : string
308  {
309  return ilPluginSlot::_getPluginsDirectory($a_ctype, $a_cname, $a_slot_id) . "/" . $a_pname;
310  }
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 634 of file class.ilPlugin.php.

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

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

634  : string
635  {
636  $img = ilUtil::getImagePath($a_img);
637  if (is_int(strpos($img, "Customizing"))) {
638  return $img;
639  }
640 
641  // prior to ILIAS 8 Plugin-Icons has to be in a subfolder of 'images' of a skin
642  $directory_prefix = ilComponent::lookupId($a_ctype, $a_cname)
643  . "_"
644  . $a_slot_id
645  . "_" .
646  ilPlugin::lookupIdForName($a_ctype, $a_cname, $a_slot_id, $a_pname);
647 
648  $img = ilUtil::getImagePath($directory_prefix . '/' . $a_img);
649  if (is_int(strpos($img, "Customizing"))) {
650  return $img;
651  }
652 
653  $plugin_directory = ilPlugin::_getDirectory($a_ctype, $a_cname, $a_slot_id, $a_pname);
654 
655  return $plugin_directory . "/templates/images/" . $a_img;
656  }
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)
$img
Definition: imgupload.php:57
static _getDirectory(string $a_ctype, string $a_cname, string $a_slot_id, string $a_pname)
Get plugin directory.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ activate()

ilPlugin::activate ( )

Activate.

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

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

905  {
906  global $DIC;
907  $ilDB = $DIC->database();
908 
910 
911  $result = true;
912 
913  // check whether update is necessary
914  if ($this->needsUpdate()) {
915  //$result = $this->isUpdatePossible();
916 
917  // do update
918  if ($result === true) {
919  $result = $this->update();
920  }
921  }
922  if ($result === true) {
923  $result = $this->beforeActivation();
924  // activate plugin
925  if ($result === true) {
926  $q = "UPDATE il_plugin SET active = " . $ilDB->quote(1, "integer") .
927  " WHERE component_type = " . $ilDB->quote($this->getComponentType(), "text") .
928  " AND component_name = " . $ilDB->quote($this->getComponentName(), "text") .
929  " AND slot_id = " . $ilDB->quote($this->getSlotId(), "text") .
930  " AND name = " . $ilDB->quote($this->getPluginName(), "text");
931 
932  $ilDB->manipulate($q);
933  $this->afterActivation();
934  }
935  }
937 
938  return $result;
939  }
$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.
global $DIC
Definition: goto.php:24
getSlotId()
Get Slot ID.
global $ilDB
getPluginName()
Get Plugin Name.
+ 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 696 of file class.ilPlugin.php.

References getDirectory().

697  {
698  $a_tpl->addBlockFile(
699  $a_var,
700  $a_block,
701  $this->getDirectory() . "/templates/" . $a_tplname
702  );
703  }
getDirectory()
Get Plugin Directory.
+ Here is the call graph for this function:

◆ afterActivation()

ilPlugin::afterActivation ( )
protected

After activation processing.

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

Referenced by activate().

968  {
969  }
+ Here is the caller graph for this function:

◆ afterDeactivation()

ilPlugin::afterDeactivation ( )
protected

After deactivation processing.

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

Referenced by deactivate().

1001  {
1002  }
+ Here is the caller graph for this function:

◆ afterInstall()

ilPlugin::afterInstall ( )
protected

After install processing.

Returns
void

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

Referenced by install().

948  {
949  }
+ 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 1061 of file class.ilPlugin.php.

Referenced by uninstall().

1062  {
1063  }
+ Here is the caller graph for this function:

◆ afterUpdate()

ilPlugin::afterUpdate ( )
protected

After update processing.

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

Referenced by update().

1174  {
1175  }
+ Here is the caller graph for this function:

◆ beforeActivation()

ilPlugin::beforeActivation ( )
protected

Before activation processing.

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

Referenced by activate().

956  {
957  return true; // false would indicate that anything went wrong
958  // activation would not proceed
959  // throw an exception in this case
960  //throw new ilPluginException($lng->txt(""));
961  }
+ Here is the caller graph for this function:

◆ beforeUninstall()

ilPlugin::beforeUninstall ( )
protected

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

Referenced by uninstall().

1006  {
1007  // plugin-specific
1008  // false would indicate that anything went wrong
1009  return true;
1010  }
+ Here is the caller graph for this function:

◆ beforeUpdate()

ilPlugin::beforeUpdate ( )
protected

Before update processing.

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

Referenced by update().

1162  {
1163  return true; // false would indicate that anything went wrong
1164  // update would not proceed
1165  // throw an exception in this case
1166  //throw new ilPluginException($lng->txt(""));
1167  }
+ 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 1145 of file class.ilPlugin.php.

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

Referenced by uninstall().

1146  {
1147  $reader = new ilPluginReader(
1148  $this->getDirectory() . '/plugin.xml',
1149  $this->getComponentType(),
1150  $this->getComponentName(),
1151  $this->getSlotId(),
1152  $this->getPluginName()
1153  );
1154  $reader->clearEvents();
1155  }
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 714 of file class.ilPlugin.php.

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

Referenced by ilPluginSlot\readPluginInformation().

715  {
716  global $DIC;
717  $ilDB = $DIC->database();
718 
720 
721  $q = "INSERT INTO il_plugin (component_type, component_name, slot_id, name)" .
722  " VALUES (" . $ilDB->quote($a_ctype, "text") . "," .
723  $ilDB->quote($a_cname, "text") . "," .
724  $ilDB->quote($a_slot_id, "text") . "," .
725  $ilDB->quote($a_pname, "text") . ")";
726 
727  $ilDB->manipulate($q);
728  }
global $DIC
Definition: goto.php:24
global $ilDB
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ deactivate()

ilPlugin::deactivate ( )

Deactivate.

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

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

976  {
977  global $DIC;
978  $ilDB = $DIC->database();
979 
981 
982  $result = true;
983 
984  $q = "UPDATE il_plugin SET active = " . $ilDB->quote(0, "integer") .
985  " WHERE component_type = " . $ilDB->quote($this->getComponentType(), "text") .
986  " AND component_name = " . $ilDB->quote($this->getComponentName(), "text") .
987  " AND slot_id = " . $ilDB->quote($this->getSlotId(), "text") .
988  " AND name = " . $ilDB->quote($this->getPluginName(), "text");
989 
990  $ilDB->manipulate($q);
991  $this->afterDeactivation();
992 
993  return $result;
994  }
$result
getComponentName()
Get Component Name.
getComponentType()
Get Component Type.
global $DIC
Definition: goto.php:24
getSlotId()
Get Slot ID.
global $ilDB
getPluginName()
Get Plugin Name.
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 1439 of file class.ilPlugin.php.

1439  : Closure
1440  {
1441  //This returns the callable of $c[$key] without executing it.
1442  return $dic->raw($dic_key);
1443  }
$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 1414 of file class.ilPlugin.php.

1414  : Closure
1415  {
1416  //This returns the callable of $c['ui.renderer'] without executing it.
1417  return $dic->raw('ui.renderer');
1418  }
$dic
Definition: result.php:13

◆ getActive()

ilPlugin::getActive ( )
Returns
bool

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

References $active.

231  : bool
232  {
233  return $this->active;
234  }

◆ 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 1278 of file class.ilPlugin.php.

References $DIC, and ilCachedComponentData\getInstance().

Referenced by ilOrgUnitExtension\__construct().

1278  : array
1279  {
1280  global $DIC;
1281  $ilPluginAdmin = $DIC['ilPluginAdmin'];
1282 
1283  $plugins = array();
1284  $cached_component = ilCachedComponentData::getInstance();
1285  $lookupActivePluginsBySlotId = $cached_component->lookupActivePluginsBySlotId($a_slot_id);
1286  foreach ($lookupActivePluginsBySlotId as $rec) {
1287  if ($ilPluginAdmin->isActive($a_ctype, $a_cname, $a_slot_id, $rec["name"])) {
1288  $plugins[] = $rec["plugin_id"];
1289  }
1290  }
1291 
1292  return $plugins;
1293  }
global $DIC
Definition: goto.php:24
+ 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 1249 of file class.ilPlugin.php.

References $DIC, and ilCachedComponentData\getInstance().

Referenced by ilPluginAdmin\getActivePluginsForSlot().

1249  : array
1250  {
1251  global $DIC;
1252  $ilPluginAdmin = $DIC['ilPluginAdmin'];
1253 
1254  $plugins = array();
1255 
1256  $cached_component = ilCachedComponentData::getInstance();
1257 
1258  $lookupActivePluginsBySlotId = $cached_component->lookupActivePluginsBySlotId($a_slot_id);
1259  foreach ($lookupActivePluginsBySlotId as $rec) {
1260  if ($ilPluginAdmin->isActive($a_ctype, $a_cname, $a_slot_id, $rec["name"])) {
1261  $plugins[] = $rec["name"];
1262  }
1263  }
1264 
1265  return $plugins;
1266  }
global $DIC
Definition: goto.php:24
+ 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 343 of file class.ilPlugin.php.

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

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

◆ getClassesDirectory()

ilPlugin::getClassesDirectory ( )
protected
Returns
string

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

References getDirectory().

Referenced by includeClass().

316  : string
317  {
318  return $this->getDirectory() . "/classes";
319  }
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 407 of file class.ilPlugin.php.

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

407  : string
408  {
409  return "il" . $plugin_data["name"] . "ConfigGUI";
410  }
+ 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 430 of file class.ilPlugin.php.

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

430  : string
431  {
432  return "Customizing/global/plugins/" . $a_ctype . "/" . $a_cname . "/" .
433  $a_slot_name . "/" . $a_pname . "/sql/dbupdate.php";
434  }
+ Here is the caller graph for this function:

◆ getDBVersion()

ilPlugin::getDBVersion ( )
Returns
int

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

References $dbversion.

Referenced by writeDBVersion().

267  : int
268  {
269  return $this->dbversion;
270  }
+ Here is the caller graph for this function:

◆ getDirectory()

ilPlugin::getDirectory ( )

Get Plugin Directory.

Returns
object Plugin Slot

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

References getPluginName(), and getSlotObject().

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

298  : string
299  {
300  return $this->getSlotObject()->getPluginsDirectory() . "/" . $this->getPluginName();
301  }
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 1389 of file class.ilPlugin.php.

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

1390  {
1392  $this->provider_collection->setMainBarProvider($this->promoteGlobalScreenProvider());
1393  }
1394 
1396  }
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 213 of file class.ilPlugin.php.

References $iliasmaxversion.

214  {
215  return $this->iliasmaxversion;
216  }

◆ getIliasMinVersion()

ilPlugin::getIliasMinVersion ( )
Returns
string

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

References $iliasminversion.

193  : string
194  {
195  return $this->iliasminversion;
196  }

◆ getImagePath()

ilPlugin::getImagePath ( string  $a_img)

Get image path.

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

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

662  : string
663  {
664  return self::_getImagePath(
665  $this->getComponentType(),
666  $this->getComponentName(),
667  $this->getSlotId(),
668  $this->getPluginName(),
669  $a_img
670  );
671  }
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 334 of file class.ilPlugin.php.

References getDirectory().

Referenced by updateLanguages().

334  : string
335  {
336  return $this->getDirectory() . "/lang";
337  }
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 157 of file class.ilPlugin.php.

References $lastupdateversion.

157  : string
158  {
160  }

◆ getMessage()

ilPlugin::getMessage ( )
Returns
string

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

Referenced by ilObjComponentSettingsGUI\update().

1449  : string
1450  {
1451  return strval($this->message);
1452  }
+ Here is the caller graph for this function:

◆ 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 1185 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(), ilComponentPluginLanguageUpdatedObjective\achieve(), ilComponentActivatePluginsObjective\achieve(), ilComponentInstallPluginObjective\achieve(), ilComponentUpdatePluginObjective\achieve(), 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().

1185  : ilPlugin
1186  {
1187  $slot_name = ilPluginSlot::lookupSlotName($a_ctype, $a_cname, $a_slot_id);
1188 
1189  $cached_component = ilCachedComponentData::getInstance();
1190  $rec = $cached_component->lookCompId($a_ctype, $a_cname);
1191  if (!$rec) {
1192  return null;
1193  }
1194 
1195  $file = "./Customizing/global/plugins/" . $a_ctype . "/" .
1196  $a_cname . "/" . $slot_name . "/" .
1197  $a_pname . "/classes/class.il" . $a_pname . "Plugin.php";
1198 
1199  if (is_file($file)) {
1200  include_once($file);
1201  $class = "il" . $a_pname . "Plugin";
1202  $plugin = new $class();
1203 
1204  return $plugin;
1205  }
1206  throw new ilPluginException("File : ".$file. " . does not Exist for plugin: ".$a_pname. " Check if your
1207  plugin is still marked as active in the DB Table 'il_plugin' but not installed anymore.");
1208  }
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 740 of file class.ilPlugin.php.

References ilCachedComponentData\getInstance().

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

740  : array
741  {
742  $cached_component = ilCachedComponentData::getInstance();
743  $rec = $cached_component->lookupPluginByName($a_pname);
744 
745  if ($rec['component_type'] == $a_ctype and $rec['component_name'] == $a_cname and $rec['slot_id'] == $a_slot_id) {
746  return $rec;
747  } else {
748  throw new ilPluginException("No plugin record found for '{$a_ctype}', '{$a_cname}', '{$a_slot_id}', '{$a_pname}");
749  }
750  }
+ 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 416 of file class.ilPlugin.php.

References getId(), and getSlotObject().

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

416  : string
417  {
418  return $this->getSlotObject()->getPrefix() . "_" . $this->getId();
419  }
+ 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 249 of file class.ilPlugin.php.

References $slot.

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

249  : ilPluginSlot
250  {
251  return $this->slot;
252  }
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 679 of file class.ilPlugin.php.

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

679  : string
680  {
681  $d2 = ilComponent::lookupId($this->getComponentType(), $this->getComponentName()) . "_" . $this->getSlotId() . "_" .
683 
684  $css = ilUtil::getStyleSheetLocation("output", $a_css_file, $d2);
685  if (is_int(strpos($css, "Customizing"))) {
686  return $css;
687  }
688 
689  return $this->getDirectory() . "/templates/" . $a_css_file;
690  }
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 440 of file class.ilPlugin.php.

References getPrefix().

Referenced by updateDatabase().

441  {
442  return $this->getPrefix();
443  }
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 619 of file class.ilPlugin.php.

References getDirectory().

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

◆ getVersion()

ilPlugin::getVersion ( )
Returns
string

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

References $version.

Referenced by update().

175  : string
176  {
177  return $this->version;
178  }
+ 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 384 of file class.ilPlugin.php.

References ILIAS_VERSION_NUMERIC, and ilComponent\isVersionGreaterString().

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

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

References getClassesDirectory().

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

326  {
327  include_once($this->getClassesDirectory() . "/" . $a_class_file_name);
328  }
+ 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 845 of file class.ilPlugin.php.

Referenced by __init().

846  {
847  }
+ Here is the caller graph for this function:

◆ install()

ilPlugin::install ( )

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

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

885  {
886  global $DIC;
887  $ilDB = $DIC->database();
888 
890  $q = "UPDATE il_plugin SET plugin_id = " . $ilDB->quote($this->getId(), "text") .
891  " WHERE component_type = " . $ilDB->quote($this->getComponentType(), "text") .
892  " AND component_name = " . $ilDB->quote($this->getComponentName(), "text") .
893  " AND slot_id = " . $ilDB->quote($this->getSlotId(), "text") .
894  " AND name = " . $ilDB->quote($this->getPluginName(), "text");
895 
896  $ilDB->manipulate($q);
897  $this->afterInstall();
898  }
getComponentName()
Get Component Name.
getComponentType()
Get Component Type.
afterInstall()
After install processing.
global $DIC
Definition: goto.php:24
getSlotId()
Get Slot ID.
global $ilDB
getPluginName()
Get Plugin Name.
+ Here is the call graph for this function:

◆ isActive()

ilPlugin::isActive ( )

Check whether plugin is active.

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

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

854  {
855  global $DIC;
856  $ilPluginAdmin = $DIC['ilPluginAdmin'];
857 
858  return $ilPluginAdmin->isActive(
859  $this->getComponentType(),
860  $this->getComponentName(),
861  $this->getSlotId(),
862  $this->getPluginName()
863  );
864  }
getComponentName()
Get Component Name.
getComponentType()
Get Component Type.
global $DIC
Definition: goto.php:24
getSlotId()
Get Slot ID.
getPluginName()
Get Plugin Name.
+ Here is the call 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 598 of file class.ilPlugin.php.

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

Referenced by ilObjectRolePermissionTableGUI\fillRow().

598  : bool
599  {
600  global $DIC;
601  $lng = $DIC->language();
602 
603  $pl = ilObjectPlugin::getPluginObjectByType($pluginId);
604  $pl->loadLanguageModule();
605 
606  return $lng->exists($pl->getPrefix() . "_" . $langVar);
607  }
static getPluginObjectByType($type)
Return either a repoObject plugin or a orgunit extension plugin or null if the type is not a plugin...
$lng
global $DIC
Definition: goto.php:24
+ 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 546 of file class.ilPlugin.php.

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

Referenced by __init(), and txt().

547  {
548  global $DIC;
549  $lng = $DIC->language();
550 
551  if (!$this->lang_initialised && is_object($lng)) {
552  $lng->loadLanguageModule($this->getPrefix());
553  $this->lang_initialised = true;
554  }
555  }
$lng
global $DIC
Definition: goto.php:24
getPrefix()
Get plugin prefix, used for lang vars.
+ 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 1330 of file class.ilPlugin.php.

References $DIC, and $ilDB.

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

1330  : string
1331  {
1332  global $DIC;
1333  $ilDB = $DIC->database();
1334 
1335  $q = "SELECT plugin_id FROM il_plugin " .
1336  " WHERE component_type = " . $ilDB->quote($a_ctype, "text") .
1337  " AND component_name = " . $ilDB->quote($a_cname, "text") .
1338  " AND slot_id = " . $ilDB->quote($a_slot_id, "text") .
1339  " AND name = " . $ilDB->quote($a_plugin_name, "text");
1340 
1341  $set = $ilDB->query($q);
1342  if ($rec = $ilDB->fetchAssoc($set)) {
1343  return $rec["plugin_id"];
1344  }
1345  }
global $DIC
Definition: goto.php:24
global $ilDB
+ 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 1304 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().

1305  {
1306  global $DIC;
1307  $ilDB = $DIC->database();
1308 
1309  $q = "SELECT name FROM il_plugin " .
1310  " WHERE component_type = " . $ilDB->quote($a_ctype, "text") .
1311  " AND component_name = " . $ilDB->quote($a_cname, "text") .
1312  " AND slot_id = " . $ilDB->quote($a_slot_id, "text") .
1313  " AND plugin_id = " . $ilDB->quote($a_plugin_id, "text");
1314 
1315  $set = $ilDB->query($q);
1316  if ($rec = $ilDB->fetchAssoc($set)) {
1317  return $rec["name"];
1318  }
1319  }
global $DIC
Definition: goto.php:24
global $ilDB
+ 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 1221 of file class.ilPlugin.php.

References $DIC, and $ilDB.

Referenced by ilPluginSlot\readPluginInformation().

1221  : array
1222  {
1223  global $DIC;
1224  $ilDB = $DIC->database();
1225 
1226  $q = "SELECT * FROM il_plugin WHERE" .
1227  " component_type = " . $ilDB->quote($a_ctype, "text") . " AND" .
1228  " component_name = " . $ilDB->quote($a_cname, "text") . " AND" .
1229  " slot_id = " . $ilDB->quote($a_slot_id, "text") . " AND" .
1230  " name = " . $ilDB->quote($a_pname, "text");
1231 
1232  $set = $ilDB->query($q);
1233 
1234  if ($ilDB->numRows($set) == 0) {
1235  return array();
1236  }
1237 
1238  return $ilDB->fetchAssoc($set);
1239  }
global $DIC
Definition: goto.php:24
global $ilDB
+ 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 578 of file class.ilPlugin.php.

References $DIC, and $lng.

578  : string
579  {
580  global $DIC;
581  $lng = $DIC->language();
582 
583  // this enables default language fallback
584  $prefix = $a_mod_prefix . "_" . $a_pl_id;
585 
586  return $lng->txt($prefix . "_" . $a_lang_var, $prefix);
587  }
$lng
global $DIC
Definition: goto.php:24

◆ lookupTypeInformationsForId()

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

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

References $DIC, and $ilDB.

Referenced by ilObjectPlugin\getPluginObjectByType().

1354  {
1355  global $DIC;
1356  $ilDB = $DIC->database();
1357 
1358  $q = "SELECT component_type, component_name, slot_id FROM il_plugin "
1359  . " WHERE plugin_id = " . $ilDB->quote($id, "text");
1360 
1361  $set = $ilDB->query($q);
1362  if ($rec = $ilDB->fetchAssoc($set)) {
1363  return [
1364  $rec["component_type"],
1365  $rec["component_name"],
1366  $rec["slot_id"],
1367  ];
1368  }
1369  }
global $DIC
Definition: goto.php:24
global $ilDB
+ Here is the caller graph for this function:

◆ needsUpdate()

ilPlugin::needsUpdate ( )

Check whether update is needed.

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

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

Referenced by activate().

871  {
872  global $DIC;
873  $ilPluginAdmin = $DIC['ilPluginAdmin'];
874 
875  return $ilPluginAdmin->needsUpdate(
876  $this->getComponentType(),
877  $this->getComponentName(),
878  $this->getSlotId(),
879  $this->getPluginName()
880  );
881  }
getComponentName()
Get Component Name.
getComponentType()
Get Component Type.
global $DIC
Definition: goto.php:24
getSlotId()
Get Slot ID.
getPluginName()
Get Plugin Name.
+ 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 1378 of file class.ilPlugin.php.

References $DIC.

Referenced by getGlobalScreenProviderCollection().

1379  {
1380  global $DIC;
1381 
1382  return new ilPluginGlobalScreenNullProvider($DIC, $this);
1383  }
Class ilPluginGlobalScreenNullProvider.
global $DIC
Definition: goto.php:24
+ 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 1128 of file class.ilPlugin.php.

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

Referenced by update().

1129  {
1130  $reader = new ilPluginReader(
1131  $this->getDirectory() . '/plugin.xml',
1132  $this->getComponentType(),
1133  $this->getComponentName(),
1134  $this->getSlotId(),
1135  $this->getPluginName()
1136  );
1137  $reader->clearEvents();
1138  $reader->startParsing();
1139  }
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 222 of file class.ilPlugin.php.

Referenced by __init().

223  {
224  $this->active = $a_active;
225  }
+ Here is the caller graph for this function:

◆ setDBVersion()

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

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

Referenced by __init(), and writeDBVersion().

259  {
260  $this->dbversion = $a_dbversion;
261  }
+ Here is the caller graph for this function:

◆ setId()

ilPlugin::setId (   $a_id)
private

Set Id.

Parameters
string$a_idId

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

Referenced by __init().

127  {
128  $this->id = $a_id;
129  }
+ Here is the caller graph for this function:

◆ setIliasMaxVersion()

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

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

Referenced by __init().

203  {
204  $this->iliasmaxversion = $a_iliasmaxversion;
205  }
+ Here is the caller graph for this function:

◆ setIliasMinVersion()

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

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

Referenced by __init().

185  {
186  $this->iliasminversion = $a_iliasminversion;
187  }
+ 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 146 of file class.ilPlugin.php.

Referenced by __init().

147  {
148  $this->lastupdateversion = $a_lastupdateversion;
149  }
+ Here is the caller graph for this function:

◆ setSlotObject()

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

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

Referenced by __init().

241  {
242  $this->slot = $a_slot;
243  }
+ Here is the caller graph for this function:

◆ setVersion()

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

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

Referenced by __init().

167  {
168  $this->version = $a_version;
169  }
+ 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 561 of file class.ilPlugin.php.

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

Referenced by ilTestExportPlugin\getFormat().

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

◆ uninstall()

ilPlugin::uninstall ( )
final

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

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

1014  {
1015  global $DIC;
1016  $ilDB = $DIC->database();
1017 
1018  if ($this->beforeUninstall()) {
1019  // remove all language entries (see ilObjLanguage)
1020  // see updateLanguages
1021  $prefix = $this->getPrefix();
1022  if ($prefix) {
1023  $ilDB->manipulate(
1024  "DELETE FROM lng_data" .
1025  " WHERE module = " . $ilDB->quote($prefix, "text")
1026  );
1027  $ilDB->manipulate(
1028  "DELETE FROM lng_modules" .
1029  " WHERE module = " . $ilDB->quote($prefix, "text")
1030  );
1031  }
1032 
1033  $this->clearEventListening();
1034 
1035  // db version is kept in il_plugin - will be deleted, too
1036 
1037  $q = "DELETE FROM il_plugin" .
1038  " WHERE component_type = " . $ilDB->quote($this->getComponentType(), "text") .
1039  " AND component_name = " . $ilDB->quote($this->getComponentName(), "text") .
1040  " AND slot_id = " . $ilDB->quote($this->getSlotId(), "text") .
1041  " AND name = " . $ilDB->quote($this->getPluginName(), "text");
1042  $ilDB->manipulate($q);
1043 
1044  $ilDB->manipulateF('DELETE FROM ctrl_classfile WHERE comp_prefix=%s', [ilDBConstants::T_TEXT], [$this->getPrefix()]);
1045  $ilDB->manipulateF('DELETE FROM ctrl_calls WHERE comp_prefix=%s', [ilDBConstants::T_TEXT], [$this->getPrefix()]);
1046 
1047  $this->afterUninstall();
1048 
1050 
1051  return true;
1052  }
1053 
1054  return false;
1055  }
afterUninstall()
This is Plugin-Specific and is triggered after the uninstall command of a plugin. ...
getComponentName()
Get Component Name.
getComponentType()
Get Component Type.
global $DIC
Definition: goto.php:24
getPrefix()
Get plugin prefix, used for lang vars.
getSlotId()
Get Slot ID.
global $ilDB
getPluginName()
Get Plugin Name.
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 1069 of file class.ilPlugin.php.

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

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

1070  {
1071  global $DIC;
1072  $ilDB = $DIC->database();
1073  $ilCtrl = $DIC->ctrl();
1074 
1075  ilGlobalCache::flushAll();
1076 
1077  $result = $this->beforeUpdate();
1078  if ($result === false) {
1079  return false;
1080  }
1081 
1082  // Load language files
1083  $this->updateLanguages();
1084 
1085  // DB update
1086  if ($result === true) {
1087  $result = $this->updateDatabase();
1088  }
1089 
1090  // load control structure
1091  $structure_reader = new ilCtrlStructureReader();
1092  $structure_reader->readStructure(
1093  true,
1094  "./" . $this->getDirectory(),
1095  $this->getPrefix(),
1096  $this->getDirectory()
1097  );
1098 
1099  // add config gui to the ctrl calls
1100  $ilCtrl->insertCtrlCalls(
1101  "ilobjcomponentsettingsgui",
1102  ilPlugin::getConfigureClassName(["name" => $this->getPluginName()]),
1103  $this->getPrefix()
1104  );
1105 
1106  $this->readEventListening();
1107 
1108  // set last update version to current version
1109  if ($result === true) {
1110  $q = "UPDATE il_plugin SET last_update_version = " . $ilDB->quote($this->getVersion(), "text") .
1111  " WHERE component_type = " . $ilDB->quote($this->getComponentType(), "text") .
1112  " AND component_name = " . $ilDB->quote($this->getComponentName(), "text") .
1113  " AND slot_id = " . $ilDB->quote($this->getSlotId(), "text") .
1114  " AND name = " . $ilDB->quote($this->getPluginName(), "text");
1115 
1116  $ilDB->manipulate($q);
1117  $this->afterUpdate();
1118  }
1119  ilGlobalCache::flushAll();
1120 
1121  return $result;
1122  }
$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.
getComponentType()
Get Component Type.
updateDatabase()
Update database.
getDirectory()
Get Plugin Directory.
global $DIC
Definition: goto.php:24
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.
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 508 of file class.ilPlugin.php.

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

Referenced by update().

509  {
510  global $DIC;
511  $ilDB = $DIC->database();
512  $lng = $DIC->language();
513 
514  ilGlobalCache::flushAll();
515 
516  $dbupdate = new ilPluginDBUpdate(
517  $this->getComponentType(),
518  $this->getComponentName(),
519  $this->getSlotId(),
520  $this->getPluginName(),
521  $ilDB,
522  true,
523  $this->getTablePrefix()
524  );
525 
526  $result = $dbupdate->applyUpdate();
527  $message = '';
528  if ($dbupdate->updateMsg == "no_changes") {
529  $message = $lng->txt("no_changes") . ". " . $lng->txt("database_is_uptodate");
530  } else {
531  foreach ($dbupdate->updateMsg as $row) {
532  $message .= $lng->txt($row["msg"]) . ": " . $row["nr"] . "<br/>";
533  }
534  }
535 
536  $this->message .= $message;
537  ilGlobalCache::flushAll();
538 
539  return $result;
540  }
getTablePrefix()
Get db table plugin prefix.
$result
Database Update class.
getComponentName()
Get Component Name.
getComponentType()
Get Component Type.
$lng
global $DIC
Definition: goto.php:24
getSlotId()
Get Slot ID.
global $ilDB
getPluginName()
Get Plugin Name.
+ 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 451 of file class.ilPlugin.php.

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

Referenced by update().

452  {
453  ilGlobalCache::flushAll();
454 
455  // get the keys of all installed languages if keys are not provided
456  if (!isset($a_lang_keys)) {
457  $a_lang_keys = array();
458  foreach (ilObjLanguage::getInstalledLanguages() as $langObj) {
459  if ($langObj->isInstalled()) {
460  $a_lang_keys[] = $langObj->getKey();
461  }
462  }
463  }
464 
465  $langs = $this->getAvailableLangFiles($this->getLanguageDirectory());
466 
467  $prefix = $this->getPrefix();
468 
469  foreach ($langs as $lang) {
470  // check if the language should be updated, otherwise skip it
471  if (!in_array($lang['key'], $a_lang_keys)) {
472  continue;
473  }
474 
475  $txt = file($this->getLanguageDirectory() . "/" . $lang["file"]);
476  $lang_array = array();
477 
478  // get locally changed variables of the module (these should be kept)
479  $local_changes = ilObjLanguage::_getLocalChangesByModule($lang['key'], $prefix);
480 
481  // get language data
482  if (is_array($txt)) {
483  foreach ($txt as $row) {
484  if ($row[0] != "#" && strpos($row, "#:#") > 0) {
485  $a = explode("#:#", trim($row));
486  $identifier = $prefix . "_" . trim($a[0]);
487  $value = trim($a[1]);
488 
489  if (isset($local_changes[$identifier])) {
490  $lang_array[$identifier] = $local_changes[$identifier];
491  } else {
492  $lang_array[$identifier] = $value;
493  ilObjLanguage::replaceLangEntry($prefix, $identifier, $lang["key"], $value);
494  }
495  //echo "<br>-$prefix-".$prefix."_".trim($a[0])."-".$lang["key"]."-";
496  }
497  }
498  }
499 
500  ilObjLanguage::replaceLangModule($lang["key"], $prefix, $lang_array);
501  }
502  }
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 276 of file class.ilPlugin.php.

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

277  {
278  global $DIC;
279  $ilDB = $DIC->database();
280 
281  $this->setDBVersion($a_dbversion);
282 
283  $q = "UPDATE il_plugin SET db_version = " . $ilDB->quote((int) $this->getDBVersion(), "integer") .
284  " WHERE component_type = " . $ilDB->quote($this->getComponentType(), "text") .
285  " AND component_name = " . $ilDB->quote($this->getComponentName(), "text") .
286  " AND slot_id = " . $ilDB->quote($this->getSlotId(), "text") .
287  " AND name = " . $ilDB->quote($this->getPluginName(), "text");
288 
289  $ilDB->manipulate($q);
290  }
getComponentName()
Get Component Name.
getComponentType()
Get Component Type.
setDBVersion(int $a_dbversion)
global $DIC
Definition: goto.php:24
getSlotId()
Get Slot ID.
global $ilDB
getPluginName()
Get Plugin Name.
+ 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().

◆ $message

ilPlugin::$message
protected

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

Referenced by updateDatabase().

◆ $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: