ILIAS
release_5-4 Revision v5.4.26-12-gabc799a52e6
◀ 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/Migration/DBUpdate_5295/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/Migration/DBUpdate_5295/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/Migration/DBUpdate_5295/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
$DIC
;
122
123
$ilDB
= $DIC[
'ilDB'
];
124
125
$fields = $this->
__getFields
();
126
$fields[
'meta_lifecycle_id'
] = array(
'integer'
,$next_id =
$ilDB
->nextId(
'il_meta_lifecycle'
));
127
128
if
($this->db->insert(
'il_meta_lifecycle'
, $fields)) {
129
$this->
setMetaId
($next_id);
130
return
$this->
getMetaId
();
131
}
132
return
false
;
133
}
134
135
public
function
update
()
136
{
137
global
$DIC
;
138
139
$ilDB
= $DIC[
'ilDB'
];
140
141
if
($this->
getMetaId
()) {
142
if
($this->db->update(
143
'il_meta_lifecycle'
,
144
$this->__getFields(),
145
array(
"meta_lifecycle_id"
=> array(
'integer'
,$this->
getMetaId
()))
146
)) {
147
return
true
;
148
}
149
}
150
return
false
;
151
}
152
153
public
function
delete
()
154
{
155
global
$DIC
;
156
157
$ilDB
= $DIC[
'ilDB'
];
158
159
// Delete 'contribute'
160
foreach
($this->
getContributeIds
() as
$id
) {
161
$con = $this->
getContribute
(
$id
);
162
$con->delete();
163
}
164
165
166
if
($this->
getMetaId
()) {
167
$query
=
"DELETE FROM il_meta_lifecycle "
.
168
"WHERE meta_lifecycle_id = "
.
$ilDB
->quote($this->
getMetaId
(),
'integer'
);
169
$res
=
$ilDB
->manipulate(
$query
);
170
return
true
;
171
}
172
return
false
;
173
}
174
175
176
public
function
__getFields
()
177
{
178
return
array(
'rbac_id'
=> array(
'integer'
,$this->
getRBACId
()),
179
'obj_id'
=> array(
'integer'
,$this->
getObjId
()),
180
'obj_type'
=> array(
'text'
,$this->
getObjType
()),
181
'lifecycle_status'
=> array(
'text'
,$this->
getStatus
()),
182
'meta_version'
=> array(
'text'
,$this->
getVersion
()),
183
'version_language'
=> array(
'text'
,$this->
getVersionLanguageCode
()));
184
}
185
186
public
function
read
()
187
{
188
global
$DIC
;
189
190
$ilDB
= $DIC[
'ilDB'
];
191
192
include_once
'Services/Migration/DBUpdate_5295/classes/class.ilMDLanguageItem.php'
;
193
194
if
($this->
getMetaId
()) {
195
$query
=
"SELECT * FROM il_meta_lifecycle "
.
196
"WHERE meta_lifecycle_id = "
.
$ilDB
->quote($this->
getMetaId
(),
'integer'
);
197
198
$res
= $this->db->query(
$query
);
199
while
(
$row
=
$res
->fetchRow(
ilDBConstants::FETCHMODE_OBJECT
)) {
200
$this->
setRBACId
(
$row
->rbac_id);
201
$this->
setObjId
(
$row
->obj_id);
202
$this->
setObjType
(
$row
->obj_type);
203
$this->
setStatus
(
$row
->lifecycle_status);
204
$this->
setVersion
(
$row
->meta_version);
205
$this->
setVersionLanguage
(
new
ilMDLanguageItem
(
$row
->version_language));
206
}
207
}
208
return
true
;
209
}
210
211
/*
212
* XML Export of all meta data
213
* @param object (xml writer) see class.ilMD2XML.php
214
*
215
*/
216
public
function
toXML
(&$writer)
217
{
218
$writer->xmlStartTag(
'Lifecycle'
, array(
'Status'
=> $this->
getStatus
()
219
? $this->
getStatus
()
220
:
'Draft'
));
221
$writer->xmlElement(
222
'Version'
,
223
array(
'Language'
=> $this->
getVersionLanguageCode
()
224
? $this->
getVersionLanguageCode
()
225
:
'en'
),
226
$this->
getVersion
()
227
);
228
229
// contribute
230
$contributes = $this->
getContributeIds
();
231
foreach
($contributes as
$id
) {
232
$con = &$this->
getContribute
($id);
233
$con->toXML($writer);
234
}
235
if
(!count($contributes)) {
236
include_once
'Services/Migration/DBUpdate_5295/classes/class.ilMDContribute.php'
;
237
$con =
new
ilMDContribute
($this->
getRBACId
(), $this->
getObjId
());
238
$con->toXML($writer);
239
}
240
$writer->xmlEndTag(
'Lifecycle'
);
241
}
242
243
244
245
// STATIC
246
public
static
function
_getId
($a_rbac_id, $a_obj_id)
247
{
248
global
$DIC
;
249
250
$ilDB
= $DIC[
'ilDB'
];
251
252
$query
=
"SELECT meta_lifecycle_id FROM il_meta_lifecycle "
.
253
"WHERE rbac_id = "
.
$ilDB
->quote($a_rbac_id,
'integer'
) .
" "
.
254
"AND obj_id = "
.
$ilDB
->quote($a_obj_id,
'integer'
);
255
256
257
$res
=
$ilDB
->query(
$query
);
258
while
(
$row
=
$res
->fetchRow(
ilDBConstants::FETCHMODE_OBJECT
)) {
259
return
$row
->meta_lifecycle_id;
260
}
261
return
false
;
262
}
263
}
ilMDLifecycle\getVersionLanguage
& getVersionLanguage()
Definition:
class.ilMDLifecycle.php:107
ilMDLifecycle\getVersionLanguageCode
getVersionLanguageCode()
Definition:
class.ilMDLifecycle.php:111
ilMDBase\setObjType
setObjType($a_type)
Definition:
class.ilMDBase.php:109
ilMDLifecycle\getVersion
getVersion()
Definition:
class.ilMDLifecycle.php:97
$DIC
global $DIC
Definition:
saml.php:7
ilMDLifecycle\read
read()
Definition:
class.ilMDLifecycle.php:186
ilMDContribute\_getIds
static _getIds($a_rbac_id, $a_obj_id, $a_parent_id, $a_parent_type)
Definition:
class.ilMDContribute.php:229
$id
if(!array_key_exists('StateId', $_REQUEST)) $id
Definition:
expirywarning.php:14
ilMDContribute
Definition:
class.ilMDContribute.php:34
ilMDLifecycle\update
update()
Definition:
class.ilMDLifecycle.php:135
ilMDLifecycle\setStatus
setStatus($a_status)
Definition:
class.ilMDLifecycle.php:75
ilMDBase\getRBACId
getRBACId()
Definition:
class.ilMDBase.php:97
$version
$version
Definition:
build.php:27
ilMDLifecycle\_getId
static _getId($a_rbac_id, $a_obj_id)
Definition:
class.ilMDLifecycle.php:246
ilMDLifecycle\addContribute
& addContribute()
Definition:
class.ilMDLifecycle.php:62
ilMDLifecycle\getContribute
& getContribute($a_contribute_id)
Definition:
class.ilMDLifecycle.php:50
ilMDLifecycle\getPossibleSubelements
getPossibleSubelements()
Definition:
class.ilMDLifecycle.php:36
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
ilMDLanguageItem
Definition:
class.ilMDLanguageItem.php:32
ilMDLifecycle\getStatus
getStatus()
Definition:
class.ilMDLifecycle.php:89
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
ilMDLifecycle\getContributeIds
& getContributeIds()
Definition:
class.ilMDLifecycle.php:44
$row
$row
Definition:
migrateto20.php:360
ilMDLifecycle\toXML
toXML(&$writer)
Definition:
class.ilMDLifecycle.php:216
ilMDLifecycle
Definition:
class.ilMDLifecycle.php:34
ilMDBase\getMetaId
getMetaId()
Definition:
class.ilMDBase.php:125
ilMDLifecycle\setVersion
setVersion($a_version)
Definition:
class.ilMDLifecycle.php:93
ilMDBase\getObjId
getObjId()
Definition:
class.ilMDBase.php:105
$ilDB
global $ilDB
Definition:
storeScorm2004.php:16
php
ilMDLifecycle\setVersionLanguage
setVersionLanguage($lng_obj)
Definition:
class.ilMDLifecycle.php:101
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
ilMDLifecycle\__getFields
__getFields()
Definition:
class.ilMDLifecycle.php:176
ilMDLifecycle\save
save()
Definition:
class.ilMDLifecycle.php:119
Services
Migration
DBUpdate_5295
classes
class.ilMDLifecycle.php
Generated on Thu Jan 16 2025 19:02:26 for ILIAS by
1.8.13 (using
Doxyfile
)