ILIAS  release_9 Revision v9.13-25-g2c18ec4c24f
ilMDEntity Class Reference
+ Inheritance diagram for ilMDEntity:
+ Collaboration diagram for ilMDEntity:

Public Member Functions

 setEntity (string $a_entity)
 
 getEntity ()
 
 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 _getIds (int $a_rbac_id, int $a_obj_id, int $a_parent_id, string $a_parent_type)
 

Private Attributes

string $entity = ''
 

Additional Inherited Members

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

Detailed Description

Definition at line 27 of file class.ilMDEntity.php.

Member Function Documentation

◆ __getFields()

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

Definition at line 80 of file class.ilMDEntity.php.

References getEntity(), ilMDBase\getObjId(), ilMDBase\getObjType(), ilMDBase\getParentId(), ilMDBase\getParentType(), and ilMDBase\getRBACId().

Referenced by save(), and update().

80  : array
81  {
82  return array(
83  'rbac_id' => array('integer', $this->getRBACId()),
84  'obj_id' => array('integer', $this->getObjId()),
85  'obj_type' => array('text', $this->getObjType()),
86  'parent_type' => array('text', $this->getParentType()),
87  'parent_id' => array('integer', $this->getParentId()),
88  'entity' => array('text', $this->getEntity())
89  );
90  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _getIds()

static ilMDEntity::_getIds ( int  $a_rbac_id,
int  $a_obj_id,
int  $a_parent_id,
string  $a_parent_type 
)
static
Returns
int[]

Definition at line 121 of file class.ilMDEntity.php.

References $DIC, $ilDB, $res, ilDBConstants\FETCHMODE_OBJECT, and ILIAS\Repository\int().

Referenced by ilMDContribute\getEntityIds().

121  : array
122  {
123  global $DIC;
124 
125  $ilDB = $DIC->database();
126 
127  $query = "SELECT meta_entity_id FROM il_meta_entity " .
128  "WHERE rbac_id = " . $ilDB->quote($a_rbac_id, 'integer') . " " .
129  "AND obj_id = " . $ilDB->quote($a_obj_id, 'integer') . " " .
130  "AND parent_id = " . $ilDB->quote($a_parent_id, 'integer') . " " .
131  "AND parent_type = " . $ilDB->quote($a_parent_type, 'text') . " " .
132  "ORDER BY meta_entity_id ";
133 
134  $res = $ilDB->query($query);
135  $ids = [];
136  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
137  $ids[] = (int) $row->meta_entity_id;
138  }
139  return $ids;
140  }
$res
Definition: ltiservices.php:69
global $DIC
Definition: feed.php:28
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ delete()

ilMDEntity::delete ( )

Definition at line 63 of file class.ilMDEntity.php.

References $res, and ilMDBase\getMetaId().

63  : bool
64  {
65  if ($this->getMetaId()) {
66  $query = "DELETE FROM il_meta_entity " .
67  "WHERE meta_entity_id = " . $this->db->quote($this->getMetaId(), 'integer');
68  $res = $this->db->manipulate($query);
69 
70  $this->db->query($query);
71 
72  return true;
73  }
74  return false;
75  }
$res
Definition: ltiservices.php:69
+ Here is the call graph for this function:

◆ getEntity()

ilMDEntity::getEntity ( )

Definition at line 37 of file class.ilMDEntity.php.

References $entity.

Referenced by __getFields(), and toXML().

37  : string
38  {
39  return $this->entity;
40  }
+ Here is the caller graph for this function:

◆ read()

ilMDEntity::read ( )

Definition at line 92 of file class.ilMDEntity.php.

References $res, ilDBConstants\FETCHMODE_OBJECT, ilMDBase\getMetaId(), setEntity(), ilMDBase\setObjId(), ilMDBase\setObjType(), ilMDBase\setParentId(), ilMDBase\setParentType(), and ilMDBase\setRBACId().

92  : bool
93  {
94  if ($this->getMetaId()) {
95  $query = "SELECT * FROM il_meta_entity " .
96  "WHERE meta_entity_id = " . $this->db->quote($this->getMetaId(), 'integer');
97 
98  $res = $this->db->query($query);
99  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
100  $this->setRBACId((int) $row->rbac_id);
101  $this->setObjId((int) $row->obj_id);
102  $this->setObjType($row->obj_type ?? '');
103  $this->setParentId((int) $row->parent_id);
104  $this->setParentType($row->parent_type ?? '');
105  $this->setEntity($row->entity ?? '');
106  }
107  }
108  return true;
109  }
$res
Definition: ltiservices.php:69
setRBACId(int $a_id)
setObjId(int $a_id)
setEntity(string $a_entity)
setParentId(int $a_id)
setParentType(string $a_parent_type)
setObjType(string $a_type)
+ Here is the call graph for this function:

◆ save()

ilMDEntity::save ( )

Definition at line 42 of file class.ilMDEntity.php.

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

42  : int
43  {
44  $fields = $this->__getFields();
45  $fields['meta_entity_id'] = array('integer', $next_id = $this->db->nextId('il_meta_entity'));
46 
47  if ($this->db->insert('il_meta_entity', $fields)) {
48  $this->setMetaId($next_id);
49  return $this->getMetaId();
50  }
51  return 0;
52  }
setMetaId(int $a_meta_id, bool $a_read_data=true)
+ Here is the call graph for this function:

◆ setEntity()

ilMDEntity::setEntity ( string  $a_entity)

Definition at line 32 of file class.ilMDEntity.php.

Referenced by read().

32  : void
33  {
34  $this->entity = $a_entity;
35  }
+ Here is the caller graph for this function:

◆ toXML()

ilMDEntity::toXML ( ilXmlWriter  $writer)

Definition at line 111 of file class.ilMDEntity.php.

References getEntity(), and ilXmlWriter\xmlElement().

111  : void
112  {
113  $writer->xmlElement('Entity', null, $this->getEntity());
114  }
xmlElement(string $tag, $attrs=null, $data=null, $encode=true, $escape=true)
Writes a basic element (no children, just textual content)
+ Here is the call graph for this function:

◆ update()

ilMDEntity::update ( )

Definition at line 54 of file class.ilMDEntity.php.

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

54  : bool
55  {
56  return $this->getMetaId() && $this->db->update(
57  'il_meta_entity',
58  $this->__getFields(),
59  array("meta_entity_id" => array('integer', $this->getMetaId()))
60  );
61  }
+ Here is the call graph for this function:

Field Documentation

◆ $entity

string ilMDEntity::$entity = ''
private

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

Referenced by getEntity().


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