ILIAS
release_5-3 Revision v5.3.23-19-g915713cf615
◀ ilDoc Overview
class.ilMDLifecycle.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
ilMDLifecycle
extends
ilMDBase
35
{
36
public
function
getPossibleSubelements
()
37
{
38
$subs[
'Contribute'
] =
'meta_contribute'
;
39
40
return
$subs;
41
}
42
43
// Get subelemsts 'Contribute'
44
public
function
&
getContributeIds
()
45
{
46
include_once
'Services/MetaData/classes/class.ilMDContribute.php'
;
47
48
return
ilMDContribute::_getIds
($this->
getRBACId
(), $this->
getObjId
(), $this->
getMetaId
(),
'meta_lifecycle'
);
49
}
50
public
function
&
getContribute
($a_contribute_id)
51
{
52
include_once
'Services/MetaData/classes/class.ilMDContribute.php'
;
53
54
if
(!$a_contribute_id) {
55
return
false
;
56
}
57
$con =
new
ilMDContribute
();
58
$con->setMetaId($a_contribute_id);
59
60
return
$con;
61
}
62
public
function
&
addContribute
()
63
{
64
include_once
'Services/MetaData/classes/class.ilMDContribute.php'
;
65
66
$con =
new
ilMDContribute
($this->
getRBACId
(), $this->
getObjId
(), $this->
getObjType
());
67
$con->setParentId($this->
getMetaId
());
68
$con->setParentType(
'meta_lifecycle'
);
69
70
return
$con;
71
}
72
73
74
// SET/GET
75
public
function
setStatus
($a_status)
76
{
77
switch
($a_status) {
78
case
'Draft'
:
79
case
'Final'
:
80
case
'Revised'
:
81
case
'Unavailable'
:
82
$this->status = $a_status;
83
84
// no break
85
default
:
86
return
false
;
87
}
88
}
89
public
function
getStatus
()
90
{
91
return
$this->status;
92
}
93
public
function
setVersion
($a_version)
94
{
95
$this->version = $a_version;
96
}
97
public
function
getVersion
()
98
{
99
return
$this->version
;
100
}
101
public
function
setVersionLanguage
($lng_obj)
102
{
103
if
(is_object($lng_obj)) {
104
$this->version_language =&$lng_obj;
105
}
106
}
107
public
function
&
getVersionLanguage
()
108
{
109
return
$this->version_language;
110
}
111
public
function
getVersionLanguageCode
()
112
{
113
if
(is_object($this->version_language)) {
114
return
$this->version_language->getLanguageCode();
115
}
116
return
false
;
117
}
118
119
public
function
save
()
120
{
121
global
$ilDB
;
122
123
$fields = $this->
__getFields
();
124
$fields[
'meta_lifecycle_id'
] = array(
'integer'
,$next_id =
$ilDB
->nextId(
'il_meta_lifecycle'
));
125
126
if
($this->db->insert(
'il_meta_lifecycle'
, $fields)) {
127
$this->
setMetaId
($next_id);
128
return
$this->
getMetaId
();
129
}
130
return
false
;
131
}
132
133
public
function
update
()
134
{
135
global
$ilDB
;
136
137
if
($this->
getMetaId
()) {
138
if
($this->db->update(
139
'il_meta_lifecycle'
,
140
$this->__getFields(),
141
array(
"meta_lifecycle_id"
=> array(
'integer'
,$this->
getMetaId
()))
142
)) {
143
return
true
;
144
}
145
}
146
return
false
;
147
}
148
149
public
function
delete
()
150
{
151
global
$ilDB
;
152
153
// Delete 'contribute'
154
foreach
($this->
getContributeIds
() as
$id
) {
155
$con = $this->
getContribute
(
$id
);
156
$con->delete();
157
}
158
159
160
if
($this->
getMetaId
()) {
161
$query
=
"DELETE FROM il_meta_lifecycle "
.
162
"WHERE meta_lifecycle_id = "
. $ilDB->quote($this->
getMetaId
(),
'integer'
);
163
$res
= $ilDB->manipulate(
$query
);
164
return
true
;
165
}
166
return
false
;
167
}
168
169
170
public
function
__getFields
()
171
{
172
return
array(
'rbac_id'
=> array(
'integer'
,$this->
getRBACId
()),
173
'obj_id'
=> array(
'integer'
,$this->
getObjId
()),
174
'obj_type'
=> array(
'text'
,$this->
getObjType
()),
175
'lifecycle_status'
=> array(
'text'
,$this->
getStatus
()),
176
'meta_version'
=> array(
'text'
,$this->
getVersion
()),
177
'version_language'
=> array(
'text'
,$this->
getVersionLanguageCode
()));
178
}
179
180
public
function
read
()
181
{
182
global
$ilDB
;
183
184
include_once
'Services/MetaData/classes/class.ilMDLanguageItem.php'
;
185
186
if
($this->
getMetaId
()) {
187
$query
=
"SELECT * FROM il_meta_lifecycle "
.
188
"WHERE meta_lifecycle_id = "
. $ilDB->quote($this->
getMetaId
(),
'integer'
);
189
190
$res
= $this->db->query(
$query
);
191
while
(
$row
=
$res
->fetchRow(
ilDBConstants::FETCHMODE_OBJECT
)) {
192
$this->
setRBACId
(
$row
->rbac_id);
193
$this->
setObjId
(
$row
->obj_id);
194
$this->
setObjType
(
$row
->obj_type);
195
$this->
setStatus
(
$row
->lifecycle_status);
196
$this->
setVersion
(
$row
->meta_version);
197
$this->
setVersionLanguage
(
new
ilMDLanguageItem
(
$row
->version_language));
198
}
199
}
200
return
true
;
201
}
202
203
/*
204
* XML Export of all meta data
205
* @param object (xml writer) see class.ilMD2XML.php
206
*
207
*/
208
public
function
toXML
(&$writer)
209
{
210
$writer->xmlStartTag(
'Lifecycle'
, array(
'Status'
=> $this->
getStatus
()
211
? $this->
getStatus
()
212
:
'Draft'
));
213
$writer->xmlElement(
214
'Version'
,
215
array(
'Language'
=> $this->
getVersionLanguageCode
()
216
? $this->
getVersionLanguageCode
()
217
:
'en'
),
218
$this->
getVersion
()
219
);
220
221
// contribute
222
$contributes = $this->
getContributeIds
();
223
foreach
($contributes as
$id
) {
224
$con =&$this->
getContribute
($id);
225
$con->toXML($writer);
226
}
227
if
(!count($contributes)) {
228
include_once
'Services/MetaData/classes/class.ilMDContribute.php'
;
229
$con =
new
ilMDContribute
($this->
getRBACId
(), $this->
getObjId
());
230
$con->toXML($writer);
231
}
232
$writer->xmlEndTag(
'Lifecycle'
);
233
}
234
235
236
237
// STATIC
238
public
static
function
_getId
($a_rbac_id, $a_obj_id)
239
{
240
global
$ilDB
;
241
242
$query
=
"SELECT meta_lifecycle_id FROM il_meta_lifecycle "
.
243
"WHERE rbac_id = "
.
$ilDB
->quote($a_rbac_id,
'integer'
) .
" "
.
244
"AND obj_id = "
.
$ilDB
->quote($a_obj_id,
'integer'
);
245
246
247
$res
=
$ilDB
->query(
$query
);
248
while
(
$row
=
$res
->fetchRow(
ilDBConstants::FETCHMODE_OBJECT
)) {
249
return
$row
->meta_lifecycle_id;
250
}
251
return
false
;
252
}
253
}
$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
Definition:
class.ilMDBase.php:33
ilMDBase\getObjType
getObjType()
Definition:
class.ilMDBase.php:111
ilMDBase\getMetaId
getMetaId()
Definition:
class.ilMDBase.php:123
ilMDBase\setObjId
setObjId($a_id)
Definition:
class.ilMDBase.php:99
ilMDBase\setMetaId
setMetaId($a_meta_id, $a_read_data=true)
Definition:
class.ilMDBase.php:115
ilMDBase\getRBACId
getRBACId()
Definition:
class.ilMDBase.php:95
ilMDBase\getObjId
getObjId()
Definition:
class.ilMDBase.php:103
ilMDBase\setObjType
setObjType($a_type)
Definition:
class.ilMDBase.php:107
ilMDBase\setRBACId
setRBACId($a_id)
Definition:
class.ilMDBase.php:91
ilMDContribute
Definition:
class.ilMDContribute.php:35
ilMDContribute\_getIds
static _getIds($a_rbac_id, $a_obj_id, $a_parent_id, $a_parent_type)
Definition:
class.ilMDContribute.php:221
ilMDLanguageItem
Definition:
class.ilMDLanguageItem.php:33
ilMDLifecycle
Definition:
class.ilMDLifecycle.php:35
ilMDLifecycle\getVersionLanguage
& getVersionLanguage()
Definition:
class.ilMDLifecycle.php:107
ilMDLifecycle\getContributeIds
& getContributeIds()
Definition:
class.ilMDLifecycle.php:44
ilMDLifecycle\toXML
toXML(&$writer)
Definition:
class.ilMDLifecycle.php:208
ilMDLifecycle\getContribute
& getContribute($a_contribute_id)
Definition:
class.ilMDLifecycle.php:50
ilMDLifecycle\read
read()
Definition:
class.ilMDLifecycle.php:180
ilMDLifecycle\getVersion
getVersion()
Definition:
class.ilMDLifecycle.php:97
ilMDLifecycle\getPossibleSubelements
getPossibleSubelements()
Definition:
class.ilMDLifecycle.php:36
ilMDLifecycle\setVersion
setVersion($a_version)
Definition:
class.ilMDLifecycle.php:93
ilMDLifecycle\_getId
static _getId($a_rbac_id, $a_obj_id)
Definition:
class.ilMDLifecycle.php:238
ilMDLifecycle\addContribute
& addContribute()
Definition:
class.ilMDLifecycle.php:62
ilMDLifecycle\setStatus
setStatus($a_status)
Definition:
class.ilMDLifecycle.php:75
ilMDLifecycle\__getFields
__getFields()
Definition:
class.ilMDLifecycle.php:170
ilMDLifecycle\update
update()
Definition:
class.ilMDLifecycle.php:133
ilMDLifecycle\getVersionLanguageCode
getVersionLanguageCode()
Definition:
class.ilMDLifecycle.php:111
ilMDLifecycle\getStatus
getStatus()
Definition:
class.ilMDLifecycle.php:89
ilMDLifecycle\setVersionLanguage
setVersionLanguage($lng_obj)
Definition:
class.ilMDLifecycle.php:101
ilMDLifecycle\save
save()
Definition:
class.ilMDLifecycle.php:119
$id
if(!array_key_exists('StateId', $_REQUEST)) $id
Definition:
expirywarning.php:14
$version
$version
Definition:
generate-includes.php:135
$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
MetaData
classes
class.ilMDLifecycle.php
Generated on Tue Sep 30 2025 19:01:16 for ILIAS by
1.9.4 (using
Doxyfile
)