19 declare(strict_types=1);
36 'revised' =>
'Revised',
37 'unavailable' =>
'Unavailable' 49 $subs[
'Contribute'] =
'meta_contribute';
64 if (!$a_contribute_id) {
68 $con->setMetaId($a_contribute_id);
77 $con->setParentType(
'meta_lifecycle');
90 $this->status = $a_status;
102 $this->version = $a_version;
112 $this->version_language = $lng_obj;
122 return is_object($this->version_language) ? $this->version_language->getLanguageCode() :
'';
128 $fields[
'meta_lifecycle_id'] = array(
'integer', $next_id = $this->db->nextId(
'il_meta_lifecycle'));
130 if ($this->db->insert(
'il_meta_lifecycle', $fields)) {
139 return $this->
getMetaId() && $this->db->update(
142 array(
"meta_lifecycle_id" => array(
'integer', $this->
getMetaId()))
146 public function delete():
bool 155 $query =
"DELETE FROM il_meta_lifecycle " .
156 "WHERE meta_lifecycle_id = " . $this->db->quote($this->
getMetaId(),
'integer');
157 $res = $this->db->manipulate($query);
171 $status = (string) array_search(
173 self::STATUS_TRANSLATION
177 'rbac_id' => array(
'integer', $this->
getRBACId()),
178 'obj_id' => array(
'integer', $this->
getObjId()),
179 'obj_type' => array(
'text', $this->
getObjType()),
180 'lifecycle_status' => array(
'text', $status),
181 'meta_version' => array(
'text', $this->
getVersion()),
189 $query =
"SELECT * FROM il_meta_lifecycle " .
190 "WHERE meta_lifecycle_id = " . $this->db->quote($this->
getMetaId(),
'integer');
192 $res = $this->db->query($query);
197 if (key_exists($row->lifecycle_status ??
'', self::STATUS_TRANSLATION)) {
198 $row->lifecycle_status = self::STATUS_TRANSLATION[$row->lifecycle_status ??
''];
202 $this->
setObjId((
int) $row->obj_id);
204 $this->
setStatus($row->lifecycle_status ??
'');
215 'Status' => $this->
getStatus() ?:
'Draft' 227 foreach ($contributes as
$id) {
229 $con->toXML($writer);
231 if (!count($contributes)) {
233 $con->toXML($writer);
239 public static function _getId(
int $a_rbac_id,
int $a_obj_id):
int 243 $ilDB = $DIC->database();
245 $query =
"SELECT meta_lifecycle_id FROM il_meta_lifecycle " .
246 "WHERE rbac_id = " .
$ilDB->quote($a_rbac_id,
'integer') .
" " .
247 "AND obj_id = " .
$ilDB->quote($a_obj_id,
'integer');
251 return (
int) $row->meta_lifecycle_id;
static _getIds(int $a_rbac_id, int $a_obj_id, int $a_parent_id, string $a_parent_type)
setVersion(string $a_version)
setVersionLanguage(ilMDLanguageItem $lng_obj)
getContribute(int $a_contribute_id)
const ilMDLanguageItem $version_language
xmlEndTag(string $tag)
Writes an endtag.
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
const STATUS_TRANSLATION
Compatibility fix for legacy MD classes for new db tables.
static _getId(int $a_rbac_id, int $a_obj_id)
setStatus(string $a_status)
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
xmlStartTag(string $tag, ?array $attrs=null, bool $empty=false, bool $encode=true, bool $escape=true)
Writes a starttag.
toXML(ilXmlWriter $writer)
xmlElement(string $tag, $attrs=null, $data=null, $encode=true, $escape=true)
Writes a basic element (no children, just textual content)
setMetaId(int $a_meta_id, bool $a_read_data=true)
setObjType(string $a_type)