ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
ilMDEntity Class Reference
+ Inheritance diagram for ilMDEntity:
+ Collaboration diagram for ilMDEntity:

Public Member Functions

 setEntity ($a_entity)
 
 getEntity ()
 
 save ()
 
 update ()
 
 delete ()
 
 __getFields ()
 
 read ()
 
 toXML (&$writer)
 
 setEntity ($a_entity)
 
 getEntity ()
 
 save ()
 
 update ()
 
 delete ()
 
 __getFields ()
 
 read ()
 
 toXML (&$writer)
 
 _getIds ($a_rbac_id, $a_obj_id, $a_parent_id, $a_parent_type)
 
- Public Member Functions inherited from ilMDBase
 __construct ( $a_rbac_id=0, $a_obj_id=0, $a_type=0)
 
 setRBACId ($a_id)
 
 getRBACId ()
 
 setObjId ($a_id)
 
 getObjId ()
 
 setObjType ($a_type)
 
 getObjType ()
 
 setMetaId ($a_meta_id, $a_read_data=true)
 
 getMetaId ()
 
 setParentType ($a_parent_type)
 
 getParentType ()
 
 setParentId ($a_id)
 
 getParentId ()
 
 setExportMode ($a_export_mode=true)
 
 getExportMode ()
 
 validate ()
 
 update ()
 
 save ()
 
 delete ()
 
 toXML (&$writer)
 
 __construct ( $a_rbac_id=0, $a_obj_id=0, $a_type=0)
 
 setRBACId ($a_id)
 
 getRBACId ()
 
 setObjId ($a_id)
 
 getObjId ()
 
 setObjType ($a_type)
 
 getObjType ()
 
 setMetaId ($a_meta_id, $a_read_data=true)
 
 getMetaId ()
 
 setParentType ($a_parent_type)
 
 getParentType ()
 
 setParentId ($a_id)
 
 getParentId ()
 
 validate ()
 
 update ()
 
 save ()
 
 delete ()
 
 toXML (&$writer)
 

Static Public Member Functions

static _getIds ($a_rbac_id, $a_obj_id, $a_parent_id, $a_parent_type)
 

Additional Inherited Members

- Data Fields inherited from ilMDBase
 $rbac_id
 
 $obj_id
 
 $obj_type
 
 $export_mode = false
 
- Protected Attributes inherited from ilMDBase
 $log
 

Detailed Description

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

Member Function Documentation

◆ __getFields() [1/2]

ilMDEntity::__getFields ( )

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

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

Referenced by save().

94  {
95  return array('rbac_id' => array('integer',$this->getRBACId()),
96  'obj_id' => array('integer',$this->getObjId()),
97  'obj_type' => array('text',$this->getObjType()),
98  'parent_type' => array('text',$this->getParentType()),
99  'parent_id' => array('integer',$this->getParentId()),
100  'entity' => array('text',$this->getEntity()));
101  }
Create styles array
The data for the language used.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ __getFields() [2/2]

ilMDEntity::__getFields ( )

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

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

94  {
95  return array('rbac_id' => $this->getRBACId(),
96  'obj_id' => $this->getObjId(),
97  'obj_type' => ilUtil::prepareDBString($this->getObjType()),
98  'parent_type' => $this->getParentType(),
99  'parent_id' => $this->getParentId(),
100  'entity' => ilUtil::prepareDBString($this->getEntity()));
101  }
Create styles array
The data for the language used.
static prepareDBString($a_str)
prepare a string for db writing (insert/update)
+ Here is the call graph for this function:

◆ _getIds() [1/2]

static ilMDEntity::_getIds (   $a_rbac_id,
  $a_obj_id,
  $a_parent_id,
  $a_parent_type 
)
static

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

References $ilDB, $query, $res, $row, array, and ilDBConstants\FETCHMODE_OBJECT.

Referenced by ilMDContribute\getEntityIds().

137  {
138  global $ilDB;
139 
140  $query = "SELECT meta_entity_id FROM il_meta_entity " .
141  "WHERE rbac_id = " . $ilDB->quote($a_rbac_id, 'integer') . " " .
142  "AND obj_id = " . $ilDB->quote($a_obj_id, 'integer') . " " .
143  "AND parent_id = " . $ilDB->quote($a_parent_id, 'integer') . " " .
144  "AND parent_type = " . $ilDB->quote($a_parent_type, 'text') . " " .
145  "ORDER BY meta_entity_id ";
146 
147  $res = $ilDB->query($query);
148  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
149  $ids[] = $row->meta_entity_id;
150  }
151  return $ids ? $ids : array();
152  }
foreach($_POST as $key=> $value) $res
$query
Create styles array
The data for the language used.
global $ilDB
+ Here is the caller graph for this function:

◆ _getIds() [2/2]

ilMDEntity::_getIds (   $a_rbac_id,
  $a_obj_id,
  $a_parent_id,
  $a_parent_type 
)

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

References $ilDB, $query, $res, $row, array, and ilDBConstants\FETCHMODE_OBJECT.

137  {
138  global $ilDB;
139 
140  $query = "SELECT meta_entity_id FROM il_meta_entity " .
141  "WHERE rbac_id = " . $ilDB->quote($a_rbac_id) . " " .
142  "AND obj_id = " . $ilDB->quote($a_obj_id) . " " .
143  "AND parent_id = " . $ilDB->quote($a_parent_id) . " " .
144  "AND parent_type = " . $ilDB->quote($a_parent_type);
145 
146  $res = $ilDB->query($query);
147  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
148  $ids[] = $row->meta_entity_id;
149  }
150  return $ids ? $ids : array();
151  }
foreach($_POST as $key=> $value) $res
$query
Create styles array
The data for the language used.
global $ilDB

◆ delete() [1/2]

ilMDEntity::delete ( )

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

References $ilDB, $query, $res, and ilMDBase\getMetaId().

77  {
78  global $ilDB;
79 
80  if ($this->getMetaId()) {
81  $query = "DELETE FROM il_meta_entity " .
82  "WHERE meta_entity_id = " . $ilDB->quote($this->getMetaId(), 'integer');
83  $res = $ilDB->manipulate($query);
84 
85  $this->db->query($query);
86 
87  return true;
88  }
89  return false;
90  }
foreach($_POST as $key=> $value) $res
$query
global $ilDB
+ Here is the call graph for this function:

◆ delete() [2/2]

ilMDEntity::delete ( )

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

References $ilDB, $query, and ilMDBase\getMetaId().

78  {
79  global $ilDB;
80 
81  if ($this->getMetaId()) {
82  $query = "DELETE FROM il_meta_entity " .
83  "WHERE meta_entity_id = " . $ilDB->quote($this->getMetaId());
84 
85  $this->db->query($query);
86 
87  return true;
88  }
89  return false;
90  }
$query
global $ilDB
+ Here is the call graph for this function:

◆ getEntity() [1/2]

ilMDEntity::getEntity ( )

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

Referenced by __getFields(), and toXML().

42  {
43  return $this->entity;
44  }
+ Here is the caller graph for this function:

◆ getEntity() [2/2]

ilMDEntity::getEntity ( )

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

42  {
43  return $this->entity;
44  }

◆ read() [1/2]

ilMDEntity::read ( )

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

References $ilDB, $query, $res, $row, ilDBConstants\FETCHMODE_OBJECT, ilMDBase\getMetaId(), setEntity(), ilMDBase\setObjId(), ilMDBase\setObjType(), ilMDBase\setParentId(), ilMDBase\setParentType(), ilMDBase\setRBACId(), and ilUtil\stripSlashes().

104  {
105  global $ilDB;
106 
107  if ($this->getMetaId()) {
108  $query = "SELECT * FROM il_meta_entity " .
109  "WHERE meta_entity_id = " . $ilDB->quote($this->getMetaId());
110 
111  $res = $this->db->query($query);
112  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
113  $this->setRBACId($row->rbac_id);
114  $this->setObjId($row->obj_id);
115  $this->setObjType($row->obj_type);
116  $this->setParentId($row->parent_id);
117  $this->setParentType($row->parent_type);
118  $this->setEntity(ilUtil::stripSlashes($row->entity));
119  }
120  }
121  return true;
122  }
setObjType($a_type)
foreach($_POST as $key=> $value) $res
setObjId($a_id)
setRBACId($a_id)
$query
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
setParentId($a_id)
global $ilDB
setParentType($a_parent_type)
setEntity($a_entity)
+ Here is the call graph for this function:

