ILIAS  release_4-4 Revision
All Data Structures Namespaces Files Functions Variables Modules Pages
ilMDEntity Class Reference
+ Inheritance diagram for ilMDEntity:
+ Collaboration diagram for ilMDEntity:

Public Member Functions

 ilMDEntity ($a_rbac_id=0, $a_obj_id=0, $a_obj_type='')
 
 setEntity ($a_entity)
 
 getEntity ()
 
 save ()
 
 update ()
 
 delete ()
 
 __getFields ()
 
 read ()
 
 toXML (&$writer)
 
 _getIds ($a_rbac_id, $a_obj_id, $a_parent_id, $a_parent_type)
 
 ilMDEntity ($a_rbac_id=0, $a_obj_id=0, $a_obj_type='')
 
 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
 ilMDBase ($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)
 
 ilMDBase ($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)
 

Additional Inherited Members

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

Detailed Description

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

Member Function Documentation

◆ __getFields() [1/2]

ilMDEntity::__getFields ( )

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

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

101  {
102  return array('rbac_id' => $this->getRBACId(),
103  'obj_id' => $this->getObjId(),
104  'obj_type' => ilUtil::prepareDBString($this->getObjType()),
105  'parent_type' => $this->getParentType(),
106  'parent_id' => $this->getParentId(),
107  'entity' => ilUtil::prepareDBString($this->getEntity()));
108  }
static prepareDBString($a_str)
prepare a string for db writing (insert/update)
+ Here is the call graph for this function:

◆ __getFields() [2/2]

ilMDEntity::__getFields ( )

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

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

Referenced by save().

103  {
104  return array('rbac_id' => array('integer',$this->getRBACId()),
105  'obj_id' => array('integer',$this->getObjId()),
106  'obj_type' => array('text',$this->getObjType()),
107  'parent_type' => array('text',$this->getParentType()),
108  'parent_id' => array('integer',$this->getParentId()),
109  'entity' => array('text',$this->getEntity()));
110  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _getIds() [1/2]

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

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

References $query, $res, $row, and DB_FETCHMODE_OBJECT.

146  {
147  global $ilDB;
148 
149  $query = "SELECT meta_entity_id FROM il_meta_entity ".
150  "WHERE rbac_id = ".$ilDB->quote($a_rbac_id)." ".
151  "AND obj_id = ".$ilDB->quote($a_obj_id)." ".
152  "AND parent_id = ".$ilDB->quote($a_parent_id)." ".
153  "AND parent_type = ".$ilDB->quote($a_parent_type);
154 
155  $res = $ilDB->query($query);
156  while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
157  {
158  $ids[] = $row->meta_entity_id;
159  }
160  return $ids ? $ids : array();
161  }
const DB_FETCHMODE_OBJECT
Definition: class.ilDB.php:11

◆ _getIds() [2/2]

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

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

References $query, $res, $row, and DB_FETCHMODE_OBJECT.

Referenced by ilMDContribute\getEntityIds().

148  {
149  global $ilDB;
150 
151  $query = "SELECT meta_entity_id FROM il_meta_entity ".
152  "WHERE rbac_id = ".$ilDB->quote($a_rbac_id ,'integer')." ".
153  "AND obj_id = ".$ilDB->quote($a_obj_id ,'integer')." ".
154  "AND parent_id = ".$ilDB->quote($a_parent_id ,'integer')." ".
155  "AND parent_type = ".$ilDB->quote($a_parent_type ,'text')." ".
156  "ORDER BY meta_entity_id ";
157 
158  $res = $ilDB->query($query);
159  while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
160  {
161  $ids[] = $row->meta_entity_id;
162  }
163  return $ids ? $ids : array();
164  }
const DB_FETCHMODE_OBJECT
Definition: class.ilDB.php:11
+ Here is the caller graph for this function:

◆ delete() [1/2]

ilMDEntity::delete ( )

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

References $query, and ilMDBase\getMetaId().

84  {
85  global $ilDB;
86 
87  if($this->getMetaId())
88  {
89  $query = "DELETE FROM il_meta_entity ".
90  "WHERE meta_entity_id = ".$ilDB->quote($this->getMetaId());
91 
92  $this->db->query($query);
93 
94  return true;
95  }
96  return false;
97  }
+ Here is the call graph for this function:

◆ delete() [2/2]

ilMDEntity::delete ( )

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

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

85  {
86  global $ilDB;
87 
88  if($this->getMetaId())
89  {
90  $query = "DELETE FROM il_meta_entity ".
91  "WHERE meta_entity_id = ".$ilDB->quote($this->getMetaId(),'integer');
92  $res = $ilDB->manipulate($query);
93 
94  $this->db->query($query);
95 
96  return true;
97  }
98  return false;
99  }
+ Here is the call graph for this function:

◆ getEntity() [1/2]

ilMDEntity::getEntity ( )

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

49  {
50  return $this->entity;
51  }

◆ getEntity() [2/2]

ilMDEntity::getEntity ( )

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

Referenced by __getFields(), and toXML().

49  {
50  return $this->entity;
51  }
+ Here is the caller graph for this function:

◆ ilMDEntity() [1/2]

ilMDEntity::ilMDEntity (   $a_rbac_id = 0,
  $a_obj_id = 0,
  $a_obj_type = '' 
)

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

37  {
38  parent::ilMDBase($a_rbac_id,
39  $a_obj_id,
40  $a_obj_type);
41  }

◆ ilMDEntity() [2/2]

ilMDEntity::ilMDEntity (   $a_rbac_id = 0,
  $a_obj_id = 0,
  $a_obj_type = '' 
)

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

37  {
38  parent::ilMDBase($a_rbac_id,
39  $a_obj_id,
40  $a_obj_type);
41  }

◆ read() [1/2]

ilMDEntity::read ( )

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

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

111  {
112  global $ilDB;
113 
114  if($this->getMetaId())
115  {
116  $query = "SELECT * FROM il_meta_entity ".
117  "WHERE meta_entity_id = ".$ilDB->quote($this->getMetaId());
118 
119  $res = $this->db->query($query);
120  while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
121  {
122  $this->setRBACId($row->rbac_id);
123  $this->setObjId($row->obj_id);
124  $this->setObjType($row->obj_type);
125  $this->setParentId($row->parent_id);
126  $this->setParentType($row->parent_type);
127  $this->setEntity(ilUtil::stripSlashes($row->entity));
128  }
129  }
130  return true;
131  }
setObjType($a_type)
const DB_FETCHMODE_OBJECT
Definition: class.ilDB.php:11
setObjId($a_id)
setRBACId($a_id)
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
setParentId($a_id)
setParentType($a_parent_type)
setEntity($a_entity)
+ Here is the call graph for this function:

◆ read() [2/2]

ilMDEntity::read ( )

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

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

113  {
114  global $ilDB;
115 
116  if($this->getMetaId())
117  {
118  $query = "SELECT * FROM il_meta_entity ".
119  "WHERE meta_entity_id = ".$ilDB->quote($this->getMetaId() ,'integer');
120 
121  $res = $this->db->query($query);
122  while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
123  {
124  $this->setRBACId($row->rbac_id);
125  $this->setObjId($row->obj_id);
126  $this->setObjType($row->obj_type);
127  $this->setParentId($row->parent_id);
128  $this->setParentType($row->parent_type);
129  $this->setEntity($row->entity);
130  }
131  }
132  return true;
133  }
setObjType($a_type)
const DB_FETCHMODE_OBJECT
Definition: class.ilDB.php:11
setObjId($a_id)
setRBACId($a_id)
setParentId($a_id)
setParentType($a_parent_type)
setEntity($a_entity)
+ Here is the call graph for this function:

◆ save() [1/2]

ilMDEntity::save ( )

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

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

54  {
55  global $ilDB;
56 
57  $fields = $this->__getFields();
58  $fields['meta_entity_id'] = array('integer',$next_id = $ilDB->nextId('il_meta_entity'));
59 
60  if($this->db->insert('il_meta_entity',$fields))
61  {
62  $this->setMetaId($next_id);
63  return $this->getMetaId();
64  }
65  return false;
66  }
setMetaId($a_meta_id, $a_read_data=true)
+ Here is the call graph for this function:

◆ save() [2/2]

ilMDEntity::save ( )

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

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

54  {
55  if($this->db->autoExecute('il_meta_entity',
56  $this->__getFields(),
57  DB_AUTOQUERY_INSERT))
58  {
59  $this->setMetaId($this->db->getLastInsertId());
60 
61  return $this->getMetaId();
62  }
63  return false;
64  }
setMetaId($a_meta_id, $a_read_data=true)
+ Here is the call graph for this function:

◆ setEntity() [1/2]

ilMDEntity::setEntity (   $a_entity)

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

Referenced by read().

45  {
46  $this->entity = $a_entity;
47  }
+ Here is the caller graph for this function:

◆ setEntity() [2/2]

ilMDEntity::setEntity (   $a_entity)

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

45  {
46  $this->entity = $a_entity;
47  }

◆ toXML() [1/2]

ilMDEntity::toXML ( $writer)

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

References getEntity().

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

◆ toXML() [2/2]

ilMDEntity::toXML ( $writer)

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

References getEntity().

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

◆ update() [1/2]

ilMDEntity::update ( )

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

References ilMDBase\getMetaId().

67  {
68  global $ilDB;
69 
70  if($this->getMetaId())
71  {
72  if($this->db->autoExecute('il_meta_entity',
73  $this->__getFields(),
74  DB_AUTOQUERY_UPDATE,
75  "meta_entity_id = ".$ilDB->quote($this->getMetaId())))
76  {
77  return true;
78  }
79  }
80  return false;
81  }
+ Here is the call graph for this function:

◆ update() [2/2]

ilMDEntity::update ( )

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

References ilMDBase\getMetaId().

69  {
70  global $ilDB;
71 
72  if($this->getMetaId())
73  {
74  if($this->db->update('il_meta_entity',
75  $this->__getFields(),
76  array("meta_entity_id" => array('integer',$this->getMetaId()))))
77  {
78  return true;
79  }
80  }
81  return false;
82  }
+ Here is the call graph for this function:

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