ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
ilGlossaryTerm Class Reference

Class ilGlossaryTerm. More...

+ Collaboration diagram for ilGlossaryTerm:

Public Member Functions

 __construct ($a_id=0)
 Constructor @access public. More...
 
 read ()
 read glossary term data More...
 
 setId ($a_id)
 set glossary term id (= glossary item id) More...
 
 getId ()
 get term id (= glossary item id) More...
 
 setGlossary (&$a_glossary)
 set glossary object More...
 
 setGlossaryId ($a_glo_id)
 set glossary id More...
 
 getGlossaryId ()
 get glossary id More...
 
 setTerm ($a_term)
 set term More...
 
 getTerm ()
 get term More...
 
 setLanguage ($a_language)
 set language More...
 
 getLanguage ()
 get language More...
 
 setImportId ($a_import_id)
 set import id More...
 
 getImportId ()
 get import id More...
 
 create ()
 create new glossary term More...
 
 delete ()
 delete glossary term (and all its definition objects) More...
 
 update ()
 update glossary term More...
 
 exportXML (&$a_xml_writer, $a_inst)
 export xml More...
 

Static Public Member Functions

static _getIdForImportId ($a_import_id)
 get current term id for import id (static) More...
 
static _exists ($a_id)
 checks wether a glossary term with specified id exists or not More...
 
static _lookGlossaryID ($term_id)
 get glossary id form term id More...
 
static _lookGlossaryTerm ($term_id)
 get glossary term More...
 
static _lookLanguage ($term_id)
 lookup term language More...
 
static getTermList ($a_glo_id, $searchterm="", $a_first_letter="", $a_def="", $a_tax_node=0, $a_add_amet_fields=false, array $a_amet_filter=null, $a_include_references=false)
 Get all terms for given set of glossary ids. More...
 
static getFirstLetters ($a_glo_id, $a_tax_node=0)
 Get all terms for given set of glossary ids. More...
 
static getNumberOfUsages ($a_term_id)
 Get number of usages. More...
 
static getUsages ($a_term_id)
 Get number of usages. More...
 
static _copyTerm ($a_term_id, $a_glossary_id)
 Copy a term to a glossary. More...
 
static getTermsOfGlossary ($a_glo_id)
 Get terms of glossary. More...
 

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$

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

Constructor & Destructor Documentation

◆ __construct()

ilGlossaryTerm::__construct (   $a_id = 0)

Constructor @access public.

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

30 {
31 global $lng, $ilias, $tpl;
32
33 $this->lng = $lng;
34 $this->ilias = $ilias;
35 $this->tpl = $tpl;
36
37 $this->id = $a_id;
38 $this->type = "term";
39 if ($a_id != 0)
40 {
41 $this->read();
42 }
43 }
read()
read glossary term data
redirection script todo: (a better solution should control the processing via a xml file)

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

+ Here is the call graph for this function:

Member Function Documentation

◆ _copyTerm()

static ilGlossaryTerm::_copyTerm (   $a_term_id,
  $a_glossary_id 
)
static

Copy a term to a glossary.

Parameters

return

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

