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 =
"")
361 $join =
" JOIN glossary_definition gd ON (gd.term_id = gt.id)".
362 " JOIN page_object ON (".
363 "page_object.parent_id = ".$ilDB->quote($a_glo_id,
"integer").
364 " AND page_object.parent_type = ".$ilDB->quote(
"gdf",
"text").
365 " AND page_object.page_id = gd.id".
366 " AND ".$ilDB->like(
"page_object.content",
"text",
"%".$a_def.
"%").
370 $searchterm = (!empty ($searchterm))
371 ?
" AND ".$ilDB->like(
"term",
"text",
"%".$searchterm.
"%").
" "
374 if ($a_first_letter !=
"")
376 $searchterm.=
" AND ".$ilDB->upper($ilDB->substr(
"term", 1, 1)).
" = ".$ilDB->upper($ilDB->quote($a_first_letter,
"text")).
" ";
380 if (is_array($a_glo_id))
382 $where = $ilDB->in(
"glo_id", $a_glo_id,
false,
"integer");
386 $where =
" glo_id = ".$ilDB->quote($a_glo_id,
"integer").
" ";
389 $q =
"SELECT gt.term, gt.id, gt.glo_id, gt.language FROM glossary_term gt ".$join.
" WHERE ".$where.$searchterm.
" ORDER BY term";
390 $term_set = $ilDB->query($q);
392 while ($term_rec = $ilDB->fetchAssoc($term_set))
394 $terms[] = array(
"term" => $term_rec[
"term"],
395 "language" => $term_rec[
"language"],
"id" => $term_rec[
"id"],
"glo_id" => $term_rec[
"glo_id"]);
415 if (is_array($a_glo_id))
417 $where = $ilDB->in(
"glo_id", $a_glo_id,
false,
"integer");
421 $where =
" glo_id = ".$ilDB->quote($a_glo_id,
"integer").
" ";
424 $q =
"SELECT DISTINCT ".$ilDB->upper($ilDB->substr(
"term", 1, 1)).
" let FROM glossary_term WHERE ".$where.
" ORDER BY let";
425 $let_set = $ilDB->query($q);
428 while ($let_rec = $ilDB->fetchAssoc($let_set))
430 $let[$let_rec[
"let"]] = $let_rec[
"let"];
443 $attrs[
"Id"] =
"il_".IL_INST_ID.
"_git_".$this->
getId();
444 $a_xml_writer->xmlStartTag(
"GlossaryItem", $attrs);
447 $a_xml_writer->xmlElement(
"GlossaryTerm", $attrs, $this->
getTerm());
451 foreach($defs as $def)
454 $definition->exportXML($a_xml_writer, $a_inst);
457 $a_xml_writer->xmlEndTag(
"GlossaryItem");
479 include_once(
"./Services/COPage/classes/class.ilInternalLink.php");
495 $new_term->setTerm($old_term->getTerm());
496 $new_term->setLanguage($old_term->getLanguage());
497 $new_term->setGlossaryId($a_glossary_id);
501 include_once(
"./Modules/Glossary/classes/class.ilGlossaryDefinition.php");
503 foreach ($def_list as $def)
508 $new_def->setShortText($old_def->getShortText());
509 $new_def->setNr($old_def->getNr());
510 $new_def->setTermId($new_term->getId());
514 include_once(
"Services/MetaData/classes/class.ilMD.php");
515 $md =
new ilMD($old_term->getGlossaryId(),
516 $old_def->getPageObject()->getId(),
517 $old_def->getPageObject()->getParentType());
518 $new_md = $md->
cloneMD($a_glossary_id,
519 $new_def->getPageObject()->getId(),
520 $old_def->getPageObject()->getParentType());
523 $new_def->getPageObject()->setXMLContent($old_def->getPageObject()->getXMLContent());
524 $new_def->getPageObject()->buildDom();
525 $new_def->getPageObject()->update();
529 return $new_term->getId();
542 $set = $ilDB->query(
"SELECT id FROM glossary_term WHERE ".
543 " glo_id = ".$ilDB->quote($a_glo_id,
"integer")
546 while ($rec = $ilDB->fetchAssoc($set))