ILIAS  release_10 Revision v10.1-43-ga1241a92c2f
ilMDMetaMetadata Class Reference
+ Inheritance diagram for ilMDMetaMetadata:
+ Collaboration diagram for ilMDMetaMetadata:

Public Member Functions

 getPossibleSubelements ()
 
 getIdentifierIds ()
 
 getIdentifier (int $a_identifier_id)
 
 addIdentifier ()
 
 getContributeIds ()
 
 getContribute (int $a_contribute_id)
 
 addContribute ()
 
 setMetaDataScheme (string $a_val)
 
 getMetaDataScheme ()
 
 setLanguage (ilMDLanguageItem $lng_obj)
 
 getLanguage ()
 
 getLanguageCode ()
 
 save ()
 
 update ()
 
 delete ()
 
 __getFields ()
 
 read ()
 
 toXML (ilXmlWriter $writer)
 
 setMetaId (int $a_meta_id, bool $a_read_data=true)
 Compatibility fix for legacy MD classes for new db tables. More...
 
- Public Member Functions inherited from ilMDBase
 __construct (int $a_rbac_id=0, int $a_obj_id=0, string $a_type='')
 constructor More...
 
 read ()
 
 setRBACId (int $a_id)
 
 getRBACId ()
 
 setObjId (int $a_id)
 
 getObjId ()
 
 setObjType (string $a_type)
 
 getObjType ()
 
 setMetaId (int $a_meta_id, bool $a_read_data=true)
 
 getMetaId ()
 
 setParentType (string $a_parent_type)
 
 getParentType ()
 
 setParentId (int $a_id)
 
 getParentId ()
 
 setExportMode (bool $a_export_mode=true)
 
 getExportMode ()
 
 validate ()
 
 update ()
 
 save ()
 
 delete ()
 
 toXML (ilXmlWriter $writer)
 

Static Public Member Functions

static _getId (int $a_rbac_id, int $a_obj_id)
 

Protected Member Functions

 createOrUpdateFirstSchema ()
 Compatibility fix for legacy MD classes for new db tables. More...
 
 deleteAllSchemas ()
 Compatibility fix for legacy MD classes for new db tables. More...
 
 readFirstSchema ()
 Compatibility fix for legacy MD classes for new db tables. More...
 
 getSchemaId ()
 Compatibility fix for legacy MD classes for new db tables. More...
 
 readSchemaId (int $parent_id)
 Compatibility fix for legacy MD classes for new db tables. More...
 

Private Attributes

string $meta_data_scheme = 'LOM v 1.0'
 
ilMDLanguageItem $language = null
 
int $schema_id = 0
 Compatibility fix for legacy MD classes for new db tables. More...
 

Additional Inherited Members

- Protected Attributes inherited from ilMDBase
ilLogger $log
 
ilDBInterface $db
 

Detailed Description

Definition at line 27 of file class.ilMDMetaMetadata.php.

Member Function Documentation

◆ __getFields()

ilMDMetaMetadata::__getFields ( )
Returns
array<string, array<string, mixed>>

Definition at line 189 of file class.ilMDMetaMetadata.php.

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

Referenced by save(), and update().

189  : array
190  {
191  return array(
192  'rbac_id' => array('integer', $this->getRBACId()),
193  'obj_id' => array('integer', $this->getObjId()),
194  'obj_type' => array('text', $this->getObjType()),
195  //'meta_data_scheme' => array('text', $this->getMetaDataScheme()),
196  'language' => array('text', $this->getLanguageCode())
197  );
198  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _getId()

static ilMDMetaMetadata::_getId ( int  $a_rbac_id,
int  $a_obj_id 
)
static

Definition at line 259 of file class.ilMDMetaMetadata.php.

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

Referenced by ilMD\getMetaMetadata().

259  : int
260  {
261  global $DIC;
262 
263  $ilDB = $DIC->database();
264 
265  $query = "SELECT meta_meta_data_id FROM il_meta_meta_data " .
266  "WHERE rbac_id = " . $ilDB->quote($a_rbac_id, 'integer') . " " .
267  "AND obj_id = " . $ilDB->quote($a_obj_id, 'integer');
268 
269  $res = $ilDB->query($query);
270  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
271  return (int) $row->meta_meta_data_id;
272  }
273  return 0;
274  }
$res
Definition: ltiservices.php:69
global $DIC
Definition: shib_login.php:25
+ Here is the caller graph for this function:

◆ addContribute()

ilMDMetaMetadata::addContribute ( )

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

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

98  {
99  $con = new ilMDContribute($this->getRBACId(), $this->getObjId(), $this->getObjType());
100  $con->setParentId($this->getMetaId());
101  $con->setParentType('meta_meta_data');
102 
103  return $con;
104  }
+ Here is the call graph for this function:

◆ addIdentifier()

ilMDMetaMetadata::addIdentifier ( )

Definition at line 69 of file class.ilMDMetaMetadata.php.

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

70  {
71  $ide = new ilMDIdentifier($this->getRBACId(), $this->getObjId(), $this->getObjType());
72  $ide->setParentId($this->getMetaId());
73  $ide->setParentType('meta_meta_data');
74 
75  return $ide;
76  }
+ Here is the call graph for this function:

◆ createOrUpdateFirstSchema()

ilMDMetaMetadata::createOrUpdateFirstSchema ( )
protected

Compatibility fix for legacy MD classes for new db tables.

Definition at line 280 of file class.ilMDMetaMetadata.php.

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

Referenced by save(), and update().

280  : void
281  {
282  if ($this->getMetaDataScheme() === '') {
283  return;
284  }
285 
286  if (!$this->getSchemaId()) {
287  $this->db->insert(
288  'il_meta_meta_schema',
289  [
290  'meta_meta_schema_id' => ['integer', $next_id = $this->db->nextId('il_meta_meta_schema')],
291  'rbac_id' => ['integer', $this->getRBACId()],
292  'obj_id' => ['integer', $this->getObjId()],
293  'obj_type' => ['text', $this->getObjType()],
294  'parent_type' => ['text', 'meta_general'],
295  'parent_id' => ['integer', $this->getMetaId()],
296  'meta_data_schema' => ['text', 'LOMv1.0'],
297  ]
298  );
299  $this->schema_id = $next_id;
300  }
301  }
getSchemaId()
Compatibility fix for legacy MD classes for new db tables.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ delete()

ilMDMetaMetadata::delete ( )

Definition at line 162 of file class.ilMDMetaMetadata.php.

References $id, $res, deleteAllSchemas(), getContribute(), getContributeIds(), getIdentifier(), getIdentifierIds(), and ilMDBase\getMetaId().

162  : bool
163  {
164  if ($this->getMetaId()) {
165  $query = "DELETE FROM il_meta_meta_data " .
166  "WHERE meta_meta_data_id = " . $this->db->quote($this->getMetaId(), 'integer');
167  $res = $this->db->manipulate($query);
168 
169  $this->deleteAllSchemas();
170 
171  foreach ($this->getIdentifierIds() as $id) {
172  $ide = $this->getIdentifier($id);
173  $ide->delete();
174  }
175 
176  foreach ($this->getContributeIds() as $id) {
177  $con = $this->getContribute($id);
178  $con->delete();
179  }
180  return true;
181  }
182 
183  return false;
184  }
$res
Definition: ltiservices.php:69
getContribute(int $a_contribute_id)
getIdentifier(int $a_identifier_id)
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:24
deleteAllSchemas()
Compatibility fix for legacy MD classes for new db tables.
+ Here is the call graph for this function:

◆ deleteAllSchemas()

ilMDMetaMetadata::deleteAllSchemas ( )
protected

Compatibility fix for legacy MD classes for new db tables.

Definition at line 306 of file class.ilMDMetaMetadata.php.

References $res, and ilMDBase\getMetaId().

Referenced by delete().

306  : void
307  {
308  $query = "DELETE FROM il_meta_meta_schema WHERE parent_type = 'meta_meta_data'
309  AND parent_id = " . $this->db->quote($this->getMetaId(), 'integer');
310  $res = $this->db->manipulate($query);
311  }
$res
Definition: ltiservices.php:69
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getContribute()

