ILIAS  release_7 Revision v7.30-3-g800a261c036
All Data Structures Namespaces Files Functions Variables Modules Pages
ilMD5295Relation Class Reference
+ Inheritance diagram for ilMD5295Relation:
+ Collaboration diagram for ilMD5295Relation:

Public Member Functions

getIdentifier_Ids ()
 
getIdentifier_ ($a_identifier__id)
 
addIdentifier_ ()
 
getDescriptionIds ()
 
getDescription ($a_description_id)
 
addDescription ()
 
 setKind ($a_kind)
 
 getKind ()
 
 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)
 

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 33 of file class.ilMD5295Relation.php.

Member Function Documentation

◆ __getFields()

ilMD5295Relation::__getFields ( )

Definition at line 182 of file class.ilMD5295Relation.php.

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

Referenced by save().

183  {
184  return array('rbac_id' => array('integer',$this->getRBACId()),
185  'obj_id' => array('integer',$this->getObjId()),
186  'obj_type' => array('text',$this->getObjType()),
187  'kind' => array('text',$this->getKind()));
188  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _getIds()

static ilMD5295Relation::_getIds (   $a_rbac_id,
  $a_obj_id 
)
static

Definition at line 254 of file class.ilMD5295Relation.php.

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

Referenced by ilMD5295\getRelationIds().

255  {
256  global $DIC;
257 
258  $ilDB = $DIC['ilDB'];
259 
260  $query = "SELECT meta_relation_id FROM il_meta_relation " .
261  "WHERE rbac_id = " . $ilDB->quote($a_rbac_id, 'integer') . " " .
262  "AND obj_id = " . $ilDB->quote($a_obj_id, 'integer');
263 
264  $res = $ilDB->query($query);
265  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
266  $ids[] = $row->meta_relation_id;
267  }
268  return $ids ? $ids : array();
269  }
foreach($_POST as $key=> $value) $res
global $DIC
Definition: goto.php:24
$query
global $ilDB
+ Here is the caller graph for this function:

◆ addDescription()

& ilMD5295Relation::addDescription ( )

Definition at line 83 of file class.ilMD5295Relation.php.

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

84  {
85  include_once 'Services/Migration/DBUpdate_5295/classes/class.ilMD5295Description.php';
86 
87  $des = new ilMD5295Description($this->getRBACId(), $this->getObjId(), $this->getObjType());
88  $des->setParentId($this->getMetaId());
89  $des->setParentType('meta_relation');
90 
91  return $des;
92  }
+ Here is the call graph for this function:

◆ addIdentifier_()

& ilMD5295Relation::addIdentifier_ ( )

Definition at line 54 of file class.ilMD5295Relation.php.

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

55  {
56  include_once 'Services/Migration/DBUpdate_5295/classes/class.ilMD5295Identifier_.php';
57 
58  $ide = new ilMD5295Identifier_($this->getRBACId(), $this->getObjId(), $this->getObjType());
59  $ide->setParentId($this->getMetaId());
60  $ide->setParentType('meta_relation');
61 
62  return $ide;
63  }
+ Here is the call graph for this function:

◆ delete()

ilMD5295Relation::delete ( )

Definition at line 156 of file class.ilMD5295Relation.php.

References $DIC, $ilDB, $query, $res, getDescription(), getDescriptionIds(), getIdentifier_(), getIdentifier_Ids(), and ilMD5295Base\getMetaId().

157  {
158  global $DIC;
159 
160  $ilDB = $DIC['ilDB'];
161 
162  if ($this->getMetaId()) {
163  $query = "DELETE FROM il_meta_relation " .
164  "WHERE meta_relation_id = " . $ilDB->quote($this->getMetaId(), 'integer');
165  $res = $ilDB->manipulate($query);
166 
167  foreach ($this->getIdentifier_Ids() as $id) {
168  $ide = $this->getIdentifier_($id);
169  $ide->delete();
170  }
171  foreach ($this->getDescriptionIds() as $id) {
172  $des = $this->getDescription($id);
173  $des->delete();
174  }
175 
176  return true;
177  }
178  return false;
179  }
foreach($_POST as $key=> $value) $res
& getDescription($a_description_id)
global $DIC
Definition: goto.php:24
& getIdentifier_($a_identifier__id)
$query
global $ilDB
+ Here is the call graph for this function:

◆ getDescription()

& ilMD5295Relation::getDescription (   $a_description_id)

Definition at line 71 of file class.ilMD5295Relation.php.

Referenced by delete(), and toXML().

72  {
73  include_once 'Services/Migration/DBUpdate_5295/classes/class.ilMD5295Description.php';
74 
75  if (!$a_description_id) {
76  return false;
77  }
78  $des = new ilMD5295Description();
79  $des->setMetaId($a_description_id);
80 
81  return $des;
82  }
+ Here is the caller graph for this function:

◆ getDescriptionIds()

& ilMD5295Relation::getDescriptionIds ( )

Definition at line 65 of file class.ilMD5295Relation.php.

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

Referenced by delete(), and toXML().

66  {
67  include_once 'Services/Migration/DBUpdate_5295/classes/class.ilMD5295Description.php';
68 
69  return ilMdDescription::_getIds($this->getRBACId(), $this->getObjId(), $this->getMetaId(), 'meta_relation');
70  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getIdentifier_()

& ilMD5295Relation::getIdentifier_ (   $a_identifier__id)

Definition at line 42 of file class.ilMD5295Relation.php.

Referenced by delete(), and toXML().

43  {
44  include_once 'Services/Migration/DBUpdate_5295/classes/class.ilMD5295Identifier_.php';
45 
46  if (!$a_identifier__id) {
47  return false;
48  }
49  $ide = new ilMD5295Identifier_();
50  $ide->setMetaId($a_identifier__id);
51 
52  return $ide;
53  }
+ Here is the caller graph for this function:

◆ getIdentifier_Ids()

& ilMD5295Relation::getIdentifier_Ids ( )

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

References ilMD5295Identifier_\_getIds(), ilMD5295Base\getMetaId(), ilMD5295Base\getObjId(), and ilMD5295Base\getRBACId().

Referenced by delete(), and toXML().

37  {
38  include_once 'Services/Migration/DBUpdate_5295/classes/class.ilMD5295Identifier_.php';
39 
40  return ilMD5295Identifier_::_getIds($this->getRBACId(), $this->getObjId(), $this->getMetaId(), 'meta_relation');
41  }
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:

◆ getKind()

ilMD5295Relation::getKind ( )

Definition at line 116 of file class.ilMD5295Relation.php.

Referenced by __getFields(), and toXML().

117  {
118  return $this->kind;
119  }
+ Here is the caller graph for this function:

◆ read()

ilMD5295Relation::read ( )

Definition at line 190 of file class.ilMD5295Relation.php.

References $DIC, $ilDB, $query, $res, ilDBConstants\FETCHMODE_OBJECT, ilMD5295Base\getMetaId(), setKind(), ilMD5295Base\setObjId(), ilMD5295Base\setObjType(), and ilMD5295Base\setRBACId().

191  {
192  global $DIC;
193 
194  $ilDB = $DIC['ilDB'];
195 
196  if ($this->getMetaId()) {
197  $query = "SELECT * FROM il_meta_relation " .
198  "WHERE meta_relation_id = " . $ilDB->quote($this->getMetaId(), 'integer');
199 
200  $res = $this->db->query($query);
201  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
202  $this->setRBACId($row->rbac_id);
203  $this->setObjId($row->obj_id);
204  $this->setObjType($row->obj_type);
205  $this->setKind($row->kind);
206  }
207  }
208  return true;
209  }
foreach($_POST as $key=> $value) $res
global $DIC
Definition: goto.php:24
$query
global $ilDB
+ Here is the call graph for this function:

◆ save()

ilMD5295Relation::save ( )

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

References $DIC, $ilDB, __getFields(), ilMD5295Base\getMetaId(), and ilMD5295Base\setMetaId().

123  {
124  global $DIC;
125 
126  $ilDB = $DIC['ilDB'];
127 
128  $fields = $this->__getFields();
129  $fields['meta_relation_id'] = array('integer',$next_id = $ilDB->nextId('il_meta_relation'));
130 
131  if ($this->db->insert('il_meta_relation', $fields)) {
132  $this->setMetaId($next_id);
133  return $this->getMetaId();
134  }
135  return false;
136  }
global $DIC
Definition: goto.php:24
global $ilDB
setMetaId($a_meta_id, $a_read_data=true)
+ Here is the call graph for this function:

◆ setKind()

ilMD5295Relation::setKind (   $a_kind)

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

Referenced by read().

95  {
96  switch ($a_kind) {
97  case 'IsPartOf':
98  case 'HasPart':
99  case 'IsVersionOf':
100  case 'HasVersion':
101  case 'IsFormatOf':
102  case 'HasFormat':
103  case 'References':
104  case 'IsReferencedBy':
105  case 'IsBasedOn':
106  case 'IsBasisFor':
107  case 'Requires':
108  case 'IsRequiredBy':
109  $this->kind = $a_kind;
110  return true;
111 
112  default:
113  return false;
114  }
115  }
+ Here is the caller graph for this function:

◆ toXML()

ilMD5295Relation::toXML ( $writer)

Definition at line 216 of file class.ilMD5295Relation.php.

References getDescription(), getDescriptionIds(), getIdentifier_(), getIdentifier_Ids(), getKind(), ilMD5295Base\getObjId(), and ilMD5295Base\getRBACId().

217  {
218  $writer->xmlStartTag('Relation', array('Kind' => $this->getKind()
219  ? $this->getKind()
220  : 'IsPartOf'));
221  $writer->xmlStartTag('Resource');
222 
223  // Identifier_
224  $ides = $this->getIdentifier_Ids();
225  foreach ($ides as $id) {
226  $ide = &$this->getIdentifier_($id);
227  $ide->toXML($writer);
228  }
229  if (!count($ides)) {
230  include_once 'Services/Migration/DBUpdate_5295/classes/class.ilMD5295Identifier_.php';
231  $ide = new ilMD5295Identifier_($this->getRBACId(), $this->getObjId());
232  $ide->toXML($writer);
233  }
234 
235  // Description
236  $dess = $this->getDescriptionIds();
237  foreach ($dess as $id) {
238  $des = &$this->getDescription($id);
239  $des->toXML($writer);
240  }
241  if (!count($dess)) {
242  include_once 'Services/Migration/DBUpdate_5295/classes/class.ilMD5295Description.php';
243  $des = new ilMD5295Description($this->getRBACId(), $this->getObjId());
244  $des->toXML($writer);
245  }
246 
247  $writer->xmlEndTag('Resource');
248  $writer->xmlEndTag('Relation');
249  }
& getDescription($a_description_id)
& getIdentifier_($a_identifier__id)
+ Here is the call graph for this function:

◆ update()

ilMD5295Relation::update ( )

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

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

139  {
140  global $DIC;
141 
142  $ilDB = $DIC['ilDB'];
143 
144  if ($this->getMetaId()) {
145  if ($this->db->update(
146  'il_meta_relation',
147  $this->__getFields(),
148  array("meta_relation_id" => array('integer',$this->getMetaId()))
149  )) {
150  return true;
151  }
152  }
153  return false;
154  }
global $DIC
Definition: goto.php:24
global $ilDB
+ Here is the call graph for this function:

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