ILIAS  Release_3_10_x_branch Revision 61812
 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.
 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.
 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.

Static Public Member Functions

static getAvailableLangFiles ($a_lang_directory)
 Get array of all language files in the plugin.
static getDBUpdateScriptName ($a_ctype, $a_cname, $a_slot_name, $a_pname)
 Get DB update script filename (full 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.
 getDirectory ()
 Get Plugin Directory.
 getClassesDirectory ()
 Get Plugin's classes Directory.
 getLanguageDirectory ()
 Get Plugin's language Directory.
 slotInit ()
 Object initialization done by slot.
 init ()
 Object initialization.

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

Constructor & Destructor Documentation

ilPlugin::__construct ( )
final

Constructor.

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

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

ilPlugin::activate ( )
final

Activate.

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

References $lng, $result, getComponentName(), getComponentType(), 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();
}
}
// activate plugin
if ($result === true)
{
$q = "UPDATE il_plugin SET active = 1".
" WHERE component_type = ".$ilDB->quote($this->getComponentType()).
" AND component_name = ".$ilDB->quote($this->getComponentName()).
" AND slot_id = ".$ilDB->quote($this->getSlotId()).
" AND name = ".$ilDB->quote($this->getPluginName());
$ilDB->query($q);
}
}

+ 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 486 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::deactivate ( )
final

Deactivate.

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

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

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

+ Here is the call graph for this function:

ilPlugin::getActive ( )
final

Get Active.

Returns
boolean Active

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

References DB_FETCHMODE_ASSOC.

{
global $ilDB, $ilPluginAdmin;
$q = "SELECT * FROM il_plugin WHERE component_type = ".$ilDB->quote($a_ctype).
" AND component_name = ".$ilDB->quote($a_cname).
" AND slot_id = ".$ilDB->quote($a_slot_id).
" AND active = 1";
$set = $ilDB->query($q);
$plugins = array();
while($rec = $set->fetchRow(DB_FETCHMODE_ASSOC))
{
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 318 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 292 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

Get Component Name.

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

Returns
string Component Name

Reimplemented in ilPageComponentPlugin, ilEventHookPlugin, 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 ilPageComponentPlugin, ilEventHookPlugin, ilSurveyQuestionsPlugin, and ilQuestionsPlugin.

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

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

Referenced by writeDBVersion().

{
return $this->dbversion;
}

+ Here is the caller graph for this function:

ilPlugin::getDirectory ( )
finalprotected

Get Plugin Directory.

Returns
object Plugin Slot

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

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

{
return $this->iliasminversion;
}
ilPlugin::getLanguageDirectory ( )
finalprotected

Get Plugin's language Directory.

Returns
object classes directory

Definition at line 310 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 131 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(), 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 719 of file class.ilPlugin.php.

References $file, and ilPluginSlot\lookupSlotName().

Referenced by SurveyQuestion\_getQuestionTypeName(), assQuestion\_getQuestionTypeName(), ilObjSurveyQuestionPool\_getQuestiontypes(), ilObjQuestionPool\_getQuestionTypes(), SurveyQuestion\_includeClass(), assQuestion\_includeClass(), ilObjComponentSettingsGUI\activatePlugin(), ilObjComponentSettingsGUI\deactivatePlugin(), ilObjComponentSettingsGUI\refreshLanguages(), 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->query("SELECT * FROM il_component WHERE type = ".
$ilDB->quote($a_ctype)." AND name = ".$ilDB->quote($a_cname));
if ($set->numRows() == 0)
{
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 495 of file class.ilPlugin.php.

References DB_FETCHMODE_ASSOC.

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

{
global $ilDB;
// read/set basic data
$q = "SELECT * FROM il_plugin".
" WHERE component_type = ".$ilDB->quote($a_ctype).
" AND component_name = ".$ilDB->quote($a_cname).
" AND slot_id = ".$ilDB->quote($a_slot_id).
" AND name = ".$ilDB->quote($a_pname);
$set = $ilDB->query($q);
if ($rec = $set->fetchRow(DB_FETCHMODE_ASSOC))
{
return $rec;
}
else // no record? create one
{
$q = "INSERT INTO il_plugin (component_type, component_name, slot_id, name)".
" VALUES (".$ilDB->quote($a_ctype).",".
$ilDB->quote($a_cname).",".
$ilDB->quote($a_slot_id).",".
$ilDB->quote($a_pname).")";
$ilDB->query($q);
$q = "SELECT * FROM il_plugin".
" WHERE component_type = ".$ilDB->quote($a_ctype).
" AND component_name = ".$ilDB->quote($a_cname).
" AND slot_id = ".$ilDB->quote($a_slot_id).
" AND name = ".$ilDB->quote($a_pname);
$set = $ilDB->query($q);
return $set->fetchRow(DB_FETCHMODE_ASSOC);
}
}

+ Here is the caller graph for this function:

ilPlugin::getPrefix ( )
final

Get plugin prefix, used for lang vars.

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

References getId(), and getSlotObject().

Referenced by __init(), 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, ilEventHookPlugin, 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, ilEventHookPlugin, 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 231 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 478 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 371 of file class.ilPlugin.php.

Referenced by updateDatabase().

{
return "il_".$this->getPrefix();
}

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

Referenced by update().

{
return $this->version;
}

+ Here is the caller graph for this function:

ilPlugin::includeClass (   $a_class_file_name)
final

Include (once) a class file.

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

References getClassesDirectory().

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

+ Here is the call graph for this function:

ilPlugin::init ( )
protected

Object initialization.

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

Definition at line 590 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 597 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 449 of file class.ilPlugin.php.

References $lng, and getPrefix().

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

+ Here is the call 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 753 of file class.ilPlugin.php.

References DB_FETCHMODE_ASSOC.

Referenced by ilPluginSlot\getPluginsInformation().

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

+ Here is the caller graph for this function:

ilPlugin::needsUpdate ( )
final

Check whether update is needed.

Definition at line 608 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 201 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 241 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 101 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 181 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 161 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 121 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 221 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 141 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, ilEventHookPlugin, 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 459 of file class.ilPlugin.php.

References $lng, and getPrefix().

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

+ Here is the call graph for this function:

ilPlugin::update ( )
final

Update.

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

References $ilCtrl, $result, getComponentName(), getComponentType(), 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
chdir("./setup");
include_once("./classes/class.ilCtrlStructureReader.php");
$structure_reader = new ilCtrlStructureReader();
$structure_reader->readStructure(true, "../".$this->getDirectory(), $this->getPrefix());
chdir("..");
$ilCtrl->storeCommonStructures();
// set last update version to current version
if ($result === true)
{
$q = "UPDATE il_plugin SET last_update_version = ".$ilDB->quote($this->getVersion()).
" WHERE component_type = ".$ilDB->quote($this->getComponentType()).
" AND component_name = ".$ilDB->quote($this->getComponentName()).
" AND slot_id = ".$ilDB->quote($this->getSlotId()).
" AND name = ".$ilDB->quote($this->getPluginName());
$ilDB->query($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 415 of file class.ilPlugin.php.

References $lng, $result, 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 379 of file class.ilPlugin.php.

References $ilCtrl, $lang, getAvailableLangFiles(), getLanguageDirectory(), getPrefix(), 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::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 261 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($this->getDBVersion()).
" WHERE component_type = ".$ilDB->quote($this->getComponentType()).
" AND component_name = ".$ilDB->quote($this->getComponentName()).
" AND slot_id = ".$ilDB->quote($this->getSlotId()).
" AND name = ".$ilDB->quote($this->getPluginName());
$ilDB->query($q);
}

+ Here is the call graph for this function:


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