ILIAS  Release_4_2_x_branch Revision 61807
 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 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.
 initAutoLoad ()
 Init auto loader.

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.
 autoLoad ($a_classname)
 Auto load implementation.

Detailed Description

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

Constructor & Destructor Documentation

ilPlugin::__construct ( )
final

Constructor.

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

References __init(), and initAutoLoad().

{
$this->__init();
$this->initAutoLoad();
}

+ Here is the call graph for this function:

Member Function Documentation

ilPlugin::__init ( )
finalprivate

Default initialization.

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

References $ilDB, $lng, getComponentName(), getComponentType(), getPluginName(), getPluginRecord(), getPrefix(), getSlotId(), init(), 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
if(is_object($lng))
{
$lng->loadLanguageModule($this->getPrefix());
}
// 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 272 of file class.ilPlugin.php.

References ilPluginSlot\_getPluginsDirectory().

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

{
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 511 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 675 of file class.ilPlugin.php.

References $ilDB, $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 537 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 726 of file class.ilPlugin.php.

Referenced by activate().

{
}

+ Here is the caller graph for this function:

ilPlugin::autoLoad (   $a_classname)
finalprivate

Auto load implementation.

Parameters
stringclass name

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

References getClassesDirectory().

{
$class_file = $this->getClassesDirectory().'/class.'.$a_classname.'.php';
@include_once($class_file);
}

+ Here is the call graph for this function:

ilPlugin::beforeActivation ( )
protected

Before activation processing.

Reimplemented in ilRepositoryObjectPlugin.

Definition at line 715 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:

ilPlugin::deactivate ( )
final

Deactivate.

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

References $ilDB, $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 193 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 857 of file class.ilPlugin.php.

References $ilDB.

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

References $dir, and $file.

Referenced by ilPluginsTableGUI\fillRow(), 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 284 of file class.ilPlugin.php.

References getDirectory().

Referenced by autoLoad(), and includeClass().

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

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilPlugin::getComponentName ( )
abstract

Get Component Name.

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

Returns
string Component Name

Reimplemented in ilPageComponentPlugin, ilShibbolethAuthenticationPlugin, ilEventHookPlugin, ilLDAPPlugin, ilUserInterfaceHookPlugin, ilPersonalDesktopHookPlugin, ilRepositoryObjectPlugin, ilSurveyQuestionsPlugin, and ilQuestionsPlugin.

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

+ Here is the caller graph for this function:

ilPlugin::getComponentType ( )
abstract

Get Component Type.

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

Returns
string Component Type

Reimplemented in ilLDAPPlugin, ilPageComponentPlugin, ilShibbolethAuthenticationPlugin, ilEventHookPlugin, ilUserInterfaceHookPlugin, ilPersonalDesktopHookPlugin, ilRepositoryObjectPlugin, ilSurveyQuestionsPlugin, and ilQuestionsPlugin.

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

+ Here is the caller graph for this function:

static ilPlugin::getConfigureClassName (   $a_name)
staticfinal

Get plugin configure class name.

Parameters
@return

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

Referenced by ilPluginsTableGUI\fillRow(), 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 382 of file class.ilPlugin.php.

Referenced by ilPluginsTableGUI\fillRow(), and ilPluginDBUpdate\ilPluginDBUpdate().

{
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 233 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 264 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 93 of file class.ilPlugin.php.

Referenced by activate(), ilRepositoryObjectPlugin\beforeActivation(), and getPrefix().

{
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 173 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 153 of file class.ilPlugin.php.

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

Get image path.

Definition at line 521 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 302 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 113 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(), 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 802 of file class.ilPlugin.php.

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

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

References $ilDB.

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

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

References getId(), and getSlotObject().

Referenced by __init(), 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::getSlot ( )
abstract

Get Slot Name.

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

Returns
string Slot Name

Reimplemented in ilPageComponentPlugin, ilShibbolethAuthenticationPlugin, ilEventHookPlugin, ilLDAPPlugin, ilUserInterfaceHookPlugin, ilPersonalDesktopHookPlugin, ilRepositoryObjectPlugin, ilSurveyQuestionsPlugin, and ilQuestionsPlugin.

ilPlugin::getSlotId ( )
abstract

Get Slot ID.

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

Returns
string Slot Id

Reimplemented in ilPageComponentPlugin, ilShibbolethAuthenticationPlugin, ilEventHookPlugin, ilLDAPPlugin, ilUserInterfaceHookPlugin, ilPersonalDesktopHookPlugin, ilRepositoryObjectPlugin, ilSurveyQuestionsPlugin, and ilQuestionsPlugin.

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

+ Here is the caller graph for this function:

ilPlugin::getSlotObject ( )
finalprotected

Get Plugin Slot.

Returns
object Plugin Slot

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

Referenced by getDirectory(), 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 529 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 391 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 501 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 133 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 348 of file class.ilPlugin.php.

Referenced by ilPluginsTableGUI\fillRow().

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

References getClassesDirectory().

Referenced by ilUserInterfaceHookPlugin\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 646 of file class.ilPlugin.php.

Referenced by __init().

{
}

+ Here is the caller graph for this function:

ilPlugin::initAutoLoad ( )
protected

Init auto loader.

Returns
void

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

Referenced by __construct().

{
spl_autoload_register(
array($this,'autoLoad')
);
}

+ Here is the caller graph for this function:

ilPlugin::isActive ( )
final

Check whether plugin is active.

Definition at line 653 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 472 of file class.ilPlugin.php.

References $lng, and getPrefix().

{
global $lng;
$lng->loadLanguageModule($this->getPrefix());
}

+ Here is the call graph for this function:

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

Lookup id for name.

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

References $ilDB.

Referenced by 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 882 of file class.ilPlugin.php.

References $ilDB.

Referenced by ilObjectPluginGUI\__construct(), ilObjectPlugin\__construct(), ilObjectCopySearchResultTableGUI\__construct(), ilRepositoryObjectPlugin\_getIcon(), ilRepositoryObjectPlugin\_getName(), ilObjPluginDispatchGUI\forward(), ilObjectPluginListGUI\init(), ilRepositoryObjectPluginSlot\isTypePlugin(), 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 837 of file class.ilPlugin.php.

References $ilDB.

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:

ilPlugin::needsUpdate ( )
final

Check whether update is needed.

Definition at line 664 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 183 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 223 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 83 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 163 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 143 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 103 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 203 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 123 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 ilPageComponentPlugin, ilShibbolethAuthenticationPlugin, ilEventHookPlugin, ilLDAPPlugin, ilUserInterfaceHookPlugin, ilPersonalDesktopHookPlugin, ilRepositoryObjectPlugin, ilSurveyQuestionsPlugin, and ilQuestionsPlugin.

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

References $lng, and getPrefix().

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

References $ilCtrl, $ilDB, $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 438 of file class.ilPlugin.php.

References $ilDB, $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 399 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 243 of file class.ilPlugin.php.

References $ilDB, 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:


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