ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
class.ilMD.php
Go to the documentation of this file.
1<?php
2/*
3 +-----------------------------------------------------------------------------+
4 | ILIAS open source |
5 +-----------------------------------------------------------------------------+
6 | Copyright (c) 1998-2001 ILIAS open source, University of Cologne |
7 | |
8 | This program is free software; you can redistribute it and/or |
9 | modify it under the terms of the GNU General Public License |
10 | as published by the Free Software Foundation; either version 2 |
11 | of the License, or (at your option) any later version. |
12 | |
13 | This program is distributed in the hope that it will be useful, |
14 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
16 | GNU General Public License for more details. |
17 | |
18 | You should have received a copy of the GNU General Public License |
19 | along with this program; if not, write to the Free Software |
20 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
21 +-----------------------------------------------------------------------------+
22*/
23
24
32include_once 'class.ilMDBase.php';
33
34class ilMD extends ilMDBase
35{
36 /*
37 * meta elements
38 *
39 */
40
41 function ilMD($a_rbac_id,$a_obj_id,$a_type)
42 {
43 parent::ilMDBase($a_rbac_id,$a_obj_id,$a_type);
44 }
45
46 function &getGeneral()
47 {
48 include_once 'Services/Migration/DBUpdate_426/classes/class.ilMDGeneral.php';
49
50 if($id = ilMDGeneral::_getId($this->getRBACId(),$this->getObjId()))
51 {
52 $gen =& new ilMDGeneral();
53 $gen->setMetaId($id);
54
55 return $gen;
56 }
57 return false;
58 }
59 function &addGeneral()
60 {
61 include_once 'Services/Migration/DBUpdate_426/classes/class.ilMDGeneral.php';
62
63 $gen =& new ilMDGeneral($this->getRBACId(),$this->getObjId(),$this->getObjType());
64
65 return $gen;
66 }
67
68
69 function &getLifecycle()
70 {
71 include_once 'Services/Migration/DBUpdate_426/classes/class.ilMDLifecycle.php';
72
73 if($id = ilMDLifecycle::_getId($this->getRBACId(),$this->getObjId()))
74 {
75 $lif =& new ilMDLifecycle();
76 $lif->setMetaId($id);
77
78 return $lif;
79 }
80 return false;
81 }
82 function &addLifecycle()
83 {
84 include_once 'Services/Migration/DBUpdate_426/classes/class.ilMDLifecycle.php';
85
86 $lif =& new ilMDLifecycle($this->getRBACId(),$this->getObjId(),$this->getObjType());
87
88 return $lif;
89 }
90
91 function &getMetaMetadata()
92 {
93 include_once 'Services/Migration/DBUpdate_426/classes/class.ilMDMetaMetadata.php';
94
95 if($id = ilMDMetaMetadata::_getId($this->getRBACId(),$this->getObjId()))
96 {
97 $met =& new ilMDMetaMetadata();
98 $met->setMetaId($id);
99
100 return $met;
101 }
102 return false;
103 }
104 function &addMetaMetadata()
105 {
106 include_once 'Services/Migration/DBUpdate_426/classes/class.ilMDMetaMetadata.php';
107
108 $met =& new ilMDMetaMetadata($this->getRBACId(),$this->getObjId(),$this->getObjType());
109
110 return $met;
111 }
112
113 function &getTechnical()
114 {
115 include_once 'Services/Migration/DBUpdate_426/classes/class.ilMDTechnical.php';
116
117 if($id = ilMDTechnical::_getId($this->getRBACId(),$this->getObjId()))
118 {
119 $tec =& new ilMDTechnical();
120 $tec->setMetaId($id);
121
122 return $tec;
123 }
124 return false;
125 }
126 function &addTechnical()
127 {
128 include_once 'Services/Migration/DBUpdate_426/classes/class.ilMDTechnical.php';
129
130 $tec =& new ilMDTechnical($this->getRBACId(),$this->getObjId(),$this->getObjType());
131
132 return $tec;
133 }
134
135 function &getEducational()
136 {
137 include_once 'Services/Migration/DBUpdate_426/classes/class.ilMDEducational.php';
138
139 if($id = ilMDEducational::_getId($this->getRBACId(),$this->getObjId()))
140 {
141 $edu =& new ilMDEducational();
142 $edu->setMetaId($id);
143
144 return $edu;
145 }
146 return false;
147 }
148 function &addEducational()
149 {
150 include_once 'Services/Migration/DBUpdate_426/classes/class.ilMDEducational.php';
151
152 $edu =& new ilMDEducational($this->getRBACId(),$this->getObjId(),$this->getObjType());
153
154 return $edu;
155 }
156 function &getRights()
157 {
158 include_once 'Services/Migration/DBUpdate_426/classes/class.ilMDRights.php';
159
160 if($id = ilMDRights::_getId($this->getRBACId(),$this->getObjId()))
161 {
162 $rig =& new ilMDRights();
163 $rig->setMetaId($id);
164
165 return $rig;
166 }
167 return false;
168 }
169 function &addRights()
170 {
171 include_once 'Services/Migration/DBUpdate_426/classes/class.ilMDRights.php';
172
173 $rig =& new ilMDRights($this->getRBACId(),$this->getObjId(),$this->getObjType());
174
175 return $rig;
176 }
177
178 function &getRelationIds()
179 {
180 include_once 'Services/Migration/DBUpdate_426/classes/class.ilMDRelation.php';
181
182 return ilMDRelation::_getIds($this->getRBACId(),$this->getObjId());
183 }
184 function &getRelation($a_relation_id)
185 {
186 include_once 'Services/Migration/DBUpdate_426/classes/class.ilMDRelation.php';
187
188 if(!$a_relation_id)
189 {
190 return false;
191 }
192
193 $rel =& new ilMDRelation();
194 $rel->setMetaId($a_relation_id);
195
196 return $rel;
197 }
198 function &addRelation()
199 {
200 include_once 'Services/Migration/DBUpdate_426/classes/class.ilMDRelation.php';
201
202 $rel =& new ilMDRelation($this->getRBACId(),$this->getObjId(),$this->getObjType());
203
204 return $rel;
205 }
206
207
209 {
210 include_once 'Services/Migration/DBUpdate_426/classes/class.ilMDAnnotation.php';
211
212 return ilMDAnnotation::_getIds($this->getRBACId(),$this->getObjId());
213 }
214 function &getAnnotation($a_annotation_id)
215 {
216 if(!$a_annotation_id)
217 {
218 return false;
219 }
220 include_once 'Services/Migration/DBUpdate_426/classes/class.ilMDAnnotation.php';
221
222 $ann =& new ilMDAnnotation();
223 $ann->setMetaId($a_annotation_id);
224
225 return $ann;
226 }
227 function &addAnnotation()
228 {
229 include_once 'Services/Migration/DBUpdate_426/classes/class.ilMDAnnotation.php';
230
231 $ann =& new ilMDAnnotation($this->getRBACId(),$this->getObjId(),$this->getObjType());
232
233 return $ann;
234 }
235
237 {
238 include_once 'Services/Migration/DBUpdate_426/classes/class.ilMDClassification.php';
239
240 return ilMDClassification::_getIds($this->getRBACId(),$this->getObjId());
241 }
242 function &getClassification($a_classification_id)
243 {
244 if(!$a_classification_id)
245 {
246 return false;
247 }
248
249 include_once 'Services/Migration/DBUpdate_426/classes/class.ilMDClassification.php';
250
251 $cla =& new ilMDClassification();
252 $cla->setMetaId($a_classification_id);
253
254 return $cla;
255 }
257 {
258 include_once 'Services/Migration/DBUpdate_426/classes/class.ilMDClassification.php';
259
260 $cla =& new ilMDClassification($this->getRBACId(),$this->getObjId(),$this->getObjType());
261
262 return $cla;
263 }
264
265 /*
266 * XML Export of all meta data
267 * @param object (xml writer) see class.ilMD2XML.php
268 *
269 */
270 function toXML(&$writer)
271 {
272 $writer->xmlStartTag('Migration/DBUpdate_426');
273
274 // General
275 if(is_object($gen =& $this->getGeneral()))
276 {
277 $gen->toXML($writer);
278 }
279
280 // Lifecycle
281 if(is_object($lif =& $this->getLifecycle()))
282 {
283 $lif->toXML($writer);
284 }
285
286 // Meta-Metadata
287 if(is_object($met =& $this->getMetaMetadata()))
288 {
289 $met->toXML($writer);
290 }
291
292 // Technical
293 if(is_object($tec =& $this->getTechnical()))
294 {
295 $tec->toXML($writer);
296 }
297
298 // Educational
299 if(is_object($edu =& $this->getEducational()))
300 {
301 $edu->toXML($writer);
302 }
303
304 // Rights
305 if(is_object($rig =& $this->getRights()))
306 {
307 $rig->toXML($writer);
308 }
309
310 // Relations
311 foreach($this->getRelationIds() as $id)
312 {
313 $rel =& $this->getRelation($id);
314 $rel->toXML($writer);
315 }
316
317 // Annotations
318 foreach($this->getAnnotationIds() as $id)
319 {
320 $ann =& $this->getAnnotation($id);
321 $ann->toXML($writer);
322 }
323
324 // Classification
325 foreach($this->getClassificationIds() as $id)
326 {
327 $cla =& $this->getClassification($id);
328 $cla->toXML($writer);
329 }
330
331 $writer->xmlEndTag('Migration/DBUpdate_426');
332 }
333
334 function deleteAll()
335 {
336 global $ilDB;
337
338 $tables = array('il_meta_annotation',
339 'il_meta_classification',
340 'il_meta_contribute',
341 'il_meta_description',
342 'il_meta_educational',
343 'il_meta_entity',
344 'il_meta_format',
345 'il_meta_general',
346 'il_meta_identifier',
347 'il_meta_identifier_',
348 'il_meta_keyword',
349 'il_meta_language',
350 'il_meta_lifecycle',
351 'il_meta_location',
352 'il_meta_meta_data',
353 'il_meta_relation',
354 'il_meta_requirement',
355 'il_meta_rights',
356 'il_meta_taxon',
357 'il_meta_taxon_path',
358 'il_meta_technical',
359 'il_meta_typical_age_range');
360
361 foreach($tables as $table)
362 {
363 $query = "DELETE FROM ".$table." ".
364 "WHERE rbac_id = ".$ilDB->quote($this->getRBACId())." ".
365 "AND obj_id = ".$ilDB->quote($this->getObjId());
366 $res = $ilDB->query($query);
367 }
368
369 return true;
370 }
371 function _deleteAllByType($a_type)
372 {
373 global $ilDB;
374
375 $tables = array('il_meta_annotation',
376 'il_meta_classification',
377 'il_meta_contribute',
378 'il_meta_description',
379 'il_meta_educational',
380 'il_meta_entity',
381 'il_meta_format',
382 'il_meta_general',
383 'il_meta_identifier',
384 'il_meta_identifier_',
385 'il_meta_keyword',
386 'il_meta_language',
387 'il_meta_lifecycle',
388 'il_meta_location',
389 'il_meta_meta_data',
390 'il_meta_relation',
391 'il_meta_requirement',
392 'il_meta_rights',
393 'il_meta_taxon',
394 'il_meta_taxon_path',
395 'il_meta_technical',
396 'il_meta_typical_age_range');
397
398 foreach($tables as $table)
399 {
400 $query = "DELETE FROM ".$table." ".
401 "WHERE obj_type = ".$ilDB->quote($a_type)." ";
402 $res = $ilDB->query($query);
403 }
404
405 return true;
406 }
407}
408?>
_getIds($a_rbac_id, $a_obj_id)
_getIds($a_rbac_id, $a_obj_id)
_getId($a_rbac_id, $a_obj_id)
_getId($a_rbac_id, $a_obj_id)
_getId($a_rbac_id, $a_obj_id)
_getId($a_rbac_id, $a_obj_id)
_getIds($a_rbac_id, $a_obj_id)
_getId($a_rbac_id, $a_obj_id)
_getId($a_rbac_id, $a_obj_id)
& getLifecycle()
Definition: class.ilMD.php:69
& addAnnotation()
Definition: class.ilMD.php:227
toXML(&$writer)
Definition: class.ilMD.php:270
& addClassification()
Definition: class.ilMD.php:256
& addEducational()
Definition: class.ilMD.php:148
& getAnnotationIds()
Definition: class.ilMD.php:208
& getRelationIds()
Definition: class.ilMD.php:178
& addRights()
Definition: class.ilMD.php:169
& getClassificationIds()
Definition: class.ilMD.php:236
& addGeneral()
Definition: class.ilMD.php:59
& getGeneral()
Definition: class.ilMD.php:46
& getClassification($a_classification_id)
Definition: class.ilMD.php:242
& addTechnical()
Definition: class.ilMD.php:126
& addMetaMetadata()
Definition: class.ilMD.php:104
_deleteAllByType($a_type)
Definition: class.ilMD.php:371
& addLifecycle()
Definition: class.ilMD.php:82
ilMD($a_rbac_id, $a_obj_id, $a_type)
Definition: class.ilMD.php:41
& getEducational()
Definition: class.ilMD.php:135
& getRights()
Definition: class.ilMD.php:156
& getTechnical()
Definition: class.ilMD.php:113
deleteAll()
Definition: class.ilMD.php:334
& getMetaMetadata()
Definition: class.ilMD.php:91
& addRelation()
Definition: class.ilMD.php:198
& getRelation($a_relation_id)
Definition: class.ilMD.php:184
& getAnnotation($a_annotation_id)
Definition: class.ilMD.php:214
global $ilDB