ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
ilMDLifecycle Class Reference
+ Inheritance diagram for ilMDLifecycle:
+ Collaboration diagram for ilMDLifecycle:

Public Member Functions

 getPossibleSubelements ()
 
getContributeIds ()
 
getContribute ($a_contribute_id)
 
addContribute ()
 
 setStatus ($a_status)
 
 getStatus ()
 
 setVersion ($a_version)
 
 getVersion ()
 
 setVersionLanguage ($lng_obj)
 
getVersionLanguage ()
 
 getVersionLanguageCode ()
 
 save ()
 
 update ()
 
 delete ()
 
 __getFields ()
 
 read ()
 
 toXML (&$writer)
 
getContributeIds ()
 
getContribute ($a_contribute_id)
 
addContribute ()
 
 setStatus ($a_status)
 
 getStatus ()
 
 setVersion ($a_version)
 
 getVersion ()
 
 setVersionLanguage ($lng_obj)
 
getVersionLanguage ()
 
 getVersionLanguageCode ()
 
 save ()
 
 update ()
 
 delete ()
 
 __getFields ()
 
 read ()
 
 toXML (&$writer)
 
 _getId ($a_rbac_id, $a_obj_id)
 
- Public Member Functions inherited from ilMDBase
 __construct ( $a_rbac_id=0, $a_obj_id=0, $a_type=0)
 
 setRBACId ($a_id)
 
 getRBACId ()
 
 setObjId ($a_id)
 
 getObjId ()
 
 setObjType ($a_type)
 
 getObjType ()
 
 setMetaId ($a_meta_id, $a_read_data=true)
 
 getMetaId ()
 
 setParentType ($a_parent_type)
 
 getParentType ()
 
 setParentId ($a_id)
 
 getParentId ()
 
 setExportMode ($a_export_mode=true)
 
 getExportMode ()
 
 validate ()
 
 update ()
 
 save ()
 
 delete ()
 
 toXML (&$writer)
 
 __construct ( $a_rbac_id=0, $a_obj_id=0, $a_type=0)
 
 setRBACId ($a_id)
 
 getRBACId ()
 
 setObjId ($a_id)
 
 getObjId ()
 
 setObjType ($a_type)
 
 getObjType ()
 
 setMetaId ($a_meta_id, $a_read_data=true)
 
 getMetaId ()
 
 setParentType ($a_parent_type)
 
 getParentType ()
 
 setParentId ($a_id)
 
 getParentId ()
 
 validate ()
 
 update ()
 
 save ()
 
 delete ()
 
 toXML (&$writer)
 

Static Public Member Functions

static _getId ($a_rbac_id, $a_obj_id)
 

Additional Inherited Members

- Data Fields inherited from ilMDBase
 $rbac_id
 
 $obj_id
 
 $obj_type
 
 $export_mode = false
 
- Protected Attributes inherited from ilMDBase
 $log
 

Detailed Description

Definition at line 34 of file class.ilMDLifecycle.php.

Member Function Documentation

◆ __getFields() [1/2]

ilMDLifecycle::__getFields ( )

Definition at line 176 of file class.ilMDLifecycle.php.

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 }

References ilMDBase\getObjId(), ilMDBase\getObjType(), ilMDBase\getRBACId(), getStatus(), getVersion(), and getVersionLanguageCode().

Referenced by save().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ __getFields() [2/2]

ilMDLifecycle::__getFields ( )

Definition at line 166 of file class.ilMDLifecycle.php.

167 {
168 return array('rbac_id' => $this->getRBACId(),
169 'obj_id' => $this->getObjId(),
170 'obj_type' => ilUtil::prepareDBString($this->getObjType()),
171 'lifecycle_status' => ilUtil::prepareDBString($this->getStatus()),
172 'meta_version' => ilUtil::prepareDBString($this->getVersion()),
173 'version_language' => ilUtil::prepareDBString($this->getVersionLanguageCode()));
174 }
static prepareDBString($a_str)
prepare a string for db writing (insert/update)

References ilMDBase\getObjId(), ilMDBase\getObjType(), ilMDBase\getRBACId(), getStatus(), getVersion(), getVersionLanguageCode(), and ilUtil\prepareDBString().

+ Here is the call graph for this function:

◆ _getId() [1/2]

static ilMDLifecycle::_getId (   $a_rbac_id,
  $a_obj_id 
)
static

Definition at line 246 of file class.ilMDLifecycle.php.

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 }
$query
foreach($_POST as $key=> $value) $res
global $ilDB
$DIC
Definition: xapitoken.php:46

References $DIC, $ilDB, $query, $res, and ilDBConstants\FETCHMODE_OBJECT.

Referenced by ilMD\getLifecycle().

+ Here is the caller graph for this function:

◆ _getId() [2/2]

