5 include_once(
"./Services/Component/classes/class.ilComponent.php");
6 include_once(
"./Services/Component/exceptions/class.ilPluginException.php");
106 $this->lastupdateversion = $a_lastupdateversion;
116 return $this->lastupdateversion;
126 $this->version = $a_version;
136 return $this->version;
146 $this->iliasminversion = $a_iliasminversion;
156 return $this->iliasminversion;
166 $this->iliasmaxversion = $a_iliasmaxversion;
176 return $this->iliasmaxversion;
186 $this->active = $a_active;
196 return $this->active;
206 $this->slot = $a_slot;
226 $this->dbversion = $a_dbversion;
236 return $this->dbversion;
250 $q =
"UPDATE il_plugin SET db_version = ".$ilDB->quote((
int) $this->
getDBVersion(),
"integer").
253 " AND slot_id = ".$ilDB->quote($this->
getSlotId(),
"text").
256 $ilDB->manipulate($q);
273 static public function _getDirectory($a_ctype, $a_cname, $a_slot_id, $a_pname)
275 include_once
"Services/Component/classes/class.ilPluginSlot.php";
315 if (!@is_dir($a_lang_directory))
320 $dir = opendir($a_lang_directory);
321 while(
$file = readdir($dir))
327 if (@is_file($a_lang_directory.
"/".
$file))
329 if (substr(
$file, 0, 6) ==
"ilias_" &&
332 $langs[] = array(
"key" => substr(
$file, 6, 2),
"file" =>
$file,
333 "path" => $a_lang_directory.
"/".
$file);
351 if (is_file($a_slot_dir.
"/".
352 $a_name.
"/classes/class.il".$a_name.
"ConfigGUI.php"))
367 return "il".$a_name.
"ConfigGUI";
385 return "Customizing/global/plugins/".$a_ctype.
"/".$a_cname.
"/".
386 $a_slot_name.
"/".$a_pname.
"/sql/dbupdate.php";
403 ilGlobalCache::flushAll();
404 include_once(
"./Services/Language/classes/class.ilObjLanguage.php");
407 if(!isset($a_lang_keys))
409 $a_lang_keys = array();
412 if ($langObj->isInstalled())
414 $a_lang_keys[] = $langObj->getKey();
423 foreach($langs as
$lang)
426 if (!in_array($lang[
'key'], $a_lang_keys) )
432 $lang_array = array();
435 $local_changes = ilObjLanguage::_getLocalChangesByModule($lang[
'key'], $prefix);
442 if ($row[0] !=
"#" && strpos($row,
"#:#") > 0)
444 $a = explode(
"#:#",trim($row));
445 $identifier = $prefix.
"_".trim($a[0]);
446 $value = trim($a[1]);
448 if (isset($local_changes[$identifier]))
450 $lang_array[$identifier] = $local_changes[$identifier];
454 $lang_array[$identifier] = $value;
462 ilObjLanguage::replaceLangModule($lang[
"key"], $prefix, $lang_array);
475 include_once(
"./Services/Component/classes/class.ilPluginDBUpdate.php");
483 $result = $dbupdate->applyUpdate();
485 if ($dbupdate->updateMsg ==
"no_changes")
487 $message = $lng->txt(
"no_changes").
". ".$lng->txt(
"database_is_uptodate");
491 foreach ($dbupdate->updateMsg as
$row)
493 $message .= $lng->txt($row[
"msg"]).
": ".$row[
"nr"].
"<br/>";
497 $this->message.= $message;
509 if (!$this->lang_initialised && is_object($lng))
511 $lng->loadLanguageModule($this->
getPrefix());
512 $this->lang_initialised =
true;
519 public function txt($a_var)
529 static function lookupTxt($a_mod_prefix, $a_pl_id, $a_lang_var)
534 $prefix = $a_mod_prefix.
"_".$a_pl_id;
535 return $lng->txt($prefix.
"_".$a_lang_var, $prefix);
546 public function getTemplate($a_template, $a_par1 =
true, $a_par2 =
true)
563 if (is_int(strpos(
$img,
"Customizing")))
569 return $d.
"/templates/images/".$a_img;
590 if (is_int(strpos($css,
"Customizing")))
603 $a_tpl->addBlockFile($a_var, $a_block,
623 $q =
"SELECT * FROM il_plugin".
624 " WHERE component_type = ".$ilDB->quote($a_ctype,
"text").
625 " AND component_name = ".$ilDB->quote($a_cname,
"text").
626 " AND slot_id = ".$ilDB->quote($a_slot_id,
"text").
627 " AND name = ".$ilDB->quote($a_pname,
"text");
628 $set = $ilDB->query($q);
629 if (!$rec = $ilDB->fetchAssoc($set))
631 $q =
"INSERT INTO il_plugin (component_type, component_name, slot_id, name)".
632 " VALUES (".$ilDB->quote($a_ctype,
"text").
",".
633 $ilDB->quote($a_cname,
"text").
",".
634 $ilDB->quote($a_slot_id,
"text").
",".
635 $ilDB->quote($a_pname,
"text").
")";
636 $ilDB->manipulate($q);
647 $rec = $cached_component->lookupPluginByName($a_pname);
649 if ($rec[
'component_type'] == $a_ctype AND $rec[
'component_name'] == $a_cname AND $rec[
'slot_id'] == $a_slot_id) {
652 include_once(
"./Services/Component/exceptions/class.ilPluginException.php");
653 throw (
new ilPluginException(
"No plugin record found for '" . $a_ctype .
"', '" . $a_cname .
"', '" . $a_slot_id .
"', '" . $a_pname
710 $this->
setId($ilPluginAdmin->getId($this->getComponentType(),
716 $this->
setVersion($ilPluginAdmin->getVersion($this->getComponentType(),
722 $this->
setIliasMinVersion($ilPluginAdmin->getIliasMinVersion($this->getComponentType(),
728 $this->
setIliasMaxVersion($ilPluginAdmin->getIliasMaxVersion($this->getComponentType(),
753 abstract protected function slotInit();
768 global $ilPluginAdmin;
779 global $ilPluginAdmin;
813 $q =
"UPDATE il_plugin SET active = ".$ilDB->quote(1,
"integer").
",".
814 " plugin_id = ".$ilDB->quote($this->
getId(),
"text").
817 " AND slot_id = ".$ilDB->quote($this->
getSlotId(),
"text").
820 $ilDB->manipulate($q);
857 $q =
"UPDATE il_plugin SET active = ".$ilDB->quote(0,
"integer").
860 " AND slot_id = ".$ilDB->quote($this->
getSlotId(),
"text").
863 $ilDB->manipulate($q);
896 $ilDB->manipulate(
"DELETE FROM lng_data".
897 " WHERE module = ".$ilDB->quote($prefix,
"text"));
898 $ilDB->manipulate(
"DELETE FROM lng_modules".
899 " WHERE module = ".$ilDB->quote($prefix,
"text"));
904 $q =
"DELETE FROM il_plugin".
907 " AND slot_id = ".$ilDB->quote($this->
getSlotId(),
"text").
909 $ilDB->manipulate($q);
949 include_once(
"./setup/classes/class.ilCtrlStructureReader.php");
962 $q =
"UPDATE il_plugin SET last_update_version = ".$ilDB->quote($this->
getVersion(),
"text").
965 " AND slot_id = ".$ilDB->quote($this->
getSlotId(),
"text").
968 $ilDB->manipulate($q);
1005 include_once(
"./Services/Component/classes/class.ilPluginSlot.php");
1009 $rec = $cached_component->lookCompId($a_ctype, $a_cname);
1023 $file =
"./Customizing/global/plugins/".$a_ctype.
"/".
1024 $a_cname.
"/".$slot_name.
"/".
1025 $a_pname.
"/classes/class.il".$a_pname.
"Plugin.php";
1029 include_once(
$file);
1030 $class =
"il".$a_pname.
"Plugin";
1031 $plugin =
new $class();
1046 $q =
"SELECT * FROM il_plugin WHERE ".
1047 " component_type = ".$ilDB->quote($a_ctype,
"text").
" AND ".
1048 " component_name = ".$ilDB->quote($a_cname,
"text").
" AND ".
1049 " slot_id = ".$ilDB->quote($a_slot_id,
"text").
" AND ".
1050 " name = ".$ilDB->quote($a_pname,
"text");
1052 $set = $ilDB->query($q);
1054 $rec = $ilDB->fetchAssoc($set);
1064 global
$ilDB, $ilPluginAdmin;
1076 $lookupActivePluginsBySlotId = $cached_component->lookupActivePluginsBySlotId($a_slot_id);
1077 foreach($lookupActivePluginsBySlotId as $rec)
1079 if ($ilPluginAdmin->isActive($a_ctype, $a_cname, $a_slot_id, $rec[
"name"]))
1081 $plugins[] = $rec[
"name"];
1095 $q =
"SELECT name FROM il_plugin ".
1096 " WHERE component_type = ".$ilDB->quote($a_ctype,
"text").
1097 " AND component_name = ".$ilDB->quote($a_cname,
"text").
1098 " AND slot_id = ".$ilDB->quote($a_slot_id,
"text").
1099 " AND plugin_id = ".$ilDB->quote($a_plugin_id,
"text");
1101 $set = $ilDB->query($q);
1102 if ($rec = $ilDB->fetchAssoc($set))
1104 return $rec[
"name"];
1115 $q =
"SELECT plugin_id FROM il_plugin ".
1116 " WHERE component_type = ".$ilDB->quote($a_ctype,
"text").
1117 " AND component_name = ".$ilDB->quote($a_cname,
"text").
1118 " AND slot_id = ".$ilDB->quote($a_slot_id,
"text").
1119 " AND name = ".$ilDB->quote($a_plugin_name,
"text");
1121 $set = $ilDB->query($q);
1122 if ($rec = $ilDB->fetchAssoc($set))
1124 return $rec[
"plugin_id"];
getTablePrefix()
Get db table plugin prefix.
static getPluginObject($a_ctype, $a_cname, $a_slot_id, $a_pname)
Get plugin object.
loadLanguageModule()
Load language module for plugin.
static replaceLangEntry($a_module, $a_identifier, $a_lang_key, $a_value, $a_local_change=null, $a_remarks=null)
Replace lang entry.
getVersion()
Get Current Version (from plugin.php file).
getIliasMinVersion()
Get Required ILIAS min.
static lookupId($a_type, $a_name)
Lookup ID of a component.
includeClass($a_class_file_name)
Include (once) a class file.
static getStyleSheetLocation($mode="output", $a_css_name="", $a_css_location="")
get full style sheet file name (path inclusive) of current user
getImagePath($a_img)
Get image path.
static lookupStoredData($a_ctype, $a_cname, $a_slot_id, $a_pname)
Lookup information data in il_plugin.
_getPluginsDirectory($a_ctype, $a_cname, $a_slot_id)
Get plugins directory.
needsUpdate()
Check whether update is needed.
static getInstalledLanguages()
Get the language objects of the installed languages.
static getActivePluginsForSlot($a_ctype, $a_cname, $a_slot_id)
Get all active plugins for a slot.
static lookupSlotName($a_ctype, $a_cname, $a_slot_id)
Lookup slot name for component and slot id.
static _getImagePath($a_ctype, $a_cname, $a_slot_id, $a_pname, $a_img)
Get image path.
setSlotObject($a_slot)
Set Plugin Slot.
lookupNameForId($a_ctype, $a_cname, $a_slot_id, $a_plugin_id)
Lookup name for id.
updateLanguages($a_lang_keys=null)
static getConfigureClassName($a_name)
Get plugin configure class name.
setVersion($a_version)
Set Current Version (from plugin.php file).
getComponentName()
Get Component Name.
beforeActivation()
Before activation processing.
getTemplate($a_template, $a_par1=true, $a_par2=true)
Get template from plugin.
setIliasMaxVersion($a_iliasmaxversion)
Set Required ILIAS max.
Class ilCtrlStructureReader.
static getPluginRecord($a_ctype, $a_cname, $a_slot_id, $a_pname)
Get record from il_plugin table.
isActive()
Check whether plugin is active.
getComponentType()
Get Component Type.
init()
Object initialization.
static lookupTxt($a_mod_prefix, $a_pl_id, $a_lang_var)
Lookup language text.
writeDBVersion($a_dbversion)
Write DB version to database.
afterActivation()
After activation processing.
lookupIdForName($a_ctype, $a_cname, $a_slot_id, $a_plugin_name)
Lookup id for name.
setDBVersion($a_dbversion)
Set DB Version.
updateDatabase()
Update database.
getDBVersion()
Get DB Version.
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
getDirectory()
Get Plugin Directory.
special template class to simplify handling of ITX/PEAR
txt($a_var)
Get Language Variable (prefix will be prepended automatically)
getPrefix()
Get plugin prefix, used for lang vars.
afterUpdate()
After update processing.
getLastUpdateVersion()
Get Version of last update.
setLastUpdateVersion($a_lastupdateversion)
Set Version of last update.
getClassesDirectory()
Get Plugin's classes Directory.
static getDBUpdateScriptName($a_ctype, $a_cname, $a_slot_name, $a_pname)
Get DB update script filename (full path)
static createPluginRecord($a_ctype, $a_cname, $a_slot_id, $a_pname)
getStyleSheetLocation($a_css_file)
Get css file location.
static hasConfigureClass($a_slot_dir, $a_name)
Has the plugin a configure class?
slotInit()
Object initialization done by slot.
static getAvailableLangFiles($a_lang_directory)
Get array of all language files in the plugin.
__init()
Default initialization.
getPluginName()
Get Plugin Name.
getSlotObject()
Get Plugin Slot.
addBlockFile($a_tpl, $a_var, $a_block, $a_tplname)
Add template content to placeholder variable.
getLanguageDirectory()
Get Plugin's language Directory.
setIliasMinVersion($a_iliasminversion)
Set Required ILIAS min.
getIliasMaxVersion()
Get Required ILIAS max.
setActive($a_active)
Set Active.
beforeUpdate()
Before update processing.
afterDeactivation()
After deactivation processing.
static _getDirectory($a_ctype, $a_cname, $a_slot_id, $a_pname)
Get plugin directory.