ILIAS  release_5-0 Revision 5.0.0-1144-gc4397b1f870
All Data Structures Namespaces Files Functions Variables Modules Pages
ilPlugin Class Reference
+ Inheritance diagram for ilPlugin:
+ Collaboration diagram for ilPlugin:

Public Member Functions

 __construct ()
 Constructor. More...
 
 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 ()
 Get Id. More...
 
 getLastUpdateVersion ()
 Get Version of last update. More...
 
 getVersion ()
 Get Current Version (from plugin.php file). More...
 
 getIliasMinVersion ()
 Get Required ILIAS min. More...
 
 getIliasMaxVersion ()
 Get Required ILIAS max. More...
 
 getActive ()
 Get Active. More...
 
 setDBVersion ($a_dbversion)
 Set DB Version. More...
 
 getDBVersion ()
 Get DB Version. More...
 
 writeDBVersion ($a_dbversion)
 Write DB version to database. More...
 
 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 ($a_var)
 Get Language Variable (prefix will be prepended automatically) More...
 
 getTemplate ($a_template, $a_par1=true, $a_par2=true)
 Get template from plugin. More...
 
 getImagePath ($a_img)
 Get image path. More...
 
 getStyleSheetLocation ($a_css_file)
 Get css file location. More...
 
 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...
 
 activate ()
 Activate. More...
 
 deactivate ()
 Deactivate. More...
 
 update ()
 Update plugin. More...
 
 lookupNameForId ($a_ctype, $a_cname, $a_slot_id, $a_plugin_id)
 Lookup name for id. More...
 
 lookupIdForName ($a_ctype, $a_cname, $a_slot_id, $a_plugin_name)
 Lookup id for name. More...
 

Static Public Member Functions

static _getDirectory ($a_ctype, $a_cname, $a_slot_id, $a_pname)
 Get plugin directory. More...
 
static getAvailableLangFiles ($a_lang_directory)
 Get array of all language files in the plugin. More...
 
static hasConfigureClass ($a_slot_dir, $a_name)
 Has the plugin a configure class? More...
 
static getConfigureClassName ($a_name)
 Get plugin configure class name. More...
 
static getDBUpdateScriptName ($a_ctype, $a_cname, $a_slot_name, $a_pname)
 Get DB update script filename (full path) More...
 
static lookupTxt ($a_mod_prefix, $a_pl_id, $a_lang_var)
 Lookup language text. More...
 
static _getImagePath ($a_ctype, $a_cname, $a_slot_id, $a_pname, $a_img)
 Get image path. More...
 
static createPluginRecord ($a_ctype, $a_cname, $a_slot_id, $a_pname)
 Create plugin record, if not existing. More...
 
static getPluginRecord ($a_ctype, $a_cname, $a_slot_id, $a_pname)
 Get record from il_plugin table. More...
 
static getPluginObject ($a_ctype, $a_cname, $a_slot_id, $a_pname)
 Get plugin object. More...
 
static lookupStoredData ($a_ctype, $a_cname, $a_slot_id, $a_pname)
 Lookup information data in il_plugin. More...
 
static getActivePluginsForSlot ($a_ctype, $a_cname, $a_slot_id)
 Get all active plugins for a slot. More...
 

Protected Member Functions

 setSlotObject ($a_slot)
 Set Plugin Slot. More...
 
 getSlotObject ()
 Get Plugin Slot. More...
 
 getClassesDirectory ()
 Get Plugin's classes Directory. More...
 
 getLanguageDirectory ()
 Get Plugin's language Directory. More...
 
 slotInit ()
 Object initialization done by slot. More...
 
 init ()
 Object initialization. More...
 
 beforeActivation ()
 Before activation processing. More...
 
 afterActivation ()
 After activation processing. More...
 
 afterDeactivation ()
 After deactivation processing. More...
 
 beforeUpdate ()
 Before update processing. More...
 
 afterUpdate ()
 After update processing. More...
 

Protected Attributes

 $lang_initialised = false
 

Private Member Functions

 setId ($a_id)
 Set Id. More...
 
 setLastUpdateVersion ($a_lastupdateversion)
 Set Version of last update. More...
 
 setVersion ($a_version)
 Set Current Version (from plugin.php file). More...
 
 setIliasMinVersion ($a_iliasminversion)
 Set Required ILIAS min. More...
 
 setIliasMaxVersion ($a_iliasmaxversion)
 Set Required ILIAS max. More...
 
 setActive ($a_active)
 Set Active. More...
 
 __init ()
 Default initialization. More...
 

Detailed Description

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

Constructor & Destructor Documentation

◆ __construct()

ilPlugin::__construct ( )
final

Constructor.

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

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

24  {
25  $this->__init();
26  }
__init()
Default initialization.
+ Here is the call graph for this function:

Member Function Documentation

◆ __init()

ilPlugin::__init ( )
finalprivate

Default initialization.

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

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

Referenced by __construct().