◆ read() [2/2]

ilMDEntity::read ( )

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

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

104  {
105  global $ilDB;
106 
107  if ($this->getMetaId()) {
108  $query = "SELECT * FROM il_meta_entity " .
109  "WHERE meta_entity_id = " . $ilDB->quote($this->getMetaId(), 'integer');
110 
111  $res = $this->db->query($query);
112  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
113  $this->setRBACId($row->rbac_id);
114  $this->setObjId($row->obj_id);
115  $this->setObjType($row->obj_type);
116  $this->setParentId($row->parent_id);
117  $this->setParentType($row->parent_type);
118  $this->setEntity($row->entity);
119  }
120  }
121  return true;
122  }
setObjType($a_type)
foreach($_POST as $key=> $value) $res
setObjId($a_id)
setRBACId($a_id)
$query
setParentId($a_id)
global $ilDB
setParentType($a_parent_type)
setEntity($a_entity)
+ Here is the call graph for this function:

◆ save() [1/2]

ilMDEntity::save ( )

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

References ilMDBase\getMetaId(), ilDBConstants\MDB2_AUTOQUERY_INSERT, and ilMDBase\setMetaId().

47  {
48  if ($this->db->autoExecute(
49  'il_meta_entity',
50  $this->__getFields(),
52  )) {
53  $this->setMetaId($this->db->getLastInsertId());
54 
55  return $this->getMetaId();
56  }
57  return false;
58  }
setMetaId($a_meta_id, $a_read_data=true)
+ Here is the call graph for this function:

◆ save() [2/2]

ilMDEntity::save ( )

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

References $ilDB, __getFields(), array, ilMDBase\getMetaId(), and ilMDBase\setMetaId().

47  {
48  global $ilDB;
49 
50  $fields = $this->__getFields();
51  $fields['meta_entity_id'] = array('integer',$next_id = $ilDB->nextId('il_meta_entity'));
52 
53  if ($this->db->insert('il_meta_entity', $fields)) {
54  $this->setMetaId($next_id);
55  return $this->getMetaId();
56  }
57  return false;
58  }
setMetaId($a_meta_id, $a_read_data=true)
Create styles array
The data for the language used.
global $ilDB
+ Here is the call graph for this function:

◆ setEntity() [1/2]

ilMDEntity::setEntity (   $a_entity)

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

Referenced by read().

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

◆ setEntity() [2/2]

ilMDEntity::setEntity (   $a_entity)

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

38  {
39  $this->entity = $a_entity;
40  }

◆ toXML() [1/2]

ilMDEntity::toXML ( $writer)

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

References getEntity().

130  {
131  $writer->xmlElement('Entity', null, $this->getEntity());
132  }
+ Here is the call graph for this function:

◆ toXML() [2/2]

ilMDEntity::toXML ( $writer)

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

References getEntity().

130  {
131  $writer->xmlElement('Entity', null, $this->getEntity());
132  }
+ Here is the call graph for this function:

◆ update() [1/2]

ilMDEntity::update ( )

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

References $ilDB, ilMDBase\getMetaId(), and ilDBConstants\MDB2_AUTOQUERY_UPDATE.

61  {
62  global $ilDB;
63 
64  if ($this->getMetaId()) {
65  if ($this->db->autoExecute(
66  'il_meta_entity',
67  $this->__getFields(),
69  "meta_entity_id = " . $ilDB->quote($this->getMetaId())
70  )) {
71  return true;
72  }
73  }
74  return false;
75  }
global $ilDB
+ Here is the call graph for this function:

◆ update() [2/2]

ilMDEntity::update ( )

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

References $ilDB, array, and ilMDBase\getMetaId().

61  {
62  global $ilDB;
63 
64  if ($this->getMetaId()) {
65  if ($this->db->update(
66  'il_meta_entity',
67  $this->__getFields(),
68  array("meta_entity_id" => array('integer',$this->getMetaId()))
69  )) {
70  return true;
71  }
72  }
73  return false;
74  }
Create styles array
The data for the language used.
global $ilDB
+ Here is the call graph for this function:

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