5 include_once(
"./Services/Component/classes/class.ilComponent.php");
6 include_once(
"./Services/Component/exceptions/class.ilPluginException.php");
84 private final function setId($a_id)
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 final 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 final 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 final 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")))
601 public final function addBlockFile($a_tpl, $a_var, $a_block, $a_tplname)
603 $a_tpl->addBlockFile($a_var, $a_block,
617 $q =
"SELECT * FROM il_plugin".
618 " WHERE component_type = ".$ilDB->quote($a_ctype,
"text").
619 " AND component_name = ".$ilDB->quote($a_cname,
"text").
620 " AND slot_id = ".$ilDB->quote($a_slot_id,
"text").
621 " AND name = ".$ilDB->quote($a_pname,
"text");
622 $set = $ilDB->query($q);
623 if (!$rec = $ilDB->fetchAssoc($set))
625 $q =
"INSERT INTO il_plugin (component_type, component_name, slot_id, name)".
626 " VALUES (".$ilDB->quote($a_ctype,
"text").
",".
627 $ilDB->quote($a_cname,
"text").
",".
628 $ilDB->quote($a_slot_id,
"text").
",".
629 $ilDB->quote($a_pname,
"text").
")";
630 $ilDB->manipulate($q);
638 static final public function getPluginRecord($a_ctype, $a_cname, $a_slot_id, $a_pname)
641 $rec = $cached_component->lookupPluginByName($a_pname);
643 if ($rec[
'component_type'] == $a_ctype AND $rec[
'component_name'] == $a_cname AND $rec[
'slot_id'] == $a_slot_id) {
646 include_once(
"./Services/Component/exceptions/class.ilPluginException.php");
647 throw (
new ilPluginException(
"No plugin record found for '" . $a_ctype .
"', '" . $a_cname .
"', '" . $a_slot_id .
"', '" . $a_pname
704 $this->
setId($ilPluginAdmin->getId($this->getComponentType(),
710 $this->
setVersion($ilPluginAdmin->getVersion($this->getComponentType(),
716 $this->
setIliasMinVersion($ilPluginAdmin->getIliasMinVersion($this->getComponentType(),
722 $this->
setIliasMaxVersion($ilPluginAdmin->getIliasMaxVersion($this->getComponentType(),
747 abstract protected function slotInit();
762 global $ilPluginAdmin;
773 global $ilPluginAdmin;
807 $q =
"UPDATE il_plugin SET active = ".$ilDB->quote(1,
"integer").
",".
808 " plugin_id = ".$ilDB->quote($this->
getId(),
"text").
811 " AND slot_id = ".$ilDB->quote($this->
getSlotId(),
"text").
814 $ilDB->manipulate($q);
851 $q =
"UPDATE il_plugin SET active = ".$ilDB->quote(0,
"integer").
854 " AND slot_id = ".$ilDB->quote($this->
getSlotId(),
"text").
857 $ilDB->manipulate($q);
895 include_once(
"./setup/classes/class.ilCtrlStructureReader.php");
908 $q =
"UPDATE il_plugin SET last_update_version = ".$ilDB->quote($this->
getVersion(),
"text").
911 " AND slot_id = ".$ilDB->quote($this->
getSlotId(),
"text").
914 $ilDB->manipulate($q);
951 include_once(
"./Services/Component/classes/class.ilPluginSlot.php");
955 $rec = $cached_component->lookCompId($a_ctype, $a_cname);
969 $file =
"./Customizing/global/plugins/".$a_ctype.
"/".
970 $a_cname.
"/".$slot_name.
"/".
971 $a_pname.
"/classes/class.il".$a_pname.
"Plugin.php";
976 $class =
"il".$a_pname.
"Plugin";
977 $plugin =
new $class();
992 $q =
"SELECT * FROM il_plugin WHERE ".
993 " component_type = ".$ilDB->quote($a_ctype,
"text").
" AND ".
994 " component_name = ".$ilDB->quote($a_cname,
"text").
" AND ".
995 " slot_id = ".$ilDB->quote($a_slot_id,
"text").
" AND ".
996 " name = ".$ilDB->quote($a_pname,
"text");
998 $set = $ilDB->query($q);
1000 $rec = $ilDB->fetchAssoc($set);
1010 global
$ilDB, $ilPluginAdmin;
1022 $lookupActivePluginsBySlotId = $cached_component->lookupActivePluginsBySlotId($a_slot_id);
1023 foreach($lookupActivePluginsBySlotId as $rec)
1025 if ($ilPluginAdmin->isActive($a_ctype, $a_cname, $a_slot_id, $rec[
"name"]))
1027 $plugins[] = $rec[
"name"];
1041 $q =
"SELECT name FROM il_plugin ".
1042 " WHERE component_type = ".$ilDB->quote($a_ctype,
"text").
1043 " AND component_name = ".$ilDB->quote($a_cname,
"text").
1044 " AND slot_id = ".$ilDB->quote($a_slot_id,
"text").
1045 " AND plugin_id = ".$ilDB->quote($a_plugin_id,
"text");
1047 $set = $ilDB->query($q);
1048 if ($rec = $ilDB->fetchAssoc($set))
1050 return $rec[
"name"];
1061 $q =
"SELECT plugin_id FROM il_plugin ".
1062 " WHERE component_type = ".$ilDB->quote($a_ctype,
"text").
1063 " AND component_name = ".$ilDB->quote($a_cname,
"text").
1064 " AND slot_id = ".$ilDB->quote($a_slot_id,
"text").
1065 " AND name = ".$ilDB->quote($a_plugin_name,
"text");
1067 $set = $ilDB->query($q);
1068 if ($rec = $ilDB->fetchAssoc($set))
1070 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.
__construct()
Constructor.
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)
Create plugin record, if not existing.
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.