5 include_once(
"./Services/Component/classes/class.ilComponent.php");
6 include_once(
"./Services/Component/exceptions/class.ilPluginException.php");
57 abstract public function getSlot();
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) {
477 $message .= $lng->txt($row[
"msg"]) .
": " . $row[
"nr"] .
"<br/>";
493 if (!$this->lang_initialised && is_object($lng)) {
494 $lng->loadLanguageModule($this->
getPrefix());
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;
577 return self::_getImagePath(
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(),
684 $this->getComponentType(),
692 $this->getComponentType(),
700 $this->getComponentType(),
729 abstract protected function slotInit();
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") .
814 " WHERE component_type = " . $ilDB->quote($this->
getComponentType(),
"text") .
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") .
866 " WHERE component_type = " . $ilDB->quote($this->
getComponentType(),
"text") .
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" .
913 " WHERE component_type = " . $ilDB->quote($this->
getComponentType(),
"text") .
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"];
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.
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 langExitsById($pluginId, $langVar)
Is searched lang var available in plugin lang files.
static lookupSlotName($a_ctype, $a_cname, $a_slot_id)
Lookup slot name for component and slot id.
setSlotObject($a_slot)
Set Plugin Slot.
updateLanguages($a_lang_keys=null)
static _getImagePath( $a_ctype, $a_cname, $a_slot_id, $a_pname, $a_img)
Get image path.
static getConfigureClassName($a_name)
Get plugin configure class name.
readEventListening()
Read the event listening definitions from the plugin.xml (if file exists)
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.
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.
afterInstall()
After install processing.
static lookupTxt($a_mod_prefix, $a_pl_id, $a_lang_var)
Lookup language text.
catch(Exception $e) $message
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
static getRepoPluginObjectByType($type)
Return either a repoObject plugin or a orgunit extension plugin or null if the type is not a plugin...
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.
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.
static replaceLangEntry( $a_module, $a_identifier, $a_lang_key, $a_value, $a_local_change=null, $a_remarks=null)
Replace lang entry.
beforeUpdate()
Before update processing.
for($i=6; $i< 13; $i++) for($i=1; $i< 13; $i++) $d
afterDeactivation()
After deactivation processing.
static _getDirectory($a_ctype, $a_cname, $a_slot_id, $a_pname)
Get plugin directory.
clearEventListening()
Clear the entries of this plugin in the event handling table.