ILIAS
release_5-3 Revision v5.3.23-19-g915713cf615
◀ ilDoc Overview
class.ilMDOrComposite.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
include_once
'Services/Migration/DBUpdate_426/classes/class.ilMDRequirement.php'
;
34
35
class
ilMDOrComposite
extends
ilMDRequirement
36
{
37
// SET/GET
38
public
function
setOrCompositeId
($a_or_composite_id)
39
{
40
$this->or_composite_id = (int) $a_or_composite_id;
41
}
42
public
function
getOrCompositeId
()
43
{
44
global
$ilDB
;
45
46
if
(!$this->or_composite_id) {
47
$query
=
"SELECT MAX(or_composite_id) AS orc FROM il_meta_requirement "
.
48
"WHERE rbac_id = "
.
$ilDB
->quote($this->
getRBACId
()) .
" "
.
49
"AND obj_id = "
. $ilDB->quote($this->
getObjId
()) .
" "
.
50
"GROUP BY or_composite_id"
;
51
52
$res
= $this->db->query(
$query
);
53
while
(
$row
=
$res
->fetchRow(
ilDBConstants::FETCHMODE_OBJECT
)) {
54
$this->or_composite_id =
$row
->orc;
55
}
56
++$this->or_composite_id;
57
}
58
return
$this->or_composite_id;
59
}
60
61
public
function
&
getRequirementIds
()
62
{
63
include_once
'Services/Migration/DBUpdate_426/classes/class.ilMDRequirement.php'
;
64
65
return
ilMDRequirement::_getIds
(
66
$this->
getRBACId
(),
67
$this->
getObjId
(),
68
$this->
getParentId
(),
69
'meta_technical'
,
70
$this->
getOrCompositeId
()
71
);
72
}
73
74
public
function
&
getRequirement
($a_requirement_id)
75
{
76
include_once
'Services/Migration/DBUpdate_426/classes/class.ilMDRequirement.php'
;
77
78
if
(!$a_requirement_id) {
79
return
false
;
80
}
81
$req
=
new
ilMDRequirement
();
82
$req
->setMetaId($a_requirement_id);
83
84
return
$req
;
85
}
86
87
public
function
&
addRequirement
()
88
{
89
include_once
'Services/Migration/DBUpdate_426/classes/class.ilMDRequirement.php'
;
90
91
$req
=
new
ilMDRequirement
($this->
getRBACId
(), $this->
getObjId
(), $this->
getObjType
());
92
$req
->setParentId($this->
getParentId
());
93
$req
->setParentType(
'meta_technical'
);
94
$req
->setOrCompositeId($this->
getOrCompositeId
());
95
96
return
$req
;
97
}
98
99
/*
100
* Overwritten save method, to get new or_composite_id
101
*
102
*/
103
public
function
save
()
104
{
105
echo
'Use ilMDOrcomposite::addRequirement()'
;
106
}
107
108
public
function
delete
()
109
{
110
foreach
($this->
getRequirementIds
() as
$id
) {
111
$req
= $this->
getRequirement
(
$id
);
112
$req
->delete();
113
}
114
return
true
;
115
}
116
117
/*
118
* XML Export of all meta data
119
* @param object (xml writer) see class.ilMD2XML.php
120
*
121
*/
122
public
function
toXML
(&$writer)
123
{
124
// For all requirements
125
$writer->xmlStartTag(
'OrComposite'
);
126
127
foreach
($this->
getRequirementIds
() as
$id
) {
128
$req
= $this->
getRequirement
($id);
129
$req
->toXML($writer);
130
}
131
$writer->xmlEndTag(
'OrComposite'
);
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 DISTINCT(or_composite_id) AS or_composite_id FROM il_meta_requirement "
.
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
"AND or_composite_id > 0 "
;
146
147
$res
=
$ilDB
->query(
$query
);
148
while
(
$row
=
$res
->fetchRow(
ilDBConstants::FETCHMODE_OBJECT
)) {
149
$ids[] =
$row
->or_composite_id;
150
}
151
return
$ids ? $ids : array();
152
}
153
}
$row
$row
Definition:
10autofilter-selection-1.php:74
php
An exception for terminatinating execution or to throw for unit testing.
ilDBConstants\FETCHMODE_OBJECT
const FETCHMODE_OBJECT
Definition:
class.ilDBConstants.php:13
ilMDBase\getObjType
getObjType()
Definition:
class.ilMDBase.php:111
ilMDBase\getRBACId
getRBACId()
Definition:
class.ilMDBase.php:95
ilMDBase\getObjId
getObjId()
Definition:
class.ilMDBase.php:103
ilMDBase\getParentId
getParentId()
Definition:
class.ilMDBase.php:139
ilMDOrComposite
Definition:
class.ilMDOrComposite.php:36
ilMDOrComposite\save
save()
Definition:
class.ilMDOrComposite.php:103
ilMDOrComposite\_getIds
_getIds($a_rbac_id, $a_obj_id, $a_parent_id, $a_parent_type)
Definition:
class.ilMDOrComposite.php:136
ilMDOrComposite\toXML
toXML(&$writer)
Definition:
class.ilMDOrComposite.php:122
ilMDOrComposite\getRequirement
& getRequirement($a_requirement_id)
Definition:
class.ilMDOrComposite.php:74
ilMDOrComposite\setOrCompositeId
setOrCompositeId($a_or_composite_id)
Definition:
class.ilMDOrComposite.php:38
ilMDOrComposite\addRequirement
& addRequirement()
Definition:
class.ilMDOrComposite.php:87
ilMDOrComposite\getOrCompositeId
getOrCompositeId()
Definition:
class.ilMDOrComposite.php:42
ilMDOrComposite\getRequirementIds
& getRequirementIds()
Definition:
class.ilMDOrComposite.php:61
ilMDRequirement
Definition:
class.ilMDRequirement.php:34
ilMDRequirement\_getIds
static _getIds($a_rbac_id, $a_obj_id, $a_parent_id, $a_parent_type, $a_or_composite_id=0)
Definition:
class.ilMDRequirement.php:238
$id
if(!array_key_exists('StateId', $_REQUEST)) $id
Definition:
expirywarning.php:14
$req
$req
Definition:
getUserInfo.php:20
$query
$query
Definition:
proxy_ylocal.php:13
$res
foreach($_POST as $key=> $value) $res
Definition:
save_question_post_data.php:15
$ilDB
global $ilDB
Definition:
storeScorm2004.php:19
Services
Migration
DBUpdate_426
classes
class.ilMDOrComposite.php
Generated on Tue Sep 30 2025 19:01:16 for ILIAS by
1.9.4 (using
Doxyfile
)