ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
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 170 of file class.ilMDLifecycle.php.

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 }

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

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 }
$query
foreach($_POST as $key=> $value) $res
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 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, $row, 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 149 of file class.ilMDLifecycle.php.

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 }
& getContribute($a_contribute_id)
if(!array_key_exists('StateId', $_REQUEST)) $id

References $id, $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 $id, $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 }

References $version.

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 }

References $version.

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

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 }
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 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, $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 119 of file class.ilMDLifecycle.php.

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

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 }

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

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 }

References $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, 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: