ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
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 ()
 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...
 
 uninstall ()
 
 update ()
 Update plugin. 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)
 
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 plugin names for a slot. More...
 
static getActivePluginIdsForSlot ($a_ctype, $a_cname, $a_slot_id)
 Get All active plugin ids for a slot. More...
 
static lookupNameForId ($a_ctype, $a_cname, $a_slot_id, $a_plugin_id)
 Lookup name for id. More...
 
static lookupIdForName ($a_ctype, $a_cname, $a_slot_id, $a_plugin_name)
 Lookup id for name. 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...
 
 beforeUninstall ()
 
 afterUninstall ()
 
 beforeUpdate ()
 Before update processing. More...
 
 afterUpdate ()
 After update processing. More...
 

Protected Attributes

 $lang_initialised = false
 
 $id = ''
 

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

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

29 {
30 $this->__init();
31 }
__init()
Default initialization.

References __init().

+ Here is the call graph for this function:

Member Function Documentation

◆ __init()

ilPlugin::__init ( )
private

Default initialization.

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

658 {
659 global $ilDB, $lng, $ilPluginAdmin;
660
661 // read/set basic data
663 $this->getComponentName(), $this->getSlotId(), $this->getPluginName());
664 $this->setLastUpdateVersion($rec["last_update_version"]);
665 $this->setDBVersion($rec["db_version"]);
666 $this->setActive($rec["active"]);
667
668 // get id
669 $this->setId($ilPluginAdmin->getId($this->getComponentType(),
670 $this->getComponentName(),
671 $this->getSlotId(),
672 $this->getPluginName()));
673
674 // get version
675 $this->setVersion($ilPluginAdmin->getVersion($this->getComponentType(),
676 $this->getComponentName(),
677 $this->getSlotId(),
678 $this->getPluginName()));
679
680 // get ilias min version
681 $this->setIliasMinVersion($ilPluginAdmin->getIliasMinVersion($this->getComponentType(),
682 $this->getComponentName(),
683 $this->getSlotId(),
684 $this->getPluginName()));
685
686 // get ilias max version
687 $this->setIliasMaxVersion($ilPluginAdmin->getIliasMaxVersion($this->getComponentType(),
688 $this->getComponentName(),
689 $this->getSlotId(),
690 $this->getPluginName()));
691
692 // get slot object
693 $this->setSlotObject(new ilPluginSlot($this->getComponentType(),
694 $this->getComponentName(), $this->getSlotId()));
695
696 // load language module
697
698 // Fix for authentication plugins
699 $this->loadLanguageModule();
700
701 // call slot and plugin init methods
702 $this->slotInit();
703 $this->init();
704 }
setIliasMinVersion($a_iliasminversion)
Set Required ILIAS min.
setSlotObject($a_slot)
Set Plugin Slot.
getSlotId()
Get Slot ID.
setId($a_id)
Set Id.
setLastUpdateVersion($a_lastupdateversion)
Set Version of last update.
setActive($a_active)
Set Active.
init()
Object initialization.
getPluginName()
Get Plugin Name.
setDBVersion($a_dbversion)
Set DB Version.
static getPluginRecord($a_ctype, $a_cname, $a_slot_id, $a_pname)
Get record from il_plugin table.
getComponentName()
Get Component Name.
loadLanguageModule()
Load language module for plugin.
slotInit()
Object initialization done by slot.
setIliasMaxVersion($a_iliasmaxversion)
Set Required ILIAS max.
getComponentType()
Get Component Type.
setVersion($a_version)
Set Current Version (from plugin.php file).
global $lng
Definition: privfeed.php:17
global $ilDB

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

Referenced by __construct().

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

◆ _getDirectory()

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

Get plugin directory.

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

273 {
274 include_once "Services/Component/classes/class.ilPluginSlot.php";
275 return ilPluginSlot::_getPluginsDirectory($a_ctype, $a_cname, $a_slot_id)."/".$a_pname;
276 }
static _getPluginsDirectory($a_ctype, $a_cname, $a_slot_id)
Get plugins directory.

References ilPluginSlot\_getPluginsDirectory().

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

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

◆ _getImagePath()

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

Get image path.

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

553 {
554 $d2 = ilComponent::lookupId($a_ctype, $a_cname)."_".$a_slot_id."_".
555 ilPlugin::lookupIdForName($a_ctype, $a_cname, $a_slot_id, $a_pname);
556
557 $img = ilUtil::getImagePath($d2."/".$a_img);
558 if (is_int(strpos($img, "Customizing")))
559 {
560 return $img;
561 }
562
563 $d = ilPlugin::_getDirectory($a_ctype, $a_cname, $a_slot_id, $a_pname);
564 return $d."/templates/images/".$a_img;
565 }
for($col=0; $col< 50; $col++) $d
static lookupId($a_type, $a_name)
Lookup ID of a component.
static lookupIdForName($a_ctype, $a_cname, $a_slot_id, $a_plugin_name)
Lookup id for name.
static _getDirectory($a_ctype, $a_cname, $a_slot_id, $a_pname)
Get plugin directory.
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)

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

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

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

◆ activate()

ilPlugin::activate ( )

Activate.

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

748 {
749 global $lng, $ilDB;
750
752
753 $result = true;
754
755 // check whether update is necessary
756 if ($this->needsUpdate())
757 {
758 //$result = $this->isUpdatePossible();
759
760 // do update
761 if ($result === true)
762 {
763 $result = $this->update();
764 }
765 }
766 if ($result === true)
767 {
768 $result = $this->beforeActivation();
769 // activate plugin
770 if ($result === true)
771 {
772 $q = "UPDATE il_plugin SET active = ".$ilDB->quote(1, "integer").",".
773 " plugin_id = ".$ilDB->quote($this->getId(), "text").
774 " WHERE component_type = ".$ilDB->quote($this->getComponentType(), "text").
775 " AND component_name = ".$ilDB->quote($this->getComponentName(), "text").
776 " AND slot_id = ".$ilDB->quote($this->getSlotId(), "text").
777 " AND name = ".$ilDB->quote($this->getPluginName(), "text");
778
779 $ilDB->manipulate($q);
780 $this->afterActivation();
781 }
782 }
784 return $result;
785 }
$result
needsUpdate()
Check whether update is needed.
afterActivation()
After activation processing.
update()
Update plugin.
beforeActivation()
Before activation processing.
getId()
Get Id.

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

+ Here is the call graph for this function:

◆ addBlockFile()

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

Add template content to placeholder variable.

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

597 {
598 $a_tpl->addBlockFile($a_var, $a_block,
599 $this->getDirectory()."/templates/".$a_tplname);
600 }
getDirectory()
Get Plugin Directory.

References getDirectory().

+ Here is the call graph for this function:

◆ afterActivation()

ilPlugin::afterActivation ( )
protected

After activation processing.

Reimplemented in ilCachedPlugin.

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

802 {
803 }

Referenced by activate().

+ Here is the caller graph for this function:

◆ afterDeactivation()

ilPlugin::afterDeactivation ( )
protected

After deactivation processing.

Reimplemented in ilCachedPlugin.

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

833 {
834 }

Referenced by deactivate().

+ Here is the caller graph for this function:

◆ afterUninstall()

ilPlugin::afterUninstall ( )
protected

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

880 {
881 // plugin-specific
882 }

Referenced by uninstall().

+ Here is the caller graph for this function:

◆ afterUpdate()

ilPlugin::afterUpdate ( )
protected

After update processing.

Reimplemented in ilCachedPlugin.

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

949 {
950 }

Referenced by update().

+ Here is the caller graph for this function:

◆ beforeActivation()

ilPlugin::beforeActivation ( )
protected

Before activation processing.

Reimplemented in ilCachedPlugin, and ilRepositoryObjectPlugin.

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

791 {
792 return true; // false would indicate that anything went wrong
793 // activation would not proceed
794 // throw an exception in this case
795 //throw new ilPluginException($lng->txt(""));
796 }

Referenced by activate().

+ Here is the caller graph for this function:

◆ beforeUninstall()

ilPlugin::beforeUninstall ( )
protected

Reimplemented in ilRepositoryObjectPlugin.

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

838 {
839 // plugin-specific
840 // false would indicate that anything went wrong
841 return true;
842 }

Referenced by uninstall().

+ Here is the caller graph for this function:

◆ beforeUpdate()

ilPlugin::beforeUpdate ( )
protected

Before update processing.

Reimplemented in ilCachedPlugin.

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

938 {
939 return true; // false would indicate that anything went wrong
940 // update would not proceed
941 // throw an exception in this case
942 //throw new ilPluginException($lng->txt(""));
943 }

