ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
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_ref_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

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

Protected Attributes

 $db
 

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 33 of file class.ilGlossaryTerm.php.

34 {
35 global $DIC;
36
37 $this->db = $DIC->database();
38 $lng = $DIC->language();
39 $tpl = $DIC["tpl"];
40
41 $this->lng = $lng;
42 $this->tpl = $tpl;
43
44 $this->id = $a_id;
45 $this->type = "term";
46 if ($a_id != 0) {
47 $this->read();
48 }
49 }
read()
read glossary term data
global $DIC
Definition: saml.php:7

References $DIC, $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 583 of file class.ilGlossaryTerm.php.

584 {
585 $old_term = new ilGlossaryTerm($a_term_id);
586
587 // copy the term
588 $new_term = new ilGlossaryTerm();
589 $new_term->setTerm($old_term->getTerm());
590 $new_term->setLanguage($old_term->getLanguage());
591 $new_term->setGlossaryId($a_glossary_id);
592 $new_term->create();
593
594 // copy the definitions
595 include_once("./Modules/Glossary/classes/class.ilGlossaryDefinition.php");
596 $def_list = ilGlossaryDefinition::getDefinitionList($a_term_id);
597 foreach ($def_list as $def) {
598 $old_def = new ilGlossaryDefinition($def["id"]);
599
600 $new_def = new ilGlossaryDefinition();
601 $new_def->setShortText($old_def->getShortText());
602 $new_def->setNr($old_def->getNr());
603 $new_def->setTermId($new_term->getId());
604 $new_def->create();
605
606 // copy meta data
607 include_once("Services/MetaData/classes/class.ilMD.php");
608 $md = new ilMD(
609 $old_term->getGlossaryId(),
610 $old_def->getPageObject()->getId(),
611 $old_def->getPageObject()->getParentType()
612 );
613 $new_md = $md->cloneMD(
614 $a_glossary_id,
615 $new_def->getPageObject()->getId(),
616 $old_def->getPageObject()->getParentType()
617 );
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 // adv metadata
630 include_once('Services/AdvancedMetaData/classes/class.ilAdvancedMDRecord.php');
631 include_once('Services/AdvancedMetaData/classes/class.ilAdvancedMDFieldDefinition.php');
632 $old_recs = ilAdvancedMDRecord::_getSelectedRecordsByObject("glo", $old_term->getGlossaryId(), "term");
633 $new_recs = ilAdvancedMDRecord::_getSelectedRecordsByObject("glo", $a_glossary_id, "term");
634 foreach ($old_recs as $old_record_obj) {
635 reset($new_recs);
636 foreach ($new_recs as $new_record_obj) {
637 if ($old_record_obj->getRecordId() == $new_record_obj->getRecordId()) {
638 foreach (ilAdvancedMDFieldDefinition::getInstancesByRecordId($old_record_obj->getRecordId()) as $def) {
639 // now we need to copy $def->getFieldId() values from old term to new term
640 // how?
641 // clone values
642
643 $source_primary = array("obj_id" => array("integer", $old_term->getGlossaryId()));
644 $source_primary["sub_type"] = array("text", "term");
645 $source_primary["sub_id"] = array("integer", $old_term->getId());
646 $source_primary["field_id"] = array("integer", $def->getFieldId());
647 $target_primary = array("obj_id" => array("integer", $new_term->getGlossaryId()));
648 $target_primary["sub_type"] = array("text", "term");
649 $target_primary["sub_id"] = array("integer", $new_term->getId());
650
651 ilADTFactory::getInstance()->initActiveRecordByType();
653 "adv_md_values",
654 array(
655 "obj_id" => "integer",
656 "sub_type" => "text",
657 "sub_id" => "integer",
658 "field_id" => "integer"
659 ),
660 $source_primary,
661 $target_primary,
662 array("disabled" => "integer")
663 );
664 }
665 }
666 }
667 }
668
669
670 return $new_term->getId();
671 }
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_ref_id, $a_sub_type="")
Get selected records by object.
Class ilGlossaryDefinition.
static getDefinitionList($a_term_id)
static
Class ilGlossaryTerm.
$def
Definition: croninfo.php:21

References $def, 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 110 of file class.ilGlossaryTerm.php.

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

References $DIC, $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 76 of file class.ilGlossaryTerm.php.

77 {
78 global $DIC;
79
80 $ilDB = $DIC->database();
81
82 if ($a_import_id == "") {
83 return 0;
84 }
85
86 $q = "SELECT * FROM glossary_term WHERE import_id = " .
87 $ilDB->quote($a_import_id, "text") .
88 " ORDER BY create_date DESC";
89 $term_set = $ilDB->query($q);
90 while ($term_rec = $ilDB->fetchAssoc($term_set)) {
92
93 $ref_ids = ilObject::_getAllReferences($glo_id); // will be 0 if import of lm is in progress (new import)
94 if (count($ref_ids) == 0 || ilObject::_hasUntrashedReference($glo_id)) {
95 return $term_rec["id"];
96 }
97 }
98
99 return 0;
100 }
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 $DIC, $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

get glossary term

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

328 {
329 global $DIC;
330
331 $ilDB = $DIC->database();
332
333 $query = "SELECT * FROM glossary_term WHERE id = " .
334 $ilDB->quote($term_id, "integer");
335 $obj_set = $ilDB->query($query);
336 $obj_rec = $ilDB->fetchAssoc($obj_set);
337
338 return $obj_rec["term"];
339 }

References $DIC, $ilDB, and $query.

Referenced by SurveyQuestion\addInternalLink(), ilObjGlossaryGUI\copyTerms(), ilObjContentObject\exportHTMLGlossaryTerms(), ilTermUsagesTableGUI\fillRow(), ilLinksTableGUI\fillRow(), ilMediaPoolPageUsagesTableGUI\fillRow(), ilMediaObjectUsagesTableGUI\fillRow(), ilObjGlossary\getAdvMDSubItemTitle(), ilSCORM2004Asset\getGlossaryTermIds(), ilObjGlossarySubItemListGUI\getHTML(), ilObjGlossaryGUI\getTemplate(), ilLinkInputGUI\getTranslatedValue(), ilObjGlossaryGUI\referenceTerms(), SurveyQuestion\setMaterial(), and ilLMPresentationGUI\showPrintView().

+ Here is the caller graph for this function:

◆ _lookLanguage()

static ilGlossaryTerm::_lookLanguage (   $term_id)
static

lookup term language

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

345 {
346 global $DIC;
347
348 $ilDB = $DIC->database();
349
350 $query = "SELECT * FROM glossary_term WHERE id = " .
351 $ilDB->quote($term_id, "integer");
352 $obj_set = $ilDB->query($query);
353 $obj_rec = $ilDB->fetchAssoc($obj_set);
354
355 return $obj_rec["language"];
356 }

References $DIC, $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 250 of file class.ilGlossaryTerm.php.

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

References $db, $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 270 of file class.ilGlossaryTerm.php.

271 {
273
274 require_once("./Modules/Glossary/classes/class.ilGlossaryDefinition.php");
276 foreach ($defs as $def) {
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 $db, $def, $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 $attrs = array();
526 $attrs["Language"] = $this->getLanguage();
527 $attrs["Id"] = "il_" . IL_INST_ID . "_git_" . $this->getId();
528 $a_xml_writer->xmlStartTag("GlossaryItem", $attrs);
529
530 $attrs = array();
531 $a_xml_writer->xmlElement("GlossaryTerm", $attrs, $this->getTerm());
532
534
535 foreach ($defs as $def) {
536 $definition = new ilGlossaryDefinition($def["id"]);
537 $definition->exportXML($a_xml_writer, $a_inst);
538 }
539
540 $a_xml_writer->xmlEndTag("GlossaryItem");
541 }
getLanguage()
get language

References $def, 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 479 of file class.ilGlossaryTerm.php.

480 {
481 global $DIC;
482
483 $ilDB = $DIC->database();
484
485 $terms = array();
486
487 // meta glossary
488 if (is_array($a_glo_id)) {
489 $where = $ilDB->in("glo_id", $a_glo_id, false, "integer");
490 } else {
491 $where = " glo_id = " . $ilDB->quote($a_glo_id, "integer") . " ";
492
493 // get all term ids under taxonomy node (if given)
494 if ($a_tax_node > 1) {
495 include_once("./Services/Taxonomy/classes/class.ilObjTaxonomy.php");
496 $tax_ids = ilObjTaxonomy::getUsageOfObject($a_glo_id);
497 if (count($tax_ids) > 0) {
498 $items = ilObjTaxonomy::getSubTreeItems("glo", $a_glo_id, "term", $tax_ids[0], $a_tax_node);
499 $sub_tree_ids = array();
500 foreach ($items as $i) {
501 $sub_tree_ids[] = $i["item_id"];
502 }
503 $in = " AND " . $ilDB->in("id", $sub_tree_ids, false, "integer");
504 }
505 }
506
507 $where .= $in;
508 }
509
510 $q = "SELECT DISTINCT " . $ilDB->upper($ilDB->substr("term", 1, 1)) . " let FROM glossary_term WHERE " . $where . " ORDER BY let";
511 $let_set = $ilDB->query($q);
512
513 $lets = array();
514 while ($let_rec = $ilDB->fetchAssoc($let_set)) {
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.
$i
Definition: disco.tpl.php:19

References $DIC, $i, $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 181 of file class.ilGlossaryTerm.php.

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

References $glo_id.

◆ getId()

ilGlossaryTerm::getId ( )

get term id (= glossary item id)

Returns
int glossary term id

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

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

References $id.

Referenced by delete(), and exportXML().

+ Here is the caller graph for this function:

◆ getImportId()

ilGlossaryTerm::getImportId ( )

get import id

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

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

References $import_id.

◆ getLanguage()

ilGlossaryTerm::getLanguage ( )

get language

Returns
string two letter language code

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

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

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 549 of file class.ilGlossaryTerm.php.

550 {
551 return count(ilGlossaryTerm::getUsages($a_term_id));
552 }
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 203 of file class.ilGlossaryTerm.php.

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

References $term.

Referenced by exportXML().

+ Here is the caller graph for this function:

◆ getTermList()

static ilGlossaryTerm::getTermList (   $a_glo_ref_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 366 of file class.ilGlossaryTerm.php.

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

References $DIC, $i, $id, $ilDB, $in, ilObject\_lookupObjectId(), 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 679 of file class.ilGlossaryTerm.php.

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

References $DIC, and $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 560 of file class.ilGlossaryTerm.php.

561 {
562 include_once("./Services/Link/classes/class.ilInternalLink.php");
563 $usages = (ilInternalLink::_getSourcesOfTarget("git", $a_term_id, 0));
564
565 include_once("./Modules/Glossary/classes/class.ilGlossaryTermReferences.php");
567 $usages["glo:termref:" . $glo_id . ":-"] = array(
568 "type" => "glo:termref",
569 "id" => $glo_id,
570 "lang" => "-"
571 );
572 }
573
574 return $usages;
575 }
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 54 of file class.ilGlossaryTerm.php.

55 {
57
58 $q = "SELECT * FROM glossary_term WHERE id = " .
59 $ilDB->quote($this->id, "integer");
60 $term_set = $ilDB->query($q);
61 $term_rec = $ilDB->fetchAssoc($term_set);
62
63 $this->setTerm($term_rec["term"]);
64 $this->setImportId($term_rec["import_id"]);
65 $this->setLanguage($term_rec["language"]);
66 $this->setGlossaryId($term_rec["glo_id"]);
67 }
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 $db, $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 158 of file class.ilGlossaryTerm.php.

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

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 170 of file class.ilGlossaryTerm.php.

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

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 137 of file class.ilGlossaryTerm.php.

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

Referenced by create().

+ Here is the caller graph for this function:

◆ setImportId()

ilGlossaryTerm::setImportId (   $a_import_id)

set import id

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

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

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 214 of file class.ilGlossaryTerm.php.

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

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 192 of file class.ilGlossaryTerm.php.

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

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 {
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 $db, and $ilDB.

Field Documentation

◆ $db

ilGlossaryTerm::$db
protected

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

Referenced by create(), delete(), read(), and update().

◆ $glo_id

ilGlossaryTerm::$glo_id

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

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

◆ $glossary

ilGlossaryTerm::$glossary

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

◆ $id

ilGlossaryTerm::$id

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

Referenced by getId(), and getTermList().

◆ $import_id

ilGlossaryTerm::$import_id

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

Referenced by getImportId().

◆ $language

ilGlossaryTerm::$language

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

Referenced by getLanguage().

◆ $lng

ilGlossaryTerm::$lng

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

Referenced by __construct().

◆ $term

ilGlossaryTerm::$term

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

Referenced by getTerm().

◆ $tpl

ilGlossaryTerm::$tpl

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

Referenced by __construct().


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