19 declare(strict_types=1);
34 'publisher' =>
'Publisher',
35 'unknown' =>
'Unknown',
36 'initiator' =>
'Initiator',
37 'terminator' =>
'Terminator',
39 'graphical designer' =>
'GraphicalDesigner',
40 'technical implementer' =>
'TechnicalImplementer',
41 'content provider' =>
'ContentProvider',
42 'technical validator' =>
'TechnicalValidator',
43 'educational validator' =>
'EducationalValidator',
44 'script writer' =>
'ScriptWriter',
45 'instructional designer' =>
'InstructionalDesigner',
46 'subject matter expert' =>
'SubjectMatterExpert',
47 'creator' =>
'Creator',
48 'validator' =>
'Validator' 69 $ent->setMetaId($a_entity_id);
78 $ent->setParentType(
'meta_contribute');
84 public function setRole(
string $a_role): bool
93 case 'GraphicalDesigner':
94 case 'TechnicalImplementer':
95 case 'ContentProvider':
96 case 'TechnicalValidator':
97 case 'EducationalValidator':
99 case 'InstructionalDesigner':
100 case 'SubjectMatterExpert':
103 case 'PointOfContact':
104 $this->role = $a_role;
119 $this->date = $a_date;
130 $fields[
'meta_contribute_id'] = array(
'integer', $next_id = $this->db->nextId(
'il_meta_contribute'));
132 if ($this->db->insert(
'il_meta_contribute', $fields)) {
141 return $this->
getMetaId() && $this->db->update(
142 'il_meta_contribute',
144 array(
"meta_contribute_id" => array(
'integer', $this->
getMetaId()))
148 public function delete():
bool 151 $query =
"DELETE FROM il_meta_contribute " .
152 "WHERE meta_contribute_id = " . $this->db->quote($this->
getMetaId(),
'integer');
153 $res = $this->db->manipulate($query);
172 $role = (string) array_search(
174 self::ROLE_TRANSLATION
178 'rbac_id' => array(
'integer', $this->
getRBACId()),
179 'obj_id' => array(
'integer', $this->
getObjId()),
180 'obj_type' => array(
'text', $this->
getObjType()),
182 'parent_id' => array(
'integer', $this->
getParentId()),
183 'role' => array(
'text', $role),
184 'c_date' => array(
'text', $this->
getDate())
191 $query =
"SELECT * FROM il_meta_contribute " .
192 "WHERE meta_contribute_id = " . $this->db->quote($this->
getMetaId(),
'integer');
194 $res = $this->db->query($query);
199 if (key_exists($row->role ??
'', self::ROLE_TRANSLATION)) {
200 $row->role = self::ROLE_TRANSLATION[$row->role ??
''];
204 $this->
setObjId((
int) $row->obj_id);
208 $this->
setRole($row->role ??
'');
209 $this->
setDate($row->c_date ??
'');
218 'Role' => $this->
getRole() ?:
'Author' 223 foreach ($entities as
$id) {
225 $ent->toXML($writer);
227 if (!count($entities)) {
229 $ent->toXML($writer);
241 public static function _getIds(
int $a_rbac_id,
int $a_obj_id,
int $a_parent_id,
string $a_parent_type): array
245 $ilDB = $DIC[
'ilDB'];
247 $query =
"SELECT meta_contribute_id FROM il_meta_contribute " .
248 "WHERE rbac_id = " .
$ilDB->quote($a_rbac_id,
'integer') .
" " .
249 "AND obj_id = " .
$ilDB->quote($a_obj_id,
'integer') .
" " .
250 "AND parent_id = " .
$ilDB->quote($a_parent_id,
'integer') .
" " .
251 "AND parent_type = " .
$ilDB->quote($a_parent_type,
'text');
256 $ids[] = (
int) $row->meta_contribute_id;
264 public static function _lookupAuthors(
int $a_rbac_id,
int $a_obj_id,
string $a_obj_type): array
268 $ilDB = $DIC[
'ilDB'];
272 $query =
"SELECT entity,ent.parent_type,role FROM il_meta_entity ent " .
273 "JOIN il_meta_contribute con ON ent.parent_id = con.meta_contribute_id " .
274 "WHERE ent.rbac_id = " .
$ilDB->quote($a_rbac_id,
'integer') .
" " .
275 "AND ent.obj_id = " .
$ilDB->quote($a_obj_id,
'integer') .
" ";
278 if ($row->role ===
'Author' && $row->parent_type ===
'meta_contribute') {
279 $authors[] = trim($row->entity);
static _getIds(int $a_rbac_id, int $a_obj_id, int $a_parent_id, string $a_parent_type)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
toXML(ilXmlWriter $writer)
xmlEndTag(string $tag)
Writes an endtag.
getEntity(int $a_entity_id)
static _lookupAuthors(int $a_rbac_id, int $a_obj_id, string $a_obj_type)
const ROLE_TRANSLATION
Compatibility fix for legacy MD classes for new db tables.
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
xmlStartTag(string $tag, ?array $attrs=null, bool $empty=false, bool $encode=true, bool $escape=true)
Writes a starttag.
setParentType(string $a_parent_type)
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)
static _getIds(int $a_rbac_id, int $a_obj_id, int $a_parent_id, string $a_parent_type)