Referenced by update().

+ Here is the caller graph for this function:

◆ createPluginRecord()

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

@description Create plugin record, if not existing

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

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

References $ilDB, and ilCachedComponentData\flush().

Referenced by ilPluginSlot\getPluginsInformation().

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

◆ deactivate()

ilPlugin::deactivate ( )

Deactivate.

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

809 {
810 global $ilDB;
811
813
814 $result = true;
815
816 $q = "UPDATE il_plugin SET active = ".$ilDB->quote(0, "integer").
817 " WHERE component_type = ".$ilDB->quote($this->getComponentType(), "text").
818 " AND component_name = ".$ilDB->quote($this->getComponentName(), "text").
819 " AND slot_id = ".$ilDB->quote($this->getSlotId(), "text").
820 " AND name = ".$ilDB->quote($this->getPluginName(), "text");
821
822 $ilDB->manipulate($q);
823 $this->afterDeactivation();
824
825 return $result;
826 }
afterDeactivation()
After deactivation processing.

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

+ Here is the call graph for this function:

◆ getActive()

ilPlugin::getActive ( )

Get Active.

Returns
boolean Active

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

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

◆ getActivePluginIdsForSlot()

static ilPlugin::getActivePluginIdsForSlot (   $a_ctype,
  $a_cname,
  $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 1037 of file class.ilPlugin.php.

1037 {
1038 global $ilPluginAdmin;
1039
1040 $plugins = array();
1041 $cached_component = ilCachedComponentData::getInstance();
1042 $lookupActivePluginsBySlotId = $cached_component->lookupActivePluginsBySlotId($a_slot_id);
1043 foreach($lookupActivePluginsBySlotId as $rec)
1044 {
1045 if ($ilPluginAdmin->isActive($a_ctype, $a_cname, $a_slot_id, $rec["name"]))
1046 {
1047 $plugins[] = $rec["plugin_id"];
1048 }
1049 }
1050
1051 return $plugins;
1052 }

References ilCachedComponentData\getInstance().

+ Here is the call graph for this function:

◆ getActivePluginsForSlot()

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

Get all active plugin names for a slot.

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

1011 {
1012 global $ilPluginAdmin;
1013
1014 $plugins = array();
1015
1016 $cached_component = ilCachedComponentData::getInstance();
1017
1018 $lookupActivePluginsBySlotId = $cached_component->lookupActivePluginsBySlotId($a_slot_id);
1019 foreach($lookupActivePluginsBySlotId as $rec)
1020 {
1021 if ($ilPluginAdmin->isActive($a_ctype, $a_cname, $a_slot_id, $rec["name"]))
1022 {
1023 $plugins[] = $rec["name"];
1024 }
1025 }
1026
1027 return $plugins;
1028 }

References ilCachedComponentData\getInstance().

Referenced by ilPluginAdmin\getActivePluginsForSlot().

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

◆ getAvailableLangFiles()

static ilPlugin::getAvailableLangFiles (   $a_lang_directory)
static

Get array of all language files in the plugin.

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

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

References $file.

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

+ Here is the caller graph for this function:

◆ getClassesDirectory()

ilPlugin::getClassesDirectory ( )
protected

Get Plugin's classes Directory.

Returns
object classes directory

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

285 {
286 return $this->getDirectory()."/classes";
287 }

References getDirectory().

Referenced by includeClass().

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

◆ getComponentName()

◆ getComponentType()

◆ getConfigureClassName()

static ilPlugin::getConfigureClassName (   $a_name)
static

Get plugin configure class name.

Parameters

return

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

365 {
366 return "il".$a_name."ConfigGUI";
367 }

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

+ Here is the caller graph for this function:

◆ getDBUpdateScriptName()

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

Get DB update script filename (full path)

Returns
string DB Update script name

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

383 {
384 return "Customizing/global/plugins/".$a_ctype."/".$a_cname."/".
385 $a_slot_name."/".$a_pname."/sql/dbupdate.php";
386 }

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

+ Here is the caller graph for this function:

◆ getDBVersion()

ilPlugin::getDBVersion ( )

Get DB Version.

Returns
int DB Version

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

234 {
235 return $this->dbversion;
236 }

Referenced by writeDBVersion().

+ Here is the caller graph for this function:

◆ getDirectory()

ilPlugin::getDirectory ( )

Get Plugin Directory.

Returns
object Plugin Slot

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

265 {
266 return $this->getSlotObject()->getPluginsDirectory()."/".$this->getPluginName();
267 }
getSlotObject()
Get Plugin Slot.

References getPluginName(), and getSlotObject().

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

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

◆ getId()

ilPlugin::getId ( )

◆ getIliasMaxVersion()

ilPlugin::getIliasMaxVersion ( )

Get Required ILIAS max.

release.

Returns
string Required ILIAS max. release

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

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

◆ getIliasMinVersion()

ilPlugin::getIliasMinVersion ( )

Get Required ILIAS min.

release.

Returns
string Required ILIAS min. release

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

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

◆ getImagePath()

ilPlugin::getImagePath (   $a_img)

Get image path.

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

571 {
572 return self::_getImagePath($this->getComponentType(), $this->getComponentName(), $this->getSlotId(),
573 $this->getPluginName(), $a_img);
574 }
static _getImagePath($a_ctype, $a_cname, $a_slot_id, $a_pname, $a_img)
Get image path.

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

+ Here is the call graph for this function:

◆ getLanguageDirectory()

ilPlugin::getLanguageDirectory ( )
protected

Get Plugin's language Directory.

Returns
object classes directory

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

303 {
304 return $this->getDirectory()."/lang";
305 }

References getDirectory().

Referenced by updateLanguages().

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

◆ getLastUpdateVersion()

ilPlugin::getLastUpdateVersion ( )

Get Version of last update.

Returns
string Version of last update

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

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

◆ getPluginName()

ilPlugin::getPluginName ( )
abstract

Get Plugin Name.

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

Must be overwritten in plugin class of plugin

Returns
string Plugin Name

Referenced by __init(), activate(), deactivate(), getDirectory(), getImagePath(), ilCloudHookPlugin\getPluginTablePrefix(), ilDclFieldTypePlugin\getPluginTablePrefix(), ilPreviewRendererPlugin\getRendererClassInstance(), getStyleSheetLocation(), isActive(), needsUpdate(), uninstall(), 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 
)
static

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

