ILIAS
release_5-3 Revision v5.3.23-19-g915713cf615
◀ ilDoc Overview
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
$ilDB
;
46
47
$lang
=
''
;
48
$query
=
"SELECT language FROM il_meta_language "
.
49
"WHERE rbac_id = "
.
$ilDB
->quote($a_rbac_id,
'integer'
) .
" "
.
50
"AND obj_id = "
.
$ilDB
->quote($a_obj_id,
'integer'
) .
" "
.
51
"AND obj_type = "
.
$ilDB
->quote($a_obj_type,
'text'
) .
" "
.
52
"AND parent_type = 'meta_general' "
.
53
"ORDER BY meta_language_id "
;
54
$ilDB
->setLimit(1);
55
$res
=
$ilDB
->query(
$query
);
56
while
(
$row
=
$res
->fetchRow(
ilDBConstants::FETCHMODE_OBJECT
)) {
57
$lang
=
$row
->language;
58
}
59
return
$lang
;
60
}
61
62
// SET/GET
63
public
function
setLanguage
(&$lng_obj)
64
{
65
if
(is_object($lng_obj)) {
66
$this->language =&$lng_obj;
67
}
68
}
69
public
function
&
getLanguage
()
70
{
71
return
is_object($this->language) ? $this->language :
false
;
72
}
73
public
function
getLanguageCode
()
74
{
75
return
is_object($this->language) ? $this->language->getLanguageCode() :
false
;
76
}
77
78
public
function
save
()
79
{
80
global
$ilDB
;
81
82
$fields = $this->
__getFields
();
83
$fields[
'meta_language_id'
] = array(
'integer'
,$next_id =
$ilDB
->nextId(
'il_meta_language'
));
84
85
if
($this->db->insert(
'il_meta_language'
, $fields)) {
86
$this->
setMetaId
($next_id);
87
return
$this->
getMetaId
();
88
}
89
return
false
;
90
}
91
92
public
function
update
()
93
{
94
global
$ilDB
;
95
96
if
($this->
getMetaId
()) {
97
if
($this->db->update(
98
'il_meta_language'
,
99
$this->__getFields(),
100
array(
"meta_language_id"
=> array(
'integer'
,$this->
getMetaId
()))
101
)) {
102
return
true
;
103
}
104
}
105
return
false
;
106
}
107
108
public
function
delete
()
109
{
110
global
$ilDB
;
111
112
if
($this->
getMetaId
()) {
113
$query
=
"DELETE FROM il_meta_language "
.
114
"WHERE meta_language_id = "
. $ilDB->quote($this->
getMetaId
(),
'integer'
);
115
$res
= $ilDB->manipulate(
$query
);
116
117
return
true
;
118
}
119
return
false
;
120
}
121
122
123
public
function
__getFields
()
124
{
125
return
array(
'rbac_id'
=> array(
'integer'
,$this->
getRBACId
()),
126
'obj_id'
=> array(
'integer'
,$this->
getObjId
()),
127
'obj_type'
=> array(
'text'
,$this->
getObjType
()),
128
'parent_type'
=> array(
'text'
,$this->
getParentType
()),
129
'parent_id'
=> array(
'integer'
,$this->
getParentId
()),
130
'language'
=> array(
'text'
,$this->
getLanguageCode
()));
131
}
132
133
public
function
read
()
134
{
135
global
$ilDB
;
136
137
include_once
'Services/MetaData/classes/class.ilMDLanguageItem.php'
;
138
139
if
($this->
getMetaId
()) {
140
$query
=
"SELECT * FROM il_meta_language "
.
141
"WHERE meta_language_id = "
. $ilDB->quote($this->
getMetaId
(),
'integer'
);
142
143
$res
= $this->db->query(
$query
);
144
while
(
$row
=
$res
->fetchRow(
ilDBConstants::FETCHMODE_OBJECT
)) {
145
$this->
setRBACId
(
$row
->rbac_id);
146
$this->
setObjId
(
$row
->obj_id);
147
$this->
setObjType
(
$row
->obj_type);
148
$this->
setParentId
(
$row
->parent_id);
149
$this->
setParentType
(
$row
->parent_type);
150
$this->
setLanguage
(
new
ilMDLanguageItem
(
$row
->language));
151
}
152
}
153
return
true
;
154
}
155
156
/*
157
* XML Export of all meta data
158
* @param object (xml writer) see class.ilMD2XML.php
159
*
160
*/
161
public
function
toXML
(&$writer)
162
{
163
$writer->xmlElement(
164
'Language'
,
165
array(
'Language'
=> $this->
getLanguageCode
() ?
166
$this->
getLanguageCode
() :
167
'en'
),
168
$this->
getLanguage
()
169
);
170
}
171
172
173
// STATIC
174
public
static
function
_getIds
($a_rbac_id, $a_obj_id, $a_parent_id, $a_parent_type)
175
{
176
global
$ilDB
;
177
178
$query
=
"SELECT meta_language_id FROM il_meta_language "
.
179
"WHERE rbac_id = "
.
$ilDB
->quote($a_rbac_id,
'integer'
) .
" "
.
180
"AND obj_id = "
.
$ilDB
->quote($a_obj_id,
'integer'
) .
" "
.
181
"AND parent_id = "
.
$ilDB
->quote($a_parent_id,
'integer'
) .
" "
.
182
"AND parent_type = "
.
$ilDB
->quote($a_parent_type,
'text'
);
183
184
$res
=
$ilDB
->query(
$query
);
185
while
(
$row
=
$res
->fetchRow(
ilDBConstants::FETCHMODE_OBJECT
)) {
186
$ids[] =
$row
->meta_language_id;
187
}
188
return
$ids ? $ids : array();
189
}
190
}
$row
$row
Definition:
10autofilter-selection-1.php:74
php
An exception for terminatinating execution or to throw for unit testing.
ilDBConstants\FETCHMODE_OBJECT
const FETCHMODE_OBJECT
Definition:
class.ilDBConstants.php:13
ilMDBase
Definition:
class.ilMDBase.php:33
ilMDBase\getObjType
getObjType()
Definition:
class.ilMDBase.php:111
ilMDBase\getMetaId
getMetaId()
Definition:
class.ilMDBase.php:123
ilMDBase\setObjId
setObjId($a_id)
Definition:
class.ilMDBase.php:99
ilMDBase\setParentId
setParentId($a_id)
Definition:
class.ilMDBase.php:135
ilMDBase\setMetaId
setMetaId($a_meta_id, $a_read_data=true)
Definition:
class.ilMDBase.php:115
ilMDBase\getRBACId
getRBACId()
Definition:
class.ilMDBase.php:95
ilMDBase\getObjId
getObjId()
Definition:
class.ilMDBase.php:103
ilMDBase\setObjType
setObjType($a_type)
Definition:
class.ilMDBase.php:107
ilMDBase\getParentType
getParentType()
Definition:
class.ilMDBase.php:131
ilMDBase\getParentId
getParentId()
Definition:
class.ilMDBase.php:139
ilMDBase\setRBACId
setRBACId($a_id)
Definition:
class.ilMDBase.php:91
ilMDBase\setParentType
setParentType($a_parent_type)
Definition:
class.ilMDBase.php:127
ilMDLanguageItem
Definition:
class.ilMDLanguageItem.php:33
ilMDLanguage
Definition:
class.ilMDLanguage.php:34
ilMDLanguage\_lookupFirstLanguage
static _lookupFirstLanguage($a_rbac_id, $a_obj_id, $a_obj_type)
Lookup first language.
Definition:
class.ilMDLanguage.php:43
ilMDLanguage\setLanguage
setLanguage(&$lng_obj)
Definition:
class.ilMDLanguage.php:63
ilMDLanguage\toXML
toXML(&$writer)
Definition:
class.ilMDLanguage.php:161
ilMDLanguage\getLanguageCode
getLanguageCode()
Definition:
class.ilMDLanguage.php:73
ilMDLanguage\__getFields
__getFields()
Definition:
class.ilMDLanguage.php:123
ilMDLanguage\save
save()
Definition:
class.ilMDLanguage.php:78
ilMDLanguage\_getIds
static _getIds($a_rbac_id, $a_obj_id, $a_parent_id, $a_parent_type)
Definition:
class.ilMDLanguage.php:174
ilMDLanguage\read
read()
Definition:
class.ilMDLanguage.php:133
ilMDLanguage\update
update()
Definition:
class.ilMDLanguage.php:92
ilMDLanguage\getLanguage
& getLanguage()
Definition:
class.ilMDLanguage.php:69
$lang
$lang
Definition:
consent.php:3
$query
$query
Definition:
proxy_ylocal.php:13
$res
foreach($_POST as $key=> $value) $res
Definition:
save_question_post_data.php:15
$ilDB
global $ilDB
Definition:
storeScorm2004.php:19
Services
MetaData
classes
class.ilMDLanguage.php
Generated on Tue Sep 30 2025 19:01:16 for ILIAS by
1.9.4 (using
Doxyfile
)