ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
ilPlugin Class Reference
+ 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 ()
 

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 = ''
 

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

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

Constructor & Destructor Documentation

◆ __construct()

ilPlugin::__construct ( )

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

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

56  {
57  $this->__init();
58  }
__init()
Default initialization.
+ Here is the call graph for this function:

Member Function Documentation

◆ __init()

ilPlugin::__init ( )
private

Default initialization.

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

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

References ilPluginSlot\_getPluginsDirectory().

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

298  : string
299  {
300  return ilPluginSlot::_getPluginsDirectory($a_ctype, $a_cname, $a_slot_id) . "/" . $a_pname;
301  }
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 622 of file class.ilPlugin.php.

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

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

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

◆ activate()

ilPlugin::activate ( )

Activate.

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

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

884  {
885  global $DIC;
886  $ilDB = $DIC->database();
887 
889 
890  $result = true;
891 
892  // check whether update is necessary
893  if ($this->needsUpdate()) {
894  //$result = $this->isUpdatePossible();
895 
896  // do update
897  if ($result === true) {
898  $result = $this->update();
899  }
900  }
901  if ($result === true) {
902  $result = $this->beforeActivation();
903  // activate plugin
904  if ($result === true) {
905  $q = "UPDATE il_plugin SET active = " . $ilDB->quote(1, "integer") .
906  " WHERE component_type = " . $ilDB->quote($this->getComponentType(), "text") .
907  " AND component_name = " . $ilDB->quote($this->getComponentName(), "text") .
908  " AND slot_id = " . $ilDB->quote($this->getSlotId(), "text") .
909  " AND name = " . $ilDB->quote($this->getPluginName(), "text");
910 
911  $ilDB->manipulate($q);
912  $this->afterActivation();
913  }
914  }
916 
917  return $result;
918  }
$result
global $DIC
Definition: saml.php:7
update()
Update plugin.
needsUpdate()
Check whether update is needed.
getComponentName()
Get Component Name.
beforeActivation()
Before activation processing.
getComponentType()
Get Component Type.
afterActivation()
After activation processing.
getSlotId()
Get Slot ID.
global $ilDB
getPluginName()
Get Plugin Name.
+ 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 675 of file class.ilPlugin.php.

References getDirectory().

676  {
677  $a_tpl->addBlockFile(
678  $a_var,
679  $a_block,
680  $this->getDirectory() . "/templates/" . $a_tplname
681  );
682  }
getDirectory()
Get Plugin Directory.
+ Here is the call graph for this function:

◆ afterActivation()

ilPlugin::afterActivation ( )
protected

After activation processing.

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

Referenced by activate().

947  {
948  }
+ Here is the caller graph for this function:

◆ afterDeactivation()

ilPlugin::afterDeactivation ( )
protected

After deactivation processing.

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

Referenced by deactivate().

980  {
981  }
+ Here is the caller graph for this function:

◆ afterInstall()

ilPlugin::afterInstall ( )
protected

After install processing.

Returns
void

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

Referenced by install().

927  {
928  }
+ 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 1040 of file class.ilPlugin.php.

Referenced by uninstall().

1041  {
1042  }
+ Here is the caller graph for this function:

◆ afterUpdate()

ilPlugin::afterUpdate ( )
protected

After update processing.

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

Referenced by update().

1154  {
1155  }
+ Here is the caller graph for this function:

◆ beforeActivation()

ilPlugin::beforeActivation ( )
protected

Before activation processing.

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

Referenced by activate().

935  {
936  return true; // false would indicate that anything went wrong
937  // activation would not proceed
938  // throw an exception in this case
939  //throw new ilPluginException($lng->txt(""));
940  }
+ Here is the caller graph for this function:

◆ beforeUninstall()

ilPlugin::beforeUninstall ( )
protected

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

Referenced by uninstall().

985  {
986  // plugin-specific
987  // false would indicate that anything went wrong
988  return true;
989  }
+ Here is the caller graph for this function:

◆ beforeUpdate()

ilPlugin::beforeUpdate ( )
protected

Before update processing.

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

Referenced by update().

1142  {
1143  return true; // false would indicate that anything went wrong
1144  // update would not proceed
1145  // throw an exception in this case
1146  //throw new ilPluginException($lng->txt(""));
1147  }
+ 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 1125 of file class.ilPlugin.php.

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

