4 require_once(
"./Services/COPage/classes/class.ilPageObject.php");
53 $q =
"SELECT * FROM glossary_definition WHERE id = ".
54 $ilDB->quote($this->
id,
"integer");
55 $def_set = $ilDB->query(
$q);
56 $def_rec = $ilDB->fetchAssoc($def_set);
60 $this->
setNr($def_rec[
"nr"]);
62 $this->page_object =&
new ilPageObject(
"gdf", $this->
id);
82 $this->term_id = $a_term_id;
112 $this->page_object =& $a_page_object;
135 $this->title = $a_title;
145 return $this->description;
153 $this->description = $a_description;
162 $this->
setId($ilDB->nextId(
"glossary_definition"));
170 $q =
"SELECT max(nr) AS max_nr FROM glossary_definition WHERE term_id = ".
171 $ilDB->quote($this->
getTermId(),
"integer");
172 $max_set = $ilDB->query(
$q);
173 $max_rec = $ilDB->fetchAssoc($max_set);
174 $max = (int) $max_rec[
"max_nr"];
177 $ilDB->manipulate(
"INSERT INTO glossary_definition (id, term_id, short_text, nr)".
179 $ilDB->quote($this->getId(),
"integer").
",".
180 $ilDB->quote($this->getTermId(),
"integer").
",".
181 $ilDB->quote($this->getShortText(),
"text").
", ".
182 $ilDB->quote(($max + 1),
"integer").
")");
185 $ilDB->unlockTables();
188 $q =
"SELECT nr FROM glossary_definition WHERE id = ".
189 $ilDB->quote($this->
id,
"integer");
190 $def_set = $ilDB->query(
$q);
191 $def_rec = $ilDB->fetchAssoc($def_set);
192 $this->
setNr($def_rec[
"nr"]);
202 $this->page_object->setId($this->
getId());
203 $this->page_object->setParentId($term->getGlossaryId());
204 $this->page_object->create();
212 #ilDB::_lockTables(array('glossary_definition' => 'WRITE'));
219 $q =
"SELECT * FROM glossary_definition WHERE id = ".
220 $ilDB->quote($this->
id,
"integer");
221 $def_set = $ilDB->query(
$q);
222 $def_rec = $ilDB->fetchAssoc($def_set);
223 $this->
setNr($def_rec[
"nr"]);
226 $ilDB->manipulate(
"UPDATE glossary_definition SET ".
228 " WHERE term_id = ".$ilDB->quote($this->getTermId(),
"integer").
" ".
229 " AND nr > ".$ilDB->quote($this->getNr(),
"integer"));
232 $ilDB->manipulate(
"DELETE FROM glossary_definition ".
233 " WHERE id = ".$ilDB->quote($this->getId(),
"integer"));
236 $ilDB->unlockTables();
239 $this->page_object->delete();
256 #ilDB::_lockTables(array('glossary_definition' => 'WRITE'));
263 $q =
"SELECT * FROM glossary_definition WHERE id = ".
264 $ilDB->quote($this->
id,
"integer");
265 $def_set = $ilDB->query(
$q);
266 $def_rec = $ilDB->fetchAssoc($def_set);
267 $this->
setNr($def_rec[
"nr"]);
269 if ($this->
getNr() < 2)
271 $ilDB->unlockTables();
276 $ilDB->manipulate(
"UPDATE glossary_definition SET ".
278 " WHERE term_id = ".$ilDB->quote($this->getTermId(),
"integer").
" ".
279 " AND nr = ".$ilDB->quote(($this->getNr() - 1),
"integer"));
282 $ilDB->manipulate(
"UPDATE glossary_definition SET ".
284 " WHERE term_id = ".$ilDB->quote($this->getTermId(),
"integer").
" ".
285 " AND id = ".$ilDB->quote($this->getId(),
"integer"));
288 $ilDB->unlockTables();
297 #ilDB::_lockTables(array('glossary_definition' => 'WRITE'));
303 $q =
"SELECT * FROM glossary_definition WHERE id = ".
304 $ilDB->quote($this->
id,
"integer");
305 $def_set = $ilDB->query(
$q);
306 $def_rec = $ilDB->fetchAssoc($def_set);
307 $this->
setNr($def_rec[
"nr"]);
310 $q =
"SELECT max(nr) as max_nr FROM glossary_definition WHERE term_id = ".
311 $ilDB->quote($this->
getTermId(),
"integer");
312 $max_set = $ilDB->query(
$q);
313 $max_rec = $ilDB->fetchAssoc($max_set);
315 if ($this->
getNr() >= $max_rec[
"max_nr"])
317 $ilDB->unlockTables();
322 $ilDB->manipulate(
"UPDATE glossary_definition SET ".
324 " WHERE term_id = ".$ilDB->quote($this->getTermId(),
"integer").
" ".
325 " AND nr = ".$ilDB->quote(($this->getNr() + 1),
"integer"));
328 $ilDB->manipulate(
"UPDATE glossary_definition SET ".
330 " WHERE term_id = ".$ilDB->quote($this->getTermId(),
"integer").
" ".
331 " AND id = ".$ilDB->quote($this->getId(),
"integer"));
334 $ilDB->unlockTables();
345 $ilDB->manipulate(
"UPDATE glossary_definition SET ".
346 " term_id = ".$ilDB->quote($this->getTermId(),
"integer").
", ".
347 " nr = ".$ilDB->quote($this->getNr(),
"integer").
", ".
348 " short_text = ".$ilDB->quote($this->getShortText(),
"text").
" ".
349 " WHERE id = ".$ilDB->quote($this->getId(),
"integer"));
360 $text = str_replace(
"<br/>",
"<br>", $text);
361 $text = strip_tags($text,
"<br>");
362 if (is_int(strpos(substr($text, 175, 10),
"[tex]")))
369 $ltexs = strrpos($short,
"[tex]");
370 $ltexe = strrpos($short,
"[/tex]");
373 $ltexe = strpos($text,
"[/tex]", $ltexs);
387 $this->page_object->buildDom();
388 $text = $this->page_object->getFirstParagraphText();
404 $q =
"SELECT * FROM glossary_definition WHERE term_id = ".
405 $ilDB->quote($a_term_id,
"integer").
407 $def_set = $ilDB->query(
$q);
408 while ($def_rec = $ilDB->fetchAssoc($def_set))
410 $defs[] = array(
"term_id" => $def_rec[
"term_id"],
411 "page_id" => $def_rec[
"page_id"],
"id" => $def_rec[
"id"],
412 "short_text" => strip_tags($def_rec[
"short_text"],
"<br>"),
413 "nr" => $def_rec[
"nr"]);
424 $a_xml_writer->xmlStartTag(
"Definition", $attrs);
429 $a_xml_writer->xmlEndTag(
"Definition");
442 include_once(
"Services/MetaData/classes/class.ilMD2XML.php");
444 $md2xml->setExportMode(
true);
445 $md2xml->startExport();
446 $a_xml_writer->appendXML($md2xml->getXML());
454 if ($a_tag ==
"Identifier" && $a_param ==
"Entry")
456 $a_value =
"il_".IL_INST_ID.
"_gdf_".$this->
getId();
472 $this->page_object->buildDom();
473 $this->page_object->insertInstIntoIDs($a_inst);
474 $this->mobs_contained = $this->page_object->collectMediaObjects(
false);
475 $this->files_contained = $this->page_object->collectFileItems();
476 $xml = $this->page_object->getXMLFromDom(
false,
false,
false,
"",
true);
477 $xml = str_replace(
"&",
"&", $xml);
478 $a_xml_writer->appendXML($xml);
480 $this->page_object->freeDom();
488 include_once
'Services/MetaData/classes/class.ilMDCreator.php';
495 $md_creator->setTitle($this->
getTitle());
496 $md_creator->setTitleLanguage(
$lang);
498 $md_creator->setDescriptionLanguage(
$lang);
499 $md_creator->setKeywordLanguage(
$lang);
500 $md_creator->setLanguage(
$lang);
501 $md_creator->create();
511 include_once(
"Services/MetaData/classes/class.ilMD.php");
512 include_once(
"Services/MetaData/classes/class.ilMDGeneral.php");
513 include_once(
"Services/MetaData/classes/class.ilMDDescription.php");
517 $md_gen =& $md->getGeneral();
518 $md_gen->setTitle($this->
getTitle());
521 $md_des_ids =& $md_gen->getDescriptionIds();
522 if (count($md_des_ids) > 0)
524 $md_des =& $md_gen->getDescription($md_des_ids[0]);
537 include_once(
'Services/MetaData/classes/class.ilMD.php');
559 include_once
'Services/MetaData/classes/class.ilMD.php';
568 $md_gen = $md->getGeneral();
571 $this->
setTitle($md_gen->getTitle());
573 foreach($md_gen->getDescriptionIds() as
$id)
575 $md_des = $md_gen->getDescription(
$id);
597 $q =
"SELECT * FROM glossary_definition WHERE id = ".
598 $ilDB->quote($a_def_id,
"integer");
599 $def_set = $ilDB->query(
$q);
600 $def_rec = $ilDB->fetchAssoc($def_set);
602 return $def_rec[
"term_id"];