ILIAS  trunk Revision v11.0_alpha-1761-g6dbbfa7b760
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
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 28 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 328 of file class.ilMDGeneral.php.

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

Referenced by save(), and update().

328  : array
329  {
333  $structure = (string) array_search(
334  $this->getStructure(),
335  self::STRUCTURE_TRANSLATION
336  );
337 
338  return array(
339  'rbac_id' => array('integer', $this->getRBACId()),
340  'obj_id' => array('integer', $this->getObjId()),
341  'obj_type' => array('text', $this->getObjType()),
342  'general_structure' => array('text', $structure),
343  'title' => array('text', $this->getTitle()),
344  'title_language' => array('text', $this->getTitleLanguageCode()),
345  //'coverage' => array('text', $this->getCoverage()),
346  //'coverage_language' => array('text', $this->getCoverageLanguageCode())
347  );
348  }
+ 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 461 of file class.ilMDGeneral.php.

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

Referenced by ilMD\getGeneral().

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

◆ addDescription()

ilMDGeneral::addDescription ( )

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

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

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

◆ addIdentifier()

ilMDGeneral::addIdentifier ( )

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

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

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

◆ addKeyword()

ilMDGeneral::addKeyword ( )

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

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

Referenced by ilMDKeyword\updateKeywords().

171  : ilMDKeyword
172  {
173  $key = new ilMDKeyword($this->getRBACId(), $this->getObjId(), $this->getObjType());
174  $key->setParentId($this->getMetaId());
175  $key->setParentType('meta_general');
176 
177  return $key;
178  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ addLanguage()

ilMDGeneral::addLanguage ( )

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

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

115  : ilMDLanguage
116  {
117  $lan = new ilMDLanguage($this->getRBACId(), $this->getObjId(), $this->getObjType());
118  $lan->setParentId($this->getMetaId());
119  $lan->setParentType('meta_general');
120 
121  return $lan;
122  }
+ 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 481 of file class.ilMDGeneral.php.

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

Referenced by save(), and update().

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

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

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

References $res, and ilMDBase\getMetaId().

Referenced by delete().

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

◆ getCoverage()

ilMDGeneral::getCoverage ( )

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

References $coverage.

Referenced by createOrUpdateCoverage(), and toXML().

232  : string
233  {
234  return $this->coverage;
235  }
+ 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 543 of file class.ilMDGeneral.php.

References $coverage_id.

Referenced by createOrUpdateCoverage(), and readFirstCoverage().

543  : int
544  {
545  return $this->coverage_id;
546  }
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 242 of file class.ilMDGeneral.php.

References null.

243  {
244  return is_object($this->coverage_language) ? $this->coverage_language : null;
245  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null

◆ getCoverageLanguageCode()

ilMDGeneral::getCoverageLanguageCode ( )

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

Referenced by createOrUpdateCoverage(), and toXML().

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

◆ getDescription()

ilMDGeneral::getDescription ( int  $a_description_id)

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

References null.

Referenced by delete(), and toXML().

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

◆ getDescriptionIds()

ilMDGeneral::getDescriptionIds ( )
Returns
int[]

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

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

Referenced by delete(), and toXML().

127  : array
128  {
129  return ilMDDescription::_getIds($this->getRBACId(), $this->getObjId(), (int) $this->getMetaId(), 'meta_general');
130  }
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 76 of file class.ilMDGeneral.php.

References null.

Referenced by delete(), and toXML().

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

◆ getIdentifierIds()

ilMDGeneral::getIdentifierIds ( )
Returns
int[]

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

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

Referenced by delete(), and toXML().

71  : array
72  {
73  return ilMDIdentifier::_getIds($this->getRBACId(), $this->getObjId(), (int) $this->getMetaId(), 'meta_general');
74  }
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 160 of file class.ilMDGeneral.php.

References null.

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

160  : ?ilMDKeyword
161  {
162  if (!$a_keyword_id) {
163  return null;
164  }
165  $key = new ilMDKeyword();
166  $key->setMetaId($a_keyword_id);
167 
168  return $key;
169  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
+ Here is the caller graph for this function:

◆ getKeywordIds()

ilMDGeneral::getKeywordIds ( )
Returns
int[]

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

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

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

155  : array
156  {
157  return ilMDKeyword::_getIds($this->getRBACId(), $this->getObjId(), (int) $this->getMetaId(), 'meta_general');
158  }
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 104 of file class.ilMDGeneral.php.

References null.

Referenced by delete(), and toXML().

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

◆ getLanguageIds()

ilMDGeneral::getLanguageIds ( )
Returns
int[]

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

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

Referenced by delete(), and toXML().

99  : array
100  {
101  return ilMDLanguage::_getIds($this->getRBACId(), $this->getObjId(), (int) $this->getMetaId(), 'meta_general');
102  }
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 56 of file class.ilMDGeneral.php.

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

◆ getStructure()

ilMDGeneral::getStructure ( )

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

References $structure.

Referenced by __getFields(), and toXML().

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

◆ getTitle()

ilMDGeneral::getTitle ( )

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

References $title.

Referenced by __getFields(), and toXML().

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

◆ getTitleLanguage()

ilMDGeneral::getTitleLanguage ( )

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

References null.

218  {
219  return is_object($this->title_language) ? $this->title_language : null;
220  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null

◆ getTitleLanguageCode()

ilMDGeneral::getTitleLanguageCode ( )

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

Referenced by __getFields(), and toXML().

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

◆ read()

ilMDGeneral::read ( )

Compatibility fix for legacy MD classes for new db tables

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

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

350  : bool
351  {
352  if ($this->getMetaId()) {
353  $query = "SELECT * FROM il_meta_general " .
354  "WHERE meta_general_id = " . $this->db->quote($this->getMetaId(), 'integer');
355 
356  $res = $this->db->query($query);
357  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
361  if (key_exists($row->general_structure ?? '', self::STRUCTURE_TRANSLATION)) {
362  $row->general_structure = self::STRUCTURE_TRANSLATION[$row->general_structure ?? ''];
363  }
364 
365  $this->setRBACId((int) $row->rbac_id);
366  $this->setObjId((int) $row->obj_id);
367  $this->setObjType((string) $row->obj_type);
368  $this->setStructure((string) $row->general_structure);
369  $this->setTitle((string) $row->title);
370  $this->setTitleLanguage(new ilMDLanguageItem($row->title_language ?? ''));
371  //$this->setCoverage((string) $row->coverage);
372  //$this->setCoverageLanguage(new ilMDLanguageItem($row->coverage_language ?? ''));
373  }
374 
375  $this->readFirstCoverage();
376  }
377  return true;
378  }
$res
Definition: ltiservices.php:66
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 551 of file class.ilMDGeneral.php.

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

Referenced by setMetaId().

551  : void
552  {
553  $query = "SELECT meta_coverage_id FROM il_meta_coverage WHERE parent_type = 'meta_general'
554  AND parent_id = " . $this->db->quote($parent_id, 'integer') .
555  " ORDER BY meta_coverage_id";
556 
557  $res = $this->db->query($query);
558  if ($row = $this->db->fetchAssoc($res)) {
559  $this->coverage_id = (int) $row['meta_coverage_id'];
560  }
561  }
$res
Definition: ltiservices.php:66
+ 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 528 of file class.ilMDGeneral.php.

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

Referenced by read().

528  : void
529  {
530  $query = "SELECT * FROM il_meta_coverage WHERE meta_coverage_id = " .
531  $this->db->quote($this->getCoverageId(), 'integer');
532 
533  $res = $this->db->query($query);
534  if ($row = $this->db->fetchAssoc($res)) {
535  $this->setCoverage((string) $row['coverage']);
536  $this->setCoverageLanguage(new ilMDLanguageItem((string) $row['coverage_language']));
537  }
538  }
$res
Definition: ltiservices.php:66
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 252 of file class.ilMDGeneral.php.

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

252  : int
253  {
254  $fields = $this->__getFields();
255  $fields['meta_general_id'] = array('integer', $next_id = $this->db->nextId('il_meta_general'));
256 
257  $this->log->debug("Insert General " . print_r($fields, true));
258  $this->log->logStack(ilLogLevel::DEBUG);
259  //ilUtil::printBacktrace(10);
260 
261  if ($this->db->insert('il_meta_general', $fields)) {
262  $this->setMetaId($next_id);
263  $this->createOrUpdateCoverage();
264  return $this->getMetaId();
265  }
266  return 0;
267  }
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 227 of file class.ilMDGeneral.php.

Referenced by readFirstCoverage().

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

◆ setCoverageLanguage()

ilMDGeneral::setCoverageLanguage ( ilMDLanguageItem  $lng_obj)

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

Referenced by readFirstCoverage().

237  : void
238  {
239  $this->coverage_language = $lng_obj;
240  }
+ 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 566 of file class.ilMDGeneral.php.

References readCoverageId().

Referenced by save().

566  : void
567  {
568  $this->readCoverageId($a_meta_id);
569  parent::setMetaId($a_meta_id, $a_read_data);
570  }
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 181 of file class.ilMDGeneral.php.

Referenced by read().

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

◆ setTitle()

ilMDGeneral::setTitle ( string  $a_title)

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

Referenced by read().

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

◆ setTitleLanguage()

ilMDGeneral::setTitleLanguage ( ilMDLanguageItem  $lng_obj)

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

Referenced by read().

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

◆ toXML()

ilMDGeneral::toXML ( ilXmlWriter  $writer)

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

References $id, 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().

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

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

269  : bool
270  {
271  if (!$this->getMetaId()) {
272  return false;
273  }
274 
275  $this->createOrUpdateCoverage();
276 
277  return (bool) $this->db->update(
278  'il_meta_general',
279  $this->__getFields(),
280  array("meta_general_id" => array('integer', $this->getMetaId()))
281  );
282  }
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 43 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 51 of file class.ilMDGeneral.php.

Referenced by getCoverageId().

◆ $coverage_language

const ilMDLanguageItem ilMDGeneral::$coverage_language = null
protected

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

◆ $structure

string ilMDGeneral::$structure = ''
private

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

Referenced by getStructure().

◆ $title

string ilMDGeneral::$title = ''
private

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

Referenced by getTitle().

◆ $title_language

ilMDLanguageItem ilMDGeneral::$title_language = null
private

Definition at line 46 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 33 of file class.ilMDGeneral.php.


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