ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
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 157 of file class.ilMDContribute.php.

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

Referenced by save().

158  {
159  return array('rbac_id' => array('integer',$this->getRBACId()),
160  'obj_id' => array('integer',$this->getObjId()),
161  'obj_type' => array('text',$this->getObjType()),
162  'parent_type' => array('text',$this->getParentType()),
163  'parent_id' => array('integer',$this->getParentId()),
164  'role' => array('text',$this->getRole()),
165  'c_date' => array('text',$this->getDate()));
166  }
Create styles array
The data for the language used.
+ 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.

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

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  }
Create styles array
The data for the language used.
static prepareDBString($a_str)
prepare a string for db writing (insert/update)
+ 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 213 of file class.ilMDContribute.php.

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

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  }
foreach($_POST as $key=> $value) $res
$query
Create styles array
The data for the language used.
global $ilDB

◆ _getIds() [2/2]

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

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

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

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

222  {
223  global $ilDB;
224 
225  $query = "SELECT meta_contribute_id FROM il_meta_contribute " .
226  "WHERE rbac_id = " . $ilDB->quote($a_rbac_id, 'integer') . " " .
227  "AND obj_id = " . $ilDB->quote($a_obj_id, 'integer') . " " .
228  "AND parent_id = " . $ilDB->quote($a_parent_id, 'integer') . " " .
229  "AND parent_type = " . $ilDB->quote($a_parent_type, 'text');
230 
231  $res = $ilDB->query($query);
232  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
233  $ids[] = $row->meta_contribute_id;
234  }
235  return $ids ? $ids : array();
236  }
foreach($_POST as $key=> $value) $res
$query
Create styles array
The data for the language used.
global $ilDB
+ Here is the caller graph for this function:

◆ _lookupAuthors()

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

Lookup authors.

public

Parameters
intrbac_id
intobj_id
stringobj_type
Returns
array string authors

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

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

Referenced by ilMDUtils\_fillHTMLMetaTags().

250  {
251  global $ilDB;
252 
253  // Ask for 'author' later to use indexes
254  $query = "SELECT entity,ent.parent_type,role FROM il_meta_entity ent " .
255  "JOIN il_meta_contribute con ON ent.parent_id = con.meta_contribute_id " .
256  "WHERE ent.rbac_id = " . $ilDB->quote($a_rbac_id, 'integer') . " " .
257  "AND ent.obj_id = " . $ilDB->quote($a_obj_id, 'integer') . " ";
258  $res = $ilDB->query($query);
259  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
260  if ($row->role == 'Author' and $row->parent_type == 'meta_contribute') {
261  $authors[] = trim($row->entity);
262  }
263  }
264  return $authors ? $authors : array();
265  }
foreach($_POST as $key=> $value) $res
$query
Create styles array
The data for the language used.
global $ilDB
+ Here is the caller graph for this function:

◆ addEntity() [1/2]

& ilMDContribute::addEntity ( )

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

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

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  }
+ Here is the call graph for this function:

◆ addEntity() [2/2]

& ilMDContribute::addEntity ( )

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

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

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  }
+ Here is the call graph for this function:

◆ delete() [1/2]

ilMDContribute::delete ( )

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

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

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(), 'integer');
145  $res = $ilDB->manipulate($query);
146 
147  foreach ($this->getEntityIds() as $id) {
148  $ent = $this->getEntity($id);
149  $ent->delete();
150  }
151  return true;
152  }
153  return false;
154  }
& getEntity($a_entity_id)
if(!array_key_exists('StateId', $_REQUEST)) $id
foreach($_POST as $key=> $value) $res
$query
global $ilDB
+ Here is the call graph for this function:

◆ delete() [2/2]

ilMDContribute::delete ( )

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

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

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  }
& getEntity($a_entity_id)
if(!array_key_exists('StateId', $_REQUEST)) $id
$query
global $ilDB
+ Here is the call graph for this function:

◆ getDate() [1/2]

ilMDContribute::getDate ( )

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

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

◆ getDate() [2/2]

ilMDContribute::getDate ( )

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

Referenced by __getFields(), and toXML().

103  {
104  return $this->date;
105  }
+ Here is the caller graph for this function:

◆ getEntity() [1/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  }

◆ getEntity() [2/2]

& ilMDContribute::getEntity (   $a_entity_id)

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

Referenced by delete(), and toXML().

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  }
+ Here is the caller graph for this function:

◆ getEntityIds() [1/2]

& ilMDContribute::getEntityIds ( )

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

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

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  }
static _getIds($a_rbac_id, $a_obj_id, $a_parent_id, $a_parent_type)
+ Here is the call graph for this function:

◆ getEntityIds() [2/2]

& ilMDContribute::getEntityIds ( )

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

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

Referenced by delete(), and toXML().

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)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getRole() [1/2]

ilMDContribute::getRole ( )

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

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

◆ getRole() [2/2]

ilMDContribute::getRole ( )

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

Referenced by __getFields(), and toXML().