Referenced by uninstall().

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

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

Referenced by ilPluginSlot\getPluginsInformation().

694  {
695  global $DIC;
696  $ilDB = $DIC->database();
697 
699 
700  $q = "INSERT INTO il_plugin (component_type, component_name, slot_id, name)" .
701  " VALUES (" . $ilDB->quote($a_ctype, "text") . "," .
702  $ilDB->quote($a_cname, "text") . "," .
703  $ilDB->quote($a_slot_id, "text") . "," .
704  $ilDB->quote($a_pname, "text") . ")";
705 
706  $ilDB->manipulate($q);
707  }
global $DIC
Definition: saml.php:7
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 954 of file class.ilPlugin.php.

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

955  {
956  global $DIC;
957  $ilDB = $DIC->database();
958 
960 
961  $result = true;
962 
963  $q = "UPDATE il_plugin SET active = " . $ilDB->quote(0, "integer") .
964  " WHERE component_type = " . $ilDB->quote($this->getComponentType(), "text") .
965  " AND component_name = " . $ilDB->quote($this->getComponentName(), "text") .
966  " AND slot_id = " . $ilDB->quote($this->getSlotId(), "text") .
967  " AND name = " . $ilDB->quote($this->getPluginName(), "text");
968 
969  $ilDB->manipulate($q);
970  $this->afterDeactivation();
971 
972  return $result;
973  }
$result
global $DIC
Definition: saml.php:7
getComponentName()
Get Component Name.
getComponentType()
Get Component Type.
getSlotId()
Get Slot ID.
global $ilDB
getPluginName()
Get Plugin Name.
afterDeactivation()
After deactivation processing.
+ Here is the call graph for this function:

◆ getActive()

ilPlugin::getActive ( )
Returns
bool

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

References $active.

222  : bool
223  {
224  return $this->active;
225  }

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

References $DIC, and ilCachedComponentData\getInstance().

Referenced by ilOrgUnitExtension\__construct().

1259  : array
1260  {
1261  global $DIC;
1262  $ilPluginAdmin = $DIC['ilPluginAdmin'];
1263 
1264  $plugins = array();
1265  $cached_component = ilCachedComponentData::getInstance();
1266  $lookupActivePluginsBySlotId = $cached_component->lookupActivePluginsBySlotId($a_slot_id);
1267  foreach ($lookupActivePluginsBySlotId as $rec) {
1268  if ($ilPluginAdmin->isActive($a_ctype, $a_cname, $a_slot_id, $rec["name"])) {
1269  $plugins[] = $rec["plugin_id"];
1270  }
1271  }
1272 
1273  return $plugins;
1274  }
global $DIC
Definition: saml.php:7
+ 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 1230 of file class.ilPlugin.php.

References $DIC, and ilCachedComponentData\getInstance().

Referenced by ilPluginAdmin\getActivePluginsForSlot().

1230  : array
1231  {
1232  global $DIC;
1233  $ilPluginAdmin = $DIC['ilPluginAdmin'];
1234 
1235  $plugins = array();
1236 
1237  $cached_component = ilCachedComponentData::getInstance();
1238 
1239  $lookupActivePluginsBySlotId = $cached_component->lookupActivePluginsBySlotId($a_slot_id);
1240  foreach ($lookupActivePluginsBySlotId as $rec) {
1241  if ($ilPluginAdmin->isActive($a_ctype, $a_cname, $a_slot_id, $rec["name"])) {
1242  $plugins[] = $rec["name"];
1243  }
1244  }
1245 
1246  return $plugins;
1247  }
global $DIC
Definition: saml.php:7
+ 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 334 of file class.ilPlugin.php.

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

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

◆ getClassesDirectory()

ilPlugin::getClassesDirectory ( )
protected
Returns
string

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

References getDirectory().

Referenced by includeClass().

307  : string
308  {
309  return $this->getDirectory() . "/classes";
310  }
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 395 of file class.ilPlugin.php.

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

395  : string
396  {
397  return "il" . $plugin_data["name"] . "ConfigGUI";
398  }
+ 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 418 of file class.ilPlugin.php.

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

418  : string
419  {
420  return "Customizing/global/plugins/" . $a_ctype . "/" . $a_cname . "/" .
421  $a_slot_name . "/" . $a_pname . "/sql/dbupdate.php";
422  }
+ Here is the caller graph for this function:

◆ getDBVersion()

ilPlugin::getDBVersion ( )
Returns
int

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

References $dbversion.

Referenced by writeDBVersion().

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

◆ getDirectory()

ilPlugin::getDirectory ( )

Get Plugin Directory.

Returns
object Plugin Slot

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

References getPluginName(), and getSlotObject().

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

289  : string
290  {
291  return $this->getSlotObject()->getPluginsDirectory() . "/" . $this->getPluginName();
292  }
getPluginName()
Get Plugin Name.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getId()

◆ getIliasMaxVersion()

ilPlugin::getIliasMaxVersion ( )

Get Required ILIAS max.

release.

Returns
string Required ILIAS max. release

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

References $iliasmaxversion.

205  {
206  return $this->iliasmaxversion;
207  }

◆ getIliasMinVersion()

ilPlugin::getIliasMinVersion ( )
Returns
string

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

References $iliasminversion.

184  : string
185  {
186  return $this->iliasminversion;
187  }

◆ getImagePath()

ilPlugin::getImagePath ( string  $a_img)

Get image path.

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

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

641  : string
642  {
643  return self::_getImagePath(
644  $this->getComponentType(),
645  $this->getComponentName(),
646  $this->getSlotId(),
647  $this->getPluginName(),
648  $a_img
649  );
650  }
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 325 of file class.ilPlugin.php.

References getDirectory().

Referenced by updateLanguages().

325  : string
326  {
327  return $this->getDirectory() . "/lang";
328  }
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 148 of file class.ilPlugin.php.

References $lastupdateversion.

148  : string
149  {
151  }

◆ 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

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

References ilCachedComponentData\getInstance(), and ilPluginSlot\lookupSlotName().

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

1167  {
1168  $slot_name = ilPluginSlot::lookupSlotName($a_ctype, $a_cname, $a_slot_id);
1169 
1170  $cached_component = ilCachedComponentData::getInstance();
1171  $rec = $cached_component->lookCompId($a_ctype, $a_cname);
1172  if (!$rec) {
1173  return null;
1174  }
1175 
1176  $file = "./Customizing/global/plugins/" . $a_ctype . "/" .
1177  $a_cname . "/" . $slot_name . "/" .
1178  $a_pname . "/classes/class.il" . $a_pname . "Plugin.php";
1179 
1180  if (is_file($file)) {
1181  include_once($file);
1182  $class = "il" . $a_pname . "Plugin";
1183  $plugin = new $class();
1184 
1185  return $plugin;
1186  }
1187 
1188  return null;
1189  }
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 719 of file class.ilPlugin.php.

References ilCachedComponentData\getInstance().

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

719  : array
720  {
721  $cached_component = ilCachedComponentData::getInstance();
722  $rec = $cached_component->lookupPluginByName($a_pname);
723 
724  if ($rec['component_type'] == $a_ctype and $rec['component_name'] == $a_cname and $rec['slot_id'] == $a_slot_id) {
725  return $rec;
726  } else {
727  throw new ilPluginException("No plugin record found for '{$a_ctype}', '{$a_cname}', '{$a_slot_id}', '{$a_pname}");
728  }
729  }
+ 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 404 of file class.ilPlugin.php.

References getId(), and getSlotObject().

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

404  : string
405  {
406  return $this->getSlotObject()->getPrefix() . "_" . $this->getId();
407  }
+ 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 240 of file class.ilPlugin.php.

References $slot.

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

240  : ilPluginSlot
241  {
242  return $this->slot;
243  }
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 658 of file class.ilPlugin.php.

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

658  : string
659  {
660  $d2 = ilComponent::lookupId($this->getComponentType(), $this->getComponentName()) . "_" . $this->getSlotId() . "_" .
662 
663  $css = ilUtil::getStyleSheetLocation("output", $a_css_file, $d2);
664  if (is_int(strpos($css, "Customizing"))) {
665  return $css;
666  }
667 
668  return $this->getDirectory() . "/templates/" . $a_css_file;
669  }
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 428 of file class.ilPlugin.php.

References getPrefix().

Referenced by updateDatabase().

429  {
430  return $this->getPrefix();
431  }
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 607 of file class.ilPlugin.php.

References getDirectory().

607  : ilTemplate
608  {
609  return new ilTemplate($this->getDirectory() . "/templates/" . $a_template, $a_par1, $a_par2);
610  }
getDirectory()
Get Plugin Directory.
special template class to simplify handling of ITX/PEAR
+ Here is the call graph for this function:

◆ getVersion()

ilPlugin::getVersion ( )
Returns
string

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

References $version.

Referenced by update().

166  : string
167  {
168  return $this->version;
169  }
+ 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 372 of file class.ilPlugin.php.

References ILIAS_VERSION_NUMERIC, and ilComponent\isVersionGreaterString().

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

372  : bool
373  {
374  // Mantis: 23282: Disable plugin config page for incompatible plugins
375  if (!(ilComponent::isVersionGreaterString($plugin_data["ilias_min_version"], ILIAS_VERSION_NUMERIC)
376  || ilComponent::isVersionGreaterString(ILIAS_VERSION_NUMERIC, $plugin_data["ilias_max_version"])
377  || ilComponent::isVersionGreaterString($plugin_db_data["last_update_version"], $plugin_data["version"]))
378  ) {
379  if (is_file($a_slot_dir . "/" . $plugin_data["name"] . "/classes/class.il" . $plugin_data["name"] . "ConfigGUI.php")) {
380  return true;
381  }
382  }
383 
384  return false;
385  }
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 316 of file class.ilPlugin.php.

References getClassesDirectory().

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

317  {
318  include_once($this->getClassesDirectory() . "/" . $a_class_file_name);
319  }
+ 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 824 of file class.ilPlugin.php.

Referenced by __init().

825  {
826  }
+ Here is the caller graph for this function:

◆ install()

ilPlugin::install ( )

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

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

864  {
865  global $DIC;
866  $ilDB = $DIC->database();
867 
869  $q = "UPDATE il_plugin SET plugin_id = " . $ilDB->quote($this->getId(), "text") .
870  " WHERE component_type = " . $ilDB->quote($this->getComponentType(), "text") .
871  " AND component_name = " . $ilDB->quote($this->getComponentName(), "text") .
872  " AND slot_id = " . $ilDB->quote($this->getSlotId(), "text") .
873  " AND name = " . $ilDB->quote($this->getPluginName(), "text");
874 
875  $ilDB->manipulate($q);
876  $this->afterInstall();
877  }
global $DIC
Definition: saml.php:7
getComponentName()
Get Component Name.
getComponentType()
Get Component Type.
afterInstall()
After install processing.
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 832 of file class.ilPlugin.php.

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

833  {
834  global $DIC;
835  $ilPluginAdmin = $DIC['ilPluginAdmin'];
836 
837  return $ilPluginAdmin->isActive(
838  $this->getComponentType(),
839  $this->getComponentName(),
840  $this->getSlotId(),
841  $this->getPluginName()
842  );
843  }
global $DIC
Definition: saml.php:7
getComponentName()
Get Component Name.
getComponentType()
Get Component Type.
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 586 of file class.ilPlugin.php.

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

Referenced by ilObjectRolePermissionTableGUI\fillRow().

586  : bool
587  {
588  global $DIC;
589  $lng = $DIC->language();
590 
591  $pl = ilObjectPlugin::getPluginObjectByType($pluginId);
592  $pl->loadLanguageModule();
593 
594  return $lng->exists($pl->getPrefix() . "_" . $langVar);
595  }
global $DIC
Definition: saml.php:7
static getPluginObjectByType($type)
Return either a repoObject plugin or a orgunit extension plugin or null if the type is not a plugin...
$lng
+ 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 534 of file class.ilPlugin.php.

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

Referenced by __init(), and txt().

535  {
536  global $DIC;
537  $lng = $DIC->language();
538 
539  if (!$this->lang_initialised && is_object($lng)) {
540  $lng->loadLanguageModule($this->getPrefix());
541  $this->lang_initialised = true;
542  }
543  }
global $DIC
Definition: saml.php:7
$lng
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 1311 of file class.ilPlugin.php.

References $DIC, and $ilDB.

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

