88 abstract public function getSlot();
139 $this->lastupdateversion = $a_lastupdateversion;
159 $this->version = $a_version;
177 $this->iliasminversion = $a_iliasminversion;
195 $this->iliasmaxversion = $a_iliasmaxversion;
215 $this->active = $a_active;
233 $this->slot = $a_slot;
251 $this->dbversion = $a_dbversion;
270 $ilDB = $DIC->database();
274 $q =
"UPDATE il_plugin SET db_version = " .
$ilDB->quote((
int) $this->
getDBVersion(),
"integer") .
280 $ilDB->manipulate($q);
298 public static function _getDirectory(
string $a_ctype,
string $a_cname,
string $a_slot_id,
string $a_pname) : string
338 if (!@is_dir($a_lang_directory)) {
342 $dir = opendir($a_lang_directory);
343 while ($file = readdir($dir)) {
348 if (@is_file($a_lang_directory .
"/" . $file)) {
349 if (substr($file, 0, 6) ==
"ilias_" 350 && substr($file, strlen($file) - 5) ==
".lang" 352 $langs[] = array(
"key" => substr($file, 6, 2),
"file" => $file,
353 "path" => $a_lang_directory .
"/" . $file);
372 public static function hasConfigureClass(
string $a_slot_dir, array $plugin_data, array $plugin_db_data) : bool
379 if (is_file($a_slot_dir .
"/" . $plugin_data[
"name"] .
"/classes/class.il" . $plugin_data[
"name"] .
"ConfigGUI.php")) {
397 return "il" . $plugin_data[
"name"] .
"ConfigGUI";
418 public static function getDBUpdateScriptName(
string $a_ctype,
string $a_cname,
string $a_slot_name,
string $a_pname) : string
420 return "Customizing/global/plugins/" . $a_ctype .
"/" . $a_cname .
"/" .
421 $a_slot_name .
"/" . $a_pname .
"/sql/dbupdate.php";
441 ilGlobalCache::flushAll();
444 if (!isset($a_lang_keys)) {
445 $a_lang_keys = array();
447 if ($langObj->isInstalled()) {
448 $a_lang_keys[] = $langObj->getKey();
457 foreach ($langs as
$lang) {
459 if (!in_array($lang[
'key'], $a_lang_keys)) {
464 $lang_array = array();
470 if (is_array(
$txt)) {
472 if ($row[0] !=
"#" && strpos($row,
"#:#") > 0) {
473 $a = explode(
"#:#", trim($row));
474 $identifier = $prefix .
"_" . trim($a[0]);
475 $value = trim($a[1]);
477 if (isset($local_changes[$identifier])) {
478 $lang_array[$identifier] = $local_changes[$identifier];
480 $lang_array[$identifier] = $value;
488 ilObjLanguage::replaceLangModule($lang[
"key"], $prefix, $lang_array);
499 $ilDB = $DIC->database();
500 $lng = $DIC->language();
502 ilGlobalCache::flushAll();
514 $result = $dbupdate->applyUpdate();
516 if ($dbupdate->updateMsg ==
"no_changes") {
517 $message =
$lng->txt(
"no_changes") .
". " .
$lng->txt(
"database_is_uptodate");
519 foreach ($dbupdate->updateMsg as
$row) {
520 $message .=
$lng->txt($row[
"msg"]) .
": " . $row[
"nr"] .
"<br/>";
525 ilGlobalCache::flushAll();
537 $lng = $DIC->language();
539 if (!$this->lang_initialised && is_object(
$lng)) {
541 $this->lang_initialised =
true;
549 public function txt(
string $a_var) : string
552 $lng = $DIC->language();
566 public static function lookupTxt(
string $a_mod_prefix,
string $a_pl_id,
string $a_lang_var) : string
569 $lng = $DIC->language();
572 $prefix = $a_mod_prefix .
"_" . $a_pl_id;
574 return $lng->txt($prefix .
"_" . $a_lang_var, $prefix);
586 public static function langExitsById(
string $pluginId,
string $langVar) : bool
589 $lng = $DIC->language();
592 $pl->loadLanguageModule();
594 return $lng->exists($pl->getPrefix() .
"_" . $langVar);
622 public static function _getImagePath(
string $a_ctype,
string $a_cname,
string $a_slot_id,
string $a_pname,
string $a_img) : string
628 if (is_int(strpos(
$img,
"Customizing"))) {
634 return $d .
"/templates/images/" . $a_img;
643 return self::_getImagePath(
664 if (is_int(strpos($css,
"Customizing"))) {
668 return $this->
getDirectory() .
"/templates/" . $a_css_file;
677 $a_tpl->addBlockFile(
693 public static function createPluginRecord(
string $a_ctype,
string $a_cname,
string $a_slot_id,
string $a_pname)
696 $ilDB = $DIC->database();
700 $q =
"INSERT INTO il_plugin (component_type, component_name, slot_id, name)" .
701 " VALUES (" .
$ilDB->quote($a_ctype,
"text") .
"," .
702 $ilDB->quote($a_cname,
"text") .
"," .
703 $ilDB->quote($a_slot_id,
"text") .
"," .
704 $ilDB->quote($a_pname,
"text") .
")";
706 $ilDB->manipulate($q);
719 public static function getPluginRecord(
string $a_ctype,
string $a_cname,
string $a_slot_id,
string $a_pname) : array
722 $rec = $cached_component->lookupPluginByName($a_pname);
724 if ($rec[
'component_type'] == $a_ctype
and $rec[
'component_name'] == $a_cname
and $rec[
'slot_id'] == $a_slot_id) {
727 throw new ilPluginException(
"No plugin record found for '{$a_ctype}', '{$a_cname}', '{$a_slot_id}', '{$a_pname}");
738 $ilPluginAdmin = $DIC[
'ilPluginAdmin'];
753 $ilPluginAdmin->getId(
754 $this->getComponentType(),
763 $ilPluginAdmin->getVersion(
764 $this->getComponentType(),
773 $ilPluginAdmin->getIliasMinVersion(
774 $this->getComponentType(),
783 $ilPluginAdmin->getIliasMaxVersion(
784 $this->getComponentType(),
817 abstract protected function slotInit();
835 $ilPluginAdmin = $DIC[
'ilPluginAdmin'];
837 return $ilPluginAdmin->isActive(
852 $ilPluginAdmin = $DIC[
'ilPluginAdmin'];
854 return $ilPluginAdmin->needsUpdate(
866 $ilDB = $DIC->database();
869 $q =
"UPDATE il_plugin SET plugin_id = " .
$ilDB->quote($this->
getId(),
"text") .
875 $ilDB->manipulate($q);
886 $ilDB = $DIC->database();
905 $q =
"UPDATE il_plugin SET active = " .
$ilDB->quote(1,
"integer") .
911 $ilDB->manipulate($q);
957 $ilDB = $DIC->database();
963 $q =
"UPDATE il_plugin SET active = " .
$ilDB->quote(0,
"integer") .
969 $ilDB->manipulate($q);
995 $ilDB = $DIC->database();
1003 "DELETE FROM lng_data" .
1004 " WHERE module = " .
$ilDB->quote($prefix,
"text")
1007 "DELETE FROM lng_modules" .
1008 " WHERE module = " .
$ilDB->quote($prefix,
"text")
1016 $q =
"DELETE FROM il_plugin" .
1021 $ilDB->manipulate($q);
1051 $ilDB = $DIC->database();
1054 ilGlobalCache::flushAll();
1070 include_once(
"./setup/classes/class.ilCtrlStructureReader.php");
1072 $structure_reader->readStructure(
1081 "ilobjcomponentsettingsgui",
1090 $q =
"UPDATE il_plugin SET last_update_version = " .
$ilDB->quote($this->
getVersion(),
"text") .
1096 $ilDB->manipulate($q);
1099 ilGlobalCache::flushAll();
1166 public static function getPluginObject(
string $a_ctype,
string $a_cname,
string $a_slot_id,
string $a_pname)
1171 $rec = $cached_component->lookCompId($a_ctype, $a_cname);
1176 $file =
"./Customizing/global/plugins/" . $a_ctype .
"/" .
1177 $a_cname .
"/" . $slot_name .
"/" .
1178 $a_pname .
"/classes/class.il" . $a_pname .
"Plugin.php";
1180 if (is_file($file)) {
1181 include_once($file);
1182 $class =
"il" . $a_pname .
"Plugin";
1183 $plugin =
new $class();
1202 public static function lookupStoredData(
string $a_ctype,
string $a_cname,
string $a_slot_id,
string $a_pname) : array
1205 $ilDB = $DIC->database();
1207 $q =
"SELECT * FROM il_plugin WHERE" .
1208 " component_type = " .
$ilDB->quote($a_ctype,
"text") .
" AND" .
1209 " component_name = " .
$ilDB->quote($a_cname,
"text") .
" AND" .
1210 " slot_id = " .
$ilDB->quote($a_slot_id,
"text") .
" AND" .
1211 " name = " .
$ilDB->quote($a_pname,
"text");
1213 $set =
$ilDB->query($q);
1215 if (
$ilDB->numRows($set) == 0) {
1219 return $ilDB->fetchAssoc($set);
1233 $ilPluginAdmin = $DIC[
'ilPluginAdmin'];
1239 $lookupActivePluginsBySlotId = $cached_component->lookupActivePluginsBySlotId($a_slot_id);
1240 foreach ($lookupActivePluginsBySlotId as $rec) {
1241 if ($ilPluginAdmin->isActive($a_ctype, $a_cname, $a_slot_id, $rec[
"name"])) {
1242 $plugins[] = $rec[
"name"];
1262 $ilPluginAdmin = $DIC[
'ilPluginAdmin'];
1266 $lookupActivePluginsBySlotId = $cached_component->lookupActivePluginsBySlotId($a_slot_id);
1267 foreach ($lookupActivePluginsBySlotId as $rec) {
1268 if ($ilPluginAdmin->isActive($a_ctype, $a_cname, $a_slot_id, $rec[
"name"])) {
1269 $plugins[] = $rec[
"plugin_id"];
1285 public static function lookupNameForId(
string $a_ctype,
string $a_cname,
string $a_slot_id,
string $a_plugin_id)
1288 $ilDB = $DIC->database();
1290 $q =
"SELECT name FROM il_plugin " .
1291 " WHERE component_type = " .
$ilDB->quote($a_ctype,
"text") .
1292 " AND component_name = " .
$ilDB->quote($a_cname,
"text") .
1293 " AND slot_id = " .
$ilDB->quote($a_slot_id,
"text") .
1294 " AND plugin_id = " .
$ilDB->quote($a_plugin_id,
"text");
1296 $set =
$ilDB->query($q);
1297 if ($rec =
$ilDB->fetchAssoc($set)) {
1298 return $rec[
"name"];
1311 public static function lookupIdForName(
string $a_ctype,
string $a_cname,
string $a_slot_id,
string $a_plugin_name) : string
1314 $ilDB = $DIC->database();
1316 $q =
"SELECT plugin_id FROM il_plugin " .
1317 " WHERE component_type = " .
$ilDB->quote($a_ctype,
"text") .
1318 " AND component_name = " .
$ilDB->quote($a_cname,
"text") .
1319 " AND slot_id = " .
$ilDB->quote($a_slot_id,
"text") .
1320 " AND name = " .
$ilDB->quote($a_plugin_name,
"text");
1322 $set =
$ilDB->query($q);
1323 if ($rec =
$ilDB->fetchAssoc($set)) {
1324 return $rec[
"plugin_id"];
1335 $ilDB = $DIC->database();
1337 $q =
"SELECT component_type, component_name, slot_id FROM il_plugin " 1338 .
" WHERE plugin_id = " .
$ilDB->quote($id,
"text")
1341 $set =
$ilDB->query($q);
1342 if ($rec =
$ilDB->fetchAssoc($set)) {
1344 $rec[
"component_type"],
1345 $rec[
"component_name"],
getTablePrefix()
Get db table plugin prefix.
writeDBVersion(int $a_dbversion)
loadLanguageModule()
Load language module for plugin.
static getPluginObject(string $a_ctype, string $a_cname, string $a_slot_id, string $a_pname)
setActive(bool $a_active)
Class AbstractStaticPluginMainMenuProvider.
static lookupId($a_type, $a_name)
Lookup ID of a component.
const ILIAS_VERSION_NUMERIC
includeClass($a_class_file_name)
Include (once) a class file.
static isVersionGreaterString($a_ver1, $a_ver2)
getImagePath(string $a_img)
Get image path.
static getStyleSheetLocation($mode="output", $a_css_name="", $a_css_location="")
get full style sheet file name (path inclusive) of current user
static getDBUpdateScriptName(string $a_ctype, string $a_cname, string $a_slot_name, string $a_pname)
static langExitsById(string $pluginId, string $langVar)
Is searched lang var available in plugin lang files.
needsUpdate()
Check whether update is needed.
static getInstalledLanguages()
Get the language objects of the installed languages.
static getAvailableLangFiles(string $a_lang_directory)
Get array of all language files in the plugin.
getTemplate(string $a_template, bool $a_par1=true, bool $a_par2=true)
gets a ilTemplate instance of a html-file in the plugin /templates
static lookupSlotName($a_ctype, $a_cname, $a_slot_id)
Lookup slot name for component and slot id.
afterUninstall()
This is Plugin-Specific and is triggered after the uninstall command of a plugin. ...
updateLanguages($a_lang_keys=null)
static _getImagePath(string $a_ctype, string $a_cname, string $a_slot_id, string $a_pname, string $a_img)
readEventListening()
Read the event listening definitions from the plugin.xml (if file exists)
static getPluginRecord(string $a_ctype, string $a_cname, string $a_slot_id, string $a_pname)
getComponentName()
Get Component Name.
beforeActivation()
Before activation processing.
Class ilCtrlStructureReader.
static getPluginObjectByType($type)
Return either a repoObject plugin or a orgunit extension plugin or null if the type is not a plugin...
isActive()
Check whether plugin is active.
static lookupIdForName(string $a_ctype, string $a_cname, string $a_slot_id, string $a_plugin_name)
Class ilPluginGlobalScreenNullProvider.
static lookupNameForId(string $a_ctype, string $a_cname, string $a_slot_id, string $a_plugin_id)
getComponentType()
Get Component Type.
static createPluginRecord(string $a_ctype, string $a_cname, string $a_slot_id, string $a_pname)
init()
Object initialization.
afterInstall()
After install processing.
static getActivePluginsForSlot(string $a_ctype, string $a_cname, string $a_slot_id)
static lookupStoredData(string $a_ctype, string $a_cname, string $a_slot_id, string $a_pname)
Lookup information data in il_plugin.
catch(Exception $e) $message
afterActivation()
After activation processing.
static _getLocalChangesByModule($a_key, $a_module)
Get the local changes of a language module.
static lookupTypeInformationsForId(string $id)
setDBVersion(int $a_dbversion)
updateDatabase()
Update database.
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
setIliasMinVersion(string $a_iliasminversion)
setIliasMaxVersion(string $a_iliasmaxversion)
static hasConfigureClass(string $a_slot_dir, array $plugin_data, array $plugin_db_data)
Has the plugin a configure class?
getDirectory()
Get Plugin Directory.
special template class to simplify handling of ITX/PEAR
txt(string $a_var)
Get Language Variable (prefix will be prepended automatically)
getPrefix()
Get plugin prefix, used for lang vars.
static _getPluginsDirectory($a_ctype, $a_cname, $a_slot_id)
Get plugins directory.
static getConfigureClassName(array $plugin_data)
Get plugin configure class name.
afterUpdate()
After update processing.
getLastUpdateVersion()
Get Version of last update.
setSlotObject(ilPluginSlot $a_slot)
slotInit()
Object initialization done by slot.
static _getDirectory(string $a_ctype, string $a_cname, string $a_slot_id, string $a_pname)
Get plugin directory.
getStyleSheetLocation(string $a_css_file)
__init()
Default initialization.
getPluginName()
Get Plugin Name.
for($i=1; $i<=count($kw_cases_sel); $i+=1) $lang
setLastUpdateVersion(string $a_lastupdateversion)
Set Version of last update.
promoteGlobalScreenProvider()
setVersion(string $a_version)
addBlockFile($a_tpl, $a_var, $a_block, $a_tplname)
Add template content to placeholder variable.
static getActivePluginIdsForSlot(string $a_ctype, string $a_cname, string $a_slot_id)
Get All active plugin ids for a slot.
getIliasMaxVersion()
Get Required ILIAS max.
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 lookupTxt(string $a_mod_prefix, string $a_pl_id, string $a_lang_var)
clearEventListening()
Clear the entries of this plugin in the event handling table.