19 declare(strict_types=1);
32 'ispartof' =>
'IsPartOf',
33 'haspart' =>
'HasPart',
34 'isversionof' =>
'IsVersionOf',
35 'hasversion' =>
'HasVersion',
36 'isformatof' =>
'IsFormatOf',
37 'hasformat' =>
'HasFormat',
38 'references' =>
'References',
39 'isreferencedby' =>
'IsReferencedBy',
40 'isbasedon' =>
'IsBasedOn',
41 'isbasisfor' =>
'IsBasisFor',
42 'requires' =>
'Requires',
43 'isrequiredby' =>
'IsRequiredBy' 60 if (!$a_identifier__id) {
64 $ide->setMetaId($a_identifier__id);
73 $ide->setParentType(
'meta_relation');
88 if (!$a_description_id) {
92 $des->setMetaId($a_description_id);
101 $des->setParentType(
'meta_relation');
117 case 'IsReferencedBy':
122 $this->kind = $a_kind;
138 $fields[
'meta_relation_id'] = array(
'integer', $next_id = $this->db->nextId(
'il_meta_relation'));
140 if ($this->db->insert(
'il_meta_relation', $fields)) {
149 return $this->
getMetaId() && $this->db->update(
152 array(
"meta_relation_id" => array(
'integer', $this->
getMetaId()))
156 public function delete():
bool 159 $query =
"DELETE FROM il_meta_relation " .
160 "WHERE meta_relation_id = " . $this->db->quote($this->
getMetaId(),
'integer');
161 $res = $this->db->manipulate($query);
185 $kind = (string) array_search(
187 self::KIND_TRANSLATION
191 'rbac_id' => array(
'integer', $this->
getRBACId()),
192 'obj_id' => array(
'integer', $this->
getObjId()),
193 'obj_type' => array(
'text', $this->
getObjType()),
194 'kind' => array(
'text', $kind)
201 $query =
"SELECT * FROM il_meta_relation " .
202 "WHERE meta_relation_id = " . $this->db->quote($this->
getMetaId(),
'integer');
204 $res = $this->db->query($query);
209 if (key_exists($row->kind ??
'', self::KIND_TRANSLATION)) {
210 $row->kind = self::KIND_TRANSLATION[$row->kind ??
''];
214 $this->
setObjId((
int) $row->obj_id);
216 $this->
setKind($row->kind ??
'');
225 'Kind' => $this->
getKind() ?:
'IsPartOf' 231 foreach ($ides as
$id) {
233 $ide->toXML($writer);
237 $ide->toXML($writer);
242 foreach ($dess as $id) {
244 $des->toXML($writer);
248 $des->toXML($writer);
260 public static function _getIds(
int $a_rbac_id,
int $a_obj_id): array
264 $ilDB = $DIC->database();
266 $query =
"SELECT meta_relation_id FROM il_meta_relation " .
267 "WHERE rbac_id = " .
$ilDB->quote($a_rbac_id,
'integer') .
" " .
268 "AND obj_id = " .
$ilDB->quote($a_obj_id,
'integer');
273 $ids[] = (
int) $row->meta_relation_id;
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
getDescription(int $a_description_id)
static _getIds(int $a_rbac_id, int $a_obj_id, int $a_parent_id, string $a_parent_type)
xmlEndTag(string $tag)
Writes an endtag.
static _getIds(int $a_rbac_id, int $a_obj_id, int $a_parent_id, string $a_parent_type)
const KIND_TRANSLATION
Compatibility fix for legacy MD classes for new db tables.
getIdentifier_(int $a_identifier__id)
toXML(ilXmlWriter $writer)
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
xmlStartTag(string $tag, ?array $attrs=null, bool $empty=false, bool $encode=true, bool $escape=true)
Writes a starttag.
setMetaId(int $a_meta_id, bool $a_read_data=true)
static _getIds(int $a_rbac_id, int $a_obj_id)
setObjType(string $a_type)