693  {
694  global $ilDB, $lng, $ilPluginAdmin;
695 
696  // read/set basic data
698  $this->getComponentName(), $this->getSlotId(), $this->getPluginName());
699  $this->setLastUpdateVersion($rec["last_update_version"]);
700  $this->setDBVersion($rec["db_version"]);
701  $this->setActive($rec["active"]);
702 
703  // get id
704  $this->setId($ilPluginAdmin->getId($this->getComponentType(),
705  $this->getComponentName(),
706  $this->getSlotId(),
707  $this->getPluginName()));
708 
709  // get version
710  $this->setVersion($ilPluginAdmin->getVersion($this->getComponentType(),
711  $this->getComponentName(),
712  $this->getSlotId(),
713  $this->getPluginName()));
714 
715  // get ilias min version
716  $this->setIliasMinVersion($ilPluginAdmin->getIliasMinVersion($this->getComponentType(),
717  $this->getComponentName(),
718  $this->getSlotId(),
719  $this->getPluginName()));
720 
721  // get ilias max version
722  $this->setIliasMaxVersion($ilPluginAdmin->getIliasMaxVersion($this->getComponentType(),
723  $this->getComponentName(),
724  $this->getSlotId(),
725  $this->getPluginName()));
726 
727  // get slot object
728  $this->setSlotObject(new ilPluginSlot($this->getComponentType(),
729  $this->getComponentName(), $this->getSlotId()));
730 
731  // load language module
732 
733  // Fix for authentication plugins
734  $this->loadLanguageModule();
735 
736  // call slot and plugin init methods
737  $this->slotInit();
738  $this->init();
739  }
loadLanguageModule()
Load language module for plugin.
setId($a_id)
Set Id.
setSlotObject($a_slot)
Set Plugin Slot.
setVersion($a_version)
Set Current Version (from plugin.php file).
getComponentName()
Get Component Name.
setIliasMaxVersion($a_iliasmaxversion)
Set Required ILIAS max.
static getPluginRecord($a_ctype, $a_cname, $a_slot_id, $a_pname)
Get record from il_plugin table.
getComponentType()
Get Component Type.
init()
Object initialization.
setDBVersion($a_dbversion)
Set DB Version.
Plugin Slot.
setLastUpdateVersion($a_lastupdateversion)
Set Version of last update.
getSlotId()
Get Slot ID.
global $lng
Definition: privfeed.php:40
slotInit()
Object initialization done by slot.
global $ilDB
getPluginName()
Get Plugin Name.
setIliasMinVersion($a_iliasminversion)
Set Required ILIAS min.
setActive($a_active)
Set Active.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _getDirectory()

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

Get plugin directory.

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

References ilPluginSlot\_getPluginsDirectory().

Referenced by _getImagePath(), ilObjectDefinition\readDefinitionDataFromCache(), and ilObjectDefinition\readDefinitionDataFromDB().

274  {
275  include_once "Services/Component/classes/class.ilPluginSlot.php";
276  return ilPluginSlot::_getPluginsDirectory($a_ctype, $a_cname, $a_slot_id)."/".$a_pname;
277  }
_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 (   $a_ctype,
  $a_cname,
  $a_slot_id,
  $a_pname,
  $a_img 
)
staticfinal

Get image path.

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

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

Referenced by ilRepositoryObjectPlugin\_getIcon().

558  {
559  $d2 = ilComponent::lookupId($a_ctype, $a_cname)."_".$a_slot_id."_".
560  ilPlugin::lookupIdForName($a_ctype, $a_cname, $a_slot_id, $a_pname);
561 
562  $img = ilUtil::getImagePath($d2."/".$a_img);
563  if (is_int(strpos($img, "Customizing")))
564  {
565  return $img;
566  }
567 
568  $d = ilPlugin::_getDirectory($a_ctype, $a_cname, $a_slot_id, $a_pname);
569  return $d."/templates/images/".$a_img;
570  }
static lookupId($a_type, $a_name)
Lookup ID of a component.
lookupIdForName($a_ctype, $a_cname, $a_slot_id, $a_plugin_name)
Lookup id for name.
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
static _getDirectory($a_ctype, $a_cname, $a_slot_id, $a_pname)
Get plugin directory.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ activate()

ilPlugin::activate ( )
final

Activate.

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

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

783  {
784  global $lng, $ilDB;
785 
787 
788  $result = true;
789 
790  // check whether update is necessary
791  if ($this->needsUpdate())
792  {
793  //$result = $this->isUpdatePossible();
794 
795  // do update
796  if ($result === true)
797  {
798  $result = $this->update();
799  }
800  }
801  if ($result === true)
802  {
803  $result = $this->beforeActivation();
804  // activate plugin
805  if ($result === true)
806  {
807  $q = "UPDATE il_plugin SET active = ".$ilDB->quote(1, "integer").",".
808  " plugin_id = ".$ilDB->quote($this->getId(), "text").
809  " WHERE component_type = ".$ilDB->quote($this->getComponentType(), "text").
810  " AND component_name = ".$ilDB->quote($this->getComponentName(), "text").
811  " AND slot_id = ".$ilDB->quote($this->getSlotId(), "text").
812  " AND name = ".$ilDB->quote($this->getPluginName(), "text");
813 
814  $ilDB->manipulate($q);
815  $this->afterActivation();
816  }
817  }
819  return $result;
820  }
$result
update()
Update plugin.
needsUpdate()
Check whether update is needed.
getComponentName()
Get Component Name.
beforeActivation()
Before activation processing.
getId()
Get Id.
getComponentType()
Get Component Type.
afterActivation()
After activation processing.
getSlotId()
Get Slot ID.
global $lng
Definition: privfeed.php:40
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 
)
final

Add template content to placeholder variable.

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

References getDirectory().

602  {
603  $a_tpl->addBlockFile($a_var, $a_block,
604  $this->getDirectory()."/templates/".$a_tplname);
605  }
getDirectory()
Get Plugin Directory.
+ Here is the call graph for this function:

◆ afterActivation()

ilPlugin::afterActivation ( )
protected

After activation processing.

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

Referenced by activate().

837  {
838  }
+ Here is the caller graph for this function:

◆ afterDeactivation()

ilPlugin::afterDeactivation ( )
protected

After deactivation processing.

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

Referenced by deactivate().

868  {
869  }
+ Here is the caller graph for this function:

◆ afterUpdate()

