Public Member Functions | |
| ilGlossaryDefinition ($a_id=0) | |
| Constructor public. | |
| read () | |
| read data of content object | |
| setId ($a_id) | |
| getId () | |
| getType () | |
| setTermId ($a_term_id) | |
| getTermId () | |
| setShortText ($a_text) | |
| getShortText () | |
| setNr ($a_nr) | |
| getNr () | |
| assignPageObject (&$a_page_object) | |
| & | getPageObject () |
| getTitle () | |
| get title of content object | |
| setTitle ($a_title) | |
| set title of content object | |
| getDescription () | |
| get description of content object | |
| setDescription ($a_description) | |
| set description of content object | |
| create ($a_upload=false) | |
| delete () | |
| moveUp () | |
| moveDown () | |
| update () | |
| updateShortText () | |
| getDefinitionList ($a_term_id) | |
| static | |
| exportXML (&$a_xml_writer, $a_inst) | |
| export xml | |
| exportXMLMetaData (&$a_xml_writer) | |
| export content objects meta data to xml (see ilias_co.dtd) | |
| modifyExportIdentifier ($a_tag, $a_param, $a_value) | |
| exportXMLDefinition (&$a_xml_writer, $a_inst=0) | |
| export page objects meta data to xml (see ilias_co.dtd) | |
| createMetaData () | |
| create meta data entry | |
| updateMetaData () | |
| update meta data entry | |
| deleteMetaData () | |
| delete meta data entry | |
| MDUpdateListener ($a_element) | |
| Meta data update listener. | |
Data Fields | |
| $ilias | |
| $lng | |
| $tpl | |
| $id | |
| $term_id | |
| $glo_id | |
| $page_object | |
| $short_text | |
| $nr | |
Definition at line 34 of file class.ilGlossaryDefinition.php.
| ilGlossaryDefinition::assignPageObject | ( | &$ | a_page_object | ) |
Definition at line 127 of file class.ilGlossaryDefinition.php.
{
$this->page_object =& $a_page_object;
}
| ilGlossaryDefinition::create | ( | $ | a_upload = false |
) |
Definition at line 173 of file class.ilGlossaryDefinition.php.
References $q, createMetaData(), getId(), getShortText(), getTermId(), ilUtil::prepareDBString(), setId(), and setNr().
{
$term =& new ilGlossaryTerm($this->getTermId());
// lock glossary_definition table
$q = "LOCK TABLES glossary_definition WRITE";
$this->ilias->db->query($q);
// get maximum definition number
$q = "SELECT max(nr) AS max_nr FROM glossary_definition WHERE term_id = '".$this->getTermId()."'";
$max_set = $this->ilias->db->query($q);
$max_rec = $max_set->fetchRow(DB_FETCHMODE_ASSOC);
$max = (int) $max_rec["max_nr"];
// insert new definition record
$q = "INSERT INTO glossary_definition (term_id, short_text, nr)".
" VALUES ('".$this->getTermId()."','".ilUtil::prepareDBString($this->getShortText())."', '".($max + 1)."')";
$this->ilias->db->query($q);
// unlock glossary definition table
$q = "UNLOCK TABLES";
$this->ilias->db->query($q);
$this->setId($this->ilias->db->getLastInsertId());
// get number
$q = "SELECT nr FROM glossary_definition WHERE id = '".$this->id."'";
$def_set = $this->ilias->db->query($q);
$def_rec = $def_set->fetchRow(DB_FETCHMODE_ASSOC);
$this->setNr($def_rec["nr"]);
// meta data will be created by
// import parser
if (!$a_upload)
{
$this->createMetaData();
}
$this->page_object =& new ilPageObject("gdf");
$this->page_object->setId($this->getId());
$this->page_object->setParentId($term->getGlossaryId());
$this->page_object->create();
}
Here is the call graph for this function:| ilGlossaryDefinition::createMetaData | ( | ) |
create meta data entry
Definition at line 452 of file class.ilGlossaryDefinition.php.
References $glo_id, $ilUser, $lang, ilGlossaryTerm::_lookGlossaryID(), ilGlossaryTerm::_lookLanguage(), getDescription(), getId(), getTermId(), getTitle(), and getType().
Referenced by create().
{
include_once 'Services/MetaData/classes/class.ilMDCreator.php';
global $ilUser;
$glo_id = ilGlossaryTerm::_lookGlossaryID($this->getTermId());
$lang = ilGlossaryTerm::_lookLanguage($this->getTermId());
$md_creator = new ilMDCreator($glo_id,$this->getId(),$this->getType());
$md_creator->setTitle($this->getTitle());
$md_creator->setTitleLanguage($lang);
$md_creator->setDescription($this->getDescription());
$md_creator->setDescriptionLanguage($lang);
$md_creator->setKeywordLanguage($lang);
$md_creator->setLanguage($lang);
$md_creator->create();
return true;
}
Here is the call graph for this function:
Here is the caller graph for this function:| ilGlossaryDefinition::delete | ( | ) |
Definition at line 217 of file class.ilGlossaryDefinition.php.
References $q, deleteMetaData(), and setNr().
{
// lock glossary_definition table
$q = "LOCK TABLES glossary_definition WRITE";
$this->ilias->db->query($q);
// be sure to get the right number
$q = "SELECT * FROM glossary_definition WHERE id = '".$this->id."'";
$def_set = $this->ilias->db->query($q);
$def_rec = $def_set->fetchRow(DB_FETCHMODE_ASSOC);
$this->setNr($def_rec["nr"]);
// update numbers of other definitions
$q = "UPDATE glossary_definition SET ".
" nr = nr - 1 ".
" WHERE term_id = '".$this->getTermId()."' ".
" AND nr > ".$this->getNr();
$this->ilias->db->query($q);
// delete current definition
$q = "DELETE FROM glossary_definition ".
" WHERE id = '".$this->getId()."' ";
$this->ilias->db->query($q);
// unlock glossary_definition table
$q = "UNLOCK TABLES";
$this->ilias->db->query($q);
// delete page and meta data
$this->page_object->delete();
// delete meta data
$this->deleteMetaData();
/*
$nested = new ilNestedSetXML();
$nested->init($this->getId(), $this->getType());
$nested->deleteAllDBData();
*/
}
Here is the call graph for this function:| ilGlossaryDefinition::deleteMetaData | ( | ) |
delete meta data entry
Definition at line 500 of file class.ilGlossaryDefinition.php.
References $glo_id, ilGlossaryTerm::_lookGlossaryID(), getId(), getTermId(), and getType().
Referenced by delete().
{
// Delete meta data
include_once('Services/MetaData/classes/class.ilMD.php');
$glo_id = ilGlossaryTerm::_lookGlossaryID($this->getTermId());
$md = new ilMD($glo_id, $this->getId(), $this->getType());
$md->deleteAll();
}
Here is the call graph for this function:
Here is the caller graph for this function:| ilGlossaryDefinition::exportXML | ( | &$ | a_xml_writer, | |
| $ | a_inst | |||
| ) |
export xml
Definition at line 387 of file class.ilGlossaryDefinition.php.
References exportXMLDefinition(), and exportXMLMetaData().
{
$attrs = array();
$a_xml_writer->xmlStartTag("Definition", $attrs);
$this->exportXMLMetaData($a_xml_writer);
$this->exportXMLDefinition($a_xml_writer, $a_inst);
$a_xml_writer->xmlEndTag("Definition");
}
Here is the call graph for this function:| ilGlossaryDefinition::exportXMLDefinition | ( | &$ | a_xml_writer, | |
| $ | a_inst = 0 | |||
| ) |
export page objects meta data to xml (see ilias_co.dtd)
| object | $a_xml_writer ilXmlWriter object that receives the xml data |
Definition at line 435 of file class.ilGlossaryDefinition.php.
References $xml.
Referenced by exportXML().
{
$this->page_object->buildDom();
$this->page_object->insertInstIntoIDs($a_inst);
$this->mobs_contained = $this->page_object->collectMediaObjects(false);
$this->files_contained = $this->page_object->collectFileItems();
$xml = $this->page_object->getXMLFromDom(false, false, false, "", true);
$xml = str_replace("&","&", $xml);
$a_xml_writer->appendXML($xml);
$this->page_object->freeDom();
}
Here is the caller graph for this function:| ilGlossaryDefinition::exportXMLMetaData | ( | &$ | a_xml_writer | ) |
export content objects meta data to xml (see ilias_co.dtd)
| object | $a_xml_writer ilXmlWriter object that receives the xml data |
Definition at line 405 of file class.ilGlossaryDefinition.php.
References $glo_id, ilGlossaryTerm::_lookGlossaryID(), getId(), getTermId(), and getType().
Referenced by exportXML().
{
$glo_id = ilGlossaryTerm::_lookGlossaryID($this->getTermId());
include_once("Services/MetaData/classes/class.ilMD2XML.php");
$md2xml = new ilMD2XML($glo_id, $this->getId(), $this->getType());
$md2xml->setExportMode(true);
$md2xml->startExport();
$a_xml_writer->appendXML($md2xml->getXML());
}
Here is the call graph for this function:
Here is the caller graph for this function:| ilGlossaryDefinition::getDefinitionList | ( | $ | a_term_id | ) |
static
Definition at line 369 of file class.ilGlossaryDefinition.php.
References $q.
Referenced by ilGlossaryTerm::delete(), ilObjGlossary::exportHTMLGlossaryTerms(), ilObjContentObject::exportHTMLGlossaryTerms(), ilObjGlossary::exportXML(), ilGlossaryTerm::exportXML(), ilGlossaryTermGUI::getInternalLinks(), ilGlossaryTermGUI::listDefinitions(), ilGlossaryPresentationGUI::listDefinitions(), ilGlossaryPresentationGUI::listTermByGiven(), ilObjGlossaryGUI::listTerms(), ilGlossaryTermGUI::output(), and ilLMPresentationGUI::showPrintView().
{
$defs = array();
$q = "SELECT * FROM glossary_definition WHERE term_id ='".$a_term_id."' ORDER BY nr";
$def_set = $this->ilias->db->query($q);
while ($def_rec = $def_set->fetchRow(DB_FETCHMODE_ASSOC))
{
$defs[] = array("term_id" => $def_rec["term_id"],
"page_id" => $def_rec["page_id"], "id" => $def_rec["id"],
"short_text" => strip_tags($def_rec["short_text"], "<br>"),
"nr" => $def_rec["nr"]);
}
return $defs;
}
Here is the caller graph for this function:| ilGlossaryDefinition::getDescription | ( | ) |
get description of content object
Definition at line 160 of file class.ilGlossaryDefinition.php.
Referenced by createMetaData(), and updateMetaData().
{
return $this->description;
}
Here is the caller graph for this function:| ilGlossaryDefinition::getId | ( | ) |
Definition at line 87 of file class.ilGlossaryDefinition.php.
Referenced by create(), createMetaData(), deleteMetaData(), exportXMLMetaData(), MDUpdateListener(), modifyExportIdentifier(), and updateMetaData().
{
return $this->id;
}
Here is the caller graph for this function:| ilGlossaryDefinition::getNr | ( | ) |
Definition at line 122 of file class.ilGlossaryDefinition.php.
Referenced by moveDown(), and moveUp().
{
return $this->nr;
}
Here is the caller graph for this function:| & ilGlossaryDefinition::getPageObject | ( | ) |
Definition at line 132 of file class.ilGlossaryDefinition.php.
{
return $this->page_object;
}
| ilGlossaryDefinition::getShortText | ( | ) |
Definition at line 112 of file class.ilGlossaryDefinition.php.
Referenced by create(), and update().
{
return $this->short_text;
}
Here is the caller graph for this function:| ilGlossaryDefinition::getTermId | ( | ) |
Definition at line 102 of file class.ilGlossaryDefinition.php.
Referenced by create(), createMetaData(), deleteMetaData(), exportXMLMetaData(), MDUpdateListener(), and updateMetaData().
{
return $this->term_id;
}
Here is the caller graph for this function:| ilGlossaryDefinition::getTitle | ( | ) |
get title of content object
Definition at line 142 of file class.ilGlossaryDefinition.php.
Referenced by createMetaData(), and updateMetaData().
{
return $this->title;
}
Here is the caller graph for this function:| ilGlossaryDefinition::getType | ( | ) |
Definition at line 92 of file class.ilGlossaryDefinition.php.
Referenced by createMetaData(), deleteMetaData(), exportXMLMetaData(), MDUpdateListener(), and updateMetaData().
{
return "gdf";
}
Here is the caller graph for this function:| ilGlossaryDefinition::ilGlossaryDefinition | ( | $ | a_id = 0 |
) |
Constructor public.
Definition at line 51 of file class.ilGlossaryDefinition.php.
References $ilias, $lng, $tpl, and read().
{
global $lng, $ilias, $tpl;
$this->lng =& $lng;
$this->ilias =& $ilias;
$this->tpl =& $tpl;
$this->id = $a_id;
if ($a_id != 0)
{
$this->read();
}
}
Here is the call graph for this function:| ilGlossaryDefinition::MDUpdateListener | ( | $ | a_element | ) |
Meta data update listener.
Important note: Do never call create() or update() method of ilObject here. It would result in an endless loop: update object -> update meta -> update object -> ... Use static _writeTitle() ... methods instead.
Even if this is not stored to db, it should be stored to the object e.g. for during import parsing
| string | $a_element |
Definition at line 523 of file class.ilGlossaryDefinition.php.
References $glo_id, $id, ilGlossaryTerm::_lookGlossaryID(), getId(), getTermId(), getType(), setDescription(), and setTitle().
{
include_once 'Services/MetaData/classes/class.ilMD.php';
switch($a_element)
{
case 'General':
// Update Title and description
$glo_id = ilGlossaryTerm::_lookGlossaryID($this->getTermId());
$md =& new ilMD($glo_id, $this->getId(), $this->getType());
$md_gen = $md->getGeneral();
//ilObject::_writeTitle($this->getId(),$md_gen->getTitle());
$this->setTitle($md_gen->getTitle());
foreach($md_gen->getDescriptionIds() as $id)
{
$md_des = $md_gen->getDescription($id);
//ilObject::_writeDescription($this->getId(),$md_des->getDescription());
$this->setDescription($md_des->getDescription());
break;
}
break;
default:
}
return true;
}
Here is the call graph for this function:| ilGlossaryDefinition::modifyExportIdentifier | ( | $ | a_tag, | |
| $ | a_param, | |||
| $ | a_value | |||
| ) |
Definition at line 418 of file class.ilGlossaryDefinition.php.
References getId().
{
if ($a_tag == "Identifier" && $a_param == "Entry")
{
$a_value = "il_".IL_INST_ID."_gdf_".$this->getId();
}
return $a_value;
}
Here is the call graph for this function:| ilGlossaryDefinition::moveDown | ( | ) |
Definition at line 298 of file class.ilGlossaryDefinition.php.
References $q, getNr(), and setNr().
{
// lock glossary_definition table
$q = "LOCK TABLES glossary_definition WRITE";
$this->ilias->db->query($q);
// be sure to get the right number
$q = "SELECT * FROM glossary_definition WHERE id = '".$this->id."'";
$def_set = $this->ilias->db->query($q);
$def_rec = $def_set->fetchRow(DB_FETCHMODE_ASSOC);
$this->setNr($def_rec["nr"]);
// get max number
$q = "SELECT max(nr) as max_nr FROM glossary_definition WHERE term_id = '".$this->getTermId()."'";
$max_set = $this->ilias->db->query($q);
$max_rec = $max_set->fetchRow(DB_FETCHMODE_ASSOC);
if ($this->getNr() >= $max_rec["max_nr"])
{
$q = "UNLOCK TABLES";
$this->ilias->db->query($q);
return;
}
// update numbers of other definitions
$q = "UPDATE glossary_definition SET ".
" nr = nr - 1 ".
" WHERE term_id = '".$this->getTermId()."' ".
" AND nr = ".($this->getNr() + 1);
$this->ilias->db->query($q);
// delete current definition
$q = "UPDATE glossary_definition SET ".
" nr = nr + 1 ".
" WHERE term_id = '".$this->getTermId()."' ".
" AND id = ".$this->getId();
$this->ilias->db->query($q);
// unlock glossary_definition table
$q = "UNLOCK TABLES";
$this->ilias->db->query($q);
}
Here is the call graph for this function:| ilGlossaryDefinition::moveUp | ( | ) |
Definition at line 258 of file class.ilGlossaryDefinition.php.
References $q, getNr(), and setNr().
{
// lock glossary_definition table
$q = "LOCK TABLES glossary_definition WRITE";
$this->ilias->db->query($q);
// be sure to get the right number
$q = "SELECT * FROM glossary_definition WHERE id = '".$this->id."'";
$def_set = $this->ilias->db->query($q);
$def_rec = $def_set->fetchRow(DB_FETCHMODE_ASSOC);
$this->setNr($def_rec["nr"]);
if ($this->getNr() < 2)
{
$q = "UNLOCK TABLES";
$this->ilias->db->query($q);
return;
}
// update numbers of other definitions
$q = "UPDATE glossary_definition SET ".
" nr = nr + 1 ".
" WHERE term_id = '".$this->getTermId()."' ".
" AND nr = ".($this->getNr() - 1);
$this->ilias->db->query($q);
// delete current definition
$q = "UPDATE glossary_definition SET ".
" nr = nr - 1 ".
" WHERE term_id = '".$this->getTermId()."' ".
" AND id = ".$this->getId();
$this->ilias->db->query($q);
// unlock glossary_definition table
$q = "UNLOCK TABLES";
$this->ilias->db->query($q);
}
Here is the call graph for this function:| ilGlossaryDefinition::read | ( | ) |
read data of content object
Definition at line 69 of file class.ilGlossaryDefinition.php.
References $q, setNr(), setShortText(), and setTermId().
Referenced by ilGlossaryDefinition().
{
$q = "SELECT * FROM glossary_definition WHERE id = '".$this->id."'";
$def_set = $this->ilias->db->query($q);
$def_rec = $def_set->fetchRow(DB_FETCHMODE_ASSOC);
$this->setTermId($def_rec["term_id"]);
$this->setShortText($def_rec["short_text"]);
$this->setNr($def_rec["nr"]);
$this->page_object =& new ilPageObject("gdf", $this->id);
}
Here is the call graph for this function:
Here is the caller graph for this function:| ilGlossaryDefinition::setDescription | ( | $ | a_description | ) |
set description of content object
Definition at line 168 of file class.ilGlossaryDefinition.php.
Referenced by MDUpdateListener().
{
$this->description = $a_description;
}
Here is the caller graph for this function:| ilGlossaryDefinition::setId | ( | $ | a_id | ) |
Definition at line 82 of file class.ilGlossaryDefinition.php.
Referenced by create().
{
$this->id = $a_id;
}
Here is the caller graph for this function:| ilGlossaryDefinition::setNr | ( | $ | a_nr | ) |
Definition at line 117 of file class.ilGlossaryDefinition.php.
Referenced by create(), delete(), moveDown(), moveUp(), and read().
{
$this->nr = $a_nr;
}
Here is the caller graph for this function:| ilGlossaryDefinition::setShortText | ( | $ | a_text | ) |
Definition at line 107 of file class.ilGlossaryDefinition.php.
Referenced by read(), and updateShortText().
{
$this->short_text = $a_text;
}
Here is the caller graph for this function:| ilGlossaryDefinition::setTermId | ( | $ | a_term_id | ) |
Definition at line 97 of file class.ilGlossaryDefinition.php.
Referenced by read().
{
$this->term_id = $a_term_id;
}
Here is the caller graph for this function:| ilGlossaryDefinition::setTitle | ( | $ | a_title | ) |
set title of content object
Definition at line 150 of file class.ilGlossaryDefinition.php.
Referenced by MDUpdateListener().
{
$this->title = $a_title;
}
Here is the caller graph for this function:| ilGlossaryDefinition::update | ( | ) |
Definition at line 343 of file class.ilGlossaryDefinition.php.
References $q, getShortText(), and updateMetaData().
Referenced by updateShortText().
{
$this->updateMetaData();
$q = "UPDATE glossary_definition SET ".
" term_id = '".$this->getTermId()."', ".
" nr = '".$this->getNr()."', ".
" short_text = '".ilUtil::prepareDBString($this->getShortText())."' ".
" WHERE id = '".$this->getId()."'";
$this->ilias->db->query($q);
}
Here is the call graph for this function:
Here is the caller graph for this function:| ilGlossaryDefinition::updateMetaData | ( | ) |
update meta data entry
Definition at line 475 of file class.ilGlossaryDefinition.php.
References $glo_id, ilGlossaryTerm::_lookGlossaryID(), getDescription(), getId(), getTermId(), getTitle(), and getType().
Referenced by update().
{
include_once("Services/MetaData/classes/class.ilMD.php");
include_once("Services/MetaData/classes/class.ilMDGeneral.php");
include_once("Services/MetaData/classes/class.ilMDDescription.php");
$glo_id = ilGlossaryTerm::_lookGlossaryID($this->getTermId());
$md =& new ilMD($glo_id, $this->getId(), $this->getType());
$md_gen =& $md->getGeneral();
$md_gen->setTitle($this->getTitle());
// sets first description (maybe not appropriate)
$md_des_ids =& $md_gen->getDescriptionIds();
if (count($md_des_ids) > 0)
{
$md_des =& $md_gen->getDescription($md_des_ids[0]);
$md_des->setDescription($this->getDescription());
$md_des->update();
}
$md_gen->update();
}
Here is the call graph for this function:
Here is the caller graph for this function:| ilGlossaryDefinition::updateShortText | ( | ) |
Definition at line 355 of file class.ilGlossaryDefinition.php.
References setShortText(), ilUtil::shortenText(), and update().
{
$this->page_object->buildDom();
$text = $this->page_object->getFirstParagraphText();
//$this->setShortText(ilUtil::shortenText($text, 180, true));
$text = str_replace("<br/>", "<br>", $text);
$this->setShortText(ilUtil::shortenText(strip_tags($text, "<br>"), 180, true));
$this->update();
}
Here is the call graph for this function:| ilGlossaryDefinition::$glo_id |
Definition at line 42 of file class.ilGlossaryDefinition.php.
Referenced by createMetaData(), deleteMetaData(), exportXMLMetaData(), MDUpdateListener(), and updateMetaData().
| ilGlossaryDefinition::$id |
Definition at line 40 of file class.ilGlossaryDefinition.php.
Referenced by MDUpdateListener().
| ilGlossaryDefinition::$ilias |
Definition at line 36 of file class.ilGlossaryDefinition.php.
Referenced by ilGlossaryDefinition().
| ilGlossaryDefinition::$lng |
Definition at line 37 of file class.ilGlossaryDefinition.php.
Referenced by ilGlossaryDefinition().
| ilGlossaryDefinition::$nr |
Definition at line 45 of file class.ilGlossaryDefinition.php.
| ilGlossaryDefinition::$page_object |
Definition at line 43 of file class.ilGlossaryDefinition.php.
| ilGlossaryDefinition::$short_text |
Definition at line 44 of file class.ilGlossaryDefinition.php.
| ilGlossaryDefinition::$term_id |
Definition at line 41 of file class.ilGlossaryDefinition.php.
| ilGlossaryDefinition::$tpl |
Definition at line 38 of file class.ilGlossaryDefinition.php.
Referenced by ilGlossaryDefinition().
1.7.1