00001 <?php
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00032 include_once 'class.ilMDBase.php';
00033
00034 class ilMD extends ilMDBase
00035 {
00036
00037
00038
00039
00040
00041 function ilMD($a_rbac_id,$a_obj_id,$a_type)
00042 {
00043 parent::ilMDBase($a_rbac_id,$a_obj_id,$a_type);
00044 }
00045
00046 function &getGeneral()
00047 {
00048 include_once 'Services/Migration/DBUpdate_426/classes/class.ilMDGeneral.php';
00049
00050 if($id = ilMDGeneral::_getId($this->getRBACId(),$this->getObjId()))
00051 {
00052 $gen =& new ilMDGeneral();
00053 $gen->setMetaId($id);
00054
00055 return $gen;
00056 }
00057 return false;
00058 }
00059 function &addGeneral()
00060 {
00061 include_once 'Services/Migration/DBUpdate_426/classes/class.ilMDGeneral.php';
00062
00063 $gen =& new ilMDGeneral($this->getRBACId(),$this->getObjId(),$this->getObjType());
00064
00065 return $gen;
00066 }
00067
00068
00069 function &getLifecycle()
00070 {
00071 include_once 'Services/Migration/DBUpdate_426/classes/class.ilMDLifecycle.php';
00072
00073 if($id = ilMDLifecycle::_getId($this->getRBACId(),$this->getObjId()))
00074 {
00075 $lif =& new ilMDLifecycle();
00076 $lif->setMetaId($id);
00077
00078 return $lif;
00079 }
00080 return false;
00081 }
00082 function &addLifecycle()
00083 {
00084 include_once 'Services/Migration/DBUpdate_426/classes/class.ilMDLifecycle.php';
00085
00086 $lif =& new ilMDLifecycle($this->getRBACId(),$this->getObjId(),$this->getObjType());
00087
00088 return $lif;
00089 }
00090
00091 function &getMetaMetadata()
00092 {
00093 include_once 'Services/Migration/DBUpdate_426/classes/class.ilMDMetaMetadata.php';
00094
00095 if($id = ilMDMetaMetadata::_getId($this->getRBACId(),$this->getObjId()))
00096 {
00097 $met =& new ilMDMetaMetadata();
00098 $met->setMetaId($id);
00099
00100 return $met;
00101 }
00102 return false;
00103 }
00104 function &addMetaMetadata()
00105 {
00106 include_once 'Services/Migration/DBUpdate_426/classes/class.ilMDMetaMetadata.php';
00107
00108 $met =& new ilMDMetaMetadata($this->getRBACId(),$this->getObjId(),$this->getObjType());
00109
00110 return $met;
00111 }
00112
00113 function &getTechnical()
00114 {
00115 include_once 'Services/Migration/DBUpdate_426/classes/class.ilMDTechnical.php';
00116
00117 if($id = ilMDTechnical::_getId($this->getRBACId(),$this->getObjId()))
00118 {
00119 $tec =& new ilMDTechnical();
00120 $tec->setMetaId($id);
00121
00122 return $tec;
00123 }
00124 return false;
00125 }
00126 function &addTechnical()
00127 {
00128 include_once 'Services/Migration/DBUpdate_426/classes/class.ilMDTechnical.php';
00129
00130 $tec =& new ilMDTechnical($this->getRBACId(),$this->getObjId(),$this->getObjType());
00131
00132 return $tec;
00133 }
00134
00135 function &getEducational()
00136 {
00137 include_once 'Services/Migration/DBUpdate_426/classes/class.ilMDEducational.php';
00138
00139 if($id = ilMDEducational::_getId($this->getRBACId(),$this->getObjId()))
00140 {
00141 $edu =& new ilMDEducational();
00142 $edu->setMetaId($id);
00143
00144 return $edu;
00145 }
00146 return false;
00147 }
00148 function &addEducational()
00149 {
00150 include_once 'Services/Migration/DBUpdate_426/classes/class.ilMDEducational.php';
00151
00152 $edu =& new ilMDEducational($this->getRBACId(),$this->getObjId(),$this->getObjType());
00153
00154 return $edu;
00155 }
00156 function &getRights()
00157 {
00158 include_once 'Services/Migration/DBUpdate_426/classes/class.ilMDRights.php';
00159
00160 if($id = ilMDRights::_getId($this->getRBACId(),$this->getObjId()))
00161 {
00162 $rig =& new ilMDRights();
00163 $rig->setMetaId($id);
00164
00165 return $rig;
00166 }
00167 return false;
00168 }
00169 function &addRights()
00170 {
00171 include_once 'Services/Migration/DBUpdate_426/classes/class.ilMDRights.php';
00172
00173 $rig =& new ilMDRights($this->getRBACId(),$this->getObjId(),$this->getObjType());
00174
00175 return $rig;
00176 }
00177
00178 function &getRelationIds()
00179 {
00180 include_once 'Services/Migration/DBUpdate_426/classes/class.ilMDRelation.php';
00181
00182 return ilMDRelation::_getIds($this->getRBACId(),$this->getObjId());
00183 }
00184 function &getRelation($a_relation_id)
00185 {
00186 include_once 'Services/Migration/DBUpdate_426/classes/class.ilMDRelation.php';
00187
00188 if(!$a_relation_id)
00189 {
00190 return false;
00191 }
00192
00193 $rel =& new ilMDRelation();
00194 $rel->setMetaId($a_relation_id);
00195
00196 return $rel;
00197 }
00198 function &addRelation()
00199 {
00200 include_once 'Services/Migration/DBUpdate_426/classes/class.ilMDRelation.php';
00201
00202 $rel =& new ilMDRelation($this->getRBACId(),$this->getObjId(),$this->getObjType());
00203
00204 return $rel;
00205 }
00206
00207
00208 function &getAnnotationIds()
00209 {
00210 include_once 'Services/Migration/DBUpdate_426/classes/class.ilMDAnnotation.php';
00211
00212 return ilMDAnnotation::_getIds($this->getRBACId(),$this->getObjId());
00213 }
00214 function &getAnnotation($a_annotation_id)
00215 {
00216 if(!$a_annotation_id)
00217 {
00218 return false;
00219 }
00220 include_once 'Services/Migration/DBUpdate_426/classes/class.ilMDAnnotation.php';
00221
00222 $ann =& new ilMDAnnotation();
00223 $ann->setMetaId($a_annotation_id);
00224
00225 return $ann;
00226 }
00227 function &addAnnotation()
00228 {
00229 include_once 'Services/Migration/DBUpdate_426/classes/class.ilMDAnnotation.php';
00230
00231 $ann =& new ilMDAnnotation($this->getRBACId(),$this->getObjId(),$this->getObjType());
00232
00233 return $ann;
00234 }
00235
00236 function &getClassificationIds()
00237 {
00238 include_once 'Services/Migration/DBUpdate_426/classes/class.ilMDClassification.php';
00239
00240 return ilMDClassification::_getIds($this->getRBACId(),$this->getObjId());
00241 }
00242 function &getClassification($a_classification_id)
00243 {
00244 if(!$a_classification_id)
00245 {
00246 return false;
00247 }
00248
00249 include_once 'Services/Migration/DBUpdate_426/classes/class.ilMDClassification.php';
00250
00251 $cla =& new ilMDClassification();
00252 $cla->setMetaId($a_classification_id);
00253
00254 return $cla;
00255 }
00256 function &addClassification()
00257 {
00258 include_once 'Services/Migration/DBUpdate_426/classes/class.ilMDClassification.php';
00259
00260 $cla =& new ilMDClassification($this->getRBACId(),$this->getObjId(),$this->getObjType());
00261
00262 return $cla;
00263 }
00264
00265
00266
00267
00268
00269
00270 function toXML(&$writer)
00271 {
00272 $writer->xmlStartTag('Migration/DBUpdate_426');
00273
00274
00275 if(is_object($gen =& $this->getGeneral()))
00276 {
00277 $gen->toXML($writer);
00278 }
00279
00280
00281 if(is_object($lif =& $this->getLifecycle()))
00282 {
00283 $lif->toXML($writer);
00284 }
00285
00286
00287 if(is_object($met =& $this->getMetaMetadata()))
00288 {
00289 $met->toXML($writer);
00290 }
00291
00292
00293 if(is_object($tec =& $this->getTechnical()))
00294 {
00295 $tec->toXML($writer);
00296 }
00297
00298
00299 if(is_object($edu =& $this->getEducational()))
00300 {
00301 $edu->toXML($writer);
00302 }
00303
00304
00305 if(is_object($rig =& $this->getRights()))
00306 {
00307 $rig->toXML($writer);
00308 }
00309
00310
00311 foreach($this->getRelationIds() as $id)
00312 {
00313 $rel =& $this->getRelation($id);
00314 $rel->toXML($writer);
00315 }
00316
00317
00318 foreach($this->getAnnotationIds() as $id)
00319 {
00320 $ann =& $this->getAnnotation($id);
00321 $ann->toXML($writer);
00322 }
00323
00324
00325 foreach($this->getClassificationIds() as $id)
00326 {
00327 $cla =& $this->getClassification($id);
00328 $cla->toXML($writer);
00329 }
00330
00331 $writer->xmlEndTag('Migration/DBUpdate_426');
00332 }
00333
00334 function deleteAll()
00335 {
00336 $tables = array('il_meta_annotation',
00337 'il_meta_classification',
00338 'il_meta_contribute',
00339 'il_meta_description',
00340 'il_meta_educational',
00341 'il_meta_entity',
00342 'il_meta_format',
00343 'il_meta_general',
00344 'il_meta_identifier',
00345 'il_meta_identifier_',
00346 'il_meta_keyword',
00347 'il_meta_language',
00348 'il_meta_lifecycle',
00349 'il_meta_location',
00350 'il_meta_meta_data',
00351 'il_meta_relation',
00352 'il_meta_requirement',
00353 'il_meta_rights',
00354 'il_meta_taxon',
00355 'il_meta_taxon_path',
00356 'il_meta_technical',
00357 'il_meta_typical_age_range');
00358
00359 foreach($tables as $table)
00360 {
00361 $query = "DELETE FROM ".$table." ".
00362 "WHERE rbac_id = '".$this->getRBACId()."' ".
00363 "AND obj_id = '".$this->getObjId()."'";
00364
00365 $this->db->query($query);
00366 }
00367
00368 return true;
00369 }
00370 function _deleteAllByType($a_type)
00371 {
00372 global $ilDB;
00373
00374 $tables = array('il_meta_annotation',
00375 'il_meta_classification',
00376 'il_meta_contribute',
00377 'il_meta_description',
00378 'il_meta_educational',
00379 'il_meta_entity',
00380 'il_meta_format',
00381 'il_meta_general',
00382 'il_meta_identifier',
00383 'il_meta_identifier_',
00384 'il_meta_keyword',
00385 'il_meta_language',
00386 'il_meta_lifecycle',
00387 'il_meta_location',
00388 'il_meta_meta_data',
00389 'il_meta_relation',
00390 'il_meta_requirement',
00391 'il_meta_rights',
00392 'il_meta_taxon',
00393 'il_meta_taxon_path',
00394 'il_meta_technical',
00395 'il_meta_typical_age_range');
00396
00397 foreach($tables as $table)
00398 {
00399 $query = "DELETE FROM ".$table." ".
00400 "WHERE obj_type = '".$a_type."' ";
00401
00402 $ilDB->query($query);
00403 }
00404
00405 return true;
00406 }
00407 }
00408 ?>