ILIAS  release_8 Revision v8.24
ilMDLifecycle Class Reference
+ Inheritance diagram for ilMDLifecycle:
+ Collaboration diagram for ilMDLifecycle:

Public Member Functions

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

Static Public Member Functions

static _getId (int $a_rbac_id, int $a_obj_id)
 

Private Attributes

ilMDLanguageItem $version_language = null
 
string $version = ""
 
string $status = ""
 

Additional Inherited Members

- Protected Attributes inherited from ilMDBase
ilLogger $log
 
ilDBInterface $db
 

Detailed Description

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

Member Function Documentation

◆ __getFields()

ilMDLifecycle::__getFields ( )
Returns
array<string, array<string, mixed>>

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

154 : array
155 {
156 return array(
157 'rbac_id' => array('integer', $this->getRBACId()),
158 'obj_id' => array('integer', $this->getObjId()),
159 'obj_type' => array('text', $this->getObjType()),
160 'lifecycle_status' => array('text', $this->getStatus()),
161 'meta_version' => array('text', $this->getVersion()),
162 'version_language' => array('text', $this->getVersionLanguageCode())
163 );
164 }

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

Referenced by save(), and update().

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

◆ _getId()

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

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

212 : int
213 {
214 global $DIC;
215
216 $ilDB = $DIC->database();
217
218 $query = "SELECT meta_lifecycle_id FROM il_meta_lifecycle " .
219 "WHERE rbac_id = " . $ilDB->quote($a_rbac_id, 'integer') . " " .
220 "AND obj_id = " . $ilDB->quote($a_obj_id, 'integer');
221
222 $res = $ilDB->query($query);
223 while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
224 return (int) $row->meta_lifecycle_id;
225 }
226 return 0;
227 }
global $DIC
Definition: feed.php:28
$res
Definition: ltiservices.php:69
$query

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

Referenced by ilMD\getLifecycle().

+ Here is the caller graph for this function:

◆ addContribute()

ilMDLifecycle::addContribute ( )

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

62 {
63 $con = new ilMDContribute($this->getRBACId(), $this->getObjId(), $this->getObjType());
64 $con->setParentId($this->getMetaId());
65 $con->setParentType('meta_lifecycle');
66
67 return $con;
68 }

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

+ Here is the call graph for this function:

◆ delete()

ilMDLifecycle::delete ( )

Reimplemented from ilMDBase.

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

134 : bool
135 {
136 // Delete 'contribute'
137 foreach ($this->getContributeIds() as $id) {
138 $con = $this->getContribute($id);
139 $con->delete();
140 }
141
142 if ($this->getMetaId()) {
143 $query = "DELETE FROM il_meta_lifecycle " .
144 "WHERE meta_lifecycle_id = " . $this->db->quote($this->getMetaId(), 'integer');
145 $res = $this->db->manipulate($query);
146 return true;
147 }
148 return false;
149 }
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
getContribute(int $a_contribute_id)

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

+ Here is the call graph for this function:

◆ getContribute()

ilMDLifecycle::getContribute ( int  $a_contribute_id)

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

51 {
52 if (!$a_contribute_id) {
53 return null;
54 }
55 $con = new ilMDContribute();
56 $con->setMetaId($a_contribute_id);
57
58 return $con;
59 }

Referenced by delete(), and toXML().

+ Here is the caller graph for this function:

◆ getContributeIds()

ilMDLifecycle::getContributeIds ( )
Returns
int[]

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

45 : array
46 {
47 return ilMDContribute::_getIds($this->getRBACId(), $this->getObjId(), $this->getMetaId(), 'meta_lifecycle');
48 }
static _getIds(int $a_rbac_id, int $a_obj_id, int $a_parent_id, string $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:

◆ getPossibleSubelements()

ilMDLifecycle::getPossibleSubelements ( )
Returns
array<string, string>

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

35 : array
36 {
37 $subs['Contribute'] = 'meta_contribute';
38
39 return $subs;
40 }

◆ getStatus()

ilMDLifecycle::getStatus ( )

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

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

References $status.

Referenced by __getFields(), and toXML().

+ Here is the caller graph for this function:

◆ getVersion()

ilMDLifecycle::getVersion ( )

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

93 : string
94 {
95 return $this->version;
96 }

References $version.

Referenced by __getFields(), and toXML().

+ Here is the caller graph for this function:

◆ getVersionLanguage()

ilMDLifecycle::getVersionLanguage ( )

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

References $version_language.

◆ getVersionLanguageCode()

ilMDLifecycle::getVersionLanguageCode ( )

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

108 : string
109 {
110 return is_object($this->version_language) ? $this->version_language->getLanguageCode() : '';
111 }

Referenced by __getFields(), and toXML().

+ Here is the caller graph for this function:

◆ read()

ilMDLifecycle::read ( )

Reimplemented from ilMDBase.

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

166 : bool
167 {
168 if ($this->getMetaId()) {
169 $query = "SELECT * FROM il_meta_lifecycle " .
170 "WHERE meta_lifecycle_id = " . $this->db->quote($this->getMetaId(), 'integer');
171
172 $res = $this->db->query($query);
173 while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
174 $this->setRBACId((int) $row->rbac_id);
175 $this->setObjId((int) $row->obj_id);
176 $this->setObjType($row->obj_type);
177 $this->setStatus((string) $row->lifecycle_status);
178 $this->setVersion((string) $row->meta_version);
179 $this->setVersionLanguage(new ilMDLanguageItem((string) $row->version_language));
180 }
181 }
182 return true;
183 }
setObjType(string $a_type)
setObjId(int $a_id)
setRBACId(int $a_id)
setVersionLanguage(ilMDLanguageItem $lng_obj)
setVersion(string $a_version)
setStatus(string $a_status)

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