ilPlugin::afterUpdate ( )
protected

After update processing.

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

Referenced by update().

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

◆ beforeActivation()

ilPlugin::beforeActivation ( )
protected

Before activation processing.

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

Referenced by activate().

826  {
827  return true; // false would indicate that anything went wrong
828  // activation would not proceed
829  // throw an exception in this case
830  //throw new ilPluginException($lng->txt(""));
831  }
+ Here is the caller graph for this function:

◆ beforeUpdate()

ilPlugin::beforeUpdate ( )
protected

Before update processing.

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

Referenced by update().

925  {
926  return true; // false would indicate that anything went wrong
927  // update would not proceed
928  // throw an exception in this case
929  //throw new ilPluginException($lng->txt(""));
930  }
+ Here is the caller graph for this function:

◆ createPluginRecord()

static ilPlugin::createPluginRecord (   $a_ctype,
  $a_cname,
  $a_slot_id,
  $a_pname 
)
staticfinal

Create plugin record, if not existing.

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

References $ilDB, and ilCachedComponentData\flush().

Referenced by ilPluginSlot\getPluginsInformation().

611  {
612  global $ilDB;
613 
615 
616  // check record existence record
617  $q = "SELECT * FROM il_plugin".
618  " WHERE component_type = ".$ilDB->quote($a_ctype, "text").
619  " AND component_name = ".$ilDB->quote($a_cname, "text").
620  " AND slot_id = ".$ilDB->quote($a_slot_id, "text").
621  " AND name = ".$ilDB->quote($a_pname, "text");
622  $set = $ilDB->query($q);
623  if (!$rec = $ilDB->fetchAssoc($set))
624  {
625  $q = "INSERT INTO il_plugin (component_type, component_name, slot_id, name)".
626  " VALUES (".$ilDB->quote($a_ctype, "text").",".
627  $ilDB->quote($a_cname, "text").",".
628  $ilDB->quote($a_slot_id, "text").",".
629  $ilDB->quote($a_pname, "text").")";
630  $ilDB->manipulate($q);
631  }
632  }
global $ilDB
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ deactivate()

ilPlugin::deactivate ( )
final

Deactivate.

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

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

844  {
845  global $ilDB;
846 
848 
849  $result = true;
850 
851  $q = "UPDATE il_plugin SET active = ".$ilDB->quote(0, "integer").
852  " WHERE component_type = ".$ilDB->quote($this->getComponentType(), "text").
853  " AND component_name = ".$ilDB->quote($this->getComponentName(), "text").
854  " AND slot_id = ".$ilDB->quote($this->getSlotId(), "text").
855  " AND name = ".$ilDB->quote($this->getPluginName(), "text");
856 
857  $ilDB->manipulate($q);
858  $this->afterDeactivation();
859 
860  return $result;
861  }
$result
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 ( )
final

Get Active.

Returns
boolean Active

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

195  {
196  return $this->active;
197  }

◆ getActivePluginsForSlot()

static ilPlugin::getActivePluginsForSlot (   $a_ctype,
  $a_cname,
  $a_slot_id 
)
staticfinal

Get all active plugins for a slot.

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

References $ilDB, and ilCachedComponentData\getInstance().

Referenced by ilPluginAdmin\getActivePluginsForSlot().

1009  {
1010  global $ilDB, $ilPluginAdmin;
1011 
1012  $plugins = array();
1013 
1014  // $q = "SELECT * FROM il_plugin WHERE component_type = ".$ilDB->quote($a_ctype, "text").
1015  // " AND component_name = ".$ilDB->quote($a_cname, "text").
1016  // " AND slot_id = ".$ilDB->quote($a_slot_id, "text").
1017  // " AND active = ".$ilDB->quote(1, "integer");
1018  //
1019  // $set = $ilDB->query($q);
1020  $cached_component = ilCachedComponentData::getInstance();
1021  // while($rec = $ilDB->fetchAssoc($set))
1022  $lookupActivePluginsBySlotId = $cached_component->lookupActivePluginsBySlotId($a_slot_id);
1023  foreach($lookupActivePluginsBySlotId as $rec)
1024  {
1025  if ($ilPluginAdmin->isActive($a_ctype, $a_cname, $a_slot_id, $rec["name"]))
1026  {
1027  $plugins[] = $rec["name"];
1028  }
1029  }
1030 
1031  return $plugins;
1032  }
global $ilDB
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getAvailableLangFiles()

static ilPlugin::getAvailableLangFiles (   $a_lang_directory)
staticfinal

Get array of all language files in the plugin.

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

References $file.

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

312  {
313  $langs = array();
314 
315  if (!@is_dir($a_lang_directory))
316  {
317  return array();
318  }
319 
320  $dir = opendir($a_lang_directory);
321  while($file = readdir($dir))
322  {
323  if ($file != "." and
324  $file != "..")
325  {
326  // directories
327  if (@is_file($a_lang_directory."/".$file))
328  {
329  if (substr($file, 0, 6) == "ilias_" &&
330  substr($file, strlen($file) - 5) == ".lang")
331  {
332  $langs[] = array("key" => substr($file, 6, 2), "file" => $file,
333  "path" => $a_lang_directory."/".$file);
334  }
335  }
336  }
337  }
338 
339  return $langs;
340  }
print $file
+ Here is the caller graph for this function:

◆ getClassesDirectory()

ilPlugin::getClassesDirectory ( )
finalprotected

Get Plugin's classes Directory.

Returns
object classes directory

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

References getDirectory().

Referenced by includeClass().

286  {
287  return $this->getDirectory()."/classes";
288  }
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. (and should be made final)

Returns
string Component Name

Referenced by __construct(), __init(), activate(), deactivate(), getImagePath(), getStyleSheetLocation(), isActive(), needsUpdate(), 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. (and should be made final)

Returns
string Component Type

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

+ Here is the caller graph for this function:

◆ getConfigureClassName()

static ilPlugin::getConfigureClassName (   $a_name)
staticfinal

Get plugin configure class name.

Parameters

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

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

366  {
367  return "il".$a_name."ConfigGUI";
368  }
+ Here is the caller graph for this function:

◆ getDBUpdateScriptName()

static ilPlugin::getDBUpdateScriptName (   $a_ctype,
  $a_cname,
  $a_slot_name,
  $a_pname 
)
staticfinal

Get DB update script filename (full path)

Returns
string DB Update script name

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

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

384  {
385  return "Customizing/global/plugins/".$a_ctype."/".$a_cname."/".
386  $a_slot_name."/".$a_pname."/sql/dbupdate.php";
387  }
+ Here is the caller graph for this function:

◆ getDBVersion()

ilPlugin::getDBVersion ( )
final

Get DB Version.

Returns
int DB Version

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

Referenced by writeDBVersion().

235  {
236  return $this->dbversion;
237  }
+ Here is the caller graph for this function:

◆ getDirectory()

ilPlugin::getDirectory ( )
final

Get Plugin Directory.

Returns
object Plugin Slot

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

References getPluginName(), and getSlotObject().

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

266  {
267  return $this->getSlotObject()->getPluginsDirectory()."/".$this->getPluginName();
268  }
getPluginName()
Get Plugin Name.
getSlotObject()
Get Plugin Slot.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getId()

ilPlugin::getId ( )
final

Get Id.

Returns
string Id

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

Referenced by activate(), ilRepositoryObjectPlugin\beforeActivation(), ilCloudHookPlugin\getPluginTablePrefix(), getPrefix(), and ilTestSignaturePlugin\handInFileForArchiving().

95  {
96  return $this->id;
97  }
+ Here is the caller graph for this function:

◆ getIliasMaxVersion()

ilPlugin::getIliasMaxVersion ( )
final

Get Required ILIAS max.

release.

Returns
string Required ILIAS max. release

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

175  {
176  return $this->iliasmaxversion;
177  }

◆ getIliasMinVersion()

ilPlugin::getIliasMinVersion ( )
final

Get Required ILIAS min.

release.

Returns
string Required ILIAS min. release

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

155  {
156  return $this->iliasminversion;
157  }

◆ getImagePath()

ilPlugin::getImagePath (   $a_img)
final

Get image path.

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

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

576  {
577  return self::_getImagePath($this->getComponentType(), $this->getComponentName(), $this->getSlotId(),
578  $this->getPluginName(), $a_img);
579  }
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 ( )
finalprotected

Get Plugin's language Directory.

Returns
object classes directory

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

References getDirectory().

Referenced by updateLanguages().

304  {
305  return $this->getDirectory()."/lang";
306  }
getDirectory()
Get Plugin Directory.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getLastUpdateVersion()

ilPlugin::getLastUpdateVersion ( )
final

Get Version of last update.

Returns
string Version of last update

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

115  {
116  return $this->lastupdateversion;
117  }

◆ 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 (and should be made final)

Returns
string Plugin Name

Referenced by __construct(), __init(), activate(), ilRepositoryObjectPlugin\beforeActivation(), deactivate(), getDirectory(), getImagePath(), ilCloudHookPlugin\getPluginTablePrefix(), ilPreviewRendererPlugin\getRendererClassInstance(), getStyleSheetLocation(), isActive(), needsUpdate(), update(), updateDatabase(), and writeDBVersion().

+ Here is the caller graph for this function:

◆ getPluginObject()

static ilPlugin::getPluginObject (   $a_ctype,
  $a_cname,
  $a_slot_id,
  $a_pname 
)
staticfinal

Get plugin object.

Parameters
string$a_ctypeIL_COMP_MODULE | IL_COMP_SERVICE
string$a_cnamecomponent name
string$a_snameplugin slot name
string$a_pnameplugin name

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

References $file, $ilDB, ilCachedComponentData\getInstance(), and ilPluginSlot\lookupSlotName().

Referenced by ilObjectPluginGUI\__construct(), ilObjectPlugin\__construct(), ilObjectCopySearchResultTableGUI\__construct(), SurveyQuestion\_getQuestionTypeName(), assQuestion\_getQuestionTypeName(), ilObjSurveyQuestionPool\_getQuestiontypes(), ilObjQuestionPool\_getQuestionTypes(), ilObjSurveyQuestionPool\_getQuestionTypeTranslations(), SurveyQuestion\_includeClass(), ilObjComponentSettingsGUI\activatePlugin(), ilObjComponentSettingsGUI\deactivatePlugin(), ilPluginAdmin\getPluginObject(), ilObjQuestionPool\getQuestionTypeTranslations(), ilObjTest\getQuestionTypeTranslations(), ilPluginAdmin\includeClass(), assQuestion\includePluginClass(), ilObjectPluginListGUI\init(), ilObjComponentSettingsGUI\refreshLanguages(), ilObjLanguage\refreshPlugins(), ilObjectCopyGUI\showTargetSelectionTree(), ilObjComponentSettingsGUI\updatePlugin(), and ilObjQuestionPoolGUI\uploadQplObject().

948  {
949  global $ilDB;
950 
951  include_once("./Services/Component/classes/class.ilPluginSlot.php");
952  $slot_name = ilPluginSlot::lookupSlotName($a_ctype, $a_cname, $a_slot_id);
953 
954  $cached_component = ilCachedComponentData::getInstance();
955  $rec = $cached_component->lookCompId($a_ctype, $a_cname);
956  if (! $rec) {
957  return NULL;
958  }
959 
960  // this check is done due to security reasons
961  // $set = $ilDB->queryF("SELECT * FROM il_component WHERE type = %s ".
962  // " AND name = %s", array("text", "text"),
963  // array($a_ctype, $a_cname));
964  // if (!$ilDB->fetchAssoc($set))
965  // {
966  // return null;
967  // }
968 
969  $file = "./Customizing/global/plugins/".$a_ctype."/".
970  $a_cname."/".$slot_name."/".
971  $a_pname."/classes/class.il".$a_pname."Plugin.php";
972 
973  if (is_file($file))
974  {
975  include_once($file);
976  $class = "il".$a_pname."Plugin";
977  $plugin = new $class();
978  return $plugin;
979  }
980 
981  return null;
982  }
print $file
static lookupSlotName($a_ctype, $a_cname, $a_slot_id)
Lookup slot name for component and slot id.
global $ilDB
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getPluginRecord()

static ilPlugin::getPluginRecord (   $a_ctype,
  $a_cname,
  $a_slot_id,
  $a_pname 
)
staticfinal

Get record from il_plugin table.

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

References ilCachedComponentData\getInstance().

Referenced by __init(), ilPluginAdmin\getPluginData(), and ilCloudHookPlugin\getPluginTablePrefix().

639  {
640  $cached_component = ilCachedComponentData::getInstance();
641  $rec = $cached_component->lookupPluginByName($a_pname);
642 
643  if ($rec['component_type'] == $a_ctype AND $rec['component_name'] == $a_cname AND $rec['slot_id'] == $a_slot_id) {
644  return $rec;
645  } else {
646  include_once("./Services/Component/exceptions/class.ilPluginException.php");
647  throw (new ilPluginException("No plugin record found for '" . $a_ctype . "', '" . $a_cname . "', '" . $a_slot_id . "', '" . $a_pname
648  . "'."));
649 
650  }
651  //
652  // global $ilDB;
653  //
654  // // read/set basic data
655  // $q = "SELECT * FROM il_plugin".
656  // " WHERE component_type = ".$ilDB->quote($a_ctype, "text").
657  // " AND component_name = ".$ilDB->quote($a_cname, "text").
658  // " AND slot_id = ".$ilDB->quote($a_slot_id, "text").
659  // " AND name = ".$ilDB->quote($a_pname, "text");
660  // $set = $ilDB->query($q);
661  // if ($rec = $ilDB->fetchAssoc($set))
662  // {
663  // return $rec;
664  // }
665  // else // no record? create one
666  // {
667  // // silently create these records is not a good idea, since
668  // // the function can be called with "wrong parameters"
669  // // raise exceptions instead
670  // include_once("./Services/Component/exceptions/class.ilPluginException.php");
671  // throw (new ilPluginException("No plugin record found for '".$a_ctype."', '".$a_cname."', '".$a_slot_id."', '".$a_pname."'."));
672  //
673  // $q = "INSERT INTO il_plugin (component_type, component_name, slot_id, name)".
674  // " VALUES (".$ilDB->quote($a_ctype, "text").",".
675  // $ilDB->quote($a_cname, "text").",".
676  // $ilDB->quote($a_slot_id, "text").",".
677  // $ilDB->quote($a_pname, "text").")";
678  // $ilDB->manipulate($q);
679  // $q = "SELECT * FROM il_plugin".
680  // " WHERE component_type = ".$ilDB->quote($a_ctype, "text").
681  // " AND component_name = ".$ilDB->quote($a_cname, "text").
682  // " AND slot_id = ".$ilDB->quote($a_slot_id, "text").
683  // " AND name = ".$ilDB->quote($a_pname, "text");
684  // $set = $ilDB->query($q);
685  // return $ilDB->fetchAssoc($set);
686  // }
687  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getPrefix()

ilPlugin::getPrefix ( )
final

Get plugin prefix, used for lang vars.

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

References getId(), and getSlotObject().

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

374  {
375  return $this->getSlotObject()->getPrefix()."_".$this->getId();
376  }
getId()
Get Id.
getSlotObject()
Get Plugin Slot.
+ 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. (and should be made final)

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. (and should be made final)

Returns
string Slot Id

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

+ Here is the caller graph for this function:

◆ getSlotObject()

ilPlugin::getSlotObject ( )
finalprotected

Get Plugin Slot.

Returns
object Plugin Slot

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

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

215  {
216  return $this->slot;
217  }
+ Here is the caller graph for this function:

◆ getStyleSheetLocation()

ilPlugin::getStyleSheetLocation (   $a_css_file)
final

Get css file location.

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

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

585  {
586  $d2 = ilComponent::lookupId($this->getComponentType(), $this->getComponentName())."_".$this->getSlotId()."_".
588 
589  $css = ilUtil::getStyleSheetLocation("output", $a_css_file, $d2);
590  if (is_int(strpos($css, "Customizing")))
591  {
592  return $css;
593  }
594 
595  return $this->getDirectory()."/templates/".$a_css_file;
596  }
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.
getComponentType()
Get Component Type.
lookupIdForName($a_ctype, $a_cname, $a_slot_id, $a_plugin_name)
Lookup id for name.
getDirectory()
Get Plugin Directory.
getSlotId()
Get Slot ID.
getPluginName()
Get Plugin Name.
+ Here is the call graph for this function:

◆ getTablePrefix()

ilPlugin::getTablePrefix ( )
final

Get db table plugin prefix.

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

References getPrefix().

Referenced by updateDatabase().

393  {
394  return $this->getPrefix();
395  }
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 (   $a_template,
  $a_par1 = true,
  $a_par2 = true 
)
final

Get template from plugin.

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

References $tpl, and getDirectory().

547  {
548  $tpl = new ilTemplate($this->getDirectory()."/templates/".$a_template, $a_par1, $a_par2);
549 
550  return $tpl;
551  }
global $tpl
Definition: ilias.php:8
getDirectory()
Get Plugin Directory.
special template class to simplify handling of ITX/PEAR
+ Here is the call graph for this function:

◆ getVersion()

ilPlugin::getVersion ( )
final

Get Current Version (from plugin.php file).

Returns
string Current Version (from plugin.php file)

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

Referenced by update().

135  {
136  return $this->version;
137  }
+ Here is the caller graph for this function:

◆ hasConfigureClass()

static ilPlugin::hasConfigureClass (   $a_slot_dir,
  $a_name 
)
staticfinal

Has the plugin a configure class?

Parameters
stringslot directory
stringplugin name
Returns
boolean true/false

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

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

350  {
351  if (is_file($a_slot_dir."/".
352  $a_name."/classes/class.il".$a_name."ConfigGUI.php"))
353  {
354  return true;
355  }
356  return false;
357  }
+ Here is the caller graph for this function:

◆ includeClass()

ilPlugin::includeClass (   $a_class_file_name)
final

Include (once) a class file.

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

References getClassesDirectory().

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

294  {
295  include_once($this->getClassesDirectory()."/".$a_class_file_name);
296  }
getClassesDirectory()
Get Plugin&#39;s classes Directory.
+ 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 final)

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

