ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
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 ( )

Reimplemented in ilRepositoryObjectPlugin.

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

60 {
61 $this->__init();
62 $this->provider_collection = new PluginProviderCollection();
63 }
__init()
Default initialization.

References __init().

+ 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.

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 }
setDBVersion(int $a_dbversion)
setActive(bool $a_active)
static getPluginRecord(string $a_ctype, string $a_cname, string $a_slot_id, string $a_pname)
getSlotId()
Get Slot ID.
setId($a_id)
Set Id.
setIliasMinVersion(string $a_iliasminversion)
init()
Object initialization.
getPluginName()
Get Plugin Name.
getComponentName()
Get Component Name.
setSlotObject(ilPluginSlot $a_slot)
loadLanguageModule()
Load language module for plugin.
setLastUpdateVersion(string $a_lastupdateversion)
Set Version of last update.
slotInit()
Object initialization done by slot.
setVersion(string $a_version)
getComponentType()
Get Component Type.
setIliasMaxVersion(string $a_iliasmaxversion)
$DIC
Definition: xapitoken.php:46

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

Referenced by __construct().

+ 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.

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.

References ilPluginSlot\_getPluginsDirectory().

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

+ 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.

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 _getDirectory(string $a_ctype, string $a_cname, string $a_slot_id, string $a_pname)
Get plugin directory.
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)
for( $i=6;$i< 13;$i++) for($i=1; $i< 13; $i++) $d
Definition: date.php:296

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

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

+ 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.

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
needsUpdate()
Check whether update is needed.
afterActivation()
After activation processing.
update()
Update plugin.
beforeActivation()
Before activation processing.
global $ilDB

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

+ 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.

684 {
685 $a_tpl->addBlockFile(
686 $a_var,
687 $a_block,
688 $this->getDirectory() . "/templates/" . $a_tplname
689 );
690 }
getDirectory()
Get Plugin Directory.

References getDirectory().

+ Here is the call graph for this function:

◆ afterActivation()

ilPlugin::afterActivation ( )
protected

After activation processing.

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

955 {
956 }

Referenced by activate().

+ Here is the caller graph for this function:

◆ afterDeactivation()

ilPlugin::afterDeactivation ( )
protected

After deactivation processing.

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

988 {
989 }

Referenced by deactivate().

+ 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.

935 {
936 }

Referenced by install().

+ 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.

1049 {
1050 }

Referenced by uninstall().

+ Here is the caller graph for this function:

◆ afterUpdate()

ilPlugin::afterUpdate ( )
protected

After update processing.

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

1161 {
1162 }

Referenced by update().

+ Here is the caller graph for this function:

◆ beforeActivation()

ilPlugin::beforeActivation ( )
protected

Before activation processing.

Reimplemented in ilRepositoryObjectPlugin.

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

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 }

Referenced by activate().

+ Here is the caller graph for this function:

◆ beforeUninstall()

ilPlugin::beforeUninstall ( )
protected

Reimplemented in ilRepositoryObjectPlugin.

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

993 {
994 // plugin-specific
995 // false would indicate that anything went wrong
996 return true;
997 }

Referenced by uninstall().

+ Here is the caller graph for this function:

◆ beforeUpdate()

ilPlugin::beforeUpdate ( )
protected

Before update processing.

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

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 }

Referenced by update().

+ 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.

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 }
Class ilPluginReader.

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

Referenced by uninstall().

+ 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_pname

@description Create plugin record

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

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 }

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

Referenced by ilPluginSlot\getPluginsInformation().

+ 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.

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 }
afterDeactivation()
After deactivation processing.

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

+ 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(\ILIAS\DI\Container $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

References $dic.

◆ 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(\ILIAS\DI\Container $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 }

References $dic.

◆ getActive()

ilPlugin::getActive ( )
Returns
bool

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

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

References $active.

◆ 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.

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 }

References $DIC, and ilCachedComponentData\getInstance().

+ Here is the call 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.

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 }

References $DIC, and ilCachedComponentData\getInstance().

Referenced by ilPluginAdmin\getActivePluginsForSlot().

+ 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.

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 }

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

+ Here is the caller graph for this function:

◆ getClassesDirectory()

ilPlugin::getClassesDirectory ( )
protected
Returns
string

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

312 : string
313 {
314 return $this->getDirectory() . "/classes";
315 }

References getDirectory().

Referenced by includeClass().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getComponentName()

◆ getComponentType()

◆ 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.

403 : string
404 {
405 return "il" . $plugin_data["name"] . "ConfigGUI";
406 }

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

+ 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.

426 : string
427 {
428 return "Customizing/global/plugins/" . $a_ctype . "/" . $a_cname . "/" .
429 $a_slot_name . "/" . $a_pname . "/sql/dbupdate.php";
430 }

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

+ Here is the caller graph for this function:

◆ getDBVersion()

ilPlugin::getDBVersion ( )
Returns
int

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

263 : int
264 {
265 return $this->dbversion;
266 }

References $dbversion.

Referenced by writeDBVersion().

+ 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.

294 : string
295 {
296 return $this->getSlotObject()->getPluginsDirectory() . "/" . $this->getPluginName();
297 }

References getPluginName(), and getSlotObject().

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

+ 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.

1377 {
1379 $this->provider_collection->setMainBarProvider($this->promoteGlobalScreenProvider());
1380 }
1381
1383 }
setMainBarProvider(AbstractStaticMainMenuPluginProvider $static_mai_menu_provider)
promoteGlobalScreenProvider()

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

+ Here is the call graph for this function:

◆ getId()

ilPlugin::getId ( )

◆ getIliasMaxVersion()

ilPlugin::getIliasMaxVersion ( )

Get Required ILIAS max.

release.

Returns
string Required ILIAS max. release

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

210 {
212 }

References $iliasmaxversion.

◆ getIliasMinVersion()

ilPlugin::getIliasMinVersion ( )
Returns
string

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

189 : string
190 {
192 }

References $iliasminversion.

◆ getImagePath()

ilPlugin::getImagePath ( string  $a_img)

Get image path.

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

649 : string
650 {
651 return self::_getImagePath(
652 $this->getComponentType(),
653 $this->getComponentName(),
654 $this->getSlotId(),
655 $this->getPluginName(),
656 $a_img
657 );
658 }
static _getImagePath(string $a_ctype, string $a_cname, string $a_slot_id, string $a_pname, string $a_img)

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

+ Here is the call graph for this function:

◆ getLanguageDirectory()

ilPlugin::getLanguageDirectory ( )
protected
Returns
string

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

330 : string
331 {
332 return $this->getDirectory() . "/lang";
333 }

References getDirectory().

Referenced by updateLanguages().

+ 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.

153 : string
154 {
156 }

References $lastupdateversion.

◆ getPluginName()

ilPlugin::getPluginName ( )
abstract

Get Plugin Name.

Must be same as in class name il<Name>Plugin and must correspond to plugins subdirectory name.

Must be overwritten in plugin class of plugin

Returns
string Plugin Name

Reimplemented in ExamplePlugin.

Referenced by __init(), activate(), clearEventListening(), deactivate(), getDirectory(), getImagePath(), ilCloudHookPlugin\getPluginTablePrefix(), ilDclFieldTypePlugin\getPluginTablePrefix(), ilPreviewRendererPlugin\getRendererClassInstance(), getStyleSheetLocation(), ilPageComponentPlugin\getUIClassInstance(), install(), isActive(), needsUpdate(), readEventListening(), uninstall(), update(), updateDatabase(), and writeDBVersion().

+ Here is the caller graph for this function:

◆ 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.

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.
Abstract Class ilPlugin.

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

Referenced by SurveyQuestion\_getQuestionTypeName(), assQuestion\_getQuestionTypeName(), ilObjQuestionPool\_getQuestionTypes(), ilObjSurveyQuestionPool\_getQuestiontypes(), ilObjSurveyQuestionPool\_getQuestionTypeTranslations(), SurveyQuestion\_includeClass(), ilObjComponentSettingsGUI\activatePlugin(), ilObjComponentSettingsGUI\confirmUninstallPlugin(), ilObjComponentSettingsGUI\deactivatePlugin(), ilObjTest\getAvailableQuestions(), ilDclFieldFactory\getClassPathByInstance(), ilDclFieldFactory\getFieldTypeByInstance(), ilOrgUnitExtension\getPlugin(), ilOrgUnitExtensionGUI\getPlugin(), ilOrgUnitExtensionListGUI\getPlugin(), ilObjectPlugin\getPlugin(), ilObjectPluginGUI\getPlugin(), ilObjectPluginListGUI\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().

+ 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.

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 }

References ilCachedComponentData\getInstance().

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

+ 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.

412 : string
413 {
414 return $this->getSlotObject()->getPrefix() . "_" . $this->getId();
415 }

References getId(), and getSlotObject().

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

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getSlot()

◆ getSlotId()

◆ getSlotObject()

ilPlugin::getSlotObject ( )
protected
Returns
ilPluginSlot

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

246 {
247 return $this->slot;
248 }

References $slot.

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

+ 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.

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 getStyleSheetLocation($mode="output", $a_css_name="", $a_css_location="")
get full style sheet file name (path inclusive) of current user

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

+ 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.

437 {
438 return $this->getPrefix();
439 }
getPrefix()
Get plugin prefix, used for lang vars.

References getPrefix().

Referenced by updateDatabase().

+ 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.

615 : ilTemplate
616 {
617 return new ilTemplate($this->getDirectory() . "/templates/" . $a_template, $a_par1, $a_par2);
618 }
special template class to simplify handling of ITX/PEAR

References getDirectory().

+ Here is the call graph for this function:

◆ getVersion()

ilPlugin::getVersion ( )
Returns
string

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

171 : string
172 {
173 return $this->version;
174 }

References $version.

Referenced by update().

+ 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.

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 }
static isVersionGreaterString($a_ver1, $a_ver2)
const ILIAS_VERSION_NUMERIC

References ILIAS_VERSION_NUMERIC, and ilComponent\isVersionGreaterString().

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

+ 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.

322 {
323 include_once($this->getClassesDirectory() . "/" . $a_class_file_name);
324 }

References getClassesDirectory().

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

+ 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.

833 {
834 }

Referenced by __init().

+ Here is the caller graph for this function:

◆ install()

ilPlugin::install ( )

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

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 }
afterInstall()
After install processing.

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

+ 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.

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 }

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

Referenced by ExamplePlugin\exchangeUIRendererAfterInitialization().

+ 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.

594 : bool
595 {
596 global $DIC;
597 $lng = $DIC->language();
598
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

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

Referenced by ilObjectRolePermissionTableGUI\fillRow().

+ 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.

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 }

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

Referenced by __init(), and txt().

+ 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.

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 }

References $DIC, and $ilDB.

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

+ 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.

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 }

References $DIC, and $ilDB.

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

+ 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.

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 }

References $DIC, and $ilDB.

Referenced by ilPluginSlot\getPluginsInformation().

+ 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.

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 }

References $DIC, and $lng.

◆ lookupTypeInformationsForId()

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

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

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 }

References $DIC, $id, and $ilDB.

Referenced by ilObjectPlugin\getPluginObjectByType().

+ 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.

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 }

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

Referenced by activate().

+ 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().

+ 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.

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 }

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

Referenced by update().

+ 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.

219 {
220 $this->active = $a_active;
221 }

Referenced by __init().

+ 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.

255 {
256 $this->dbversion = $a_dbversion;
257 }

Referenced by __init(), and writeDBVersion().

+ 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.

123 {
124 $this->id = $a_id;
125 }

Referenced by __init().

+ 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.

199 {
200 $this->iliasmaxversion = $a_iliasmaxversion;
201 }

Referenced by __init().

+ 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.

181 {
182 $this->iliasminversion = $a_iliasminversion;
183 }

Referenced by __init().

+ 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.

143 {
144 $this->lastupdateversion = $a_lastupdateversion;
145 }

Referenced by __init().

+ 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.

237 {
238 $this->slot = $a_slot;
239 }

Referenced by __init().

+ 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.

163 {
164 $this->version = $a_version;
165 }

Referenced by __init().

+ Here is the caller graph for this function:

◆ slotInit()

◆ txt()

ilPlugin::txt ( string  $a_var)

Get Language Variable (prefix will be prepended automatically)

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

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 }

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

+ Here is the call graph for this function:

◆ uninstall()

ilPlugin::uninstall ( )
final

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

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 }
clearEventListening()
Clear the entries of this plugin in the event handling table.
afterUninstall()
This is Plugin-Specific and is triggered after the uninstall command of a plugin.

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

+ Here is the call graph for this function:

◆ update()

ilPlugin::update ( )

Update plugin.

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

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 }
Class ilCtrlStructureReader.
readEventListening()
Read the event listening definitions from the plugin.xml (if file exists)
updateLanguages($a_lang_keys=null)
afterUpdate()
After update processing.
beforeUpdate()
Before update processing.
static getConfigureClassName(array $plugin_data)
Get plugin configure class name.
updateDatabase()
Update database.
global $ilCtrl
Definition: ilias.php:18

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

Referenced by activate().

+ 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.

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 }
Database Update class.
getTablePrefix()
Get db table plugin prefix.
$message
Definition: xapiexit.php:14

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

Referenced by update().

+ 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.

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 _getLocalChangesByModule($a_key, $a_module)
Get the local changes of a language module.
static getInstalledLanguages()
Get the language objects of the installed languages.
static replaceLangEntry( $a_module, $a_identifier, $a_lang_key, $a_value, $a_local_change=null, $a_remarks=null)
Replace lang entry.
static getAvailableLangFiles(string $a_lang_directory)
Get array of all language files in the plugin.
getLanguageDirectory()
$txt
Definition: error.php:13
$a
thx to https://mlocati.github.io/php-cs-fixer-configurator for the examples
$lang
Definition: xapiexit.php:8

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

Referenced by update().

+ 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.

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 }

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

+ 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: