ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
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 163 of file class.ilMDContribute.php.

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

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

159 {
160 return array('rbac_id' => $this->getRBACId(),
161 'obj_id' => $this->getObjId(),
162 'obj_type' => ilUtil::prepareDBString($this->getObjType()),
163 'parent_type' => $this->getParentType(),
164 'parent_id' => $this->getParentId(),
165 'role' => ilUtil::prepareDBString($this->getRole()),
166 'date' => ilUtil::prepareDBString($this->getDate()));
167 }
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 229 of file class.ilMDContribute.php.

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

References $DIC, $ilDB, $query, $res, 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 213 of file class.ilMDContribute.php.

214 {
215 global $ilDB;
216
217 $query = "SELECT meta_contribute_id FROM il_meta_contribute " .
218 "WHERE rbac_id = " . $ilDB->quote($a_rbac_id) . " " .
219 "AND obj_id = " . $ilDB->quote($a_obj_id) . " " .
220 "AND parent_id = " . $ilDB->quote($a_parent_id) . " " .
221 "AND parent_type = " . $ilDB->quote($a_parent_type);
222
223 $res = $ilDB->query($query);
224 while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
225 $ids[] = $row->meta_contribute_id;
226 }
227 return $ids ? $ids : array();
228 }

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

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

Referenced by ilMDUtils\_fillHTMLMetaTags().

+ Here is the caller graph for this function:

◆ addEntity() [1/2]

& ilMDContribute::addEntity ( )

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

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

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

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

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

143 {
144 global $DIC;
145
146 $ilDB = $DIC['ilDB'];
147
148 if ($this->getMetaId()) {
149 $query = "DELETE FROM il_meta_contribute " .
150 "WHERE meta_contribute_id = " . $ilDB->quote($this->getMetaId(), 'integer');
151 $res = $ilDB->manipulate($query);
152
153 foreach ($this->getEntityIds() as $id) {
154 $ent = $this->getEntity($id);
155 $ent->delete();
156 }
157 return true;
158 }
159 return false;
160 }
& getEntity($a_entity_id)

References $DIC, $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 138 of file class.ilMDContribute.php.

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

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

+ Here is the call graph for this function:

◆ getDate() [1/2]

ilMDContribute::getDate ( )

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

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

Referenced by __getFields(), and toXML().

+ Here is the caller graph for this function:

◆ getDate() [2/2]

ilMDContribute::getDate ( )

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

102 {
103 return $this->date;
104 }

◆ 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 return false;
49 }
50 $ent = new ilMDEntity();
51 $ent->setMetaId($a_entity_id);
52
53 return $ent;
54 }

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 return false;
49 }
50 $ent = new ilMDEntity();
51 $ent->setMetaId($a_entity_id);
52
53 return $ent;
54 }

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

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

Referenced by __getFields(), and toXML().

+ Here is the caller graph for this function:

◆ getRole() [2/2]

ilMDContribute::getRole ( )

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

94 {
95 return $this->role;
96 }

◆ read() [1/2]

ilMDContribute::read ( )

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

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

References $DIC, $ilDB, $query, $res, 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 169 of file class.ilMDContribute.php.

170 {
171 global $ilDB;
172
173 include_once 'Services/Migration/DBUpdate_426/classes/class.ilMDLanguageItem.php';
174
175 if ($this->getMetaId()) {
176 $query = "SELECT * FROM il_meta_contribute " .
177 "WHERE meta_contribute_id = " . $ilDB->quote($this->getMetaId());
178
179 $res = $this->db->query($query);
180 while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
181 $this->setRBACId($row->rbac_id);
182 $this->setObjId($row->obj_id);
183 $this->setObjType($row->obj_type);
184 $this->setParentId($row->parent_id);
185 $this->setParentType($row->parent_type);
186 $this->setRole(ilUtil::stripSlashes($row->role));
187 $this->setDate(ilUtil::stripSlashes($row->date));
188 }
189 }
190 return true;
191 }
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled

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

109 {
110 global $DIC;
111
112 $ilDB = $DIC['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 $this->setMetaId($next_id);
119 return $this->getMetaId();
120 }
121 return false;
122 }
setMetaId($a_meta_id, $a_read_data=true)

References $DIC, $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 107 of file class.ilMDContribute.php.

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

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

+ Here is the call graph for this function:

◆ setDate() [1/2]

ilMDContribute::setDate (   $a_date)

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

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

Referenced by read().

+ Here is the caller graph for this function:

◆ setDate() [2/2]

ilMDContribute::setDate (   $a_date)

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

98 {
99 $this->date = $a_date;
100 }

◆ setRole() [1/2]

ilMDContribute::setRole (   $a_role)

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

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

Referenced by read().

+ Here is the caller graph for this function:

◆ setRole() [2/2]

ilMDContribute::setRole (   $a_role)

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

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

◆ toXML() [1/2]

ilMDContribute::toXML ( $writer)

Reimplemented from ilMDBase.

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

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

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

199 {
200 $writer->xmlStartTag('Contribute', array('Role' => $this->getRole()));
201
202 // Entities
203 foreach ($this->getEntityIds() as $id) {
204 $ent = &$this->getEntity($id);
205 $ent->toXML($writer);
206 }
207 $writer->xmlElement('Date', null, $this->getDate());
208 $writer->xmlEndTag('Contribute');
209 }

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

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

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

+ Here is the call graph for this function:

◆ update() [2/2]

ilMDContribute::update ( )

Reimplemented from ilMDBase.

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

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

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

+ Here is the call graph for this function:

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