◆ save()

ilMDLifecycle::save ( )

Reimplemented from ilMDBase.

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

113 : int
114 {
115 $fields = $this->__getFields();
116 $fields['meta_lifecycle_id'] = array('integer', $next_id = $this->db->nextId('il_meta_lifecycle'));
117
118 if ($this->db->insert('il_meta_lifecycle', $fields)) {
119 $this->setMetaId($next_id);
120 return $this->getMetaId();
121 }
122 return 0;
123 }
setMetaId(int $a_meta_id, bool $a_read_data=true)

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

+ Here is the call graph for this function:

◆ setStatus()

ilMDLifecycle::setStatus ( string  $a_status)

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

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

Referenced by read().

+ Here is the caller graph for this function:

◆ setVersion()

ilMDLifecycle::setVersion ( string  $a_version)

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

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

Referenced by read().

+ Here is the caller graph for this function:

◆ setVersionLanguage()

ilMDLifecycle::setVersionLanguage ( ilMDLanguageItem  $lng_obj)

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

98 : void
99 {
100 $this->version_language = $lng_obj;
101 }

Referenced by read().

+ Here is the caller graph for this function:

◆ toXML()

ilMDLifecycle::toXML ( ilXmlWriter  $writer)

Reimplemented from ilMDBase.

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

185 : void
186 {
187 $writer->xmlStartTag('Lifecycle', array(
188 'Status' => $this->getStatus() ?: 'Draft'
189 ));
190 $writer->xmlElement(
191 'Version',
192 array(
193 'Language' => $this->getVersionLanguageCode() ?: 'en'
194 ),
195 $this->getVersion()
196 );
197
198 // contribute
199 $contributes = $this->getContributeIds();
200 foreach ($contributes as $id) {
201 $con = $this->getContribute($id);
202 $con->toXML($writer);
203 }
204 if (!count($contributes)) {
205 $con = new ilMDContribute($this->getRBACId(), $this->getObjId());
206 $con->toXML($writer);
207 }
208 $writer->xmlEndTag('Lifecycle');
209 }
xmlElement(string $tag, $attrs=null, $data=null, $encode=true, $escape=true)
Writes a basic element (no children, just textual content)
xmlEndTag(string $tag)
Writes an endtag.
xmlStartTag(string $tag, ?array $attrs=null, bool $empty=false, bool $encode=true, bool $escape=true)
Writes a starttag.

References $id, getContribute(), getContributeIds(), ilMDBase\getObjId(), ilMDBase\getRBACId(), getStatus(), getVersion(), getVersionLanguageCode(), ilXmlWriter\xmlElement(), ilXmlWriter\xmlEndTag(), and ilXmlWriter\xmlStartTag().

+ Here is the call graph for this function:

◆ update()

ilMDLifecycle::update ( )

Reimplemented from ilMDBase.

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

125 : bool
126 {
127 return $this->getMetaId() && $this->db->update(
128 'il_meta_lifecycle',
129 $this->__getFields(),
130 array("meta_lifecycle_id" => array('integer', $this->getMetaId()))
131 );
132 }

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

+ Here is the call graph for this function:

Field Documentation

◆ $status

string ilMDLifecycle::$status = ""
private

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

Referenced by getStatus().

◆ $version

string ilMDLifecycle::$version = ""
private

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

Referenced by getVersion().

◆ $version_language

ilMDLanguageItem ilMDLifecycle::$version_language = null
private

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

Referenced by getVersionLanguage().


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