ILIAS  trunk Revision v12.0_alpha-377-g3641b37b9db
ilObjGlossary Class Reference

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

+ Inheritance diagram for ilObjGlossary:
+ Collaboration diagram for ilObjGlossary:

Public Member Functions

 __construct (int $a_id=0, bool $a_call_by_reference=true)
 
 create (bool $a_upload=false)
 
 read ()
 
 setVirtualMode (string $a_mode)
 
 getVirtualMode ()
 
 isVirtual ()
 
 setPresentationMode (string $a_val)
 
 getPresentationMode ()
 
 setSnippetLength (int $a_val)
 Set definition snippet length (in overview) More...
 
 getSnippetLength ()
 
 setOnline (bool $a_online)
 
 getOnline ()
 
 setActiveGlossaryMenu (bool $a_act_glo_menu)
 
 isActiveGlossaryMenu ()
 
 setShowTaxonomy (bool $a_val)
 
 getShowTaxonomy ()
 
 setActiveFlashcards (bool $a_flash)
 
 isActiveFlashcards ()
 
 setFlashcardsMode (string $a_flash)
 
 getFlashcardsMode ()
 
 setAutoGlossaries (array $a_val)
 
 addAutoGlossary (int $glo_id)
 
 getAutoGlossaries ()
 
 removeAutoGlossary (int $a_glo_id)
 
 update ()
 
 updateAutoGlossaries ()
 
 getGlossariesForCollection ()
 
 addGlossaryForCollection (int $glo_id)
 
 removeGlossaryFromCollection (int $glo_id)
 
 getTermList (string $searchterm="", string $a_letter="", string $a_def="", int $a_tax_node=0, bool $a_include_offline_childs=false, bool $a_add_amet_fields=false, ?array $a_amet_filter=null, bool $a_omit_virtual=false, bool $a_include_references=false)
 
 getFirstLetters (int $a_tax_node=0)
 
 getAllGlossaryIds (bool $a_include_offline_childs=false, bool $ids_are_ref_ids=false)
 Get all glossary ids. More...
 
 createExportDirectory (string $a_type="xml")
 
 getExportDirectory (string $a_type="xml")
 
 delete ()
 delete object or referenced object (in the case of a referenced object, object data is only deleted if last reference is deleted) This function removes an object entirely from system!! More...
 
 getTaxonomyId ()
 
 cloneObject (int $target_id, int $copy_id=0, bool $omit_tree=false)
 
 removeOfflineGlossaries (array $a_glo_ids, bool $ids_are_ref_ids=false)
 Remove offline glossaries from obj id array. More...
 
 autoLinkGlossaryTerms (int $a_glo_ref_id)
 Auto link glossary terms. More...
 
 supportsLongTextQuery ()
 Is long text search supported. More...
 
- Public Member Functions inherited from ilObject
 getObjectProperties ()
 
 flushObjectProperties ()
 
 withReferences ()
 determines whether objects are referenced or not (got ref ids or not) More...
 
 processAutoRating ()
 
 read ()
 
 getId ()
 
 setId (int $id)
 
 setRefId (int $ref_id)
 
 getRefId ()
 
 getType ()
 
 setType (string $type)
 
 getPresentationTitle ()
 get presentation title Normally same as title Overwritten for sessions More...
 
 getTitle ()
 
 getUntranslatedTitle ()
 Get untranslated object title WebDAV needs to access the untranslated title of an object. More...
 
 setTitle (string $title)
 
 getDescription ()
 
 setDescription (string $description)
 
 getLongDescription ()
 get object long description (stored in object_description) More...
 
 getImportId ()
 
 setImportId (string $import_id)
 
 setOfflineStatus (bool $status)
 
 getOfflineStatus ()
 
 supportsOfflineHandling ()
 
 getOwner ()
 
 getOwnerName ()
 get full name of object owner More...
 
 setOwner (int $usr_id)
 
 getCreateDate ()
 Get create date in YYYY-MM-DD HH-MM-SS format. More...
 
 getLastUpdateDate ()
 Get last update date in YYYY-MM-DD HH-MM-SS format. More...
 
 create ()
 note: title, description and type should be set when this function is called More...
 
 update ()
 
 MDUpdateListener (string $element)
 Metadata update listener. More...
 
 createMetaData ()
 
 updateMetaData ()
 
 deleteMetaData ()
 
 updateOwner ()
 update owner of object in db More...
 
 putInTree (int $parent_ref_id)
 maybe this method should be in tree object!? More...
 
 setPermissions (int $parent_ref_id)
 
 setParentRolePermissions (int $parent_ref_id)
 Initialize the permissions of parent roles (local roles of categories, global roles...) This method is overwritten in e.g. More...
 
 createReference ()
 creates reference for object More...
 
 countReferences ()
 
 delete ()
 delete object or referenced object (in the case of a referenced object, object data is only deleted if last reference is deleted) This function removes an object entirely from system!! More...
 
 initDefaultRoles ()
 init default roles settings Purpose of this function is to create a local role folder and local roles, that are needed depending on the object type. More...
 
 applyDidacticTemplate (int $tpl_id)
 
 getXMLZip ()
 
 getHTMLDirectory ()
 
 appendCopyInfo (int $target_id, int $copy_id, int $new_obj_id)
 Prepend Copy info if object with same name exists in that container. More...
 
 cloneDependencies (int $target_id, int $copy_id)
 Clone object dependencies. More...
 
 cloneMetaData (ilObject $target_obj)
 Copy meta data. More...
 
 selfOrParentWithRatingEnabled ()
 
 getPossibleSubObjects (bool $filter=true)
 get all possible sub objects of this type the object can decide which types of sub objects are possible jut in time overwrite if the decision distinguish from standard model More...
 

Static Public Member Functions

static _lookupOnline (int $a_id)
 
static lookupSnippetLength (int $a_id)
 
static lookupAutoGlossaries (int $a_id)
 
static getDeletionDependencies (int $obj_id)
 Get deletion dependencies. More...
 
static getAdvMDSubItemTitle (int $a_obj_id, string $a_sub_type, int $a_sub_id)
 
- Static Public Member Functions inherited from ilObject
static _lookupObjIdByImportId (string $import_id)
 Get (latest) object id for an import id. More...
 
static _lookupImportId (int $obj_id)
 
static _lookupOwnerName (int $owner_id)
 Lookup owner name for owner id. More...
 
static _getIdForImportId (string $import_id)
 
static _getAllReferences (int $id)
 get all reference ids for object ID More...
 
static _lookupTitle (int $obj_id)
 
static lookupOfflineStatus (int $obj_id)
 Lookup offline status using objectDataCache. More...
 
static _lookupOwner (int $obj_id)
 Lookup owner user ID for object ID. More...
 
static _getIdsForTitle (string $title, string $type='', bool $partial_match=false)
 
static _lookupDescription (int $obj_id)
 
static _lookupLastUpdate (int $obj_id, bool $formatted=false)
 
static _getLastUpdateOfObjects (array $obj_ids)
 
static _lookupObjId (int $ref_id)
 
static _setDeletedDate (int $ref_id, int $deleted_by)
 
static setDeletedDates (array $ref_ids, int $user_id)
 
static _resetDeletedDate (int $ref_id)
 
static _lookupDeletedDate (int $ref_id)
 
static _writeTitle (int $obj_id, string $title)
 write title to db (static) More...
 
static _writeDescription (int $obj_id, string $desc)
 write description to db (static) More...
 
static _writeImportId (int $obj_id, string $import_id)
 write import id to db (static) More...
 
static _lookupType (int $id, bool $reference=false)
 
static _isInTrash (int $ref_id)
 
static _hasUntrashedReference (int $obj_id)
 checks whether an object has at least one reference that is not in trash More...
 
static _lookupObjectId (int $ref_id)
 
static _getObjectsDataForType (string $type, bool $omit_trash=false)
 get all objects of a certain type More...
 
static _exists (int $id, bool $reference=false, ?string $type=null)
 checks if an object exists in object_data More...
 
static _getObjectsByType (string $obj_type="", ?int $owner=null)
 
static _prepareCloneSelection (array $ref_ids, string $new_type, bool $show_path=true)
 Prepare copy wizard object selection. More...
 
static getIconForType (string $type)
 
static _getIcon (int $obj_id=0, string $size="big", string $type="", bool $offline=false)
 Get icon for repository item. More...
 
static collectDeletionDependencies (array &$deps, int $ref_id, int $obj_id, string $type, int $depth=0)
 Collect deletion dependencies. More...
 
static getDeletionDependencies (int $obj_id)
 Get deletion dependencies. More...
 
static getLongDescriptions (array $obj_ids)
 
static getAllOwnedRepositoryObjects (int $user_id)
 
static fixMissingTitles ($type, array &$obj_title_map)
 Try to fix missing object titles. More...
 
static _lookupCreationDate (int $obj_id)
 
static _getObjectTypeIdByTitle (string $type, ?\ilDBInterface $ilDB=null)
 
static getAdvMDSubItemTitle (int $a_obj_id, string $a_sub_type, int $a_sub_id)
 

Data Fields

array $auto_glossaries = array()
 
- Data Fields inherited from ilObject
const TITLE_LENGTH = 255
 
const DESC_LENGTH = 128
 
const LONG_DESC_LENGTH = 4000
 
const TABLE_OBJECT_DATA = "object_data"
 
array $objectList
 
string $untranslatedTitle
 

Static Protected Member Functions

static lookup (int $a_id, string $a_property)
 Lookup glossary property. More...
 

Protected Attributes

ILIAS Glossary Term TermManager $term_manager
 
ILIAS Style Content DomainService $content_style_domain
 
ilGlossaryDefPage $page_object
 
array $file_ids = []
 
array $mob_ids = []
 
bool $show_tax = false
 
int $style_id = 0
 
bool $glo_menu_active = false
 
bool $online = false
 
int $snippet_length = 0
 
string $pres_mode = ""
 
bool $virtual = false
 
string $virtual_mode = ""
 
bool $flashcards_active = false
 
string $flashcards_mode = ""
 
ilGlobalTemplateInterface $tpl
 
ilObjUser $user
 
- Protected Attributes inherited from ilObject
ilLogger $obj_log
 
ILIAS $ilias
 
ilObjectDefinition $obj_definition
 
ilDBInterface $db
 
ilLogger $log
 
ilErrorHandling $error
 
ilTree $tree
 
ilAppEventHandler $app_event_handler
 
ilRbacAdmin $rbac_admin
 
ilRbacReview $rbac_review
 
ilObjUser $user
 
ilLanguage $lng
 
LOMServices $lom_services
 
bool $call_by_reference
 
int $max_title = self::TITLE_LENGTH
 
int $max_desc = self::DESC_LENGTH
 
bool $add_dots = true
 
int $ref_id = null
 
string $type = ""
 
string $title = ""
 
string $desc = ""
 
string $long_desc = ""
 
int $owner = 0
 
string $create_date = ""
 
string $last_update = ""
 
string $import_id = ""
 
bool $register = false
 

Additional Inherited Members

