ILIAS
release_5-4 Revision v5.4.26-12-gabc799a52e6
◀ ilDoc Overview
class.ilMDEntity.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
32
include_once
'class.ilMDBase.php'
;
33
34
class
ilMDEntity
extends
ilMDBase
35
{
36
// SET/GET
37
public
function
setEntity
($a_entity)
38
{
39
$this->entity = $a_entity;
40
}
41
public
function
getEntity
()
42
{
43
return
$this->entity;
44
}
45
46
public
function
save
()
47
{
48
global
$DIC
;
49
50
$ilDB
= $DIC[
'ilDB'
];
51
52
$fields = $this->
__getFields
();
53
$fields[
'meta_entity_id'
] = array(
'integer'
,$next_id =
$ilDB
->nextId(
'il_meta_entity'
));
54
55
if
($this->db->insert(
'il_meta_entity'
, $fields)) {
56
$this->
setMetaId
($next_id);
57
return
$this->
getMetaId
();
58
}
59
return
false
;
60
}
61
62
public
function
update
()
63
{
64
global
$DIC
;
65
66
$ilDB
= $DIC[
'ilDB'
];
67
68
if
($this->
getMetaId
()) {
69
if
($this->db->update(
70
'il_meta_entity'
,
71
$this->__getFields(),
72
array(
"meta_entity_id"
=> array(
'integer'
,$this->
getMetaId
()))
73
)) {
74
return
true
;
75
}
76
}
77
return
false
;
78
}
79
80
public
function
delete
()
81
{
82
global
$DIC
;
83
84
$ilDB
= $DIC[
'ilDB'
];
85
86
if
($this->
getMetaId
()) {
87
$query
=
"DELETE FROM il_meta_entity "
.
88
"WHERE meta_entity_id = "
.
$ilDB
->quote($this->
getMetaId
(),
'integer'
);
89
$res
=
$ilDB
->manipulate(
$query
);
90
91
$this->db->query(
$query
);
92
93
return
true
;
94
}
95
return
false
;
96
}
97
98
99
public
function
__getFields
()
100
{
101
return
array(
'rbac_id'
=> array(
'integer'
,$this->
getRBACId
()),
102
'obj_id'
=> array(
'integer'
,$this->
getObjId
()),
103
'obj_type'
=> array(
'text'
,$this->
getObjType
()),
104
'parent_type'
=> array(
'text'
,$this->
getParentType
()),
105
'parent_id'
=> array(
'integer'
,$this->
getParentId
()),
106
'entity'
=> array(
'text'
,$this->
getEntity
()));
107
}
108
109
public
function
read
()
110
{
111
global
$DIC
;
112
113
$ilDB
= $DIC[
'ilDB'
];
114
115
if
($this->
getMetaId
()) {
116
$query
=
"SELECT * FROM il_meta_entity "
.
117
"WHERE meta_entity_id = "
.
$ilDB
->quote($this->
getMetaId
(),
'integer'
);
118
119
$res
= $this->db->query(
$query
);
120
while
(
$row
=
$res
->fetchRow(
ilDBConstants::FETCHMODE_OBJECT
)) {
121
$this->
setRBACId
(
$row
->rbac_id);
122
$this->
setObjId
(
$row
->obj_id);
123
$this->
setObjType
(
$row
->obj_type);
124
$this->
setParentId
(
$row
->parent_id);
125
$this->
setParentType
(
$row
->parent_type);
126
$this->
setEntity
(
$row
->entity);
127
}
128
}
129
return
true
;
130
}
131
132
/*
133
* XML Export of all meta data
134
* @param object (xml writer) see class.ilMD2XML.php
135
*
136
*/
137
public
function
toXML
(&$writer)
138
{
139
$writer->xmlElement(
'Entity'
, null, $this->
getEntity
());
140
}
141
142
143
// STATIC
144
public
static
function
_getIds
($a_rbac_id, $a_obj_id, $a_parent_id, $a_parent_type)
145
{
146
global
$DIC
;
147
148
$ilDB
= $DIC[
'ilDB'
];
149
150
$query
=
"SELECT meta_entity_id FROM il_meta_entity "
.
151
"WHERE rbac_id = "
.
$ilDB
->quote($a_rbac_id,
'integer'
) .
" "
.
152
"AND obj_id = "
.
$ilDB
->quote($a_obj_id,
'integer'
) .
" "
.
153
"AND parent_id = "
.
$ilDB
->quote($a_parent_id,
'integer'
) .
" "
.
154
"AND parent_type = "
.
$ilDB
->quote($a_parent_type,
'text'
) .
" "
.
155
"ORDER BY meta_entity_id "
;
156
157
$res
=
$ilDB
->query(
$query
);
158
while
(
$row
=
$res
->fetchRow(
ilDBConstants::FETCHMODE_OBJECT
)) {
159
$ids[] =
$row
->meta_entity_id;
160
}
161
return
$ids ? $ids : array();
162
}
163
}
ilMDBase\setObjType
setObjType($a_type)
Definition:
class.ilMDBase.php:109
$DIC
global $DIC
Definition:
saml.php:7
ilMDEntity\update
update()
Definition:
class.ilMDEntity.php:62
ilMDEntity\toXML
toXML(&$writer)
Definition:
class.ilMDEntity.php:137
ilMDEntity\read
read()
Definition:
class.ilMDEntity.php:109
ilMDEntity\_getIds
static _getIds($a_rbac_id, $a_obj_id, $a_parent_id, $a_parent_type)
Definition:
class.ilMDEntity.php:144
ilMDEntity\getEntity
getEntity()
Definition:
class.ilMDEntity.php:41
ilMDBase\getRBACId
getRBACId()
Definition:
class.ilMDBase.php:97
ilMDEntity\save
save()
Definition:
class.ilMDEntity.php:46
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
ilMDEntity
Definition:
class.ilMDEntity.php:34
ilMDBase\setObjId
setObjId($a_id)
Definition:
class.ilMDBase.php:101
ilMDBase\setRBACId
setRBACId($a_id)
Definition:
class.ilMDBase.php:93
$query
$query
Definition:
proxy_ylocal.php:13
ilMDBase\setParentId
setParentId($a_id)
Definition:
class.ilMDBase.php:137
$row
$row
Definition:
migrateto20.php:360
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
ilMDBase\setParentType
setParentType($a_parent_type)
Definition:
class.ilMDBase.php:129
php
ilMDBase\getObjType
getObjType()
Definition:
class.ilMDBase.php:113
ilDBConstants\FETCHMODE_OBJECT
const FETCHMODE_OBJECT
Definition:
class.ilDBConstants.php:13
ilMDBase
Definition:
class.ilMDBase.php:32
ilMDEntity\setEntity
setEntity($a_entity)
Definition:
class.ilMDEntity.php:37
ilMDBase\getParentId
getParentId()
Definition:
class.ilMDBase.php:141
ilMDEntity\__getFields
__getFields()
Definition:
class.ilMDEntity.php:99
Services
MetaData
classes
class.ilMDEntity.php
Generated on Thu Jan 30 2025 19:02:01 for ILIAS by
1.8.13 (using
Doxyfile
)