ilMDMetaMetadata::getContribute ( int  $a_contribute_id)

Definition at line 86 of file class.ilMDMetaMetadata.php.

Referenced by delete(), and toXML().

87  {
88  if (!$a_contribute_id) {
89  return null;
90  }
91  $con = new ilMDContribute();
92  $con->setMetaId($a_contribute_id);
93 
94  return $con;
95  }
+ Here is the caller graph for this function:

◆ getContributeIds()

ilMDMetaMetadata::getContributeIds ( )
Returns
int[]

Definition at line 81 of file class.ilMDMetaMetadata.php.

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

Referenced by delete(), and toXML().

81  : array
82  {
83  return ilMDContribute::_getIds($this->getRBACId(), $this->getObjId(), $this->getMetaId(), 'meta_meta_data');
84  }
static _getIds(int $a_rbac_id, int $a_obj_id, int $a_parent_id, string $a_parent_type)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getIdentifier()

ilMDMetaMetadata::getIdentifier ( int  $a_identifier_id)

Definition at line 58 of file class.ilMDMetaMetadata.php.

Referenced by delete(), and toXML().

59  {
60  if (!$a_identifier_id) {
61  return null;
62  }
63  $ide = new ilMDIdentifier();
64  $ide->setMetaId($a_identifier_id);
65 
66  return $ide;
67  }
+ Here is the caller graph for this function:

◆ getIdentifierIds()

ilMDMetaMetadata::getIdentifierIds ( )
Returns
int[]

Definition at line 53 of file class.ilMDMetaMetadata.php.

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

Referenced by delete(), and toXML().

53  : array
54  {
55  return ilMDIdentifier::_getIds($this->getRBACId(), $this->getObjId(), $this->getMetaId(), 'meta_meta_data');
56  }
static _getIds(int $a_rbac_id, int $a_obj_id, int $a_parent_id, string $a_parent_type)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getLanguage()

ilMDMetaMetadata::getLanguage ( )

Definition at line 124 of file class.ilMDMetaMetadata.php.

References ILIAS\UI\examples\Symbol\Glyph\Language\language().

125  {
126  return is_object($this->language) ? $this->language : null;
127  }
language()
description: > Example for rendring a language glyph.
Definition: language.php:25
+ Here is the call graph for this function:

◆ getLanguageCode()

ilMDMetaMetadata::getLanguageCode ( )

Definition at line 129 of file class.ilMDMetaMetadata.php.

References ILIAS\UI\examples\Symbol\Glyph\Language\language().

Referenced by __getFields(), and toXML().

129  : string
130  {
131  return is_object($this->language) ? $this->language->getLanguageCode() : '';
132  }
language()
description: > Example for rendring a language glyph.
Definition: language.php:25
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getMetaDataScheme()

ilMDMetaMetadata::getMetaDataScheme ( )

Definition at line 113 of file class.ilMDMetaMetadata.php.

Referenced by createOrUpdateFirstSchema(), and toXML().

113  : string
114  {
115  // Fixed attribute
116  return 'LOM v 1.0';
117  }
+ Here is the caller graph for this function:

◆ getPossibleSubelements()

ilMDMetaMetadata::getPossibleSubelements ( )
Returns
array<string, string>

Definition at line 40 of file class.ilMDMetaMetadata.php.

40  : array
41  {
42  $subs['Identifier'] = 'meta_identifier';
43  $subs['Contribute'] = 'meta_contribute';
44 
45  return $subs;
46  }

◆ getSchemaId()

ilMDMetaMetadata::getSchemaId ( )
protected

Compatibility fix for legacy MD classes for new db tables.

Definition at line 330 of file class.ilMDMetaMetadata.php.

References $schema_id.

Referenced by createOrUpdateFirstSchema().

330  : int
331  {
332  return $this->schema_id;
333  }
int $schema_id
Compatibility fix for legacy MD classes for new db tables.
+ Here is the caller graph for this function:

◆ read()

ilMDMetaMetadata::read ( )

Definition at line 200 of file class.ilMDMetaMetadata.php.

References $res, ilDBConstants\FETCHMODE_OBJECT, ilMDBase\getMetaId(), readFirstSchema(), setLanguage(), ilMDBase\setObjId(), ilMDBase\setObjType(), and ilMDBase\setRBACId().

200  : bool
201  {
202  if ($this->getMetaId()) {
203  $query = "SELECT * FROM il_meta_meta_data " .
204  "WHERE meta_meta_data_id = " . $this->db->quote($this->getMetaId(), 'integer');
205 
206  $res = $this->db->query($query);
207  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
208  $this->setRBACId((int) $row->rbac_id);
209  $this->setObjId((int) $row->obj_id);
210  $this->setObjType($row->obj_type);
211  //$this->setMetaDataScheme($row->meta_data_scheme ?? '');
212  $this->setLanguage(new ilMDLanguageItem($row->language ?? ''));
213  }
214 
215  $this->readFirstSchema();
216 
217  return true;
218  }
219  return false;
220  }
$res
Definition: ltiservices.php:69
setLanguage(ilMDLanguageItem $lng_obj)
setRBACId(int $a_id)
setObjId(int $a_id)
readFirstSchema()
Compatibility fix for legacy MD classes for new db tables.
setObjType(string $a_type)
+ Here is the call graph for this function:

◆ readFirstSchema()

ilMDMetaMetadata::readFirstSchema ( )
protected

Compatibility fix for legacy MD classes for new db tables.

Definition at line 316 of file class.ilMDMetaMetadata.php.

References $res, ilMDBase\getMetaId(), and setMetaDataScheme().

Referenced by read().

316  : void
317  {
318  $query = "SELECT * FROM il_meta_meta_schema WHERE meta_meta_schema_id = " .
319  $this->db->quote($this->getMetaId(), 'integer');
320 
321  $res = $this->db->query($query);
322  if ($row = $this->db->fetchAssoc($res)) {
323  $this->setMetaDataScheme((string) $row['meta_data_schema']);
324  }
325  }
$res
Definition: ltiservices.php:69
setMetaDataScheme(string $a_val)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ readSchemaId()

ilMDMetaMetadata::readSchemaId ( int  $parent_id)
protected

Compatibility fix for legacy MD classes for new db tables.

Definition at line 338 of file class.ilMDMetaMetadata.php.

References $res, and ILIAS\Repository\int().

Referenced by setMetaId().

338  : void
339  {
340  $query = "SELECT meta_meta_schema_id FROM il_meta_meta_schema WHERE parent_type = 'meta_meta_data'
341  AND parent_id = " . $this->db->quote($parent_id, 'integer') .
342  " ORDER BY meta_meta_schema_id";
343 
344  $res = $this->db->query($query);
345  if ($row = $this->db->fetchAssoc($res)) {
346  $this->schema_id = (int) $row['meta_meta_schema_id'];
347  }
348  }
$res
Definition: ltiservices.php:69
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ save()

ilMDMetaMetadata::save ( )

Definition at line 134 of file class.ilMDMetaMetadata.php.

References __getFields(), createOrUpdateFirstSchema(), ilMDBase\getMetaId(), and setMetaId().

134  : int
135  {
136  $fields = $this->__getFields();
137  $fields['meta_meta_data_id'] = array('integer', $next_id = $this->db->nextId('il_meta_meta_data'));
138 
139  if ($this->db->insert('il_meta_meta_data', $fields)) {
140  $this->setMetaId($next_id);
141  $this->createOrUpdateFirstSchema();
142  return $this->getMetaId();
143  }
144  return 0;
145  }
setMetaId(int $a_meta_id, bool $a_read_data=true)
Compatibility fix for legacy MD classes for new db tables.
createOrUpdateFirstSchema()
Compatibility fix for legacy MD classes for new db tables.
+ Here is the call graph for this function:

◆ setLanguage()

ilMDMetaMetadata::setLanguage ( ilMDLanguageItem  $lng_obj)

Definition at line 119 of file class.ilMDMetaMetadata.php.

References ILIAS\UI\examples\Symbol\Glyph\Language\language().

Referenced by read().

119  : void
120  {
121  $this->language = $lng_obj;
122  }
language()
description: > Example for rendring a language glyph.
Definition: language.php:25
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setMetaDataScheme()

