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