961 {
962 include_once("./Services/Component/classes/class.ilPluginSlot.php");
963 $slot_name = ilPluginSlot::lookupSlotName($a_ctype, $a_cname, $a_slot_id);
964
965 $cached_component = ilCachedComponentData::getInstance();
966 $rec = $cached_component->lookCompId($a_ctype, $a_cname);
967 if (! $rec) {
968 return NULL;
969 }
970
971 $file = "./Customizing/global/plugins/".$a_ctype."/".
972 $a_cname."/".$slot_name."/".
973 $a_pname."/classes/class.il".$a_pname."Plugin.php";
974
975 if (is_file($file))
976 {
977 include_once($file);
978 $class = "il".$a_pname."Plugin";
979 $plugin = new $class();
980 return $plugin;
981 }
982
983 return null;
984 }
static lookupSlotName($a_ctype, $a_cname, $a_slot_id)
Lookup slot name for component and slot id.

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

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

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

◆ getPluginRecord()

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

Get record from il_plugin table.

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

640 {
641 $cached_component = ilCachedComponentData::getInstance();
642 $rec = $cached_component->lookupPluginByName($a_pname);
643
644 if ($rec['component_type'] == $a_ctype AND $rec['component_name'] == $a_cname AND $rec['slot_id'] == $a_slot_id) {
645 return $rec;
646 } else {
647 include_once("./Services/Component/exceptions/class.ilPluginException.php");
648 throw (new ilPluginException("No plugin record found for '" . $a_ctype . "', '" . $a_cname . "', '" . $a_slot_id . "', '" . $a_pname
649 . "'."));
650
651 }
652 }

References ilCachedComponentData\getInstance().

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

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

373 {
374 return $this->getSlotObject()->getPrefix()."_".$this->getId();
375 }

References getId(), and getSlotObject().

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

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

◆ getSlot()

◆ getSlotId()

◆ getSlotObject()

ilPlugin::getSlotObject ( )
protected

Get Plugin Slot.

Returns
object Plugin Slot

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

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

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

+ Here is the caller graph for this function:

◆ getStyleSheetLocation()

ilPlugin::getStyleSheetLocation (   $a_css_file)

Get css file location.

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

580 {
581 $d2 = ilComponent::lookupId($this->getComponentType(), $this->getComponentName())."_".$this->getSlotId()."_".
583
584 $css = ilUtil::getStyleSheetLocation("output", $a_css_file, $d2);
585 if (is_int(strpos($css, "Customizing")))
586 {
587 return $css;
588 }
589
590 return $this->getDirectory()."/templates/".$a_css_file;
591 }
static getStyleSheetLocation($mode="output", $a_css_name="", $a_css_location="")
get full style sheet file name (path inclusive) of current user

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

+ Here is the call graph for this function:

◆ getTablePrefix()

ilPlugin::getTablePrefix ( )

Get db table plugin prefix.

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

392 {
393 return $this->getPrefix();
394 }
getPrefix()
Get plugin prefix, used for lang vars.

References getPrefix().

Referenced by updateDatabase().

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

◆ getTemplate()

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

Get template from plugin.

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

542 {
543 $tpl = new ilTemplate($this->getDirectory()."/templates/".$a_template, $a_par1, $a_par2);
544
545 return $tpl;
546 }
global $tpl
Definition: ilias.php:8
special template class to simplify handling of ITX/PEAR

References $tpl, and getDirectory().

+ Here is the call graph for this function:

◆ getVersion()

ilPlugin::getVersion ( )

Get Current Version (from plugin.php file).

Returns
string Current Version (from plugin.php file)

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

134 {
135 return $this->version;
136 }

References $version.

Referenced by update().

+ Here is the caller graph for this function:

◆ hasConfigureClass()

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

Has the plugin a configure class?

Parameters
stringslot directory
stringplugin name
Returns
boolean true/false

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

349 {
350 if (is_file($a_slot_dir."/".
351 $a_name."/classes/class.il".$a_name."ConfigGUI.php"))
352 {
353 return true;
354 }
355 return false;
356 }

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

+ Here is the caller graph for this function:

◆ includeClass()

ilPlugin::includeClass (   $a_class_file_name)

Include (once) a class file.

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

293 {
294 include_once($this->getClassesDirectory()."/".$a_class_file_name);
295 }
getClassesDirectory()
Get Plugin's classes Directory.

References getClassesDirectory().

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

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

◆ init()

ilPlugin::init ( )
protected

Object initialization.

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

Reimplemented in ilCachedPlugin.

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

719 {
720 }

Referenced by __init().

+ Here is the caller graph for this function:

◆ isActive()

ilPlugin::isActive ( )

Check whether plugin is active.

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

726 {
727 global $ilPluginAdmin;
728
729 return $ilPluginAdmin->isActive($this->getComponentType(),
730 $this->getComponentName(), $this->getSlotId(), $this->getPluginName());
731 }

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

+ Here is the call graph for this function:

◆ loadLanguageModule()

ilPlugin::loadLanguageModule ( )

Load language module for plugin.

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

505 {
506 global $lng;
507
508 if (!$this->lang_initialised && is_object($lng))
509 {
510 $lng->loadLanguageModule($this->getPrefix());
511 $this->lang_initialised = true;
512 }
513 }

References $lng, and getPrefix().

Referenced by __init(), and txt().

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

◆ lookupIdForName()

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

Lookup id for name.

Reimplemented in ilCachedPlugin.

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

1078 {
1079 global $ilDB;
1080
1081 $q = "SELECT plugin_id FROM il_plugin ".
1082 " WHERE component_type = ".$ilDB->quote($a_ctype, "text").
1083 " AND component_name = ".$ilDB->quote($a_cname, "text").
1084 " AND slot_id = ".$ilDB->quote($a_slot_id, "text").
1085 " AND name = ".$ilDB->quote($a_plugin_name, "text");
1086
1087 $set = $ilDB->query($q);
1088 if ($rec = $ilDB->fetchAssoc($set))
1089 {
1090 return $rec["plugin_id"];
1091 }
1092 }

References $ilDB.

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

+ Here is the caller graph for this function:

◆ lookupNameForId()

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

Lookup name for id.

Reimplemented in ilCachedPlugin.

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

1058 {
1059 global $ilDB;
1060
1061 $q = "SELECT name 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 plugin_id = ".$ilDB->quote($a_plugin_id, "text");
1066
1067 $set = $ilDB->query($q);
1068 if ($rec = $ilDB->fetchAssoc($set))
1069 {
1070 return $rec["name"];
1071 }
1072 }

References $ilDB.

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

+ Here is the caller graph for this function:

◆ lookupStoredData()

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

