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
{
35
// SET/GET
36
public
function
setLanguage
(&$lng_obj)
37
{
38
if
(is_object($lng_obj)) {
39
$this->language =&$lng_obj;
40
}
41
}
42
public
function
&
getLanguage
()
43
{
44
return
is_object($this->language) ? $this->language :
false
;
45
}
46
public
function
getLanguageCode
()
47
{
48
return
is_object($this->language) ? $this->language->getLanguageCode() :
false
;
49
}
50
51
public
function
save
()
52
{
53
if
($this->db->autoExecute(
54
'il_meta_language'
,
55
$this->__getFields(),
56
ilDBConstants::MDB2_AUTOQUERY_INSERT
57
)) {
58
$this->
setMetaId
($this->db->getLastInsertId());
59
60
return
$this->
getMetaId
();
61
}
62
return
false
;
63
}
64
65
public
function
update
()
66
{
67
global
$ilDB
;
68
69
if
($this->
getMetaId
()) {
70
if
($this->db->autoExecute(
71
'il_meta_language'
,
72
$this->__getFields(),
73
ilDBConstants::MDB2_AUTOQUERY_UPDATE
,
74
"meta_language_id = "
. $ilDB->quote($this->
getMetaId
())
75
)) {
76
return
true
;
77
}
78
}
79
return
false
;
80
}
81
82
public
function
delete
()
83
{
84
global
$ilDB
;
85
86
if
($this->
getMetaId
()) {
87
$query
=
"DELETE FROM il_meta_language "
.
88
"WHERE meta_language_id = "
. $ilDB->quote($this->
getMetaId
());
89
90
$this->db->query(
$query
);
91
92
return
true
;
93
}
94
return
false
;
95
}
96
97
98
public
function
__getFields
()
99
{
100
return
array
(
'rbac_id'
=> $this->
getRBACId
(),
101
'obj_id'
=> $this->
getObjId
(),
102
'obj_type'
=>
ilUtil::prepareDBString
($this->
getObjType
()),
103
'parent_type'
=> $this->
getParentType
(),
104
'parent_id'
=> $this->
getParentId
(),
105
'language'
=>
ilUtil::prepareDBString
($this->
getLanguageCode
()));
106
}
107
108
public
function
read
()
109
{
110
global
$ilDB
;
111
112
include_once
'Services/Migration/DBUpdate_426/classes/class.ilMDLanguageItem.php'
;
113
114
if
($this->
getMetaId
()) {
115
$query
=
"SELECT * FROM il_meta_language "
.
116
"WHERE meta_language_id = "
. $ilDB->quote($this->
getMetaId
());
117
118
$res
= $this->db->query(
$query
);
119
while
(
$row
=
$res
->fetchRow(
ilDBConstants::FETCHMODE_OBJECT
)) {
120
$this->
setRBACId
(
$row
->rbac_id);
121
$this->
setObjId
(
$row
->obj_id);
122
$this->
setObjType
(
$row
->obj_type);
123
$this->
setParentId
(
$row
->parent_id);
124
$this->
setParentType
(
$row
->parent_type);
125
$this->
setLanguage
(
new
ilMDLanguageItem
(
$row
->language));
126
}
127
}
128
return
true
;
129
}
130
131
/*
132
* XML Export of all meta data
133
* @param object (xml writer) see class.ilMD2XML.php
134
*
135
*/
136
public
function
toXML
(&$writer)
137
{
138
$writer->xmlElement(
'Language'
,
array
(
'Language'
=> $this->
getLanguageCode
()), $this->
getLanguage
());
139
}
140
141
142
// STATIC
143
public
function
_getIds
($a_rbac_id, $a_obj_id, $a_parent_id, $a_parent_type)
144
{
145
global
$ilDB
;
146
147
$query
=
"SELECT meta_language_id FROM il_meta_language "
.
148
"WHERE rbac_id = "
. $ilDB->quote($a_rbac_id) .
" "
.
149
"AND obj_id = "
. $ilDB->quote($a_obj_id) .
" "
.
150
"AND parent_id = "
. $ilDB->quote($a_parent_id) .
" "
.
151
"AND parent_type = "
. $ilDB->quote($a_parent_type);
152
153
$res
= $ilDB->query(
$query
);
154
while
(
$row
=
$res
->fetchRow(
ilDBConstants::FETCHMODE_OBJECT
)) {
155
$ids[] =
$row
->meta_language_id;
156
}
157
return
$ids ? $ids :
array
();
158
}
159
}
ilMDLanguage\save
save()
Definition:
class.ilMDLanguage.php:51
ilMDLanguage\read
read()
Definition:
class.ilMDLanguage.php:108
ilMDBase\setObjType
setObjType($a_type)
Definition:
class.ilMDBase.php:107
ilMDLanguage\setLanguage
setLanguage(&$lng_obj)
Definition:
class.ilMDLanguage.php:36
ilMDBase\getRBACId
getRBACId()
Definition:
class.ilMDBase.php:95
ilMDLanguage\update
update()
Definition:
class.ilMDLanguage.php:65
ilDBConstants\MDB2_AUTOQUERY_UPDATE
const MDB2_AUTOQUERY_UPDATE
Definition:
class.ilDBConstants.php:60
ilMDBase\setMetaId
setMetaId($a_meta_id, $a_read_data=true)
Definition:
class.ilMDBase.php:115
$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:99
ilMDBase\setRBACId
setRBACId($a_id)
Definition:
class.ilMDBase.php:91
$query
$query
Definition:
proxy_ylocal.php:13
ilMDLanguage\toXML
toXML(&$writer)
Definition:
class.ilMDLanguage.php:136
ilMDLanguage\getLanguage
& getLanguage()
Definition:
class.ilMDLanguage.php:42
ilMDLanguage
Definition:
class.ilMDLanguage.php:33
array
Create styles array
The data for the language used.
Definition:
40duplicateStyle.php:19
ilMDBase\setParentId
setParentId($a_id)
Definition:
class.ilMDBase.php:135
ilMDLanguage\_getIds
_getIds($a_rbac_id, $a_obj_id, $a_parent_id, $a_parent_type)
Definition:
class.ilMDLanguage.php:143
ilMDBase\getMetaId
getMetaId()
Definition:
class.ilMDBase.php:123
ilMDBase\getParentType
getParentType()
Definition:
class.ilMDBase.php:131
ilMDBase\getObjId
getObjId()
Definition:
class.ilMDBase.php:103
ilUtil\prepareDBString
static prepareDBString($a_str)
prepare a string for db writing (insert/update)
Definition:
class.ilUtil.php:2906
$ilDB
global $ilDB
Definition:
storeScorm2004.php:16
ilMDLanguage\getLanguageCode
getLanguageCode()
Definition:
class.ilMDLanguage.php:46
ilDBConstants\MDB2_AUTOQUERY_INSERT
const MDB2_AUTOQUERY_INSERT
Definition:
class.ilDBConstants.php:59
ilMDLanguage\__getFields
__getFields()
Definition:
class.ilMDLanguage.php:98
ilMDBase\setParentType
setParentType($a_parent_type)
Definition:
class.ilMDBase.php:127
ilMDBase\getObjType
getObjType()
Definition:
class.ilMDBase.php:111
ilDBConstants\FETCHMODE_OBJECT
const FETCHMODE_OBJECT
Definition:
class.ilDBConstants.php:13
$row
$row
Definition:
10autofilter-selection-1.php:74
ilMDBase
Definition:
class.ilMDBase.php:32
ilMDBase\getParentId
getParentId()
Definition:
class.ilMDBase.php:139
Services
Migration
DBUpdate_426
classes
class.ilMDLanguage.php
Generated on Sat Jan 18 2025 19:01:34 for ILIAS by
1.8.13 (using
Doxyfile
)