95  {
96  return $this->role;
97  }
+ Here is the caller graph for this function:

◆ read() [1/2]

ilMDContribute::read ( )

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

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

169  {
170  global $ilDB;
171 
172  include_once 'Services/MetaData/classes/class.ilMDLanguageItem.php';
173 
174  if ($this->getMetaId()) {
175  $query = "SELECT * FROM il_meta_contribute " .
176  "WHERE meta_contribute_id = " . $ilDB->quote($this->getMetaId(), 'integer');
177 
178  $res = $this->db->query($query);
179  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
180  $this->setRBACId($row->rbac_id);
181  $this->setObjId($row->obj_id);
182  $this->setObjType($row->obj_type);
183  $this->setParentId($row->parent_id);
184  $this->setParentType($row->parent_type);
185  $this->setRole($row->role);
186  $this->setDate($row->c_date);
187  }
188  }
189  return true;
190  }
setObjType($a_type)
foreach($_POST as $key=> $value) $res
setObjId($a_id)
setRBACId($a_id)
$query
setParentId($a_id)
global $ilDB
setParentType($a_parent_type)
+ Here is the call graph for this function:

◆ read() [2/2]

ilMDContribute::read ( )

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

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().

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  }
setObjType($a_type)
foreach($_POST as $key=> $value) $res
setObjId($a_id)
setRBACId($a_id)
$query
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
setParentId($a_id)
global $ilDB
setParentType($a_parent_type)
+ Here is the call graph for this function:

◆ save() [1/2]

ilMDContribute::save ( )

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

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

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  }
setMetaId($a_meta_id, $a_read_data=true)
+ Here is the call graph for this function:

◆ save() [2/2]

ilMDContribute::save ( )

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

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

109  {
110  global $ilDB;
111 
112  $fields = $this->__getFields();
113  $fields['meta_contribute_id'] = array('integer',$next_id = $ilDB->nextId('il_meta_contribute'));
114 
115  if ($this->db->insert('il_meta_contribute', $fields)) {
116  $this->setMetaId($next_id);
117  return $this->getMetaId();
118  }
119  return false;
120  }
setMetaId($a_meta_id, $a_read_data=true)
Create styles array
The data for the language used.
global $ilDB
+ Here is the call graph for this function:

◆ setDate() [1/2]

ilMDContribute::setDate (   $a_date)

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

References date.

98  {
99  $this->date = $a_date;
100  }
date( 'd-M-Y', $objPHPExcel->getProperties() ->getCreated())

◆ setDate() [2/2]

ilMDContribute::setDate (   $a_date)

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

References date.

Referenced by read().

99  {
100  $this->date = $a_date;
101  }
date( 'd-M-Y', $objPHPExcel->getProperties() ->getCreated())
+ Here is the caller graph for this function:

◆ 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  $this->role = $a_role;
87  return true;
88 
89  default:
90  return false;
91  }
92  }

◆ setRole() [2/2]

ilMDContribute::setRole (   $a_role)

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

Referenced by read().

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  }
+ Here is the caller graph for this function:

◆ toXML() [1/2]

ilMDContribute::toXML ( $writer)

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

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

198  {
199  $writer->xmlStartTag('Contribute', array('Role' => $this->getRole()
200  ? $this->getRole()
201  : 'Author'));
202 
203  // Entities
204  $entities = $this->getEntityIds();
205  foreach ($entities as $id) {
206  $ent =&$this->getEntity($id);
207  $ent->toXML($writer);
208  }
209  if (!count($entities)) {
210  include_once 'Services/MetaData/classes/class.ilMDEntity.php';
211  $ent = new ilMDEntity($this->getRBACId(), $this->getObjId());
212  $ent->toXML($writer);
213  }
214 
215  $writer->xmlElement('Date', null, $this->getDate());
216  $writer->xmlEndTag('Contribute');
217  }
& getEntity($a_entity_id)
if(!array_key_exists('StateId', $_REQUEST)) $id
Create styles array
The data for the language used.
+ Here is the call graph for this function:

◆ toXML() [2/2]

ilMDContribute::toXML ( $writer)

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

References $id, array, getDate(), getEntity(), getEntityIds(), and getRole().

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  }
& getEntity($a_entity_id)
if(!array_key_exists('StateId', $_REQUEST)) $id
Create styles array
The data for the language used.
+ Here is the call graph for this function:

◆ update() [1/2]

ilMDContribute::update ( )

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

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

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  }
global $ilDB
+ Here is the call graph for this function:

◆ update() [2/2]

ilMDContribute::update ( )

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

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

123  {
124  global $ilDB;
125 
126  if ($this->getMetaId()) {
127  if ($this->db->update(
128  'il_meta_contribute',
129  $this->__getFields(),
130  array("meta_contribute_id" => array('integer',$this->getMetaId()))
131  )) {
132  return true;
133  }
134  }
135  return false;
136  }
Create styles array
The data for the language used.
global $ilDB
+ Here is the call graph for this function:

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