ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
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 170 of file class.ilMDLifecycle.php.

171 {
172 return array('rbac_id' => $this->getRBACId(),
173 'obj_id' => $this->getObjId(),
174 'obj_type' => ilUtil::prepareDBString($this->getObjType()),
175 'lifecycle_status' => ilUtil::prepareDBString($this->getStatus()),
176 'meta_version' => ilUtil::prepareDBString($this->getVersion()),
177 'version_language' => ilUtil::prepareDBString($this->getVersionLanguageCode()));
178 }
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 245 of file class.ilMDLifecycle.php.

246 {
247 global $ilDB;
248
249 $query = "SELECT meta_lifecycle_id FROM il_meta_lifecycle ".
250 "WHERE rbac_id = ".$ilDB->quote($a_rbac_id ,'integer')." ".
251 "AND obj_id = ".$ilDB->quote($a_obj_id ,'integer');
252
253
254 $res = $ilDB->query($query);
255 while($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT))
256 {
257 return $row->meta_lifecycle_id;
258 }
259 return false;
260 }
global $ilDB

References $ilDB, $query, $res, $row, 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 228 of file class.ilMDLifecycle.php.

229 {
230 global $ilDB;
231
232 $query = "SELECT meta_lifecycle_id FROM il_meta_lifecycle ".
233 "WHERE rbac_id = ".$ilDB->quote($a_rbac_id)." ".
234 "AND obj_id = ".$ilDB->quote($a_obj_id);
235
236
237 $res = $ilDB->query($query);
238 while($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT))
239 {
240 return $row->meta_lifecycle_id;
241 }
242 return false;
243 }

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

◆ addContribute() [1/2]

& ilMDLifecycle::addContribute ( )

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

64 {
65 include_once 'Services/MetaData/classes/class.ilMDContribute.php';
66
67 $con = new ilMDContribute($this->getRBACId(),$this->getObjId(),$this->getObjType());
68 $con->setParentId($this->getMetaId());
69 $con->setParentType('meta_lifecycle');
70
71 return $con;
72 }

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 56 of file class.ilMDLifecycle.php.

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

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 $ilDB;
156
157 // Delete 'contribute'
158 foreach($this->getContributeIds() as $id)
159 {
160 $con = $this->getContribute($id);
161 $con->delete();
162 }
163
164
165 if($this->getMetaId())
166 {
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 $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 145 of file class.ilMDLifecycle.php.

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

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 {
56 return false;
57 }
58 $con = new ilMDContribute();
59 $con->setMetaId($a_contribute_id);
60
61 return $con;
62 }

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 {
49 return false;
50 }
51 $con = new ilMDContribute();
52 $con->setMetaId($a_contribute_id);
53
54 return $con;
55 }

◆ 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 90 of file class.ilMDLifecycle.php.

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

Referenced by __getFields(), and toXML().

+ Here is the caller graph for this function:

◆ getStatus() [2/2]

ilMDLifecycle::getStatus ( )

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

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

◆ getVersion() [1/2]

ilMDLifecycle::getVersion ( )

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

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

References $version.

Referenced by __getFields(), and toXML().

+ Here is the caller graph for this function:

◆ getVersion() [2/2]

ilMDLifecycle::getVersion ( )

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

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

References $version.

◆ getVersionLanguage() [1/2]

& ilMDLifecycle::getVersionLanguage ( )

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

110 {
111 return $this->version_language;
112 }

◆ getVersionLanguage() [2/2]

& ilMDLifecycle::getVersionLanguage ( )

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

103 {
104 return $this->version_language;
105 }

◆ getVersionLanguageCode() [1/2]

ilMDLifecycle::getVersionLanguageCode ( )

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

114 {
115 if(is_object($this->version_language))
116 {
117 return $this->version_language->getLanguageCode();
118 }
119 return false;
120 }

Referenced by __getFields(), and toXML().

+ Here is the caller graph for this function:

◆ getVersionLanguageCode() [2/2]

ilMDLifecycle::getVersionLanguageCode ( )

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

