ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
ilObjLanguageAccess Class Reference
+ Collaboration diagram for ilObjLanguageAccess:

Static Public Member Functions

static _checkTranslate ()
 Permission check for translations. More...
 
static _checkMaintenance ()
 Permission check for language maintenance (import/export) More...
 
static _lookupLangFolderRefId ()
 Lookup the ref_id of the global language folder. More...
 
static _lookupId ($a_key)
 Lookup the object ID for a language key. More...
 
static _getTranslationLink ()
 Get the link to translate the current page. More...
 
static _isPageTranslation ()
 Check if the current request is a page translation. More...
 
static _saveUsages ()
 Store the collected language variable usages in the user session This should be called as late as possible in a request. More...
 
static _getSavedModules ()
 Get the stored modules from the user session. More...
 
static _getSavedTopics ()
 Get the stored topics from the user session. More...
 

Static Protected Attributes

static $cached_check_translate
 

Detailed Description

Definition at line 17 of file class.ilObjLanguageAccess.php.

Member Function Documentation

◆ _checkMaintenance()

static ilObjLanguageAccess::_checkMaintenance ( )
static

Permission check for language maintenance (import/export)

  • The user must have read and write permissions to the language folder

@access static

Returns
boolean maintenance possible (true/false)

Definition at line 63 of file class.ilObjLanguageAccess.php.

64 {
65 global $DIC;
66 $ilSetting = $DIC->settings();
67 $ilUser = $DIC->user();
68 $rbacsystem = $DIC->rbac()->system();
69
70 if ($ilUser->getId()) {
72 return $rbacsystem->checkAccess("read,write", (int) $ref_id);
73 }
74 return false;
75 }
static _lookupLangFolderRefId()
Lookup the ref_id of the global language folder.
global $ilSetting
Definition: privfeed.php:17
$ilUser
Definition: imgupload.php:18
$DIC
Definition: xapitoken.php:46

References $DIC, $ilSetting, $ilUser, and _lookupLangFolderRefId().

Referenced by ilObjLanguageExtGUI\executeCommand().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _checkTranslate()

static ilObjLanguageAccess::_checkTranslate ( )
static

Permission check for translations.

This check is used for displaying the translation link on each page

  • The page translation of the current language must be turned on
  • The user must have read and write permissions to the language folder

@access static

Returns
boolean translation possible (true/false)

Definition at line 36 of file class.ilObjLanguageAccess.php.

37 {
38 global $DIC;
39 $lng = $DIC->language();
40 $ilSetting = $DIC->settings();
41 $ilUser = $DIC->user();
42 $rbacsystem = $DIC->rbac()->system();
43
44 if (!$ilSetting->get("lang_translate_" . $lng->getLangKey())) {
45 return false;
46 }
47
48 if ($ilUser->getId()) {
50 return $rbacsystem->checkAccess("read,write", (int) $ref_id);
51 }
52 return false;
53 }
$lng

References $DIC, $ilSetting, $ilUser, $lng, and _lookupLangFolderRefId().

Referenced by ilDataCollectionGlobalTemplate\fillFooter(), ilCOPageGlobalTemplate\fillFooter(), ilRTEGlobalTemplate\fillFooter(), ilGlobalTemplate\fillFooter(), and ILIAS\UICore\PageContentProvider\getFooterModification().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _getSavedModules()

static ilObjLanguageAccess::_getSavedModules ( )
static

Get the stored modules from the user session.

Returns
array list of module names

Definition at line 168 of file class.ilObjLanguageAccess.php.

169 {
170 $saved = $_SESSION['lang_ext_maintenance']['used_modules'];
171 return is_array($saved) ? $saved : array();
172 }
$_SESSION["AccountId"]

References $_SESSION.

Referenced by ilObjLanguageExtGUI\initAddNewEntryForm(), and ilObjLanguageExtGUI\viewObject().

+ Here is the caller graph for this function:

◆ _getSavedTopics()

static ilObjLanguageAccess::_getSavedTopics ( )
static

Get the stored topics from the user session.

Returns
array list of module names

Definition at line 179 of file class.ilObjLanguageAccess.php.

180 {
181 $saved = $_SESSION['lang_ext_maintenance']['used_topics'];
182 return is_array($saved) ? $saved : array();
183 }

References $_SESSION.

Referenced by ilObjLanguageExtGUI\initAddNewEntryForm(), and ilObjLanguageExtGUI\viewObject().

+ Here is the caller graph for this function:

◆ _getTranslationLink()

static ilObjLanguageAccess::_getTranslationLink ( )
static

Get the link to translate the current page.

Returns
string translation link

Definition at line 121 of file class.ilObjLanguageAccess.php.

122 {
123 // ref id must be given to prevent params being deleted by ilAdministrtionGUI
124 return "ilias.php"
125 . "?ref_id=" . self::_lookupLangFolderRefId()
126 . "&baseClass=ilAdministrationGUI"
127 . "&cmdClass=ilobjlanguageextgui"
128 . "&view_mode=translate"
129 . "&reset_offset=true";
130 }

References _lookupLangFolderRefId().

Referenced by ilDataCollectionGlobalTemplate\fillFooter(), ilCOPageGlobalTemplate\fillFooter(), ilRTEGlobalTemplate\fillFooter(), ilGlobalTemplate\fillFooter(), and ILIAS\UICore\PageContentProvider\getFooterModification().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _isPageTranslation()

static ilObjLanguageAccess::_isPageTranslation ( )
static

Check if the current request is a page translation.

The page translation mode is used when the translation of a single page is called by the translation link on a page footer. On this screen only the topics stored from the calling page are shown for translation and only a save function for these topics is offered.

Returns
bool page translation (true or false)

Definition at line 142 of file class.ilObjLanguageAccess.php.

143 {
144 return (strtolower($_GET['cmdClass'] == 'ilobjlanguageextgui') and $_GET['view_mode'] == "translate");
145 }
$_GET["client_id"]

References $_GET.

Referenced by ilLanguageExtTableGUI\__construct(), ilObjLanguageExtGUI\addAdminLocatorItems(), ilDataCollectionGlobalTemplate\fillFooter(), ilCOPageGlobalTemplate\fillFooter(), ilRTEGlobalTemplate\fillFooter(), ilGlobalTemplate\fillFooter(), ilObjLanguageExtGUI\getAdminTabs(), ILIAS\UICore\PageContentProvider\getFooterModification(), ilLanguageExtTableGUI\initFilter(), ilObjLanguageExtGUI\setTitleAndDescription(), and ilObjLanguageExtGUI\viewObject().

+ Here is the caller graph for this function:

◆ _lookupId()

static ilObjLanguageAccess::_lookupId (   $a_key)
static

Lookup the object ID for a language key.

Parameters
stringlanguage key
integerlanguage object id

Definition at line 102 of file class.ilObjLanguageAccess.php.

103 {
104 global $DIC;
105 $ilDB = $DIC->database();
106
107 $q = "SELECT obj_id FROM object_data " .
108 " WHERE type = " . $ilDB->quote("lng", "text") .
109 " AND title = " . $ilDB->quote($a_key, "text");
110 $set = $ilDB->query($q);
111 $row = $ilDB->fetchAssoc($set);
112 return $row['obj_id'];
113 }
global $ilDB

References $DIC, and $ilDB.

Referenced by ilObjLanguageExtGUI\__construct().

+ Here is the caller graph for this function:

◆ _lookupLangFolderRefId()

static ilObjLanguageAccess::_lookupLangFolderRefId ( )
static

Lookup the ref_id of the global language folder.

Returns
int language folder ref_id

Definition at line 83 of file class.ilObjLanguageAccess.php.

84 {
85 global $DIC;
86 $ilDB = $DIC->database();
87
88 $q = "SELECT ref_id FROM object_reference r, object_data d" .
89 " WHERE r.obj_id = d.obj_id AND d.type = " . $ilDB->quote("lngf", "text");
90 $set = $ilDB->query($q);
91 $row = $ilDB->fetchAssoc($set);
92 return $row['ref_id'];
93 }

References $DIC, and $ilDB.

Referenced by _checkMaintenance(), _checkTranslate(), and _getTranslationLink().

+ Here is the caller graph for this function:

◆ _saveUsages()

static ilObjLanguageAccess::_saveUsages ( )
static

Store the collected language variable usages in the user session This should be called as late as possible in a request.

Definition at line 152 of file class.ilObjLanguageAccess.php.

153 {
154 global $DIC;
155 $lng = $DIC->language();
156
157 if (self::_checkTranslate() and !self::_isPageTranslation()) {
158 $_SESSION['lang_ext_maintenance']['used_modules'] = array_keys($lng->getUsedModules());
159 $_SESSION['lang_ext_maintenance']['used_topics'] = array_keys($lng->getUsedTopics());
160 }
161 }

References $_SESSION, $DIC, and $lng.

Referenced by ilDataCollectionGlobalTemplate\getSpecial(), ilCOPageGlobalTemplate\getSpecial(), ilRTEGlobalTemplate\getSpecial(), ilGlobalTemplate\getSpecial(), ilDataCollectionGlobalTemplate\printToStdout(), ilCOPageGlobalTemplate\printToStdout(), ilRTEGlobalTemplate\printToStdout(), ilGlobalPageTemplate\printToStdout(), ILIAS\Services\UICore\MetaTemplate\PageContentGUI\renderPage(), and ilGlobalTemplate\renderPage().

+ Here is the caller graph for this function:

Field Documentation

◆ $cached_check_translate

ilObjLanguageAccess::$cached_check_translate
staticprotected

Definition at line 23 of file class.ilObjLanguageAccess.php.


The documentation for this class was generated from the following file: