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") .
250 " WHERE component_type = " . $ilDB->quote($this->
getComponentType(),
"text") .
251 " AND component_name = " . $ilDB->quote($this->
getComponentName(),
"text") .
252 " AND slot_id = " . $ilDB->quote($this->
getSlotId(),
"text") .
253 " AND name = " . $ilDB->quote($this->
getPluginName(),
"text");
255 $ilDB->manipulate($q);
272 public static 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)) {
318 $dir = opendir($a_lang_directory);
319 while (
$file = readdir($dir)) {
323 if (@is_file($a_lang_directory .
"/" .
$file)) {
324 if (substr(
$file, 0, 6) ==
"ilias_" &&
325 substr(
$file, strlen(
$file) - 5) ==
".lang") {
326 $langs[] = array(
"key" => substr(
$file, 6, 2),
"file" =>
$file,
327 "path" => $a_lang_directory .
"/" .
$file);
345 if (is_file($a_slot_dir .
"/" .
346 $a_name .
"/classes/class.il" . $a_name .
"ConfigGUI.php")) {
360 return "il" . $a_name .
"ConfigGUI";
378 return "Customizing/global/plugins/" . $a_ctype .
"/" . $a_cname .
"/" .
379 $a_slot_name .
"/" . $a_pname .
"/sql/dbupdate.php";
396 ilGlobalCache::flushAll();
397 include_once(
"./Services/Language/classes/class.ilObjLanguage.php");
400 if (!isset($a_lang_keys)) {
401 $a_lang_keys = array();
403 if ($langObj->isInstalled()) {
404 $a_lang_keys[] = $langObj->getKey();
413 foreach ($langs as
$lang) {
415 if (!in_array(
$lang[
'key'], $a_lang_keys)) {
420 $lang_array = array();
423 $local_changes = ilObjLanguage::_getLocalChangesByModule(
$lang[
'key'], $prefix);
426 if (is_array(
$txt)) {
428 if (
$row[0] !=
"#" && strpos(
$row,
"#:#") > 0) {
429 $a = explode(
"#:#", trim(
$row));
430 $identifier = $prefix .
"_" . trim($a[0]);
431 $value = trim($a[1]);
433 if (isset($local_changes[$identifier])) {
434 $lang_array[$identifier] = $local_changes[$identifier];
436 $lang_array[$identifier] = $value;
444 ilObjLanguage::replaceLangModule(
$lang[
"key"], $prefix, $lang_array);
457 include_once(
"./Services/Component/classes/class.ilPluginDBUpdate.php");
471 $result = $dbupdate->applyUpdate();
473 if ($dbupdate->updateMsg ==
"no_changes") {
474 $message =
$lng->txt(
"no_changes") .
". " .
$lng->txt(
"database_is_uptodate");
476 foreach ($dbupdate->updateMsg as
$row) {
493 if (!$this->lang_initialised && is_object(
$lng)) {
495 $this->lang_initialised =
true;
502 public function txt($a_var)
512 public static function lookupTxt($a_mod_prefix, $a_pl_id, $a_lang_var)
517 $prefix = $a_mod_prefix .
"_" . $a_pl_id;
518 return $lng->txt($prefix .
"_" . $a_lang_var, $prefix);
534 $pl->loadLanguageModule();
536 return $lng->exists($pl->getPrefix() .
"_" . $langVar);
543 public function getTemplate($a_template, $a_par1 =
true, $a_par2 =
true)
564 if (is_int(strpos(
$img,
"Customizing"))) {
569 return $d .
"/templates/images/" . $a_img;
595 if (is_int(strpos($css,
"Customizing"))) {
599 return $this->
getDirectory() .
"/templates/" . $a_css_file;
607 $a_tpl->addBlockFile(
629 $q =
"INSERT INTO il_plugin (component_type, component_name, slot_id, name)" .
630 " VALUES (" .
$ilDB->quote($a_ctype,
"text") .
"," .
631 $ilDB->quote($a_cname,
"text") .
"," .
632 $ilDB->quote($a_slot_id,
"text") .
"," .
633 $ilDB->quote($a_pname,
"text") .
")";
635 $ilDB->manipulate($q);
645 $rec = $cached_component->lookupPluginByName($a_pname);
647 if ($rec[
'component_type'] == $a_ctype and $rec[
'component_name'] == $a_cname and $rec[
'slot_id'] == $a_slot_id) {
650 include_once(
"./Services/Component/exceptions/class.ilPluginException.php");
651 throw (
new ilPluginException(
"No plugin record found for '" . $a_ctype .
"', '" . $a_cname .
"', '" . $a_slot_id .
"', '" . $a_pname
675 $this->
setId($ilPluginAdmin->getId(
676 $this->getComponentType(),
677 $this->getComponentName(),
679 $this->getPluginName()
684 $this->getComponentType(),
685 $this->getComponentName(),
687 $this->getPluginName()
692 $this->getComponentType(),
693 $this->getComponentName(),
695 $this->getPluginName()
700 $this->getComponentType(),
701 $this->getComponentName(),
703 $this->getPluginName()
744 global $ilPluginAdmin;
746 return $ilPluginAdmin->isActive(
759 global $ilPluginAdmin;
761 return $ilPluginAdmin->needsUpdate(
779 $q =
"UPDATE il_plugin SET plugin_id = " .
$ilDB->quote($this->
getId(),
"text") .
780 " WHERE component_type = " . $ilDB->quote($this->
getComponentType(),
"text") .
781 " AND component_name = " . $ilDB->quote($this->
getComponentName(),
"text") .
782 " AND slot_id = " . $ilDB->quote($this->
getSlotId(),
"text") .
783 " AND name = " . $ilDB->quote($this->
getPluginName(),
"text");
785 $ilDB->manipulate($q);
813 $q =
"UPDATE il_plugin SET active = " .
$ilDB->quote(1,
"integer") .
815 " AND component_name = " . $ilDB->quote($this->
getComponentName(),
"text") .
816 " AND slot_id = " . $ilDB->quote($this->
getSlotId(),
"text") .
817 " AND name = " . $ilDB->quote($this->
getPluginName(),
"text");
819 $ilDB->manipulate($q);
865 $q =
"UPDATE il_plugin SET active = " .
$ilDB->quote(0,
"integer") .
867 " AND component_name = " . $ilDB->quote($this->
getComponentName(),
"text") .
868 " AND slot_id = " . $ilDB->quote($this->
getSlotId(),
"text") .
869 " AND name = " . $ilDB->quote($this->
getPluginName(),
"text");
871 $ilDB->manipulate($q);
902 $ilDB->manipulate(
"DELETE FROM lng_data" .
903 " WHERE module = " .
$ilDB->quote($prefix,
"text"));
904 $ilDB->manipulate(
"DELETE FROM lng_modules" .
905 " WHERE module = " .
$ilDB->quote($prefix,
"text"));
912 $q =
"DELETE FROM il_plugin" .
914 " AND component_name = " . $ilDB->quote($this->
getComponentName(),
"text") .
915 " AND slot_id = " . $ilDB->quote($this->
getSlotId(),
"text") .
916 " AND name = " . $ilDB->quote($this->
getPluginName(),
"text");
917 $ilDB->manipulate($q);
956 include_once(
"./setup/classes/class.ilCtrlStructureReader.php");
958 $structure_reader->readStructure(
967 $ilCtrl->insertCtrlCalls(
968 "ilobjcomponentsettingsgui",
977 $q =
"UPDATE il_plugin SET last_update_version = " .
$ilDB->quote($this->
getVersion(),
"text") .
978 " WHERE component_type = " . $ilDB->quote($this->
getComponentType(),
"text") .
979 " AND component_name = " . $ilDB->quote($this->
getComponentName(),
"text") .
980 " AND slot_id = " . $ilDB->quote($this->
getSlotId(),
"text") .
981 " AND name = " . $ilDB->quote($this->
getPluginName(),
"text");
983 $ilDB->manipulate($q);
1050 include_once(
"./Services/Component/classes/class.ilPluginSlot.php");
1054 $rec = $cached_component->lookCompId($a_ctype, $a_cname);
1059 $file =
"./Customizing/global/plugins/" . $a_ctype .
"/" .
1060 $a_cname .
"/" . $slot_name .
"/" .
1061 $a_pname .
"/classes/class.il" . $a_pname .
"Plugin.php";
1063 if (is_file(
$file)) {
1064 include_once(
$file);
1065 $class =
"il" . $a_pname .
"Plugin";
1066 $plugin =
new $class();
1088 $q =
"SELECT * FROM il_plugin WHERE" .
1089 " component_type = " .
$ilDB->quote($a_ctype,
"text") .
" AND" .
1090 " component_name = " .
$ilDB->quote($a_cname,
"text") .
" AND" .
1091 " slot_id = " .
$ilDB->quote($a_slot_id,
"text") .
" AND" .
1092 " name = " .
$ilDB->quote($a_pname,
"text");
1094 $set =
$ilDB->query($q);
1096 if (
$ilDB->numRows($set) == 0) {
1100 return $ilDB->fetchAssoc($set);
1108 global $ilPluginAdmin;
1114 $lookupActivePluginsBySlotId = $cached_component->lookupActivePluginsBySlotId($a_slot_id);
1115 foreach ($lookupActivePluginsBySlotId as $rec) {
1116 if ($ilPluginAdmin->isActive($a_ctype, $a_cname, $a_slot_id, $rec[
"name"])) {
1117 $plugins[] = $rec[
"name"];
1133 global $ilPluginAdmin;
1137 $lookupActivePluginsBySlotId = $cached_component->lookupActivePluginsBySlotId($a_slot_id);
1138 foreach ($lookupActivePluginsBySlotId as $rec) {
1139 if ($ilPluginAdmin->isActive($a_ctype, $a_cname, $a_slot_id, $rec[
"name"])) {
1140 $plugins[] = $rec[
"plugin_id"];
1154 $q =
"SELECT name FROM il_plugin " .
1155 " WHERE component_type = " .
$ilDB->quote($a_ctype,
"text") .
1156 " AND component_name = " .
$ilDB->quote($a_cname,
"text") .
1157 " AND slot_id = " .
$ilDB->quote($a_slot_id,
"text") .
1158 " AND plugin_id = " .
$ilDB->quote($a_plugin_id,
"text");
1160 $set =
$ilDB->query($q);
1161 if ($rec =
$ilDB->fetchAssoc($set)) {
1162 return $rec[
"name"];
1173 $q =
"SELECT plugin_id FROM il_plugin " .
1174 " WHERE component_type = " .
$ilDB->quote($a_ctype,
"text") .
1175 " AND component_name = " .
$ilDB->quote($a_cname,
"text") .
1176 " AND slot_id = " .
$ilDB->quote($a_slot_id,
"text") .
1177 " AND name = " .
$ilDB->quote($a_plugin_name,
"text");
1179 $set =
$ilDB->query($q);
1180 if ($rec =
$ilDB->fetchAssoc($set)) {
1181 return $rec[
"plugin_id"];
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 getRepoPluginObjectByType($type)
Return either a repoObject plugin or a orgunit extension plugin or null if the type is not a plugin.
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.
readEventListening()
Read the event listening definitions from the plugin.xml (if file exists)
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.
clearEventListening()
Clear the entries of this plugin in the event handling table.
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).
afterInstall()
After install processing.
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.
static _getImagePath( $a_ctype, $a_cname, $a_slot_id, $a_pname, $a_img)
Get image path.
__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.
static langExitsById($pluginId, $langVar)
Is searched lang var available in plugin lang files.
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=6;$i< 13;$i++) for($i=1; $i< 13; $i++) $d
catch(Exception $e) $message
if(!file_exists("$old.txt")) if( $old===$new) if(file_exists("$new.txt")) $file