19 declare(strict_types=1);
49 $lng = $DIC->language();
51 $ilUser = $DIC->user();
52 $rbacsystem = $DIC->rbac()->system();
54 if (isset(self::$cached_check_translate)) {
55 return self::$cached_check_translate;
59 self::$cached_check_translate =
false;
60 return self::$cached_check_translate;
63 if ($ilUser->getId()) {
64 $ref_id = self::_lookupLangFolderRefId();
65 self::$cached_check_translate = $rbacsystem->checkAccess(
"read,write",
$ref_id);
67 self::$cached_check_translate =
false;
70 return self::$cached_check_translate;
84 $ilUser = $DIC->user();
85 $rbacsystem = $DIC->rbac()->system();
87 if ($ilUser->getId()) {
88 $ref_id = self::_lookupLangFolderRefId();
89 return $rbacsystem->checkAccess(
"read,write",
$ref_id);
103 $ilDB = $DIC->database();
105 $q =
"SELECT ref_id FROM object_reference r, object_data d" .
106 " WHERE r.obj_id = d.obj_id AND d.type = " .
$ilDB->quote(
"lngf",
"text");
108 $row =
$ilDB->fetchAssoc($set);
109 return (
int) $row[
"ref_id"];
122 $ilDB = $DIC->database();
124 $q =
"SELECT obj_id FROM object_data " .
125 " WHERE type = " .
$ilDB->quote(
"lng",
"text") .
126 " AND title = " .
$ilDB->quote($a_key,
"text");
128 $row =
$ilDB->fetchAssoc($set);
129 return (
int) $row[
"obj_id"];
142 .
"?ref_id=" . self::_lookupLangFolderRefId()
143 .
"&baseClass=ilAdministrationGUI" 144 .
"&cmdClass=ilobjlanguageextgui" 145 .
"&view_mode=translate" 146 .
"&reset_offset=true";
164 if ($DIC->http()->wrapper()->query()->has(
"cmdClass")) {
165 $cmdClass = $DIC->http()->wrapper()->query()->retrieve(
167 $DIC->refinery()->kindlyTo()->string()
170 if ($DIC->http()->wrapper()->query()->has(
"view_mode")) {
171 $view_mode_get = $DIC->http()->wrapper()->query()->retrieve(
173 $DIC->refinery()->kindlyTo()->string()
176 return (strtolower($cmdClass) ===
"ilobjlanguageextgui" && $view_mode_get ===
"translate");
186 $lng = $DIC->language();
188 if (self::_checkTranslate() and !self::_isPageTranslation()) {
189 ilSession::set(
"lang_ext_maintenance", array(
"used_modules" => array_keys(
$lng->getUsedModules())));
190 ilSession::set(
"lang_ext_maintenance", array(
"used_topics" => array_keys(
$lng->getUsedTopics())));
202 $lang_ext_maintenance_from_session =
ilSession::get(
"lang_ext_maintenance");
203 if (is_array($lang_ext_maintenance_from_session) && isset($lang_ext_maintenance_from_session[
"used_modules"])) {
204 $saved = $lang_ext_maintenance_from_session[
"used_modules"];
217 $lang_ext_maintenance_from_session =
ilSession::get(
"lang_ext_maintenance");
218 if (is_array($lang_ext_maintenance_from_session) && isset($lang_ext_maintenance_from_session[
"used_topics"])) {
219 $saved = $lang_ext_maintenance_from_session[
"used_topics"];
static get(string $a_var)
static bool $cached_check_translate
static _isPageTranslation()
Check if the current request is a page translation.
static _getSavedModules()
Get the stored modules from the user session.
static _lookupId(string $a_key)
Lookup the object ID for a language key.
static _checkMaintenance()
Permission check for language maintenance (import/export)
static _getTranslationLink()
Get the link to translate the current page.
static _lookupLangFolderRefId()
Lookup the ref_id of the global language folder.
static _getSavedTopics()
Get the stored topics from the user session.
static _saveUsages()
Store the collected language variable usages in the user session This should be called as late as pos...
static set(string $a_var, $a_val)
Set a value.
static _checkTranslate()
Permission check for translations.