5 include_once(
"./Services/Component/classes/class.ilComponent.php");
6 include_once(
"./Services/Component/exceptions/class.ilPluginException.php");
105 $this->lastupdateversion = $a_lastupdateversion;
115 return $this->lastupdateversion;
125 $this->version = $a_version;
145 $this->iliasminversion = $a_iliasminversion;
155 return $this->iliasminversion;
165 $this->iliasmaxversion = $a_iliasmaxversion;
175 return $this->iliasmaxversion;
185 $this->active = $a_active;
195 return $this->active;
205 $this->slot = $a_slot;
225 $this->dbversion = $a_dbversion;
235 return $this->dbversion;
249 $q =
"UPDATE il_plugin SET db_version = ".$ilDB->quote((
int) $this->
getDBVersion(),
"integer").
252 " AND slot_id = ".$ilDB->quote($this->
getSlotId(),
"text").
255 $ilDB->manipulate($q);
272 static public function _getDirectory($a_ctype, $a_cname, $a_slot_id, $a_pname)
274 include_once
"Services/Component/classes/class.ilPluginSlot.php";
314 if (!@is_dir($a_lang_directory))
319 $dir = opendir($a_lang_directory);
320 while(
$file = readdir($dir))
326 if (@is_file($a_lang_directory.
"/".
$file))
328 if (substr(
$file, 0, 6) ==
"ilias_" &&
332 "path" => $a_lang_directory.
"/".
$file);
350 if (is_file($a_slot_dir.
"/".
351 $a_name.
"/classes/class.il".$a_name.
"ConfigGUI.php"))
366 return "il".$a_name.
"ConfigGUI";
384 return "Customizing/global/plugins/".$a_ctype.
"/".$a_cname.
"/".
385 $a_slot_name.
"/".$a_pname.
"/sql/dbupdate.php";
402 ilGlobalCache::flushAll();
403 include_once(
"./Services/Language/classes/class.ilObjLanguage.php");
406 if(!isset($a_lang_keys))
408 $a_lang_keys =
array();
411 if ($langObj->isInstalled())
413 $a_lang_keys[] = $langObj->getKey();
422 foreach($langs as
$lang)
425 if (!in_array($lang[
'key'], $a_lang_keys) )
431 $lang_array =
array();
434 $local_changes = ilObjLanguage::_getLocalChangesByModule($lang[
'key'], $prefix);
441 if ($row[0] !=
"#" && strpos($row,
"#:#") > 0)
443 $a = explode(
"#:#",trim($row));
444 $identifier = $prefix.
"_".trim($a[0]);
445 $value = trim($a[1]);
447 if (isset($local_changes[$identifier]))
449 $lang_array[$identifier] = $local_changes[$identifier];
453 $lang_array[$identifier] = $value;
461 ilObjLanguage::replaceLangModule($lang[
"key"], $prefix, $lang_array);
474 include_once(
"./Services/Component/classes/class.ilPluginDBUpdate.php");
482 $result = $dbupdate->applyUpdate();
484 if ($dbupdate->updateMsg ==
"no_changes")
486 $message = $lng->txt(
"no_changes").
". ".$lng->txt(
"database_is_uptodate");
490 foreach ($dbupdate->updateMsg as
$row)
492 $message .= $lng->txt($row[
"msg"]).
": ".$row[
"nr"].
"<br/>";
496 $this->message.= $message;
508 if (!$this->lang_initialised && is_object($lng))
510 $lng->loadLanguageModule($this->
getPrefix());
511 $this->lang_initialised =
true;
518 public function txt($a_var)
528 static function lookupTxt($a_mod_prefix, $a_pl_id, $a_lang_var)
533 $prefix = $a_mod_prefix.
"_".$a_pl_id;
534 return $lng->txt($prefix.
"_".$a_lang_var, $prefix);
541 public function getTemplate($a_template, $a_par1 =
true, $a_par2 =
true)
558 if (is_int(strpos(
$img,
"Customizing")))
564 return $d.
"/templates/images/".$a_img;
585 if (is_int(strpos($css,
"Customizing")))
598 $a_tpl->addBlockFile($a_var, $a_block,
618 $q =
"SELECT * FROM il_plugin".
619 " WHERE component_type = ".$ilDB->quote($a_ctype,
"text").
620 " AND component_name = ".$ilDB->quote($a_cname,
"text").
621 " AND slot_id = ".$ilDB->quote($a_slot_id,
"text").
622 " AND name = ".$ilDB->quote($a_pname,
"text");
623 $set = $ilDB->query($q);
624 if (!$rec = $ilDB->fetchAssoc($set))
626 $q =
"INSERT INTO il_plugin (component_type, component_name, slot_id, name)".
627 " VALUES (".$ilDB->quote($a_ctype,
"text").
",".
628 $ilDB->quote($a_cname,
"text").
",".
629 $ilDB->quote($a_slot_id,
"text").
",".
630 $ilDB->quote($a_pname,
"text").
")";
631 $ilDB->manipulate($q);
642 $rec = $cached_component->lookupPluginByName($a_pname);
644 if ($rec[
'component_type'] == $a_ctype AND $rec[
'component_name'] == $a_cname AND $rec[
'slot_id'] == $a_slot_id) {
647 include_once(
"./Services/Component/exceptions/class.ilPluginException.php");
648 throw (
new ilPluginException(
"No plugin record found for '" . $a_ctype .
"', '" . $a_cname .
"', '" . $a_slot_id .
"', '" . $a_pname
669 $this->
setId($ilPluginAdmin->getId($this->getComponentType(),
675 $this->
setVersion($ilPluginAdmin->getVersion($this->getComponentType(),
681 $this->
setIliasMinVersion($ilPluginAdmin->getIliasMinVersion($this->getComponentType(),
687 $this->
setIliasMaxVersion($ilPluginAdmin->getIliasMaxVersion($this->getComponentType(),
712 abstract protected function slotInit();
727 global $ilPluginAdmin;
738 global $ilPluginAdmin;
772 $q =
"UPDATE il_plugin SET active = ".$ilDB->quote(1,
"integer").
",".
773 " plugin_id = ".$ilDB->quote($this->
getId(),
"text").
776 " AND slot_id = ".$ilDB->quote($this->
getSlotId(),
"text").
779 $ilDB->manipulate($q);
816 $q =
"UPDATE il_plugin SET active = ".$ilDB->quote(0,
"integer").
819 " AND slot_id = ".$ilDB->quote($this->
getSlotId(),
"text").
822 $ilDB->manipulate($q);
855 $ilDB->manipulate(
"DELETE FROM lng_data".
856 " WHERE module = ".$ilDB->quote($prefix,
"text"));
857 $ilDB->manipulate(
"DELETE FROM lng_modules".
858 " WHERE module = ".$ilDB->quote($prefix,
"text"));
863 $q =
"DELETE FROM il_plugin".
866 " AND slot_id = ".$ilDB->quote($this->
getSlotId(),
"text").
868 $ilDB->manipulate($q);
908 include_once(
"./setup/classes/class.ilCtrlStructureReader.php");
921 $q =
"UPDATE il_plugin SET last_update_version = ".$ilDB->quote($this->
getVersion(),
"text").
924 " AND slot_id = ".$ilDB->quote($this->
getSlotId(),
"text").
927 $ilDB->manipulate($q);
962 include_once(
"./Services/Component/classes/class.ilPluginSlot.php");
966 $rec = $cached_component->lookCompId($a_ctype, $a_cname);
971 $file =
"./Customizing/global/plugins/".$a_ctype.
"/".
972 $a_cname.
"/".$slot_name.
"/".
973 $a_pname.
"/classes/class.il".$a_pname.
"Plugin.php";
978 $class =
"il".$a_pname.
"Plugin";
979 $plugin =
new $class();
994 $q =
"SELECT * FROM il_plugin WHERE ".
995 " component_type = ".$ilDB->quote($a_ctype,
"text").
" AND ".
996 " component_name = ".$ilDB->quote($a_cname,
"text").
" AND ".
997 " slot_id = ".$ilDB->quote($a_slot_id,
"text").
" AND ".
998 " name = ".$ilDB->quote($a_pname,
"text");
1000 $set = $ilDB->query($q);
1002 $rec = $ilDB->fetchAssoc($set);
1012 global $ilPluginAdmin;
1018 $lookupActivePluginsBySlotId = $cached_component->lookupActivePluginsBySlotId($a_slot_id);
1019 foreach($lookupActivePluginsBySlotId as $rec)
1021 if ($ilPluginAdmin->isActive($a_ctype, $a_cname, $a_slot_id, $rec[
"name"]))
1023 $plugins[] = $rec[
"name"];
1038 global $ilPluginAdmin;
1042 $lookupActivePluginsBySlotId = $cached_component->lookupActivePluginsBySlotId($a_slot_id);
1043 foreach($lookupActivePluginsBySlotId as $rec)
1045 if ($ilPluginAdmin->isActive($a_ctype, $a_cname, $a_slot_id, $rec[
"name"]))
1047 $plugins[] = $rec[
"plugin_id"];
1061 $q =
"SELECT name 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 plugin_id = ".$ilDB->quote($a_plugin_id,
"text");
1067 $set = $ilDB->query($q);
1068 if ($rec = $ilDB->fetchAssoc($set))
1070 return $rec[
"name"];
1081 $q =
"SELECT plugin_id FROM il_plugin ".
1082 " WHERE component_type = ".$ilDB->quote($a_ctype,
"text").
1083 " AND component_name = ".$ilDB->quote($a_cname,
"text").
1084 " AND slot_id = ".$ilDB->quote($a_slot_id,
"text").
1085 " AND name = ".$ilDB->quote($a_plugin_name,
"text");
1087 $set = $ilDB->query($q);
1088 if ($rec = $ilDB->fetchAssoc($set))
1090 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.
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 plugin names 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.
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.
for($col=0; $col< 50; $col++) $d
static lookupIdForName($a_ctype, $a_cname, $a_slot_id, $a_plugin_name)
Lookup id for name.
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.
static getActivePluginIdsForSlot($a_ctype, $a_cname, $a_slot_id)
Get All active plugin ids for a slot.
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)
static lookupNameForId($a_ctype, $a_cname, $a_slot_id, $a_plugin_id)
Lookup name for id.
getDirectory()
Get Plugin Directory.
special template class to simplify handling of ITX/PEAR
Reload workbook from saved file
txt($a_var)
Get Language Variable (prefix will be prepended automatically)
getPrefix()
Get plugin prefix, used for lang vars.
Create styles array
The data for the language used.
static _getPluginsDirectory($a_ctype, $a_cname, $a_slot_id)
Get plugins directory.
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.
for($i=1; $i<=count($kw_cases_sel); $i+=1) $lang
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.
if(!file_exists("$old.txt")) if($old===$new) if(file_exists("$new.txt")) $file
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.