ilMDLifecycle::_getId (   $a_rbac_id,
  $a_obj_id 
)

Definition at line 221 of file class.ilMDLifecycle.php.

222 {
223 global $ilDB;
224
225 $query = "SELECT meta_lifecycle_id FROM il_meta_lifecycle " .
226 "WHERE rbac_id = " . $ilDB->quote($a_rbac_id) . " " .
227 "AND obj_id = " . $ilDB->quote($a_obj_id);
228
229
230 $res = $ilDB->query($query);
231 while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
232 return $row->meta_lifecycle_id;
233 }
234 return false;
235 }

References $ilDB, $query, $res, and ilDBConstants\FETCHMODE_OBJECT.

◆ addContribute() [1/2]

& ilMDLifecycle::addContribute ( )

Definition at line 62 of file class.ilMDLifecycle.php.

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 }

References ilMDBase\getMetaId(), ilMDBase\getObjId(), ilMDBase\getObjType(), and ilMDBase\getRBACId().

+ Here is the call graph for this function:

◆ addContribute() [2/2]

& ilMDLifecycle::addContribute ( )

Definition at line 55 of file class.ilMDLifecycle.php.

56 {
57 include_once 'Services/Migration/DBUpdate_426/classes/class.ilMDContribute.php';
58
59 $con = new ilMDContribute($this->getRBACId(), $this->getObjId(), $this->getObjType());
60 $con->setParentId($this->getMetaId());
61 $con->setParentType('meta_lifecycle');
62
63 return $con;
64 }

References ilMDBase\getMetaId(), ilMDBase\getObjId(), ilMDBase\getObjType(), and ilMDBase\getRBACId().

+ Here is the call graph for this function:

◆ delete() [1/2]

ilMDLifecycle::delete ( )

Reimplemented from ilMDBase.

Definition at line 153 of file class.ilMDLifecycle.php.

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 }
& getContribute($a_contribute_id)

References $DIC, $ilDB, $query, $res, getContribute(), getContributeIds(), and ilMDBase\getMetaId().

+ Here is the call graph for this function:

◆ delete() [2/2]

ilMDLifecycle::delete ( )

Reimplemented from ilMDBase.

Definition at line 143 of file class.ilMDLifecycle.php.

144 {
145 global $ilDB;
146
147 // Delete 'contribute'
148 foreach ($this->getContributeIds() as $id) {
149 $con = $this->getContribute($id);
150 $con->delete();
151 }
152
153
154 if ($this->getMetaId()) {
155 $query = "DELETE FROM il_meta_lifecycle " .
156 "WHERE meta_lifecycle_id = " . $ilDB->quote($this->getMetaId());
157
158 $this->db->query($query);
159
160 return true;
161 }
162 return false;
163 }

References $ilDB, $query, getContribute(), getContributeIds(), and ilMDBase\getMetaId().

+ Here is the call graph for this function:

◆ getContribute() [1/2]

& ilMDLifecycle::getContribute (   $a_contribute_id)

Definition at line 50 of file class.ilMDLifecycle.php.

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 }

Referenced by delete(), and toXML().

+ Here is the caller graph for this function:

◆ getContribute() [2/2]

& ilMDLifecycle::getContribute (   $a_contribute_id)

Definition at line 43 of file class.ilMDLifecycle.php.

44 {
45 include_once 'Services/Migration/DBUpdate_426/classes/class.ilMDContribute.php';
46
47 if (!$a_contribute_id) {
48 return false;
49 }
50 $con = new ilMDContribute();
51 $con->setMetaId($a_contribute_id);
52
53 return $con;
54 }

◆ getContributeIds() [1/2]

& ilMDLifecycle::getContributeIds ( )

Definition at line 44 of file class.ilMDLifecycle.php.

45 {
46 include_once 'Services/MetaData/classes/class.ilMDContribute.php';
47
48 return ilMDContribute::_getIds($this->getRBACId(), $this->getObjId(), $this->getMetaId(), 'meta_lifecycle');
49 }
static _getIds($a_rbac_id, $a_obj_id, $a_parent_id, $a_parent_type)

References ilMDContribute\_getIds(), ilMDBase\getMetaId(), ilMDBase\getObjId(), and ilMDBase\getRBACId().

Referenced by delete(), and toXML().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getContributeIds() [2/2]

& ilMDLifecycle::getContributeIds ( )

Definition at line 37 of file class.ilMDLifecycle.php.

38 {
39 include_once 'Services/Migration/DBUpdate_426/classes/class.ilMDContribute.php';
40
41 return ilMDContribute::_getIds($this->getRBACId(), $this->getObjId(), $this->getMetaId(), 'meta_lifecycle');
42 }

References ilMDContribute\_getIds(), ilMDBase\getMetaId(), ilMDBase\getObjId(), and ilMDBase\getRBACId().

