ILIAS  release_5-0 Revision 5.0.0-1144-gc4397b1f870
All Data Structures Namespaces Files Functions Variables Modules Pages
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 extended language maintenance must be turned on
  • The user must have read and write permissions to the language folder

static

Returns
boolean maintenance possible (true/false)

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

References $ilSetting, $ilUser, and $ref_id.

Referenced by ilObjLanguageExtGUI\executeCommand().

58  {
59  global $ilSetting, $ilUser, $rbacsystem;
60 
61  if (!$ilSetting->get("lang_ext_maintenance"))
62  {
63  return false;
64  }
65 
66  if ($ilUser->getId())
67  {
68  $ref_id = self::_lookupLangFolderRefId();
69  return $rbacsystem->checkAccess("read,write", (int) $ref_id);
70  }
71  return false;
72  }
global $ilUser
Definition: imgupload.php:15
$ref_id
Definition: sahs_server.php:39
global $ilSetting
Definition: privfeed.php:40
+ 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 extended language maintenance must be turned on
  • 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 30 of file class.ilObjLanguageAccess.php.

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

Referenced by ilTemplate\addILIASFooter().

31  {
32  global $lng, $ilSetting, $ilUser, $rbacsystem;
33 
34  if (!$ilSetting->get("lang_ext_maintenance")
35  or !$ilSetting->get("lang_translate_".$lng->getLangKey()))
36  {
37  return false;
38  }
39 
40  if ($ilUser->getId())
41  {
42  $ref_id = self::_lookupLangFolderRefId();
43  return $rbacsystem->checkAccess("read,write", (int) $ref_id);
44  }
45  return false;
46  }
global $ilUser
Definition: imgupload.php:15
$ref_id
Definition: sahs_server.php:39
global $ilSetting
Definition: privfeed.php:40
global $lng
Definition: privfeed.php:40
+ 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 158 of file class.ilObjLanguageAccess.php.

References $_SESSION.

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

159  {
160  $saved = $_SESSION['lang_ext_maintenance']['used_modules'];
161  return is_array($saved) ? $saved : array();
162  }
< a tabindex="-1" style="border-style: none;" href="#" title="Refresh Image" onclick="document.getElementById('siimage').src = './securimage_show.php?sid=' + Math.random(); this.blur(); return false">< img src="./images/refresh.png" alt="Reload Image" height="32" width="32" onclick="this.blur()" align="bottom" border="0"/></a >< br/>< strong > Enter Code *if($_SERVER['REQUEST_METHOD']=='POST' &&@ $_POST['do']=='contact') $_SESSION['ctform']['success']
+ 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 169 of file class.ilObjLanguageAccess.php.

References $_SESSION.

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

170  {
171  $saved = $_SESSION['lang_ext_maintenance']['used_topics'];
172  return is_array($saved) ? $saved : array();
173  }
< a tabindex="-1" style="border-style: none;" href="#" title="Refresh Image" onclick="document.getElementById('siimage').src = './securimage_show.php?sid=' + Math.random(); this.blur(); return false">< img src="./images/refresh.png" alt="Reload Image" height="32" width="32" onclick="this.blur()" align="bottom" border="0"/></a >< br/>< strong > Enter Code *if($_SERVER['REQUEST_METHOD']=='POST' &&@ $_POST['do']=='contact') $_SESSION['ctform']['success']
+ 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 116 of file class.ilObjLanguageAccess.php.

Referenced by ilTemplate\addILIASFooter().

117  {
118  // ref id must be given to prevent params being deleted by ilAdministrtionGUI
119  return "ilias.php"
120  ."?ref_id=".self::_lookupLangFolderRefId()
121  ."&baseClass=ilAdministrationGUI"
122  ."&cmdClass=ilobjlanguageextgui"
123  ."&view_mode=translate"
124  ."&reset_offset=true";
125  }
+ 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 137 of file class.ilObjLanguageAccess.php.

References $_GET.

Referenced by ilLanguageExtTableGUI\__construct(), ilObjLanguageExtGUI\addAdminLocatorItems(), ilTemplate\addILIASFooter(), ilObjLanguageExtGUI\getAdminTabs(), ilLanguageExtTableGUI\initFilter(), ilObjLanguageExtGUI\setTitleAndDescription(), and ilObjLanguageExtGUI\viewObject().

138  {
139  return (strtolower($_GET['cmdClass'] == 'ilobjlanguageextgui') and $_GET['view_mode'] == "translate");
140  }
$_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 98 of file class.ilObjLanguageAccess.php.

References $ilDB, and $row.

Referenced by ilObjLanguageExtGUI\ilObjLanguageExtGUI().

99  {
100  global $ilDB;
101 
102  $q = "SELECT obj_id FROM object_data ".
103  " WHERE type = ".$ilDB->quote("lng", "text").
104  " AND title = ".$ilDB->quote($a_key, "text");
105  $set = $ilDB->query($q);
106  $row = $ilDB->fetchAssoc($set);
107  return $row['obj_id'];
108  }
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 80 of file class.ilObjLanguageAccess.php.

References $ilDB, and $row.

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

◆ _saveUsages()

static ilObjLanguageAccess::_saveUsages ( )
static

Store the collected usages in the user session.

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

References $_SESSION, and $lng.

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

147  {
148  global $lng;
149  $_SESSION['lang_ext_maintenance']['used_modules'] = array_keys($lng->getUsedModules());
150  $_SESSION['lang_ext_maintenance']['used_topics'] = array_keys($lng->getUsedTopics());
151  }
< a tabindex="-1" style="border-style: none;" href="#" title="Refresh Image" onclick="document.getElementById('siimage').src = './securimage_show.php?sid=' + Math.random(); this.blur(); return false">< img src="./images/refresh.png" alt="Reload Image" height="32" width="32" onclick="this.blur()" align="bottom" border="0"/></a >< br/>< strong > Enter Code *if($_SERVER['REQUEST_METHOD']=='POST' &&@ $_POST['do']=='contact') $_SESSION['ctform']['success']
global $lng
Definition: privfeed.php:40
+ Here is the caller graph for this function:

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