ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
class.ilObjLanguageAccess.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (c) 1998-20014 ILIAS open source, Extended GPL, see docs/LICENSE */
3 
18 {
29  public static function _checkTranslate()
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()) {
38  $ref_id = self::_lookupLangFolderRefId();
39  return $rbacsystem->checkAccess("read,write", (int) $ref_id);
40  }
41  return false;
42  }
43 
44 
52  public static function _checkMaintenance()
53  {
54  global $ilSetting, $ilUser, $rbacsystem;
55 
56  if ($ilUser->getId()) {
57  $ref_id = self::_lookupLangFolderRefId();
58  return $rbacsystem->checkAccess("read,write", (int) $ref_id);
59  }
60  return false;
61  }
62 
63 
69  public static function _lookupLangFolderRefId()
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  }
79 
80 
87  public static function _lookupId($a_key)
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  }
98 
99 
105  public static function _getTranslationLink()
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  }
115 
126  public static function _isPageTranslation()
127  {
128  return (strtolower($_GET['cmdClass'] == 'ilobjlanguageextgui') and $_GET['view_mode'] == "translate");
129  }
130 
131 
135  public static function _saveUsages()
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  }
141 
147  public static function _getSavedModules()
148  {
149  $saved = $_SESSION['lang_ext_maintenance']['used_modules'];
150  return is_array($saved) ? $saved : array();
151  }
152 
158  public static function _getSavedTopics()
159  {
160  $saved = $_SESSION['lang_ext_maintenance']['used_topics'];
161  return is_array($saved) ? $saved : array();
162  }
163 }
$_SESSION["AccountId"]
static _isPageTranslation()
Check if the current request is a page translation.
$_GET["client_id"]
static _getSavedModules()
Get the stored modules from the user session.
static _checkMaintenance()
Permission check for language maintenance (import/export)
static _lookupId($a_key)
Lookup the object ID for a language key.
static _getTranslationLink()
Get the link to translate the current page.
$ilUser
Definition: imgupload.php:18
static _lookupLangFolderRefId()
Lookup the ref_id of the global language folder.
static _getSavedTopics()
Get the stored topics from the user session.
Create styles array
The data for the language used.
global $ilSetting
Definition: privfeed.php:17
global $lng
Definition: privfeed.php:17
global $ilDB
static _saveUsages()
Store the collected usages in the user session.
static _checkTranslate()
Permission check for translations.