ilMDMetaMetadata::setMetaDataScheme ( string  $a_val)

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

Referenced by readFirstSchema().

108  : void
109  {
110  $this->meta_data_scheme = $a_val;
111  }
+ Here is the caller graph for this function:

◆ setMetaId()

ilMDMetaMetadata::setMetaId ( int  $a_meta_id,
bool  $a_read_data = true 
)

Compatibility fix for legacy MD classes for new db tables.

Definition at line 353 of file class.ilMDMetaMetadata.php.

References readSchemaId().

Referenced by save().

353  : void
354  {
355  $this->readSchemaId($a_meta_id);
356  parent::setMetaId($a_meta_id, $a_read_data);
357  }
readSchemaId(int $parent_id)
Compatibility fix for legacy MD classes for new db tables.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ toXML()

ilMDMetaMetadata::toXML ( ilXmlWriter  $writer)

Definition at line 222 of file class.ilMDMetaMetadata.php.

References $id, getContribute(), getContributeIds(), getIdentifier(), getIdentifierIds(), getLanguageCode(), getMetaDataScheme(), ilMDBase\getObjId(), ilMDBase\getRBACId(), ilXmlWriter\xmlEndTag(), and ilXmlWriter\xmlStartTag().

222  : void
223  {
224  $attr = null;
225  if ($this->getMetaDataScheme()) {
226  $attr['MetadataScheme'] = $this->getMetaDataScheme();
227  }
228  if ($this->getLanguageCode()) {
229  $attr['Language'] = $this->getLanguageCode();
230  }
231  $writer->xmlStartTag('Meta-Metadata', $attr);
232 
233  // ELEMENT IDENTIFIER
234  $identifiers = $this->getIdentifierIds();
235  foreach ($identifiers as $id) {
236  $ide = $this->getIdentifier($id);
237  $ide->toXML($writer);
238  }
239  if (!count($identifiers)) {
240  $ide = new ilMDIdentifier($this->getRBACId(), $this->getObjId());
241  $ide->toXML($writer);
242  }
243 
244  // ELEMETN Contribute
245  $contributes = $this->getContributeIds();
246  foreach ($contributes as $id) {
247  $con = $this->getContribute($id);
248  $con->toXML($writer);
249  }
250  if (!count($contributes)) {
251  $con = new ilMDContribute($this->getRBACId(), $this->getObjId());
252  $con->toXML($writer);
253  }
254 
255  $writer->xmlEndTag('Meta-Metadata');
256  }
getContribute(int $a_contribute_id)
xmlEndTag(string $tag)
Writes an endtag.
getIdentifier(int $a_identifier_id)
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:24
xmlStartTag(string $tag, ?array $attrs=null, bool $empty=false, bool $encode=true, bool $escape=true)
Writes a starttag.
+ Here is the call graph for this function:

◆ update()

ilMDMetaMetadata::update ( )

Definition at line 147 of file class.ilMDMetaMetadata.php.

References __getFields(), createOrUpdateFirstSchema(), and ilMDBase\getMetaId().

147  : bool
148  {
149  if (!$this->getMetaId()) {
150  return false;
151  }
152 
153  $this->createOrUpdateFirstSchema();
154 
155  return (bool) $this->db->update(
156  'il_meta_meta_data',
157  $this->__getFields(),
158  array("meta_meta_data_id" => array('integer', $this->getMetaId()))
159  );
160  }
createOrUpdateFirstSchema()
Compatibility fix for legacy MD classes for new db tables.
+ Here is the call graph for this function:

Field Documentation

◆ $language

ilMDLanguageItem ilMDMetaMetadata::$language = null
private

Definition at line 30 of file class.ilMDMetaMetadata.php.

◆ $meta_data_scheme

string ilMDMetaMetadata::$meta_data_scheme = 'LOM v 1.0'
private

Definition at line 29 of file class.ilMDMetaMetadata.php.

◆ $schema_id

int ilMDMetaMetadata::$schema_id = 0
private

Compatibility fix for legacy MD classes for new db tables.

Definition at line 35 of file class.ilMDMetaMetadata.php.

Referenced by getSchemaId().


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