ILIAS
release_7 Revision v7.30-3-g800a261c036
◀ ilDoc Overview
Main Page
Related Pages
Modules
+
Namespaces
Namespace List
+
Namespace Members
+
All
$
_
a
b
c
d
e
f
g
h
i
j
l
m
p
r
s
t
w
+
Functions
_
a
b
c
f
g
h
i
r
s
t
w
+
Variables
$
c
d
e
f
g
h
j
l
m
p
s
t
+
Data Structures
Data Structures
Data Structure Index
Class Hierarchy
+
Data Fields
+
All
$
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
+
Functions
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
+
Variables
$
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
+
Files
File List
+
Globals
+
All
$
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
z
+
Functions
_
a
b
c
d
e
f
g
h
i
l
m
n
o
p
r
s
t
u
v
w
x
+
Variables
$
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
z
Examples
•
All
Data Structures
Namespaces
Files
Functions
Variables
Modules
Pages
class.ilMDLanguage.php
Go to the documentation of this file.
1
<?php
2
/*
3
+-----------------------------------------------------------------------------+
4
| ILIAS open source |
5
+-----------------------------------------------------------------------------+
6
| Copyright (c) 1998-2001 ILIAS open source, University of Cologne |
7
| |
8
| This program is free software; you can redistribute it and/or |
9
| modify it under the terms of the GNU General Public License |
10
| as published by the Free Software Foundation; either version 2 |
11
| of the License, or (at your option) any later version. |
12
| |
13
| This program is distributed in the hope that it will be useful, |
14
| but WITHOUT ANY WARRANTY; without even the implied warranty of |
15
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
16
| GNU General Public License for more details. |
17
| |
18
| You should have received a copy of the GNU General Public License |
19
| along with this program; if not, write to the Free Software |
20
| Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
21
+-----------------------------------------------------------------------------+
22
*/
23
24
31
include_once
'class.ilMDBase.php'
;
32
33
class
ilMDLanguage
extends
ilMDBase
34
{
43
public
static
function
_lookupFirstLanguage
($a_rbac_id, $a_obj_id, $a_obj_type)
44
{
45
global
$DIC
;
46
47
$ilDB
= $DIC[
'ilDB'
];
48
49
$lang
=
''
;
50
$query
=
"SELECT language FROM il_meta_language "
.
51
"WHERE rbac_id = "
.
$ilDB
->quote($a_rbac_id,
'integer'
) .
" "
.
52
"AND obj_id = "
.
$ilDB
->quote($a_obj_id,
'integer'
) .
" "
.
53
"AND obj_type = "
.
$ilDB
->quote($a_obj_type,
'text'
) .
" "
.
54
"AND parent_type = 'meta_general' "
.
55
"ORDER BY meta_language_id "
;
56
$ilDB
->setLimit(1);
57
$res
=
$ilDB
->query(
$query
);
58
while
($row =
$res
->fetchRow(
ilDBConstants::FETCHMODE_OBJECT
)) {
59
$lang
= $row->language;
60
}
61
return
$lang
;
62
}
63
64
// SET/GET
65
public
function
setLanguage
(&$lng_obj)
66
{
67
if
(is_object($lng_obj)) {
68
$this->
language
= &$lng_obj;
69
}
70
}
71
public
function
&
getLanguage
()
72
{
73
return
is_object($this->
language
) ? $this->
language
:
false
;
74
}
75
public
function
getLanguageCode
()
76
{
77
return
is_object($this->
language
) ? $this->
language
->getLanguageCode() :
false
;
78
}
79
80
public
function
save
()
81
{
82
global
$DIC
;
83
84
$ilDB
= $DIC[
'ilDB'
];
85
86
$fields = $this->
__getFields
();
87
$fields[
'meta_language_id'
] = array(
'integer'
,$next_id =
$ilDB
->nextId(
'il_meta_language'
));
88
if
($this->db->insert(
'il_meta_language'
, $fields)) {
89
$this->
setMetaId
($next_id);
90
return
$this->
getMetaId
();
91
}
92
return
false
;
93
}
94
95
public
function
update
()
96
{
97
global
$DIC
;
98
99
$ilDB
= $DIC[
'ilDB'
];
100
101
if
($this->
getMetaId
()) {
102
if
($this->db->update(
103
'il_meta_language'
,
104
$this->__getFields(),
105
array(
"meta_language_id"
=> array(
'integer'
,$this->
getMetaId
()))
106
)) {
107
return
true
;
108
}
109
}
110
return
false
;
111
}
112
113
public
function
delete
()
114
{
115
global
$DIC
;
116
117
$ilDB
= $DIC[
'ilDB'
];
118
119
if
($this->
getMetaId
()) {
120
$query
=
"DELETE FROM il_meta_language "
.
121
"WHERE meta_language_id = "
.
$ilDB
->quote($this->
getMetaId
(),
'integer'
);
122
$res
=
$ilDB
->manipulate(
$query
);
123
124
return
true
;
125
}
126
return
false
;
127
}
128
129
130
public
function
__getFields
()
131
{
132
return
array(
'rbac_id'
=> array(
'integer'
,$this->
getRBACId
()),
133
'obj_id'
=> array(
'integer'
,$this->
getObjId
()),
134
'obj_type'
=> array(
'text'
,$this->
getObjType
()),
135
'parent_type'
=> array(
'text'
,$this->
getParentType
()),
136
'parent_id'
=> array(
'integer'
,$this->
getParentId
()),
137
'language'
=> array(
'text'
,$this->
getLanguageCode
()));
138
}
139
140
public
function
read
()
141
{
142
global
$DIC
;
143
144
$ilDB
= $DIC[
'ilDB'
];
145
146
include_once
'Services/MetaData/classes/class.ilMDLanguageItem.php'
;
147
148
if
($this->
getMetaId
()) {
149
$query
=
"SELECT * FROM il_meta_language "
.
150
"WHERE meta_language_id = "
.
$ilDB
->quote($this->
getMetaId
(),
'integer'
);
151
152
$res
= $this->db->query(
$query
);
153
while
($row =
$res
->fetchRow(
ilDBConstants::FETCHMODE_OBJECT
)) {
154
$this->
setRBACId
($row->rbac_id);
155
$this->
setObjId
($row->obj_id);
156
$this->
setObjType
($row->obj_type);
157
$this->
setParentId
($row->parent_id);
158
$this->
setParentType
($row->parent_type);
159
$this->
setLanguage
(
new
ilMDLanguageItem
($row->language));
160
}
161
}
162
return
true
;
163
}
164
165
/*
166
* XML Export of all meta data
167
* @param object (xml writer) see class.ilMD2XML.php
168
*
169
*/
170
public
function
toXML
(&$writer)
171
{
172
$writer->xmlElement(
173
'Language'
,
174
array(
'Language'
=> $this->
getLanguageCode
() ?
175
$this->
getLanguageCode
() :
176
'en'
),
177
$this->
getLanguage
()
178
);
179
}
180
181
182
// STATIC
183
public
static
function
_getIds
($a_rbac_id, $a_obj_id, $a_parent_id, $a_parent_type)
184
{
185
global
$DIC
;
186
187
$ilDB
= $DIC[
'ilDB'
];
188
189
$query
=
"SELECT meta_language_id FROM il_meta_language "
.
190
"WHERE rbac_id = "
.
$ilDB
->quote($a_rbac_id,
'integer'
) .
" "
.
191
"AND obj_id = "
.
$ilDB
->quote($a_obj_id,
'integer'
) .
" "
.
192
"AND parent_id = "
.
$ilDB
->quote($a_parent_id,
'integer'
) .
" "
.
193
"AND parent_type = "
.
$ilDB
->quote($a_parent_type,
'text'
);
194
195
$res
=
$ilDB
->query(
$query
);
196
while
($row =
$res
->fetchRow(
ilDBConstants::FETCHMODE_OBJECT
)) {
197
$ids[] = $row->meta_language_id;
198
}
199
return
$ids ? $ids : array();
200
}
201
}
ilMDLanguage\save
save()
Definition:
class.ilMDLanguage.php:80
ilMDLanguage\_getIds
static _getIds($a_rbac_id, $a_obj_id, $a_parent_id, $a_parent_type)
Definition:
class.ilMDLanguage.php:183
ilMDLanguage\read
read()
Definition:
class.ilMDLanguage.php:140
ilMDBase\setObjType
setObjType($a_type)
Definition:
class.ilMDBase.php:109
ilMDLanguage\setLanguage
setLanguage(&$lng_obj)
Definition:
class.ilMDLanguage.php:65
ilMDLanguage\_lookupFirstLanguage
static _lookupFirstLanguage($a_rbac_id, $a_obj_id, $a_obj_type)
Lookup first language.
Definition:
class.ilMDLanguage.php:43
ilMDBase\getRBACId
getRBACId()
Definition:
class.ilMDBase.php:97
ilMDLanguage\update
update()
Definition:
class.ilMDLanguage.php:95
ilMDBase\setMetaId
setMetaId($a_meta_id, $a_read_data=true)
Definition:
class.ilMDBase.php:117
$res
foreach($_POST as $key=> $value) $res
Definition:
save_question_post_data.php:15
ilMDLanguageItem
Definition:
class.ilMDLanguageItem.php:32
ilMDBase\setObjId
setObjId($a_id)
Definition:
class.ilMDBase.php:101
$DIC
global $DIC
Definition:
goto.php:24
ilMDBase\setRBACId
setRBACId($a_id)
Definition:
class.ilMDBase.php:93
$query
$query
Definition:
proxy_ylocal.php:13
ilMDLanguage\toXML
toXML(&$writer)
Definition:
class.ilMDLanguage.php:170
ilMDLanguage\getLanguage
& getLanguage()
Definition:
class.ilMDLanguage.php:71
ilMDLanguage
Definition:
class.ilMDLanguage.php:33
ilMDBase\setParentId
setParentId($a_id)
Definition:
class.ilMDBase.php:137
$lang
$lang
Definition:
xapiexit.php:8
ilMDBase\getMetaId
getMetaId()
Definition:
class.ilMDBase.php:125
ilMDBase\getParentType
getParentType()
Definition:
class.ilMDBase.php:133
ilMDBase\getObjId
getObjId()
Definition:
class.ilMDBase.php:105
$ilDB
global $ilDB
Definition:
storeScorm2004.php:16
ilMDLanguage\getLanguageCode
getLanguageCode()
Definition:
class.ilMDLanguage.php:75
ilMDLanguage\__getFields
__getFields()
Definition:
class.ilMDLanguage.php:130
ilMDBase\setParentType
setParentType($a_parent_type)
Definition:
class.ilMDBase.php:129
ilMDBase\getObjType
getObjType()
Definition:
class.ilMDBase.php:113
ilDBConstants\FETCHMODE_OBJECT
const FETCHMODE_OBJECT
Definition:
class.ilDBConstants.php:11
language
language()
Definition:
language.php:2
ilMDBase
Definition:
class.ilMDBase.php:32
ilMDBase\getParentId
getParentId()
Definition:
class.ilMDBase.php:141
Services
MetaData
classes
class.ilMDLanguage.php
Generated on Sat Apr 5 2025 21:01:33 for ILIAS by
1.8.13 (using
Doxyfile
)