5include_once(
"./Services/Component/classes/class.ilComponent.php");
6include_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_" &&
331 $langs[] = array(
"key" => substr(
$file, 6, 2),
"file" =>
$file,
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))
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(),
670 $this->getComponentName(),
672 $this->getPluginName()));
675 $this->
setVersion($ilPluginAdmin->getVersion($this->getComponentType(),
676 $this->getComponentName(),
678 $this->getPluginName()));
681 $this->
setIliasMinVersion($ilPluginAdmin->getIliasMinVersion($this->getComponentType(),
682 $this->getComponentName(),
684 $this->getPluginName()));
687 $this->
setIliasMaxVersion($ilPluginAdmin->getIliasMaxVersion($this->getComponentType(),
688 $this->getComponentName(),
690 $this->getPluginName()));
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"];
for($col=0; $col< 50; $col++) $d
An exception for terminatinating execution or to throw for unit testing.
static lookupId($a_type, $a_name)
Lookup ID of a component.
Class ilCtrlStructureReader.
static getInstalledLanguages()
Get the language objects of the installed languages.
static replaceLangEntry($a_module, $a_identifier, $a_lang_key, $a_value, $a_local_change=null, $a_remarks=null)
Replace lang entry.
static lookupSlotName($a_ctype, $a_cname, $a_slot_id)
Lookup slot name for component and slot id.
static _getPluginsDirectory($a_ctype, $a_cname, $a_slot_id)
Get plugins directory.
static createPluginRecord($a_ctype, $a_cname, $a_slot_id, $a_pname)
setIliasMinVersion($a_iliasminversion)
Set Required ILIAS min.
getDBVersion()
Get DB Version.
static getAvailableLangFiles($a_lang_directory)
Get array of all language files in the plugin.
setSlotObject($a_slot)
Set Plugin Slot.
writeDBVersion($a_dbversion)
Write DB version to database.
needsUpdate()
Check whether update is needed.
getTablePrefix()
Get db table plugin prefix.
afterActivation()
After activation processing.
updateLanguages($a_lang_keys=null)
static getDBUpdateScriptName($a_ctype, $a_cname, $a_slot_name, $a_pname)
Get DB update script filename (full path)
includeClass($a_class_file_name)
Include (once) a class file.
isActive()
Check whether plugin is active.
getSlotObject()
Get Plugin Slot.
getLastUpdateVersion()
Get Version of last update.
static lookupIdForName($a_ctype, $a_cname, $a_slot_id, $a_plugin_name)
Lookup id for name.
setLastUpdateVersion($a_lastupdateversion)
Set Version of last update.
addBlockFile($a_tpl, $a_var, $a_block, $a_tplname)
Add template content to placeholder variable.
getLanguageDirectory()
Get Plugin's language Directory.
afterUpdate()
After update processing.
getPrefix()
Get plugin prefix, used for lang vars.
setActive($a_active)
Set Active.
getVersion()
Get Current Version (from plugin.php file).
static _getImagePath($a_ctype, $a_cname, $a_slot_id, $a_pname, $a_img)
Get image path.
getTemplate($a_template, $a_par1=true, $a_par2=true)
Get template from plugin.
static getPluginObject($a_ctype, $a_cname, $a_slot_id, $a_pname)
Get plugin object.
init()
Object initialization.
getPluginName()
Get Plugin Name.
setDBVersion($a_dbversion)
Set DB Version.
static lookupTxt($a_mod_prefix, $a_pl_id, $a_lang_var)
Lookup language text.
static getPluginRecord($a_ctype, $a_cname, $a_slot_id, $a_pname)
Get record from il_plugin table.
getComponentName()
Get Component Name.
__init()
Default initialization.
static lookupNameForId($a_ctype, $a_cname, $a_slot_id, $a_plugin_id)
Lookup name for id.
beforeUpdate()
Before update processing.
static _getDirectory($a_ctype, $a_cname, $a_slot_id, $a_pname)
Get plugin directory.
getDirectory()
Get Plugin Directory.
getIliasMaxVersion()
Get Required ILIAS max.
getImagePath($a_img)
Get image path.
getIliasMinVersion()
Get Required ILIAS min.
getStyleSheetLocation($a_css_file)
Get css file location.
getClassesDirectory()
Get Plugin's classes Directory.
static getConfigureClassName($a_name)
Get plugin configure class name.
beforeActivation()
Before activation processing.
loadLanguageModule()
Load language module for plugin.
slotInit()
Object initialization done by slot.
static hasConfigureClass($a_slot_dir, $a_name)
Has the plugin a configure class?
static lookupStoredData($a_ctype, $a_cname, $a_slot_id, $a_pname)
Lookup information data in il_plugin.
setIliasMaxVersion($a_iliasmaxversion)
Set Required ILIAS max.
txt($a_var)
Get Language Variable (prefix will be prepended automatically)
afterDeactivation()
After deactivation processing.
getComponentType()
Get Component Type.
setVersion($a_version)
Set Current Version (from plugin.php file).
static getActivePluginsForSlot($a_ctype, $a_cname, $a_slot_id)
Get all active plugin names for a slot.
static getActivePluginIdsForSlot($a_ctype, $a_cname, $a_slot_id)
Get All active plugin ids for a slot.
updateDatabase()
Update database.
special template class to simplify handling of ITX/PEAR
static getStyleSheetLocation($mode="output", $a_css_name="", $a_css_location="")
get full style sheet file name (path inclusive) of current user
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
for($i=1; $i<=count($kw_cases_sel); $i+=1) $lang
if(!file_exists("$old.txt")) if( $old===$new) if(file_exists("$new.txt")) $file