107 {
108 if(is_object($this->version_language))
109 {
110 return $this->version_language->getLanguageCode();
111 }
112 return false;
113 }

◆ read() [1/2]

ilMDLifecycle::read ( )

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

187 {
188 global $ilDB;
189
190 include_once 'Services/MetaData/classes/class.ilMDLanguageItem.php';
191
192 if($this->getMetaId())
193 {
194 $query = "SELECT * FROM il_meta_lifecycle ".
195 "WHERE meta_lifecycle_id = ".$ilDB->quote($this->getMetaId() ,'integer');
196
197 $res = $this->db->query($query);
198 while($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT))
199 {
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 $ilDB, $query, $res, $row, 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 180 of file class.ilMDLifecycle.php.

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

References $ilDB, $query, $res, $row, 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 122 of file class.ilMDLifecycle.php.

123 {
124 global $ilDB;
125
126 $fields = $this->__getFields();
127 $fields['meta_lifecycle_id'] = array('integer',$next_id = $ilDB->nextId('il_meta_lifecycle'));
128
129 if($this->db->insert('il_meta_lifecycle',$fields))
130 {
131 $this->setMetaId($next_id);
132 return $this->getMetaId();
133 }
134 return false;
135 }
setMetaId($a_meta_id, $a_read_data=true)

References $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 115 of file class.ilMDLifecycle.php.

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

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

+ Here is the call graph for this function:

◆ setStatus() [1/2]

ilMDLifecycle::setStatus (   $a_status)

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

77 {
78 switch($a_status)
79 {
80 case 'Draft':
81 case 'Final':
82 case 'Revised':
83 case 'Unavailable':
84 $this->status = $a_status;
85
86 default:
87 return false;
88 }
89 }

Referenced by read().

+ Here is the caller graph for this function:

◆ setStatus() [2/2]

ilMDLifecycle::setStatus (   $a_status)

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

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

◆ setVersion() [1/2]

ilMDLifecycle::setVersion (   $a_version)

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

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

Referenced by read().

+ Here is the caller graph for this function:

◆ setVersion() [2/2]

ilMDLifecycle::setVersion (   $a_version)

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

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

◆ setVersionLanguage() [1/2]

ilMDLifecycle::setVersionLanguage (   $lng_obj)

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

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

Referenced by read().

+ Here is the caller graph for this function:

◆ setVersionLanguage() [2/2]

ilMDLifecycle::setVersionLanguage (   $lng_obj)

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

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

◆ 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('Version',array('Language' => $this->getVersionLanguageCode()
222 ? $this->getVersionLanguageCode()
223 : 'en'),
224 $this->getVersion());
225
226 // contribute
227 $contributes = $this->getContributeIds();
228 foreach($contributes as $id)
229 {
230 $con =& $this->getContribute($id);
231 $con->toXML($writer);
232 }
233 if(!count($contributes))
234 {
235 include_once 'Services/MetaData/classes/class.ilMDContribute.php';
236 $con = new ilMDContribute($this->getRBACId(),$this->getObjId());
237 $con->toXML($writer);
238 }
239 $writer->xmlEndTag('Lifecycle');
240 }

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 210 of file class.ilMDLifecycle.php.

211 {
212 $writer->xmlStartTag('Lifecycle',array('Status' => $this->getStatus()));
213 $writer->xmlElement('Version',array('Language' => $this->getVersionLanguageCode()),$this->getVersion());
214
215 // contribute
216 foreach($this->getContributeIds() as $id)
217 {
218 $con =& $this->getContribute($id);
219 $con->toXML($writer);
220 }
221
222 $writer->xmlEndTag('Lifecycle');
223 }

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 137 of file class.ilMDLifecycle.php.

138 {
139 global $ilDB;
140
141 if($this->getMetaId())
142 {
143 if($this->db->update('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 $ilDB, and ilMDBase\getMetaId().

+ Here is the call graph for this function:

◆ update() [2/2]

ilMDLifecycle::update ( )

Reimplemented from ilMDBase.

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

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

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

+ Here is the call graph for this function:

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