ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
ilMDContribute Class Reference
+ Inheritance diagram for ilMDContribute:
+ Collaboration diagram for ilMDContribute:

Public Member Functions

getEntityIds ()
 
getEntity ($a_entity_id)
 
addEntity ()
 
 setRole ($a_role)
 
 getRole ()
 
 setDate ($a_date)
 
 getDate ()
 
 save ()
 
 update ()
 
 delete ()
 
 __getFields ()
 
 read ()
 
 toXML (&$writer)
 
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
 __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)
 
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
 
- Protected Attributes inherited from ilMDBase
 $log
 

Detailed Description

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

Member Function Documentation

◆ __getFields() [1/2]

ilMDContribute::__getFields ( )

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

163 {
164 return array('rbac_id' => array('integer',$this->getRBACId()),
165 'obj_id' => array('integer',$this->getObjId()),
166 'obj_type' => array('text',$this->getObjType()),
167 'parent_type' => array('text',$this->getParentType()),
168 'parent_id' => array('integer',$this->getParentId()),
169 'role' => array('text',$this->getRole()),
170 'c_date' => array('text',$this->getDate()));
171 }

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 161 of file class.ilMDContribute.php.

162 {
163 return array('rbac_id' => $this->getRBACId(),
164 'obj_id' => $this->getObjId(),
165 'obj_type' => ilUtil::prepareDBString($this->getObjType()),
166 'parent_type' => $this->getParentType(),
167 'parent_id' => $this->getParentId(),
168 'role' => ilUtil::prepareDBString($this->getRole()),
169 'date' => ilUtil::prepareDBString($this->getDate()));
170 }
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]

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

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

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

References $ilDB, $query, $res, $row, and ilDBConstants\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 219 of file class.ilMDContribute.php.

220 {
221 global $ilDB;
222
223 $query = "SELECT meta_contribute_id FROM il_meta_contribute ".
224 "WHERE rbac_id = ".$ilDB->quote($a_rbac_id)." ".
225 "AND obj_id = ".$ilDB->quote($a_obj_id)." ".
226 "AND parent_id = ".$ilDB->quote($a_parent_id)." ".
227 "AND parent_type = ".$ilDB->quote($a_parent_type);
228
229 $res = $ilDB->query($query);
230 while($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT))
231 {
232 $ids[] = $row->meta_contribute_id;
233 }
234 return $ids ? $ids : array();
235 }

References $ilDB, $query, $res, $row, and ilDBConstants\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 259 of file class.ilMDContribute.php.

260 {
261 global $ilDB;
262
263 // Ask for 'author' later to use indexes
264 $query = "SELECT entity,ent.parent_type,role FROM il_meta_entity ent ".
265 "JOIN il_meta_contribute con ON ent.parent_id = con.meta_contribute_id ".
266 "WHERE ent.rbac_id = ".$ilDB->quote($a_rbac_id ,'integer')." ".
267 "AND ent.obj_id = ".$ilDB->quote($a_obj_id ,'integer')." ";
268 $res = $ilDB->query($query);
269 while($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT))
270 {
271 if($row->role == 'Author' and $row->parent_type == 'meta_contribute')
272 {
273 $authors[] = trim($row->entity);
274 }
275 }
276 return $authors ? $authors : array();
277 }

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

Referenced by ilMDUtils\_fillHTMLMetaTags().

+ Here is the caller graph for this function:

◆ addEntity() [1/2]

& ilMDContribute::addEntity ( )

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

57 {
58 include_once 'Services/MetaData/classes/class.ilMDEntity.php';
59
60 $ent = new ilMDEntity($this->getRBACId(),$this->getObjId(),$this->getObjType());
61 $ent->setParentId($this->getMetaId());
62 $ent->setParentType('meta_contribute');
63
64 return $ent;
65 }

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 56 of file class.ilMDContribute.php.

57 {
58 include_once 'Services/Migration/DBUpdate_426/classes/class.ilMDEntity.php';
59
60 $ent = new ilMDEntity($this->getRBACId(),$this->getObjId(),$this->getObjType());
61 $ent->setParentId($this->getMetaId());
62 $ent->setParentType('meta_contribute');
63
64 return $ent;
65 }

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 141 of file class.ilMDContribute.php.

142 {
143 global $ilDB;
144
145 if($this->getMetaId())
146 {
147 $query = "DELETE FROM il_meta_contribute ".
148 "WHERE meta_contribute_id = ".$ilDB->quote($this->getMetaId() ,'integer');
149 $res = $ilDB->manipulate($query);
150
151 foreach($this->getEntityIds() as $id)
152 {
153 $ent = $this->getEntity($id);
154 $ent->delete();
155 }
156 return true;
157 }
158 return false;
159 }
& 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 139 of file class.ilMDContribute.php.

140 {
141 global $ilDB;
142
143 if($this->getMetaId())
144 {
145 $query = "DELETE FROM il_meta_contribute ".
146 "WHERE meta_contribute_id = ".$ilDB->quote($this->getMetaId());
147
148 $this->db->query($query);
149
150 foreach($this->getEntityIds() as $id)
151 {
152 $ent =& $this->getEntity($id);
153 $ent->delete();
154 }
155 return true;
156 }
157 return false;
158 }

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

+ Here is the call graph for this function:

◆ getDate() [1/2]

ilMDContribute::getDate ( )

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

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

Referenced by __getFields(), and toXML().

+ Here is the caller graph for this function:

◆ getDate() [2/2]

ilMDContribute::getDate ( )

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

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

◆ getEntity() [1/2]

& ilMDContribute::getEntity (   $a_entity_id)

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

44 {
45 include_once 'Services/MetaData/classes/class.ilMDEntity.php';
46
47 if(!$a_entity_id)
48 {
49 return false;
50 }
51 $ent = new ilMDEntity();
52 $ent->setMetaId($a_entity_id);
53
54 return $ent;
55 }

Referenced by delete(), and toXML().

+ Here is the caller graph for this function:

◆ getEntity() [2/2]

& ilMDContribute::getEntity (   $a_entity_id)

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

44 {
45 include_once 'Services/Migration/DBUpdate_426/classes/class.ilMDEntity.php';
46
47 if(!$a_entity_id)
48 {
49 return false;
50 }
51 $ent = new ilMDEntity();
52 $ent->setMetaId($a_entity_id);
53
54 return $ent;
55 }

◆ getEntityIds() [1/2]

& ilMDContribute::getEntityIds ( )

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

38 {
39 include_once 'Services/MetaData/classes/class.ilMDEntity.php';
40
41 return ilMDEntity::_getIds($this->getRBACId(),$this->getObjId(),$this->getMetaId(),'meta_contribute');
42 }
static _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 37 of file class.ilMDContribute.php.

38 {
39 include_once 'Services/Migration/DBUpdate_426/classes/class.ilMDEntity.php';
40
41 return ilMDEntity::_getIds($this->getRBACId(),$this->getObjId(),$this->getMetaId(),'meta_contribute');
42 }

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 96 of file class.ilMDContribute.php.

97 {
98 return $this->role;
99 }

Referenced by __getFields(), and toXML().

+ Here is the caller graph for this function:

◆ getRole() [2/2]

ilMDContribute::getRole ( )

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

96 {
97 return $this->role;
98 }

◆ read() [1/2]

ilMDContribute::read ( )

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

174 {
175 global $ilDB;
176
177 include_once 'Services/MetaData/classes/class.ilMDLanguageItem.php';
178
179 if($this->getMetaId())
180 {
181 $query = "SELECT * FROM il_meta_contribute ".
182 "WHERE meta_contribute_id = ".$ilDB->quote($this->getMetaId() ,'integer');
183
184 $res = $this->db->query($query);
185 while($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT))
186 {
187 $this->setRBACId($row->rbac_id);
188 $this->setObjId($row->obj_id);
189 $this->setObjType($row->obj_type);
190 $this->setParentId($row->parent_id);
191 $this->setParentType($row->parent_type);
192 $this->setRole($row->role);
193 $this->setDate($row->c_date);
194 }
195 }
196 return true;
197 }
setObjId($a_id)
setParentId($a_id)
setObjType($a_type)
setRBACId($a_id)
setParentType($a_parent_type)

References $ilDB, $query, $res, $row, ilDBConstants\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 172 of file class.ilMDContribute.php.

173 {
174 global $ilDB;
175
176 include_once 'Services/Migration/DBUpdate_426/classes/class.ilMDLanguageItem.php';
177
178 if($this->getMetaId())
179 {
180 $query = "SELECT * FROM il_meta_contribute ".
181 "WHERE meta_contribute_id = ".$ilDB->quote($this->getMetaId());
182
183 $res = $this->db->query($query);
184 while($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT))
185 {
186 $this->setRBACId($row->rbac_id);
187 $this->setObjId($row->obj_id);
188 $this->setObjType($row->obj_type);
189 $this->setParentId($row->parent_id);
190 $this->setParentType($row->parent_type);
191 $this->setRole(ilUtil::stripSlashes($row->role));
192 $this->setDate(ilUtil::stripSlashes($row->date));
193 }
194 }
195 return true;
196 }
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(), 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 110 of file class.ilMDContribute.php.

111 {
112 global $ilDB;
113
114 $fields = $this->__getFields();
115 $fields['meta_contribute_id'] = array('integer',$next_id = $ilDB->nextId('il_meta_contribute'));
116
117 if($this->db->insert('il_meta_contribute',$fields))
118 {
119 $this->setMetaId($next_id);
120 return $this->getMetaId();
121 }
122 return false;
123 }
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 109 of file class.ilMDContribute.php.

110 {
111 if($this->db->autoExecute('il_meta_contribute',
112 $this->__getFields(),
114 {
115 $this->setMetaId($this->db->getLastInsertId());
116
117 return $this->getMetaId();
118 }
119 return false;
120 }

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

+ Here is the call graph for this function:

◆ setDate() [1/2]

ilMDContribute::setDate (   $a_date)

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

101 {
102 $this->date = $a_date;
103 }
date( 'd-M-Y', $objPHPExcel->getProperties() ->getCreated())

References date.

Referenced by read().

+ Here is the caller graph for this function:

◆ setDate() [2/2]

ilMDContribute::setDate (   $a_date)

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

100 {
101 $this->date = $a_date;
102 }

References date.

◆ setRole() [1/2]

ilMDContribute::setRole (   $a_role)

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

69 {
70 switch($a_role)
71 {
72 case 'Author':
73 case 'Publisher':
74 case 'Unknown':
75 case 'Initiator':
76 case 'Terminator':
77 case 'Editor':
78 case 'GraphicalDesigner':
79 case 'TechnicalImplementer':
80 case 'ContentProvider':
81 case 'TechnicalValidator':
82 case 'EducationalValidator':
83 case 'ScriptWriter':
84 case 'InstructionalDesigner':
85 case 'SubjectMatterExpert':
86 case 'Creator':
87 case 'Validator':
88 case 'PointOfContact':
89 $this->role = $a_role;
90 return true;
91
92 default:
93 return false;
94 }
95 }

Referenced by read().

+ Here is the caller graph for this function:

◆ setRole() [2/2]

ilMDContribute::setRole (   $a_role)

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

69 {
70 switch($a_role)
71 {
72 case 'Author':
73 case 'Publisher':
74 case 'Unknown':
75 case 'Initiator':
76 case 'Terminator':
77 case 'Editor':
78 case 'GraphicalDesigner':
79 case 'TechnicalImplementer':
80 case 'ContentProvider':
81 case 'TechnicalValidator':
82 case 'EducationalValidator':
83 case 'ScriptWriter':
84 case 'InstructionalDesigner':
85 case 'SubjectMatterExpert':
86 case 'Creator':
87 case 'Validator':
88 $this->role = $a_role;
89 return true;
90
91 default:
92 return false;
93 }
94 }

◆ toXML() [1/2]

ilMDContribute::toXML ( $writer)

Reimplemented from ilMDBase.

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

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

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 203 of file class.ilMDContribute.php.

204 {
205 $writer->xmlStartTag('Contribute',array('Role' => $this->getRole()));
206
207 // Entities
208 foreach($this->getEntityIds() as $id)
209 {
210 $ent =& $this->getEntity($id);
211 $ent->toXML($writer);
212 }
213 $writer->xmlElement('Date',null,$this->getDate());
214 $writer->xmlEndTag('Contribute');
215 }

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 125 of file class.ilMDContribute.php.

126 {
127 global $ilDB;
128
129 if($this->getMetaId())
130 {
131 if($this->db->update('il_meta_contribute',
132 $this->__getFields(),
133 array("meta_contribute_id" => array('integer',$this->getMetaId()))))
134 {
135 return true;
136 }
137 }
138 return false;
139 }

References $ilDB, and ilMDBase\getMetaId().

+ Here is the call graph for this function:

◆ update() [2/2]

ilMDContribute::update ( )

Reimplemented from ilMDBase.

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

123 {
124 global $ilDB;
125
126 if($this->getMetaId())
127 {
128 if($this->db->autoExecute('il_meta_contribute',
129 $this->__getFields(),
131 "meta_contribute_id = ".$ilDB->quote($this->getMetaId())))
132 {
133 return true;
134 }
135 }
136 return false;
137 }

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: