ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
ilMDContribute Class Reference
+ Inheritance diagram for ilMDContribute:
+ Collaboration diagram for ilMDContribute:

Public Member Functions

 ilMDContribute ($a_rbac_id=0, $a_obj_id=0, $a_obj_type='')
 
getEntityIds ()
 
getEntity ($a_entity_id)
 
addEntity ()
 
 setRole ($a_role)
 
 getRole ()
 
 setDate ($a_date)
 
 getDate ()
 
 save ()
 
 update ()
 
 delete ()
 
 __getFields ()
 
 read ()
 
 toXML (&$writer)
 
 _getIds ($a_rbac_id, $a_obj_id, $a_parent_id, $a_parent_type)
 
 ilMDContribute ($a_rbac_id=0, $a_obj_id=0, $a_obj_type='')
 
getEntityIds ()
 
getEntity ($a_entity_id)
 
addEntity ()
 
 setRole ($a_role)
 
 getRole ()
 
 setDate ($a_date)
 
 getDate ()
 
 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)
 

Static Public Member Functions

static _lookupAuthors ($a_rbac_id, $a_obj_id, $a_obj_type)
 Lookup authors. More...
 

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.ilMDContribute.php.

Member Function Documentation

◆ __getFields() [1/2]

ilMDContribute::__getFields ( )

Definition at line 170 of file class.ilMDContribute.php.

171 {
172 return array('rbac_id' => array('integer',$this->getRBACId()),
173 'obj_id' => array('integer',$this->getObjId()),
174 'obj_type' => array('text',$this->getObjType()),
175 'parent_type' => array('text',$this->getParentType()),
176 'parent_id' => array('integer',$this->getParentId()),
177 'role' => array('text',$this->getRole()),
178 'c_date' => array('text',$this->getDate()));
179 }

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

Referenced by save().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ __getFields() [2/2]

ilMDContribute::__getFields ( )

Definition at line 169 of file class.ilMDContribute.php.

170 {
171 return array('rbac_id' => $this->getRBACId(),
172 'obj_id' => $this->getObjId(),
173 'obj_type' => ilUtil::prepareDBString($this->getObjType()),
174 'parent_type' => $this->getParentType(),
175 'parent_id' => $this->getParentId(),
176 'role' => ilUtil::prepareDBString($this->getRole()),
177 'date' => ilUtil::prepareDBString($this->getDate()));
178 }
static prepareDBString($a_str)
prepare a string for db writing (insert/update)

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

+ Here is the call graph for this function:

◆ _getIds() [1/2]

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

Definition at line 238 of file class.ilMDContribute.php.

239 {
240 global $ilDB;
241
242 $query = "SELECT meta_contribute_id FROM il_meta_contribute ".
243 "WHERE rbac_id = ".$ilDB->quote($a_rbac_id ,'integer')." ".
244 "AND obj_id = ".$ilDB->quote($a_obj_id ,'integer')." ".
245 "AND parent_id = ".$ilDB->quote($a_parent_id ,'integer')." ".
246 "AND parent_type = ".$ilDB->quote($a_parent_type ,'text');
247
248 $res = $ilDB->query($query);
249 while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
250 {
251 $ids[] = $row->meta_contribute_id;
252 }
253 return $ids ? $ids : array();
254 }
const DB_FETCHMODE_OBJECT
Definition: class.ilDB.php:11
global $ilDB

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

Referenced by ilMDLifecycle\getContributeIds(), and ilMDMetaMetadata\getContributeIds().

+ Here is the caller graph for this function:

◆ _getIds() [2/2]

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

Definition at line 227 of file class.ilMDContribute.php.

228 {
229 global $ilDB;
230
231 $query = "SELECT meta_contribute_id FROM il_meta_contribute ".
232 "WHERE rbac_id = ".$ilDB->quote($a_rbac_id)." ".
233 "AND obj_id = ".$ilDB->quote($a_obj_id)." ".
234 "AND parent_id = ".$ilDB->quote($a_parent_id)." ".
235 "AND parent_type = ".$ilDB->quote($a_parent_type);
236
237 $res = $ilDB->query($query);
238 while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
239 {
240 $ids[] = $row->meta_contribute_id;
241 }
242 return $ids ? $ids : array();
243 }

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

◆ _lookupAuthors()

static ilMDContribute::_lookupAuthors (   $a_rbac_id,
  $a_obj_id,
  $a_obj_type 
)
static

Lookup authors.

@access public

Parameters
intrbac_id
intobj_id
stringobj_type
Returns
array string authors

Definition at line 267 of file class.ilMDContribute.php.

268 {
269 global $ilDB;
270
271 // Ask for 'author' later to use indexes
272 $query = "SELECT entity,ent.parent_type,role FROM il_meta_entity ent ".
273 "JOIN il_meta_contribute con ON ent.parent_id = con.meta_contribute_id ".
274 "WHERE ent.rbac_id = ".$ilDB->quote($a_rbac_id ,'integer')." ".
275 "AND ent.obj_id = ".$ilDB->quote($a_obj_id ,'integer')." ";
276 $res = $ilDB->query($query);
277 while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
278 {
279 if($row->role == 'Author' and $row->parent_type == 'meta_contribute')
280 {
281 $authors[] = trim($row->entity);
282 }
283 }
284 return $authors ? $authors : array();
285 }

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

Referenced by ilMDUtils\_fillHTMLMetaTags().

+ Here is the caller graph for this function:

◆ addEntity() [1/2]

& ilMDContribute::addEntity ( )

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

65 {
66 include_once 'Services/MetaData/classes/class.ilMDEntity.php';
67
68 $ent = new ilMDEntity($this->getRBACId(),$this->getObjId(),$this->getObjType());
69 $ent->setParentId($this->getMetaId());
70 $ent->setParentType('meta_contribute');
71
72 return $ent;
73 }

References ilMDBase\getMetaId(), ilMDBase\getObjId(), ilMDBase\getObjType(), and ilMDBase\getRBACId().

+ Here is the call graph for this function:

◆ addEntity() [2/2]

& ilMDContribute::addEntity ( )

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

65 {
66 include_once 'Services/Migration/DBUpdate_426/classes/class.ilMDEntity.php';
67
68 $ent =& new ilMDEntity($this->getRBACId(),$this->getObjId(),$this->getObjType());
69 $ent->setParentId($this->getMetaId());
70 $ent->setParentType('meta_contribute');
71
72 return $ent;
73 }

References ilMDBase\getMetaId(), ilMDBase\getObjId(), ilMDBase\getObjType(), and ilMDBase\getRBACId().

+ Here is the call graph for this function:

◆ delete() [1/2]

ilMDContribute::delete ( )

Reimplemented from ilMDBase.

Definition at line 149 of file class.ilMDContribute.php.

150 {
151 global $ilDB;
152
153 if($this->getMetaId())
154 {
155 $query = "DELETE FROM il_meta_contribute ".
156 "WHERE meta_contribute_id = ".$ilDB->quote($this->getMetaId() ,'integer');
157 $res = $ilDB->manipulate($query);
158
159 foreach($this->getEntityIds() as $id)
160 {
161 $ent = $this->getEntity($id);
162 $ent->delete();
163 }
164 return true;
165 }
166 return false;
167 }
& getEntity($a_entity_id)

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

+ Here is the call graph for this function:

◆ delete() [2/2]

ilMDContribute::delete ( )

Reimplemented from ilMDBase.

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

148 {
149 global $ilDB;
150
151 if($this->getMetaId())
152 {
153 $query = "DELETE FROM il_meta_contribute ".
154 "WHERE meta_contribute_id = ".$ilDB->quote($this->getMetaId());
155
156 $this->db->query($query);
157
158 foreach($this->getEntityIds() as $id)
159 {
160 $ent =& $this->getEntity($id);
161 $ent->delete();
162 }
163 return true;
164 }
165 return false;
166 }

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

+ Here is the call graph for this function:

◆ getDate() [1/2]

ilMDContribute::getDate ( )

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

113 {
114 return $this->date;
115 }

Referenced by __getFields(), and toXML().

+ Here is the caller graph for this function:

◆ getDate() [2/2]

ilMDContribute::getDate ( )

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

112 {
113 return $this->date;
114 }

◆ getEntity() [1/2]

& ilMDContribute::getEntity (   $a_entity_id)

Definition at line 51 of file class.ilMDContribute.php.

52 {
53 include_once 'Services/MetaData/classes/class.ilMDEntity.php';
54
55 if(!$a_entity_id)
56 {
57 return false;
58 }
59 $ent =& new ilMDEntity();
60 $ent->setMetaId($a_entity_id);
61
62 return $ent;
63 }

Referenced by delete(), and toXML().

+ Here is the caller graph for this function:

◆ getEntity() [2/2]

& ilMDContribute::getEntity (   $a_entity_id)

Definition at line 51 of file class.ilMDContribute.php.

52 {
53 include_once 'Services/Migration/DBUpdate_426/classes/class.ilMDEntity.php';
54
55 if(!$a_entity_id)
56 {
57 return false;
58 }
59 $ent =& new ilMDEntity();
60 $ent->setMetaId($a_entity_id);
61
62 return $ent;
63 }

◆ getEntityIds() [1/2]

& ilMDContribute::getEntityIds ( )

Definition at line 45 of file class.ilMDContribute.php.

46 {
47 include_once 'Services/MetaData/classes/class.ilMDEntity.php';
48
49 return ilMDEntity::_getIds($this->getRBACId(),$this->getObjId(),$this->getMetaId(),'meta_contribute');
50 }
_getIds($a_rbac_id, $a_obj_id, $a_parent_id, $a_parent_type)

References ilMDEntity\_getIds(), ilMDBase\getMetaId(), ilMDBase\getObjId(), and ilMDBase\getRBACId().

Referenced by delete(), and toXML().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getEntityIds() [2/2]

& ilMDContribute::getEntityIds ( )

Definition at line 45 of file class.ilMDContribute.php.

46 {
47 include_once 'Services/Migration/DBUpdate_426/classes/class.ilMDEntity.php';
48
49 return ilMDEntity::_getIds($this->getRBACId(),$this->getObjId(),$this->getMetaId(),'meta_contribute');
50 }

References ilMDEntity\_getIds(), ilMDBase\getMetaId(), ilMDBase\getObjId(), and ilMDBase\getRBACId().

+ Here is the call graph for this function:

◆ getRole() [1/2]

ilMDContribute::getRole ( )

Definition at line 104 of file class.ilMDContribute.php.

105 {
106 return $this->role;
107 }

Referenced by __getFields(), and toXML().

+ Here is the caller graph for this function:

◆ getRole() [2/2]

ilMDContribute::getRole ( )

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

104 {
105 return $this->role;
106 }

◆ ilMDContribute() [1/2]

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

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

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

◆ ilMDContribute() [2/2]

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

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

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

◆ read() [1/2]

ilMDContribute::read ( )

Definition at line 181 of file class.ilMDContribute.php.

182 {
183 global $ilDB;
184
185 include_once 'Services/MetaData/classes/class.ilMDLanguageItem.php';
186
187 if($this->getMetaId())
188 {
189 $query = "SELECT * FROM il_meta_contribute ".
190 "WHERE meta_contribute_id = ".$ilDB->quote($this->getMetaId() ,'integer');
191
192 $res = $this->db->query($query);
193 while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
194 {
195 $this->setRBACId($row->rbac_id);
196 $this->setObjId($row->obj_id);
197 $this->setObjType($row->obj_type);
198 $this->setParentId($row->parent_id);
199 $this->setParentType($row->parent_type);
200 $this->setRole($row->role);
201 $this->setDate($row->c_date);
202 }
203 }
204 return true;
205 }
setObjId($a_id)
setParentId($a_id)
setObjType($a_type)
setRBACId($a_id)
setParentType($a_parent_type)

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

+ Here is the call graph for this function:

◆ read() [2/2]

ilMDContribute::read ( )

Definition at line 180 of file class.ilMDContribute.php.

181 {
182 global $ilDB;
183
184 include_once 'Services/Migration/DBUpdate_426/classes/class.ilMDLanguageItem.php';
185
186 if($this->getMetaId())
187 {
188 $query = "SELECT * FROM il_meta_contribute ".
189 "WHERE meta_contribute_id = ".$ilDB->quote($this->getMetaId());
190
191 $res = $this->db->query($query);
192 while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
193 {
194 $this->setRBACId($row->rbac_id);
195 $this->setObjId($row->obj_id);
196 $this->setObjType($row->obj_type);
197 $this->setParentId($row->parent_id);
198 $this->setParentType($row->parent_type);
199 $this->setRole(ilUtil::stripSlashes($row->role));
200 $this->setDate(ilUtil::stripSlashes($row->date));
201 }
202 }
203 return true;
204 }
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled

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

+ Here is the call graph for this function:

◆ save() [1/2]

ilMDContribute::save ( )

Reimplemented from ilMDBase.

Definition at line 118 of file class.ilMDContribute.php.

119 {
120 global $ilDB;
121
122 $fields = $this->__getFields();
123 $fields['meta_contribute_id'] = array('integer',$next_id = $ilDB->nextId('il_meta_contribute'));
124
125 if($this->db->insert('il_meta_contribute',$fields))
126 {
127 $this->setMetaId($next_id);
128 return $this->getMetaId();
129 }
130 return false;
131 }
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]

ilMDContribute::save ( )

Reimplemented from ilMDBase.

Definition at line 117 of file class.ilMDContribute.php.

118 {
119 if($this->db->autoExecute('il_meta_contribute',
120 $this->__getFields(),
121 DB_AUTOQUERY_INSERT))
122 {
123 $this->setMetaId($this->db->getLastInsertId());
124
125 return $this->getMetaId();
126 }
127 return false;
128 }

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

+ Here is the call graph for this function:

◆ setDate() [1/2]

ilMDContribute::setDate (   $a_date)

Definition at line 108 of file class.ilMDContribute.php.

109 {
110 $this->date = $a_date;
111 }

Referenced by read().

+ Here is the caller graph for this function:

◆ setDate() [2/2]

ilMDContribute::setDate (   $a_date)

Definition at line 107 of file class.ilMDContribute.php.

108 {
109 $this->date = $a_date;
110 }

◆ setRole() [1/2]

ilMDContribute::setRole (   $a_role)

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

77 {
78 switch($a_role)
79 {
80 case 'Author':
81 case 'Publisher':
82 case 'Unknown':
83 case 'Initiator':
84 case 'Terminator':
85 case 'Editor':
86 case 'GraphicalDesigner':
87 case 'TechnicalImplementer':
88 case 'ContentProvider':
89 case 'TechnicalValidator':
90 case 'EducationalValidator':
91 case 'ScriptWriter':
92 case 'InstructionalDesigner':
93 case 'SubjectMatterExpert':
94 case 'Creator':
95 case 'Validator':
96 case 'PointOfContact':
97 $this->role = $a_role;
98 return true;
99
100 default:
101 return false;
102 }
103 }

Referenced by read().

+ Here is the caller graph for this function:

◆ setRole() [2/2]

ilMDContribute::setRole (   $a_role)

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

77 {
78 switch($a_role)
79 {
80 case 'Author':
81 case 'Publisher':
82 case 'Unknown':
83 case 'Initiator':
84 case 'Terminator':
85 case 'Editor':
86 case 'GraphicalDesigner':
87 case 'TechnicalImplementer':
88 case 'ContentProvider':
89 case 'TechnicalValidator':
90 case 'EducationalValidator':
91 case 'ScriptWriter':
92 case 'InstructionalDesigner':
93 case 'SubjectMatterExpert':
94 case 'Creator':
95 case 'Validator':
96 $this->role = $a_role;
97 return true;
98
99 default:
100 return false;
101 }
102 }

◆ toXML() [1/2]

ilMDContribute::toXML ( $writer)

Reimplemented from ilMDBase.

Definition at line 212 of file class.ilMDContribute.php.

213 {
214 $writer->xmlStartTag('Contribute',array('Role' => $this->getRole()
215 ? $this->getRole()
216 : 'Author'));
217
218 // Entities
219 $entities = $this->getEntityIds();
220 foreach($entities as $id)
221 {
222 $ent =& $this->getEntity($id);
223 $ent->toXML($writer);
224 }
225 if(!count($entities))
226 {
227 include_once 'Services/MetaData/classes/class.ilMDEntity.php';
228 $ent = new ilMDEntity($this->getRBACId(),$this->getObjId());
229 $ent->toXML($writer);
230 }
231
232 $writer->xmlElement('Date',null,$this->getDate());
233 $writer->xmlEndTag('Contribute');
234 }

References getDate(), getEntity(), getEntityIds(), ilMDBase\getObjId(), ilMDBase\getRBACId(), and getRole().

+ Here is the call graph for this function:

◆ toXML() [2/2]

ilMDContribute::toXML ( $writer)

Reimplemented from ilMDBase.

Definition at line 211 of file class.ilMDContribute.php.

212 {
213 $writer->xmlStartTag('Contribute',array('Role' => $this->getRole()));
214
215 // Entities
216 foreach($this->getEntityIds() as $id)
217 {
218 $ent =& $this->getEntity($id);
219 $ent->toXML($writer);
220 }
221 $writer->xmlElement('Date',null,$this->getDate());
222 $writer->xmlEndTag('Contribute');
223 }

References getDate(), getEntity(), getEntityIds(), and getRole().

+ Here is the call graph for this function:

◆ update() [1/2]

ilMDContribute::update ( )

Reimplemented from ilMDBase.

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

134 {
135 global $ilDB;
136
137 if($this->getMetaId())
138 {
139 if($this->db->update('il_meta_contribute',
140 $this->__getFields(),
141 array("meta_contribute_id" => array('integer',$this->getMetaId()))))
142 {
143 return true;
144 }
145 }
146 return false;
147 }

References $ilDB, and ilMDBase\getMetaId().

+ Here is the call graph for this function:

◆ update() [2/2]

ilMDContribute::update ( )

Reimplemented from ilMDBase.

Definition at line 130 of file class.ilMDContribute.php.

131 {
132 global $ilDB;
133
134 if($this->getMetaId())
135 {
136 if($this->db->autoExecute('il_meta_contribute',
137 $this->__getFields(),
138 DB_AUTOQUERY_UPDATE,
139 "meta_contribute_id = ".$ilDB->quote($this->getMetaId())))
140 {
141 return true;
142 }
143 }
144 return false;
145 }

References $ilDB, and ilMDBase\getMetaId().

+ Here is the call graph for this function:

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