1311  : string
1312  {
1313  global $DIC;
1314  $ilDB = $DIC->database();
1315 
1316  $q = "SELECT plugin_id FROM il_plugin " .
1317  " WHERE component_type = " . $ilDB->quote($a_ctype, "text") .
1318  " AND component_name = " . $ilDB->quote($a_cname, "text") .
1319  " AND slot_id = " . $ilDB->quote($a_slot_id, "text") .
1320  " AND name = " . $ilDB->quote($a_plugin_name, "text");
1321 
1322  $set = $ilDB->query($q);
1323  if ($rec = $ilDB->fetchAssoc($set)) {
1324  return $rec["plugin_id"];
1325  }
1326  }
global $DIC
Definition: saml.php:7
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 1285 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().

1286  {
1287  global $DIC;
1288  $ilDB = $DIC->database();
1289 
1290  $q = "SELECT name FROM il_plugin " .
1291  " WHERE component_type = " . $ilDB->quote($a_ctype, "text") .
1292  " AND component_name = " . $ilDB->quote($a_cname, "text") .
1293  " AND slot_id = " . $ilDB->quote($a_slot_id, "text") .
1294  " AND plugin_id = " . $ilDB->quote($a_plugin_id, "text");
1295 
1296  $set = $ilDB->query($q);
1297  if ($rec = $ilDB->fetchAssoc($set)) {
1298  return $rec["name"];
1299  }
1300  }
global $DIC
Definition: saml.php:7
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 1202 of file class.ilPlugin.php.

References $DIC, and $ilDB.

Referenced by ilPluginSlot\getPluginsInformation().

1202  : array
1203  {
1204  global $DIC;
1205  $ilDB = $DIC->database();
1206 
1207  $q = "SELECT * FROM il_plugin WHERE" .
1208  " component_type = " . $ilDB->quote($a_ctype, "text") . " AND" .
1209  " component_name = " . $ilDB->quote($a_cname, "text") . " AND" .
1210  " slot_id = " . $ilDB->quote($a_slot_id, "text") . " AND" .
1211  " name = " . $ilDB->quote($a_pname, "text");
1212 
1213  $set = $ilDB->query($q);
1214 
1215  if ($ilDB->numRows($set) == 0) {
1216  return array();
1217  }
1218 
1219  return $ilDB->fetchAssoc($set);
1220  }
global $DIC
Definition: saml.php:7
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 566 of file class.ilPlugin.php.

References $DIC, and $lng.

566  : string
567  {
568  global $DIC;
569  $lng = $DIC->language();
570 
571  // this enables default language fallback
572  $prefix = $a_mod_prefix . "_" . $a_pl_id;
573 
574  return $lng->txt($prefix . "_" . $a_lang_var, $prefix);
575  }
global $DIC
Definition: saml.php:7
$lng

◆ lookupTypeInformationsForId()

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

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

References $DIC, and $ilDB.

Referenced by ilObjectPlugin\getPluginObjectByType().

1333  {
1334  global $DIC;
1335  $ilDB = $DIC->database();
1336 
1337  $q = "SELECT component_type, component_name, slot_id FROM il_plugin "
1338  . " WHERE plugin_id = " . $ilDB->quote($id, "text")
1339  ;
1340 
1341  $set = $ilDB->query($q);
1342  if ($rec = $ilDB->fetchAssoc($set)) {
1343  return [
1344  $rec["component_type"],
1345  $rec["component_name"],
1346  $rec["slot_id"]
1347  ];
1348  }
1349  }
global $DIC
Definition: saml.php:7
global $ilDB
+ Here is the caller graph for this function:

◆ needsUpdate()

ilPlugin::needsUpdate ( )

Check whether update is needed.

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

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

Referenced by activate().

850  {
851  global $DIC;
852  $ilPluginAdmin = $DIC['ilPluginAdmin'];
853 
854  return $ilPluginAdmin->needsUpdate(
855  $this->getComponentType(),
856  $this->getComponentName(),
857  $this->getSlotId(),
858  $this->getPluginName()
859  );
860  }
global $DIC
Definition: saml.php:7
getComponentName()
Get Component Name.
getComponentType()
Get Component Type.
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

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

◆ readEventListening()

ilPlugin::readEventListening ( )
protected

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

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

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

Referenced by update().

1109  {
1110  $reader = new ilPluginReader(
1111  $this->getDirectory() . '/plugin.xml',
1112  $this->getComponentType(),
1113  $this->getComponentName(),
1114  $this->getSlotId(),
1115  $this->getPluginName()
1116  );
1117  $reader->clearEvents();
1118  $reader->startParsing();
1119  }
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 213 of file class.ilPlugin.php.

Referenced by __init().

214  {
215  $this->active = $a_active;
216  }
+ Here is the caller graph for this function:

◆ setDBVersion()

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

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

Referenced by __init(), and writeDBVersion().

250  {
251  $this->dbversion = $a_dbversion;
252  }
+ Here is the caller graph for this function:

◆ setId()

ilPlugin::setId (   $a_id)
private

Set Id.

Parameters
string$a_idId

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

Referenced by __init().

118  {
119  $this->id = $a_id;
120  }
+ Here is the caller graph for this function:

◆ setIliasMaxVersion()

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

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

Referenced by __init().

194  {
195  $this->iliasmaxversion = $a_iliasmaxversion;
196  }
+ Here is the caller graph for this function:

◆ setIliasMinVersion()

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

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

Referenced by __init().

176  {
177  $this->iliasminversion = $a_iliasminversion;
178  }
+ 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 137 of file class.ilPlugin.php.

Referenced by __init().

138  {
139  $this->lastupdateversion = $a_lastupdateversion;
140  }
+ Here is the caller graph for this function:

◆ setSlotObject()

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

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

Referenced by __init().

232  {
233  $this->slot = $a_slot;
234  }
+ Here is the caller graph for this function:

◆ setVersion()

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

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

Referenced by __init().

158  {
159  $this->version = $a_version;
160  }
+ 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 549 of file class.ilPlugin.php.

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

Referenced by ilTestExportPlugin\getFormat().

549  : string
550  {
551  global $DIC;
552  $lng = $DIC->language();
553  $this->loadLanguageModule();
554 
555  return $lng->txt($this->getPrefix() . "_" . $a_var, $this->getPrefix());
556  }
loadLanguageModule()
Load language module for plugin.
global $DIC
Definition: saml.php:7
$lng
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 992 of file class.ilPlugin.php.

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

993  {
994  global $DIC;
995  $ilDB = $DIC->database();
996 
997  if ($this->beforeUninstall()) {
998  // remove all language entries (see ilObjLanguage)
999  // see updateLanguages
1000  $prefix = $this->getPrefix();
1001  if ($prefix) {
1002  $ilDB->manipulate(
1003  "DELETE FROM lng_data" .
1004  " WHERE module = " . $ilDB->quote($prefix, "text")
1005  );
1006  $ilDB->manipulate(
1007  "DELETE FROM lng_modules" .
1008  " WHERE module = " . $ilDB->quote($prefix, "text")
1009  );
1010  }
1011 
1012  $this->clearEventListening();
1013 
1014  // db version is kept in il_plugin - will be deleted, too
1015 
1016  $q = "DELETE FROM il_plugin" .
1017  " WHERE component_type = " . $ilDB->quote($this->getComponentType(), "text") .
1018  " AND component_name = " . $ilDB->quote($this->getComponentName(), "text") .
1019  " AND slot_id = " . $ilDB->quote($this->getSlotId(), "text") .
1020  " AND name = " . $ilDB->quote($this->getPluginName(), "text");
1021  $ilDB->manipulate($q);
1022 
1023  $ilDB->manipulateF('DELETE FROM ctrl_classfile WHERE comp_prefix=%s', [ ilDBConstants::T_TEXT ], [ $this->getPrefix() ]);
1024  $ilDB->manipulateF('DELETE FROM ctrl_calls WHERE comp_prefix=%s', [ ilDBConstants::T_TEXT ], [ $this->getPrefix() ]);
1025 
1026  $this->afterUninstall();
1027 
1029 
1030  return true;
1031  }
1032 
1033  return false;
1034  }
global $DIC
Definition: saml.php:7
afterUninstall()
This is Plugin-Specific and is triggered after the uninstall command of a plugin. ...
getComponentName()
Get Component Name.
getComponentType()
Get Component Type.
getPrefix()
Get plugin prefix, used for lang vars.
getSlotId()
Get Slot ID.
global $ilDB
getPluginName()
Get Plugin Name.
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 1048 of file class.ilPlugin.php.

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

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

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

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

Referenced by update().

497  {
498  global $DIC;
499  $ilDB = $DIC->database();
500  $lng = $DIC->language();
501 
502  ilGlobalCache::flushAll();
503 
504  $dbupdate = new ilPluginDBUpdate(
505  $this->getComponentType(),
506  $this->getComponentName(),
507  $this->getSlotId(),
508  $this->getPluginName(),
509  $ilDB,
510  true,
511  $this->getTablePrefix()
512  );
513 
514  $result = $dbupdate->applyUpdate();
515  $message = '';
516  if ($dbupdate->updateMsg == "no_changes") {
517  $message = $lng->txt("no_changes") . ". " . $lng->txt("database_is_uptodate");
518  } else {
519  foreach ($dbupdate->updateMsg as $row) {
520  $message .= $lng->txt($row["msg"]) . ": " . $row["nr"] . "<br/>";
521  }
522  }
523 
524  $this->message .= $message;
525  ilGlobalCache::flushAll();
526 
527  return $result;
528  }
getTablePrefix()
Get db table plugin prefix.
$result
global $DIC
Definition: saml.php:7
Database Update class.
getComponentName()
Get Component Name.
getComponentType()
Get Component Type.
catch(Exception $e) $message
$lng
$row
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 439 of file class.ilPlugin.php.

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

Referenced by update().

440  {
441  ilGlobalCache::flushAll();
442 
443  // get the keys of all installed languages if keys are not provided
444  if (!isset($a_lang_keys)) {
445  $a_lang_keys = array();
446  foreach (ilObjLanguage::getInstalledLanguages() as $langObj) {
447  if ($langObj->isInstalled()) {
448  $a_lang_keys[] = $langObj->getKey();
449  }
450  }
451  }
452 
453  $langs = $this->getAvailableLangFiles($this->getLanguageDirectory());
454 
455  $prefix = $this->getPrefix();
456 
457  foreach ($langs as $lang) {
458  // check if the language should be updated, otherwise skip it
459  if (!in_array($lang['key'], $a_lang_keys)) {
460  continue;
461  }
462 
463  $txt = file($this->getLanguageDirectory() . "/" . $lang["file"]);
464  $lang_array = array();
465 
466  // get locally changed variables of the module (these should be kept)
467  $local_changes = ilObjLanguage::_getLocalChangesByModule($lang['key'], $prefix);
468 
469  // get language data
470  if (is_array($txt)) {
471  foreach ($txt as $row) {
472  if ($row[0] != "#" && strpos($row, "#:#") > 0) {
473  $a = explode("#:#", trim($row));
474  $identifier = $prefix . "_" . trim($a[0]);
475  $value = trim($a[1]);
476 
477  if (isset($local_changes[$identifier])) {
478  $lang_array[$identifier] = $local_changes[$identifier];
479  } else {
480  $lang_array[$identifier] = $value;
481  ilObjLanguage::replaceLangEntry($prefix, $identifier, $lang["key"], $value);
482  }
483  //echo "<br>-$prefix-".$prefix."_".trim($a[0])."-".$lang["key"]."-";
484  }
485  }
486  }
487 
488  ilObjLanguage::replaceLangModule($lang["key"], $prefix, $lang_array);
489  }
490  }
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:11
getPrefix()
Get plugin prefix, used for lang vars.
$row
for($i=1; $i<=count($kw_cases_sel); $i+=1) $lang
Definition: langwiz.php:349
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 267 of file class.ilPlugin.php.

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

268  {
269  global $DIC;
270  $ilDB = $DIC->database();
271 
272  $this->setDBVersion($a_dbversion);
273 
274  $q = "UPDATE il_plugin SET db_version = " . $ilDB->quote((int) $this->getDBVersion(), "integer") .
275  " WHERE component_type = " . $ilDB->quote($this->getComponentType(), "text") .
276  " AND component_name = " . $ilDB->quote($this->getComponentName(), "text") .
277  " AND slot_id = " . $ilDB->quote($this->getSlotId(), "text") .
278  " AND name = " . $ilDB->quote($this->getPluginName(), "text");
279 
280  $ilDB->manipulate($q);
281  }
global $DIC
Definition: saml.php:7
getComponentName()
Get Component Name.
getComponentType()
Get Component Type.
setDBVersion(int $a_dbversion)
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().

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