ILIAS  release_9 Revision v9.13-25-g2c18ec4c24f
ilMDGeneral Class Reference
+ Inheritance diagram for ilMDGeneral:
+ Collaboration diagram for ilMDGeneral:

Public Member Functions

 getPossibleSubelements ()
 
 getIdentifierIds ()
 
 getIdentifier (int $a_identifier_id)
 
 addIdentifier ()
 
 getLanguageIds ()
 
 getLanguage (int $a_language_id)
 
 addLanguage ()
 
 getDescriptionIds ()
 
 getDescription (int $a_description_id)
 
 addDescription ()
 
 getKeywordIds ()
 
 getKeyword (int $a_keyword_id)
 
 addKeyword ()
 
 setStructure (string $a_structure)
 
 getStructure ()
 
 setTitle (string $a_title)
 
 getTitle ()
 
 setTitleLanguage (ilMDLanguageItem $lng_obj)
 
 getTitleLanguage ()
 
 getTitleLanguageCode ()
 
 setCoverage (string $a_coverage)
 
 getCoverage ()
 
 setCoverageLanguage (ilMDLanguageItem $lng_obj)
 
 getCoverageLanguage ()
 
 getCoverageLanguageCode ()
 
 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

 createOrUpdateCoverage ()
 Compatibility fix for legacy MD classes for new db tables. More...
 
 deleteAllCoverages ()
 Compatibility fix for legacy MD classes for new db tables. More...
 
 readFirstCoverage ()
 Compatibility fix for legacy MD classes for new db tables. More...
 
 getCoverageId ()
 Compatibility fix for legacy MD classes for new db tables. More...
 
 readCoverageId (int $parent_id)
 Compatibility fix for legacy MD classes for new db tables. More...
 

Protected Attributes

const ilMDLanguageItem $coverage_language = null
 
- Protected Attributes inherited from ilMDBase
ilLogger $log
 
ilDBInterface $db
 

Private Attributes

const STRUCTURE_TRANSLATION
 Compatibility fix for legacy MD classes for new db tables. More...
 
string $coverage = ''
 
string $structure = ''
 
string $title = ''
 
ilMDLanguageItem $title_language = null
 
int $coverage_id = 0
 Compatibility fix for legacy MD classes for new db tables. More...
 

Detailed Description

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

Member Function Documentation

◆ __getFields()

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

Compatibility fix for legacy MD classes for new db tables

Definition at line 327 of file class.ilMDGeneral.php.

References ilMDBase\getObjId(), ilMDBase\getObjType(), ilMDBase\getRBACId(), getStructure(), getTitle(), and getTitleLanguageCode().

Referenced by save(), and update().

327  : array
328  {
332  $structure = (string) array_search(
333  $this->getStructure(),
334  self::STRUCTURE_TRANSLATION
335  );
336 
337  return array(
338  'rbac_id' => array('integer', $this->getRBACId()),
339  'obj_id' => array('integer', $this->getObjId()),
340  'obj_type' => array('text', $this->getObjType()),
341  'general_structure' => array('text', $structure),
342  'title' => array('text', $this->getTitle()),
343  'title_language' => array('text', $this->getTitleLanguageCode()),
344  //'coverage' => array('text', $this->getCoverage()),
345  //'coverage_language' => array('text', $this->getCoverageLanguageCode())
346  );
347  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _getId()

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

Definition at line 460 of file class.ilMDGeneral.php.

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

Referenced by ilMD\getGeneral(), and ILIAS\Repository\Provider\RepositoryOpenGraphExposer\getGeneralObjectMeta().

460  : int
461  {
462  global $DIC;
463 
464  $ilDB = $DIC->database();
465 
466  $query = "SELECT meta_general_id FROM il_meta_general " .
467  "WHERE rbac_id = " . $ilDB->quote($a_rbac_id, 'integer') . " " .
468  "AND obj_id = " . $ilDB->quote($a_obj_id, 'integer');
469 
470  $res = $ilDB->query($query);
471  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
472  return (int) $row->meta_general_id;
473  }
474  return 0;
475  }
$res
Definition: ltiservices.php:69
global $DIC
Definition: feed.php:28
+ Here is the caller graph for this function:

◆ addDescription()

ilMDGeneral::addDescription ( )

Definition at line 142 of file class.ilMDGeneral.php.

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

143  {
144  $des = new ilMDDescription($this->getRBACId(), $this->getObjId(), $this->getObjType());
145  $des->setParentId($this->getMetaId());
146  $des->setParentType('meta_general');
147 
148  return $des;
149  }
+ Here is the call graph for this function:

◆ addIdentifier()

ilMDGeneral::addIdentifier ( )

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

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

87  {
88  $ide = new ilMDIdentifier($this->getRBACId(), $this->getObjId(), $this->getObjType());
89  $ide->setParentId($this->getMetaId());
90  $ide->setParentType('meta_general');
91 
92  return $ide;
93  }
+ Here is the call graph for this function:

◆ addKeyword()

ilMDGeneral::addKeyword ( )

Definition at line 170 of file class.ilMDGeneral.php.

References ILIAS\LTI\ToolProvider\$key, ilMDBase\getMetaId(), ilMDBase\getObjId(), ilMDBase\getObjType(), and ilMDBase\getRBACId().

Referenced by ilMDKeyword\updateKeywords().

170  : ilMDKeyword
171  {
172  $key = new ilMDKeyword($this->getRBACId(), $this->getObjId(), $this->getObjType());
173  $key->setParentId($this->getMetaId());
174  $key->setParentType('meta_general');
175 
176  return $key;
177  }
string $key
Consumer key/client ID value.
Definition: System.php:193
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ addLanguage()

ilMDGeneral::addLanguage ( )

Definition at line 114 of file class.ilMDGeneral.php.

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

114  : ilMDLanguage
115  {
116  $lan = new ilMDLanguage($this->getRBACId(), $this->getObjId(), $this->getObjType());
117  $lan->setParentId($this->getMetaId());
118  $lan->setParentType('meta_general');
119 
120  return $lan;
121  }
+ Here is the call graph for this function:

◆ createOrUpdateCoverage()

ilMDGeneral::createOrUpdateCoverage ( )
protected

Compatibility fix for legacy MD classes for new db tables.

Definition at line 480 of file class.ilMDGeneral.php.

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

Referenced by save(), and update().

480  : void
481  {
482  if ($this->getCoverage() === '' && $this->getCoverageLanguageCode() === '') {
483  return;
484  }
485 
486  if (!$this->getCoverageId()) {
487  $this->db->insert(
488  'il_meta_coverage',
489  [
490  'meta_coverage_id' => ['integer', $next_id = $this->db->nextId('il_meta_coverage')],
491  'rbac_id' => ['integer', $this->getRBACId()],
492  'obj_id' => ['integer', $this->getObjId()],
493  'obj_type' => ['text', $this->getObjType()],
494  'parent_type' => ['text', 'meta_general'],
495  'parent_id' => ['integer', $this->getMetaId()],
496  'coverage' => ['text', $this->getCoverage()],
497  'coverage_language' => ['text', $this->getCoverageLanguageCode()]
498  ]
499  );
500  $this->coverage_id = $next_id;
501  return;
502  }
503 
504  $this->db->update(
505  'il_meta_coverage',
506  [
507  'coverage' => ['text', $this->getCoverage()],
508  'coverage_language' => ['text', $this->getCoverageLanguageCode()]
509  ],
510  ['meta_coverage_id' => ['integer', $this->getCoverageId()]]
511  );
512  }
getCoverageId()
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()

ilMDGeneral::delete ( )

Definition at line 283 of file class.ilMDGeneral.php.

References $id, ILIAS\LTI\ToolProvider\$key, $res, deleteAllCoverages(), getDescription(), getDescriptionIds(), getIdentifier(), getIdentifierIds(), getKeyword(), getKeywordIds(), getLanguage(), getLanguageIds(), and ilMDBase\getMetaId().

