4 require_once(
"./Modules/Glossary/classes/class.ilGlossaryDefPage.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"]);
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;
184 function create($a_upload =
false, $a_omit_page_creation =
false)
190 $this->
setId($ilDB->nextId(
"glossary_definition"));
192 $ilAtomQuery = $ilDB->buildAtomQuery();
193 $ilAtomQuery->addTableLock(
'glossary_definition');
195 $ilAtomQuery->addQueryCallable(
function (
ilDBInterface $ilDB) {
198 $q =
"SELECT max(nr) AS max_nr FROM glossary_definition WHERE term_id = " .
200 $max_set = $ilDB->
query($q);
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") .
", " .
219 $q =
"SELECT nr FROM glossary_definition WHERE id = ".
220 $ilDB->
quote($this->
id,
"integer");
221 $def_set = $ilDB->
query($q);
223 $this->
setNr($def_rec[
"nr"]);
232 if (!$a_omit_page_creation)
235 $this->page_object->setId($this->
getId());
236 $this->page_object->setParentId($term->getGlossaryId());
237 $this->page_object->create();
245 $ilAtomQuery = $ilDB->buildAtomQuery();
246 $ilAtomQuery->addTableLock(
"glossary_definition");
248 $ilAtomQuery->addQueryCallable(
function (
ilDBInterface $ilDB){
251 $q =
"SELECT * FROM glossary_definition WHERE id = ".
252 $ilDB->
quote($this->
id,
"integer");
253 $def_set = $ilDB->
query($q);
255 $this->
setNr($def_rec[
"nr"]);
258 $ilDB->
manipulate(
"UPDATE glossary_definition SET ".
260 " WHERE term_id = ".$ilDB->
quote($this->getTermId(),
"integer").
" ".
261 " AND nr > ".$ilDB->
quote($this->getNr(),
"integer"));
264 $ilDB->
manipulate(
"DELETE FROM glossary_definition ".
265 " WHERE id = ".$ilDB->
quote($this->getId(),
"integer"));
271 $this->page_object->delete();
282 $ilAtomQuery = $ilDB->buildAtomQuery();
283 $ilAtomQuery->addTableLock(
'glossary_definition');
285 $ilAtomQuery->addQueryCallable(
function (
ilDBInterface $ilDB) {
288 $q =
"SELECT * FROM glossary_definition WHERE id = " .
289 $ilDB->
quote($this->
id,
"integer");
290 $def_set = $ilDB->
query($q);
292 $this->
setNr($def_rec[
"nr"]);
294 if ($this->
getNr() < 2) {
299 $ilDB->
manipulate(
"UPDATE glossary_definition SET " .
301 " WHERE term_id = " . $ilDB->
quote($this->getTermId(),
"integer") .
" " .
302 " AND nr = " . $ilDB->
quote(($this->getNr() - 1),
"integer"));
305 $ilDB->
manipulate(
"UPDATE glossary_definition SET " .
307 " WHERE term_id = " . $ilDB->
quote($this->getTermId(),
"integer") .
" " .
308 " AND id = " . $ilDB->
quote($this->getId(),
"integer"));
318 $ilAtomQuery = $ilDB->buildAtomQuery();
319 $ilAtomQuery->addTableLock(
'glossary_definition');
321 $ilAtomQuery->addQueryCallable(
function(
ilDBInterface $ilDB){
324 $q =
"SELECT * FROM glossary_definition WHERE id = ".
325 $ilDB->
quote($this->
id,
"integer");
326 $def_set = $ilDB->
query($q);
328 $this->
setNr($def_rec[
"nr"]);
331 $q =
"SELECT max(nr) as max_nr FROM glossary_definition WHERE term_id = ".
333 $max_set = $ilDB->
query($q);
336 if ($this->
getNr() >= $max_rec[
"max_nr"])
342 $ilDB->
manipulate(
"UPDATE glossary_definition SET ".
344 " WHERE term_id = ".$ilDB->
quote($this->getTermId(),
"integer").
" ".
345 " AND nr = ".$ilDB->
quote(($this->getNr() + 1),
"integer"));
348 $ilDB->
manipulate(
"UPDATE glossary_definition SET ".
350 " WHERE term_id = ".$ilDB->
quote($this->getTermId(),
"integer").
" ".
351 " AND id = ".$ilDB->
quote($this->getId(),
"integer"));
365 $ilDB->manipulate(
"UPDATE glossary_definition SET ".
366 " term_id = ".$ilDB->quote($this->getTermId(),
"integer").
", ".
367 " nr = ".$ilDB->quote($this->getNr(),
"integer").
", ".
368 " short_text = ".$ilDB->quote($this->getShortText(),
"text").
", ".
369 " short_text_dirty = ".$ilDB->quote($this->getShortTextDirty(),
"integer").
" ".
370 " WHERE id = ".$ilDB->quote($this->getId(),
"integer"));
385 include_once(
"./Modules/Glossary/classes/class.ilObjGlossary.php");
386 include_once(
"./Modules/Glossary/classes/class.ilGlossaryTerm.php");
387 $glo_id = ilGlossaryTerm::_lookGlossaryId($this->
getTermId());
389 if ($snippet_length > 0)
391 $a_length = $snippet_length;
397 if (is_int(strpos(substr(
$text, $a_length - 16 - 5, 10),
"[tex]")))
404 $ltexs = strrpos($short,
"[tex]");
405 $ltexe = strrpos($short,
"[/tex]");
408 $ltexe = strpos(
$text,
"[/tex]", $ltexs);
422 $this->page_object->buildDom();
423 $text = $this->page_object->getFirstParagraphText();
440 $q =
"SELECT * FROM glossary_definition WHERE term_id = ".
441 $ilDB->quote($a_term_id,
"integer").
443 $def_set = $ilDB->query($q);
444 while ($def_rec = $ilDB->fetchAssoc($def_set))
446 $defs[] =
array(
"term_id" => $def_rec[
"term_id"],
447 "page_id" => $def_rec[
"page_id"],
"id" => $def_rec[
"id"],
448 "short_text" => strip_tags($def_rec[
"short_text"],
"<br>"),
449 "nr" => $def_rec[
"nr"],
450 "short_text_dirty" => $def_rec[
"short_text_dirty"]);
461 $a_xml_writer->xmlStartTag(
"Definition", $attrs);
466 $a_xml_writer->xmlEndTag(
"Definition");
479 include_once(
"Services/MetaData/classes/class.ilMD2XML.php");
481 $md2xml->setExportMode(
true);
482 $md2xml->startExport();
483 $a_xml_writer->appendXML($md2xml->getXML());
491 if ($a_tag ==
"Identifier" && $a_param ==
"Entry")
493 $a_value =
"il_".IL_INST_ID.
"_gdf_".$this->
getId();
509 $this->page_object->buildDom();
510 $this->page_object->insertInstIntoIDs($a_inst);
511 $this->mobs_contained = $this->page_object->collectMediaObjects(
false);
512 include_once(
"./Services/COPage/classes/class.ilPCFileList.php");
514 $xml = $this->page_object->getXMLFromDom(
false,
false,
false,
"",
true);
515 $xml = str_replace(
"&",
"&", $xml);
516 $a_xml_writer->appendXML($xml);
518 $this->page_object->freeDom();
526 include_once
'Services/MetaData/classes/class.ilMDCreator.php';
533 $md_creator->setTitle($this->
getTitle());
534 $md_creator->setTitleLanguage(
$lang);
536 $md_creator->setDescriptionLanguage(
$lang);
537 $md_creator->setKeywordLanguage(
$lang);
538 $md_creator->setLanguage(
$lang);
540 $md_creator->create();
550 include_once(
"Services/MetaData/classes/class.ilMD.php");
551 include_once(
"Services/MetaData/classes/class.ilMDGeneral.php");
552 include_once(
"Services/MetaData/classes/class.ilMDDescription.php");
556 $md_gen = $md->getGeneral();
557 $md_gen->setTitle($this->
getTitle());
560 $md_des_ids = $md_gen->getDescriptionIds();
561 if (count($md_des_ids) > 0)
563 $md_des = $md_gen->getDescription($md_des_ids[0]);
576 include_once(
'Services/MetaData/classes/class.ilMD.php');
598 include_once
'Services/MetaData/classes/class.ilMD.php';
607 $md_gen = $md->getGeneral();
610 $this->
setTitle($md_gen->getTitle());
612 foreach($md_gen->getDescriptionIds() as
$id)
614 $md_des = $md_gen->getDescription($id);
636 $q =
"SELECT * FROM glossary_definition WHERE id = ".
637 $ilDB->quote($a_def_id,
"integer");
638 $def_set = $ilDB->query($q);
639 $def_rec = $ilDB->fetchAssoc($def_set);
641 return $def_rec[
"term_id"];
654 include_once(
"./Modules/Glossary/classes/class.ilGlossaryTerm.php");
657 foreach ($term_ids as $term_id)
659 $ilDB->manipulate(
"UPDATE glossary_definition SET ".
660 " short_text_dirty = ".$ilDB->quote(1,
"integer").
661 " WHERE term_id = ".$ilDB->quote($term_id,
"integer")
static getDefinitionList($a_term_id)
static
assignPageObject(&$a_page_object)
__construct($a_id=0)
Constructor public.
modifyExportIdentifier($a_tag, $a_param, $a_value)
updateMetaData()
update meta data entry
getTitle()
get title of content object
static shortenText($a_str, $a_len, $a_dots=false, $a_next_blank=false, $a_keep_extension=false)
shorten a string to given length.
setShortTextDirty($a_val)
Set short text dirty.
static _lookupTermId($a_def_id)
Looks up term id for a definition id.
setDescription($a_description)
Set description.
static collectFileItems($a_page, $a_domdoc)
Get all file items that are used within the page.
deleteMetaData()
delete meta data entry
setTitle($a_title)
set title of content object
exportXMLDefinition(&$a_xml_writer, $a_inst=0)
export page objects meta data to xml (see ilias_co.dtd)
redirection script todo: (a better solution should control the processing via a xml file) ...
read()
read data of content object
static _lookLanguage($term_id)
lookup term language
Glossary definition page object.
Create styles array
The data for the language used.
MDUpdateListener($a_element)
Meta data update listener.
static _lookGlossaryID($term_id)
get glossary id form term id
Class ilGlossaryDefinition.
getDescription()
Get description.
createMetaData()
create meta data entry
exportXML(&$a_xml_writer, $a_inst)
export xml
for($i=1; $i<=count($kw_cases_sel); $i+=1) $lang
fetchAssoc($query_result)
static getTermsOfGlossary($a_glo_id)
Get terms of glossary.
exportXMLMetaData(&$a_xml_writer)
export content objects meta data to xml (see ilias_co.dtd)
shortenShortText($text)
Shorten short text.
static setShortTextsDirty($a_glo_id)
Set short texts dirty.
getShortTextDirty()
Get short text dirty.
static lookupSnippetLength($a_id)
Lookup snippet length.
create($a_upload=false, $a_omit_page_creation=false)
Create definition.