4 include_once(
"./Services/DataSet/classes/class.ilDataSet.php");
34 $this->db = $DIC->database();
36 parent::__construct();
46 return array(
"5.1.0",
"5.4.0");
57 return "http://www.ilias.de/xml/Modules/Glossary/" . $a_entity;
67 protected function getTypes($a_entity, $a_version)
69 if ($a_entity ==
"glo") {
76 "Description" =>
"text",
79 "SnippetLength" =>
"integer",
80 "GloMenuActive" =>
"text",
81 "ShowTax" =>
"integer" 86 if ($a_entity ==
"glo_term") {
100 if ($a_entity ==
"glo_definition") {
101 switch ($a_version) {
106 "TermId" =>
"integer",
107 "ShortText" =>
"text",
109 "ShortTextDirty" =>
"integer" 114 if ($a_entity ==
"glo_advmd_col_order") {
115 switch ($a_version) {
119 "GloId" =>
"integer",
121 "OrderNr" =>
"integer" 126 if ($a_entity ==
"glo_auto_glossaries") {
127 switch ($a_version) {
130 "GloId" =>
"integer",
131 "AutoGloId" =>
"text" 143 public function readData($a_entity, $a_version, $a_ids, $a_field =
"")
147 if (!is_array($a_ids)) {
148 $a_ids = array($a_ids);
151 if ($a_entity ==
"glo") {
152 switch ($a_version) {
155 $this->
getDirectDataFromQuery(
"SELECT o.title, o.description, g.id, g.virtual, pres_mode, snippet_length, show_tax, glo_menu_active" .
156 " FROM glossary g JOIN object_data o " .
157 " ON (g.id = o.obj_id) " .
158 " WHERE " .
$ilDB->in(
"g.id", $a_ids,
false,
"integer"));
163 if ($a_entity ==
"glo_term") {
164 switch ($a_version) {
167 " FROM glossary_term " .
168 " WHERE " .
$ilDB->in(
"glo_id", $a_ids,
false,
"integer"));
173 " FROM glossary_term " .
174 " WHERE " .
$ilDB->in(
"glo_id", $a_ids,
false,
"integer"));
176 $set =
$ilDB->query(
"SELECT r.term_id, r.glo_id, t.term, t.language " .
177 "FROM glo_term_reference r JOIN glossary_term t ON (r.term_id = t.id) " .
178 " WHERE " .
$ilDB->in(
"r.glo_id", $a_ids,
false,
"integer"));
179 while ($rec =
$ilDB->fetchAssoc($set)) {
181 "Id" => $rec[
"term_id"],
182 "GloId" => $rec[
"glo_id"],
183 "Term" => $rec[
"term"],
184 "Language" => $rec[
"language"],
191 if ($a_entity ==
"glo_definition") {
192 switch ($a_version) {
196 " FROM glossary_definition " .
197 " WHERE " .
$ilDB->in(
"term_id", $a_ids,
false,
"integer"));
202 if ($a_entity ==
"glo_advmd_col_order") {
203 switch ($a_version) {
207 " FROM glo_advmd_col_order " .
208 " WHERE " .
$ilDB->in(
"glo_id", $a_ids,
false,
"integer"));
213 if ($a_entity ==
"glo_auto_glossaries") {
214 switch ($a_version) {
216 $set =
$ilDB->query(
"SELECT * FROM glo_glossaries " .
217 " WHERE " .
$ilDB->in(
"id", $a_ids,
false,
"integer"));
219 while ($rec =
$ilDB->fetchAssoc($set)) {
221 "GloId" => $rec[
"id"],
222 "AutoGloId" =>
"il_" . IL_INST_ID .
"_glo_" . $rec[
"glo_id"]
238 "glo_term" => array(
"ids" => $a_rec[
"Id"]),
239 "glo_advmd_col_order" => array(
"ids" => $a_rec[
"Id"]),
240 "glo_auto_glossaries" => array(
"ids" => $a_rec[
"Id"])
245 "glo_definition" => array(
"ids" => $a_rec[
"Id"])
259 public function importRecord($a_entity, $a_types, $a_rec, $a_mapping, $a_schema_version)
264 include_once(
"./Modules/Glossary/classes/class.ilObjGlossary.php");
265 if ($new_id = $a_mapping->getMapping(
'Services/Container',
'objs', $a_rec[
'Id'])) {
269 $newObj->create(
true);
272 $newObj->setTitle($a_rec[
"Title"]);
273 $newObj->setDescription($a_rec[
"Description"]);
274 $newObj->setVirtualMode($a_rec[
"Virtual"]);
275 $newObj->setPresentationMode($a_rec[
"PresMode"]);
276 $newObj->setSnippetLength($a_rec[
"SnippetLength"]);
277 $newObj->setActiveGlossaryMenu($a_rec[
"GloMenuActive"]);
278 $newObj->setShowTaxonomy($a_rec[
"ShowTax"]);
282 $newObj->update(
true);
284 $this->current_obj = $newObj;
285 $this->old_glo_id = $a_rec[
"Id"];
286 $a_mapping->addMapping(
"Modules/Glossary",
"glo", $a_rec[
"Id"], $newObj->getId());
287 $a_mapping->addMapping(
"Services/Object",
"obj", $a_rec[
"Id"], $newObj->getId());
288 $a_mapping->addMapping(
291 $a_rec[
"Id"] .
":0:glo",
292 $newObj->getId() .
":0:glo" 294 $a_mapping->addMapping(
"Services/AdvancedMetaData",
"parent", $a_rec[
"Id"], $newObj->getId());
301 include_once(
"./Modules/Glossary/classes/class.ilGlossaryTerm.php");
302 $glo_id = (int) $a_mapping->getMapping(
"Modules/Glossary",
"glo", $a_rec[
"GloId"]);
304 $term->setGlossaryId($glo_id);
305 $term->setTerm($a_rec[
"Term"]);
306 $term->setLanguage($a_rec[
"Language"]);
311 $term_id = $term->getId();
312 $this->log->debug(
"glo_term, import id: " . $term->getImportId() .
", term id: " . $term_id);
314 $a_mapping->addMapping(
321 $a_mapping->addMapping(
324 "glo:term:" . $a_rec[
"Id"],
328 $a_mapping->addMapping(
331 "glo:term:" . $a_rec[
"Id"],
335 $a_mapping->addMapping(
336 "Services/AdvancedMetaData",
338 "advmd:term:" . $a_rec[
"Id"],
343 case "glo_definition":
347 include_once(
"./Modules/Glossary/classes/class.ilGlossaryDefinition.php");
348 $term_id = (int) $a_mapping->getMapping(
"Modules/Glossary",
"term", $a_rec[
"TermId"]);
349 if ((
int) $term_id == 0) {
350 $this->log->debug(
"ERROR: Did not find glossary term glo_term id '" . $a_rec[
"TermId"] .
"' for definition id '" . $a_rec[
"Id"] .
"'.");
353 $def->setTermId($term_id);
354 $def->setShortText($a_rec[
"ShortText"]);
355 $def->setNr($a_rec[
"Nr"]);
356 $def->setShortTextDirty($a_rec[
"ShortTextDirty"]);
358 $def->create(
true,
true);
360 $a_mapping->addMapping(
"Modules/Glossary",
"def", $a_rec[
"Id"],
$def->getId());
361 $a_mapping->addMapping(
364 "gdf:" . $a_rec[
"Id"],
365 "gdf:" .
$def->getId()
367 $a_mapping->addMapping(
370 $this->old_glo_id .
":" . $a_rec[
"Id"] .
":gdf",
371 $this->current_obj->getId() .
":" .
$def->getId() .
":gdf" 376 case "glo_advmd_col_order":
380 $a_mapping->addMapping(
"Modules/Glossary",
"advmd_col_order", $a_rec[
"GloId"] .
":" . $a_rec[
"FieldId"], $a_rec[
"OrderNr"]);
383 case "glo_auto_glossaries":
385 $glo_id = (int) $a_mapping->getMapping(
"Modules/Glossary",
"glo", $a_rec[
"GloId"]);
388 $glo->addAutoGlossary($auto_glo_id);
389 $glo->updateAutoGlossaries();
readData($a_entity, $a_version, $a_ids, $a_field="")
Read data.
getDirectDataFromQuery($a_query, $a_convert_to_leading_upper=true, $a_set=true)
Get data from query.This is a standard procedure, all db field names are directly mapped to abstract ...
getDependencies($a_entity, $a_version, $a_rec, $a_ids)
Determine the dependent sets of data.
getSupportedVersions()
Get supported versions.
getCurrentInstallationId()
Get current installation id.
static getInstanceByObjId($a_obj_id, $stop_on_error=true)
get an instance of an Ilias object by object id
static _lookupType($a_id, $a_reference=false)
lookup object type
getXmlNamespace($a_entity, $a_schema_version)
Get xml namespace.
Class ilGlossaryDefinition.
__construct()
Constructor.
importRecord($a_entity, $a_types, $a_rec, $a_mapping, $a_schema_version)
Import record.
static getLogger($a_component_id)
Get component logger.
A dataset contains in data in a common structure that can be shared and transformed for different pur...
getTypes($a_entity, $a_version)
Get field types for entity.
static _lookupObjIdByImportId($a_import_id)