48 bool $a_call_by_reference =
true 51 $this->tpl = $DIC[
"tpl"];
53 $this->db = $DIC->database();
54 $this->
user = $DIC->user();
57 $this->content_style_domain = $DIC
60 $this->term_manager = $DIC->glossary()->internal()->domain()->term($this);
65 $id = parent::create();
75 'id' => array(
'integer', $this->
getId()),
76 'is_online' => array(
'text',
'n'),
78 'pres_mode' => array(
'text',
'table'),
79 'snippet_length' => array(
'integer', 200)
91 public function read(): void
95 $q =
"SELECT * FROM glossary WHERE id = " .
96 $this->db->quote($this->
getId(),
"integer");
97 $gl_set = $this->db->query(
$q);
98 $gl_rec = $this->db->fetchAssoc($gl_set);
101 if (isset($gl_rec[
"public_xml_file"]) && $gl_rec[
"public_xml_file"] !=
"") {
104 if (isset($gl_rec[
"public_html_file"]) && $gl_rec[
"public_html_file"] !=
"") {
116 $set = $this->db->query(
117 "SELECT * FROM glo_glossaries " .
118 " WHERE id = " . $this->db->quote($this->getId(),
"integer")
121 while ($rec = $this->db->fetchAssoc($set)) {
122 $glos[] = $rec[
"glo_id"];
131 $this->virtual_mode = $a_mode;
132 $this->
virtual =
true;
136 $this->virtual_mode =
"none";
137 $this->
virtual =
false;
154 $this->pres_mode = $a_val;
165 $this->snippet_length = $a_val;
170 return ($this->snippet_length > 0)
171 ? $this->snippet_length
177 $this->online = $a_online;
190 $db = $DIC->database();
192 $q =
"SELECT is_online FROM glossary WHERE id = " .
209 $db = $DIC->database();
211 $set =
$db->
query(
"SELECT $a_property FROM glossary WHERE id = " .
215 return $rec[$a_property];
220 return (
int) self::lookup($a_id,
"snippet_length");
226 $this->glo_menu_active = $a_act_glo_menu;
236 $this->downloads_active = $a_down;
246 $this->show_tax = $a_val;
256 $this->flashcards_active = $a_flash;
266 $this->flashcards_mode = $a_flash;
280 $this->auto_glossaries = array();
281 foreach ($a_val as $v) {
289 !in_array($glo_id, $this->auto_glossaries)) {
290 $this->auto_glossaries[] = $glo_id;
307 if ($g != $a_glo_id) {
334 'id' => array(
'integer', $this->
getId())
339 return parent::update();
345 $this->db->manipulate(
346 "DELETE FROM glo_glossaries WHERE " .
347 " id = " . $this->db->quote($this->getId(),
"integer")
353 'id' => array(
'integer', $this->
getId()),
354 'glo_id' => array(
'integer', $glo_id)
365 $db = $DIC->database();
369 "SELECT * FROM glo_glossaries " .
370 " WHERE id = " .
$db->
quote($a_id,
"integer")
374 $glos[] = (
int) $rec[
"glo_id"];
384 $set = $this->db->query(
385 "SELECT * FROM glossary_collection " .
386 " WHERE id = " . $this->db->quote($this->getId(),
"integer")
389 while ($rec = $this->db->fetchAssoc($set)) {
390 $glos[] = (
int) $rec[
"glo_id"];
399 "glossary_collection",
401 "id" => [
"integer", $this->
getId()],
402 "glo_id" => [
"integer", $glo_id]
410 $this->db->manipulate(
411 "DELETE FROM glossary_collection WHERE " .
412 " id = " . $this->db->quote($this->getId(),
"integer") .
413 " AND glo_id = " . $this->db->quote($glo_id,
"integer")
418 string $searchterm =
"",
419 string $a_letter =
"",
422 bool $a_include_offline_childs =
false,
423 bool $a_add_amet_fields =
false,
424 ?array $a_amet_filter =
null,
425 bool $a_omit_virtual =
false,
426 bool $a_include_references =
false 428 if ($a_omit_virtual) {
441 $a_include_references
451 return $first_letters;
459 bool $a_include_offline_childs =
false,
460 bool $ids_are_ref_ids =
false 464 $tree = $DIC->repositoryTree();
470 if ($virtual_mode ===
"coll") {
472 if ($ids_are_ref_ids) {
474 foreach ($glo_ids as $obj_id) {
477 $glo_ids = $glo_ref_ids;
480 if (!$a_include_offline_childs) {
485 if ($ids_are_ref_ids) {
486 if (!in_array($this->
getRefId(), $glo_ids)) {
489 } elseif (!in_array($this->
getId(), $glo_ids)) {
490 $glo_ids[] = $this->
getId();
492 } elseif ($ids_are_ref_ids) {
495 $glo_ids = [$this->
getId()];
520 $this->public_export_file[$a_type] = $a_file;
529 return $this->public_export_file[$a_type] ??
"";
532 public function delete():
bool 535 if (!parent::delete()) {
542 foreach ($terms as $term) {
543 $this->term_manager->deleteTerm((
int) $term[
"id"]);
552 $q =
"DELETE FROM glossary WHERE id = " . $this->db->quote($this->
getId());
553 $this->db->query(
$q);
565 $lng = $DIC->language();
569 foreach ($sms as $sm) {
571 $dep[$sm] =
$lng->
txt(
"glo_used_in_scorm");
579 if (count($tax_ids) > 0) {
581 return (
int) $tax_ids[0];
589 $new_obj = parent::cloneObject($target_id, $copy_id, $omit_tree);
599 if (!$cp_options->isRootNode($this->getRefId())) {
614 $this->content_style_domain->styleForRefId($this->
getRefId())->cloneTo($new_obj->getId());
620 $new_tax = $tax->cloneObject(0, 0,
true);
621 $map = $tax->getNodeMapping();
627 $new_tax_ass =
new ilTaxNodeAssignment(
"glo", $new_obj->getId(),
"term", $new_tax->getId());
631 $term_mappings = array();
634 $term_mappings[$term[
"id"]] = $new_term_id;
639 foreach ($assignmts as
$a) {
640 if ($map[$a[
"node_id"]] > 0) {
641 $new_tax_ass->addAssignment($map[$a[
"node_id"]], $new_term_id);
648 if (!empty($term_mappings)) {
649 $cp_options->appendMapping($this->
getRefId() .
'_glo_terms', $term_mappings);
654 $new_obj->addGlossaryForCollection($glo_id);
665 bool $ids_are_ref_ids =
false 667 $glo_ids = $a_glo_ids;
668 if ($ids_are_ref_ids) {
674 $set = $this->db->query(
675 "SELECT id FROM glossary " .
676 " WHERE " . $this->db->in(
"id", $glo_ids,
false,
"integer") .
677 " AND is_online = " . $this->db->quote(
"y",
"text")
679 $online_glo_ids = array();
680 while ($rec = $this->db->fetchAssoc($set)) {
681 $online_glo_ids[] = $rec[
"id"];
684 if (!$ids_are_ref_ids) {
685 return $online_glo_ids;
688 $online_ref_ids = array_filter($a_glo_ids,
static function (
$ref_id) use ($online_glo_ids):
bool {
693 return $online_ref_ids;
700 $lng = $DIC->language();
702 if ($a_sub_type ==
"term") {
721 $found_pages = array();
722 foreach ($source_terms as $source_term) {
724 $c = $pg->getXMLContent();
725 foreach ($terms as $t) {
726 if (is_int(stripos(
$c, $t[
"term"]))) {
727 $found_pages[$source_term[
"id"]][
"terms"][] = $t;
728 if (!isset($found_pages[$source_term[
"id"]][
"page"])) {
729 $found_pages[$source_term[
"id"]][
"page"] = $pg;
737 foreach ($found_pages as
$id => $fp) {
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
setSnippetLength(int $a_val)
Set definition snippet length (in overview)
cloneObject(int $target_id, int $copy_id=0, bool $omit_tree=false)
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)
getAllGlossaryIds(bool $a_include_offline_childs=false, bool $ids_are_ref_ids=false)
Get all glossary ids.
setAutoGlossaries(array $a_val)
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...
removeAutoGlossary(int $a_glo_id)
ilGlossaryDefPage $page_object
addGlossaryForCollection(int $glo_id)
fetchAssoc(ilDBStatement $statement)
setActiveFlashcards(bool $a_flash)
setPresentationMode(string $a_val)
static autoLinkGlossariesPage(ilPageObject $a_page, array $a_terms)
Auto link glossary of whole page.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
setOnline(bool $a_online)
static _lookupOnline(int $a_id)
static _getAllReferences(int $id)
get all reference ids for object ID
static getScormModulesForGlossary(int $a_glo_id)
Get SCORM modules that assign a certain glossary.
static getUsageOfObject(int $a_obj_id, bool $a_include_titles=false)
quote($value, string $type)
loadLanguageModule(string $a_module)
Load language module.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static getAdvMDSubItemTitle(int $a_obj_id, string $a_sub_type, int $a_sub_id)
addAutoGlossary(int $glo_id)
getGlossariesForCollection()
setActiveGlossaryMenu(bool $a_act_glo_menu)
setFlashcardsMode(string $a_flash)
static _getExportDirectory(int $a_obj_id, string $a_type="xml", string $a_obj_type="", string $a_entity="")
Get export directory for an repository object
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.
setPublicExportFile(string $a_type, string $a_file)
specify public export file for type
static _copyTerm(int $a_term_id, int $a_glossary_id)
Copy a term to a glossary.
ilGlobalTemplateInterface $tpl
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
getExportDirectory(string $a_type="xml")
create(bool $a_upload=false)
__construct(int $a_id=0, bool $a_call_by_reference=true)
cloneMetaData(ilObject $target_obj)
Copy meta data.
static _createExportDirectory(int $a_obj_id, string $a_export_type="xml", string $a_obj_type="")
getPublicExportFile(string $a_type)
get public export file
static _lookGlossaryTerm(int $term_id)
get glossary term
static _lookupObjectId(int $ref_id)
query(string $query)
Run a (read-only) Query on the database.
removeOfflineGlossaries(array $a_glo_ids, bool $ids_are_ref_ids=false)
Remove offline glossaries from obj id array.
array $public_export_file
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
getAssignmentsOfItem(int $a_item_id)
Get assignments for item.
setActiveDownloads(bool $a_down)
static saveUsage(int $a_tax_id, int $a_obj_id)
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
__construct(Container $dic, ilPlugin $plugin)
createExportDirectory(string $a_type="xml")
static lookupSnippetLength(int $a_id)
setVirtualMode(string $a_mode)
autoLinkGlossaryTerms(int $a_glo_ref_id)
Auto link glossary terms.
$a
thx to https://mlocati.github.io/php-cs-fixer-configurator for the examples
setShowTaxonomy(bool $a_val)
static yn2tf(string $a_yn)
static lookupAutoGlossaries(int $a_id)
removeGlossaryFromCollection(int $glo_id)
static _getInstance(int $a_copy_id)
static getDeletionDependencies(int $obj_id)
static _lookupType(int $id, bool $reference=false)
getFirstLetters(int $a_tax_node=0)
ILIAS Style Content DomainService $content_style_domain
static getFirstLetters(array $a_glo_id, int $a_tax_node=0)
supportsLongTextQuery()
Is long text search supported.
ILIAS Glossary Term TermManager $term_manager
static lookup(int $a_id, string $a_property)
Lookup glossary property.