Lookup information data in il_plugin.

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

991 {
992 global $ilDB;
993
994 $q = "SELECT * FROM il_plugin WHERE ".
995 " component_type = ".$ilDB->quote($a_ctype, "text")." AND ".
996 " component_name = ".$ilDB->quote($a_cname, "text")." AND ".
997 " slot_id = ".$ilDB->quote($a_slot_id, "text")." AND ".
998 " name = ".$ilDB->quote($a_pname, "text");
999
1000 $set = $ilDB->query($q);
1001
1002 $rec = $ilDB->fetchAssoc($set);
1003
1004 return $rec;
1005 }

References $ilDB.

Referenced by ilPluginSlot\getPluginsInformation().

+ Here is the caller graph for this function:

◆ lookupTxt()

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

Lookup language text.

Reimplemented in ilCachedPlugin.

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

529 {
530 global $lng;
531
532 // this enables default language fallback
533 $prefix = $a_mod_prefix."_".$a_pl_id;
534 return $lng->txt($prefix."_".$a_lang_var, $prefix);
535 }

References $lng.

◆ needsUpdate()

ilPlugin::needsUpdate ( )

Check whether update is needed.

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

737 {
738 global $ilPluginAdmin;
739
740 return $ilPluginAdmin->needsUpdate($this->getComponentType(),
741 $this->getComponentName(), $this->getSlotId(), $this->getPluginName());
742 }

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

Referenced by activate().

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

◆ setActive()

ilPlugin::setActive (   $a_active)
private

Set Active.

Parameters
boolean$a_activeActive

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

184 {
185 $this->active = $a_active;
186 }

Referenced by __init().

+ Here is the caller graph for this function:

◆ setDBVersion()

ilPlugin::setDBVersion (   $a_dbversion)

Set DB Version.

Parameters
int$a_dbversionDB Version

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

224 {
225 $this->dbversion = $a_dbversion;
226 }

Referenced by __init(), and writeDBVersion().

+ Here is the caller graph for this function:

◆ setId()

ilPlugin::setId (   $a_id)
private

Set Id.

Parameters
string$a_idId

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

84 {
85 $this->id = $a_id;
86 }

Referenced by __init().

+ Here is the caller graph for this function:

◆ setIliasMaxVersion()

ilPlugin::setIliasMaxVersion (   $a_iliasmaxversion)
private

Set Required ILIAS max.

release.

Parameters
string$a_iliasmaxversionRequired ILIAS max. release

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

164 {
165 $this->iliasmaxversion = $a_iliasmaxversion;
166 }

Referenced by __init().

+ Here is the caller graph for this function:

◆ setIliasMinVersion()

ilPlugin::setIliasMinVersion (   $a_iliasminversion)
private

Set Required ILIAS min.

release.

Parameters
string$a_iliasminversionRequired ILIAS min. release

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

144 {
145 $this->iliasminversion = $a_iliasminversion;
146 }

Referenced by __init().

+ Here is the caller graph for this function:

◆ setLastUpdateVersion()

ilPlugin::setLastUpdateVersion (   $a_lastupdateversion)
private

Set Version of last update.

Parameters
string$a_lastupdateversionVersion of last update

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

104 {
105 $this->lastupdateversion = $a_lastupdateversion;
106 }

Referenced by __init().

+ Here is the caller graph for this function:

◆ setSlotObject()

ilPlugin::setSlotObject (   $a_slot)
protected

Set Plugin Slot.

Parameters
object$a_slotPlugin Slot

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

204 {
205 $this->slot = $a_slot;
206 }

Referenced by __init().

+ Here is the caller graph for this function:

◆ setVersion()

ilPlugin::setVersion (   $a_version)
private

Set Current Version (from plugin.php file).

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

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

124 {
125 $this->version = $a_version;
126 }

Referenced by __init().

+ Here is the caller graph for this function:

◆ slotInit()

◆ txt()

ilPlugin::txt (   $a_var)

Get Language Variable (prefix will be prepended automatically)

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

519 {
520 global $lng;
521 $this->loadLanguageModule();
522 return $lng->txt($this->getPrefix()."_".$a_var, $this->getPrefix());
523 }

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

+ Here is the call graph for this function:

◆ uninstall()

ilPlugin::uninstall ( )
final

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

845 {
846 global $ilDB;
847
848 if($this->beforeUninstall())
849 {
850 // remove all language entries (see ilObjLanguage)
851 // see updateLanguages
852 $prefix = $this->getPrefix();
853 if($prefix)
854 {
855 $ilDB->manipulate("DELETE FROM lng_data".
856 " WHERE module = ".$ilDB->quote($prefix, "text"));
857 $ilDB->manipulate("DELETE FROM lng_modules".
858 " WHERE module = ".$ilDB->quote($prefix, "text"));
859 }
860
861 // db version is kept in il_plugin - will be deleted, too
862
863 $q = "DELETE FROM il_plugin".
864 " WHERE component_type = ".$ilDB->quote($this->getComponentType(), "text").
865 " AND component_name = ".$ilDB->quote($this->getComponentName(), "text").
866 " AND slot_id = ".$ilDB->quote($this->getSlotId(), "text").
867 " AND name = ".$ilDB->quote($this->getPluginName(), "text");
868 $ilDB->manipulate($q);
869
870 $this->afterUninstall();
871
873 return true;
874 }
875
876 return false;
877 }

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

+ Here is the call graph for this function:

◆ update()

ilPlugin::update ( )

Update plugin.

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

888 {
889 global $ilDB, $ilCtrl;
890
892
893 $result = $this->beforeUpdate();
894 if ($result === false) {
895 return false;
896 }
897
898 // DB update
899 if ($result === true)
900 {
901 $result = $this->updateDatabase();
902 }
903
904 // Load language files
905 $this->updateLanguages();
906
907 // load control structure
908 include_once("./setup/classes/class.ilCtrlStructureReader.php");
909 $structure_reader = new ilCtrlStructureReader();
910 $structure_reader->readStructure(true, "./".$this->getDirectory(), $this->getPrefix(),
911 $this->getDirectory());
912 // $ilCtrl->storeCommonStructures();
913
914 // add config gui to the ctrl calls
915 $ilCtrl->insertCtrlCalls("ilobjcomponentsettingsgui", ilPlugin::getConfigureClassName($this->getPluginName()),
916 $this->getPrefix());
917
918 // set last update version to current version
919 if ($result === true)
920 {
921 $q = "UPDATE il_plugin SET last_update_version = ".$ilDB->quote($this->getVersion(), "text").
922 " WHERE component_type = ".$ilDB->quote($this->getComponentType(), "text").
923 " AND component_name = ".$ilDB->quote($this->getComponentName(), "text").
924 " AND slot_id = ".$ilDB->quote($this->getSlotId(), "text").
925 " AND name = ".$ilDB->quote($this->getPluginName(), "text");
926
927 $ilDB->manipulate($q);
928 $this->afterUpdate();
929 }
930
931 return $result;
932 }
Class ilCtrlStructureReader.
updateLanguages($a_lang_keys=null)
afterUpdate()
After update processing.
getVersion()
Get Current Version (from plugin.php file).
beforeUpdate()
Before update processing.
static getConfigureClassName($a_name)
Get plugin configure class name.
updateDatabase()
Update database.
global $ilCtrl
Definition: ilias.php:18

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

Referenced by activate().

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

◆ updateDatabase()

ilPlugin::updateDatabase ( )

Update database.

Reimplemented in ilCachedPlugin.

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

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

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

Referenced by update().

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

◆ updateLanguages()

ilPlugin::updateLanguages (   $a_lang_keys = null)

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

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

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

Referenced by update().

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

◆ writeDBVersion()

ilPlugin::writeDBVersion (   $a_dbversion)

Write DB version to database.

Parameters
int$a_dbversionDB Version

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

244 {
245 global $ilDB;
246
247 $this->setDBVersion($a_dbversion);
248
249 $q = "UPDATE il_plugin SET db_version = ".$ilDB->quote((int) $this->getDBVersion(), "integer").
250 " WHERE component_type = ".$ilDB->quote($this->getComponentType(), "text").
251 " AND component_name = ".$ilDB->quote($this->getComponentName(), "text").
252 " AND slot_id = ".$ilDB->quote($this->getSlotId(), "text").
253 " AND name = ".$ilDB->quote($this->getPluginName(), "text");
254
255 $ilDB->manipulate($q);
256 }
getDBVersion()
Get DB Version.

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

+ Here is the call graph for this function:

Field Documentation

◆ $id

ilPlugin::$id = ''
protected

◆ $lang_initialised

ilPlugin::$lang_initialised = false
protected

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


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