ILIAS  release_9 Revision v9.13-25-g2c18ec4c24f
ILIAS\MetaData\Vocabularies\LOMVocabularies Class Reference
+ Inheritance diagram for ILIAS\MetaData\Vocabularies\LOMVocabularies:
+ Collaboration diagram for ILIAS\MetaData\Vocabularies\LOMVocabularies:

Public Member Functions

 __construct (DictionaryInitiatorInterface $dictionary_initiator, NavigatorFactoryInterface $navigator_factory)
 
 vocabulariesForElement (BaseElementInterface $element)
 
 filteredVocabulariesForElement (ElementInterface $element, bool $ignore_marker)
 

Protected Member Functions

 checkCondition (ElementInterface $element, VocabularyInterface $vocabulary, bool $ignore_marker)
 
 getDataValueFromRelativePath (ElementInterface $start, PathInterface $path, bool $ignore_marker)
 

Protected Attributes

DictionaryInitiatorInterface $initiator
 
NavigatorFactoryInterface $navigator_factory
 
DictionaryInterface $dictionary
 

Detailed Description

Definition at line 32 of file LOMVocabularies.php.

Constructor & Destructor Documentation

◆ __construct()

ILIAS\MetaData\Vocabularies\LOMVocabularies::__construct ( DictionaryInitiatorInterface  $dictionary_initiator,
NavigatorFactoryInterface  $navigator_factory 
)

Definition at line 39 of file LOMVocabularies.php.

References ILIAS\MetaData\Vocabularies\LOMVocabularies\$navigator_factory.

42  {
43  $this->initiator = $dictionary_initiator;
44  $this->navigator_factory = $navigator_factory;
45  }
NavigatorFactoryInterface $navigator_factory

Member Function Documentation

◆ checkCondition()

ILIAS\MetaData\Vocabularies\LOMVocabularies::checkCondition ( ElementInterface  $element,
VocabularyInterface  $vocabulary,
bool  $ignore_marker 
)
protected

Definition at line 89 of file LOMVocabularies.php.

References ILIAS\MetaData\Vocabularies\VocabularyInterface\condition(), ILIAS\MetaData\Vocabularies\LOMVocabularies\getDataValueFromRelativePath(), and ILIAS\MetaData\Vocabularies\VocabularyInterface\isConditional().

Referenced by ILIAS\MetaData\Vocabularies\LOMVocabularies\filteredVocabulariesForElement().

93  : bool {
94  if (!$vocabulary->isConditional()) {
95  return true;
96  }
97  $value = $this->getDataValueFromRelativePath(
98  $element,
99  $vocabulary->condition()->path(),
100  $ignore_marker
101  );
102  if ($value === $vocabulary->condition()->value()) {
103  return true;
104  }
105  return false;
106  }
getDataValueFromRelativePath(ElementInterface $start, PathInterface $path, bool $ignore_marker)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ filteredVocabulariesForElement()

ILIAS\MetaData\Vocabularies\LOMVocabularies::filteredVocabulariesForElement ( ElementInterface  $element,
bool  $ignore_marker 
)
Returns
VocabularyInterface[]

Implements ILIAS\MetaData\Vocabularies\VocabulariesInterface.

Definition at line 64 of file LOMVocabularies.php.

References $vocab, ILIAS\MetaData\Vocabularies\LOMVocabularies\checkCondition(), ILIAS\MetaData\Vocabularies\LOMVocabularies\getDataValueFromRelativePath(), ILIAS\MetaData\Elements\Base\BaseElementInterface\getDefinition(), and ILIAS\MetaData\Vocabularies\LOMVocabularies\vocabulariesForElement().

67  : \Generator {
68  $is_vocab_value = false;
69  $source = null;
70  if ($element->getDefinition()->dataType() === Type::VOCAB_VALUE) {
71  $is_vocab_value = true;
72  $source = $this->getDataValueFromRelativePath(
73  $element,
74  $this->initiator->pathFromValueToSource(),
75  $ignore_marker
76  );
77  }
78  foreach ($this->vocabulariesForElement($element) as $vocab) {
79  if ($is_vocab_value && $vocab->source() !== $source) {
80  continue;
81  }
82  if (!$this->checkCondition($element, $vocab, $ignore_marker)) {
83  continue;
84  }
85  yield $vocab;
86  }
87  }
checkCondition(ElementInterface $element, VocabularyInterface $vocabulary, bool $ignore_marker)
vocabulariesForElement(BaseElementInterface $element)
getDataValueFromRelativePath(ElementInterface $start, PathInterface $path, bool $ignore_marker)
$vocab
+ Here is the call graph for this function:

◆ getDataValueFromRelativePath()

ILIAS\MetaData\Vocabularies\LOMVocabularies::getDataValueFromRelativePath ( ElementInterface  $start,
PathInterface  $path,
bool  $ignore_marker 
)
protected

Definition at line 108 of file LOMVocabularies.php.

Referenced by ILIAS\MetaData\Vocabularies\LOMVocabularies\checkCondition(), and ILIAS\MetaData\Vocabularies\LOMVocabularies\filteredVocabulariesForElement().

112  : ?string {
113  $element = $this->navigator_factory->navigator(
114  $path,
115  $start
116  )->lastElementAtFinalStep();
117 
118  if (!isset($element)) {
119  return null;
120  }
121  if (
122  !$ignore_marker &&
123  ($element instanceof MarkableInterface) &&
124  $element->isMarked()
125  ) {
126  return $element->getMarker()->dataValue();
127  }
128  return $element->getData()->value();
129  }
$path
Definition: ltiservices.php:32
+ Here is the caller graph for this function:

◆ vocabulariesForElement()

ILIAS\MetaData\Vocabularies\LOMVocabularies::vocabulariesForElement ( BaseElementInterface  $element)
Returns
VocabularyInterface[]

Implements ILIAS\MetaData\Vocabularies\VocabulariesInterface.

Definition at line 50 of file LOMVocabularies.php.

Referenced by ILIAS\MetaData\Vocabularies\LOMVocabularies\filteredVocabulariesForElement().

52  : \Generator {
53  if (!isset($this->dictionary)) {
54  $this->dictionary = $this->initiator->get();
55  }
56  foreach ($this->dictionary->tagsForElement($element) as $tag) {
57  yield $tag->vocabulary();
58  }
59  }
+ Here is the caller graph for this function:

Field Documentation

◆ $dictionary

DictionaryInterface ILIAS\MetaData\Vocabularies\LOMVocabularies::$dictionary
protected

Definition at line 37 of file LOMVocabularies.php.

◆ $initiator

DictionaryInitiatorInterface ILIAS\MetaData\Vocabularies\LOMVocabularies::$initiator
protected

Definition at line 34 of file LOMVocabularies.php.

◆ $navigator_factory

NavigatorFactoryInterface ILIAS\MetaData\Vocabularies\LOMVocabularies::$navigator_factory
protected

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