40 $this->db = $DIC->database();
47 return array(
"5.1.0",
"5.4.0");
50 protected function getXmlNamespace(
string $a_entity,
string $a_schema_version): string
52 return "https://www.ilias.de/xml/Modules/Glossary/" . $a_entity;
55 protected function getTypes(
string $a_entity,
string $a_version): array
57 if ($a_entity ==
"glo") {
64 "Description" =>
"text",
67 "SnippetLength" =>
"integer",
68 "GloMenuActive" =>
"text",
69 "ShowTax" =>
"integer" 74 if ($a_entity ==
"glo_term") {
88 if ($a_entity ==
"glo_definition") {
94 "TermId" =>
"integer",
95 "ShortText" =>
"text",
97 "ShortTextDirty" =>
"integer" 102 if ($a_entity ==
"glo_advmd_col_order") {
103 switch ($a_version) {
107 "GloId" =>
"integer",
109 "OrderNr" =>
"integer" 114 if ($a_entity ==
"glo_auto_glossaries") {
115 switch ($a_version) {
118 "GloId" =>
"integer",
119 "AutoGloId" =>
"text" 126 public function readData(
string $a_entity,
string $a_version, array $a_ids): void
130 if ($a_entity ==
"glo") {
131 switch ($a_version) {
134 $this->
getDirectDataFromQuery(
"SELECT o.title, o.description, g.id, g.virtual, pres_mode, snippet_length, show_tax, glo_menu_active" .
135 " FROM glossary g JOIN object_data o " .
136 " ON (g.id = o.obj_id) " .
137 " WHERE " .
$ilDB->in(
"g.id", $a_ids,
false,
"integer"));
142 if ($a_entity ==
"glo_term") {
143 switch ($a_version) {
146 " FROM glossary_term " .
147 " WHERE " .
$ilDB->in(
"glo_id", $a_ids,
false,
"integer"));
152 " FROM glossary_term " .
153 " WHERE " .
$ilDB->in(
"glo_id", $a_ids,
false,
"integer"));
155 $set =
$ilDB->query(
"SELECT r.term_id, r.glo_id, t.term, t.language " .
156 "FROM glo_term_reference r JOIN glossary_term t ON (r.term_id = t.id) " .
157 " WHERE " .
$ilDB->in(
"r.glo_id", $a_ids,
false,
"integer"));
158 while ($rec =
$ilDB->fetchAssoc($set)) {
160 "Id" => $rec[
"term_id"],
161 "GloId" => $rec[
"glo_id"],
162 "Term" => $rec[
"term"],
163 "Language" => $rec[
"language"],
170 if ($a_entity ==
"glo_definition") {
171 switch ($a_version) {
175 " FROM glossary_definition " .
176 " WHERE " .
$ilDB->in(
"term_id", $a_ids,
false,
"integer"));
181 if ($a_entity ==
"glo_advmd_col_order") {
182 switch ($a_version) {
186 " FROM glo_advmd_col_order " .
187 " WHERE " .
$ilDB->in(
"glo_id", $a_ids,
false,
"integer"));
192 if ($a_entity ==
"glo_auto_glossaries") {
193 switch ($a_version) {
195 $set =
$ilDB->query(
"SELECT * FROM glo_glossaries " .
196 " WHERE " .
$ilDB->in(
"id", $a_ids,
false,
"integer"));
198 while ($rec =
$ilDB->fetchAssoc($set)) {
200 "GloId" => $rec[
"id"],
201 "AutoGloId" =>
"il_" .
IL_INST_ID .
"_glo_" . $rec[
"glo_id"]
215 ?array $a_rec = null,
221 "glo_term" => array(
"ids" => $a_rec[
"Id"] ?? null),
222 "glo_advmd_col_order" => array(
"ids" => $a_rec[
"Id"] ?? null),
223 "glo_auto_glossaries" => array(
"ids" => $a_rec[
"Id"] ?? null)
228 "glo_definition" => array(
"ids" => $a_rec[
"Id"] ?? null)
241 string $a_schema_version
247 if ($new_id = $a_mapping->
getMapping(
'Services/Container',
'objs', $a_rec[
'Id'])) {
251 $newObj->create(
true);
254 $newObj->setTitle($a_rec[
"Title"]);
255 $newObj->setDescription($a_rec[
"Description"]);
256 $newObj->setVirtualMode($a_rec[
"Virtual"]);
257 $newObj->setPresentationMode($a_rec[
"PresMode"]);
258 $newObj->setSnippetLength((
int) ($a_rec[
"SnippetLength"] ?? 0));
259 $newObj->setActiveGlossaryMenu((
bool) ($a_rec[
"GloMenuActive"] ??
false));
260 $newObj->setShowTaxonomy((
bool) ($a_rec[
"ShowTax"] ??
false));
266 $this->current_obj = $newObj;
267 $this->old_glo_id = $a_rec[
"Id"];
268 $a_mapping->
addMapping(
"Modules/Glossary",
"glo", $a_rec[
"Id"], $newObj->getId());
269 $a_mapping->
addMapping(
"Services/Object",
"obj", $a_rec[
"Id"], $newObj->getId());
273 $a_rec[
"Id"] .
":0:glo",
274 $newObj->getId() .
":0:glo" 276 $a_mapping->
addMapping(
"Services/AdvancedMetaData",
"parent", $a_rec[
"Id"], $newObj->getId());
283 $glo_id = (
int) $a_mapping->
getMapping(
"Modules/Glossary",
"glo", $a_rec[
"GloId"]);
285 $term->setGlossaryId($glo_id);
286 $term->setTerm($a_rec[
"Term"]);
287 $term->setLanguage($a_rec[
"Language"]);
292 $term_id = $term->getId();
293 $this->log->debug(
"glo_term, import id: " . $term->getImportId() .
", term id: " . $term_id);
305 "glo:term:" . $a_rec[
"Id"],
312 "glo:term:" . $a_rec[
"Id"],
317 "Services/AdvancedMetaData",
319 "advmd:term:" . $a_rec[
"Id"],
324 case "glo_definition":
328 $term_id = (
int) $a_mapping->
getMapping(
"Modules/Glossary",
"term", $a_rec[
"TermId"]);
330 $this->log->debug(
"ERROR: Did not find glossary term glo_term id '" . $a_rec[
"TermId"] .
"' for definition id '" . $a_rec[
"Id"] .
"'.");
333 $def->setTermId($term_id);
334 $def->setShortText($a_rec[
"ShortText"]);
335 $def->setNr($a_rec[
"Nr"]);
336 $def->setShortTextDirty($a_rec[
"ShortTextDirty"]);
338 $def->create(
true,
true);
340 $a_mapping->
addMapping(
"Modules/Glossary",
"def", $a_rec[
"Id"], $def->getId());
344 "gdf:" . $a_rec[
"Id"],
345 "gdf:" . $def->getId()
350 $this->old_glo_id .
":" . $a_rec[
"Id"] .
":gdf",
351 $this->current_obj->getId() .
":" . $def->getId() .
":gdf" 356 case "glo_advmd_col_order":
360 $a_mapping->
addMapping(
"Modules/Glossary",
"advmd_col_order", $a_rec[
"GloId"] .
":" . $a_rec[
"FieldId"], $a_rec[
"OrderNr"]);
363 case "glo_auto_glossaries":
365 $glo_id = (
int) $a_mapping->
getMapping(
"Modules/Glossary",
"glo", $a_rec[
"GloId"]);
368 $glo->addAutoGlossary($auto_glo_id);
369 $glo->updateAutoGlossaries();
getDependencies(string $a_entity, string $a_version, ?array $a_rec=null, ?array $a_ids=null)
Determine the dependent sets of data.
static _lookupObjIdByImportId(string $import_id)
Get (latest) object id for an import id.
importRecord(string $a_entity, array $a_types, array $a_rec, ilImportMapping $a_mapping, string $a_schema_version)
readData(string $a_entity, string $a_version, array $a_ids)
static getLogger(string $a_component_id)
Get component logger.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
addMapping(string $a_comp, string $a_entity, string $a_old_id, string $a_new_id)
getXmlNamespace(string $a_entity, string $a_schema_version)
getTypes(string $a_entity, string $a_version)
getMapping(string $a_comp, string $a_entity, string $a_old_id)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
getCurrentInstallationId()
getDirectDataFromQuery(string $a_query, bool $a_convert_to_leading_upper=true, bool $a_set=true)
Get data from query.This is a standard procedure, all db field names are directly mapped to abstract ...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static getInstanceByObjId(?int $obj_id, bool $stop_on_error=true)
get an instance of an Ilias object by object id
__construct(Container $dic, ilPlugin $plugin)
stripTags(array $rec, array $omit_keys=[])
static _lookupType(int $id, bool $reference=false)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
ilObjGlossary $current_obj