ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
ilMD5295Contribute Class Reference
+ Inheritance diagram for ilMD5295Contribute:
+ Collaboration diagram for ilMD5295Contribute:

Public Member Functions

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

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 ilMD5295Base
 $rbac_id
 
 $obj_id
 
 $obj_type
 
 $export_mode = false
 
- Protected Attributes inherited from ilMD5295Base
 $log
 

Detailed Description

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

Member Function Documentation

◆ __getFields()

ilMD5295Contribute::__getFields ( )

Definition at line 163 of file class.ilMD5295Contribute.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(), ilMD5295Base\getObjId(), ilMD5295Base\getObjType(), ilMD5295Base\getParentId(), ilMD5295Base\getParentType(), ilMD5295Base\getRBACId(), and getRole().

Referenced by save().

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

◆ _getIds()

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

Definition at line 229 of file class.ilMD5295Contribute.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 ilMD5295Lifecycle\getContributeIds(), and ilMD5295MetaMetadata\getContributeIds().

+ Here is the caller graph for this function:

◆ _lookupAuthors()

static ilMD5295Contribute::_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.ilMD5295Contribute.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.

◆ addEntity()

& ilMD5295Contribute::addEntity ( )

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

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

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

+ Here is the call graph for this function:

◆ delete()

ilMD5295Contribute::delete ( )

Reimplemented from ilMD5295Base.

Definition at line 142 of file class.ilMD5295Contribute.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 }

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

+ Here is the call graph for this function:

◆ getDate()

ilMD5295Contribute::getDate ( )

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

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

Referenced by __getFields(), and toXML().

+ Here is the caller graph for this function:

◆ getEntity()

& ilMD5295Contribute::getEntity (   $a_entity_id)

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

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

Referenced by delete(), and toXML().

+ Here is the caller graph for this function:

◆ getEntityIds()

& ilMD5295Contribute::getEntityIds ( )

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

38 {
39 include_once 'Services/Migration/DBUpdate_5295/classes/class.ilMD5295Entity.php';
40
41 return ilMD5295Entity::_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 ilMD5295Entity\_getIds(), ilMD5295Base\getMetaId(), ilMD5295Base\getObjId(), and ilMD5295Base\getRBACId().

Referenced by delete(), and toXML().

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

◆ getRole()

ilMD5295Contribute::getRole ( )

Definition at line 94 of file class.ilMD5295Contribute.php.

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

Referenced by __getFields(), and toXML().

+ Here is the caller graph for this function:

◆ read()

ilMD5295Contribute::read ( )

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

175 {
176 global $DIC;
177
178 $ilDB = $DIC['ilDB'];
179
180 include_once 'Services/Migration/DBUpdate_5295/classes/class.ilMD5295LanguageItem.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 }
setParentType($a_parent_type)

References $DIC, $ilDB, $query, $res, ilDBConstants\FETCHMODE_OBJECT, ilMD5295Base\getMetaId(), setDate(), ilMD5295Base\setObjId(), ilMD5295Base\setObjType(), ilMD5295Base\setParentId(), ilMD5295Base\setParentType(), ilMD5295Base\setRBACId(), and setRole().

+ Here is the call graph for this function:

◆ save()

ilMD5295Contribute::save ( )

Reimplemented from ilMD5295Base.

Definition at line 108 of file class.ilMD5295Contribute.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(), ilMD5295Base\getMetaId(), and ilMD5295Base\setMetaId().

+ Here is the call graph for this function:

◆ setDate()

ilMD5295Contribute::setDate (   $a_date)

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

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

Referenced by read().

+ Here is the caller graph for this function:

◆ setRole()

ilMD5295Contribute::setRole (   $a_role)

Definition at line 67 of file class.ilMD5295Contribute.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:

◆ toXML()

ilMD5295Contribute::toXML ( $writer)

Reimplemented from ilMD5295Base.

Definition at line 205 of file class.ilMD5295Contribute.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/Migration/DBUpdate_5295/classes/class.ilMD5295Entity.php';
219 $ent = new ilMD5295Entity($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(), ilMD5295Base\getObjId(), ilMD5295Base\getRBACId(), and getRole().

+ Here is the call graph for this function:

◆ update()

ilMD5295Contribute::update ( )

Reimplemented from ilMD5295Base.

Definition at line 124 of file class.ilMD5295Contribute.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 ilMD5295Base\getMetaId().

+ Here is the call graph for this function:

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