ILIAS  release_7 Revision v7.30-3-g800a261c036
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

static

Returns
boolean maintenance possible (true/false)

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

References $DIC, $ilSetting, and $ilUser.

Referenced by ilObjLanguageExtGUI\executeCommand().

73  {
74  global $DIC;
75  $ilSetting = $DIC->settings();
76  $ilUser = $DIC->user();
77  $rbacsystem = $DIC->rbac()->system();
78 
79  if ($ilUser->getId()) {
80  $ref_id = self::_lookupLangFolderRefId();
81  return $rbacsystem->checkAccess("read,write", (int) $ref_id);
82  }
83  return false;
84  }
global $DIC
Definition: goto.php:24
global $ilSetting
Definition: privfeed.php:17
$ilUser
Definition: imgupload.php:18
+ 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

static

Returns
boolean translation possible (true/false)

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

References $DIC, $ilSetting, $ilUser, and $lng.

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

37  {
38  global $DIC;
39  $lng = $DIC->language();
40  $ilSetting = $DIC->settings();
41  $ilUser = $DIC->user();
42  $rbacsystem = $DIC->rbac()->system();
43 
44  if (isset(self::$cached_check_translate)) {
45  return self::$cached_check_translate;
46  }
47 
48  if (!$ilSetting->get("lang_translate_" . $lng->getLangKey())) {
49  self::$cached_check_translate = false;
50  return self::$cached_check_translate;
51  }
52 
53  if ($ilUser->getId()) {
54  $ref_id = self::_lookupLangFolderRefId();
55  self::$cached_check_translate = $rbacsystem->checkAccess("read,write", (int) $ref_id);
56  }
57  else {
58  self::$cached_check_translate = false;
59  }
60 
61  return self::$cached_check_translate;
62  }
$lng
global $DIC
Definition: goto.php:24
global $ilSetting
Definition: privfeed.php:17
$ilUser
Definition: imgupload.php:18
+ 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 177 of file class.ilObjLanguageAccess.php.

References $_SESSION.

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

178  {
179  $saved = $_SESSION['lang_ext_maintenance']['used_modules'];
180  return is_array($saved) ? $saved : array();
181  }
$_SESSION["AccountId"]
+ 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 188 of file class.ilObjLanguageAccess.php.

References $_SESSION.

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

189  {
190  $saved = $_SESSION['lang_ext_maintenance']['used_topics'];
191  return is_array($saved) ? $saved : array();
192  }
$_SESSION["AccountId"]
+ 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 130 of file class.ilObjLanguageAccess.php.

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

131  {
132  // ref id must be given to prevent params being deleted by ilAdministrtionGUI
133  return "ilias.php"
134  . "?ref_id=" . self::_lookupLangFolderRefId()
135  . "&baseClass=ilAdministrationGUI"
136  . "&cmdClass=ilobjlanguageextgui"
137  . "&view_mode=translate"
138  . "&reset_offset=true";
139  }
+ 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 151 of file class.ilObjLanguageAccess.php.

References $_GET.

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

152  {
153  return (strtolower($_GET['cmdClass'] == 'ilobjlanguageextgui') and $_GET['view_mode'] == "translate");
154  }
$_GET["client_id"]
+ 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 111 of file class.ilObjLanguageAccess.php.

References $DIC, and $ilDB.

Referenced by ilObjLanguageExtGUI\__construct().

112  {
113  global $DIC;
114  $ilDB = $DIC->database();
115 
116  $q = "SELECT obj_id FROM object_data " .
117  " WHERE type = " . $ilDB->quote("lng", "text") .
118  " AND title = " . $ilDB->quote($a_key, "text");
119  $set = $ilDB->query($q);
120  $row = $ilDB->fetchAssoc($set);
121  return $row['obj_id'];
122  }
global $DIC
Definition: goto.php:24
global $ilDB
+ 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 92 of file class.ilObjLanguageAccess.php.

References $DIC, and $ilDB.

93  {
94  global $DIC;
95  $ilDB = $DIC->database();
96 
97  $q = "SELECT ref_id FROM object_reference r, object_data d" .
98  " WHERE r.obj_id = d.obj_id AND d.type = " . $ilDB->quote("lngf", "text");
99  $set = $ilDB->query($q);
100  $row = $ilDB->fetchAssoc($set);
101  return $row['ref_id'];
102  }
global $DIC
Definition: goto.php:24
global $ilDB

◆ _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 161 of file class.ilObjLanguageAccess.php.

References $_SESSION, $DIC, and $lng.

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

162  {
163  global $DIC;
164  $lng = $DIC->language();
165 
166  if (self::_checkTranslate() and !self::_isPageTranslation()) {
167  $_SESSION['lang_ext_maintenance']['used_modules'] = array_keys($lng->getUsedModules());
168  $_SESSION['lang_ext_maintenance']['used_topics'] = array_keys($lng->getUsedTopics());
169  }
170  }
$_SESSION["AccountId"]
$lng
global $DIC
Definition: goto.php:24
+ 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: