Public Member Functions | Data Fields

ilGlossaryDefinition Class Reference

Public Member Functions

 ilGlossaryDefinition ($a_id=0)
 Constructor public.
 read ()
 read data of content object
 setId ($a_id)
 getId ()
 assignMetaData (&$a_meta_data)
getMetaData ()
 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 ()
 delete ()
 moveUp ()
 moveDown ()
 update ()
 updateMetaData ()
 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)

Data Fields

 $ilias
 $lng
 $tpl
 $id
 $term_id
 $glo_id
 $meta_data
 $page_object
 $short_text
 $nr

Detailed Description

Definition at line 34 of file class.ilGlossaryDefinition.php.


Member Function Documentation

ilGlossaryDefinition::assignMetaData ( &$  a_meta_data  ) 

Definition at line 99 of file class.ilGlossaryDefinition.php.

Referenced by ilGlossaryDefinition().

        {
                $this->meta_data =& $a_meta_data;
        }

Here is the caller graph for this function:

ilGlossaryDefinition::assignPageObject ( &$  a_page_object  ) 

Definition at line 144 of file class.ilGlossaryDefinition.php.

        {
                $this->page_object =& $a_page_object;
        }

ilGlossaryDefinition::create (  ) 

Definition at line 194 of file class.ilGlossaryDefinition.php.

References $q, getDescription(), getId(), getShortText(), getTermId(), getTitle(), getType(), 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"]);

                $this->meta_data->setId($this->getId());
                $this->meta_data->setType($this->getType());
                $this->meta_data->setTitle($this->getTitle());
                $this->meta_data->setDescription($this->getDescription());
                $this->meta_data->setObject($this);
                $this->meta_data->create();

                //$this->meta_data->setId($this->getId());
                //$this->meta_data->setType($this->getType());
                //$this->meta_data->create();
                $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::delete (  ) 

Definition at line 241 of file class.ilGlossaryDefinition.php.

References $q, getId(), getType(), 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
                $nested = new ilNestedSetXML();
                $nested->init($this->getId(), $this->getType());
                $nested->deleteAllDBData();

        }

Here is the call graph for this function:

ilGlossaryDefinition::exportXML ( &$  a_xml_writer,
a_inst 
)

export xml

Definition at line 414 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)

Parameters:
object $a_xml_writer ilXmlWriter object that receives the xml data

Definition at line 461 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)

Parameters:
object $a_xml_writer ilXmlWriter object that receives the xml data

Definition at line 432 of file class.ilGlossaryDefinition.php.

References getType().

Referenced by exportXML().

        {
                $nested = new ilNestedSetXML();
                $nested->setParameterModifier($this, "modifyExportIdentifier");
                $a_xml_writer->appendXML($nested->export($this->getId(),
                        $this->getType()));
        }

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 396 of file class.ilGlossaryDefinition.php.

References $q.

Referenced by ilGlossaryTerm::delete(), 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

Returns:
string description

Definition at line 179 of file class.ilGlossaryDefinition.php.

Referenced by create().

        {
//              return parent::getDescription();
                return $this->meta_data->getDescription();
        }

Here is the caller graph for this function:

ilGlossaryDefinition::getId (  ) 

Definition at line 94 of file class.ilGlossaryDefinition.php.

Referenced by create(), delete(), and modifyExportIdentifier().

        {
                return $this->id;
        }

Here is the caller graph for this function:

& ilGlossaryDefinition::getMetaData (  ) 

Definition at line 104 of file class.ilGlossaryDefinition.php.

        {
                return $this->meta_data;
        }

ilGlossaryDefinition::getNr (  ) 

Definition at line 139 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 149 of file class.ilGlossaryDefinition.php.

        {
                return $this->page_object;
        }

ilGlossaryDefinition::getShortText (  ) 

Definition at line 129 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 119 of file class.ilGlossaryDefinition.php.

Referenced by create().

        {
                return $this->term_id;
        }

Here is the caller graph for this function:

ilGlossaryDefinition::getTitle (  ) 

get title of content object

Returns:
string title

Definition at line 159 of file class.ilGlossaryDefinition.php.

Referenced by create().

        {
//              return parent::getTitle();
                return $this->meta_data->getTitle();
        }

Here is the caller graph for this function:

ilGlossaryDefinition::getType (  ) 

Definition at line 109 of file class.ilGlossaryDefinition.php.

Referenced by create(), delete(), and exportXMLMetaData().

        {
                return "gdf";
        }

Here is the caller graph for this function:

ilGlossaryDefinition::ilGlossaryDefinition ( a_id = 0  ) 

Constructor public.

Definition at line 52 of file class.ilGlossaryDefinition.php.

References $ilias, $lng, $tpl, assignMetaData(), and read().

        {
                global $lng, $ilias, $tpl;

                $this->lng =& $lng;
                $this->ilias =& $ilias;
                $this->tpl =& $tpl;

                $this->id = $a_id;
                if ($a_id == 0)
                {
                        $new_meta =& new ilMetaData();
                        $this->assignMetaData($new_meta);
                }
                else
                {
                        $this->read();
                }
        }

Here is the call graph for this function:

ilGlossaryDefinition::modifyExportIdentifier ( a_tag,
a_param,
a_value 
)

Definition at line 444 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 320 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 280 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 75 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);
                $this->meta_data =& new ilMetaData("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 188 of file class.ilGlossaryDefinition.php.

Referenced by updateMetaData().

        {
//              parent::setTitle($a_title);
                $this->meta_data->setDescription($a_description);
        }

Here is the caller graph for this function:

ilGlossaryDefinition::setId ( a_id  ) 

Definition at line 89 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 134 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 124 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 114 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 168 of file class.ilGlossaryDefinition.php.

Referenced by updateMetaData().

        {
//              parent::setTitle($a_title);
                $this->meta_data->setTitle($a_title);
        }

Here is the caller graph for this function:

ilGlossaryDefinition::update (  ) 

Definition at line 365 of file class.ilGlossaryDefinition.php.

References $q, and getShortText().

Referenced by updateShortText().

        {
                $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 (  ) 

Definition at line 375 of file class.ilGlossaryDefinition.php.

References setDescription(), and setTitle().

        {
                $this->meta_data->update();
                $this->setTitle($this->meta_data->getTitle());
                $this->setDescription($this->meta_data->getDescription());
        }

Here is the call graph for this function:

ilGlossaryDefinition::updateShortText (  ) 

Definition at line 382 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:


Field Documentation

ilGlossaryDefinition::$glo_id

Definition at line 42 of file class.ilGlossaryDefinition.php.

ilGlossaryDefinition::$id

Definition at line 40 of file class.ilGlossaryDefinition.php.

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::$meta_data

Definition at line 43 of file class.ilGlossaryDefinition.php.

ilGlossaryDefinition::$nr

Definition at line 46 of file class.ilGlossaryDefinition.php.

ilGlossaryDefinition::$page_object

Definition at line 44 of file class.ilGlossaryDefinition.php.

ilGlossaryDefinition::$short_text

Definition at line 45 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().


The documentation for this class was generated from the following file: