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
if
($this->db->autoExecute(
49
'il_meta_entity'
,
50
$this->__getFields(),
51
ilDBConstants::AUTOQUERY_INSERT
52
)) {
53
$this->
setMetaId
($this->db->getLastInsertId());
54
55
return
$this->
getMetaId
();
56
}
57
return
false
;
58
}
59
60
public
function
update
()
61
{
62
global
$ilDB
;
63
64
if
($this->
getMetaId
()) {
65
if
($this->db->autoExecute(
66
'il_meta_entity'
,
67
$this->__getFields(),
68
ilDBConstants::AUTOQUERY_UPDATE
,
69
"meta_entity_id = "
. $ilDB->quote($this->
getMetaId
())
70
)) {
71
return
true
;
72
}
73
}
74
return
false
;
75
}
76
77
public
function
delete
()
78
{
79
global
$ilDB
;
80
81
if
($this->
getMetaId
()) {
82
$query
=
"DELETE FROM il_meta_entity "
.
83
"WHERE meta_entity_id = "
. $ilDB->quote($this->
getMetaId
());
84
85
$this->db->query(
$query
);
86
87
return
true
;
88
}
89
return
false
;
90
}
91
92
93
public
function
__getFields
()
94
{
95
return
array(
'rbac_id'
=> $this->
getRBACId
(),
96
'obj_id'
=> $this->
getObjId
(),
97
'obj_type'
=>
ilUtil::prepareDBString
($this->
getObjType
()),
98
'parent_type'
=> $this->
getParentType
(),
99
'parent_id'
=> $this->
getParentId
(),
100
'entity'
=>
ilUtil::prepareDBString
($this->
getEntity
()));
101
}
102
103
public
function
read
()
104
{
105
global
$ilDB
;
106
107
if
($this->
getMetaId
()) {
108
$query
=
"SELECT * FROM il_meta_entity "
.
109
"WHERE meta_entity_id = "
. $ilDB->quote($this->
getMetaId
());
110
111
$res
= $this->db->query(
$query
);
112
while
(
$row
=
$res
->fetchRow(
ilDBConstants::FETCHMODE_OBJECT
)) {
113
$this->
setRBACId
(
$row
->rbac_id);
114
$this->
setObjId
(
$row
->obj_id);
115
$this->
setObjType
(
$row
->obj_type);
116
$this->
setParentId
(
$row
->parent_id);
117
$this->
setParentType
(
$row
->parent_type);
118
$this->
setEntity
(
ilUtil::stripSlashes
(
$row
->entity));
119
}
120
}
121
return
true
;
122
}
123
124
/*
125
* XML Export of all meta data
126
* @param object (xml writer) see class.ilMD2XML.php
127
*
128
*/
129
public
function
toXML
(&$writer)
130
{
131
$writer->xmlElement(
'Entity'
, null, $this->
getEntity
());
132
}
133
134
135
// STATIC
136
public
function
_getIds
($a_rbac_id, $a_obj_id, $a_parent_id, $a_parent_type)
137
{
138
global
$ilDB
;
139
140
$query
=
"SELECT meta_entity_id FROM il_meta_entity "
.
141
"WHERE rbac_id = "
. $ilDB->quote($a_rbac_id) .
" "
.
142
"AND obj_id = "
. $ilDB->quote($a_obj_id) .
" "
.
143
"AND parent_id = "
. $ilDB->quote($a_parent_id) .
" "
.
144
"AND parent_type = "
. $ilDB->quote($a_parent_type);
145
146
$res
= $ilDB->query(
$query
);
147
while
(
$row
=
$res
->fetchRow(
ilDBConstants::FETCHMODE_OBJECT
)) {
148
$ids[] =
$row
->meta_entity_id;
149
}
150
return
$ids ? $ids : array();
151
}
152
}
ilMDBase\setObjType
setObjType($a_type)
Definition:
class.ilMDBase.php:109
ilMDEntity\update
update()
Definition:
class.ilMDEntity.php:60
ilMDEntity\toXML
toXML(&$writer)
Definition:
class.ilMDEntity.php:129
ilMDEntity\read
read()
Definition:
class.ilMDEntity.php:103
ilDBConstants\AUTOQUERY_INSERT
const AUTOQUERY_INSERT
Definition:
class.ilDBConstants.php:57
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
ilMDEntity\_getIds
_getIds($a_rbac_id, $a_obj_id, $a_parent_id, $a_parent_type)
Definition:
class.ilMDEntity.php:136
ilMDBase\setRBACId
setRBACId($a_id)
Definition:
class.ilMDBase.php:93
$query
$query
Definition:
proxy_ylocal.php:13
ilUtil\stripSlashes
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
Definition:
class.ilUtil.php:2406
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
ilUtil\prepareDBString
static prepareDBString($a_str)
prepare a string for db writing (insert/update)
Definition:
class.ilUtil.php:2871
$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
ilDBConstants\AUTOQUERY_UPDATE
const AUTOQUERY_UPDATE
Definition:
class.ilDBConstants.php:58
ilMDBase\getParentId
getParentId()
Definition:
class.ilMDBase.php:141
ilMDEntity\__getFields
__getFields()
Definition:
class.ilMDEntity.php:93
Services
Migration
DBUpdate_426
classes
class.ilMDEntity.php
Generated on Thu Feb 27 2025 19:02:00 for ILIAS by
1.8.13 (using
Doxyfile
)