ILIAS  Release_4_4_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
ilPlugin Class Reference
+ Inheritance diagram for ilPlugin:
+ Collaboration diagram for ilPlugin:

Public Member Functions

 __construct ()
 Constructor.
 getComponentType ()
 Get Component Type.
 getComponentName ()
 Get Component Name.
 getSlot ()
 Get Slot Name.
 getSlotId ()
 Get Slot ID.
 getPluginName ()
 Get Plugin Name.
 getId ()
 Get Id.
 getLastUpdateVersion ()
 Get Version of last update.
 getVersion ()
 Get Current Version (from plugin.php file).
 getIliasMinVersion ()
 Get Required ILIAS min.
 getIliasMaxVersion ()
 Get Required ILIAS max.
 getActive ()
 Get Active.
 setDBVersion ($a_dbversion)
 Set DB Version.
 getDBVersion ()
 Get DB Version.
 writeDBVersion ($a_dbversion)
 Write DB version to database.
 getDirectory ()
 Get Plugin Directory.
 includeClass ($a_class_file_name)
 Include (once) a class file.
 getPrefix ()
 Get plugin prefix, used for lang vars.
 getTablePrefix ()
 Get db table plugin prefix.
 updateLanguages ()
 Update all languages.
 updateDatabase ()
 Update database.
 loadLanguageModule ()
 Load language module for plugin.
 txt ($a_var)
 Get Language Variable (prefix will be prepended automatically)
 getTemplate ($a_template, $a_par1=true, $a_par2=true)
 Get template from plugin.
 getImagePath ($a_img)
 Get image path.
 getStyleSheetLocation ($a_css_file)
 Get css file location.
 addBlockFile ($a_tpl, $a_var, $a_block, $a_tplname)
 Add template content to placeholder variable.
 isActive ()
 Check whether plugin is active.
 needsUpdate ()
 Check whether update is needed.
 activate ()
 Activate.
 deactivate ()
 Deactivate.
 update ()
 Update plugin.
 lookupNameForId ($a_ctype, $a_cname, $a_slot_id, $a_plugin_id)
 Lookup name for id.
 lookupIdForName ($a_ctype, $a_cname, $a_slot_id, $a_plugin_name)
 Lookup id for name.

Static Public Member Functions

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

Protected Member Functions

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

Protected Attributes

 $lang_initialised = false

Private Member Functions

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

Detailed Description

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

Constructor & Destructor Documentation

ilPlugin::__construct ( )
final

Constructor.

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

References __init().

{
$this->__init();
}

+ Here is the call graph for this function:

Member Function Documentation

ilPlugin::__init ( )
finalprivate

Default initialization.

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

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

Referenced by __construct().

{
global $ilDB, $lng, $ilPluginAdmin;
// read/set basic data
$this->getComponentName(), $this->getSlotId(), $this->getPluginName());
$this->setLastUpdateVersion($rec["last_update_version"]);
$this->setDBVersion($rec["db_version"]);
$this->setActive($rec["active"]);
// get id
$this->setId($ilPluginAdmin->getId($this->getComponentType(),
$this->getComponentName(),
$this->getSlotId(),
$this->getPluginName()));
// get version
$this->setVersion($ilPluginAdmin->getVersion($this->getComponentType(),
$this->getComponentName(),
$this->getSlotId(),
$this->getPluginName()));
// get ilias min version
$this->setIliasMinVersion($ilPluginAdmin->getIliasMinVersion($this->getComponentType(),
$this->getComponentName(),
$this->getSlotId(),
$this->getPluginName()));
// get ilias max version
$this->setIliasMaxVersion($ilPluginAdmin->getIliasMaxVersion($this->getComponentType(),
$this->getComponentName(),
$this->getSlotId(),
$this->getPluginName()));
// get slot object
$this->getComponentName(), $this->getSlotId()));
// load language module
// Fix for authentication plugins
// call slot and plugin init methods
$this->slotInit();
$this->init();
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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

Get plugin directory.

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

References ilPluginSlot\_getPluginsDirectory().

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

