ILIAS  release_4-3 Revision
 All Data Structures Namespaces Files Functions Variables Groups Pages
class.ilMDFactory.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 
33 {
34  /*
35  * get md element by index and type
36  *
37  * @param string type (name e.g meta_general,meta_language)
38  *
39  * @return MD object
40  */
41  function &_getInstance($a_type,$a_index,$a_technical_id = 0)
42  {
43  switch($a_type)
44  {
45  case 'meta_technical':
46  include_once 'Services/MetaData/classes/class.ilMDTechnical.php';
47 
48  $tec = new ilMDTechnical();
49  $tec->setMetaId($a_index);
50 
51  return $tec;
52 
53  case 'meta_or_composite':
54  include_once 'Services/MetaData/classes/class.ilMDOrComposite.php';
55  include_once 'Services/MetaData/classes/class.ilMDTechnical.php';
56 
57  $tec = new ilMDTechnical();
58  $tec->setMetaId($a_technical_id);
59 
60  return $tec->getOrComposite($a_index);
61 
62  case 'meta_requirement':
63  include_once 'Services/MetaData/classes/class.ilMDRequirement.php';
64 
65  $req =& new ilMDRequirement();
66  $req->setMetaId($a_index);
67 
68  return $req;
69 
70 
71  case 'meta_location':
72  include_once 'Services/MetaData/classes/class.ilMDLocation.php';
73 
74  $loc =& new ilMDLocation();
75  $loc->setMetaId($a_index);
76 
77  return $loc;
78 
79  case 'meta_format':
80  include_once 'Services/MetaData/classes/class.ilMDFormat.php';
81 
82  $for =& new ilMDFormat();
83  $for->setMetaId($a_index);
84 
85  return $for;
86 
87  case 'meta_lifecycle':
88  include_once 'Services/MetaData/classes/class.ilMDLifecycle.php';
89 
90  $lif =& new ilMDLifecycle();
91  $lif->setMetaId($a_index);
92 
93  return $lif;
94 
95  case 'meta_entity':
96  include_once 'Services/MetaData/classes/class.ilMDEntity.php';
97 
98  $ent =& new ilMDEntity();
99  $ent->setMetaId($a_index);
100 
101  return $ent;
102 
103  case 'meta_contribute':
104  include_once 'Services/MetaData/classes/class.ilMDContribute.php';
105 
106  $con =& new ilMDContribute();
107  $con->setMetaId($a_index);
108 
109  return $con;
110 
111  case 'meta_identifier':
112  include_once 'Services/MetaData/classes/class.ilMDIdentifier.php';
113 
114  $ide =& new ilMDIdentifier();
115  $ide->setMetaId($a_index);
116 
117  return $ide;
118 
119  case 'educational_description':
120  case 'meta_description':
121  include_once 'Services/MetaData/classes/class.ilMDDescription.php';
122 
123  $des =& new ilMDDescription();
124  $des->setMetaId($a_index);
125 
126  return $des;
127 
128  case 'meta_keyword':
129  case 'classification_keyword':
130  include_once 'Services/MetaData/classes/class.ilMDKeyword.php';
131 
132  $key =& new ilMDKeyword();
133  $key->setMetaId($a_index);
134 
135  return $key;
136 
137  case 'educational_language':
138  case 'meta_language':
139  include_once 'Services/MetaData/classes/class.ilMDLanguage.php';
140 
141  $lan =& new ilMDLanguage();
142  $lan->setMetaId($a_index);
143 
144  return $lan;
145 
146  case 'meta_rights':
147  include_once 'Services/MetaData/classes/class.ilMDRights.php';
148 
149  $rights =& new ilMDRights();
150  $rights->setMetaId($a_index);
151  return $rights;
152 
153  case 'meta_educational':
154  include_once 'Services/MetaData/classes/class.ilMDEducational.php';
155 
156  $edu =& new ilMDEducational();
157  $edu->setMetaId($a_index);
158  return $edu;
159 
160  case 'educational_typical_age_range':
161  include_once 'Services/MetaData/classes/class.ilMDTypicalAgeRange.php';
162 
163  $age =& new ilMDTypicalAgeRange();
164  $age->setMetaId($a_index);
165  return $age;
166 
167  case 'meta_relation':
168  include_once 'Services/MetaData/classes/class.ilMDRelation.php';
169 
170  $relation =& new ilMDRelation();
171  $relation->setMetaId($a_index);
172  return $relation;
173 
174  case 'relation_resource_identifier':
175  include_once 'Services/MetaData/classes/class.ilMDIdentifier_.php';
176 
177  $ide =& new ilMDIdentifier_();
178  $ide->setMetaId($a_index);
179 
180  return $ide;
181 
182  case 'relation_resource_description':
183  include_once 'Services/MetaData/classes/class.ilMDDescription.php';
184 
185  $des =& new ilMDDescription();
186  $des->setMetaId($a_index);
187 
188  return $des;
189 
190  case 'meta_annotation':
191  include_once 'Services/MetaData/classes/class.ilMDAnnotation.php';
192 
193  $anno =& new ilMDAnnotation();
194  $anno->setMetaId($a_index);
195  return $anno;
196 
197  case 'meta_classification':
198  include_once 'Services/MetaData/classes/class.ilMDClassification.php';
199 
200  $class =& new ilMDClassification();
201  $class->setMetaId($a_index);
202  return $class;
203 
204  case 'classification_taxon_path':
205  include_once 'Services/MetaData/classes/class.ilMDTaxonPath.php';
206 
207  $tax_path =& new ilMDTaxonPath();
208 
209  $tax_path->setMetaId($a_index);
210  return $tax_path;
211 
212  case 'classification_taxon':
213  include_once 'Services/MetaData/classes/class.ilMDTaxon.php';
214 
215  $tax =& new ilMDTaxon();
216  $tax->setMetaId($a_index);
217  return $tax;
218 
219  case 'meta_meta_metadata':
220  include_once 'Services/MetaData/classes/class.ilMDMetaMetadata.php';
221 
222  $met =& new ilMDMetaMetadata();
223  $met->setMetaId($a_index);
224  return $met;
225 
226  default:
227  echo $a_type . " not known";
228 
229  }
230  }
231 }
232 ?>