Referenced by __init().

754  {
755  }
+ Here is the caller graph for this function:

◆ isActive()

ilPlugin::isActive ( )
final

Check whether plugin is active.

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

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

761  {
762  global $ilPluginAdmin;
763 
764  return $ilPluginAdmin->isActive($this->getComponentType(),
765  $this->getComponentName(), $this->getSlotId(), $this->getPluginName());
766  }
getComponentName()
Get Component Name.
getComponentType()
Get Component Type.
getSlotId()
Get Slot ID.
getPluginName()
Get Plugin Name.
+ Here is the call graph for this function:

◆ loadLanguageModule()

ilPlugin::loadLanguageModule ( )
final

Load language module for plugin.

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

References $lng, and getPrefix().

Referenced by __init(), and txt().

506  {
507  global $lng;
508 
509  if (!$this->lang_initialised && is_object($lng))
510  {
511  $lng->loadLanguageModule($this->getPrefix());
512  $this->lang_initialised = true;
513  }
514  }
getPrefix()
Get plugin prefix, used for lang vars.
global $lng
Definition: privfeed.php:40
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ lookupIdForName()

ilPlugin::lookupIdForName (   $a_ctype,
  $a_cname,
  $a_slot_id,
  $a_plugin_name 
)

Lookup id for name.

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

References $ilDB.

Referenced by _getImagePath(), ilObjRepositorySettings\getAllObjTypes(), ilModulesTableGUI\getComponents(), ilObjectDefinition\getGroupedRepositoryObjectTypes(), getStyleSheetLocation(), ilObjectDefinition\readDefinitionDataFromCache(), and ilObjectDefinition\readDefinitionDataFromDB().

1058  {
1059  global $ilDB;
1060 
1061  $q = "SELECT plugin_id FROM il_plugin ".
1062  " WHERE component_type = ".$ilDB->quote($a_ctype, "text").
1063  " AND component_name = ".$ilDB->quote($a_cname, "text").
1064  " AND slot_id = ".$ilDB->quote($a_slot_id, "text").
1065  " AND name = ".$ilDB->quote($a_plugin_name, "text");
1066 
1067  $set = $ilDB->query($q);
1068  if ($rec = $ilDB->fetchAssoc($set))
1069  {
1070  return $rec["plugin_id"];
1071  }
1072  }
global $ilDB
+ Here is the caller graph for this function:

◆ lookupNameForId()

ilPlugin::lookupNameForId (   $a_ctype,
  $a_cname,
  $a_slot_id,
  $a_plugin_id 
)

Lookup name for id.

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

References $ilDB.

Referenced by ilObjectPluginGUI\__construct(), ilObjectPlugin\__construct(), ilObjectCopySearchResultTableGUI\__construct(), ilRepositoryObjectPlugin\_getIcon(), ilRepositoryObjectPlugin\_getName(), ilObjPluginDispatchGUI\forward(), ilNavigationHistory\getItems(), ilObjectPluginListGUI\init(), ilRepositoryObjectPluginSlot\isTypePlugin(), ilRepositoryObjectPluginSlot\isTypePluginWithLP(), and ilObjectCopyGUI\showTargetSelectionTree().

1038  {
1039  global $ilDB;
1040 
1041  $q = "SELECT name FROM il_plugin ".
1042  " WHERE component_type = ".$ilDB->quote($a_ctype, "text").
1043  " AND component_name = ".$ilDB->quote($a_cname, "text").
1044  " AND slot_id = ".$ilDB->quote($a_slot_id, "text").
1045  " AND plugin_id = ".$ilDB->quote($a_plugin_id, "text");
1046 
1047  $set = $ilDB->query($q);
1048  if ($rec = $ilDB->fetchAssoc($set))
1049  {
1050  return $rec["name"];
1051  }
1052  }
global $ilDB
+ Here is the caller graph for this function:

◆ lookupStoredData()

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

Lookup information data in il_plugin.

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

References $ilDB.

Referenced by ilPluginSlot\getPluginsInformation().

