ILIAS  release_8 Revision v8.24
ilGlossaryTerm Class Reference

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V. More...

+ Collaboration diagram for ilGlossaryTerm:

Public Member Functions

 __construct (int $a_id=0)
 
 read ()
 
 setId (int $a_id)
 set glossary term id (= glossary item id) More...
 
 getId ()
 
 setGlossary (ilObjGlossary $a_glossary)
 
 setGlossaryId (int $a_glo_id)
 
 getGlossaryId ()
 
 setTerm (string $a_term)
 
 getTerm ()
 
 setLanguage (string $a_language)
 
 getLanguage ()
 
 setImportId (string $a_import_id)
 
 getImportId ()
 
 create ()
 
 delete ()
 delete glossary term (and all its definition objects) More...
 
 update ()
 
 exportXML (ilXmlWriter $a_xml_writer, int $a_inst)
 

Static Public Member Functions

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

Data Fields

ilLanguage $lng
 
ilGlobalTemplateInterface $tpl
 
int $id = 0
 
ilObjGlossary $glossary
 
string $term = ""
 
string $language = ""
 
int $glo_id = 0
 
string $import_id = ""
 

Protected Attributes

string $type
 
ilDBInterface $db
 

Detailed Description

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V.

ILIAS is licensed with the GPL-3.0, see https://www.gnu.org/licenses/gpl-3.0.en.html You should have received a copy of said license along with the source code, too.

If this is not the case or you just want to try ILIAS, you'll find us at: https://www.ilias.de https://github.com/ILIAS-eLearning Glossary terms

Author
Alexander Killing killi.nosp@m.ng@l.nosp@m.eifos.nosp@m..de

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

Constructor & Destructor Documentation

◆ __construct()

ilGlossaryTerm::__construct ( int  $a_id = 0)

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

37 {
38 global $DIC;
39
40 $this->db = $DIC->database();
41 $lng = $DIC->language();
42 $tpl = $DIC["tpl"];
43
44 $this->lng = $lng;
45 $this->tpl = $tpl;
46
47 $this->id = $a_id;
48 $this->type = "term";
49 if ($a_id != 0) {
50 $this->read();
51 }
52 }
ilGlobalTemplateInterface $tpl
global $DIC
Definition: feed.php:28

References $DIC, $lng, $tpl, ILIAS\Repository\lng(), and read().

+ Here is the call graph for this function:

Member Function Documentation

◆ _copyTerm()

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

Copy a term to a glossary.

Returns
int new term id

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

480 : int {
481 $old_term = new ilGlossaryTerm($a_term_id);
482
483 // copy the term
484 $new_term = new ilGlossaryTerm();
485 $new_term->setTerm($old_term->getTerm());
486 $new_term->setLanguage($old_term->getLanguage());
487 $new_term->setGlossaryId($a_glossary_id);
488 $new_term->create();
489
490 // copy the definitions
491 $def_list = ilGlossaryDefinition::getDefinitionList($a_term_id);
492 foreach ($def_list as $def) {
493 $old_def = new ilGlossaryDefinition($def["id"]);
494
495 $new_def = new ilGlossaryDefinition();
496 $new_def->setShortText($old_def->getShortText());
497 $new_def->setNr($old_def->getNr());
498 $new_def->setTermId($new_term->getId());
499 $new_def->create();
500
501 // copy meta data
502 $md = new ilMD(
503 $old_term->getGlossaryId(),
504 $old_def->getPageObject()->getId(),
505 $old_def->getPageObject()->getParentType()
506 );
507 $new_md = $md->cloneMD(
508 $a_glossary_id,
509 $new_def->getPageObject()->getId(),
510 $old_def->getPageObject()->getParentType()
511 );
512
513
514 $new_page = $new_def->getPageObject();
515 $old_def->getPageObject()->copy($new_page->getId(), $new_page->getParentType(), $new_page->getParentId(), true);
516
517 // page content
518 //$new_def->getPageObject()->setXMLContent($old_def->getPageObject()->copyXmlContent(true));
519 //$new_def->getPageObject()->buildDom();
520 //$new_def->getPageObject()->update();
521 }
522
523 // adv metadata
524 $old_recs = ilAdvancedMDRecord::_getSelectedRecordsByObject("glo", $old_term->getGlossaryId(), "term");
525 $new_recs = ilAdvancedMDRecord::_getSelectedRecordsByObject("glo", $a_glossary_id, "term");
526 foreach ($old_recs as $old_record_obj) {
527 reset($new_recs);
528 foreach ($new_recs as $new_record_obj) {
529 if ($old_record_obj->getRecordId() == $new_record_obj->getRecordId()) {
530 foreach (ilAdvancedMDFieldDefinition::getInstancesByRecordId($old_record_obj->getRecordId()) as $def) {
531 // now we need to copy $def->getFieldId() values from old term to new term
532 // how?
533 // clone values
534
535 $source_primary = array("obj_id" => array("integer", $old_term->getGlossaryId()));
536 $source_primary["sub_type"] = array("text", "term");
537 $source_primary["sub_id"] = array("integer", $old_term->getId());
538 $source_primary["field_id"] = array("integer", $def->getFieldId());
539 $target_primary = array("obj_id" => array("integer", $new_term->getGlossaryId()));
540 $target_primary["sub_type"] = array("text", "term");
541 $target_primary["sub_id"] = array("integer", $new_term->getId());
542
543 ilADTFactory::getInstance()->initActiveRecordByType();
545 "adv_md_values",
546 array(
547 "obj_id" => "integer",
548 "sub_type" => "text",
549 "sub_id" => "integer",
550 "field_id" => "integer"
551 ),
552 $source_primary,
553 $target_primary,
554 array("disabled" => "integer")
555 );
556 }
557 }
558 }
559 }
560
561 return $new_term->getId();
562 }
static cloneByPrimary(string $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 getInstancesByRecordId( $a_record_id, $a_only_searchable=false, string $language='')
Get definitions by record id.
static _getSelectedRecordsByObject(string $a_obj_type, int $a_id, string $a_sub_type="", bool $is_ref_id=true)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static getDefinitionList(int $a_term_id)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...

Referenced by ilObjGlossary\cloneObject(), and ilObjGlossaryGUI\pasteTerms().

+ Here is the caller graph for this function:

◆ _exists()

static ilGlossaryTerm::_exists ( int  $a_id)
static

checks whether a glossary term with specified id exists or not

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

100 : bool
101 {
102 global $DIC;
103
104 $ilDB = $DIC->database();
105
106 if (is_int(strpos($a_id, "_"))) {
108 }
109
110 $q = "SELECT * FROM glossary_term WHERE id = " .
111 $ilDB->quote($a_id, "integer");
112 $obj_set = $ilDB->query($q);
113 if ($obj_rec = $ilDB->fetchAssoc($obj_set)) {
114 return true;
115 } else {
116 return false;
117 }
118 }

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 ( string  $a_import_id)
static

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

71 : int {
72 global $DIC;
73
74 $ilDB = $DIC->database();
75
76 if ($a_import_id == "") {
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 $glo_id = self::_lookGlossaryID($term_rec["id"]);
86
87 $ref_ids = ilObject::_getAllReferences($glo_id); // will be 0 if import of lm is in progress (new import)
88 if (count($ref_ids) == 0 || ilObject::_hasUntrashedReference($glo_id)) {
89 return (int) $term_rec["id"];
90 }
91 }
92
93 return 0;
94 }
static _lookGlossaryID(int $term_id)
get glossary id form term id
static _hasUntrashedReference(int $obj_id)
checks whether an object has at least one reference that is not in trash
static _getAllReferences(int $id)
get all reference ids for object ID

Referenced by ilInternalLink\_getIdForImportId().

+ Here is the caller graph for this function:

◆ _lookGlossaryID()

static ilGlossaryTerm::_lookGlossaryID ( int  $term_id)
static

◆ _lookGlossaryTerm()

static ilGlossaryTerm::_lookGlossaryTerm ( int  $term_id)
static

get glossary term

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

253 : string
254 {
255 global $DIC;
256
257 $ilDB = $DIC->database();
258
259 $query = "SELECT * FROM glossary_term WHERE id = " .
260 $ilDB->quote($term_id, "integer");
261 $obj_set = $ilDB->query($query);
262 $obj_rec = $ilDB->fetchAssoc($obj_set);
263
264 return $obj_rec["term"] ?? "";
265 }

References $DIC, $ilDB, and $query.

Referenced by ilObjGlossaryGUI\copyTerms(), ilTermUsagesTableGUI\fillRow(), ilLinksTableGUI\fillRow(), ilMediaPoolPageUsagesTableGUI\fillRow(), ilMediaObjectUsagesTableGUI\fillRow(), ilObjGlossary\getAdvMDSubItemTitle(), ilObjGlossarySubItemListGUI\getHTML(), ilObjGlossaryGUI\getTemplate(), ilLinkInputGUI\getTranslatedValue(), ilObjGlossaryGUI\referenceTerms(), and ilLMPresentationGUI\showPrintView().

+ Here is the caller graph for this function:

◆ _lookLanguage()

static ilGlossaryTerm::_lookLanguage ( int  $term_id)
static

lookup term language

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

270 : string
271 {
272 global $DIC;
273
274 $ilDB = $DIC->database();
275
276 $query = "SELECT * FROM glossary_term WHERE id = " .
277 $ilDB->quote($term_id, "integer");
278 $obj_set = $ilDB->query($query);
279 $obj_rec = $ilDB->fetchAssoc($obj_set);
280
281 return $obj_rec["language"];
282 }

References $DIC, $ilDB, and $query.

Referenced by ilGlossaryDefinition\createMetaData().

+ Here is the caller graph for this function:

◆ create()

ilGlossaryTerm::create ( )

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

183 : void
184 {
186
187 $this->setId($ilDB->nextId("glossary_term"));
188 $ilDB->manipulate("INSERT INTO glossary_term (id, glo_id, term, language, import_id, create_date, last_update)" .
189 " VALUES (" .
190 $ilDB->quote($this->getId(), "integer") . ", " .
191 $ilDB->quote($this->getGlossaryId(), "integer") . ", " .
192 $ilDB->quote($this->term, "text") . ", " .
193 $ilDB->quote($this->language, "text") . "," .
194 $ilDB->quote($this->getImportId(), "text") . "," .
195 $ilDB->now() . ", " .
196 $ilDB->now() . ")");
197 }
setId(int $a_id)
set glossary term id (= glossary item id)

References $ilDB.

Referenced by ilObjGlossaryGUI\addTerm().

+ Here is the caller graph for this function:

◆ delete()

ilGlossaryTerm::delete ( )

delete glossary term (and all its definition objects)

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

202 : void
203 {
205
207 foreach ($defs as $def) {
208 $def_obj = new ilGlossaryDefinition($def["id"]);
209 $def_obj->delete();
210 }
211
212 // delete term references
214
215 // delete glossary_term record
216 $ilDB->manipulate("DELETE FROM glossary_term " .
217 " WHERE id = " . $ilDB->quote($this->getId(), "integer"));
218 }
static deleteReferencesOfTerm(int $a_term_id)
Delete all references of a term.

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

Referenced by ilObjGlossaryGUI\deleteTerms().

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

◆ exportXML()

ilGlossaryTerm::exportXML ( ilXmlWriter  $a_xml_writer,
int  $a_inst 
)

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

434 : void {
435 $attrs = array();
436 $attrs["Language"] = $this->getLanguage();
437 $attrs["Id"] = "il_" . IL_INST_ID . "_git_" . $this->getId();
438 $a_xml_writer->xmlStartTag("GlossaryItem", $attrs);
439
440 $attrs = array();
441 $a_xml_writer->xmlElement("GlossaryTerm", $attrs, $this->getTerm());
442
444
445 foreach ($defs as $def) {
446 $definition = new ilGlossaryDefinition($def["id"]);
447 $definition->exportXML($a_xml_writer, $a_inst);
448 }
449
450 $a_xml_writer->xmlEndTag("GlossaryItem");
451 }
xmlElement(string $tag, $attrs=null, $data=null, $encode=true, $escape=true)
Writes a basic element (no children, just textual content)
xmlEndTag(string $tag)
Writes an endtag.
xmlStartTag(string $tag, ?array $attrs=null, bool $empty=false, bool $encode=true, bool $escape=true)
Writes a starttag.
const IL_INST_ID
Definition: constants.php:40

◆ getFirstLetters()

static ilGlossaryTerm::getFirstLetters ( array  $a_glo_id,
int  $a_tax_node = 0 
)
static

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

393 : array {
394 global $DIC;
395
396 $ilDB = $DIC->database();
397
398 // meta glossary
399 if (count($a_glo_id) > 1) {
400 $where = $ilDB->in("glo_id", $a_glo_id, false, "integer");
401 } else {
402 $a_glo_id = current($a_glo_id);
403 $where = " glo_id = " . $ilDB->quote($a_glo_id, "integer") . " ";
404 $in = "";
405 // get all term ids under taxonomy node (if given)
406 if ($a_tax_node > 1) {
407 $tax_ids = ilObjTaxonomy::getUsageOfObject($a_glo_id);
408 if (count($tax_ids) > 0) {
409 $items = ilObjTaxonomy::getSubTreeItems("glo", $a_glo_id, "term", $tax_ids[0], $a_tax_node);
410 $sub_tree_ids = array();
411 foreach ($items as $i) {
412 $sub_tree_ids[] = $i["item_id"];
413 }
414 $in = " AND " . $ilDB->in("id", $sub_tree_ids, false, "integer");
415 }
416 }
417
418 $where .= $in;
419 }
420
421 $q = "SELECT DISTINCT " . $ilDB->upper($ilDB->substr("term", 1, 1)) . " let FROM glossary_term WHERE " . $where . " ORDER BY let";
422 $let_set = $ilDB->query($q);
423
424 $let = array();
425 while ($let_rec = $ilDB->fetchAssoc($let_set)) {
426 $let[$let_rec["let"]] = $let_rec["let"];
427 }
428 return $let;
429 }
static getUsageOfObject(int $a_obj_id, bool $a_include_titles=false)
static getSubTreeItems(string $a_comp, int $a_obj_id, string $a_item_type, int $a_tax_id, $a_node)
Get all assigned items under a node.
$i
Definition: metadata.php:41

References $ilDB.

◆ getGlossaryId()

ilGlossaryTerm::getGlossaryId ( )

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

147 : int
148 {
149 return $this->glo_id;
150 }

◆ getId()

ilGlossaryTerm::getId ( )

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

129 : int
130 {
131 return $this->id;
132 }

References $id.

Referenced by ilObjGlossaryGUI\addDefinition(), and ilObjGlossaryGUI\addTerm().

+ Here is the caller graph for this function:

◆ getImportId()

ilGlossaryTerm::getImportId ( )

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

178 : string
179 {
180 return $this->import_id;
181 }

◆ getLanguage()

ilGlossaryTerm::getLanguage ( )

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

168 : string
169 {
170 return $this->language;
171 }

◆ getNumberOfUsages()

static ilGlossaryTerm::getNumberOfUsages ( int  $a_term_id)
static

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

453 : int
454 {
455 return count(self::getUsages($a_term_id));
456 }

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

+ Here is the caller graph for this function:

◆ getTerm()

ilGlossaryTerm::getTerm ( )

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

157 : string
158 {
159 return $this->term;
160 }

Referenced by ilObjGlossaryGUI\addDefinition(), ilObjGlossaryGUI\confirmDefinitionDeletion(), and ilObjGlossaryGUI\confirmTermDeletion().

+ Here is the caller graph for this function:

◆ getTermList()

static ilGlossaryTerm::getTermList ( array  $a_glo_ref_id,
string  $searchterm = "",
string  $a_first_letter = "",
string  $a_def = "",
int  $a_tax_node = 0,
bool  $a_add_amet_fields = false,
array  $a_amet_filter = null,
bool  $a_include_references = false 
)
static

Get all terms for given set of glossary ids.

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

296 : array {
297 global $DIC;
298
299 if (count($a_glo_ref_id) > 1) {
300 $a_glo_id = array_map(static function ($id): int {
302 }, $a_glo_ref_id);
303 } else {
304 $a_glo_id = ilObject::_lookupObjectId(current($a_glo_ref_id));
305 }
306 $ilDB = $DIC->database();
307
308 $join = $in = "";
309
310 $terms = array();
311
312 // get all term ids under taxonomy node (if given)
313 if ($a_tax_node > 1) {
314 $tax_ids = ilObjTaxonomy::getUsageOfObject($a_glo_id);
315 if (count($tax_ids) > 0) {
316 $items = ilObjTaxonomy::getSubTreeItems("glo", $a_glo_id, "term", $tax_ids[0], $a_tax_node);
317 $sub_tree_ids = array();
318 foreach ($items as $i) {
319 $sub_tree_ids[] = $i["item_id"];
320 }
321 $in = " AND " . $ilDB->in("gt.id", $sub_tree_ids, false, "integer");
322 }
323 }
324
325 if ($a_def != "") {
326 // meta glossary?
327 if (is_array($a_glo_id)) {
328 $glo_where = $ilDB->in("page_object.parent_id", $a_glo_id, false, "integer");
329 } else {
330 $glo_where = " page_object.parent_id = " . $ilDB->quote($a_glo_id, "integer");
331 }
332
333 $join = " JOIN glossary_definition gd ON (gd.term_id = gt.id)" .
334 " JOIN page_object ON (" .
335 $glo_where .
336 " AND page_object.parent_type = " . $ilDB->quote("gdf", "text") .
337 " AND page_object.page_id = gd.id" .
338 " AND " . $ilDB->like("page_object.content", "text", "%" . $a_def . "%") .
339 ")";
340 }
341
342 $searchterm = (!empty($searchterm))
343 ? " AND " . $ilDB->like("term", "text", "%" . $searchterm . "%") . " "
344 : "";
345
346 if ($a_first_letter != "") {
347 $searchterm .= " AND " . $ilDB->upper($ilDB->substr("term", 1, 1)) . " = " . $ilDB->upper($ilDB->quote($a_first_letter, "text")) . " ";
348 }
349
350 // include references
351 $where_glo_id_or = "";
352 if ($a_include_references) {
353 $join .= " LEFT JOIN glo_term_reference tr ON (gt.id = tr.term_id) ";
354 if (is_array($a_glo_id)) {
355 $where_glo_id_or = " OR " . $ilDB->in("tr.glo_id", $a_glo_id, false, "integer");
356 } else {
357 $where_glo_id_or = " OR tr.glo_id = " . $ilDB->quote($a_glo_id, "integer");
358 }
359 }
360
361 // meta glossary
362 if (is_array($a_glo_id)) {
363 $where = "(" . $ilDB->in("gt.glo_id", $a_glo_id, false, "integer") . $where_glo_id_or . ")";
364 } else {
365 $where = "(gt.glo_id = " . $ilDB->quote($a_glo_id, "integer") . $where_glo_id_or . ")";
366 }
367
368 $where .= $in;
369
370
371 $q = "SELECT DISTINCT(gt.term), gt.id, gt.glo_id, gt.language FROM glossary_term gt " . $join . " WHERE " . $where . $searchterm . " ORDER BY term";
372
373 //echo $q; exit;
374
375 $term_set = $ilDB->query($q);
376 $glo_ids = array();
377 while ($term_rec = $ilDB->fetchAssoc($term_set)) {
378 $terms[] = array("term" => $term_rec["term"],
379 "language" => $term_rec["language"], "id" => $term_rec["id"], "glo_id" => $term_rec["glo_id"]);
380 $glo_ids[] = $term_rec["glo_id"];
381 }
382
383 // add advanced metadata
384 if (($a_add_amet_fields || is_array($a_amet_filter)) && count($a_glo_ref_id) == 1) {
385 $terms = ilAdvancedMDValues::queryForRecords(current($a_glo_ref_id), "glo", "term", $glo_ids, "term", $terms, "glo_id", "id", $a_amet_filter);
386 }
387 return $terms;
388 }
static queryForRecords(int $adv_rec_obj_ref_id, string $adv_rec_obj_type, string $adv_rec_obj_subtype, array $a_obj_id, string $a_subtype, array $a_records, string $a_obj_id_key, string $a_obj_subid_key, array $a_amet_filter=null)
static _lookupObjectId(int $ref_id)

References $id, and ilObject\_lookupObjectId().

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

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

◆ getTermsOfGlossary()

static ilGlossaryTerm::getTermsOfGlossary ( int  $a_glo_id)
static
Returns
int[] term ids

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

569 : array {
570 global $DIC;
571
572 $ilDB = $DIC->database();
573
574 $set = $ilDB->query(
575 "SELECT id FROM glossary_term WHERE " .
576 " glo_id = " . $ilDB->quote($a_glo_id, "integer")
577 );
578 $ids = array();
579 while ($rec = $ilDB->fetchAssoc($set)) {
580 $ids[] = (int) $rec["id"];
581 }
582 return $ids;
583 }

Referenced by ilGlossaryDefinition\setShortTextsDirty().

+ Here is the caller graph for this function:

◆ getUsages()

static ilGlossaryTerm::getUsages ( int  $a_term_id)
static

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

458 : array
459 {
460 $usages = (ilInternalLink::_getSourcesOfTarget("git", $a_term_id, 0));
461
463 $usages["glo:termref:" . $glo_id . ":-"] = array(
464 "type" => "glo:termref",
465 "id" => $glo_id,
466 "lang" => "-"
467 );
468 }
469
470 return $usages;
471 }
static lookupReferencesOfTerm(int $a_term_id)

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

Referenced by ilTermUsagesTableGUI\getItems().

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

◆ read()

ilGlossaryTerm::read ( )

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

54 : void
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((string) $term_rec["term"]);
64 $this->setImportId((string) $term_rec["import_id"]);
65 $this->setLanguage((string) $term_rec["language"]);
66 $this->setGlossaryId((int) $term_rec["glo_id"]);
67 }
setTerm(string $a_term)
setImportId(string $a_import_id)
setLanguage(string $a_language)
setGlossaryId(int $a_glo_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 ( ilObjGlossary  $a_glossary)

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

136 : void {
137 $this->glossary = $a_glossary;
138 $this->setGlossaryId($a_glossary->getId());
139 }

Referenced by ilObjGlossaryGUI\addTerm().

+ Here is the caller graph for this function:

◆ setGlossaryId()

ilGlossaryTerm::setGlossaryId ( int  $a_glo_id)

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

143 : void {
144 $this->glo_id = $a_glo_id;
145 }

Referenced by read().

+ Here is the caller graph for this function:

◆ setId()

ilGlossaryTerm::setId ( int  $a_id)

set glossary term id (= glossary item id)

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

124 : void
125 {
126 $this->id = $a_id;
127 }

◆ setImportId()

ilGlossaryTerm::setImportId ( string  $a_import_id)

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

173 : void
174 {
175 $this->import_id = $a_import_id;
176 }

Referenced by read().

+ Here is the caller graph for this function:

◆ setLanguage()

ilGlossaryTerm::setLanguage ( string  $a_language)

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

164 : void {
165 $this->language = $a_language;
166 }

Referenced by ilObjGlossaryGUI\addTerm(), and read().

+ Here is the caller graph for this function:

◆ setTerm()

ilGlossaryTerm::setTerm ( string  $a_term)

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

152 : void
153 {
154 $this->term = $a_term;
155 }

Referenced by ilObjGlossaryGUI\addTerm(), and read().

+ Here is the caller graph for this function:

◆ update()

ilGlossaryTerm::update ( )

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

220 : void
221 {
223
224 $ilDB->manipulate("UPDATE glossary_term SET " .
225 " glo_id = " . $ilDB->quote($this->getGlossaryId(), "integer") . ", " .
226 " term = " . $ilDB->quote($this->getTerm(), "text") . ", " .
227 " import_id = " . $ilDB->quote($this->getImportId(), "text") . ", " .
228 " language = " . $ilDB->quote($this->getLanguage(), "text") . ", " .
229 " last_update = " . $ilDB->now() . " " .
230 " WHERE id = " . $ilDB->quote($this->getId(), "integer"));
231 }

References $ilDB.

Field Documentation

◆ $db

ilDBInterface ilGlossaryTerm::$db
protected

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

Referenced by read().

◆ $glo_id

int ilGlossaryTerm::$glo_id = 0

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

◆ $glossary

ilObjGlossary ilGlossaryTerm::$glossary

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

◆ $id

int ilGlossaryTerm::$id = 0

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

◆ $import_id

string ilGlossaryTerm::$import_id = ""

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

◆ $language

string ilGlossaryTerm::$language = ""

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

◆ $lng

ilLanguage ilGlossaryTerm::$lng

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

Referenced by __construct().

◆ $term

string ilGlossaryTerm::$term = ""

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

◆ $tpl

ilGlobalTemplateInterface ilGlossaryTerm::$tpl

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

Referenced by __construct().

◆ $type

string ilGlossaryTerm::$type
protected

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


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