- Protected Member Functions inherited from ilObject
 doMDUpdateListener (string $a_element)
 
 beforeMDUpdateListener (string $a_element)
 
 doCreateMetaData ()
 
 beforeCreateMetaData ()
 
 doUpdateMetaData ()
 
 beforeUpdateMetaData ()
 
 doDeleteMetaData ()
 
 beforeDeleteMetaData ()
 
 handleAutoRating ()
 
 hasAutoRating ()
 

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

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

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

Constructor & Destructor Documentation

◆ __construct()

ilObjGlossary::__construct ( int  $a_id = 0,
bool  $a_call_by_reference = true 
)

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

47 {
48 global $DIC;
49 $this->tpl = $DIC["tpl"];
50
51 $this->db = $DIC->database();
52 $this->user = $DIC->user();
53 $this->type = "glo";
54 parent::__construct($a_id, $a_call_by_reference);
55 $this->content_style_domain = $DIC
56 ->contentStyle()
57 ->domain();
58 $this->term_manager = $DIC->glossary()->internal()->domain()->term($this);
59 }
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
global $DIC
Definition: shib_login.php:26

References $DIC, ILIAS\GlobalScreen\Provider\__construct(), and ILIAS\Repository\user().

+ Here is the call graph for this function:

Member Function Documentation

◆ _lookupOnline()

static ilObjGlossary::_lookupOnline ( int  $a_id)
static

Definition at line 176 of file class.ilObjGlossary.php.

178 : bool {
179 global $DIC;
180
181 $db = $DIC->database();
182
183 $q = "SELECT is_online FROM glossary WHERE id = " .
184 $db->quote($a_id, "integer");
185 $lm_set = $db->query($q);
186 $lm_rec = $db->fetchAssoc($lm_set);
187
188 return ilUtil::yn2tf($lm_rec["is_online"]);
189 }
ilDBInterface $db
static yn2tf(string $a_yn)
quote($value, string $type)
query(string $query)
Run a (read-only) Query on the database.
fetchAssoc(ilDBStatement $statement)
$q
Definition: shib_logout.php:23
$lm_set

Referenced by ilRepositoryExplorer\isClickable().

+ Here is the caller graph for this function:

◆ addAutoGlossary()

ilObjGlossary::addAutoGlossary ( int  $glo_id)

Definition at line 267 of file class.ilObjGlossary.php.

267 : void
268 {
269 if ($glo_id > 0 && ilObject::_lookupType($glo_id) == "glo" &&
270 !in_array($glo_id, $this->auto_glossaries)) {
271 $this->auto_glossaries[] = $glo_id;
272 }
273 }
static _lookupType(int $id, bool $reference=false)

References ilObject\_lookupType().

+ Here is the call graph for this function:

◆ addGlossaryForCollection()

ilObjGlossary::addGlossaryForCollection ( int  $glo_id)

Definition at line 376 of file class.ilObjGlossary.php.

376 : void
377 {
378 $this->db->replace(
379 "glossary_collection",
380 [
381 "id" => ["integer", $this->getId()],
382 "glo_id" => ["integer", $glo_id]
383 ],
384 []
385 );
386 }

References ILIAS\Survey\Mode\getId().

+ Here is the call graph for this function:

◆ autoLinkGlossaryTerms()

ilObjGlossary::autoLinkGlossaryTerms ( int  $a_glo_ref_id)

Auto link glossary terms.

Definition at line 672 of file class.ilObjGlossary.php.

674 : void {
675 // get terms of target glossary
676 $terms = ilGlossaryTerm::getTermList([$a_glo_ref_id]);
677
678 // for each get page: get content
679 $source_terms = ilGlossaryTerm::getTermList([$this->getRefId()]);
680 $found_pages = array();
681 foreach ($source_terms as $source_term) {
682 $pg = new ilGlossaryDefPage($source_term["id"]);
683 $c = $pg->getXMLContent();
684 foreach ($terms as $t) {
685 if (is_int(stripos($c, $t["term"]))) {
686 $found_pages[$source_term["id"]]["terms"][] = $t;
687 if (!isset($found_pages[$source_term["id"]]["page"])) {
688 $found_pages[$source_term["id"]]["page"] = $pg;
689 }
690 }
691 }
692 reset($terms);
693 }
694
695 // ilPCParagraph autoLinkGlossariesPage with page and terms
696 foreach ($found_pages as $id => $fp) {
697 ilPCParagraph::autoLinkGlossariesPage($fp["page"], $fp["terms"]);
698 }
699 }
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
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.
static autoLinkGlossariesPage(ilPageObject $a_page, array $a_terms)
Auto link glossary of whole page.
$c
Definition: deliver.php:25

◆ cloneObject()

ilObjGlossary::cloneObject ( int  $target_id,
int  $copy_id = 0,
bool  $omit_tree = false 
)

Definition at line 546 of file class.ilObjGlossary.php.

546 : ?ilObject
547 {
548 $new_obj = parent::cloneObject($target_id, $copy_id, $omit_tree);
549 $this->cloneMetaData($new_obj);
550
551 $tax_ass = null;
552 $new_tax_ass = null;
553 $map = [];
554
555 //copy online status if object is not the root copy object
556 $cp_options = ilCopyWizardOptions::_getInstance($copy_id);
557
558 if (!$cp_options->isRootNode($this->getRefId())) {
559 $new_obj->setOnline($this->getOnline());
560 }
561
562 // $new_obj->setTitle($this->getTitle());
563 $new_obj->setDescription($this->getDescription());
564 $new_obj->setVirtualMode($this->getVirtualMode());
565 $new_obj->setPresentationMode($this->getPresentationMode());
566 $new_obj->setSnippetLength($this->getSnippetLength());
567 $new_obj->setAutoGlossaries($this->getAutoGlossaries());
568 $new_obj->setActiveFlashcards($this->isActiveFlashcards());
569 $new_obj->setFlashcardsMode($this->getFlashcardsMode());
570 $new_obj->update();
571
572 // set/copy stylesheet
573 $this->content_style_domain->styleForRefId($this->getRefId())->cloneTo($new_obj->getId());
574
575 // copy taxonomy
576 if (($tax_id = $this->getTaxonomyId()) > 0) {
577 // clone it
578 $tax = new ilObjTaxonomy($tax_id);
579 $new_tax = $tax->cloneObject(0, 0, true);
580 $map = $tax->getNodeMapping();
581
582 // assign new taxonomy to new glossary
583 ilObjTaxonomy::saveUsage($new_tax->getId(), $new_obj->getId());
584
585 $tax_ass = new ilTaxNodeAssignment("glo", $this->getId(), "term", $tax_id);
586 $new_tax_ass = new ilTaxNodeAssignment("glo", $new_obj->getId(), "term", $new_tax->getId());
587 }
588
589 // copy terms
590 $term_mappings = array();
591 foreach (ilGlossaryTerm::getTermList([$this->getRefId()]) as $term) {
592 $new_term_id = ilGlossaryTerm::_copyTerm($term["id"], $new_obj->getId());
593 $term_mappings[$term["id"]] = $new_term_id;
594
595 // copy tax node assignments
596 if ($tax_id > 0) {
597 $assignmts = $tax_ass->getAssignmentsOfItem($term["id"]);
598 foreach ($assignmts as $a) {
599 if ($map[$a["node_id"]] > 0) {
600 $new_tax_ass->addAssignment($map[$a["node_id"]], $new_term_id);
601 }
602 }
603 }
604 }
605
606 // add mapping of term_ids to copy wizard options
607 if (!empty($term_mappings)) {
608 $cp_options->appendMapping($this->getRefId() . '_glo_terms', $term_mappings);
609 }
610
611 // copy collection glossaries
612 foreach ($this->getGlossariesForCollection() as $glo_id) {
613 $new_obj->addGlossaryForCollection($glo_id);
614 }
615
616 return $new_obj;
617 }
static _getInstance(int $a_copy_id)
static _copyTerm(int $a_term_id, int $a_glossary_id)
Copy a term to a glossary.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static saveUsage(int $a_tax_id, int $a_obj_id)
Class ilObject Basic functions for all objects.
cloneMetaData(ilObject $target_obj)
Copy meta data.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
$a
thx to https://mlocati.github.io/php-cs-fixer-configurator for the examples

References Vendor\Package\$a, ilGlossaryTerm\_copyTerm(), ilCopyWizardOptions\_getInstance(), ILIAS\Survey\Mode\getId(), ilGlossaryTerm\getTermList(), and ilObjTaxonomy\saveUsage().

+ Here is the call graph for this function:

◆ create()

ilObjGlossary::create ( bool  $a_upload = false)

Definition at line 61 of file class.ilObjGlossary.php.

61 : int
62 {
63 $id = parent::create();
64
65 // meta data will be created by
66 // import parser
67 if (!$a_upload) {
68 $this->createMetaData();
69 }
70 $this->db->insert(
71 'glossary',
72 array(
73 'id' => array('integer', $this->getId()),
74 'is_online' => array('text', 'n'),
75 'virtual' => array('text', $this->getVirtualMode()),
76 'pres_mode' => array('text', 'table'),
77 'snippet_length' => array('integer', 200)
78 )
79 );
80
81 $this->setPresentationMode("table");
82 $this->setSnippetLength(200);
83
84 $this->updateAutoGlossaries();
85
86 return $id;
87 }
setSnippetLength(int $a_val)
Set definition snippet length (in overview)
setPresentationMode(string $a_val)

References $id, ilObject\createMetaData(), ilObject\getId(), getVirtualMode(), setPresentationMode(), setSnippetLength(), and updateAutoGlossaries().

+ Here is the call graph for this function:

◆ createExportDirectory()

ilObjGlossary::createExportDirectory ( string  $a_type = "xml")

Definition at line 481 of file class.ilObjGlossary.php.

481 : string
482 {
483 return ilExport::_createExportDirectory($this->getId(), $a_type, $this->getType());
484 }
static _createExportDirectory(int $a_obj_id, string $a_export_type="xml", string $a_obj_type="")

References ilExport\_createExportDirectory(), and ILIAS\Survey\Mode\getId().

+ Here is the call graph for this function:

◆ delete()

ilObjGlossary::delete ( )

delete object or referenced object (in the case of a referenced object, object data is only deleted if last reference is deleted) This function removes an object entirely from system!!

Returns
bool true if object was removed completely; false if only a references was removed

Reimplemented from ilObject.

Definition at line 491 of file class.ilObjGlossary.php.

491 : bool
492 {
493 // always call parent delete function first!!
494 if (!parent::delete()) {
495 return false;
496 }
497
498 // delete terms
499 if (!$this->isVirtual()) {
500 $terms = $this->getTermList();
501 foreach ($terms as $term) {
502 $this->term_manager->deleteTerm((int) $term["id"]);
503 }
504 }
505
506 // delete term references
507 $refs = new ilGlossaryTermReferences($this->getId());
508 $refs->delete();
509
510 // delete glossary data entry
511 $q = "DELETE FROM glossary WHERE id = " . $this->db->quote($this->getId());
512 $this->db->query($q);
513
514 // delete meta data
515 $this->deleteMetaData();
516
517 return true;
518 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
getTermList(string $searchterm="", string $a_letter="", string $a_def="", int $a_tax_node=0, bool $a_include_offline_childs=false, bool $a_add_amet_fields=false, ?array $a_amet_filter=null, bool $a_omit_virtual=false, bool $a_include_references=false)

References $q, and ILIAS\Survey\Mode\getId().

+ Here is the call graph for this function:

◆ getAdvMDSubItemTitle()

static ilObjGlossary::getAdvMDSubItemTitle ( int  $a_obj_id,
string  $a_sub_type,
int  $a_sub_id 
)
static

Implements ilAdvancedMetaDataSubItems.

Definition at line 655 of file class.ilObjGlossary.php.

655 : string
656 {
657 global $DIC;
658
659 $lng = $DIC->language();
660
661 if ($a_sub_type == "term") {
662 $lng->loadLanguageModule("glo");
663
664 return $lng->txt("glo_term") . ' "' . ilGlossaryTerm::_lookGlossaryTerm($a_sub_id) . '"';
665 }
666 return "";
667 }
static _lookGlossaryTerm(int $term_id)
get glossary term
loadLanguageModule(string $a_module)
Load language module.
txt(string $a_topic, string $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
ilLanguage $lng

References $DIC, $lng, and ilGlossaryTerm\_lookGlossaryTerm().

+ Here is the call graph for this function:

◆ getAllGlossaryIds()

ilObjGlossary::getAllGlossaryIds ( bool  $a_include_offline_childs = false,
bool  $ids_are_ref_ids = false 
)

Get all glossary ids.

Returns
int[]

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

441 : array {
442 global $DIC;
443
444 $tree = $DIC->repositoryTree();
445
446 if ($this->isVirtual()) {
447 $glo_ids = array();
448
449 $virtual_mode = $this->getRefId() ? $this->getVirtualMode() : '';
450 if ($virtual_mode === "coll") {
451 $glo_ids = $this->getGlossariesForCollection();
452 if ($ids_are_ref_ids) {
453 $glo_ref_ids = [];
454 foreach ($glo_ids as $obj_id) {
455 $glo_ref_ids[] = current(ilObject::_getAllReferences($obj_id));
456 }
457 $glo_ids = $glo_ref_ids;
458 }
459 }
460 if (!$a_include_offline_childs) {
461 $glo_ids = $this->removeOfflineGlossaries($glo_ids, $ids_are_ref_ids);
462 }
463 // always show entries of current glossary (if no permission is given, user will not come to the presentation screen)
464 // see bug #14477
465 if ($ids_are_ref_ids) {
466 if (!in_array($this->getRefId(), $glo_ids)) {
467 $glo_ids[] = $this->getRefId();
468 }
469 } elseif (!in_array($this->getId(), $glo_ids)) {
470 $glo_ids[] = $this->getId();
471 }
472 } elseif ($ids_are_ref_ids) {
473 $glo_ids = [$this->getRefId()];
474 } else {
475 $glo_ids = [$this->getId()];
476 }
477
478 return $glo_ids;
479 }
removeOfflineGlossaries(array $a_glo_ids, bool $ids_are_ref_ids=false)
Remove offline glossaries from obj id array.
static _getAllReferences(int $id)
get all reference ids for object ID
ilTree $tree

References ilObject\_getAllReferences(), and ILIAS\Survey\Mode\getId().

+ Here is the call graph for this function:

◆ getAutoGlossaries()

ilObjGlossary::getAutoGlossaries ( )
Returns
int[]

Definition at line 278 of file class.ilObjGlossary.php.

278 : array
279 {
281 }

◆ getDeletionDependencies()

static ilObjGlossary::getDeletionDependencies ( int  $obj_id)
static

Get deletion dependencies.

Reimplemented from ilObject.

Definition at line 520 of file class.ilObjGlossary.php.

520 : array
521 {
522 global $DIC;
523
524 $lng = $DIC->language();
525
526 $dep = array();
528 foreach ($sms as $sm) {
529 $lng->loadLanguageModule("content");
530 $dep[$sm] = $lng->txt("glo_used_in_scorm");
531 }
532 return $dep;
533 }
static getScormModulesForGlossary(int $a_glo_id)
Get SCORM modules that assign a certain glossary.

References $DIC, $lng, and ilObjSAHSLearningModule\getScormModulesForGlossary().

+ Here is the call graph for this function:

◆ getExportDirectory()

ilObjGlossary::getExportDirectory ( string  $a_type = "xml")

Definition at line 486 of file class.ilObjGlossary.php.

486 : string
487 {
488 return ilExport::_getExportDirectory($this->getId(), $a_type, $this->getType());
489 }
static _getExportDirectory(int $a_obj_id, string $a_type="xml", string $a_obj_type="", string $a_entity="")
@depricated Get export directory for an repository object

References ilExport\_getExportDirectory(), and ILIAS\Survey\Mode\getId().

+ Here is the call graph for this function:

◆ getFirstLetters()

ilObjGlossary::getFirstLetters ( int  $a_tax_node = 0)

Definition at line 426 of file class.ilObjGlossary.php.

428 : array {
429 $glo_ids = $this->getAllGlossaryIds();
430 $first_letters = ilGlossaryTerm::getFirstLetters($glo_ids, $a_tax_node);
431 return $first_letters;
432 }
static getFirstLetters(array $a_glo_id, int $a_tax_node=0)
getAllGlossaryIds(bool $a_include_offline_childs=false, bool $ids_are_ref_ids=false)
Get all glossary ids.

◆ getFlashcardsMode()

ilObjGlossary::getFlashcardsMode ( )

Definition at line 250 of file class.ilObjGlossary.php.

250 : string
251 {
253 }

◆ getGlossariesForCollection()

ilObjGlossary::getGlossariesForCollection ( )
Returns
int[]

Definition at line 360 of file class.ilObjGlossary.php.

360 : array
361 {
362 $set = $this->db->query(
363 "SELECT * FROM glossary_collection " .
364 " WHERE id = " . $this->db->quote($this->getId(), "integer")
365 );
366 $glos = [];
367 while ($rec = $this->db->fetchAssoc($set)) {
368 if (ilObject::_lookupType((int) $rec["glo_id"]) === "glo") { // #46222 (deleted glossary)
369 $glos[] = (int) $rec["glo_id"];
370 }
371 }
372
373 return $glos;
374 }

References ilObject\_lookupType(), and ILIAS\Repository\int().

+ Here is the call graph for this function:

◆ getOnline()

ilObjGlossary::getOnline ( )

Definition at line 171 of file class.ilObjGlossary.php.

171 : bool
172 {
173 return $this->online;
174 }

References $online.

◆ getPresentationMode()

ilObjGlossary::getPresentationMode ( )

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

148 : string
149 {
150 return $this->pres_mode;
151 }

References $pres_mode.

◆ getShowTaxonomy()

ilObjGlossary::getShowTaxonomy ( )

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

230 : bool
231 {
232 return $this->show_tax;
233 }

◆ getSnippetLength()

ilObjGlossary::getSnippetLength ( )

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

159 : int
160 {
161 return ($this->snippet_length > 0)
162 ? $this->snippet_length
163 : 200;
164 }

◆ getTaxonomyId()

ilObjGlossary::getTaxonomyId ( )

Definition at line 535 of file class.ilObjGlossary.php.

535 : int
536 {
537 $tax_ids = ilObjTaxonomy::getUsageOfObject($this->getId());
538 if (count($tax_ids) > 0) {
539 // glossaries handle max. one taxonomy
540 return (int) $tax_ids[0];
541 }
542 return 0;
543 }
static getUsageOfObject(int $a_obj_id, bool $a_include_titles=false)

References ILIAS\Survey\Mode\getId(), and ilObjTaxonomy\getUsageOfObject().

+ Here is the call graph for this function:

◆ getTermList()

ilObjGlossary::getTermList ( string  $searchterm = "",
string  $a_letter = "",
string  $a_def = "",
int  $a_tax_node = 0,
bool  $a_include_offline_childs = false,
bool  $a_add_amet_fields = false,
?array  $a_amet_filter = null,
bool  $a_omit_virtual = false,
bool  $a_include_references = false 
)

Definition at line 397 of file class.ilObjGlossary.php.

407 : array {
408 if ($a_omit_virtual) {
409 $glo_ref_ids[] = $this->getRefId();
410 } else {
411 $glo_ref_ids = $this->getAllGlossaryIds($a_include_offline_childs, true);
412 }
414 $glo_ref_ids,
415 $searchterm,
416 $a_letter,
417 $a_def,
418 $a_tax_node,
419 $a_add_amet_fields,
420 $a_amet_filter,
421 $a_include_references
422 );
423 return $list;
424 }

◆ getVirtualMode()

ilObjGlossary::getVirtualMode ( )

Definition at line 133 of file class.ilObjGlossary.php.

133 : string
134 {
135 return $this->virtual_mode;
136 }

References $virtual_mode.

Referenced by create().

+ Here is the caller graph for this function:

◆ isActiveFlashcards()

ilObjGlossary::isActiveFlashcards ( )

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

240 : bool
241 {
243 }

◆ isActiveGlossaryMenu()

ilObjGlossary::isActiveGlossaryMenu ( )

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

220 : bool
221 {
223 }

◆ isVirtual()

ilObjGlossary::isVirtual ( )

Definition at line 138 of file class.ilObjGlossary.php.

138 : bool
139 {
140 return $this->virtual;
141 }

References $virtual.

◆ lookup()

static ilObjGlossary::lookup ( int  $a_id,
string  $a_property 
)
staticprotected

Lookup glossary property.

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

197 : string {
198 global $DIC;
199
200 $db = $DIC->database();
201
202 $set = $db->query("SELECT $a_property FROM glossary WHERE id = " .
203 $db->quote($a_id, "integer"));
204 $rec = $db->fetchAssoc($set);
205
206 return $rec[$a_property];
207 }

◆ lookupAutoGlossaries()

static ilObjGlossary::lookupAutoGlossaries ( int  $a_id)
static

Definition at line 338 of file class.ilObjGlossary.php.

340 : array {
341 global $DIC;
342
343 $db = $DIC->database();
344
345 // read auto glossaries
346 $set = $db->query(
347 "SELECT * FROM glo_glossaries " .
348 " WHERE id = " . $db->quote($a_id, "integer")
349 );
350 $glos = array();
351 while ($rec = $db->fetchAssoc($set)) {
352 $glos[] = (int) $rec["glo_id"];
353 }
354 return $glos;
355 }

Referenced by ilGlossaryDefPage\beforePageContentUpdate().

+ Here is the caller graph for this function:

◆ lookupSnippetLength()

static ilObjGlossary::lookupSnippetLength ( int  $a_id)
static

Definition at line 209 of file class.ilObjGlossary.php.

209 : int
210 {
211 return (int) self::lookup($a_id, "snippet_length");
212 }
static lookup(int $a_id, string $a_property)
Lookup glossary property.

Referenced by ilGlossaryTerm\shortenShortText().

+ Here is the caller graph for this function:

◆ read()

ilObjGlossary::read ( )

Reimplemented from ilObject.

Definition at line 89 of file class.ilObjGlossary.php.

89 : void
90 {
91 parent::read();
92
93 $q = "SELECT * FROM glossary WHERE id = " .
94 $this->db->quote($this->getId(), "integer");
95 $gl_set = $this->db->query($q);
96 $gl_rec = $this->db->fetchAssoc($gl_set);
97 $this->setOnline(ilUtil::yn2tf($gl_rec["is_online"]));
98 $this->setVirtualMode((string) ($gl_rec["virtual"] ?? ""));
99 $this->setActiveGlossaryMenu(ilUtil::yn2tf($gl_rec["glo_menu_active"]));
100 $this->setPresentationMode((string) $gl_rec["pres_mode"]);
101 $this->setSnippetLength((int) $gl_rec["snippet_length"]);
102 $this->setShowTaxonomy((bool) $gl_rec["show_tax"]);
103 $this->setActiveFlashcards(ilUtil::yn2tf($gl_rec["flash_active"]));
104 $this->setFlashcardsMode($gl_rec["flash_mode"]);
105
106 // read auto glossaries
107 $set = $this->db->query(
108 "SELECT * FROM glo_glossaries " .
109 " WHERE id = " . $this->db->quote($this->getId(), "integer")
110 );
111 $glos = array();
112 while ($rec = $this->db->fetchAssoc($set)) {
113 $glos[] = $rec["glo_id"];
114 }
115 $this->setAutoGlossaries($glos);
116 }
setActiveGlossaryMenu(bool $a_act_glo_menu)
setVirtualMode(string $a_mode)
setShowTaxonomy(bool $a_val)
setAutoGlossaries(array $a_val)
setFlashcardsMode(string $a_flash)
setActiveFlashcards(bool $a_flash)
setOnline(bool $a_online)

References $q, ilObject\getId(), setActiveFlashcards(), setActiveGlossaryMenu(), setAutoGlossaries(), setFlashcardsMode(), setOnline(), setPresentationMode(), setShowTaxonomy(), setSnippetLength(), setVirtualMode(), and ilUtil\yn2tf().

+ Here is the call graph for this function:

◆ removeAutoGlossary()

ilObjGlossary::removeAutoGlossary ( int  $a_glo_id)

Definition at line 283 of file class.ilObjGlossary.php.

285 : void {
286 $glo_ids = array();
287 foreach ($this->getAutoGlossaries() as $g) {
288 if ($g != $a_glo_id) {
289 $glo_ids[] = $g;
290 }
291 }
292 $this->setAutoGlossaries($glo_ids);
293 }

◆ removeGlossaryFromCollection()

ilObjGlossary::removeGlossaryFromCollection ( int  $glo_id)

Definition at line 388 of file class.ilObjGlossary.php.

388 : void
389 {
390 $this->db->manipulate(
391 "DELETE FROM glossary_collection WHERE " .
392 " id = " . $this->db->quote($this->getId(), "integer") .
393 " AND glo_id = " . $this->db->quote($glo_id, "integer")
394 );
395 }

◆ removeOfflineGlossaries()

ilObjGlossary::removeOfflineGlossaries ( array  $a_glo_ids,
bool  $ids_are_ref_ids = false 
)

Remove offline glossaries from obj id array.

Definition at line 622 of file class.ilObjGlossary.php.

625 : array {
626 $glo_ids = $a_glo_ids;
627 if ($ids_are_ref_ids) {
628 $glo_ids = array_map(static function ($id): int {
630 }, $a_glo_ids);
631 }
632
633 $set = $this->db->query(
634 "SELECT id FROM glossary " .
635 " WHERE " . $this->db->in("id", $glo_ids, false, "integer") .
636 " AND is_online = " . $this->db->quote("y", "text")
637 );
638 $online_glo_ids = array();
639 while ($rec = $this->db->fetchAssoc($set)) {
640 $online_glo_ids[] = $rec["id"];
641 }
642
643 if (!$ids_are_ref_ids) {
644 return $online_glo_ids;
645 }
646
647 $online_ref_ids = array_filter($a_glo_ids, static function ($ref_id) use ($online_glo_ids): bool {
648 return in_array(ilObject::_lookupObjectId($ref_id), $online_glo_ids);
649 });
650
651
652 return $online_ref_ids;
653 }
static _lookupObjectId(int $ref_id)

References $id, and ilObject\_lookupObjectId().

+ Here is the call graph for this function:

◆ setActiveFlashcards()

ilObjGlossary::setActiveFlashcards ( bool  $a_flash)

Definition at line 235 of file class.ilObjGlossary.php.

235 : void
236 {
237 $this->flashcards_active = $a_flash;
238 }

Referenced by read().

+ Here is the caller graph for this function:

◆ setActiveGlossaryMenu()

ilObjGlossary::setActiveGlossaryMenu ( bool  $a_act_glo_menu)

Definition at line 215 of file class.ilObjGlossary.php.

215 : void
216 {
217 $this->glo_menu_active = $a_act_glo_menu;
218 }

Referenced by read().

+ Here is the caller graph for this function:

◆ setAutoGlossaries()

ilObjGlossary::setAutoGlossaries ( array  $a_val)
Parameters
int[]$a_val

Definition at line 258 of file class.ilObjGlossary.php.

260 : void {
261 $this->auto_glossaries = array();
262 foreach ($a_val as $v) {
263 $this->addAutoGlossary($v);
264 }
265 }
addAutoGlossary(int $glo_id)

Referenced by read().

+ Here is the caller graph for this function:

◆ setFlashcardsMode()

ilObjGlossary::setFlashcardsMode ( string  $a_flash)

Definition at line 245 of file class.ilObjGlossary.php.

245 : void
246 {
247 $this->flashcards_mode = $a_flash;
248 }

Referenced by read().

+ Here is the caller graph for this function:

◆ setOnline()

ilObjGlossary::setOnline ( bool  $a_online)

Definition at line 166 of file class.ilObjGlossary.php.

166 : void
167 {
168 $this->online = $a_online;
169 }

Referenced by read().

+ Here is the caller graph for this function:

◆ setPresentationMode()

ilObjGlossary::setPresentationMode ( string  $a_val)

Definition at line 143 of file class.ilObjGlossary.php.

143 : void
144 {
145 $this->pres_mode = $a_val;
146 }

Referenced by create(), and read().

+ Here is the caller graph for this function:

◆ setShowTaxonomy()

ilObjGlossary::setShowTaxonomy ( bool  $a_val)

Definition at line 225 of file class.ilObjGlossary.php.

225 : void
226 {
227 $this->show_tax = $a_val;
228 }

Referenced by read().

+ Here is the caller graph for this function:

◆ setSnippetLength()

ilObjGlossary::setSnippetLength ( int  $a_val)

Set definition snippet length (in overview)

Definition at line 154 of file class.ilObjGlossary.php.

154 : void
155 {
156 $this->snippet_length = $a_val;
157 }

Referenced by create(), and read().

+ Here is the caller graph for this function:

◆ setVirtualMode()

ilObjGlossary::setVirtualMode ( string  $a_mode)

Definition at line 118 of file class.ilObjGlossary.php.

118 : void
119 {
120 switch ($a_mode) {
121 case "coll":
122 $this->virtual_mode = $a_mode;
123 $this->virtual = true;
124 break;
125
126 default:
127 $this->virtual_mode = "none";
128 $this->virtual = false;
129 break;
130 }
131 }

Referenced by read().

+ Here is the caller graph for this function:

◆ supportsLongTextQuery()

ilObjGlossary::supportsLongTextQuery ( )

Is long text search supported.

Definition at line 704 of file class.ilObjGlossary.php.

704 : bool
705 {
706 return true;
707 }

◆ update()

ilObjGlossary::update ( )

Reimplemented from ilObject.

Definition at line 295 of file class.ilObjGlossary.php.

295 : bool
296 {
297 $this->updateMetaData();
298
299 $this->db->update(
300 'glossary',
301 array(
302 'is_online' => array('text', ilUtil::tf2yn($this->getOnline())),
303 'virtual' => array('text', $this->getVirtualMode()),
304 'glo_menu_active' => array('text', ilUtil::tf2yn($this->isActiveGlossaryMenu())),
305 'pres_mode' => array('text', $this->getPresentationMode()),
306 'show_tax' => array('integer', $this->getShowTaxonomy()),
307 'snippet_length' => array('integer', $this->getSnippetLength()),
308 'flash_active' => array('text', ilUtil::tf2yn($this->isActiveFlashcards())),
309 'flash_mode' => array('text', $this->getFlashcardsMode())
310 ),
311 array(
312 'id' => array('integer', $this->getId())
313 )
314 );
315
316 $this->updateAutoGlossaries();
317 return parent::update();
318 }
static tf2yn(bool $a_tf)

References ILIAS\Survey\Mode\getId(), and ilUtil\tf2yn().

+ Here is the call graph for this function:

◆ updateAutoGlossaries()

ilObjGlossary::updateAutoGlossaries ( )

Definition at line 320 of file class.ilObjGlossary.php.

320 : void
321 {
322 // update auto glossaries
323 $this->db->manipulate(
324 "DELETE FROM glo_glossaries WHERE " .
325 " id = " . $this->db->quote($this->getId(), "integer")
326 );
327 foreach ($this->getAutoGlossaries() as $glo_id) {
328 $this->db->insert(
329 'glo_glossaries',
330 array(
331 'id' => array('integer', $this->getId()),
332 'glo_id' => array('integer', $glo_id)
333 )
334 );
335 }
336 }

References ILIAS\Survey\Mode\getId().

Referenced by create().

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

Field Documentation

◆ $auto_glossaries

array ilObjGlossary::$auto_glossaries = array()

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

◆ $content_style_domain

ILIAS Style Content DomainService ilObjGlossary::$content_style_domain
protected

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

◆ $file_ids

array ilObjGlossary::$file_ids = []
protected

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

◆ $flashcards_active

bool ilObjGlossary::$flashcards_active = false
protected

Definition at line 37 of file class.ilObjGlossary.php.

◆ $flashcards_mode

string ilObjGlossary::$flashcards_mode = ""
protected

Definition at line 38 of file class.ilObjGlossary.php.

◆ $glo_menu_active

bool ilObjGlossary::$glo_menu_active = false
protected

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

◆ $mob_ids

array ilObjGlossary::$mob_ids = []
protected

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

◆ $online

bool ilObjGlossary::$online = false
protected

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

Referenced by getOnline().

◆ $page_object

ilGlossaryDefPage ilObjGlossary::$page_object
protected

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

◆ $pres_mode

string ilObjGlossary::$pres_mode = ""
protected

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

Referenced by getPresentationMode().

◆ $show_tax

bool ilObjGlossary::$show_tax = false
protected

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

◆ $snippet_length

int ilObjGlossary::$snippet_length = 0
protected

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

◆ $style_id

int ilObjGlossary::$style_id = 0
protected

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

◆ $term_manager

ILIAS Glossary Term TermManager ilObjGlossary::$term_manager
protected

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

◆ $tpl

ilGlobalTemplateInterface ilObjGlossary::$tpl
protected

Definition at line 39 of file class.ilObjGlossary.php.

◆ $user

ilObjUser ilObjGlossary::$user
protected

Definition at line 41 of file class.ilObjGlossary.php.

◆ $virtual

bool ilObjGlossary::$virtual = false
protected

Definition at line 35 of file class.ilObjGlossary.php.

Referenced by isVirtual().

◆ $virtual_mode

string ilObjGlossary::$virtual_mode = ""
protected

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

Referenced by getVirtualMode().


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