ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
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 95 of file class.ilMDEntity.php.

96 {
97 return array('rbac_id' => array('integer',$this->getRBACId()),
98 'obj_id' => array('integer',$this->getObjId()),
99 'obj_type' => array('text',$this->getObjType()),
100 'parent_type' => array('text',$this->getParentType()),
101 'parent_id' => array('integer',$this->getParentId()),
102 'entity' => array('text',$this->getEntity()));
103 }

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

Referenced by save().

+ 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.

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 }
static prepareDBString($a_str)
prepare a string for db writing (insert/update)

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

+ 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 140 of file class.ilMDEntity.php.

141 {
142 global $ilDB;
143
144 $query = "SELECT meta_entity_id FROM il_meta_entity ".
145 "WHERE rbac_id = ".$ilDB->quote($a_rbac_id ,'integer')." ".
146 "AND obj_id = ".$ilDB->quote($a_obj_id ,'integer')." ".
147 "AND parent_id = ".$ilDB->quote($a_parent_id ,'integer')." ".
148 "AND parent_type = ".$ilDB->quote($a_parent_type ,'text')." ".
149 "ORDER BY meta_entity_id ";
150
151 $res = $ilDB->query($query);
152 while($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT))
153 {
154 $ids[] = $row->meta_entity_id;
155 }
156 return $ids ? $ids : array();
157 }
global $ilDB

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

Referenced by ilMDContribute\getEntityIds().

+ 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 138 of file class.ilMDEntity.php.

139 {
140 global $ilDB;
141
142 $query = "SELECT meta_entity_id FROM il_meta_entity ".
143 "WHERE rbac_id = ".$ilDB->quote($a_rbac_id)." ".
144 "AND obj_id = ".$ilDB->quote($a_obj_id)." ".
145 "AND parent_id = ".$ilDB->quote($a_parent_id)." ".
146 "AND parent_type = ".$ilDB->quote($a_parent_type);
147
148 $res = $ilDB->query($query);
149 while($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT))
150 {
151 $ids[] = $row->meta_entity_id;
152 }
153 return $ids ? $ids : array();
154 }

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

◆ delete() [1/2]

ilMDEntity::delete ( )

Reimplemented from ilMDBase.

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

78 {
79 global $ilDB;
80
81 if($this->getMetaId())
82 {
83 $query = "DELETE FROM il_meta_entity ".
84 "WHERE meta_entity_id = ".$ilDB->quote($this->getMetaId(),'integer');
85 $res = $ilDB->manipulate($query);
86
87 $this->db->query($query);
88
89 return true;
90 }
91 return false;
92 }

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

+ Here is the call graph for this function:

◆ delete() [2/2]

ilMDEntity::delete ( )

Reimplemented from ilMDBase.

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

77 {
78 global $ilDB;
79
80 if($this->getMetaId())
81 {
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 }

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

+ Here is the call graph for this function:

◆ getEntity() [1/2]

ilMDEntity::getEntity ( )

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

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

Referenced by __getFields(), and toXML().

+ 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 105 of file class.ilMDEntity.php.

106 {
107 global $ilDB;
108
109 if($this->getMetaId())
110 {
111 $query = "SELECT * FROM il_meta_entity ".
112 "WHERE meta_entity_id = ".$ilDB->quote($this->getMetaId() ,'integer');
113
114 $res = $this->db->query($query);
115 while($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT))
116 {
117 $this->setRBACId($row->rbac_id);
118 $this->setObjId($row->obj_id);
119 $this->setObjType($row->obj_type);
120 $this->setParentId($row->parent_id);
121 $this->setParentType($row->parent_type);
122 $this->setEntity($row->entity);
123 }
124 }
125 return true;
126 }
setObjId($a_id)
setParentId($a_id)
setObjType($a_type)
setRBACId($a_id)
setParentType($a_parent_type)
setEntity($a_entity)

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

+ Here is the call graph for this function:

◆ read() [2/2]

ilMDEntity::read ( )

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

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

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

+ Here is the call graph for this function:

◆ save() [1/2]

ilMDEntity::save ( )

Reimplemented from ilMDBase.

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

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 {
55 $this->setMetaId($next_id);
56 return $this->getMetaId();
57 }
58 return false;
59 }
setMetaId($a_meta_id, $a_read_data=true)

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

+ Here is the call graph for this function:

◆ save() [2/2]

ilMDEntity::save ( )

Reimplemented from ilMDBase.

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

47 {
48 if($this->db->autoExecute('il_meta_entity',
49 $this->__getFields(),
51 {
52 $this->setMetaId($this->db->getLastInsertId());
53
54 return $this->getMetaId();
55 }
56 return false;
57 }

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

+ Here is the call graph for this function:

◆ setEntity() [1/2]

ilMDEntity::setEntity (   $a_entity)

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

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

Referenced by read().

+ 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)

Reimplemented from ilMDBase.

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

134 {
135 $writer->xmlElement('Entity',null,$this->getEntity());
136 }

References getEntity().

+ Here is the call graph for this function:

◆ toXML() [2/2]

ilMDEntity::toXML ( $writer)

Reimplemented from ilMDBase.

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

132 {
133 $writer->xmlElement('Entity',null,$this->getEntity());
134 }

References getEntity().

+ Here is the call graph for this function:

◆ update() [1/2]

ilMDEntity::update ( )

Reimplemented from ilMDBase.

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

62 {
63 global $ilDB;
64
65 if($this->getMetaId())
66 {
67 if($this->db->update('il_meta_entity',
68 $this->__getFields(),
69 array("meta_entity_id" => array('integer',$this->getMetaId()))))
70 {
71 return true;
72 }
73 }
74 return false;
75 }

References $ilDB, and ilMDBase\getMetaId().

+ Here is the call graph for this function:

◆ update() [2/2]

ilMDEntity::update ( )

Reimplemented from ilMDBase.

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

60 {
61 global $ilDB;
62
63 if($this->getMetaId())
64 {
65 if($this->db->autoExecute('il_meta_entity',
66 $this->__getFields(),
68 "meta_entity_id = ".$ilDB->quote($this->getMetaId())))
69 {
70 return true;
71 }
72 }
73 return false;
74 }

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

+ Here is the call graph for this function:

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