ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
LOMDictionaryInitiator.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
22
27use ILIAS\MetaData\Paths\FactoryInterface as PathFactoryInterface;
30
31class LOMDictionaryInitiator extends BaseDictionaryInitiator
32{
33 protected PathFactoryInterface $path_factory;
35
36 public function __construct(
38 PathFactoryInterface $path_factory,
41 ) {
42 $this->tag_factory = $tag_factory;
43 $this->path_factory = $path_factory;
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'));
86 $lifecycle->getSubElement('contribute')
87 ->getSubElement('date')
88 ->getSubElement('description')
89 );
90 }
91
93 {
94 $root = $structure->getRoot();
95
96 $metametadata = $root->getSubElement('metaMetadata');
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}
$classification
$technical
$general
SECTIONS.
$lifecycle
$annotation
$relation
$rights
$metametadata
$educational
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
__construct(TagFactoryInterface $tag_factory, PathFactoryInterface $path_factory, NavigatorFactoryInterface $navigator_factory, StructureSetInterface $structure)
getRoot()
Returns the root element of the metadata set.
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc