ILIAS  Release_4_1_x_branch Revision 61804
 All Data Structures Namespaces Files Functions Variables Groups Pages
ilGlossaryTerm Class Reference

Class ilGlossaryTerm. More...

+ Collaboration diagram for ilGlossaryTerm:

Public Member Functions

 ilGlossaryTerm ($a_id=0)
 Constructor public.
 read ()
 read glossary term data
 _getIdForImportId ($a_import_id)
 get current term id for import id (static)
 _exists ($a_id)
 checks wether a glossary term with specified id exists or not
 setId ($a_id)
 set glossary term id (= glossary item id)
 getId ()
 get term id (= glossary item id)
 setGlossary (&$a_glossary)
 set glossary object
 setGlossaryId ($a_glo_id)
 set glossary id
 getGlossaryId ()
 get glossary id
 setTerm ($a_term)
 set term
 getTerm ()
 get term
 setLanguage ($a_language)
 set language
 getLanguage ()
 get language
 setImportId ($a_import_id)
 set import id
 getImportId ()
 get import id
 create ()
 create new glossary term
 delete ()
 delete glossary term (and all its definition objects)
 update ()
 update glossary term
 _lookGlossaryID ($term_id)
 get glossary id form term id
 _lookGlossaryTerm ($term_id)
 get glossary term
 _lookLanguage ($term_id)
 lookup term language
 exportXML (&$a_xml_writer, $a_inst)
 export xml
 _copyTerm ($a_term_id, $a_glossary_id)
 Copy a term to a glossary.

Static Public Member Functions

static getTermList ($a_glo_id, $searchterm="", $a_first_letter="", $a_def="")
 Get all terms for given set of glossary ids.
static getFirstLetters ($a_glo_id)
 Get all terms for given set of glossary ids.
static getNumberOfUsages ($a_term_id)
 Get number of usages.
static getUsages ($a_term_id)
 Get number of usages.
static getTermsOfGlossary ($a_glo_id)
 Get terms of glossary.

Data Fields

 $ilias
 $lng
 $tpl
 $id
 $glossary
 $term
 $language
 $glo_id
 $import_id

Detailed Description

Class ilGlossaryTerm.

Author
Alex Killing alex..nosp@m.kill.nosp@m.ing@g.nosp@m.mx.d.nosp@m.e
Version
Id:
class.ilGlossaryTerm.php 23895 2010-05-18 15:38:10Z akill

Definition at line 12 of file class.ilGlossaryTerm.php.

Member Function Documentation

ilGlossaryTerm::_copyTerm (   $a_term_id,
  $a_glossary_id 
)

Copy a term to a glossary.

Parameters
@return

Definition at line 489 of file class.ilGlossaryTerm.php.

References ilMD\cloneMD(), ilGlossaryDefinition\getDefinitionList(), and ilGlossaryTerm().

Referenced by ilSCORM2004Page\performAutomaticModifications().

{
$old_term = new ilGlossaryTerm($a_term_id);
// copy the term
$new_term = new ilGlossaryTerm();
$new_term->setTerm($old_term->getTerm());
$new_term->setLanguage($old_term->getLanguage());
$new_term->setGlossaryId($a_glossary_id);
$new_term->create();
// copy the definitions
include_once("./Modules/Glossary/classes/class.ilGlossaryDefinition.php");
$def_list = ilGlossaryDefinition::getDefinitionList($a_term_id);
foreach ($def_list as $def)
{
$old_def = new ilGlossaryDefinition($def["id"]);
$new_def = new ilGlossaryDefinition();
$new_def->setShortText($old_def->getShortText());
$new_def->setNr($old_def->getNr());
$new_def->setTermId($new_term->getId());
$new_def->create();
// copy meta data
include_once("Services/MetaData/classes/class.ilMD.php");
$md = new ilMD($old_term->getGlossaryId(),
$old_def->getPageObject()->getId(),
$old_def->getPageObject()->getParentType());
$new_md = $md->cloneMD($a_glossary_id,
$new_def->getPageObject()->getId(),
$old_def->getPageObject()->getParentType());
// page content
$new_def->getPageObject()->setXMLContent($old_def->getPageObject()->getXMLContent());
$new_def->getPageObject()->buildDom();
$new_def->getPageObject()->update();
}
return $new_term->getId();
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilGlossaryTerm::_exists (   $a_id)

checks wether a glossary term with specified id exists or not

Parameters
int$idid
Returns
boolean true, if glossary term exists

Definition at line 105 of file class.ilGlossaryTerm.php.

References $ilDB, and ilInternalLink\_extractObjIdOfTarget().

Referenced by ilLinksTableGUI\fillRow().

{
global $ilDB;
include_once("./Services/COPage/classes/class.ilInternalLink.php");
if (is_int(strpos($a_id, "_")))
{
}
$q = "SELECT * FROM glossary_term WHERE id = ".
$ilDB->quote($a_id, "integer");
$obj_set = $ilDB->query($q);
if ($obj_rec = $ilDB->fetchAssoc($obj_set))
{
return true;
}
else
{
return false;
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilGlossaryTerm::_getIdForImportId (   $a_import_id)

get current term id for import id (static)

Parameters
int$a_import_idimport id
Returns
int id

Definition at line 71 of file class.ilGlossaryTerm.php.

References $glo_id, $ilDB, ilObject\_hasUntrashedReference(), and _lookGlossaryID().

{
global $ilDB;
if ($a_import_id == "")
{
return 0;
}
$q = "SELECT * FROM glossary_term WHERE import_id = ".
$ilDB->quote($a_import_id, "text").
" ORDER BY create_date DESC";
$term_set = $ilDB->query($q);
while ($term_rec = $ilDB->fetchAssoc($term_set))
{
{
return $term_rec["id"];
}
}
return 0;
}

+ Here is the call graph for this function:

ilGlossaryTerm::_lookGlossaryID (   $term_id)

get glossary id form term id

Definition at line 303 of file class.ilGlossaryTerm.php.

References $ilDB, and $query.

Referenced by ilObjGlossaryAccess\_checkGoto(), _getIdForImportId(), ilGlossaryTermGUI\_goto(), ilGlossaryDefinition\createMetaData(), ilGlossaryDefinition\deleteMetaData(), ilGlossaryDefinition\exportXMLMetaData(), ilGlossaryPresentationGUI\getLinkXML(), ilObjMediaObject\getParentObjectIdForUsage(), ilGlossaryDefinition\MDUpdateListener(), ilSCORM2004Page\performAutomaticModifications(), and ilGlossaryDefinition\updateMetaData().

{
global $ilDB;
$query = "SELECT * FROM glossary_term WHERE id = ".
$ilDB->quote($term_id, "integer");
$obj_set = $ilDB->query($query);
$obj_rec = $ilDB->fetchAssoc($obj_set);
return $obj_rec["glo_id"];
}

+ Here is the caller graph for this function:

ilGlossaryTerm::_lookGlossaryTerm (   $term_id)

get glossary term

Definition at line 318 of file class.ilGlossaryTerm.php.

References $ilDB, and $query.

Referenced by ilShopResultPresentationGUI\__appendChildLinks(), SurveyQuestion\addInternalLink(), ilTermUsagesTableGUI\fillRow(), ilLinksTableGUI\fillRow(), ilMediaObjectUsagesTableGUI\fillRow(), ilMediaPoolPageUsagesTableGUI\fillRow(), ilSCORM2004Sco\getGlossaryTermIds(), ilObjGlossarySubItemListGUI\getHTML(), ilObjGlossaryGUI\getTemplate(), SurveyQuestion\setMaterial(), and ilLMPresentationGUI\showPrintView().

{
global $ilDB;
$query = "SELECT * FROM glossary_term WHERE id = ".
$ilDB->quote($term_id, "integer");
$obj_set = $ilDB->query($query);
$obj_rec = $ilDB->fetchAssoc($obj_set);
return $obj_rec["term"];
}

+ Here is the caller graph for this function:

ilGlossaryTerm::_lookLanguage (   $term_id)

lookup term language

Definition at line 333 of file class.ilGlossaryTerm.php.

References $ilDB, and $query.

Referenced by ilGlossaryDefinition\createMetaData().

{
global $ilDB;
$query = "SELECT * FROM glossary_term WHERE id = ".
$ilDB->quote($term_id, "integer");
$obj_set = $ilDB->query($query);
$obj_rec = $ilDB->fetchAssoc($obj_set);
return $obj_rec["language"];
}

+ Here is the caller graph for this function:

ilGlossaryTerm::create ( )

create new glossary term

Definition at line 248 of file class.ilGlossaryTerm.php.

References $ilDB, getImportId(), and setId().

{
global $ilDB;
$this->setId($ilDB->nextId("glossary_term"));
$ilDB->manipulate("INSERT INTO glossary_term (id, glo_id, term, language, import_id, create_date, last_update)".
" VALUES (".
$ilDB->quote($this->getId(), "integer").", ".
$ilDB->quote($this->getGlossaryId(), "integer").", ".
$ilDB->quote($this->term, "text").", ".
$ilDB->quote($this->language, "text").",".
$ilDB->quote($this->getImportId(), "text").",".
$ilDB->now().", ".
$ilDB->now().")");
}

+ Here is the call graph for this function:

ilGlossaryTerm::delete ( )

delete glossary term (and all its definition objects)

Definition at line 268 of file class.ilGlossaryTerm.php.

References $ilDB, ilGlossaryDefinition\getDefinitionList(), and getId().

{
global $ilDB;
require_once("./Modules/Glossary/classes/class.ilGlossaryDefinition.php");
foreach($defs as $def)
{
$def_obj =& new ilGlossaryDefinition($def["id"]);
$def_obj->delete();
}
$ilDB->manipulate("DELETE FROM glossary_term ".
" WHERE id = ".$ilDB->quote($this->getId(), "integer"));
}

+ Here is the call graph for this function:

ilGlossaryTerm::exportXML ( $a_xml_writer,
  $a_inst 
)

export xml

Definition at line 438 of file class.ilGlossaryTerm.php.

References ilGlossaryDefinition\getDefinitionList(), getId(), getLanguage(), and getTerm().

{
$attrs = array();
$attrs["Language"] = $this->getLanguage();
$attrs["Id"] = "il_".IL_INST_ID."_git_".$this->getId();
$a_xml_writer->xmlStartTag("GlossaryItem", $attrs);
$attrs = array();
$a_xml_writer->xmlElement("GlossaryTerm", $attrs, $this->getTerm());
foreach($defs as $def)
{
$definition = new ilGlossaryDefinition($def["id"]);
$definition->exportXML($a_xml_writer, $a_inst);
}
$a_xml_writer->xmlEndTag("GlossaryItem");
}

+ Here is the call graph for this function:

static ilGlossaryTerm::getFirstLetters (   $a_glo_id)
static

Get all terms for given set of glossary ids.

Parameters
integer/arrayarray of glossary ids for meta glossaries
stringsearchstring
stringfirst letter
Returns
array array of terms

Definition at line 408 of file class.ilGlossaryTerm.php.

References $ilDB.

{
global $ilDB;
$terms = array();
// meta glossary
if (is_array($a_glo_id))
{
$where = $ilDB->in("glo_id", $a_glo_id, false, "integer");
}
else
{
$where = " glo_id = ".$ilDB->quote($a_glo_id, "integer")." ";
}
$q = "SELECT DISTINCT ".$ilDB->upper($ilDB->substr("term", 1, 1))." let FROM glossary_term WHERE ".$where." ORDER BY let";
$let_set = $ilDB->query($q);
$lets = array();
while ($let_rec = $ilDB->fetchAssoc($let_set))
{
$let[$let_rec["let"]] = $let_rec["let"];
}
return $let;
}
ilGlossaryTerm::getGlossaryId ( )

get glossary id

Returns
int glossary id

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

References $glo_id.

{
return $this->glo_id;
}
ilGlossaryTerm::getId ( )

get term id (= glossary item id)

Returns
int glossary term id

Definition at line 146 of file class.ilGlossaryTerm.php.

References $id.

Referenced by delete(), exportXML(), and update().

{
return $this->id;
}

+ Here is the caller graph for this function:

ilGlossaryTerm::getImportId ( )

get import id

Definition at line 239 of file class.ilGlossaryTerm.php.

References $import_id.

Referenced by create().

{
}

+ Here is the caller graph for this function:

ilGlossaryTerm::getLanguage ( )

get language

Returns
string two letter language code

Definition at line 221 of file class.ilGlossaryTerm.php.

References $language.

Referenced by exportXML().

{
}

+ Here is the caller graph for this function:

static ilGlossaryTerm::getNumberOfUsages (   $a_term_id)
static

Get number of usages.

Parameters
intterm id
Returns
int number of usages

Definition at line 466 of file class.ilGlossaryTerm.php.

References getUsages().

Referenced by ilObjGlossaryGUI\confirmDefinitionDeletion(), ilObjGlossaryGUI\confirmTermDeletion(), ilTermDefinitionEditorGUI\executeCommand(), ilTermListTableGUI\fillRow(), and ilGlossaryTermGUI\getTabs().

{
return count(ilGlossaryTerm::getUsages($a_term_id));
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilGlossaryTerm::getTerm ( )

get term

Returns
string term

Definition at line 201 of file class.ilGlossaryTerm.php.

References $term.

Referenced by exportXML().

{
return $this->term;
}

+ Here is the caller graph for this function:

static ilGlossaryTerm::getTermList (   $a_glo_id,
  $searchterm = "",
  $a_first_letter = "",
  $a_def = "" 
)
static

Get all terms for given set of glossary ids.

Parameters
integer/arrayarray of glossary ids for meta glossaries
stringsearchstring
stringfirst letter
Returns
array array of terms

Definition at line 353 of file class.ilGlossaryTerm.php.

References $ilDB.

{
global $ilDB;
$terms = array();
if ($a_def != "")
{
$join = " JOIN glossary_definition gd ON (gd.term_id = gt.id)".
" JOIN page_object ON (".
"page_object.parent_id = ".$ilDB->quote($a_glo_id, "integer").
" AND page_object.parent_type = ".$ilDB->quote("gdf", "text").
" AND page_object.page_id = gd.id".
" AND ".$ilDB->like("page_object.content", "text", "%".$a_def."%").
")";
}
$searchterm = (!empty ($searchterm))
? " AND ".$ilDB->like("term", "text", "%".$searchterm."%")." "
: "";
if ($a_first_letter != "")
{
$searchterm.= " AND ".$ilDB->upper($ilDB->substr("term", 1, 1))." = ".$ilDB->upper($ilDB->quote($a_first_letter, "text"))." ";
}
// meta glossary
if (is_array($a_glo_id))
{
$where = $ilDB->in("glo_id", $a_glo_id, false, "integer");
}
else
{
$where = " glo_id = ".$ilDB->quote($a_glo_id, "integer")." ";
}
$q = "SELECT gt.term, gt.id, gt.glo_id, gt.language FROM glossary_term gt ".$join." WHERE ".$where.$searchterm." ORDER BY term";
$term_set = $ilDB->query($q);
//var_dump($q);
while ($term_rec = $ilDB->fetchAssoc($term_set))
{
$terms[] = array("term" => $term_rec["term"],
"language" => $term_rec["language"], "id" => $term_rec["id"], "glo_id" => $term_rec["glo_id"]);
}
return $terms;
}
static ilGlossaryTerm::getTermsOfGlossary (   $a_glo_id)
static

Get terms of glossary.

Parameters
@return

Definition at line 538 of file class.ilGlossaryTerm.php.

References $ilDB.

Referenced by ilGlossaryDefinition\setShortTextsDirty().

{
global $ilDB;
$set = $ilDB->query("SELECT id FROM glossary_term WHERE ".
" glo_id = ".$ilDB->quote($a_glo_id, "integer")
);
$ids = array();
while ($rec = $ilDB->fetchAssoc($set))
{
$ids[] = $rec["id"];
}
return $ids;
}

+ Here is the caller graph for this function:

static ilGlossaryTerm::getUsages (   $a_term_id)
static

Get number of usages.

Parameters
intterm id
Returns
int number of usages

Definition at line 477 of file class.ilGlossaryTerm.php.

References ilInternalLink\_getSourcesOfTarget().

Referenced by ilTermUsagesTableGUI\getItems(), and getNumberOfUsages().

{
include_once("./Services/COPage/classes/class.ilInternalLink.php");
return (ilInternalLink::_getSourcesOfTarget("git", $a_term_id, 0));
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilGlossaryTerm::ilGlossaryTerm (   $a_id = 0)

Constructor public.

Definition at line 29 of file class.ilGlossaryTerm.php.

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

Referenced by _copyTerm().

{
global $lng, $ilias, $tpl;
$this->lng =& $lng;
$this->ilias =& $ilias;
$this->tpl =& $tpl;
$this->id = $a_id;
$this->type = "term";
if ($a_id != 0)
{
$this->read();
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilGlossaryTerm::read ( )

read glossary term data

Definition at line 48 of file class.ilGlossaryTerm.php.

References $ilDB, setGlossaryId(), setImportId(), setLanguage(), and setTerm().

Referenced by ilGlossaryTerm().

{
global $ilDB;
$q = "SELECT * FROM glossary_term WHERE id = ".
$ilDB->quote($this->id, "integer");
$term_set = $ilDB->query($q);
$term_rec = $ilDB->fetchAssoc($term_set);
$this->setTerm($term_rec["term"]);
$this->setImportId($term_rec["import_id"]);
$this->setLanguage($term_rec["language"]);
$this->setGlossaryId($term_rec["glo_id"]);
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilGlossaryTerm::setGlossary ( $a_glossary)

set glossary object

Parameters
object$a_glossaryglossary object

Definition at line 156 of file class.ilGlossaryTerm.php.

References setGlossaryId().

{
$this->glossary =& $a_glossary;
$this->setGlossaryId($a_glossary->getId());
}

+ Here is the call graph for this function:

ilGlossaryTerm::setGlossaryId (   $a_glo_id)

set glossary id

Parameters
int$a_glo_idglossary id

Definition at line 168 of file class.ilGlossaryTerm.php.

Referenced by read(), and setGlossary().

{
$this->glo_id = $a_glo_id;
}

+ Here is the caller graph for this function:

ilGlossaryTerm::setId (   $a_id)

set glossary term id (= glossary item id)

Parameters
int$a_idglossary term id

Definition at line 135 of file class.ilGlossaryTerm.php.

Referenced by create().

{
$this->id = $a_id;
}

+ Here is the caller graph for this function:

ilGlossaryTerm::setImportId (   $a_import_id)

set import id

Definition at line 230 of file class.ilGlossaryTerm.php.

Referenced by read().

{
$this->import_id = $a_import_id;
}

+ Here is the caller graph for this function:

ilGlossaryTerm::setLanguage (   $a_language)

set language

Parameters
string$a_languagetwo letter language code

Definition at line 212 of file class.ilGlossaryTerm.php.

Referenced by read().

{
$this->language = $a_language;
}

+ Here is the caller graph for this function:

ilGlossaryTerm::setTerm (   $a_term)

set term

Parameters
string$a_termterm

Definition at line 190 of file class.ilGlossaryTerm.php.

Referenced by read().

{
$this->term = $a_term;
}

+ Here is the caller graph for this function:

ilGlossaryTerm::update ( )

update glossary term

Definition at line 287 of file class.ilGlossaryTerm.php.

References $ilDB, and getId().

{
global $ilDB;
$ilDB->manipulate("UPDATE glossary_term SET ".
" glo_id = ".$ilDB->quote($this->getGlossaryId(), "integer").", ".
" term = ".$ilDB->quote($this->getTerm(), "text").", ".
" import_id = ".$ilDB->quote($this->getImportId(), "text").", ".
" language = ".$ilDB->quote($this->getLanguage(), "text").", ".
" last_update = ".$ilDB->now()." ".
" WHERE id = ".$ilDB->quote($this->getId(), "integer"));
}

+ Here is the call graph for this function:

Field Documentation

ilGlossaryTerm::$glo_id

Definition at line 22 of file class.ilGlossaryTerm.php.

Referenced by _getIdForImportId(), and getGlossaryId().

ilGlossaryTerm::$glossary

Definition at line 19 of file class.ilGlossaryTerm.php.

ilGlossaryTerm::$id

Definition at line 18 of file class.ilGlossaryTerm.php.

Referenced by getId().

ilGlossaryTerm::$ilias

Definition at line 14 of file class.ilGlossaryTerm.php.

Referenced by ilGlossaryTerm().

ilGlossaryTerm::$import_id

Definition at line 23 of file class.ilGlossaryTerm.php.

Referenced by getImportId().

ilGlossaryTerm::$language

Definition at line 21 of file class.ilGlossaryTerm.php.

Referenced by getLanguage().

ilGlossaryTerm::$lng

Definition at line 15 of file class.ilGlossaryTerm.php.

Referenced by ilGlossaryTerm().

ilGlossaryTerm::$term

Definition at line 20 of file class.ilGlossaryTerm.php.

Referenced by getTerm().

ilGlossaryTerm::$tpl

Definition at line 16 of file class.ilGlossaryTerm.php.

Referenced by ilGlossaryTerm().


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