ILIAS
release_5-4 Revision v5.4.26-12-gabc799a52e6
◀ ilDoc Overview
class.ilMDTaxonPath.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
ilMDTaxonPath
extends
ilMDBase
34
{
35
// METHODS OF CHILD OBJECTS (Taxon)
36
public
function
&
getTaxonIds
()
37
{
38
include_once
'Services/Migration/DBUpdate_5295/classes/class.ilMDTaxon.php'
;
39
40
return
ilMDTaxon::_getIds
($this->
getRBACId
(), $this->
getObjId
(), $this->
getMetaId
(),
'meta_taxon_path'
);
41
}
42
public
function
&
getTaxon
($a_taxon_id)
43
{
44
include_once
'Services/Migration/DBUpdate_5295/classes/class.ilMDTaxon.php'
;
45
46
if
(!$a_taxon_id) {
47
return
false
;
48
}
49
$tax =
new
ilMDTaxon
();
50
$tax->setMetaId($a_taxon_id);
51
52
return
$tax;
53
}
54
public
function
&
addTaxon
()
55
{
56
include_once
'Services/Migration/DBUpdate_5295/classes/class.ilMDTaxon.php'
;
57
58
$tax =
new
ilMDTaxon
($this->
getRBACId
(), $this->
getObjId
(), $this->
getObjType
());
59
$tax->setParentId($this->
getMetaId
());
60
$tax->setParentType(
'meta_taxon_path'
);
61
62
return
$tax;
63
}
64
65
// SET/GET
66
public
function
setSource
($a_source)
67
{
68
$this->source = $a_source;
69
}
70
public
function
getSource
()
71
{
72
return
$this->source
;
73
}
74
public
function
setSourceLanguage
(&$lng_obj)
75
{
76
if
(is_object($lng_obj)) {
77
$this->source_language = $lng_obj;
78
}
79
}
80
public
function
&
getSourceLanguage
()
81
{
82
return
is_object($this->source_language) ? $this->source_language :
false
;
83
}
84
public
function
getSourceLanguageCode
()
85
{
86
return
is_object($this->source_language) ? $this->source_language->getLanguageCode() :
false
;
87
}
88
89
90
public
function
save
()
91
{
92
global
$DIC
;
93
94
$ilDB
= $DIC[
'ilDB'
];
95
96
$fields = $this->
__getFields
();
97
$fields[
'meta_taxon_path_id'
] = array(
'integer'
,$next_id =
$ilDB
->nextId(
'il_meta_taxon_path'
));
98
99
if
($this->db->insert(
'il_meta_taxon_path'
, $fields)) {
100
$this->
setMetaId
($next_id);
101
return
$this->
getMetaId
();
102
}
103
return
false
;
104
}
105
106
public
function
update
()
107
{
108
global
$DIC
;
109
110
$ilDB
= $DIC[
'ilDB'
];
111
112
if
($this->
getMetaId
()) {
113
if
($this->db->update(
114
'il_meta_taxon_path'
,
115
$this->__getFields(),
116
array(
"meta_taxon_path_id"
=> array(
'integer'
,$this->
getMetaId
()))
117
)) {
118
return
true
;
119
}
120
}
121
return
false
;
122
}
123
124
public
function
delete
()
125
{
126
global
$DIC
;
127
128
$ilDB
= $DIC[
'ilDB'
];
129
130
if
($this->
getMetaId
()) {
131
$query
=
"DELETE FROM il_meta_taxon_path "
.
132
"WHERE meta_taxon_path_id = "
.
$ilDB
->quote($this->
getMetaId
(),
'integer'
);
133
$res
=
$ilDB
->manipulate(
$query
);
134
135
foreach
($this->
getTaxonIds
() as
$id
) {
136
$tax = $this->
getTaxon
($id);
137
$tax->delete();
138
}
139
140
return
true
;
141
}
142
return
false
;
143
}
144
145
146
public
function
__getFields
()
147
{
148
return
array(
'rbac_id'
=> array(
'integer'
,$this->
getRBACId
()),
149
'obj_id'
=> array(
'integer'
,$this->
getObjId
()),
150
'obj_type'
=> array(
'text'
,$this->
getObjType
()),
151
'parent_type'
=> array(
'text'
,$this->
getParentType
()),
152
'parent_id'
=> array(
'integer'
,$this->
getParentId
()),
153
'source'
=> array(
'text'
,$this->
getSource
()),
154
'source_language'
=> array(
'text'
,$this->
getSourceLanguageCode
()));
155
}
156
157
public
function
read
()
158
{
159
global
$DIC
;
160
161
$ilDB
= $DIC[
'ilDB'
];
162
163
include_once
'Services/Migration/DBUpdate_5295/classes/class.ilMDLanguageItem.php'
;
164
165
if
($this->
getMetaId
()) {
166
$query
=
"SELECT * FROM il_meta_taxon_path "
.
167
"WHERE meta_taxon_path_id = "
.
$ilDB
->quote($this->
getMetaId
(),
'integer'
);
168
169
$res
=
$ilDB
->query(
$query
);
170
while
(
$row
=
$res
->fetchRow(
ilDBConstants::FETCHMODE_OBJECT
)) {
171
$this->
setRBACId
(
$row
->rbac_id);
172
$this->
setObjId
(
$row
->obj_id);
173
$this->
setObjType
(
$row
->obj_type);
174
$this->
setParentId
(
$row
->parent_id);
175
$this->
setParentType
(
$row
->parent_type);
176
$this->
setSource
(
$row
->source);
177
$this->source_language =
new
ilMDLanguageItem
(
$row
->source_language);
178
}
179
}
180
return
true
;
181
}
182
183
/*
184
* XML Export of all meta data
185
* @param object (xml writer) see class.ilMD2XML.php
186
*
187
*/
188
public
function
toXML
(&$writer)
189
{
190
$writer->xmlStartTag(
'TaxonPath'
);
191
192
$writer->xmlElement(
193
'Source'
,
194
array(
'Language'
=> $this->
getSourceLanguageCode
()
195
? $this->
getSourceLanguageCode
()
196
:
'en'
),
197
$this->
getSource
()
198
);
199
200
// Taxon
201
$taxs = $this->
getTaxonIds
();
202
foreach
($taxs as
$id
) {
203
$tax = &$this->
getTaxon
($id);
204
$tax->toXML($writer);
205
}
206
if
(!count($taxs)) {
207
include_once
'Services/Migration/DBUpdate_5295/classes/class.ilMDTaxon.php'
;
208
$tax =
new
ilMDTaxon
($this->
getRBACId
(), $this->
getObjId
());
209
$tax->toXML($writer);
210
}
211
212
$writer->xmlEndTag(
'TaxonPath'
);
213
}
214
215
216
217
// STATIC
218
public
static
function
_getIds
($a_rbac_id, $a_obj_id, $a_parent_id, $a_parent_type)
219
{
220
global
$DIC
;
221
222
$ilDB
= $DIC[
'ilDB'
];
223
224
$query
=
"SELECT meta_taxon_path_id FROM il_meta_taxon_path "
.
225
"WHERE rbac_id = "
.
$ilDB
->quote($a_rbac_id,
'integer'
) .
" "
.
226
"AND obj_id = "
.
$ilDB
->quote($a_obj_id,
'integer'
) .
" "
.
227
"AND parent_id = "
.
$ilDB
->quote($a_parent_id,
'integer'
) .
" "
.
228
"AND parent_type = "
.
$ilDB
->quote($a_parent_type,
'text'
);
229
230
$res
=
$ilDB
->query(
$query
);
231
while
(
$row
=
$res
->fetchRow(
ilDBConstants::FETCHMODE_OBJECT
)) {
232
$ids[] =
$row
->meta_taxon_path_id;
233
}
234
return
$ids ? $ids : array();
235
}
236
}
ilMDBase\setObjType
setObjType($a_type)
Definition:
class.ilMDBase.php:109
ilMDTaxonPath
Definition:
class.ilMDTaxonPath.php:33
$DIC
global $DIC
Definition:
saml.php:7
ilMDTaxonPath\_getIds
static _getIds($a_rbac_id, $a_obj_id, $a_parent_id, $a_parent_type)
Definition:
class.ilMDTaxonPath.php:218
ilMDTaxonPath\save
save()
Definition:
class.ilMDTaxonPath.php:90
$id
if(!array_key_exists('StateId', $_REQUEST)) $id
Definition:
expirywarning.php:14
ilMDTaxonPath\update
update()
Definition:
class.ilMDTaxonPath.php:106
ilMDBase\getRBACId
getRBACId()
Definition:
class.ilMDBase.php:97
ilMDTaxonPath\addTaxon
& addTaxon()
Definition:
class.ilMDTaxonPath.php:54
ilMDTaxonPath\getSourceLanguage
& getSourceLanguage()
Definition:
class.ilMDTaxonPath.php:80
ilMDTaxonPath\setSource
setSource($a_source)
Definition:
class.ilMDTaxonPath.php:66
ilMDTaxonPath\getTaxon
& getTaxon($a_taxon_id)
Definition:
class.ilMDTaxonPath.php:42
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
ilMDTaxonPath\getSourceLanguageCode
getSourceLanguageCode()
Definition:
class.ilMDTaxonPath.php:84
ilMDBase\setRBACId
setRBACId($a_id)
Definition:
class.ilMDBase.php:93
ilMDTaxonPath\__getFields
__getFields()
Definition:
class.ilMDTaxonPath.php:146
ilMDTaxonPath\getSource
getSource()
Definition:
class.ilMDTaxonPath.php:70
$query
$query
Definition:
proxy_ylocal.php:13
ilMDTaxon
Definition:
class.ilMDTaxon.php:33
ilMDBase\setParentId
setParentId($a_id)
Definition:
class.ilMDBase.php:137
ilMDTaxonPath\setSourceLanguage
setSourceLanguage(&$lng_obj)
Definition:
class.ilMDTaxonPath.php:74
$row
$row
Definition:
migrateto20.php:360
ilMDBase\getMetaId
getMetaId()
Definition:
class.ilMDBase.php:125
ilMDTaxonPath\getTaxonIds
& getTaxonIds()
Definition:
class.ilMDTaxonPath.php:36
ilMDBase\getParentType
getParentType()
Definition:
class.ilMDBase.php:133
ilMDTaxon\_getIds
static _getIds($a_rbac_id, $a_obj_id, $a_parent_id, $a_parent_type)
Definition:
class.ilMDTaxon.php:180
ilMDBase\getObjId
getObjId()
Definition:
class.ilMDBase.php:105
ilMDTaxonPath\read
read()
Definition:
class.ilMDTaxonPath.php:157
$ilDB
global $ilDB
Definition:
storeScorm2004.php:16
ilMDBase\setParentType
setParentType($a_parent_type)
Definition:
class.ilMDBase.php:129
ilMDTaxonPath\toXML
toXML(&$writer)
Definition:
class.ilMDTaxonPath.php:188
php
ilMDBase\getObjType
getObjType()
Definition:
class.ilMDBase.php:113
ilDBConstants\FETCHMODE_OBJECT
const FETCHMODE_OBJECT
Definition:
class.ilDBConstants.php:13
$source
$source
Definition:
linkback.php:22
ilMDBase
Definition:
class.ilMDBase.php:32
ilMDBase\getParentId
getParentId()
Definition:
class.ilMDBase.php:141
Services
Migration
DBUpdate_5295
classes
class.ilMDTaxonPath.php
Generated on Thu Jan 30 2025 19:02:01 for ILIAS by
1.8.13 (using
Doxyfile
)