ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
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...
 
 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)
 
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...
 
 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 698 of file class.ilPlugin.php.

699 {
700 global $ilDB, $lng, $ilPluginAdmin;
701
702 // read/set basic data
704 $this->getComponentName(), $this->getSlotId(), $this->getPluginName());
705 $this->setLastUpdateVersion($rec["last_update_version"]);
706 $this->setDBVersion($rec["db_version"]);
707 $this->setActive($rec["active"]);
708
709 // get id
710 $this->setId($ilPluginAdmin->getId($this->getComponentType(),
711 $this->getComponentName(),
712 $this->getSlotId(),
713 $this->getPluginName()));
714
715 // get version
716 $this->setVersion($ilPluginAdmin->getVersion($this->getComponentType(),
717 $this->getComponentName(),
718 $this->getSlotId(),
719 $this->getPluginName()));
720
721 // get ilias min version
722 $this->setIliasMinVersion($ilPluginAdmin->getIliasMinVersion($this->getComponentType(),
723 $this->getComponentName(),
724 $this->getSlotId(),
725 $this->getPluginName()));
726
727 // get ilias max version
728 $this->setIliasMaxVersion($ilPluginAdmin->getIliasMaxVersion($this->getComponentType(),
729 $this->getComponentName(),
730 $this->getSlotId(),
731 $this->getPluginName()));
732
733 // get slot object
734 $this->setSlotObject(new ilPluginSlot($this->getComponentType(),
735 $this->getComponentName(), $this->getSlotId()));
736
737 // load language module
738
739 // Fix for authentication plugins
740 $this->loadLanguageModule();
741
742 // call slot and plugin init methods
743 $this->slotInit();
744 $this->init();
745 }
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:40
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 273 of file class.ilPlugin.php.

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.

References ilPluginSlot\_getPluginsDirectory().

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

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

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

789 {
790 global $lng, $ilDB;
791
793
794 $result = true;
795
796 // check whether update is necessary
797 if ($this->needsUpdate())
798 {
799 //$result = $this->isUpdatePossible();
800
801 // do update
802 if ($result === true)
803 {
804 $result = $this->update();
805 }
806 }
807 if ($result === true)
808 {
809 $result = $this->beforeActivation();
810 // activate plugin
811 if ($result === true)
812 {
813 $q = "UPDATE il_plugin SET active = ".$ilDB->quote(1, "integer").",".
814 " plugin_id = ".$ilDB->quote($this->getId(), "text").
815 " WHERE component_type = ".$ilDB->quote($this->getComponentType(), "text").
816 " AND component_name = ".$ilDB->quote($this->getComponentName(), "text").
817 " AND slot_id = ".$ilDB->quote($this->getSlotId(), "text").
818 " AND name = ".$ilDB->quote($this->getPluginName(), "text");
819
820 $ilDB->manipulate($q);
821 $this->afterActivation();
822 }
823 }
825 return $result;
826 }
$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 601 of file class.ilPlugin.php.

602 {
603 $a_tpl->addBlockFile($a_var, $a_block,
604 $this->getDirectory()."/templates/".$a_tplname);
605 }
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 842 of file class.ilPlugin.php.

843 {
844 }

Referenced by activate().

+ Here is the caller graph for this function:

◆ afterDeactivation()

ilPlugin::afterDeactivation ( )
protected

After deactivation processing.

Reimplemented in ilCachedPlugin.

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

874 {
875 }

Referenced by deactivate().

+ Here is the caller graph for this function:

◆ afterUninstall()

ilPlugin::afterUninstall ( )
protected

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

921 {
922 // plugin-specific
923 }

Referenced by uninstall().

+ Here is the caller graph for this function:

◆ afterUpdate()

ilPlugin::afterUpdate ( )
protected

After update processing.

Reimplemented in ilCachedPlugin.

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

990 {
991 }

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

832 {
833 return true; // false would indicate that anything went wrong
834 // activation would not proceed
835 // throw an exception in this case
836 //throw new ilPluginException($lng->txt(""));
837 }

Referenced by activate().

+ Here is the caller graph for this function:

◆ beforeUninstall()

ilPlugin::beforeUninstall ( )
protected

Reimplemented in ilRepositoryObjectPlugin.

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

879 {
880 // plugin-specific
881 // false would indicate that anything went wrong
882 return true;
883 }

Referenced by uninstall().

+ Here is the caller graph for this function:

◆ beforeUpdate()

ilPlugin::beforeUpdate ( )
protected

Before update processing.

Reimplemented in ilCachedPlugin.

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

979 {
980 return true; // false would indicate that anything went wrong
981 // update would not proceed
982 // throw an exception in this case
983 //throw new ilPluginException($lng->txt(""));
984 }

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

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

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

850 {
851 global $ilDB;
852
854
855 $result = true;
856
857 $q = "UPDATE il_plugin SET active = ".$ilDB->quote(0, "integer").
858 " WHERE component_type = ".$ilDB->quote($this->getComponentType(), "text").
859 " AND component_name = ".$ilDB->quote($this->getComponentName(), "text").
860 " AND slot_id = ".$ilDB->quote($this->getSlotId(), "text").
861 " AND name = ".$ilDB->quote($this->getPluginName(), "text");
862
863 $ilDB->manipulate($q);
864 $this->afterDeactivation();
865
866 return $result;
867 }
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 194 of file class.ilPlugin.php.

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

◆ getActivePluginsForSlot()

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

Get all active plugins for a slot.

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

1063 {
1064 global $ilDB, $ilPluginAdmin;
1065
1066 $plugins = array();
1067
1068 // $q = "SELECT * FROM il_plugin WHERE component_type = ".$ilDB->quote($a_ctype, "text").
1069 // " AND component_name = ".$ilDB->quote($a_cname, "text").
1070 // " AND slot_id = ".$ilDB->quote($a_slot_id, "text").
1071 // " AND active = ".$ilDB->quote(1, "integer");
1072 //
1073 // $set = $ilDB->query($q);
1074 $cached_component = ilCachedComponentData::getInstance();
1075 // while($rec = $ilDB->fetchAssoc($set))
1076 $lookupActivePluginsBySlotId = $cached_component->lookupActivePluginsBySlotId($a_slot_id);
1077 foreach($lookupActivePluginsBySlotId as $rec)
1078 {
1079 if ($ilPluginAdmin->isActive($a_ctype, $a_cname, $a_slot_id, $rec["name"]))
1080 {
1081 $plugins[] = $rec["name"];
1082 }
1083 }
1084
1085 return $plugins;
1086 }

References $ilDB, and ilCachedComponentData\getInstance().

Referenced by ilPluginAdmin\getActivePluginsForSlot().

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

◆ getAvailableLangFiles()

static ilPlugin::getAvailableLangFiles (   $a_lang_directory)
static

Get array of all language files in the plugin.

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

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

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

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

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

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

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

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

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

+ Here is the caller graph for this function:

◆ getDBVersion()

ilPlugin::getDBVersion ( )

Get DB Version.

Returns
int DB Version

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

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

Referenced by writeDBVersion().

+ Here is the caller graph for this function:

◆ getDirectory()

ilPlugin::getDirectory ( )

Get Plugin Directory.

Returns
object Plugin Slot

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

266 {
267 return $this->getSlotObject()->getPluginsDirectory()."/".$this->getPluginName();
268 }
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 ( )

Get Id.

Returns
string Id

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

95 {
96 return $this->id;
97 }

References $id.

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

+ Here is the caller graph for this function:

◆ getIliasMaxVersion()

ilPlugin::getIliasMaxVersion ( )

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

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)

Get image path.

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

576 {
577 return self::_getImagePath($this->getComponentType(), $this->getComponentName(), $this->getSlotId(),
578 $this->getPluginName(), $a_img);
579 }
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 303 of file class.ilPlugin.php.

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

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

Returns
string Plugin Name

Referenced by __init(), activate(), deactivate(), getDirectory(), getImagePath(), ilCloudHookPlugin\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 1001 of file class.ilPlugin.php.

1002 {
1003 global $ilDB;
1004
1005 include_once("./Services/Component/classes/class.ilPluginSlot.php");
1006 $slot_name = ilPluginSlot::lookupSlotName($a_ctype, $a_cname, $a_slot_id);
1007
1008 $cached_component = ilCachedComponentData::getInstance();
1009 $rec = $cached_component->lookCompId($a_ctype, $a_cname);
1010 if (! $rec) {
1011 return NULL;
1012 }
1013
1014 // this check is done due to security reasons
1015 // $set = $ilDB->queryF("SELECT * FROM il_component WHERE type = %s ".
1016 // " AND name = %s", array("text", "text"),
1017 // array($a_ctype, $a_cname));
1018 // if (!$ilDB->fetchAssoc($set))
1019 // {
1020 // return null;
1021 // }
1022
1023 $file = "./Customizing/global/plugins/".$a_ctype."/".
1024 $a_cname."/".$slot_name."/".
1025 $a_pname."/classes/class.il".$a_pname."Plugin.php";
1026
1027 if (is_file($file))
1028 {
1029 include_once($file);
1030 $class = "il".$a_pname."Plugin";
1031 $plugin = new $class();
1032 return $plugin;
1033 }
1034
1035 return null;
1036 }
static lookupSlotName($a_ctype, $a_cname, $a_slot_id)
Lookup slot name for component and slot id.

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

Referenced by ilObjectCopySearchResultTableGUI\__construct(), ilObjectPlugin\__construct(), ilObjectPluginGUI\__construct(), SurveyQuestion\_getQuestionTypeName(), assQuestion\_getQuestionTypeName(), ilObjQuestionPool\_getQuestionTypes(), ilObjSurveyQuestionPool\_getQuestiontypes(), ilObjSurveyQuestionPool\_getQuestionTypeTranslations(), SurveyQuestion\_includeClass(), ilObjComponentSettingsGUI\activatePlugin(), ilObjComponentSettingsGUI\confirmUninstallPlugin(), ilObjComponentSettingsGUI\deactivatePlugin(), ilPluginAdmin\getPluginObject(), ilObjTest\getQuestionTypeTranslations(), ilObjQuestionPool\getQuestionTypeTranslations(), ilPluginAdmin\includeClass(), assQuestion\includePluginClass(), ilObjectPluginListGUI\init(), 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 644 of file class.ilPlugin.php.

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

References ilCachedComponentData\getInstance().

Referenced by __init(), ilPluginAdmin\getPluginData(), and ilCloudHookPlugin\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 373 of file class.ilPlugin.php.

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

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

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

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

+ Here is the caller graph for this function:

◆ getStyleSheetLocation()

ilPlugin::getStyleSheetLocation (   $a_css_file)

Get css file location.

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

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

393 {
394 return $this->getPrefix();
395 }
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 546 of file class.ilPlugin.php.

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

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

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

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 }

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

294 {
295 include_once($this->getClassesDirectory()."/".$a_class_file_name);
296 }
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 759 of file class.ilPlugin.php.

760 {
761 }

Referenced by __init().

+ Here is the caller graph for this function:

◆ isActive()

ilPlugin::isActive ( )

Check whether plugin is active.

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

767 {
768 global $ilPluginAdmin;
769
770 return $ilPluginAdmin->isActive($this->getComponentType(),
771 $this->getComponentName(), $this->getSlotId(), $this->getPluginName());
772 }

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

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 }

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

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

Lookup id for name.

Reimplemented in ilCachedPlugin.

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

1112 {
1113 global $ilDB;
1114
1115 $q = "SELECT plugin_id FROM il_plugin ".
1116 " WHERE component_type = ".$ilDB->quote($a_ctype, "text").
1117 " AND component_name = ".$ilDB->quote($a_cname, "text").
1118 " AND slot_id = ".$ilDB->quote($a_slot_id, "text").
1119 " AND name = ".$ilDB->quote($a_plugin_name, "text");
1120
1121 $set = $ilDB->query($q);
1122 if ($rec = $ilDB->fetchAssoc($set))
1123 {
1124 return $rec["plugin_id"];
1125 }
1126 }

References $ilDB.

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

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

Reimplemented in ilCachedPlugin.

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

1092 {
1093 global $ilDB;
1094
1095 $q = "SELECT name FROM il_plugin ".
1096 " WHERE component_type = ".$ilDB->quote($a_ctype, "text").
1097 " AND component_name = ".$ilDB->quote($a_cname, "text").
1098 " AND slot_id = ".$ilDB->quote($a_slot_id, "text").
1099 " AND plugin_id = ".$ilDB->quote($a_plugin_id, "text");
1100
1101 $set = $ilDB->query($q);
1102 if ($rec = $ilDB->fetchAssoc($set))
1103 {
1104 return $rec["name"];
1105 }
1106 }

References $ilDB.

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

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

1043 {
1044 global $ilDB;
1045
1046 $q = "SELECT * FROM il_plugin WHERE ".
1047 " component_type = ".$ilDB->quote($a_ctype, "text")." AND ".
1048 " component_name = ".$ilDB->quote($a_cname, "text")." AND ".
1049 " slot_id = ".$ilDB->quote($a_slot_id, "text")." AND ".
1050 " name = ".$ilDB->quote($a_pname, "text");
1051
1052 $set = $ilDB->query($q);
1053
1054 $rec = $ilDB->fetchAssoc($set);
1055
1056 return $rec;
1057 }

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

◆ needsUpdate()

ilPlugin::needsUpdate ( )

Check whether update is needed.

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

778 {
779 global $ilPluginAdmin;
780
781 return $ilPluginAdmin->isActive($this->getComponentType(),
782 $this->getComponentName(), $this->getSlotId(), $this->getPluginName());
783 }

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Referenced by __init().

+ Here is the caller graph for this function:

◆ slotInit()

ilPlugin::slotInit ( )
abstractprotected

◆ txt()

ilPlugin::txt (   $a_var)

Get Language Variable (prefix will be prepended automatically)

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

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

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

+ Here is the call graph for this function:

◆ uninstall()

ilPlugin::uninstall ( )
final

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

886 {
887 global $ilDB;
888
889 if($this->beforeUninstall())
890 {
891 // remove all language entries (see ilObjLanguage)
892 // see updateLanguages
893 $prefix = $this->getPrefix();
894 if($prefix)
895 {
896 $ilDB->manipulate("DELETE FROM lng_data".
897 " WHERE module = ".$ilDB->quote($prefix, "text"));
898 $ilDB->manipulate("DELETE FROM lng_modules".
899 " WHERE module = ".$ilDB->quote($prefix, "text"));
900 }
901
902 // db version is kept in il_plugin - will be deleted, too
903
904 $q = "DELETE FROM il_plugin".
905 " WHERE component_type = ".$ilDB->quote($this->getComponentType(), "text").
906 " AND component_name = ".$ilDB->quote($this->getComponentName(), "text").
907 " AND slot_id = ".$ilDB->quote($this->getSlotId(), "text").
908 " AND name = ".$ilDB->quote($this->getPluginName(), "text");
909 $ilDB->manipulate($q);
910
911 $this->afterUninstall();
912
914 return true;
915 }
916
917 return false;
918 }

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

929 {
930 global $ilDB, $ilCtrl;
931
933
934 $result = $this->beforeUpdate();
935 if ($result === false) {
936 return false;
937 }
938
939 // DB update
940 if ($result === true)
941 {
942 $result = $this->updateDatabase();
943 }
944
945 // Load language files
946 $this->updateLanguages();
947
948 // load control structure
949 include_once("./setup/classes/class.ilCtrlStructureReader.php");
950 $structure_reader = new ilCtrlStructureReader();
951 $structure_reader->readStructure(true, "./".$this->getDirectory(), $this->getPrefix(),
952 $this->getDirectory());
953 // $ilCtrl->storeCommonStructures();
954
955 // add config gui to the ctrl calls
956 $ilCtrl->insertCtrlCalls("ilobjcomponentsettingsgui", ilPlugin::getConfigureClassName($this->getPluginName()),
957 $this->getPrefix());
958
959 // set last update version to current version
960 if ($result === true)
961 {
962 $q = "UPDATE il_plugin SET last_update_version = ".$ilDB->quote($this->getVersion(), "text").
963 " WHERE component_type = ".$ilDB->quote($this->getComponentType(), "text").
964 " AND component_name = ".$ilDB->quote($this->getComponentName(), "text").
965 " AND slot_id = ".$ilDB->quote($this->getSlotId(), "text").
966 " AND name = ".$ilDB->quote($this->getPluginName(), "text");
967
968 $ilDB->manipulate($q);
969 $this->afterUpdate();
970 }
971
972 return $result;
973 }
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 469 of file class.ilPlugin.php.

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

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

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

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 }
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

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

Referenced by getId(), and ilCloudHookPlugin\getPluginTablePrefix().

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