19 declare(strict_types=1);
35 'publisher' =>
'Publisher',
36 'unknown' =>
'Unknown',
37 'initiator' =>
'Initiator',
38 'terminator' =>
'Terminator',
40 'graphical designer' =>
'GraphicalDesigner',
41 'technical implementer' =>
'TechnicalImplementer',
42 'content provider' =>
'ContentProvider',
43 'technical validator' =>
'TechnicalValidator',
44 'educational validator' =>
'EducationalValidator',
45 'script writer' =>
'ScriptWriter',
46 'instructional designer' =>
'InstructionalDesigner',
47 'subject matter expert' =>
'SubjectMatterExpert',
48 'creator' =>
'Creator',
49 'validator' =>
'Validator' 70 $ent->setMetaId($a_entity_id);
79 $ent->setParentType(
'meta_contribute');
85 public function setRole(
string $a_role): bool
94 case 'GraphicalDesigner':
95 case 'TechnicalImplementer':
96 case 'ContentProvider':
97 case 'TechnicalValidator':
98 case 'EducationalValidator':
100 case 'InstructionalDesigner':
101 case 'SubjectMatterExpert':
104 case 'PointOfContact':
105 $this->role = $a_role;
120 $this->date = $a_date;
131 $fields[
'meta_contribute_id'] = array(
'integer', $next_id = $this->db->nextId(
'il_meta_contribute'));
133 if ($this->db->insert(
'il_meta_contribute', $fields)) {
142 return $this->
getMetaId() && $this->db->update(
143 'il_meta_contribute',
145 array(
"meta_contribute_id" => array(
'integer', $this->
getMetaId()))
149 public function delete():
bool 152 $query =
"DELETE FROM il_meta_contribute " .
153 "WHERE meta_contribute_id = " . $this->db->quote($this->
getMetaId(),
'integer');
154 $res = $this->db->manipulate($query);
173 $role = (string) array_search(
175 self::ROLE_TRANSLATION
179 'rbac_id' => array(
'integer', $this->
getRBACId()),
180 'obj_id' => array(
'integer', $this->
getObjId()),
181 'obj_type' => array(
'text', $this->
getObjType()),
183 'parent_id' => array(
'integer', $this->
getParentId()),
184 'role' => array(
'text', $role),
185 'c_date' => array(
'text', $this->
getDate())
192 $query =
"SELECT * FROM il_meta_contribute " .
193 "WHERE meta_contribute_id = " . $this->db->quote($this->
getMetaId(),
'integer');
195 $res = $this->db->query($query);
200 if (key_exists($row->role ??
'', self::ROLE_TRANSLATION)) {
201 $row->role = self::ROLE_TRANSLATION[$row->role ??
''];
205 $this->
setObjId((
int) $row->obj_id);
209 $this->
setRole($row->role ??
'');
210 $this->
setDate($row->c_date ??
'');
219 'Role' => $this->
getRole() ?:
'Author' 224 foreach ($entities as
$id) {
226 $ent->toXML($writer);
228 if (!count($entities)) {
230 $ent->toXML($writer);
242 public static function _getIds(
int $a_rbac_id,
int $a_obj_id,
int $a_parent_id,
string $a_parent_type): array
246 $ilDB = $DIC[
'ilDB'];
248 $query =
"SELECT meta_contribute_id FROM il_meta_contribute " .
249 "WHERE rbac_id = " .
$ilDB->quote($a_rbac_id,
'integer') .
" " .
250 "AND obj_id = " .
$ilDB->quote($a_obj_id,
'integer') .
" " .
251 "AND parent_id = " .
$ilDB->quote($a_parent_id,
'integer') .
" " .
252 "AND parent_type = " .
$ilDB->quote($a_parent_type,
'text');
257 $ids[] = (
int) $row->meta_contribute_id;
265 public static function _lookupAuthors(
int $a_rbac_id,
int $a_obj_id,
string $a_obj_type): array
269 $ilDB = $DIC[
'ilDB'];
273 $query =
"SELECT entity,ent.parent_type,role FROM il_meta_entity ent " .
274 "JOIN il_meta_contribute con ON ent.parent_id = con.meta_contribute_id " .
275 "WHERE ent.rbac_id = " .
$ilDB->quote($a_rbac_id,
'integer') .
" " .
276 "AND ent.obj_id = " .
$ilDB->quote($a_obj_id,
'integer') .
" ";
279 if ($row->role ===
'Author' && $row->parent_type ===
'meta_contribute') {
280 $authors[] = trim($row->entity);
static _getIds(int $a_rbac_id, int $a_obj_id, int $a_parent_id, string $a_parent_type)
toXML(ilXmlWriter $writer)
xmlEndTag(string $tag)
Writes an endtag.
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
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)