ILIAS  Release_5_0_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.
 afterDeactivation ()
 After deactivation processing.
 beforeUpdate ()
 Before update processing.
 afterUpdate ()
 After update 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 662 of file class.ilPlugin.php.

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

Referenced by __construct().

{
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(), ilObjectDefinition\readDefinitionDataFromCache(), and ilObjectDefinition\readDefinitionDataFromDB().

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

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

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

{
$d2 = ilComponent::lookupId($a_ctype, $a_cname)."_".$a_slot_id."_".
ilPlugin::lookupIdForName($a_ctype, $a_cname, $a_slot_id, $a_pname);
$img = ilUtil::getImagePath($d2."/".$a_img);
if (is_int(strpos($img, "Customizing")))
{
return $img;
}
$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 752 of file class.ilPlugin.php.

References $ilDB, $lng, $result, afterActivation(), beforeActivation(), ilCachedComponentData\flush(), 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 571 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.

Reimplemented in ilCachedPlugin.

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

Referenced by activate().

{
}

+ Here is the caller graph for this function:

ilPlugin::afterDeactivation ( )
protected

After deactivation processing.

Reimplemented in ilCachedPlugin.

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

Referenced by deactivate().

{
}

+ Here is the caller graph for this function:

ilPlugin::afterUpdate ( )
protected

After update processing.

Reimplemented in ilCachedPlugin.

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

Referenced by update().

{
}

+ Here is the caller graph for this function:

ilPlugin::beforeActivation ( )
protected

Before activation processing.

Reimplemented in ilRepositoryObjectPlugin, and ilCachedPlugin.

Definition at line 795 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::beforeUpdate ( )
protected

Before update processing.

Reimplemented in ilCachedPlugin.

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

Referenced by update().

{
return true; // false would indicate that anything went wrong
// update 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 580 of file class.ilPlugin.php.

References $ilDB, and ilCachedComponentData\flush().

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 call graph for this function:

+ Here is the caller graph for this function:

ilPlugin::deactivate ( )
final

Deactivate.

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

References $ilDB, $result, afterDeactivation(), ilCachedComponentData\flush(), 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 978 of file class.ilPlugin.php.

References $ilDB, and ilCachedComponentData\getInstance().

{
global $ilDB, $ilPluginAdmin;
$plugins = array();
// $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);
$cached_component = ilCachedComponentData::getInstance();
// while($rec = $ilDB->fetchAssoc($set))
$lookupActivePluginsBySlotId = $cached_component->lookupActivePluginsBySlotId($a_slot_id);
foreach($lookupActivePluginsBySlotId as $rec)
{
if ($ilPluginAdmin->isActive($a_ctype, $a_cname, $a_slot_id, $rec["name"]))
{
$plugins[] = $rec["name"];
}
}
return $plugins;
}

+ Here is the call graph for this function:

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:

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(), 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 545 of file class.ilPlugin.php.

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

Referenced by _getImagePath().

{
return self::_getImagePath($this->getComponentType(), $this->getComponentName(), $this->getSlotId(),
$this->getPluginName(), $a_img);
}

+ Here is the call graph for this function:

+ Here is the caller 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(), getImagePath(), ilCloudHookPlugin\getPluginTablePrefix(), ilPreviewRendererPlugin\getRendererClassInstance(), getStyleSheetLocation(), 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 917 of file class.ilPlugin.php.

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

Referenced by ilObjectPluginGUI\__construct(), ilObjectPlugin\__construct(), ilObjectCopySearchResultTableGUI\__construct(), SurveyQuestion\_getQuestionTypeName(), assQuestion\_getQuestionTypeName(), ilObjSurveyQuestionPool\_getQuestiontypes(), ilObjQuestionPool\_getQuestionTypes(), ilObjSurveyQuestionPool\_getQuestionTypeTranslations(), SurveyQuestion\_includeClass(), ilObjComponentSettingsGUI\activatePlugin(), ilObjComponentSettingsGUI\deactivatePlugin(), 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);
$cached_component = ilCachedComponentData::getInstance();
$rec = $cached_component->lookCompId($a_ctype, $a_cname);
if (! $rec) {
return NULL;
}
// 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 608 of file class.ilPlugin.php.

References ilCachedComponentData\getInstance().

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

{
$cached_component = ilCachedComponentData::getInstance();
$rec = $cached_component->lookupPluginByName($a_pname);
if ($rec['component_type'] == $a_ctype AND $rec['component_name'] == $a_cname AND $rec['slot_id'] == $a_slot_id) {
return $rec;
} else {
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
. "'."));
}
//
// 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 call graph for this function:

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

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

{
$d2 = ilComponent::lookupId($this->getComponentType(), $this->getComponentName())."_".$this->getSlotId()."_".
$css = ilUtil::getStyleSheetLocation("output", $a_css_file, $d2);
if (is_int(strpos($css, "Customizing")))
{
return $css;
}
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 516 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)

Reimplemented in ilCachedPlugin.

Definition at line 723 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 730 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 475 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.

Reimplemented in ilCachedPlugin.

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

References $ilDB.

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

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

Reimplemented in ilCachedPlugin.

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

References $ilDB.

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

{
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 958 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 741 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
ilPlugin::txt (   $a_var)
final

Get Language Variable (prefix will be prepended automatically)

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

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

Referenced by activate().

{
global $ilDB, $ilCtrl;
$result = $this->beforeUpdate();
if ($result === false) {
return false;
}
// 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);
$this->afterUpdate();
}
return $result;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilPlugin::updateDatabase ( )

Update database.

Reimplemented in ilCachedPlugin.

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

References $ilDB, $lng, $result, $row, ilCachedComponentData\flush(), 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();
$message = '';
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, $txt, getAvailableLangFiles(), getLanguageDirectory(), getPrefix(), ilObjLanguage\replaceLangEntry(), and ilObjLanguage\replaceLangModule().

Referenced by update().

{
global $ilCtrl;
ilGlobalCache::flushAll();
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 $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:

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: