ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
ilMDLifecycle Class Reference
+ Inheritance diagram for ilMDLifecycle:
+ Collaboration diagram for ilMDLifecycle:

Public Member Functions

 ilMDLifecycle ($a_rbac_id=0, $a_obj_id=0, $a_obj_type='')
 
 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)
 
 _getId ($a_rbac_id, $a_obj_id)
 
 ilMDLifecycle ($a_rbac_id=0, $a_obj_id=0, $a_obj_type='')
 
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
 ilMDBase ($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)
 
 ilMDBase ($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)
 

Additional Inherited Members

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

Detailed Description

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

Member Function Documentation

◆ __getFields() [1/2]

ilMDLifecycle::__getFields ( )

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

184 {
185 return array('rbac_id' => array('integer',$this->getRBACId()),
186 'obj_id' => array('integer',$this->getObjId()),
187 'obj_type' => array('text',$this->getObjType()),
188 'lifecycle_status' => array('text',$this->getStatus()),
189 'meta_version' => array('text',$this->getVersion()),
190 'version_language' => array('text',$this->getVersionLanguageCode()));
191 }

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

178 {
179 return array('rbac_id' => $this->getRBACId(),
180 'obj_id' => $this->getObjId(),
181 'obj_type' => ilUtil::prepareDBString($this->getObjType()),
182 'lifecycle_status' => ilUtil::prepareDBString($this->getStatus()),
183 'meta_version' => ilUtil::prepareDBString($this->getVersion()),
184 'version_language' => ilUtil::prepareDBString($this->getVersionLanguageCode()));
185 }
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]

ilMDLifecycle::_getId (   $a_rbac_id,
  $a_obj_id 
)

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

253 {
254 global $ilDB;
255
256 $query = "SELECT meta_lifecycle_id FROM il_meta_lifecycle ".
257 "WHERE rbac_id = ".$ilDB->quote($a_rbac_id ,'integer')." ".
258 "AND obj_id = ".$ilDB->quote($a_obj_id ,'integer');
259
260
261 $res = $ilDB->query($query);
262 while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
263 {
264 return $row->meta_lifecycle_id;
265 }
266 return false;
267 }
const DB_FETCHMODE_OBJECT
Definition: class.ilDB.php:11
global $ilDB

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

236 {
237 global $ilDB;
238
239 $query = "SELECT meta_lifecycle_id FROM il_meta_lifecycle ".
240 "WHERE rbac_id = ".$ilDB->quote($a_rbac_id)." ".
241 "AND obj_id = ".$ilDB->quote($a_obj_id);
242
243
244 $res = $ilDB->query($query);
245 while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
246 {
247 return $row->meta_lifecycle_id;
248 }
249 return false;
250 }

References $ilDB, $query, $res, $row, and DB_FETCHMODE_OBJECT.

◆ addContribute() [1/2]

& ilMDLifecycle::addContribute ( )

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

71 {
72 include_once 'Services/MetaData/classes/class.ilMDContribute.php';
73
74 $con =& new ilMDContribute($this->getRBACId(),$this->getObjId(),$this->getObjType());
75 $con->setParentId($this->getMetaId());
76 $con->setParentType('meta_lifecycle');
77
78 return $con;
79 }

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