{
include_once "Services/Component/classes/class.ilPluginSlot.php";
return ilPluginSlot::_getPluginsDirectory($a_ctype, $a_cname, $a_slot_id)."/".$a_pname;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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

Get image path.

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

References $d, and _getDirectory().

Referenced by ilRepositoryObjectPlugin\_getIcon().

{
$d = ilPlugin::_getDirectory($a_ctype, $a_cname, $a_slot_id, $a_pname);
return $d."/templates/images/".$a_img;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilPlugin::activate ( )
final

Activate.

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

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

{
global $lng, $ilDB;
$result = true;
// check whether update is necessary
if ($this->needsUpdate())
{
//$result = $this->isUpdatePossible();
// do update
if ($result === true)
{
$result = $this->update();
}
}
if ($result === true)
{
// activate plugin
if ($result === true)
{
$q = "UPDATE il_plugin SET active = ".$ilDB->quote(1, "integer").",".
" plugin_id = ".$ilDB->quote($this->getId(), "text").
" WHERE component_type = ".$ilDB->quote($this->getComponentType(), "text").
" AND component_name = ".$ilDB->quote($this->getComponentName(), "text").
" AND slot_id = ".$ilDB->quote($this->getSlotId(), "text").
" AND name = ".$ilDB->quote($this->getPluginName(), "text");
$ilDB->manipulate($q);
$this->afterActivation();
}
}
return $result;
}

+ Here is the call graph for this function:

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

Add template content to placeholder variable.

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

References getDirectory().

{
$a_tpl->addBlockFile($a_var, $a_block,
$this->getDirectory()."/templates/".$a_tplname);
}

+ Here is the call graph for this function:

ilPlugin::afterActivation ( )
protected

After activation processing.

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

Referenced by activate().

{
}

+ Here is the caller graph for this function:

ilPlugin::beforeActivation ( )
protected

Before activation processing.

Reimplemented in ilRepositoryObjectPlugin.

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

Referenced by activate().

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

+ Here is the caller graph for this function:

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

Create plugin record, if not existing.

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

Referenced by ilPluginSlot\getPluginsInformation().

{
global $ilDB;
// check record existence record
$q = "SELECT * FROM il_plugin".
" WHERE component_type = ".$ilDB->quote($a_ctype, "text").
" AND component_name = ".$ilDB->quote($a_cname, "text").
" AND slot_id = ".$ilDB->quote($a_slot_id, "text").
" AND name = ".$ilDB->quote($a_pname, "text");
$set = $ilDB->query($q);
if (!$rec = $ilDB->fetchAssoc($set))
{
$q = "INSERT INTO il_plugin (component_type, component_name, slot_id, name)".
" VALUES (".$ilDB->quote($a_ctype, "text").",".
$ilDB->quote($a_cname, "text").",".
$ilDB->quote($a_slot_id, "text").",".
$ilDB->quote($a_pname, "text").")";
$ilDB->manipulate($q);
}
}

+ Here is the caller graph for this function:

ilPlugin::deactivate ( )
final

Deactivate.

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

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

{
global $ilDB;
$result = true;
$q = "UPDATE il_plugin SET active = ".$ilDB->quote(0, "integer").
" WHERE component_type = ".$ilDB->quote($this->getComponentType(), "text").
" AND component_name = ".$ilDB->quote($this->getComponentName(), "text").
" AND slot_id = ".$ilDB->quote($this->getSlotId(), "text").
" AND name = ".$ilDB->quote($this->getPluginName(), "text");
$ilDB->manipulate($q);
return $result;
}

+ Here is the call graph for this function:

ilPlugin::getActive ( )
final

Get Active.

Returns
boolean Active

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

{
return $this->active;
}
static ilPlugin::getActivePluginsForSlot (   $a_ctype,
  $a_cname,
  $a_slot_id 
)
staticfinal

Get all active plugins for a slot.

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

{
global $ilDB, $ilPluginAdmin;
$q = "SELECT * FROM il_plugin WHERE component_type = ".$ilDB->quote($a_ctype, "text").
" AND component_name = ".$ilDB->quote($a_cname, "text").
" AND slot_id = ".$ilDB->quote($a_slot_id, "text").
" AND active = ".$ilDB->quote(1, "integer");
$set = $ilDB->query($q);
$plugins = array();
while($rec = $ilDB->fetchAssoc($set))
{
if ($ilPluginAdmin->isActive($a_ctype, $a_cname, $a_slot_id, $rec["name"]))
{
$plugins[] = $rec["name"];
}
}
return $plugins;
}
static ilPlugin::getAvailableLangFiles (   $a_lang_directory)
staticfinal

Get array of all language files in the plugin.

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

References $file.

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

{
$langs = array();
if (!@is_dir($a_lang_directory))
{
return array();
}
$dir = opendir($a_lang_directory);
while($file = readdir($dir))
{
if ($file != "." and
$file != "..")
{
// directories
if (@is_file($a_lang_directory."/".$file))
{
if (substr($file, 0, 6) == "ilias_" &&
substr($file, strlen($file) - 5) == ".lang")
{
$langs[] = array("key" => substr($file, 6, 2), "file" => $file,
"path" => $a_lang_directory."/".$file);
}
}
}
}
return $langs;
}

+ Here is the caller graph for this function:

ilPlugin::getClassesDirectory ( )
finalprotected

Get Plugin's classes Directory.

Returns
object classes directory

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

References getDirectory().

Referenced by includeClass().

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

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilPlugin::getComponentName ( )
abstract
ilPlugin::getComponentType ( )
abstract
static ilPlugin::getConfigureClassName (   $a_name)
staticfinal

Get plugin configure class name.

Parameters
@return

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

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

{
return "il".$a_name."ConfigGUI";
}

+ Here is the caller graph for this function:

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

Get DB update script filename (full path)

Returns
string DB Update script name

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

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

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

+ Here is the caller graph for this function:

ilPlugin::getDBVersion ( )
final

Get DB Version.

Returns
int DB Version

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

Referenced by writeDBVersion().

{
return $this->dbversion;
}

+ Here is the caller graph for this function:

ilPlugin::getDirectory ( )
final

Get Plugin Directory.

Returns
object Plugin Slot

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

References getPluginName(), and getSlotObject().

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

{
return $this->getSlotObject()->getPluginsDirectory()."/".$this->getPluginName();
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilPlugin::getId ( )
final

Get Id.

Returns
string Id

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

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

{
return $this->id;
}

+ Here is the caller graph for this function:

ilPlugin::getIliasMaxVersion ( )
final

Get Required ILIAS max.

release.

Returns
string Required ILIAS max. release

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

{
return $this->iliasmaxversion;
}
ilPlugin::getIliasMinVersion ( )
final

Get Required ILIAS min.

release.

Returns
string Required ILIAS min. release

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

{
return $this->iliasminversion;
}
ilPlugin::getImagePath (   $a_img)
final

Get image path.

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

References getDirectory().

{
return $this->getDirectory()."/templates/images/".$a_img;
}

+ Here is the call graph for this function:

ilPlugin::getLanguageDirectory ( )
finalprotected

Get Plugin's language Directory.

Returns
object classes directory

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

References getDirectory().

Referenced by updateLanguages().

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

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilPlugin::getLastUpdateVersion ( )
final

Get Version of last update.

Returns
string Version of last update

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

{
return $this->lastupdateversion;
}
ilPlugin::getPluginName ( )
abstract

Get Plugin Name.

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

Must be overwritten in plugin class of plugin (and should be made final)

Returns
string Plugin Name

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

+ Here is the caller graph for this function:

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

Get plugin object.

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

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

References $file, and ilPluginSlot\lookupSlotName().

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

{
global $ilDB;
include_once("./Services/Component/classes/class.ilPluginSlot.php");
$slot_name = ilPluginSlot::lookupSlotName($a_ctype, $a_cname, $a_slot_id);
// this check is done due to security reasons
$set = $ilDB->queryF("SELECT * FROM il_component WHERE type = %s ".
" AND name = %s", array("text", "text"),
array($a_ctype, $a_cname));
if (!$ilDB->fetchAssoc($set))
{
return null;
}
$file = "./Customizing/global/plugins/".$a_ctype."/".
$a_cname."/".$slot_name."/".
$a_pname."/classes/class.il".$a_pname."Plugin.php";
if (is_file($file))
{
include_once($file);
$class = "il".$a_pname."Plugin";
$plugin = new $class();
return $plugin;
}
return null;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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

Get record from il_plugin table.

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

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

{
global $ilDB;
// read/set basic data
$q = "SELECT * FROM il_plugin".
" WHERE component_type = ".$ilDB->quote($a_ctype, "text").
" AND component_name = ".$ilDB->quote($a_cname, "text").
" AND slot_id = ".$ilDB->quote($a_slot_id, "text").
" AND name = ".$ilDB->quote($a_pname, "text");
$set = $ilDB->query($q);
if ($rec = $ilDB->fetchAssoc($set))
{
return $rec;
}
else // no record? create one
{
// silently create these records is not a good idea, since
// the function can be called with "wrong parameters"
// raise exceptions instead
include_once("./Services/Component/exceptions/class.ilPluginException.php");
throw (new ilPluginException("No plugin record found for '".$a_ctype."', '".$a_cname."', '".$a_slot_id."', '".$a_pname."'."));
$q = "INSERT INTO il_plugin (component_type, component_name, slot_id, name)".
" VALUES (".$ilDB->quote($a_ctype, "text").",".
$ilDB->quote($a_cname, "text").",".
$ilDB->quote($a_slot_id, "text").",".
$ilDB->quote($a_pname, "text").")";
$ilDB->manipulate($q);
$q = "SELECT * FROM il_plugin".
" WHERE component_type = ".$ilDB->quote($a_ctype, "text").
" AND component_name = ".$ilDB->quote($a_cname, "text").
" AND slot_id = ".$ilDB->quote($a_slot_id, "text").
" AND name = ".$ilDB->quote($a_pname, "text");
$set = $ilDB->query($q);
return $ilDB->fetchAssoc($set);
}
}

+ Here is the caller graph for this function:

ilPlugin::getPrefix ( )
final

Get plugin prefix, used for lang vars.

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

References getId(), and getSlotObject().

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

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

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilPlugin::getSlotId ( )
abstract
ilPlugin::getSlotObject ( )
finalprotected

Get Plugin Slot.

Returns
object Plugin Slot

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

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

{
return $this->slot;
}

+ Here is the caller graph for this function:

ilPlugin::getStyleSheetLocation (   $a_css_file)
final

Get css file location.

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

References getDirectory().

{
return $this->getDirectory()."/templates/".$a_css_file;
}

+ Here is the call graph for this function:

ilPlugin::getTablePrefix ( )
final

Get db table plugin prefix.

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

References getPrefix().

Referenced by updateDatabase().

{
return $this->getPrefix();
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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

Get template from plugin.

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

References $tpl, and getDirectory().

{
$tpl = new ilTemplate($this->getDirectory()."/templates/".$a_template, $a_par1, $a_par2);
return $tpl;
}

+ Here is the call graph for this function:

ilPlugin::getVersion ( )
final

Get Current Version (from plugin.php file).

Returns
string Current Version (from plugin.php file)

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

Referenced by update().

{
return $this->version;
}

+ Here is the caller graph for this function:

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

Has the plugin a configure class?

Parameters
stringslot directory
stringplugin name
Returns
boolean true/false

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

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

{
if (is_file($a_slot_dir."/".
$a_name."/classes/class.il".$a_name."ConfigGUI.php"))
{
return true;
}
return false;
}

+ Here is the caller graph for this function:

ilPlugin::includeClass (   $a_class_file_name)
final

Include (once) a class file.

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

References getClassesDirectory().

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

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

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilPlugin::init ( )
protected

Object initialization.

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

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

Referenced by __init().

{
}

+ Here is the caller graph for this function:

ilPlugin::isActive ( )
final

Check whether plugin is active.

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

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

{
global $ilPluginAdmin;
return $ilPluginAdmin->isActive($this->getComponentType(),
$this->getComponentName(), $this->getSlotId(), $this->getPluginName());
}

+ Here is the call graph for this function:

ilPlugin::loadLanguageModule ( )
final

Load language module for plugin.

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

References $lng, and getPrefix().

Referenced by __init(), and txt().

{
global $lng;
if (!$this->lang_initialised && is_object($lng))
{
$lng->loadLanguageModule($this->getPrefix());
$this->lang_initialised = true;
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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

Lookup id for name.

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

Referenced by ilObjRepositorySettings\getAllObjTypes(), ilModulesTableGUI\getComponents(), ilObjectDefinition\getGroupedRepositoryObjectTypes(), and ilObjectDefinition\readDefinitionData().

{
global $ilDB;
$q = "SELECT plugin_id FROM il_plugin ".
" WHERE component_type = ".$ilDB->quote($a_ctype, "text").
" AND component_name = ".$ilDB->quote($a_cname, "text").
" AND slot_id = ".$ilDB->quote($a_slot_id, "text").
" AND name = ".$ilDB->quote($a_plugin_name, "text");
$set = $ilDB->query($q);
if ($rec = $ilDB->fetchAssoc($set))
{
return $rec["plugin_id"];
}
}

+ Here is the caller graph for this function:

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

Lookup name for id.

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

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

{
global $ilDB;
$q = "SELECT name FROM il_plugin ".
" WHERE component_type = ".$ilDB->quote($a_ctype, "text").
" AND component_name = ".$ilDB->quote($a_cname, "text").
" AND slot_id = ".$ilDB->quote($a_slot_id, "text").
" AND plugin_id = ".$ilDB->quote($a_plugin_id, "text");
$set = $ilDB->query($q);
if ($rec = $ilDB->fetchAssoc($set))
{
return $rec["name"];
}
}

+ Here is the caller graph for this function:

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

Lookup information data in il_plugin.

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

Referenced by ilPluginSlot\getPluginsInformation().

{
global $ilDB;
$q = "SELECT * FROM il_plugin WHERE ".
" component_type = ".$ilDB->quote($a_ctype, "text")." AND ".
" component_name = ".$ilDB->quote($a_cname, "text")." AND ".
" slot_id = ".$ilDB->quote($a_slot_id, "text")." AND ".
" name = ".$ilDB->quote($a_pname, "text");
$set = $ilDB->query($q);
$rec = $ilDB->fetchAssoc($set);
return $rec;
}

+ Here is the caller graph for this function:

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

Lookup language text.

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

References $lng.

Referenced by ilObjRole\__getPermissionDefinitions(), ilPermission2GUI\__showPermissionsCreateSection(), ilPermission2GUI\__showPermissionsGeneralSection(), ilPermission2GUI\__showPermissionsObjectSection(), ilPermission2GUI\__showPermissionsRBACSection(), ilObject\_prepareCloneSelection(), ilContainerContentGUI\addHeaderRow(), ilPDSelectedItemsBlockGUI\addHeaderRow(), ilContainerContentGUI\addMessageRow(), ilObjSystemFolderGUI\checkObject(), ilRepUtilGUI\confirmRemoveFromSystemObject(), ilTrashTableGUI\fillRow(), ilSearchResultTableGUI\fillRow(), ilLPCollectionSettingsTableGUI\fillRow(), ilObjectOwnershipManagementTableGUI\fillRow(), ilAdminSubItemsTableGUI\fillRow(), ilObjectRoleTemplatePermissionTableGUI\fillRow(), ilObjectRolePermissionTableGUI\fillRow(), ilModulesTableGUI\getComponents(), ilLPObjectStatisticsTypesTableGUI\getItems(), ilObjectStatusGUI\getPermissionInfo(), ilLPTableBaseGUI\getPossibleTypes(), ilObjectListGUI\insertIconsAndCheckboxes(), ilObjectOwnershipManagementGUI\listObjects(), ilObjectAddNewItemGUI\parseRepository(), ilObjRoleTemplateGUI\permObject(), ilObjRoleGUI\permObject(), and ilRepUtilGUI\showDeleteConfirmation().

{
global $lng;
// this enables default language fallback
$prefix = $a_mod_prefix."_".$a_pl_id;
return $lng->txt($prefix."_".$a_lang_var, $prefix);
/*
return $lng->_lookupEntry($lng->lang_key, $a_mod_prefix."_".$a_pl_id,
$a_mod_prefix."_".$a_pl_id."_".$a_lang_var);
*/
}

+ Here is the caller graph for this function:

ilPlugin::needsUpdate ( )
final

Check whether update is needed.

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

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

Referenced by activate().

{
global $ilPluginAdmin;
return $ilPluginAdmin->isActive($this->getComponentType(),
$this->getComponentName(), $this->getSlotId(), $this->getPluginName());
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilPlugin::setActive (   $a_active)
finalprivate

Set Active.

Parameters
boolean$a_activeActive

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

Referenced by __init().

{
$this->active = $a_active;
}

+ Here is the caller graph for this function:

ilPlugin::setDBVersion (   $a_dbversion)
final

Set DB Version.

Parameters
int$a_dbversionDB Version

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

Referenced by __init(), and writeDBVersion().

{
$this->dbversion = $a_dbversion;
}

+ Here is the caller graph for this function:

ilPlugin::setId (   $a_id)
finalprivate

Set Id.

Parameters
string$a_idId

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

Referenced by __init().

{
$this->id = $a_id;
}

+ Here is the caller graph for this function:

ilPlugin::setIliasMaxVersion (   $a_iliasmaxversion)
finalprivate

Set Required ILIAS max.

release.

Parameters
string$a_iliasmaxversionRequired ILIAS max. release

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

Referenced by __init().

{
$this->iliasmaxversion = $a_iliasmaxversion;
}

+ Here is the caller graph for this function:

ilPlugin::setIliasMinVersion (   $a_iliasminversion)
finalprivate

Set Required ILIAS min.

release.

Parameters
string$a_iliasminversionRequired ILIAS min. release

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

Referenced by __init().

{
$this->iliasminversion = $a_iliasminversion;
}

+ Here is the caller graph for this function:

ilPlugin::setLastUpdateVersion (   $a_lastupdateversion)
finalprivate

Set Version of last update.

Parameters
string$a_lastupdateversionVersion of last update

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

Referenced by __init().

{
$this->lastupdateversion = $a_lastupdateversion;
}

+ Here is the caller graph for this function:

ilPlugin::setSlotObject (   $a_slot)
finalprotected

Set Plugin Slot.

Parameters
object$a_slotPlugin Slot

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

Referenced by __init().

{
$this->slot = $a_slot;
}

+ Here is the caller graph for this function:

ilPlugin::setVersion (   $a_version)
finalprivate

Set Current Version (from plugin.php file).

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

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

Referenced by __init().

{
$this->version = $a_version;
}

+ Here is the caller graph for this function:

ilPlugin::slotInit ( )
abstractprotected

Object initialization done by slot.

Must be overwritten in plugin class of plugin slot.

(and should be made protected final)

Reimplemented in ilShibbolethAuthenticationPlugin, ilEventHookPlugin, ilTestSignaturePlugin, ilLDAPPlugin, ilTestExportPlugin, ilPageComponentPlugin, ilCloudHookPlugin, ilPreviewRendererPlugin, ilUserInterfaceHookPlugin, ilPersonalDesktopHookPlugin, ilRepositoryObjectPlugin, ilQuestionsPlugin, ilSurveyQuestionsPlugin, and ilCronHookPlugin.

Referenced by __init().

+ Here is the caller graph for this function:

ilPlugin::txt (   $a_var)
final

Get Language Variable (prefix will be prepended automatically)

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

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

{
global $lng;
return $lng->txt($this->getPrefix()."_".$a_var, $this->getPrefix());
}

+ Here is the call graph for this function:

ilPlugin::update ( )
final

Update plugin.

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

References $ilCtrl, $result, getComponentName(), getComponentType(), getConfigureClassName(), getDirectory(), getPluginName(), getPrefix(), getSlotId(), getVersion(), updateDatabase(), and updateLanguages().

Referenced by activate().

{
global $ilDB, $ilCtrl;
$result = true;
// DB update
if ($result === true)
{
$result = $this->updateDatabase();
}
// Load language files
$this->updateLanguages();
// load control structure
include_once("./setup/classes/class.ilCtrlStructureReader.php");
$structure_reader = new ilCtrlStructureReader();
$structure_reader->readStructure(true, "./".$this->getDirectory(), $this->getPrefix(),
$this->getDirectory());
// $ilCtrl->storeCommonStructures();
// add config gui to the ctrl calls
$ilCtrl->insertCtrlCalls("ilobjcomponentsettingsgui", ilPlugin::getConfigureClassName($this->getPluginName()),
$this->getPrefix());
// set last update version to current version
if ($result === true)
{
$q = "UPDATE il_plugin SET last_update_version = ".$ilDB->quote($this->getVersion(), "text").
" WHERE component_type = ".$ilDB->quote($this->getComponentType(), "text").
" AND component_name = ".$ilDB->quote($this->getComponentName(), "text").
" AND slot_id = ".$ilDB->quote($this->getSlotId(), "text").
" AND name = ".$ilDB->quote($this->getPluginName(), "text");
$ilDB->manipulate($q);
}
return $result;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilPlugin::updateDatabase ( )

Update database.

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

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

Referenced by update().

{
global $ilDB, $lng;
include_once("./Services/Component/classes/class.ilPluginDBUpdate.php");
$dbupdate = new ilPluginDBUpdate($this->getComponentType(),
$this->getComponentName(), $this->getSlotId(),
$this->getPluginName(), $ilDB, true, $this->getTablePrefix());
//$dbupdate->getDBVersionStatus();
//$dbupdate->getCurrentVersion();
$result = $dbupdate->applyUpdate();
if ($dbupdate->updateMsg == "no_changes")
{
$message = $lng->txt("no_changes").". ".$lng->txt("database_is_uptodate");
}
else
{
foreach ($dbupdate->updateMsg as $row)
{
$message .= $lng->txt($row["msg"]).": ".$row["nr"]."<br/>";
}
}
$this->message.= $message;
return $result;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilPlugin::updateLanguages ( )
final

Update all languages.

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

References $ilCtrl, $lang, $row, getAvailableLangFiles(), getLanguageDirectory(), getPrefix(), ilObjLanguage\replaceLangEntry(), and ilObjLanguage\replaceLangModule().

Referenced by update().

{
global $ilCtrl;
include_once("./Services/Language/classes/class.ilObjLanguage.php");
$langs = $this->getAvailableLangFiles($this->getLanguageDirectory());
$prefix = $this->getPrefix();
foreach($langs as $lang)
{
$txt = file($this->getLanguageDirectory()."/".$lang["file"]);
$lang_array = array();
// get language data
if (is_array($txt))
{
foreach ($txt as $row)
{
if ($row[0] != "#" && strpos($row, "#:#") > 0)
{
$a = explode("#:#",trim($row));
$lang_array[$prefix."_".trim($a[0])] = trim($a[1]);
ilObjLanguage::replaceLangEntry($prefix, $prefix."_".trim($a[0]),
$lang["key"], trim($a[1]));
//echo "<br>-$prefix-".$prefix."_".trim($a[0])."-".$lang["key"]."-";
}
}
}
ilObjLanguage::replaceLangModule($lang["key"], $prefix,
$lang_array);
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilPlugin::writeDBVersion (   $a_dbversion)
final

Write DB version to database.

Parameters
int$a_dbversionDB Version

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

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

{
global $ilDB;
$this->setDBVersion($a_dbversion);
$q = "UPDATE il_plugin SET db_version = ".$ilDB->quote((int) $this->getDBVersion(), "integer").
" WHERE component_type = ".$ilDB->quote($this->getComponentType(), "text").
" AND component_name = ".$ilDB->quote($this->getComponentName(), "text").
" AND slot_id = ".$ilDB->quote($this->getSlotId(), "text").
" AND name = ".$ilDB->quote($this->getPluginName(), "text");
$ilDB->manipulate($q);
}

+ Here is the call graph for this function:

Field Documentation

ilPlugin::$lang_initialised = false
protected

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


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