ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
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 usages in the user session. More...
 
static _getSavedModules ()
 Get the stored modules from the user session. More...
 
static _getSavedTopics ()
 Get the stored topics from the user session. More...
 

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 52 of file class.ilObjLanguageAccess.php.

53 {
54 global $ilSetting, $ilUser, $rbacsystem;
55
56 if ($ilUser->getId()) {
58 return $rbacsystem->checkAccess("read,write", (int) $ref_id);
59 }
60 return false;
61 }
static _lookupLangFolderRefId()
Lookup the ref_id of the global language folder.
global $ilSetting
Definition: privfeed.php:17
$ilUser
Definition: imgupload.php:18

References $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 29 of file class.ilObjLanguageAccess.php.

30 {
31 global $lng, $ilSetting, $ilUser, $rbacsystem;
32
33 if (!$ilSetting->get("lang_translate_" . $lng->getLangKey())) {
34 return false;
35 }
36
37 if ($ilUser->getId()) {
39 return $rbacsystem->checkAccess("read,write", (int) $ref_id);
40 }
41 return false;
42 }
global $lng
Definition: privfeed.php:17

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

Referenced by ilTemplate\addILIASFooter().

+ 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 147 of file class.ilObjLanguageAccess.php.

148 {
149 $saved = $_SESSION['lang_ext_maintenance']['used_modules'];
150 return is_array($saved) ? $saved : array();
151 }
$_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 158 of file class.ilObjLanguageAccess.php.

159 {
160 $saved = $_SESSION['lang_ext_maintenance']['used_topics'];
161 return is_array($saved) ? $saved : array();
162 }

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 105 of file class.ilObjLanguageAccess.php.

106 {
107 // ref id must be given to prevent params being deleted by ilAdministrtionGUI
108 return "ilias.php"
109 . "?ref_id=" . self::_lookupLangFolderRefId()
110 . "&baseClass=ilAdministrationGUI"
111 . "&cmdClass=ilobjlanguageextgui"
112 . "&view_mode=translate"
113 . "&reset_offset=true";
114 }

References _lookupLangFolderRefId().

Referenced by ilTemplate\addILIASFooter().

+ 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 126 of file class.ilObjLanguageAccess.php.

127 {
128 return (strtolower($_GET['cmdClass'] == 'ilobjlanguageextgui') and $_GET['view_mode'] == "translate");
129 }
$_GET["client_id"]

References $_GET.

Referenced by ilLanguageExtTableGUI\__construct(), ilObjLanguageExtGUI\addAdminLocatorItems(), ilTemplate\addILIASFooter(), ilObjLanguageExtGUI\getAdminTabs(), 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 87 of file class.ilObjLanguageAccess.php.

88 {
89 global $ilDB;
90
91 $q = "SELECT obj_id FROM object_data " .
92 " WHERE type = " . $ilDB->quote("lng", "text") .
93 " AND title = " . $ilDB->quote($a_key, "text");
94 $set = $ilDB->query($q);
95 $row = $ilDB->fetchAssoc($set);
96 return $row['obj_id'];
97 }
global $ilDB

References $ilDB, and $row.

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 69 of file class.ilObjLanguageAccess.php.

70 {
71 global $ilDB;
72
73 $q = "SELECT ref_id FROM object_reference r, object_data d" .
74 " WHERE r.obj_id = d.obj_id AND d.type = " . $ilDB->quote("lngf", "text");
75 $set = $ilDB->query($q);
76 $row = $ilDB->fetchAssoc($set);
77 return $row['ref_id'];
78 }

References $ilDB, and $row.

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

+ Here is the caller graph for this function:

◆ _saveUsages()

static ilObjLanguageAccess::_saveUsages ( )
static

Store the collected usages in the user session.

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

136 {
137 global $lng;
138 $_SESSION['lang_ext_maintenance']['used_modules'] = array_keys($lng->getUsedModules());
139 $_SESSION['lang_ext_maintenance']['used_topics'] = array_keys($lng->getUsedTopics());
140 }

References $_SESSION, and $lng.

Referenced by ilTemplate\get(), and ilTemplate\show().

+ Here is the caller graph for this function:

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