989  {
990  global $ilDB;
991 
992  $q = "SELECT * FROM il_plugin WHERE ".
993  " component_type = ".$ilDB->quote($a_ctype, "text")." AND ".
994  " component_name = ".$ilDB->quote($a_cname, "text")." AND ".
995  " slot_id = ".$ilDB->quote($a_slot_id, "text")." AND ".
996  " name = ".$ilDB->quote($a_pname, "text");
997 
998  $set = $ilDB->query($q);
999 
1000  $rec = $ilDB->fetchAssoc($set);
1001 
1002  return $rec;
1003  }
global $ilDB
+ Here is the caller graph for this function:

◆ lookupTxt()

static ilPlugin::lookupTxt (   $a_mod_prefix,
  $a_pl_id,
  $a_lang_var 
)
static

◆ needsUpdate()

ilPlugin::needsUpdate ( )
final

Check whether update is needed.

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

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

Referenced by activate().

772  {
773  global $ilPluginAdmin;
774 
775  return $ilPluginAdmin->isActive($this->getComponentType(),
776  $this->getComponentName(), $this->getSlotId(), $this->getPluginName());
777  }
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:

◆ setActive()

ilPlugin::setActive (   $a_active)
finalprivate

Set Active.

Parameters
boolean$a_activeActive

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

Referenced by __init().

185  {
186  $this->active = $a_active;
187  }
+ Here is the caller graph for this function:

◆ setDBVersion()

ilPlugin::setDBVersion (   $a_dbversion)
final

Set DB Version.

Parameters
int$a_dbversionDB Version

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

Referenced by __init(), and writeDBVersion().

225  {
226  $this->dbversion = $a_dbversion;
227  }
+ Here is the caller graph for this function:

◆ setId()

ilPlugin::setId (   $a_id)
finalprivate

Set Id.

Parameters
string$a_idId

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

Referenced by __init().

85  {
86  $this->id = $a_id;
87  }
+ Here is the caller graph for this function:

◆ setIliasMaxVersion()

ilPlugin::setIliasMaxVersion (   $a_iliasmaxversion)
finalprivate

Set Required ILIAS max.

release.

Parameters
string$a_iliasmaxversionRequired ILIAS max. release

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

Referenced by __init().

165  {
166  $this->iliasmaxversion = $a_iliasmaxversion;
167  }
+ Here is the caller graph for this function:

◆ setIliasMinVersion()

ilPlugin::setIliasMinVersion (   $a_iliasminversion)
finalprivate

Set Required ILIAS min.

release.

Parameters
string$a_iliasminversionRequired ILIAS min. release

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

Referenced by __init().

145  {
146  $this->iliasminversion = $a_iliasminversion;
147  }
+ Here is the caller graph for this function:

◆ setLastUpdateVersion()

ilPlugin::setLastUpdateVersion (   $a_lastupdateversion)
finalprivate

Set Version of last update.

Parameters
string$a_lastupdateversionVersion of last update

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

Referenced by __init().

105  {
106  $this->lastupdateversion = $a_lastupdateversion;
107  }
+ Here is the caller graph for this function:

◆ setSlotObject()

ilPlugin::setSlotObject (   $a_slot)
finalprotected

Set Plugin Slot.

Parameters
object$a_slotPlugin Slot

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

Referenced by __init().

205  {
206  $this->slot = $a_slot;
207  }
+ Here is the caller graph for this function:

◆ setVersion()

ilPlugin::setVersion (   $a_version)
finalprivate

Set Current Version (from plugin.php file).

Parameters
string$a_versionCurrent Version (from plugin.php file)

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

Referenced by __init().

125  {
126  $this->version = $a_version;
127  }
+ 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 final)

Referenced by __init().

+ Here is the caller graph for this function:

◆ txt()

ilPlugin::txt (   $a_var)
final

Get Language Variable (prefix will be prepended automatically)

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

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

Referenced by ilTestExportPlugin\getFormat().

520  {
521  global $lng;
522  $this->loadLanguageModule();
523  return $lng->txt($this->getPrefix()."_".$a_var, $this->getPrefix());
524  }
loadLanguageModule()
Load language module for plugin.
getPrefix()
Get plugin prefix, used for lang vars.
global $lng
Definition: privfeed.php:40
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ update()

ilPlugin::update ( )
final

Update plugin.

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

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

Referenced by activate().

875  {
876  global $ilDB, $ilCtrl;
877 
879 
880  $result = $this->beforeUpdate();
881  if ($result === false) {
882  return false;
883  }
884 
885  // DB update
886  if ($result === true)
887  {
888  $result = $this->updateDatabase();
889  }
890 
891  // Load language files
892  $this->updateLanguages();
893 
894  // load control structure
895  include_once("./setup/classes/class.ilCtrlStructureReader.php");
896  $structure_reader = new ilCtrlStructureReader();
897  $structure_reader->readStructure(true, "./".$this->getDirectory(), $this->getPrefix(),
898  $this->getDirectory());
899  // $ilCtrl->storeCommonStructures();
900 
901  // add config gui to the ctrl calls
902  $ilCtrl->insertCtrlCalls("ilobjcomponentsettingsgui", ilPlugin::getConfigureClassName($this->getPluginName()),
903  $this->getPrefix());
904 
905  // set last update version to current version
906  if ($result === true)
907  {
908  $q = "UPDATE il_plugin SET last_update_version = ".$ilDB->quote($this->getVersion(), "text").
909  " WHERE component_type = ".$ilDB->quote($this->getComponentType(), "text").
910  " AND component_name = ".$ilDB->quote($this->getComponentName(), "text").
911  " AND slot_id = ".$ilDB->quote($this->getSlotId(), "text").
912  " AND name = ".$ilDB->quote($this->getPluginName(), "text");
913 
914  $ilDB->manipulate($q);
915  $this->afterUpdate();
916  }
917 
918  return $result;
919  }
getVersion()
Get Current Version (from plugin.php file).
$result
updateLanguages($a_lang_keys=null)
static getConfigureClassName($a_name)
Get plugin configure class name.
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.
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 469 of file class.ilPlugin.php.

