4 require_once(
"./Services/COPage/classes/class.ilPageObject.php");
54 $q =
"SELECT * FROM glossary_definition WHERE id = ".
55 $ilDB->quote($this->
id,
"integer");
56 $def_set = $ilDB->query($q);
57 $def_rec = $ilDB->fetchAssoc($def_set);
61 $this->
setNr($def_rec[
"nr"]);
64 $this->page_object =&
new ilPageObject(
"gdf", $this->
id);
84 $this->term_id = $a_term_id;
114 $this->page_object =& $a_page_object;
137 $this->title = $a_title;
147 return $this->description;
157 $this->description = $a_description;
167 $this->short_text_dirty = $a_val;
190 $this->
setId($ilDB->nextId(
"glossary_definition"));
198 $q =
"SELECT max(nr) AS max_nr FROM glossary_definition WHERE term_id = ".
199 $ilDB->quote($this->
getTermId(),
"integer");
200 $max_set = $ilDB->query($q);
201 $max_rec = $ilDB->fetchAssoc($max_set);
202 $max = (int) $max_rec[
"max_nr"];
205 $ilDB->manipulate(
"INSERT INTO glossary_definition (id, term_id, short_text, nr, short_text_dirty)".
207 $ilDB->quote($this->getId(),
"integer").
",".
208 $ilDB->quote($this->getTermId(),
"integer").
",".
209 $ilDB->quote($this->getShortText(),
"text").
", ".
210 $ilDB->quote(($max + 1),
"integer").
", ".
215 $ilDB->unlockTables();
218 $q =
"SELECT nr FROM glossary_definition WHERE id = ".
219 $ilDB->quote($this->
id,
"integer");
220 $def_set = $ilDB->query($q);
221 $def_rec = $ilDB->fetchAssoc($def_set);
222 $this->
setNr($def_rec[
"nr"]);
232 $this->page_object->setId($this->
getId());
233 $this->page_object->setParentId($term->getGlossaryId());
234 $this->page_object->create();
242 #ilDB::_lockTables(array('glossary_definition' => 'WRITE'));
249 $q =
"SELECT * FROM glossary_definition WHERE id = ".
250 $ilDB->quote($this->
id,
"integer");
251 $def_set = $ilDB->query($q);
252 $def_rec = $ilDB->fetchAssoc($def_set);
253 $this->
setNr($def_rec[
"nr"]);
256 $ilDB->manipulate(
"UPDATE glossary_definition SET ".
258 " WHERE term_id = ".$ilDB->quote($this->getTermId(),
"integer").
" ".
259 " AND nr > ".$ilDB->quote($this->getNr(),
"integer"));
262 $ilDB->manipulate(
"DELETE FROM glossary_definition ".
263 " WHERE id = ".$ilDB->quote($this->getId(),
"integer"));
266 $ilDB->unlockTables();
269 $this->page_object->delete();
286 #ilDB::_lockTables(array('glossary_definition' => 'WRITE'));
293 $q =
"SELECT * FROM glossary_definition WHERE id = ".
294 $ilDB->quote($this->
id,
"integer");
295 $def_set = $ilDB->query($q);
296 $def_rec = $ilDB->fetchAssoc($def_set);
297 $this->
setNr($def_rec[
"nr"]);
299 if ($this->
getNr() < 2)
301 $ilDB->unlockTables();
306 $ilDB->manipulate(
"UPDATE glossary_definition SET ".
308 " WHERE term_id = ".$ilDB->quote($this->getTermId(),
"integer").
" ".
309 " AND nr = ".$ilDB->quote(($this->getNr() - 1),
"integer"));
312 $ilDB->manipulate(
"UPDATE glossary_definition SET ".
314 " WHERE term_id = ".$ilDB->quote($this->getTermId(),
"integer").
" ".
315 " AND id = ".$ilDB->quote($this->getId(),
"integer"));
318 $ilDB->unlockTables();
327 #ilDB::_lockTables(array('glossary_definition' => 'WRITE'));
333 $q =
"SELECT * FROM glossary_definition WHERE id = ".
334 $ilDB->quote($this->
id,
"integer");
335 $def_set = $ilDB->query($q);
336 $def_rec = $ilDB->fetchAssoc($def_set);
337 $this->
setNr($def_rec[
"nr"]);
340 $q =
"SELECT max(nr) as max_nr FROM glossary_definition WHERE term_id = ".
341 $ilDB->quote($this->
getTermId(),
"integer");
342 $max_set = $ilDB->query($q);
343 $max_rec = $ilDB->fetchAssoc($max_set);
345 if ($this->
getNr() >= $max_rec[
"max_nr"])
347 $ilDB->unlockTables();
352 $ilDB->manipulate(
"UPDATE glossary_definition SET ".
354 " WHERE term_id = ".$ilDB->quote($this->getTermId(),
"integer").
" ".
355 " AND nr = ".$ilDB->quote(($this->getNr() + 1),
"integer"));
358 $ilDB->manipulate(
"UPDATE glossary_definition SET ".
360 " WHERE term_id = ".$ilDB->quote($this->getTermId(),
"integer").
" ".
361 " AND id = ".$ilDB->quote($this->getId(),
"integer"));
364 $ilDB->unlockTables();
375 $ilDB->manipulate(
"UPDATE glossary_definition SET ".
376 " term_id = ".$ilDB->quote($this->getTermId(),
"integer").
", ".
377 " nr = ".$ilDB->quote($this->getNr(),
"integer").
", ".
378 " short_text = ".$ilDB->quote($this->getShortText(),
"text").
", ".
379 " short_text_dirty = ".$ilDB->quote($this->getShortTextDirty(),
"integer").
" ".
380 " WHERE id = ".$ilDB->quote($this->getId(),
"integer"));
395 include_once(
"./Modules/Glossary/classes/class.ilObjGlossary.php");
396 include_once(
"./Modules/Glossary/classes/class.ilGlossaryTerm.php");
399 if ($snippet_length > 0)
401 $a_length = $snippet_length;
405 $text = str_replace(
"<br/>",
"<br>", $text);
406 $text = strip_tags($text,
"<br>");
407 if (is_int(strpos(substr($text, $a_length - 16 - 5, 10),
"[tex]")))
414 $ltexs = strrpos($short,
"[tex]");
415 $ltexe = strrpos($short,
"[/tex]");
418 $ltexe = strpos($text,
"[/tex]", $ltexs);
432 $this->page_object->buildDom();
433 $text = $this->page_object->getFirstParagraphText();
450 $q =
"SELECT * FROM glossary_definition WHERE term_id = ".
451 $ilDB->quote($a_term_id,
"integer").
453 $def_set = $ilDB->query($q);
454 while ($def_rec = $ilDB->fetchAssoc($def_set))
456 $defs[] = array(
"term_id" => $def_rec[
"term_id"],
457 "page_id" => $def_rec[
"page_id"],
"id" => $def_rec[
"id"],
458 "short_text" => strip_tags($def_rec[
"short_text"],
"<br>"),
459 "nr" => $def_rec[
"nr"],
460 "short_text_dirty" => $def_rec[
"short_text_dirty"]);
471 $a_xml_writer->xmlStartTag(
"Definition", $attrs);
476 $a_xml_writer->xmlEndTag(
"Definition");
489 include_once(
"Services/MetaData/classes/class.ilMD2XML.php");
491 $md2xml->setExportMode(
true);
492 $md2xml->startExport();
493 $a_xml_writer->appendXML($md2xml->getXML());
501 if ($a_tag ==
"Identifier" && $a_param ==
"Entry")
503 $a_value =
"il_".IL_INST_ID.
"_gdf_".$this->
getId();
519 $this->page_object->buildDom();
520 $this->page_object->insertInstIntoIDs($a_inst);
521 $this->mobs_contained = $this->page_object->collectMediaObjects(
false);
522 $this->files_contained = $this->page_object->collectFileItems();
523 $xml = $this->page_object->getXMLFromDom(
false,
false,
false,
"",
true);
524 $xml = str_replace(
"&",
"&", $xml);
525 $a_xml_writer->appendXML($xml);
527 $this->page_object->freeDom();
535 include_once
'Services/MetaData/classes/class.ilMDCreator.php';
542 $md_creator->setTitle($this->
getTitle());
543 $md_creator->setTitleLanguage(
$lang);
545 $md_creator->setDescriptionLanguage(
$lang);
546 $md_creator->setKeywordLanguage(
$lang);
547 $md_creator->setLanguage(
$lang);
549 $md_creator->create();
559 include_once(
"Services/MetaData/classes/class.ilMD.php");
560 include_once(
"Services/MetaData/classes/class.ilMDGeneral.php");
561 include_once(
"Services/MetaData/classes/class.ilMDDescription.php");
565 $md_gen =& $md->getGeneral();
566 $md_gen->setTitle($this->
getTitle());
569 $md_des_ids =& $md_gen->getDescriptionIds();
570 if (count($md_des_ids) > 0)
572 $md_des =& $md_gen->getDescription($md_des_ids[0]);
585 include_once(
'Services/MetaData/classes/class.ilMD.php');
607 include_once
'Services/MetaData/classes/class.ilMD.php';
616 $md_gen = $md->getGeneral();
619 $this->
setTitle($md_gen->getTitle());
621 foreach($md_gen->getDescriptionIds() as
$id)
623 $md_des = $md_gen->getDescription(
$id);
645 $q =
"SELECT * FROM glossary_definition WHERE id = ".
646 $ilDB->quote($a_def_id,
"integer");
647 $def_set = $ilDB->query($q);
648 $def_rec = $ilDB->fetchAssoc($def_set);
650 return $def_rec[
"term_id"];
663 include_once(
"./Modules/Glossary/classes/class.ilGlossaryTerm.php");
668 $ilDB->manipulate(
"UPDATE glossary_definition SET ".
669 " short_text_dirty = ".$ilDB->quote(1,
"integer").
670 " WHERE term_id = ".$ilDB->quote($term_id,
"integer")