ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
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 static function _checkTranslate()
30 {
31 global $lng, $ilSetting, $ilUser, $rbacsystem;
32
33 if (!$ilSetting->get("lang_translate_".$lng->getLangKey()))
34 {
35 return false;
36 }
37
38 if ($ilUser->getId())
39 {
41 return $rbacsystem->checkAccess("read,write", (int) $ref_id);
42 }
43 return false;
44 }
45
46
54 static function _checkMaintenance()
55 {
56 global $ilSetting, $ilUser, $rbacsystem;
57
58 if ($ilUser->getId())
59 {
61 return $rbacsystem->checkAccess("read,write", (int) $ref_id);
62 }
63 return false;
64 }
65
66
72 static function _lookupLangFolderRefId()
73 {
74 global $ilDB;
75
76 $q = "SELECT ref_id FROM object_reference r, object_data d".
77 " WHERE r.obj_id = d.obj_id AND d.type = ".$ilDB->quote("lngf", "text");
78 $set = $ilDB->query($q);
79 $row = $ilDB->fetchAssoc($set);
80 return $row['ref_id'];
81 }
82
83
90 static function _lookupId($a_key)
91 {
92 global $ilDB;
93
94 $q = "SELECT obj_id FROM object_data ".
95 " WHERE type = ".$ilDB->quote("lng", "text").
96 " AND title = ".$ilDB->quote($a_key, "text");
97 $set = $ilDB->query($q);
98 $row = $ilDB->fetchAssoc($set);
99 return $row['obj_id'];
100 }
101
102
108 static function _getTranslationLink()
109 {
110 // ref id must be given to prevent params being deleted by ilAdministrtionGUI
111 return "ilias.php"
112 ."?ref_id=".self::_lookupLangFolderRefId()
113 ."&baseClass=ilAdministrationGUI"
114 ."&cmdClass=ilobjlanguageextgui"
115 ."&view_mode=translate"
116 ."&reset_offset=true";
117 }
118
129 public static function _isPageTranslation()
130 {
131 return (strtolower($_GET['cmdClass'] == 'ilobjlanguageextgui') and $_GET['view_mode'] == "translate");
132 }
133
134
138 static function _saveUsages()
139 {
140 global $lng;
141 $_SESSION['lang_ext_maintenance']['used_modules'] = array_keys($lng->getUsedModules());
142 $_SESSION['lang_ext_maintenance']['used_topics'] = array_keys($lng->getUsedTopics());
143 }
144
150 static function _getSavedModules()
151 {
152 $saved = $_SESSION['lang_ext_maintenance']['used_modules'];
153 return is_array($saved) ? $saved : array();
154 }
155
161 static function _getSavedTopics()
162 {
163 $saved = $_SESSION['lang_ext_maintenance']['used_topics'];
164 return is_array($saved) ? $saved : array();
165 }
166
167}
168
169?>
$_GET["client_id"]
$_SESSION["AccountId"]
An exception for terminatinating execution or to throw for unit testing.
static _getSavedTopics()
Get the stored topics from the user session.
static _lookupId($a_key)
Lookup the object ID for a language key.
static _getSavedModules()
Get the stored modules from the user session.
static _saveUsages()
Store the collected usages in the user session.
static _checkMaintenance()
Permission check for language maintenance (import/export)
static _lookupLangFolderRefId()
Lookup the ref_id of the global language folder.
static _checkTranslate()
Permission check for translations.
static _isPageTranslation()
Check if the current request is a page translation.
static _getTranslationLink()
Get the link to translate the current page.
global $lng
Definition: privfeed.php:17
global $ilSetting
Definition: privfeed.php:17
$ref_id
Definition: sahs_server.php:39
global $ilDB
$ilUser
Definition: imgupload.php:18