64 {
65 include_once 'Services/Migration/DBUpdate_426/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:

◆ delete() [1/2]

ilMDLifecycle::delete ( )

Reimplemented from ilMDBase.

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

161 {
162 global $ilDB;
163
164 // Delete 'contribute'
165 foreach($this->getContributeIds() as $id)
166 {
167 $con = $this->getContribute($id);
168 $con->delete();
169 }
170
171
172 if($this->getMetaId())
173 {
174 $query = "DELETE FROM il_meta_lifecycle ".
175 "WHERE meta_lifecycle_id = ".$ilDB->quote($this->getMetaId() ,'integer');
176 $res = $ilDB->manipulate($query);
177 return true;
178 }
179 return false;
180 }
& 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 152 of file class.ilMDLifecycle.php.

153 {
154 global $ilDB;
155
156 // Delete 'contribute'
157 foreach($this->getContributeIds() as $id)
158 {
159 $con = $this->getContribute($id);
160 $con->delete();
161 }
162
163
164 if($this->getMetaId())
165 {
166 $query = "DELETE FROM il_meta_lifecycle ".
167 "WHERE meta_lifecycle_id = ".$ilDB->quote($this->getMetaId());
168
169 $this->db->query($query);
170
171 return true;
172 }
173 return false;
174 }

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

58 {
59 include_once 'Services/MetaData/classes/class.ilMDContribute.php';
60
61 if(!$a_contribute_id)
62 {
63 return false;
64 }
65 $con =& new ilMDContribute();
66 $con->setMetaId($a_contribute_id);
67
68 return $con;
69 }

Referenced by delete(), and toXML().

+ Here is the caller graph for this function:

◆ getContribute() [2/2]

& ilMDLifecycle::getContribute (   $a_contribute_id)

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

51 {
52 include_once 'Services/Migration/DBUpdate_426/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 }

◆ getContributeIds() [1/2]

& ilMDLifecycle::getContributeIds ( )

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

52 {
53 include_once 'Services/MetaData/classes/class.ilMDContribute.php';
54
55 return ilMDContribute::_getIds($this->getRBACId(),$this->getObjId(),$this->getMetaId(),'meta_lifecycle');
56 }
_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 44 of file class.ilMDLifecycle.php.

45 {
46 include_once 'Services/Migration/DBUpdate_426/classes/class.ilMDContribute.php';
47
48 return ilMDContribute::_getIds($this->getRBACId(),$this->getObjId(),$this->getMetaId(),'meta_lifecycle');
49 }

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

+ Here is the call graph for this function:

◆ getPossibleSubelements()

ilMDLifecycle::getPossibleSubelements ( )

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

44 {
45 $subs['Contribute'] = 'meta_contribute';
46
47 return $subs;
48 }

◆ getStatus() [1/2]

ilMDLifecycle::getStatus ( )

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

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

Referenced by __getFields(), and toXML().

+ Here is the caller graph for this function:

◆ getStatus() [2/2]

ilMDLifecycle::getStatus ( )

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

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

◆ getVersion() [1/2]

ilMDLifecycle::getVersion ( )

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

106 {
107 return $this->version;
108 }

Referenced by __getFields(), and toXML().

+ Here is the caller graph for this function:

◆ getVersion() [2/2]

ilMDLifecycle::getVersion ( )

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

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

◆ getVersionLanguage() [1/2]

& ilMDLifecycle::getVersionLanguage ( )

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

117 {
118 return $this->version_language;
119 }

◆ getVersionLanguage() [2/2]

& ilMDLifecycle::getVersionLanguage ( )

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

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

◆ getVersionLanguageCode() [1/2]

ilMDLifecycle::getVersionLanguageCode ( )

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

121 {
122 if(is_object($this->version_language))
123 {
124 return $this->version_language->getLanguageCode();
125 }
126 return false;
127 }

Referenced by __getFields(), and toXML().

+ Here is the caller graph for this function:

◆ getVersionLanguageCode() [2/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 }

◆ ilMDLifecycle() [1/2]

ilMDLifecycle::ilMDLifecycle (   $a_rbac_id = 0,
  $a_obj_id = 0,
  $a_obj_type = '' 
)

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

37 {
38 parent::ilMDBase($a_rbac_id,
39 $a_obj_id,
40 $a_obj_type);
41 }

◆ ilMDLifecycle() [2/2]

ilMDLifecycle::ilMDLifecycle (   $a_rbac_id = 0,
  $a_obj_id = 0,
  $a_obj_type = '' 
)

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

37 {
38 parent::ilMDBase($a_rbac_id,
39 $a_obj_id,
40 $a_obj_type);
41 }

◆ read() [1/2]

ilMDLifecycle::read ( )

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

194 {
195 global $ilDB;
196
197 include_once 'Services/MetaData/classes/class.ilMDLanguageItem.php';
198
199 if($this->getMetaId())
200 {
201 $query = "SELECT * FROM il_meta_lifecycle ".
202 "WHERE meta_lifecycle_id = ".$ilDB->quote($this->getMetaId() ,'integer');
203
204 $res = $this->db->query($query);
205 while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
206 {
207 $this->setRBACId($row->rbac_id);
208 $this->setObjId($row->obj_id);
209 $this->setObjType($row->obj_type);
210 $this->setStatus($row->lifecycle_status);
211 $this->setVersion($row->meta_version);
212 $this->setVersionLanguage(new ilMDLanguageItem($row->version_language));
213 }
214 }
215 return true;
216 }
setObjId($a_id)
setObjType($a_type)
setRBACId($a_id)
setVersion($a_version)
setVersionLanguage($lng_obj)

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

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

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

130 {
131 global $ilDB;
132
133 $fields = $this->__getFields();
134 $fields['meta_lifecycle_id'] = array('integer',$next_id = $ilDB->nextId('il_meta_lifecycle'));
135
136 if($this->db->insert('il_meta_lifecycle',$fields))
137 {
138 $this->setMetaId($next_id);
139 return $this->getMetaId();
140 }
141 return false;
142 }
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 122 of file class.ilMDLifecycle.php.

123 {
124 if($this->db->autoExecute('il_meta_lifecycle',
125 $this->__getFields(),
126 DB_AUTOQUERY_INSERT))
127 {
128 $this->setMetaId($this->db->getLastInsertId());
129
130 return $this->getMetaId();
131 }
132 return false;
133 }

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

+ Here is the call graph for this function:

◆ setStatus() [1/2]

ilMDLifecycle::setStatus (   $a_status)

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

84 {
85 switch($a_status)
86 {
87 case 'Draft':
88 case 'Final':
89 case 'Revised':
90 case 'Unavailable':
91 $this->status = $a_status;
92
93 default:
94 return false;
95 }
96 }

Referenced by read().

+ Here is the caller graph for this function:

◆ setStatus() [2/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 }

◆ setVersion() [1/2]

ilMDLifecycle::setVersion (   $a_version)

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

102 {
103 $this->version = $a_version;
104 }

Referenced by read().

+ Here is the caller graph for this function:

◆ setVersion() [2/2]

ilMDLifecycle::setVersion (   $a_version)

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

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

◆ setVersionLanguage() [1/2]

ilMDLifecycle::setVersionLanguage (   $lng_obj)

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

110 {
111 if(is_object($lng_obj))
112 {
113 $this->version_language =& $lng_obj;
114 }
115 }

Referenced by read().

+ Here is the caller graph for this function:

◆ setVersionLanguage() [2/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 }

◆ toXML() [1/2]

ilMDLifecycle::toXML ( $writer)

Reimplemented from ilMDBase.

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

224 {
225 $writer->xmlStartTag('Lifecycle',array('Status' => $this->getStatus()
226 ? $this->getStatus()
227 : 'Draft'));
228 $writer->xmlElement('Version',array('Language' => $this->getVersionLanguageCode()
229 ? $this->getVersionLanguageCode()
230 : 'en'),
231 $this->getVersion());
232
233 // contribute
234 $contributes = $this->getContributeIds();
235 foreach($contributes as $id)
236 {
237 $con =& $this->getContribute($id);
238 $con->toXML($writer);
239 }
240 if(!count($contributes))
241 {
242 include_once 'Services/MetaData/classes/class.ilMDContribute.php';
243 $con = new ilMDContribute($this->getRBACId(),$this->getObjId());
244 $con->toXML($writer);
245 }
246 $writer->xmlEndTag('Lifecycle');
247 }

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

218 {
219 $writer->xmlStartTag('Lifecycle',array('Status' => $this->getStatus()));
220 $writer->xmlElement('Version',array('Language' => $this->getVersionLanguageCode()),$this->getVersion());
221
222 // contribute
223 foreach($this->getContributeIds() as $id)
224 {
225 $con =& $this->getContribute($id);
226 $con->toXML($writer);
227 }
228
229 $writer->xmlEndTag('Lifecycle');
230 }

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

145 {
146 global $ilDB;
147
148 if($this->getMetaId())
149 {
150 if($this->db->update('il_meta_lifecycle',
151 $this->__getFields(),
152 array("meta_lifecycle_id" => array('integer',$this->getMetaId()))))
153 {
154 return true;
155 }
156 }
157 return false;
158 }

References $ilDB, and ilMDBase\getMetaId().

+ Here is the call graph for this function:

◆ update() [2/2]

ilMDLifecycle::update ( )

Reimplemented from ilMDBase.

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

136 {
137 global $ilDB;
138
139 if($this->getMetaId())
140 {
141 if($this->db->autoExecute('il_meta_lifecycle',
142 $this->__getFields(),
143 DB_AUTOQUERY_UPDATE,
144 "meta_lifecycle_id = ".$ilDB->quote($this->getMetaId())))
145 {
146 return true;
147 }
148 }
149 return false;
150 }

References $ilDB, and ilMDBase\getMetaId().

+ Here is the call graph for this function:

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