4 include_once(
"./Services/DataSet/classes/class.ilDataSet.php");
33 $this->db = $DIC->database();
35 parent::__construct();
45 return array(
"5.1.0");
56 return "http://www.ilias.de/xml/Modules/Glossary/" . $a_entity;
66 protected function getTypes($a_entity, $a_version)
68 if ($a_entity ==
"glo") {
74 "Description" =>
"text",
77 "SnippetLength" =>
"integer",
78 "GloMenuActive" =>
"text",
79 "ShowTax" =>
"integer" 84 if ($a_entity ==
"glo_term") {
97 if ($a_entity ==
"glo_definition") {
102 "TermId" =>
"integer",
103 "ShortText" =>
"text",
105 "ShortTextDirty" =>
"integer" 110 if ($a_entity ==
"glo_advmd_col_order") {
111 switch ($a_version) {
114 "GloId" =>
"integer",
116 "OrderNr" =>
"integer" 128 public function readData($a_entity, $a_version, $a_ids, $a_field =
"")
132 if (!is_array($a_ids)) {
133 $a_ids =
array($a_ids);
136 if ($a_entity ==
"glo") {
137 switch ($a_version) {
139 $this->
getDirectDataFromQuery(
"SELECT o.title, o.description, g.id, g.virtual, pres_mode, snippet_length, show_tax, glo_menu_active" .
140 " FROM glossary g JOIN object_data o " .
141 " ON (g.id = o.obj_id) " .
142 " WHERE " .
$ilDB->in(
"g.id", $a_ids,
false,
"integer"));
147 if ($a_entity ==
"glo_term") {
148 switch ($a_version) {
152 " FROM glossary_term " .
153 " WHERE " .
$ilDB->in(
"glo_id", $a_ids,
false,
"integer"));
158 if ($a_entity ==
"glo_definition") {
159 switch ($a_version) {
162 " FROM glossary_definition " .
163 " WHERE " .
$ilDB->in(
"term_id", $a_ids,
false,
"integer"));
168 if ($a_entity ==
"glo_advmd_col_order") {
169 switch ($a_version) {
172 " FROM glo_advmd_col_order " .
173 " WHERE " .
$ilDB->in(
"glo_id", $a_ids,
false,
"integer"));
187 "glo_term" =>
array(
"ids" => $a_rec[
"Id"]),
188 "glo_advmd_col_order" =>
array(
"ids" => $a_rec[
"Id"])
193 "glo_definition" =>
array(
"ids" => $a_rec[
"Id"])
207 public function importRecord($a_entity, $a_types, $a_rec, $a_mapping, $a_schema_version)
212 include_once(
"./Modules/Glossary/classes/class.ilObjGlossary.php");
213 if ($new_id = $a_mapping->getMapping(
'Services/Container',
'objs', $a_rec[
'Id'])) {
217 $newObj->create(
true);
220 $newObj->setTitle($a_rec[
"Title"]);
221 $newObj->setDescription($a_rec[
"Description"]);
222 $newObj->setVirtualMode($a_rec[
"Virtual"]);
223 $newObj->setPresentationMode($a_rec[
"PresMode"]);
224 $newObj->setSnippetLength($a_rec[
"SnippetLength"]);
225 $newObj->setActiveGlossaryMenu($a_rec[
"GloMenuActive"]);
226 $newObj->setShowTaxonomy($a_rec[
"ShowTax"]);
227 $newObj->update(
true);
229 $this->current_obj = $newObj;
230 $this->old_glo_id = $a_rec[
"Id"];
231 $a_mapping->addMapping(
"Modules/Glossary",
"glo", $a_rec[
"Id"], $newObj->getId());
232 $a_mapping->addMapping(
"Services/Object",
"obj", $a_rec[
"Id"], $newObj->getId());
233 $a_mapping->addMapping(
236 $a_rec[
"Id"] .
":0:glo",
237 $newObj->getId() .
":0:glo" 239 $a_mapping->addMapping(
"Services/AdvancedMetaData",
"parent", $a_rec[
"Id"], $newObj->getId());
246 include_once(
"./Modules/Glossary/classes/class.ilGlossaryTerm.php");
247 $glo_id = (int) $a_mapping->getMapping(
"Modules/Glossary",
"glo", $a_rec[
"GloId"]);
249 $term->setGlossaryId($glo_id);
250 $term->setTerm($a_rec[
"Term"]);
251 $term->setLanguage($a_rec[
"Language"]);
256 $term_id = $term->getId();
257 $this->log->debug(
"glo_term, import id: " . $term->getImportId() .
", term id: " . $term_id);
259 $a_mapping->addMapping(
266 $a_mapping->addMapping(
269 "glo:term:" . $a_rec[
"Id"],
273 $a_mapping->addMapping(
276 "glo:term:" . $a_rec[
"Id"],
280 $a_mapping->addMapping(
281 "Services/AdvancedMetaData",
283 "advmd:term:" . $a_rec[
"Id"],
288 case "glo_definition":
292 include_once(
"./Modules/Glossary/classes/class.ilGlossaryDefinition.php");
293 $term_id = (int) $a_mapping->getMapping(
"Modules/Glossary",
"term", $a_rec[
"TermId"]);
294 if ((
int) $term_id == 0) {
295 $this->log->debug(
"ERROR: Did not find glossary term glo_term id '" . $a_rec[
"TermId"] .
"' for definition id '" . $a_rec[
"Id"] .
"'.");
298 $def->setTermId($term_id);
299 $def->setShortText($a_rec[
"ShortText"]);
300 $def->setNr($a_rec[
"Nr"]);
301 $def->setShortTextDirty($a_rec[
"ShortTextDirty"]);
303 $def->create(
true,
true);
305 $a_mapping->addMapping(
"Modules/Glossary",
"def", $a_rec[
"Id"],
$def->getId());
306 $a_mapping->addMapping(
309 "gdf:" . $a_rec[
"Id"],
310 "gdf:" .
$def->getId()
312 $a_mapping->addMapping(
315 $this->old_glo_id .
":" . $a_rec[
"Id"] .
":gdf",
316 $this->current_obj->getId() .
":" .
$def->getId() .
":gdf" 321 case "glo_advmd_col_order":
325 $a_mapping->addMapping(
"Modules/Glossary",
"advmd_col_order", $a_rec[
"GloId"] .
":" . $a_rec[
"FieldId"], $a_rec[
"OrderNr"]);
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
Create styles array
The data for the language used.
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.