ILIAS  trunk Revision v11.0_alpha-1744-gb0451eebef4
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
LOMDictionaryInitiator.php
Go to the documentation of this file.
1 <?php
2 
19 declare(strict_types=1);
20 
22 
30 
31 class LOMDictionaryInitiator extends BaseDictionaryInitiator
32 {
35 
36  public function __construct(
37  TagFactoryInterface $tag_factory,
38  PathFactoryInterface $path_factory,
41  ) {
42  $this->tag_factory = $tag_factory;
43  $this->path_factory = $path_factory;
44  parent::__construct($path_factory, $navigator_factory, $structure);
45  }
46 
47  public function get(): DictionaryInterface
48  {
49  $this->initDictionary();
50  return new LOMDictionary($this->path_factory, $this->navigator_factory, ...$this->getTagAssignments());
51  }
52 
53  protected function initDictionary(): void
54  {
55  $structure = $this->getStructure();
56 
66  }
67 
69  {
70  $root = $structure->getRoot();
71 
72  $general = $root->getSubElement('general');
73  $this->addTagsToLangString($general->getSubElement('title'));
74  $this->addTagsToLangString($general->getSubElement('description'));
75  $this->addTagsToLangString($general->getSubElement('keyword'));
76  $this->addTagsToLangString($general->getSubElement('coverage'));
77  }
78 
80  {
81  $root = $structure->getRoot();
82 
83  $lifecycle = $root->getSubElement('lifeCycle');
84  $this->addTagsToLangString($lifecycle->getSubElement('version'));
85  $this->addTagsToLangString(
86  $lifecycle->getSubElement('contribute')
87  ->getSubElement('date')
88  ->getSubElement('description')
89  );
90  }
91 
93  {
94  $root = $structure->getRoot();
95 
96  $metametadata = $root->getSubElement('metaMetadata');
97  $this->addTagsToLangString(
98  $metametadata->getSubElement('contribute')
99  ->getSubElement('date')
100  ->getSubElement('description')
101  );
102  }
103 
105  {
106  $root = $structure->getRoot();
107 
108  $technical = $root->getSubElement('technical');
109  $this->addTagsToLangString($technical->getSubElement('installationRemarks'));
110  $this->addTagsToLangString($technical->getSubElement('otherPlatformRequirements'));
111  $this->addTagsToLangString(
112  $technical->getSubElement('duration')
113  ->getSubElement('description')
114  );
115  }
116 
118  {
119  $root = $structure->getRoot();
120 
121  $educational = $root->getSubElement('educational');
122  $this->addTagsToLangString($educational->getSubElement('typicalAgeRange'));
123  $this->addTagsToLangString($educational->getSubElement('description'));
124  $this->addTagsToLangString(
125  $educational->getSubElement('typicalLearningTime')
126  ->getSubElement('description')
127  );
128  }
129 
131  {
132  $root = $structure->getRoot();
133 
134  $rights = $root->getSubElement('rights');
135  $description = $rights->getSubElement('description');
136  $this->addTagsToLangString($description);
137 
138  $tag_10 = $this->tag_factory->tag(
141  );
142  $tag_4 = $this->tag_factory->tag(
143  Version::V4_1_0,
145  );
146 
147  $description_string = $description->getSubElement('string');
148  $this->addTagToElement($tag_10, $description_string);
149  $this->addTagToElement($tag_4, $description_string);
150  }
151 
153  {
154  $root = $structure->getRoot();
155 
156  $relation = $root->getSubElement('relation');
157  $this->addTagsToLangString(
158  $relation->getSubElement('resource')
159  ->getSubElement('description')
160  );
161  }
162 
164  {
165  $root = $structure->getRoot();
166 
167  $annotation = $root->getSubElement('annotation');
168  $this->addTagsToLangString(
169  $annotation->getSubElement('date')
170  ->getSubElement('description')
171  );
172  $this->addTagsToLangString($annotation->getSubElement('description'));
173  }
174 
176  {
177  $root = $structure->getRoot();
178 
179  $classification = $root->getSubElement('classification');
180  $taxon_path = $classification->getSubElement('taxonPath');
181  $this->addTagsToLangString($taxon_path->getSubElement('source'));
182  $this->addTagsToLangString(
183  $taxon_path->getSubElement('taxon')
184  ->getSubElement('entry')
185  );
186  $this->addTagsToLangString($classification->getSubElement('description'));
187  $this->addTagsToLangString($classification->getSubElement('keyword'));
188  }
189 
190  protected function addTagsToLangString(StructureElementInterface $element): void
191  {
192  $tag_10 = $this->tag_factory->tag(
194  SpecialCase::LANGSTRING
195  );
196 
197  $this->addTagToElement($tag_10, $element);
198  }
199 }
$relation
$technical
getRoot()
Returns the root element of the metadata set.
$educational
$general
SECTIONS.
$annotation
$lifecycle
addTagToElement(TagInterface $tag, StructureElementInterface $element)
When indices are added, the tag applies only to copies of the element with those indices (beginning w...
NavigatorFactoryInterface $navigator_factory
only needed to instantiate dictionaries, which is done in inheritors
$classification
$rights
__construct(Container $dic, ilPlugin $plugin)
__construct(TagFactoryInterface $tag_factory, PathFactoryInterface $path_factory, NavigatorFactoryInterface $navigator_factory, StructureSetInterface $structure)
$metametadata