24 require_once(
"./Services/COPage/classes/class.ilPageObject.php");
73 $q =
"SELECT * FROM glossary_definition WHERE id = ".$ilDB->quote($this->
id);
74 $def_set = $this->ilias->db->query($q);
79 $this->
setNr($def_rec[
"nr"]);
81 $this->page_object =&
new ilPageObject(
"gdf", $this->
id);
101 $this->term_id = $a_term_id;
111 $this->short_text = $a_text;
131 $this->page_object =& $a_page_object;
154 $this->title = $a_title;
164 return $this->description;
172 $this->description = $a_description;
182 $q =
"LOCK TABLES glossary_definition WRITE";
183 $this->ilias->db->query($q);
186 $q =
"SELECT max(nr) AS max_nr FROM glossary_definition WHERE term_id = ".$ilDB->quote($this->
getTermId());
187 $max_set = $this->ilias->db->query($q);
189 $max = (int) $max_rec[
"max_nr"];
192 $q =
"INSERT INTO glossary_definition (term_id, short_text, nr)".
193 " VALUES (".$ilDB->quote($this->
getTermId()).
",".
194 $ilDB->quote($this->
getShortText()).
", ".$ilDB->quote(($max + 1)).
")";
195 $this->ilias->db->query($q);
198 $q =
"UNLOCK TABLES";
199 $this->ilias->db->query($q);
201 $this->
setId($this->ilias->db->getLastInsertId());
204 $q =
"SELECT nr FROM glossary_definition WHERE id = ".$ilDB->quote($this->
id);
205 $def_set = $this->ilias->db->query($q);
207 $this->
setNr($def_rec[
"nr"]);
217 $this->page_object->setId($this->
getId());
218 $this->page_object->setParentId($term->getGlossaryId());
219 $this->page_object->create();
227 $q =
"LOCK TABLES glossary_definition WRITE";
228 $this->ilias->db->query($q);
231 $q =
"SELECT * FROM glossary_definition WHERE id = ".$ilDB->quote($this->
id);
232 $def_set = $this->ilias->db->query($q);
234 $this->
setNr($def_rec[
"nr"]);
237 $q =
"UPDATE glossary_definition SET ".
239 " WHERE term_id = ".$ilDB->quote($this->
getTermId()).
" ".
240 " AND nr > ".$ilDB->quote($this->
getNr());
241 $this->ilias->db->query($q);
244 $q =
"DELETE FROM glossary_definition ".
245 " WHERE id = ".$ilDB->quote($this->
getId()).
" ";
246 $this->ilias->db->query($q);
249 $q =
"UNLOCK TABLES";
250 $this->ilias->db->query($q);
253 $this->page_object->delete();
270 $q =
"LOCK TABLES glossary_definition WRITE";
271 $this->ilias->db->query($q);
274 $q =
"SELECT * FROM glossary_definition WHERE id = ".$ilDB->quote($this->
id);
275 $def_set = $this->ilias->db->query($q);
277 $this->
setNr($def_rec[
"nr"]);
279 if ($this->
getNr() < 2)
281 $q =
"UNLOCK TABLES";
282 $this->ilias->db->query($q);
287 $q =
"UPDATE glossary_definition SET ".
289 " WHERE term_id = ".$ilDB->quote($this->
getTermId()).
" ".
290 " AND nr = ".$ilDB->quote(($this->
getNr() - 1));
291 $this->ilias->db->query($q);
294 $q =
"UPDATE glossary_definition SET ".
296 " WHERE term_id = ".$ilDB->quote($this->
getTermId()).
" ".
297 " AND id = ".$ilDB->quote($this->
getId());
298 $this->ilias->db->query($q);
301 $q =
"UNLOCK TABLES";
302 $this->ilias->db->query($q);
312 $q =
"LOCK TABLES glossary_definition WRITE";
313 $this->ilias->db->query($q);
316 $q =
"SELECT * FROM glossary_definition WHERE id = ".$ilDB->quote($this->
id);
317 $def_set = $this->ilias->db->query($q);
319 $this->
setNr($def_rec[
"nr"]);
322 $q =
"SELECT max(nr) as max_nr FROM glossary_definition WHERE term_id = ".
324 $max_set = $this->ilias->db->query($q);
327 if ($this->
getNr() >= $max_rec[
"max_nr"])
329 $q =
"UNLOCK TABLES";
330 $this->ilias->db->query($q);
335 $q =
"UPDATE glossary_definition SET ".
337 " WHERE term_id = ".$ilDB->quote($this->
getTermId()).
" ".
338 " AND nr = ".$ilDB->quote(($this->
getNr() + 1));
339 $this->ilias->db->query($q);
342 $q =
"UPDATE glossary_definition SET ".
344 " WHERE term_id = ".$ilDB->quote($this->
getTermId()).
" ".
345 " AND id = ".$ilDB->quote($this->
getId());
346 $this->ilias->db->query($q);
349 $q =
"UNLOCK TABLES";
350 $this->ilias->db->query($q);
361 $q =
"UPDATE glossary_definition SET ".
362 " term_id = ".$ilDB->quote($this->
getTermId()).
", ".
363 " nr = ".$ilDB->quote($this->
getNr()).
", ".
364 " short_text = ".$ilDB->quote($this->
getShortText()).
" ".
365 " WHERE id = ".$ilDB->quote($this->
getId());
366 $this->ilias->db->query($q);
371 $this->page_object->buildDom();
372 $text = $this->page_object->getFirstParagraphText();
375 $text = str_replace(
"<br/>",
"<br>", $text);
376 $text = strip_tags($text,
"<br>");
377 if (is_int(strpos(substr($text, 175, 10),
"[tex]")))
384 $ltexs = strrpos($short,
"[tex]");
385 $ltexe = strrpos($short,
"[/tex]");
388 $ltexe = strpos($text,
"[/tex]", $ltexs);
406 $q =
"SELECT * FROM glossary_definition WHERE term_id = ".$ilDB->quote($a_term_id).
408 $def_set = $ilDB->query($q);
411 $defs[] = array(
"term_id" => $def_rec[
"term_id"],
412 "page_id" => $def_rec[
"page_id"],
"id" => $def_rec[
"id"],
413 "short_text" => strip_tags($def_rec[
"short_text"],
"<br>"),
414 "nr" => $def_rec[
"nr"]);
425 $a_xml_writer->xmlStartTag(
"Definition", $attrs);
430 $a_xml_writer->xmlEndTag(
"Definition");
443 include_once(
"Services/MetaData/classes/class.ilMD2XML.php");
445 $md2xml->setExportMode(
true);
446 $md2xml->startExport();
447 $a_xml_writer->appendXML($md2xml->getXML());
455 if ($a_tag ==
"Identifier" && $a_param ==
"Entry")
457 $a_value =
"il_".IL_INST_ID.
"_gdf_".$this->
getId();
473 $this->page_object->buildDom();
474 $this->page_object->insertInstIntoIDs($a_inst);
475 $this->mobs_contained = $this->page_object->collectMediaObjects(
false);
476 $this->files_contained = $this->page_object->collectFileItems();
477 $xml = $this->page_object->getXMLFromDom(
false,
false,
false,
"",
true);
478 $xml = str_replace(
"&",
"&", $xml);
479 $a_xml_writer->appendXML($xml);
481 $this->page_object->freeDom();
489 include_once
'Services/MetaData/classes/class.ilMDCreator.php';
496 $md_creator->setTitle($this->
getTitle());
497 $md_creator->setTitleLanguage(
$lang);
499 $md_creator->setDescriptionLanguage(
$lang);
500 $md_creator->setKeywordLanguage(
$lang);
501 $md_creator->setLanguage(
$lang);
502 $md_creator->create();
512 include_once(
"Services/MetaData/classes/class.ilMD.php");
513 include_once(
"Services/MetaData/classes/class.ilMDGeneral.php");
514 include_once(
"Services/MetaData/classes/class.ilMDDescription.php");
518 $md_gen =& $md->getGeneral();
519 $md_gen->setTitle($this->
getTitle());
522 $md_des_ids =& $md_gen->getDescriptionIds();
523 if (count($md_des_ids) > 0)
525 $md_des =& $md_gen->getDescription($md_des_ids[0]);
538 include_once(
'Services/MetaData/classes/class.ilMD.php');
560 include_once
'Services/MetaData/classes/class.ilMD.php';
569 $md_gen = $md->getGeneral();
572 $this->
setTitle($md_gen->getTitle());
574 foreach($md_gen->getDescriptionIds() as
$id)
576 $md_des = $md_gen->getDescription(
$id);
598 $q =
"SELECT * FROM glossary_definition WHERE id = ".$ilDB->quote($a_def_id);
599 $def_set = $ilDB->query($q);
602 return $def_rec[
"term_id"];