587 {
588 $old_term = new ilGlossaryTerm($a_term_id);
589
590 // copy the term
591 $new_term = new ilGlossaryTerm();
592 $new_term->setTerm($old_term->getTerm());
593 $new_term->setLanguage($old_term->getLanguage());
594 $new_term->setGlossaryId($a_glossary_id);
595 $new_term->create();
596
597 // copy the definitions
598 include_once("./Modules/Glossary/classes/class.ilGlossaryDefinition.php");
599 $def_list = ilGlossaryDefinition::getDefinitionList($a_term_id);
600 foreach ($def_list as $def)
601 {
602 $old_def = new ilGlossaryDefinition($def["id"]);
603
604 $new_def = new ilGlossaryDefinition();
605 $new_def->setShortText($old_def->getShortText());
606 $new_def->setNr($old_def->getNr());
607 $new_def->setTermId($new_term->getId());
608 $new_def->create();
609
610 // copy meta data
611 include_once("Services/MetaData/classes/class.ilMD.php");
612 $md = new ilMD($old_term->getGlossaryId(),
613 $old_def->getPageObject()->getId(),
614 $old_def->getPageObject()->getParentType());
615 $new_md = $md->cloneMD($a_glossary_id,
616 $new_def->getPageObject()->getId(),
617 $old_def->getPageObject()->getParentType());
618
619
620 $new_page = $new_def->getPageObject();
621 $old_def->getPageObject()->copy($new_page->getId(), $new_page->getParentType(), $new_page->getParentId(), true);
622
623 // page content
624 //$new_def->getPageObject()->setXMLContent($old_def->getPageObject()->copyXmlContent(true));
625 //$new_def->getPageObject()->buildDom();
626 //$new_def->getPageObject()->update();
627
628 }
629
630 // adv metadata
631 include_once('Services/AdvancedMetaData/classes/class.ilAdvancedMDRecord.php');
632 include_once('Services/AdvancedMetaData/classes/class.ilAdvancedMDFieldDefinition.php');
633 $old_recs = ilAdvancedMDRecord::_getSelectedRecordsByObject("glo", $old_term->getGlossaryId(), "term");
634 $new_recs = ilAdvancedMDRecord::_getSelectedRecordsByObject("glo", $a_glossary_id, "term");
635 foreach($old_recs as $old_record_obj)
636 {
637 reset($new_recs);
638 foreach ($new_recs as $new_record_obj)
639 {
640 if ($old_record_obj->getRecordId() == $new_record_obj->getRecordId())
641 {
642 foreach (ilAdvancedMDFieldDefinition::getInstancesByRecordId($old_record_obj->getRecordId()) as $def)
643 {
644 // now we need to copy $def->getFieldId() values from old term to new term
645 // how?
646 // clone values
647
648 $source_primary = array("obj_id"=>array("integer", $old_term->getGlossaryId()));
649 $source_primary["sub_type"] = array("text", "term");
650 $source_primary["sub_id"] = array("integer", $old_term->getId());
651 $source_primary["field_id"] = array("integer", $def->getFieldId());
652 $target_primary = array("obj_id"=>array("integer", $new_term->getGlossaryId()));
653 $target_primary["sub_type"] = array("text", "term");
654 $target_primary["sub_id"] = array("integer", $new_term->getId());
655
656 ilADTFactory::getInstance()->initActiveRecordByType();
658 "adv_md_values",
659 array(
660 "obj_id" => "integer",
661 "sub_type" => "text",
662 "sub_id" => "integer",
663 "field_id" => "integer"
664 ),
665 $source_primary,
666 $target_primary,
667 array("disabled"=>"integer"));
668
669 }
670 }
671 }
672 }
673
674
675 return $new_term->getId();
676 }
static cloneByPrimary($a_table, array $a_primary_def, array $a_source_primary, array $a_target_primary, array $a_additional=null)
Clone values by (partial) primary key.
static getInstance()
Get singleton.
static getInstancesByRecordId($a_record_id, $a_only_searchable=false)
Get definitions by record id.
static _getSelectedRecordsByObject($a_obj_type, $a_obj_id, $a_sub_type="")
Get selected records by object.
Class ilGlossaryDefinition.
static getDefinitionList($a_term_id)
static
Class ilGlossaryTerm.

References ilAdvancedMDRecord\_getSelectedRecordsByObject(), ilADTActiveRecordByType\cloneByPrimary(), ilGlossaryDefinition\getDefinitionList(), ilADTFactory\getInstance(), and ilAdvancedMDFieldDefinition\getInstancesByRecordId().

Referenced by ilObjGlossary\cloneObject(), ilGlossaryAct\copyTerm(), ilObjGlossaryGUI\pasteTerms(), and ilSCORM2004Page\performAutomaticModifications().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _exists()

static ilGlossaryTerm::_exists (   $a_id)
static

checks wether a glossary term with specified id exists or not

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

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

107 {
108 global $ilDB;
109
110 include_once("./Services/Link/classes/class.ilInternalLink.php");
111 if (is_int(strpos($a_id, "_")))
112 {
114 }
115
116 $q = "SELECT * FROM glossary_term WHERE id = ".
117 $ilDB->quote($a_id, "integer");
118 $obj_set = $ilDB->query($q);
119 if ($obj_rec = $ilDB->fetchAssoc($obj_set))
120 {
121 return true;
122 }
123 else
124 {
125 return false;
126 }
127
128 }
global $ilDB

References $ilDB, and ilInternalLink\_extractObjIdOfTarget().

Referenced by ilInternalLink\_exists(), and ilLinksTableGUI\fillRow().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _getIdForImportId()

static ilGlossaryTerm::_getIdForImportId (   $a_import_id)
static

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.

72 {
73 global $ilDB;
74
75 if ($a_import_id == "")
76 {
77 return 0;
78 }
79
80 $q = "SELECT * FROM glossary_term WHERE import_id = ".
81 $ilDB->quote($a_import_id, "text").
82 " ORDER BY create_date DESC";
83 $term_set = $ilDB->query($q);
84 while ($term_rec = $ilDB->fetchAssoc($term_set))
85 {
87
88 $ref_ids = ilObject::_getAllReferences($glo_id); // will be 0 if import of lm is in progress (new import)
89 if (count($ref_ids) == 0 || ilObject::_hasUntrashedReference($glo_id))
90 {
91 return $term_rec["id"];
92 }
93 }
94
95 return 0;
96 }
static _lookGlossaryID($term_id)
get glossary id form term id
static _getAllReferences($a_id)
get all reference ids of object
static _hasUntrashedReference($a_obj_id)
checks wether an object has at least one reference that is not in trash

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

Referenced by ilInternalLink\_getIdForImportId().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _lookGlossaryID()

◆ _lookGlossaryTerm()

static ilGlossaryTerm::_lookGlossaryTerm (   $term_id)
static

◆ _lookLanguage()

static ilGlossaryTerm::_lookLanguage (   $term_id)
static

lookup term language

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

341 {
342 global $ilDB;
343
344 $query = "SELECT * FROM glossary_term WHERE id = ".
345 $ilDB->quote($term_id, "integer");
346 $obj_set = $ilDB->query($query);
347 $obj_rec = $ilDB->fetchAssoc($obj_set);
348
349 return $obj_rec["language"];
350 }

References $ilDB, and $query.

Referenced by ilGlossaryDefinition\createMetaData().

+ Here is the caller graph for this function:

◆ create()

ilGlossaryTerm::create ( )

create new glossary term

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

250 {
251 global $ilDB;
252
253 $this->setId($ilDB->nextId("glossary_term"));
254 $ilDB->manipulate("INSERT INTO glossary_term (id, glo_id, term, language, import_id, create_date, last_update)".
255 " VALUES (".
256 $ilDB->quote($this->getId(), "integer").", ".
257 $ilDB->quote($this->getGlossaryId(), "integer").", ".
258 $ilDB->quote($this->term, "text").", ".
259 $ilDB->quote($this->language, "text").",".
260 $ilDB->quote($this->getImportId(), "text").",".
261 $ilDB->now().", ".
262 $ilDB->now().")");
263 }
setId($a_id)
set glossary term id (= glossary item id)

References $ilDB, and setId().

+ Here is the call graph for this function:

◆ delete()

ilGlossaryTerm::delete ( )

delete glossary term (and all its definition objects)

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

270 {
271 global $ilDB;
272
273 require_once("./Modules/Glossary/classes/class.ilGlossaryDefinition.php");
275 foreach($defs as $def)
276 {
277 $def_obj = new ilGlossaryDefinition($def["id"]);
278 $def_obj->delete();
279 }
280
281 // delete term references
282 include_once("./Modules/Glossary/classes/class.ilGlossaryTermReferences.php");
284
285 // delete glossary_term record
286 $ilDB->manipulate("DELETE FROM glossary_term ".
287 " WHERE id = ".$ilDB->quote($this->getId(), "integer"));
288 }
static deleteReferencesOfTerm($a_term_id)
Delete all references of a term.
getId()
get term id (= glossary item id)

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

+ Here is the call graph for this function:

◆ exportXML()

ilGlossaryTerm::exportXML ( $a_xml_writer,
  $a_inst 
)

export xml

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

524 {
525
526 $attrs = array();
527 $attrs["Language"] = $this->getLanguage();
528 $attrs["Id"] = "il_".IL_INST_ID."_git_".$this->getId();
529 $a_xml_writer->xmlStartTag("GlossaryItem", $attrs);
530
531 $attrs = array();
532 $a_xml_writer->xmlElement("GlossaryTerm", $attrs, $this->getTerm());
533
535
536 foreach($defs as $def)
537 {
538 $definition = new ilGlossaryDefinition($def["id"]);
539 $definition->exportXML($a_xml_writer, $a_inst);
540 }
541
542 $a_xml_writer->xmlEndTag("GlossaryItem");
543 }
getLanguage()
get language

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

+ Here is the call graph for this function:

◆ getFirstLetters()

static ilGlossaryTerm::getFirstLetters (   $a_glo_id,
  $a_tax_node = 0 
)
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 474 of file class.ilGlossaryTerm.php.

475 {
476 global $ilDB;
477
478 $terms = array();
479
480 // meta glossary
481 if (is_array($a_glo_id))
482 {
483 $where = $ilDB->in("glo_id", $a_glo_id, false, "integer");
484 }
485 else
486 {
487 $where = " glo_id = ".$ilDB->quote($a_glo_id, "integer")." ";
488
489 // get all term ids under taxonomy node (if given)
490 if ($a_tax_node > 1)
491 {
492 include_once("./Services/Taxonomy/classes/class.ilObjTaxonomy.php");
493 $tax_ids = ilObjTaxonomy::getUsageOfObject($a_glo_id);
494 if (count($tax_ids) > 0)
495 {
496 $items = ilObjTaxonomy::getSubTreeItems("glo", $a_glo_id, "term", $tax_ids[0], $a_tax_node);
497 $sub_tree_ids = array();
498 foreach ($items as $i)
499 {
500 $sub_tree_ids[] = $i["item_id"];
501 }
502 $in = " AND ".$ilDB->in("id", $sub_tree_ids, false, "integer");
503 }
504 }
505
506 $where.= $in;
507 }
508
509 $q = "SELECT DISTINCT ".$ilDB->upper($ilDB->substr("term", 1, 1))." let FROM glossary_term WHERE ".$where." ORDER BY let";
510 $let_set = $ilDB->query($q);
511
512 $lets = array();
513 while ($let_rec = $ilDB->fetchAssoc($let_set))
514 {
515 $let[$let_rec["let"]] = $let_rec["let"];
516 }
517 return $let;
518 }
if(php_sapi_name() !='cli') $in
Definition: Utf8Test.php:37
static getUsageOfObject($a_obj_id, $a_include_titles=false)
Get usage of object.
static getSubTreeItems($a_comp, $a_obj_id, $a_item_type, $a_tax_id, $a_node)
Get all assigned items under a node.

References $ilDB, $in, ilObjTaxonomy\getSubTreeItems(), and ilObjTaxonomy\getUsageOfObject().

Referenced by ilObjGlossary\getFirstLetters().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getGlossaryId()

ilGlossaryTerm::getGlossaryId ( )

get glossary id

Returns
int glossary id

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

181 {
182 return $this->glo_id;
183 }

References $glo_id.

◆ getId()

ilGlossaryTerm::getId ( )

get term id (= glossary item id)

Returns
int glossary term id

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

148 {
149 return $this->id;
150 }

References $id.

Referenced by delete(), and exportXML().

+ Here is the caller graph for this function:

◆ getImportId()

ilGlossaryTerm::getImportId ( )

get import id

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

241 {
242 return $this->import_id;
243 }

References $import_id.

◆ getLanguage()

ilGlossaryTerm::getLanguage ( )

get language

Returns
string two letter language code

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

223 {
224 return $this->language;
225 }

References $language.

Referenced by exportXML().

+ Here is the caller graph for this function:

◆ getNumberOfUsages()

static ilGlossaryTerm::getNumberOfUsages (   $a_term_id)
static

Get number of usages.

Parameters
intterm id
Returns
int number of usages

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

552 {
553 return count(ilGlossaryTerm::getUsages($a_term_id));
554 }
static getUsages($a_term_id)
Get number of usages.

References getUsages().

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

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getTerm()

ilGlossaryTerm::getTerm ( )

get term

Returns
string term

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

203 {
204 return $this->term;
205 }

References $term.

Referenced by exportXML().

+ Here is the caller graph for this function:

◆ getTermList()

static ilGlossaryTerm::getTermList (   $a_glo_id,
  $searchterm = "",
  $a_first_letter = "",
  $a_def = "",
  $a_tax_node = 0,
  $a_add_amet_fields = false,
array  $a_amet_filter = null,
  $a_include_references = false 
)
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 360 of file class.ilGlossaryTerm.php.

362 {
363 global $ilDB;
364
365 $join = $in = "";
366
367 $terms = array();
368
369 // get all term ids under taxonomy node (if given)
370 if ($a_tax_node > 1)
371 {
372 include_once("./Services/Taxonomy/classes/class.ilObjTaxonomy.php");
373 $tax_ids = ilObjTaxonomy::getUsageOfObject($a_glo_id);
374 if (count($tax_ids) > 0)
375 {
376 $items = ilObjTaxonomy::getSubTreeItems("glo", $a_glo_id, "term", $tax_ids[0], $a_tax_node);
377 $sub_tree_ids = array();
378 foreach ($items as $i)
379 {
380 $sub_tree_ids[] = $i["item_id"];
381 }
382 $in = " AND ".$ilDB->in("gt.id", $sub_tree_ids, false, "integer");
383 }
384 }
385
386 if ($a_def != "")
387 {
388 // meta glossary?
389 if (is_array($a_glo_id))
390 {
391 $glo_where = $ilDB->in("page_object.parent_id", $a_glo_id, false, "integer");
392 }
393 else
394 {
395 $glo_where = " page_object.parent_id = ".$ilDB->quote($a_glo_id, "integer");
396 }
397
398 $join = " JOIN glossary_definition gd ON (gd.term_id = gt.id)".
399 " JOIN page_object ON (".
400 $glo_where.
401 " AND page_object.parent_type = ".$ilDB->quote("gdf", "text").
402 " AND page_object.page_id = gd.id".
403 " AND ".$ilDB->like("page_object.content", "text", "%".$a_def."%").
404 ")";
405 }
406
407 $searchterm = (!empty ($searchterm))
408 ? " AND ".$ilDB->like("term", "text", "%".$searchterm."%")." "
409 : "";
410
411 if ($a_first_letter != "")
412 {
413 $searchterm.= " AND ".$ilDB->upper($ilDB->substr("term", 1, 1))." = ".$ilDB->upper($ilDB->quote($a_first_letter, "text"))." ";
414 }
415
416 // include references
417 $where_glo_id_or = "";
418 if ($a_include_references)
419 {
420 $join.= " LEFT JOIN glo_term_reference tr ON (gt.id = tr.term_id) ";
421 if (is_array($a_glo_id))
422 {
423 $where_glo_id_or = " OR ".$ilDB->in("tr.glo_id", $a_glo_id, false, "integer");
424 }
425 else
426 {
427 $where_glo_id_or = " OR tr.glo_id = ".$ilDB->quote($a_glo_id, "integer");
428 }
429 }
430
431 // meta glossary
432 if (is_array($a_glo_id))
433 {
434 $where = "(".$ilDB->in("gt.glo_id", $a_glo_id, false, "integer").$where_glo_id_or.")";
435 }
436 else
437 {
438 $where = "(gt.glo_id = ".$ilDB->quote($a_glo_id, "integer").$where_glo_id_or.")";
439 }
440
441 $where.= $in;
442
443
444 $q = "SELECT DISTINCT(gt.term), gt.id, gt.glo_id, gt.language FROM glossary_term gt ".$join." WHERE ".$where.$searchterm." ORDER BY term";
445
446 //echo $q; exit;
447
448 $term_set = $ilDB->query($q);
449 $glo_ids = array();
450 while ($term_rec = $ilDB->fetchAssoc($term_set))
451 {
452 $terms[] = array("term" => $term_rec["term"],
453 "language" => $term_rec["language"], "id" => $term_rec["id"], "glo_id" => $term_rec["glo_id"]);
454 $glo_ids[] = $term_rec["glo_id"];
455 }
456
457 // add advanced metadata
458 if ($a_add_amet_fields || is_array($a_amet_filter))
459 {
460 include_once("./Services/AdvancedMetaData/classes/class.ilAdvancedMDValues.php");
461 $terms = ilAdvancedMDValues::queryForRecords($glo_ids, "term", $terms, "glo_id", "id", $a_amet_filter);
462 }
463 return $terms;
464 }
static queryForRecords($a_obj_id, $a_subtype, $a_records, $a_obj_id_key, $a_obj_subid_key, array $a_amet_filter=null)
Query data for given object records.

References $ilDB, $in, ilObjTaxonomy\getSubTreeItems(), ilObjTaxonomy\getUsageOfObject(), and ilAdvancedMDValues\queryForRecords().

Referenced by ilPCParagraph\autoLinkGlossaries(), ilObjGlossary\autoLinkGlossaryTerms(), ilObjContentObject\autoLinkGlossaryTerms(), ilObjGlossary\cloneObject(), ilObjGlossary\getTermList(), and ilGlossaryExporter\getXmlExportTailDependencies().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getTermsOfGlossary()

static ilGlossaryTerm::getTermsOfGlossary (   $a_glo_id)
static

Get terms of glossary.

Parameters

return

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

685 {
686 global $ilDB;
687
688 $set = $ilDB->query("SELECT id FROM glossary_term WHERE ".
689 " glo_id = ".$ilDB->quote($a_glo_id, "integer")
690 );
691 $ids = array();
692 while ($rec = $ilDB->fetchAssoc($set))
693 {
694 $ids[] = $rec["id"];
695 }
696 return $ids;
697 }

References $ilDB.

Referenced by ilGlossaryDefinition\setShortTextsDirty().

+ Here is the caller graph for this function:

◆ getUsages()

static ilGlossaryTerm::getUsages (   $a_term_id)
static

Get number of usages.

Parameters
intterm id
Returns
int number of usages

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

563 {
564 include_once("./Services/Link/classes/class.ilInternalLink.php");
565 $usages = (ilInternalLink::_getSourcesOfTarget("git", $a_term_id, 0));
566
567 include_once("./Modules/Glossary/classes/class.ilGlossaryTermReferences.php");
569 {
570 $usages["glo:termref:".$glo_id.":-"] = array(
571 "type" => "glo:termref",
572 "id" => $glo_id,
573 "lang" => "-"
574 );
575 }
576
577 return $usages;
578 }
static lookupReferencesOfTerm($a_term_id)
Lookup references of a term.

References $glo_id, ilInternalLink\_getSourcesOfTarget(), and ilGlossaryTermReferences\lookupReferencesOfTerm().

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

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ read()

ilGlossaryTerm::read ( )

read glossary term data

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

49 {
50 global $ilDB;
51
52 $q = "SELECT * FROM glossary_term WHERE id = ".
53 $ilDB->quote($this->id, "integer");
54 $term_set = $ilDB->query($q);
55 $term_rec = $ilDB->fetchAssoc($term_set);
56
57 $this->setTerm($term_rec["term"]);
58 $this->setImportId($term_rec["import_id"]);
59 $this->setLanguage($term_rec["language"]);
60 $this->setGlossaryId($term_rec["glo_id"]);
61
62 }
setLanguage($a_language)
set language
setGlossaryId($a_glo_id)
set glossary id
setTerm($a_term)
set term
setImportId($a_import_id)
set import id

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

Referenced by __construct().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setGlossary()

ilGlossaryTerm::setGlossary ( $a_glossary)

set glossary object

Parameters
object$a_glossaryglossary object

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

158 {
159 $this->glossary = $a_glossary;
160 $this->setGlossaryId($a_glossary->getId());
161 }

References setGlossaryId().

+ Here is the call graph for this function:

◆ setGlossaryId()

ilGlossaryTerm::setGlossaryId (   $a_glo_id)

set glossary id

Parameters
int$a_glo_idglossary id

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

170 {
171 $this->glo_id = $a_glo_id;
172 }

Referenced by read(), and setGlossary().

+ Here is the caller graph for this function:

◆ setId()

ilGlossaryTerm::setId (   $a_id)

set glossary term id (= glossary item id)

Parameters
int$a_idglossary term id

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

137 {
138 $this->id = $a_id;
139 }

Referenced by create().

+ Here is the caller graph for this function:

◆ setImportId()

ilGlossaryTerm::setImportId (   $a_import_id)

set import id

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

232 {
233 $this->import_id = $a_import_id;
234 }

Referenced by read().

+ Here is the caller graph for this function:

◆ setLanguage()

ilGlossaryTerm::setLanguage (   $a_language)

set language

Parameters
string$a_languagetwo letter language code

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

214 {
215 $this->language = $a_language;
216 }

Referenced by read().

+ Here is the caller graph for this function:

◆ setTerm()

ilGlossaryTerm::setTerm (   $a_term)

set term

Parameters
string$a_termterm

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

192 {
193 $this->term = $a_term;
194 }

Referenced by read().

+ Here is the caller graph for this function:

◆ update()

ilGlossaryTerm::update ( )

update glossary term

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

295 {
296 global $ilDB;
297
298 $ilDB->manipulate("UPDATE glossary_term SET ".
299 " glo_id = ".$ilDB->quote($this->getGlossaryId(), "integer").", ".
300 " term = ".$ilDB->quote($this->getTerm(), "text").", ".
301 " import_id = ".$ilDB->quote($this->getImportId(), "text").", ".
302 " language = ".$ilDB->quote($this->getLanguage(), "text").", ".
303 " last_update = ".$ilDB->now()." ".
304 " WHERE id = ".$ilDB->quote($this->getId(), "integer"));
305 }

References $ilDB.

Field Documentation

◆ $glo_id

ilGlossaryTerm::$glo_id

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

Referenced by _getIdForImportId(), getGlossaryId(), and getUsages().

◆ $glossary

ilGlossaryTerm::$glossary

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

◆ $id

ilGlossaryTerm::$id

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

Referenced by getId().

◆ $ilias

ilGlossaryTerm::$ilias

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

Referenced by __construct().

◆ $import_id

ilGlossaryTerm::$import_id

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

Referenced by getImportId().

◆ $language

ilGlossaryTerm::$language

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

Referenced by getLanguage().

◆ $lng

ilGlossaryTerm::$lng

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

Referenced by __construct().

◆ $term

ilGlossaryTerm::$term

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

Referenced by getTerm().

◆ $tpl

ilGlossaryTerm::$tpl

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

Referenced by __construct().


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