52 $q =
"SELECT * FROM glossary_term WHERE id = ".
53 $ilDB->quote($this->
id,
"integer");
54 $term_set = $ilDB->query($q);
55 $term_rec = $ilDB->fetchAssoc($term_set);
57 $this->
setTerm($term_rec[
"term"]);
75 if ($a_import_id ==
"")
80 $q =
"SELECT * FROM glossary_term WHERE import_id = ".
81 $ilDB->quote($a_import_id,
"text").
82 " ORDER BY create_date DESC";
83 $term_set = $ilDB->query($q);
84 while ($term_rec = $ilDB->fetchAssoc($term_set))
90 return $term_rec[
"id"];
109 include_once(
"./Services/COPage/classes/class.ilInternalLink.php");
110 if (is_int(strpos($a_id,
"_")))
115 $q =
"SELECT * FROM glossary_term WHERE id = ".
116 $ilDB->quote($a_id,
"integer");
117 $obj_set = $ilDB->query($q);
118 if ($obj_rec = $ilDB->fetchAssoc($obj_set))
158 $this->glossary =& $a_glossary;
170 $this->glo_id = $a_glo_id;
192 $this->term = $a_term;
214 $this->language = $a_language;
232 $this->import_id = $a_import_id;
252 $this->
setId($ilDB->nextId(
"glossary_term"));
253 $ilDB->manipulate(
"INSERT INTO glossary_term (id, glo_id, term, language, import_id, create_date, last_update)".
255 $ilDB->quote($this->getId(),
"integer").
", ".
256 $ilDB->quote($this->getGlossaryId(),
"integer").
", ".
257 $ilDB->quote($this->term,
"text").
", ".
258 $ilDB->quote($this->language,
"text").
",".
272 require_once(
"./Modules/Glossary/classes/class.ilGlossaryDefinition.php");
274 foreach($defs as $def)
279 $ilDB->manipulate(
"DELETE FROM glossary_term ".
280 " WHERE id = ".$ilDB->quote($this->getId(),
"integer"));
291 $ilDB->manipulate(
"UPDATE glossary_term SET ".
292 " glo_id = ".$ilDB->quote($this->getGlossaryId(),
"integer").
", ".
293 " term = ".$ilDB->quote($this->getTerm(),
"text").
", ".
294 " import_id = ".$ilDB->quote($this->getImportId(),
"text").
", ".
295 " language = ".$ilDB->quote($this->getLanguage(),
"text").
", ".
296 " last_update = ".$ilDB->now().
" ".
297 " WHERE id = ".$ilDB->quote($this->
getId(),
"integer"));
307 $query =
"SELECT * FROM glossary_term WHERE id = ".
308 $ilDB->quote($term_id,
"integer");
309 $obj_set = $ilDB->query(
$query);
310 $obj_rec = $ilDB->fetchAssoc($obj_set);
312 return $obj_rec[
"glo_id"];
322 $query =
"SELECT * FROM glossary_term WHERE id = ".
323 $ilDB->quote($term_id,
"integer");
324 $obj_set = $ilDB->query(
$query);
325 $obj_rec = $ilDB->fetchAssoc($obj_set);
327 return $obj_rec[
"term"];
337 $query =
"SELECT * FROM glossary_term WHERE id = ".
338 $ilDB->quote($term_id,
"integer");
339 $obj_set = $ilDB->query(
$query);
340 $obj_rec = $ilDB->fetchAssoc($obj_set);
342 return $obj_rec[
"language"];
353 static function getTermList($a_glo_id, $searchterm =
"", $a_first_letter =
"", $a_def =
"",
363 include_once(
"./Services/Taxonomy/classes/class.ilObjTaxonomy.php");
365 if (count($tax_ids) > 0)
368 $sub_tree_ids = array();
369 foreach ($items as $i)
371 $sub_tree_ids[] = $i[
"item_id"];
373 $in =
" AND ".$ilDB->in(
"gt.id", $sub_tree_ids,
false,
"integer");
379 $join =
" JOIN glossary_definition gd ON (gd.term_id = gt.id)".
380 " JOIN page_object ON (".
381 "page_object.parent_id = ".$ilDB->quote($a_glo_id,
"integer").
382 " AND page_object.parent_type = ".$ilDB->quote(
"gdf",
"text").
383 " AND page_object.page_id = gd.id".
384 " AND ".$ilDB->like(
"page_object.content",
"text",
"%".$a_def.
"%").
388 $searchterm = (!empty ($searchterm))
389 ?
" AND ".$ilDB->like(
"term",
"text",
"%".$searchterm.
"%").
" "
392 if ($a_first_letter !=
"")
394 $searchterm.=
" AND ".$ilDB->upper($ilDB->substr(
"term", 1, 1)).
" = ".$ilDB->upper($ilDB->quote($a_first_letter,
"text")).
" ";
398 if (is_array($a_glo_id))
400 $where = $ilDB->in(
"glo_id", $a_glo_id,
false,
"integer");
404 $where =
" glo_id = ".$ilDB->quote($a_glo_id,
"integer").
" ";
409 $q =
"SELECT gt.term, gt.id, gt.glo_id, gt.language FROM glossary_term gt ".$join.
" WHERE ".$where.$searchterm.
" ORDER BY term";
410 $term_set = $ilDB->query($q);
412 while ($term_rec = $ilDB->fetchAssoc($term_set))
414 $terms[] = array(
"term" => $term_rec[
"term"],
415 "language" => $term_rec[
"language"],
"id" => $term_rec[
"id"],
"glo_id" => $term_rec[
"glo_id"]);
435 if (is_array($a_glo_id))
437 $where = $ilDB->in(
"glo_id", $a_glo_id,
false,
"integer");
441 $where =
" glo_id = ".$ilDB->quote($a_glo_id,
"integer").
" ";
446 include_once(
"./Services/Taxonomy/classes/class.ilObjTaxonomy.php");
448 if (count($tax_ids) > 0)
451 $sub_tree_ids = array();
452 foreach ($items as $i)
454 $sub_tree_ids[] = $i[
"item_id"];
456 $in =
" AND ".$ilDB->in(
"id", $sub_tree_ids,
false,
"integer");
463 $q =
"SELECT DISTINCT ".$ilDB->upper($ilDB->substr(
"term", 1, 1)).
" let FROM glossary_term WHERE ".$where.
" ORDER BY let";
464 $let_set = $ilDB->query($q);
467 while ($let_rec = $ilDB->fetchAssoc($let_set))
469 $let[$let_rec[
"let"]] = $let_rec[
"let"];
482 $attrs[
"Id"] =
"il_".IL_INST_ID.
"_git_".$this->
getId();
483 $a_xml_writer->xmlStartTag(
"GlossaryItem", $attrs);
486 $a_xml_writer->xmlElement(
"GlossaryTerm", $attrs, $this->
getTerm());
490 foreach($defs as $def)
493 $definition->exportXML($a_xml_writer, $a_inst);
496 $a_xml_writer->xmlEndTag(
"GlossaryItem");
518 include_once(
"./Services/COPage/classes/class.ilInternalLink.php");
534 $new_term->setTerm($old_term->getTerm());
535 $new_term->setLanguage($old_term->getLanguage());
536 $new_term->setGlossaryId($a_glossary_id);
540 include_once(
"./Modules/Glossary/classes/class.ilGlossaryDefinition.php");
542 foreach ($def_list as $def)
547 $new_def->setShortText($old_def->getShortText());
548 $new_def->setNr($old_def->getNr());
549 $new_def->setTermId($new_term->getId());
553 include_once(
"Services/MetaData/classes/class.ilMD.php");
554 $md =
new ilMD($old_term->getGlossaryId(),
555 $old_def->getPageObject()->getId(),
556 $old_def->getPageObject()->getParentType());
557 $new_md = $md->
cloneMD($a_glossary_id,
558 $new_def->getPageObject()->getId(),
559 $old_def->getPageObject()->getParentType());
562 $new_def->getPageObject()->setXMLContent($old_def->getPageObject()->copyXmlContent(
true));
563 $new_def->getPageObject()->buildDom();
564 $new_def->getPageObject()->update();
568 return $new_term->getId();
581 $set = $ilDB->query(
"SELECT id FROM glossary_term WHERE ".
582 " glo_id = ".$ilDB->quote($a_glo_id,
"integer")
585 while ($rec = $ilDB->fetchAssoc($set))