ILIAS  trunk Revision v11.0_alpha-1866-gfa368f7776e
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
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 28 of file class.ilMDEntity.php.

Member Function Documentation

◆ __getFields()

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

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

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

Referenced by save(), and update().

81  : array
82  {
83  return array(
84  'rbac_id' => array('integer', $this->getRBACId()),
85  'obj_id' => array('integer', $this->getObjId()),
86  'obj_type' => array('text', $this->getObjType()),
87  'parent_type' => array('text', $this->getParentType()),
88  'parent_id' => array('integer', $this->getParentId()),
89  'entity' => array('text', $this->getEntity())
90  );
91  }
+ 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 122 of file class.ilMDEntity.php.

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

Referenced by ilMDContribute\getEntityIds().

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

◆ delete()

ilMDEntity::delete ( )

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

References $res, and ilMDBase\getMetaId().

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

◆ getEntity()

ilMDEntity::getEntity ( )

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

References $entity.

Referenced by __getFields(), and toXML().

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

◆ read()

ilMDEntity::read ( )

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

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

93  : bool
94  {
95  if ($this->getMetaId()) {
96  $query = "SELECT * FROM il_meta_entity " .
97  "WHERE meta_entity_id = " . $this->db->quote($this->getMetaId(), 'integer');
98 
99  $res = $this->db->query($query);
100  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
101  $this->setRBACId((int) $row->rbac_id);
102  $this->setObjId((int) $row->obj_id);
103  $this->setObjType($row->obj_type ?? '');
104  $this->setParentId((int) $row->parent_id);
105  $this->setParentType($row->parent_type ?? '');
106  $this->setEntity($row->entity ?? '');
107  }
108  }
109  return true;
110  }
$res
Definition: ltiservices.php:66
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 43 of file class.ilMDEntity.php.

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

43  : int
44  {
45  $fields = $this->__getFields();
46  $fields['meta_entity_id'] = array('integer', $next_id = $this->db->nextId('il_meta_entity'));
47 
48  if ($this->db->insert('il_meta_entity', $fields)) {
49  $this->setMetaId($next_id);
50  return $this->getMetaId();
51  }
52  return 0;
53  }
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 33 of file class.ilMDEntity.php.

Referenced by read().

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

◆ toXML()

ilMDEntity::toXML ( ilXmlWriter  $writer)

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

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

112  : void
113  {
114  $writer->xmlElement('Entity', null, $this->getEntity());
115  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
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 55 of file class.ilMDEntity.php.

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

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

Field Documentation

◆ $entity

string ilMDEntity::$entity = ''
private

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

Referenced by getEntity().


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