283  : bool
284  {
285  if (!$this->getMetaId()) {
286  return false;
287  }
288  // Identifier
289  foreach ($this->getIdentifierIds() as $id) {
290  $ide = $this->getIdentifier($id);
291  $ide->delete();
292  }
293 
294  // Language
295  foreach ($this->getLanguageIds() as $id) {
296  $lan = $this->getLanguage($id);
297  $lan->delete();
298  }
299 
300  // Description
301  foreach ($this->getDescriptionIds() as $id) {
302  $des = $this->getDescription($id);
303  $des->delete();
304  }
305 
306  // Keyword
307  foreach ($this->getKeywordIds() as $id) {
308  $key = $this->getKeyword($id);
309  $key->delete();
310  }
311 
312  if ($this->getMetaId()) {
313  $query = "DELETE FROM il_meta_general " .
314  "WHERE meta_general_id = " . $this->db->quote($this->getMetaId(), 'integer');
315  $res = $this->db->manipulate($query);
316 
317  $this->deleteAllCoverages();
318  return true;
319  }
320 
321  return false;
322  }
$res
Definition: ltiservices.php:69
getIdentifier(int $a_identifier_id)
deleteAllCoverages()
Compatibility fix for legacy MD classes for new db tables.
string $key
Consumer key/client ID value.
Definition: System.php:193
getDescription(int $a_description_id)
getLanguage(int $a_language_id)
getKeyword(int $a_keyword_id)
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
+ Here is the call graph for this function:

◆ deleteAllCoverages()

ilMDGeneral::deleteAllCoverages ( )
protected

Compatibility fix for legacy MD classes for new db tables.

Definition at line 517 of file class.ilMDGeneral.php.

References $res, and ilMDBase\getMetaId().

Referenced by delete().

517  : void
518  {
519  $query = "DELETE FROM il_meta_coverage WHERE parent_type = 'meta_general'
520  AND parent_id = " . $this->db->quote($this->getMetaId(), 'integer');
521  $res = $this->db->manipulate($query);
522  }
$res
Definition: ltiservices.php:69
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getCoverage()

ilMDGeneral::getCoverage ( )

Definition at line 231 of file class.ilMDGeneral.php.

References $coverage.

Referenced by createOrUpdateCoverage(), and toXML().

231  : string
232  {
233  return $this->coverage;
234  }
+ Here is the caller graph for this function:

◆ getCoverageId()

ilMDGeneral::getCoverageId ( )
protected

Compatibility fix for legacy MD classes for new db tables.

Definition at line 542 of file class.ilMDGeneral.php.

References $coverage_id.

Referenced by createOrUpdateCoverage(), and readFirstCoverage().

542  : int
543  {
544  return $this->coverage_id;
545  }
int $coverage_id
Compatibility fix for legacy MD classes for new db tables.
+ Here is the caller graph for this function:

◆ getCoverageLanguage()

ilMDGeneral::getCoverageLanguage ( )

Definition at line 241 of file class.ilMDGeneral.php.

242  {
243  return is_object($this->coverage_language) ? $this->coverage_language : null;
244  }

◆ getCoverageLanguageCode()

ilMDGeneral::getCoverageLanguageCode ( )

Definition at line 246 of file class.ilMDGeneral.php.

Referenced by createOrUpdateCoverage(), and toXML().

246  : string
247  {
248  return is_object($this->coverage_language) ? $this->coverage_language->getLanguageCode() : '';
249  }
+ Here is the caller graph for this function:

◆ getDescription()

ilMDGeneral::getDescription ( int  $a_description_id)

Definition at line 131 of file class.ilMDGeneral.php.

Referenced by delete(), and toXML().

131  : ?ilMDDescription
132  {
133  if (!$a_description_id) {
134  return null;
135  }
136  $des = new ilMDDescription();
137  $des->setMetaId($a_description_id);
138 
139  return $des;
140  }
+ Here is the caller graph for this function:

◆ getDescriptionIds()

ilMDGeneral::getDescriptionIds ( )
Returns
int[]

Definition at line 126 of file class.ilMDGeneral.php.

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

Referenced by delete(), and toXML().

126  : array
127  {
128  return ilMDDescription::_getIds($this->getRBACId(), $this->getObjId(), (int) $this->getMetaId(), 'meta_general');
129  }
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()

ilMDGeneral::getIdentifier ( int  $a_identifier_id)

Definition at line 75 of file class.ilMDGeneral.php.

Referenced by delete(), and toXML().

76  {
77  if (!$a_identifier_id) {
78  return null;
79  }
80  $ide = new ilMDIdentifier();
81  $ide->setMetaId($a_identifier_id);
82 
83  return $ide;
84  }
+ Here is the caller graph for this function:

◆ getIdentifierIds()

ilMDGeneral::getIdentifierIds ( )
Returns
int[]

Definition at line 70 of file class.ilMDGeneral.php.

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

Referenced by delete(), and toXML().

70  : array
71  {
72  return ilMDIdentifier::_getIds($this->getRBACId(), $this->getObjId(), (int) $this->getMetaId(), 'meta_general');
73  }
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:

◆ getKeyword()

ilMDGeneral::getKeyword ( int  $a_keyword_id)

Definition at line 159 of file class.ilMDGeneral.php.

References ILIAS\LTI\ToolProvider\$key.

Referenced by delete(), toXML(), and ilMDKeyword\updateKeywords().

159  : ?ilMDKeyword
160  {
161  if (!$a_keyword_id) {
162  return null;
163  }
164  $key = new ilMDKeyword();
165  $key->setMetaId($a_keyword_id);
166 
167  return $key;
168  }
string $key
Consumer key/client ID value.
Definition: System.php:193
+ Here is the caller graph for this function:

◆ getKeywordIds()

ilMDGeneral::getKeywordIds ( )
Returns
int[]

Definition at line 154 of file class.ilMDGeneral.php.

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

Referenced by delete(), toXML(), and ilMDKeyword\updateKeywords().

154  : array
155  {
156  return ilMDKeyword::_getIds($this->getRBACId(), $this->getObjId(), (int) $this->getMetaId(), 'meta_general');
157  }
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()

ilMDGeneral::getLanguage ( int  $a_language_id)

Definition at line 103 of file class.ilMDGeneral.php.

Referenced by delete(), and toXML().

103  : ?ilMDLanguage
104  {
105  if (!$a_language_id) {
106  return null;
107  }
108  $lan = new ilMDLanguage();
109  $lan->setMetaId($a_language_id);
110 
111  return $lan;
112  }
+ Here is the caller graph for this function:

◆ getLanguageIds()

ilMDGeneral::getLanguageIds ( )
Returns
int[]

Definition at line 98 of file class.ilMDGeneral.php.

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

Referenced by delete(), and toXML().

98  : array
99  {
100  return ilMDLanguage::_getIds($this->getRBACId(), $this->getObjId(), (int) $this->getMetaId(), 'meta_general');
101  }
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:

◆ getPossibleSubelements()

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

Definition at line 55 of file class.ilMDGeneral.php.

55  : array
56  {
57  $subs['Keyword'] = 'meta_keyword';
58  $subs['Language'] = 'meta_language';
59  $subs['Identifier'] = 'meta_identifier';
60  $subs['Description'] = 'meta_description';
61 
62  return $subs;
63  }

◆ getStructure()

ilMDGeneral::getStructure ( )

Definition at line 196 of file class.ilMDGeneral.php.

References $structure.

Referenced by __getFields(), and toXML().

196  : string
197  {
198  return $this->structure;
199  }
+ Here is the caller graph for this function:

◆ getTitle()

ilMDGeneral::getTitle ( )

Definition at line 206 of file class.ilMDGeneral.php.

References $title.

Referenced by __getFields(), and toXML().

206  : string
207  {
208  return $this->title;
209  }
+ Here is the caller graph for this function:

◆ getTitleLanguage()

ilMDGeneral::getTitleLanguage ( )

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

217  {
218  return is_object($this->title_language) ? $this->title_language : null;
219  }

◆ getTitleLanguageCode()

ilMDGeneral::getTitleLanguageCode ( )

Definition at line 221 of file class.ilMDGeneral.php.

Referenced by __getFields(), and toXML().

221  : string
222  {
223  return is_object($this->title_language) ? $this->title_language->getLanguageCode() : '';
224  }
+ Here is the caller graph for this function:

◆ read()

ilMDGeneral::read ( )

Compatibility fix for legacy MD classes for new db tables

Definition at line 349 of file class.ilMDGeneral.php.

References $res, ilDBConstants\FETCHMODE_OBJECT, ilMDBase\getMetaId(), readFirstCoverage(), ilMDBase\setObjId(), ilMDBase\setObjType(), ilMDBase\setRBACId(), setStructure(), setTitle(), and setTitleLanguage().

349  : bool
350  {
351  if ($this->getMetaId()) {
352  $query = "SELECT * FROM il_meta_general " .
353  "WHERE meta_general_id = " . $this->db->quote($this->getMetaId(), 'integer');
354 
355  $res = $this->db->query($query);
356  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
360  if (key_exists($row->general_structure ?? '', self::STRUCTURE_TRANSLATION)) {
361  $row->general_structure = self::STRUCTURE_TRANSLATION[$row->general_structure ?? ''];
362  }
363 
364  $this->setRBACId((int) $row->rbac_id);
365  $this->setObjId((int) $row->obj_id);
366  $this->setObjType((string) $row->obj_type);
367  $this->setStructure((string) $row->general_structure);
368  $this->setTitle((string) $row->title);
369  $this->setTitleLanguage(new ilMDLanguageItem($row->title_language ?? ''));
370  //$this->setCoverage((string) $row->coverage);
371  //$this->setCoverageLanguage(new ilMDLanguageItem($row->coverage_language ?? ''));
372  }
373 
374  $this->readFirstCoverage();
375  }
376  return true;
377  }
$res
Definition: ltiservices.php:69
setTitle(string $a_title)
setStructure(string $a_structure)
setRBACId(int $a_id)
setObjId(int $a_id)
readFirstCoverage()
Compatibility fix for legacy MD classes for new db tables.
setTitleLanguage(ilMDLanguageItem $lng_obj)
setObjType(string $a_type)
+ Here is the call graph for this function:

◆ readCoverageId()

ilMDGeneral::readCoverageId ( int  $parent_id)
protected

Compatibility fix for legacy MD classes for new db tables.

Definition at line 550 of file class.ilMDGeneral.php.

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

Referenced by setMetaId().

550  : void
551  {
552  $query = "SELECT meta_coverage_id FROM il_meta_coverage WHERE parent_type = 'meta_general'
553  AND parent_id = " . $this->db->quote($parent_id, 'integer') .
554  " ORDER BY meta_coverage_id";
555 
556  $res = $this->db->query($query);
557  if ($row = $this->db->fetchAssoc($res)) {
558  $this->coverage_id = (int) $row['meta_coverage_id'];
559  }
560  }
$res
Definition: ltiservices.php:69
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ readFirstCoverage()

ilMDGeneral::readFirstCoverage ( )
protected

Compatibility fix for legacy MD classes for new db tables.

Definition at line 527 of file class.ilMDGeneral.php.

References $res, getCoverageId(), setCoverage(), and setCoverageLanguage().

Referenced by read().

527  : void
528  {
529  $query = "SELECT * FROM il_meta_coverage WHERE meta_coverage_id = " .
530  $this->db->quote($this->getCoverageId(), 'integer');
531 
532  $res = $this->db->query($query);
533  if ($row = $this->db->fetchAssoc($res)) {
534  $this->setCoverage((string) $row['coverage']);
535  $this->setCoverageLanguage(new ilMDLanguageItem((string) $row['coverage_language']));
536  }
537  }
$res
Definition: ltiservices.php:69
getCoverageId()
Compatibility fix for legacy MD classes for new db tables.
setCoverage(string $a_coverage)
setCoverageLanguage(ilMDLanguageItem $lng_obj)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ save()

ilMDGeneral::save ( )

Definition at line 251 of file class.ilMDGeneral.php.

References __getFields(), createOrUpdateCoverage(), ilLogLevel\DEBUG, ilMDBase\getMetaId(), and setMetaId().

251  : int
252  {
253  $fields = $this->__getFields();
254  $fields['meta_general_id'] = array('integer', $next_id = $this->db->nextId('il_meta_general'));
255 
256  $this->log->debug("Insert General " . print_r($fields, true));
257  $this->log->logStack(ilLogLevel::DEBUG);
258  //ilUtil::printBacktrace(10);
259 
260  if ($this->db->insert('il_meta_general', $fields)) {
261  $this->setMetaId($next_id);
262  $this->createOrUpdateCoverage();
263  return $this->getMetaId();
264  }
265  return 0;
266  }
setMetaId(int $a_meta_id, bool $a_read_data=true)
Compatibility fix for legacy MD classes for new db tables.
createOrUpdateCoverage()
Compatibility fix for legacy MD classes for new db tables.
+ Here is the call graph for this function:

◆ setCoverage()

ilMDGeneral::setCoverage ( string  $a_coverage)

Definition at line 226 of file class.ilMDGeneral.php.

Referenced by readFirstCoverage().

226  : void
227  {
228  $this->coverage = $a_coverage;
229  }
+ Here is the caller graph for this function:

◆ setCoverageLanguage()

ilMDGeneral::setCoverageLanguage ( ilMDLanguageItem  $lng_obj)

Definition at line 236 of file class.ilMDGeneral.php.

Referenced by readFirstCoverage().

236  : void
237  {
238  $this->coverage_language = $lng_obj;
239  }
+ Here is the caller graph for this function:

◆ setMetaId()

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

Compatibility fix for legacy MD classes for new db tables.

Definition at line 565 of file class.ilMDGeneral.php.

References readCoverageId().

Referenced by save().

565  : void
566  {
567  $this->readCoverageId($a_meta_id);
568  parent::setMetaId($a_meta_id, $a_read_data);
569  }
readCoverageId(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:

◆ setStructure()

ilMDGeneral::setStructure ( string  $a_structure)

Definition at line 180 of file class.ilMDGeneral.php.

Referenced by read().

180  : bool
181  {
182  switch ($a_structure) {
183  case 'Atomic':
184  case 'Collection':
185  case 'Networked':
186  case 'Hierarchical':
187  case 'Linear':
188  $this->structure = $a_structure;
189  return true;
190 
191  default:
192  return false;
193  }
194  }
+ Here is the caller graph for this function:

◆ setTitle()

ilMDGeneral::setTitle ( string  $a_title)

Definition at line 201 of file class.ilMDGeneral.php.

Referenced by read().

201  : void
202  {
203  $this->title = $a_title;
204  }
+ Here is the caller graph for this function:

◆ setTitleLanguage()

ilMDGeneral::setTitleLanguage ( ilMDLanguageItem  $lng_obj)

Definition at line 211 of file class.ilMDGeneral.php.

Referenced by read().

211  : void
212  {
213  $this->title_language = $lng_obj;
214  }
+ Here is the caller graph for this function:

◆ toXML()

ilMDGeneral::toXML ( ilXmlWriter  $writer)

Definition at line 379 of file class.ilMDGeneral.php.

References $id, ILIAS\LTI\ToolProvider\$key, getCoverage(), getCoverageLanguageCode(), getDescription(), getDescriptionIds(), ilMDBase\getExportMode(), getIdentifier(), getIdentifierIds(), getKeyword(), getKeywordIds(), getLanguage(), getLanguageIds(), ilMDBase\getObjId(), ilMDBase\getObjType(), ilMDBase\getRBACId(), getStructure(), getTitle(), getTitleLanguageCode(), ilXmlWriter\xmlElement(), ilXmlWriter\xmlEndTag(), and ilXmlWriter\xmlStartTag().

379  : void
380  {
381  $writer->xmlStartTag('General', array(
382  'Structure' => $this->getStructure() ?: 'Atomic'
383  ));
384 
385  // Identifier
386  $first = true;
387  $identifiers = $this->getIdentifierIds();
388  foreach ($identifiers as $id) {
389  $ide = $this->getIdentifier($id);
390  $ide->setExportMode($this->getExportMode());
391  $ide->toXML($writer);
392  $first = false;
393  }
394  if (!count($identifiers)) {
395  $ide = new ilMDIdentifier(
396  $this->getRBACId(),
397  $this->getObjId(),
398  $this->getObjType()
399  ); // added type, alex, 31 Oct 2007
400  $ide->setExportMode(true);
401  $ide->toXML($writer);
402  }
403 
404  // Title
405  $writer->xmlElement(
406  'Title',
407  array(
408  'Language' => $this->getTitleLanguageCode() ?: 'en'
409  ),
410  $this->getTitle()
411  );
412 
413  // Language
414  $languages = $this->getLanguageIds();
415  foreach ($languages as $id) {
416  $lan = $this->getLanguage($id);
417  $lan->toXML($writer);
418  }
419 
420  // Description
421  $descriptions = $this->getDescriptionIds();
422  foreach ($descriptions as $id) {
423  $des = $this->getDescription($id);
424  $des->toXML($writer);
425  }
426  if (!count($descriptions)) {
427  // Default
428 
429  $des = new ilMDDescription($this->getRBACId(), $this->getObjId());
430  $des->toXML($writer);
431  }
432 
433  // Keyword
434  $keywords = $this->getKeywordIds();
435  foreach ($keywords as $id) {
436  $key = $this->getKeyword($id);
437  $key->toXML($writer);
438  }
439  if (!count($keywords)) {
440  // Default
441 
442  $key = new ilMDKeyword($this->getRBACId(), $this->getObjId());
443  $key->toXML($writer);
444  }
445 
446  // Copverage
447  if ($this->getCoverage() !== '') {
448  $writer->xmlElement(
449  'Coverage',
450  array(
451  'Language' => $this->getCoverageLanguageCode() ?: 'en'
452  ),
453  $this->getCoverage()
454  );
455  }
456  $writer->xmlEndTag('General');
457  }
getIdentifier(int $a_identifier_id)
xmlEndTag(string $tag)
Writes an endtag.
string $key
Consumer key/client ID value.
Definition: System.php:193
getDescription(int $a_description_id)
getLanguage(int $a_language_id)
getKeyword(int $a_keyword_id)
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
xmlStartTag(string $tag, ?array $attrs=null, bool $empty=false, bool $encode=true, bool $escape=true)
Writes a starttag.
xmlElement(string $tag, $attrs=null, $data=null, $encode=true, $escape=true)
Writes a basic element (no children, just textual content)
+ Here is the call graph for this function:

◆ update()

ilMDGeneral::update ( )

Definition at line 268 of file class.ilMDGeneral.php.

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

268  : bool
269  {
270  if (!$this->getMetaId()) {
271  return false;
272  }
273 
274  $this->createOrUpdateCoverage();
275 
276  return (bool) $this->db->update(
277  'il_meta_general',
278  $this->__getFields(),
279  array("meta_general_id" => array('integer', $this->getMetaId()))
280  );
281  }
createOrUpdateCoverage()
Compatibility fix for legacy MD classes for new db tables.
+ Here is the call graph for this function:

Field Documentation

◆ $coverage

string ilMDGeneral::$coverage = ''
private

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

Referenced by getCoverage().

◆ $coverage_id

int ilMDGeneral::$coverage_id = 0
private

Compatibility fix for legacy MD classes for new db tables.

Definition at line 50 of file class.ilMDGeneral.php.

Referenced by getCoverageId().

◆ $coverage_language

const ilMDLanguageItem ilMDGeneral::$coverage_language = null
protected

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

◆ $structure

string ilMDGeneral::$structure = ''
private

Definition at line 43 of file class.ilMDGeneral.php.

Referenced by getStructure().

◆ $title

string ilMDGeneral::$title = ''
private

Definition at line 44 of file class.ilMDGeneral.php.

Referenced by getTitle().

◆ $title_language

ilMDLanguageItem ilMDGeneral::$title_language = null
private

Definition at line 45 of file class.ilMDGeneral.php.

◆ STRUCTURE_TRANSLATION

const ilMDGeneral::STRUCTURE_TRANSLATION
private
Initial value:
= [
'atomic' => 'Atomic'

Compatibility fix for legacy MD classes for new db tables.

Definition at line 32 of file class.ilMDGeneral.php.


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