References $ilDB, $lng, $result, $row, ilCachedComponentData\flush(), getComponentName(), getComponentType(), getPluginName(), getSlotId(), and getTablePrefix().

Referenced by update().

470  {
471  global $ilDB, $lng;
472 
474 
475  include_once("./Services/Component/classes/class.ilPluginDBUpdate.php");
476  $dbupdate = new ilPluginDBUpdate($this->getComponentType(),
477  $this->getComponentName(), $this->getSlotId(),
478  $this->getPluginName(), $ilDB, true, $this->getTablePrefix());
479 
480  //$dbupdate->getDBVersionStatus();
481  //$dbupdate->getCurrentVersion();
482 
483  $result = $dbupdate->applyUpdate();
484  $message = '';
485  if ($dbupdate->updateMsg == "no_changes")
486  {
487  $message = $lng->txt("no_changes").". ".$lng->txt("database_is_uptodate");
488  }
489  else
490  {
491  foreach ($dbupdate->updateMsg as $row)
492  {
493  $message .= $lng->txt($row["msg"]).": ".$row["nr"]."<br/>";
494  }
495  }
496 
497  $this->message.= $message;
498 
499  return $result;
500  }
getTablePrefix()
Get db table plugin prefix.
$result
Database Update class.
getComponentName()
Get Component Name.
getComponentType()
Get Component Type.
getSlotId()
Get Slot ID.
global $lng
Definition: privfeed.php:40
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 401 of file class.ilPlugin.php.

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

Referenced by update().

402  {
403  ilGlobalCache::flushAll();
404  include_once("./Services/Language/classes/class.ilObjLanguage.php");
405 
406  // get the keys of all installed languages if keys are not provided
407  if(!isset($a_lang_keys))
408  {
409  $a_lang_keys = array();
410  foreach (ilObjLanguage::getInstalledLanguages() as $langObj)
411  {
412  if ($langObj->isInstalled())
413  {
414  $a_lang_keys[] = $langObj->getKey();
415  }
416  }
417  }
418 
419  $langs = $this->getAvailableLangFiles($this->getLanguageDirectory());
420 
421  $prefix = $this->getPrefix();
422 
423  foreach($langs as $lang)
424  {
425  // check if the language should be updated, otherwise skip it
426  if (!in_array($lang['key'], $a_lang_keys) )
427  {
428  continue;
429  }
430 
431  $txt = file($this->getLanguageDirectory()."/".$lang["file"]);
432  $lang_array = array();
433 
434  // get locally changed variables of the module (these should be kept)
435  $local_changes = ilObjLanguage::_getLocalChangesByModule($lang['key'], $prefix);
436 
437  // get language data
438  if (is_array($txt))
439  {
440  foreach ($txt as $row)
441  {
442  if ($row[0] != "#" && strpos($row, "#:#") > 0)
443  {
444  $a = explode("#:#",trim($row));
445  $identifier = $prefix."_".trim($a[0]);
446  $value = trim($a[1]);
447 
448  if (isset($local_changes[$identifier]))
449  {
450  $lang_array[$identifier] = $local_changes[$identifier];
451  }
452  else
453  {
454  $lang_array[$identifier] = $value;
455  ilObjLanguage::replaceLangEntry($prefix, $identifier, $lang["key"], $value);
456  }
457  //echo "<br>-$prefix-".$prefix."_".trim($a[0])."-".$lang["key"]."-";
458  }
459  }
460  }
461 
462  ilObjLanguage::replaceLangModule($lang["key"], $prefix, $lang_array);
463  }
464  }
static replaceLangEntry($a_module, $a_identifier, $a_lang_key, $a_value, $a_local_change=null, $a_remarks=null)
Replace lang entry.
static getInstalledLanguages()
Get the language objects of the installed languages.
$txt
Definition: error.php:10
getPrefix()
Get plugin prefix, used for lang vars.
static getAvailableLangFiles($a_lang_directory)
Get array of all language files in the plugin.
getLanguageDirectory()
Get Plugin&#39;s language Directory.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ writeDBVersion()

ilPlugin::writeDBVersion (   $a_dbversion)
final

Write DB version to database.

Parameters
int$a_dbversionDB Version

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

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

245  {
246  global $ilDB;
247 
248  $this->setDBVersion($a_dbversion);
249 
250  $q = "UPDATE il_plugin SET db_version = ".$ilDB->quote((int) $this->getDBVersion(), "integer").
251  " WHERE component_type = ".$ilDB->quote($this->getComponentType(), "text").
252  " AND component_name = ".$ilDB->quote($this->getComponentName(), "text").
253  " AND slot_id = ".$ilDB->quote($this->getSlotId(), "text").
254  " AND name = ".$ilDB->quote($this->getPluginName(), "text");
255 
256  $ilDB->manipulate($q);
257  }
getComponentName()
Get Component Name.
getComponentType()
Get Component Type.
setDBVersion($a_dbversion)
Set DB Version.
getDBVersion()
Get DB Version.
getSlotId()
Get Slot ID.
global $ilDB
getPluginName()
Get Plugin Name.
+ Here is the call graph for this function:

Field Documentation

◆ $lang_initialised

ilPlugin::$lang_initialised = false
protected

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


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