+ Here is the call graph for this function:

◆ getPossibleSubelements()

ilMDLifecycle::getPossibleSubelements ( )

Definition at line 36 of file class.ilMDLifecycle.php.

37 {
38 $subs['Contribute'] = 'meta_contribute';
39
40 return $subs;
41 }

◆ getStatus() [1/2]

ilMDLifecycle::getStatus ( )

Definition at line 89 of file class.ilMDLifecycle.php.

90 {
91 return $this->status;
92 }

Referenced by __getFields(), and toXML().

+ Here is the caller graph for this function:

◆ getStatus() [2/2]

ilMDLifecycle::getStatus ( )

Definition at line 82 of file class.ilMDLifecycle.php.

83 {
84 return $this->status;
85 }

◆ getVersion() [1/2]

ilMDLifecycle::getVersion ( )

Definition at line 97 of file class.ilMDLifecycle.php.

98 {
99 return $this->version;
100 }

Referenced by __getFields(), and toXML().

+ Here is the caller graph for this function:

◆ getVersion() [2/2]

ilMDLifecycle::getVersion ( )

Definition at line 90 of file class.ilMDLifecycle.php.

91 {
92 return $this->version;
93 }

◆ getVersionLanguage() [1/2]

& ilMDLifecycle::getVersionLanguage ( )

Definition at line 107 of file class.ilMDLifecycle.php.

108 {
109 return $this->version_language;
110 }

◆ getVersionLanguage() [2/2]

& ilMDLifecycle::getVersionLanguage ( )

Definition at line 100 of file class.ilMDLifecycle.php.

101 {
102 return $this->version_language;
103 }

◆ getVersionLanguageCode() [1/2]

ilMDLifecycle::getVersionLanguageCode ( )

Definition at line 111 of file class.ilMDLifecycle.php.

112 {
113 if (is_object($this->version_language)) {
114 return $this->version_language->getLanguageCode();
115 }
116 return false;
117 }

Referenced by __getFields(), and toXML().

+ Here is the caller graph for this function:

◆ getVersionLanguageCode() [2/2]

ilMDLifecycle::getVersionLanguageCode ( )

Definition at line 104 of file class.ilMDLifecycle.php.

105 {
106 if (is_object($this->version_language)) {
107 return $this->version_language->getLanguageCode();
108 }
109 return false;
110 }

◆ read() [1/2]

ilMDLifecycle::read ( )

Definition at line 186 of file class.ilMDLifecycle.php.

187 {
188 global $DIC;
189
190 $ilDB = $DIC['ilDB'];
191
192 include_once 'Services/MetaData/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 }
setObjId($a_id)
setObjType($a_type)
setRBACId($a_id)
setVersion($a_version)
setVersionLanguage($lng_obj)

References $DIC, $ilDB, $query, $res, ilDBConstants\FETCHMODE_OBJECT, ilMDBase\getMetaId(), ilMDBase\setObjId(), ilMDBase\setObjType(), ilMDBase\setRBACId(), setStatus(), setVersion(), and setVersionLanguage().

+ Here is the call graph for this function:

◆ read() [2/2]

ilMDLifecycle::read ( )

Definition at line 176 of file class.ilMDLifecycle.php.

177 {
178 global $ilDB;
179
180 include_once 'Services/Migration/DBUpdate_426/classes/class.ilMDLanguageItem.php';
181
182 if ($this->getMetaId()) {
183 $query = "SELECT * FROM il_meta_lifecycle " .
184 "WHERE meta_lifecycle_id = " . $ilDB->quote($this->getMetaId());
185
186 $res = $this->db->query($query);
187 while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
188 $this->setRBACId($row->rbac_id);
189 $this->setObjId($row->obj_id);
190 $this->setObjType($row->obj_type);
191 $this->setStatus(ilUtil::stripSlashes($row->lifecycle_status));
192 $this->setVersion(ilUtil::stripSlashes($row->meta_version));
193 $this->setVersionLanguage(new ilMDLanguageItem($row->version_language));
194 }
195 }
196 return true;
197 }
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled

References $ilDB, $query, $res, ilDBConstants\FETCHMODE_OBJECT, ilMDBase\getMetaId(), ilMDBase\setObjId(), ilMDBase\setObjType(), ilMDBase\setRBACId(), setStatus(), setVersion(), setVersionLanguage(), and ilUtil\stripSlashes().

+ Here is the call graph for this function:

◆ save() [1/2]

ilMDLifecycle::save ( )

Reimplemented from ilMDBase.

Definition at line 119 of file class.ilMDLifecycle.php.

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 }
setMetaId($a_meta_id, $a_read_data=true)

References $DIC, $ilDB, __getFields(), ilMDBase\getMetaId(), and ilMDBase\setMetaId().

+ Here is the call graph for this function:

◆ save() [2/2]

ilMDLifecycle::save ( )

Reimplemented from ilMDBase.

Definition at line 112 of file class.ilMDLifecycle.php.

113 {
114 if ($this->db->autoExecute(
115 'il_meta_lifecycle',
116 $this->__getFields(),
118 )) {
119 $this->setMetaId($this->db->getLastInsertId());
120
121 return $this->getMetaId();
122 }
123 return false;
124 }

References ilDBConstants\AUTOQUERY_INSERT, ilMDBase\getMetaId(), and ilMDBase\setMetaId().

+ Here is the call graph for this function:

◆ setStatus() [1/2]

ilMDLifecycle::setStatus (   $a_status)

Definition at line 75 of file class.ilMDLifecycle.php.

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 }

Referenced by read().

+ Here is the caller graph for this function:

◆ setStatus() [2/2]

ilMDLifecycle::setStatus (   $a_status)

Definition at line 68 of file class.ilMDLifecycle.php.

69 {
70 switch ($a_status) {
71 case 'Draft':
72 case 'Final':
73 case 'Revised':
74 case 'Unavailable':
75 $this->status = $a_status;
76
77 // no break
78 default:
79 return false;
80 }
81 }

◆ setVersion() [1/2]

ilMDLifecycle::setVersion (   $a_version)

Definition at line 93 of file class.ilMDLifecycle.php.

94 {
95 $this->version = $a_version;
96 }

Referenced by read().

+ Here is the caller graph for this function:

◆ setVersion() [2/2]

ilMDLifecycle::setVersion (   $a_version)

Definition at line 86 of file class.ilMDLifecycle.php.

87 {
88 $this->version = $a_version;
89 }

◆ setVersionLanguage() [1/2]

ilMDLifecycle::setVersionLanguage (   $lng_obj)

Definition at line 101 of file class.ilMDLifecycle.php.

102 {
103 if (is_object($lng_obj)) {
104 $this->version_language = &$lng_obj;
105 }
106 }

Referenced by read().

+ Here is the caller graph for this function:

◆ setVersionLanguage() [2/2]

ilMDLifecycle::setVersionLanguage (   $lng_obj)

Definition at line 94 of file class.ilMDLifecycle.php.

95 {
96 if (is_object($lng_obj)) {
97 $this->version_language = &$lng_obj;
98 }
99 }

◆ toXML() [1/2]

ilMDLifecycle::toXML ( $writer)

Reimplemented from ilMDBase.

Definition at line 216 of file class.ilMDLifecycle.php.

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/MetaData/classes/class.ilMDContribute.php';
237 $con = new ilMDContribute($this->getRBACId(), $this->getObjId());
238 $con->toXML($writer);
239 }
240 $writer->xmlEndTag('Lifecycle');
241 }

References getContribute(), getContributeIds(), ilMDBase\getObjId(), ilMDBase\getRBACId(), getStatus(), getVersion(), and getVersionLanguageCode().

+ Here is the call graph for this function:

◆ toXML() [2/2]

ilMDLifecycle::toXML ( $writer)

Reimplemented from ilMDBase.

Definition at line 204 of file class.ilMDLifecycle.php.

205 {
206 $writer->xmlStartTag('Lifecycle', array('Status' => $this->getStatus()));
207 $writer->xmlElement('Version', array('Language' => $this->getVersionLanguageCode()), $this->getVersion());
208
209 // contribute
210 foreach ($this->getContributeIds() as $id) {
211 $con = &$this->getContribute($id);
212 $con->toXML($writer);
213 }
214
215 $writer->xmlEndTag('Lifecycle');
216 }

References getContribute(), getContributeIds(), getStatus(), getVersion(), and getVersionLanguageCode().

+ Here is the call graph for this function:

◆ update() [1/2]

ilMDLifecycle::update ( )

Reimplemented from ilMDBase.

Definition at line 135 of file class.ilMDLifecycle.php.

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 }

References $DIC, $ilDB, and ilMDBase\getMetaId().

+ Here is the call graph for this function:

◆ update() [2/2]

ilMDLifecycle::update ( )

Reimplemented from ilMDBase.

Definition at line 126 of file class.ilMDLifecycle.php.

127 {
128 global $ilDB;
129
130 if ($this->getMetaId()) {
131 if ($this->db->autoExecute(
132 'il_meta_lifecycle',
133 $this->__getFields(),
135 "meta_lifecycle_id = " . $ilDB->quote($this->getMetaId())
136 )) {
137 return true;
138 }
139 }
140 return false;
141 }

References $ilDB, ilDBConstants\AUTOQUERY_UPDATE, and ilMDBase\getMetaId().

+ Here is the call graph for this function:

The documentation for this class was generated from the following files: