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()];
510 if (!is_writable($glo_data_dir)) {
512 .
") not writeable.");
516 $glo_dir = $glo_data_dir .
"/glo_" . $this->
getId();
518 if (!is_dir($glo_dir)) {
522 $import_dir = $glo_dir .
"/import";
524 if (!is_dir($import_dir)) {
563 $this->public_export_file[$a_type] = $a_file;
572 return $this->public_export_file[$a_type] ??
"";
578 string $a_target_dir,
583 $attrs[
"Type"] =
"Glossary";
584 $a_xml_writer->
xmlStartTag(
"ContentObject", $attrs);
591 $this->mob_ids = array();
592 $this->file_ids = array();
593 foreach ($terms as $term) {
595 $this->page_object->buildDom();
596 $this->page_object->insertInstIntoIDs(
IL_INST_ID);
597 $mob_ids = $this->page_object->collectMediaObjects(
false);
599 foreach ($mob_ids as $mob_id) {
600 $this->mob_ids[$mob_id] = $mob_id;
602 foreach ($file_ids as $file_id) {
603 $this->file_ids[$file_id] = $file_id;
608 $expLog->
write(date(
"[y-m-d H:i:s] ") .
"Start Export Media Objects");
610 $expLog->
write(date(
"[y-m-d H:i:s] ") .
"Finished Export Media Objects");
613 $expLog->
write(date(
"[y-m-d H:i:s] ") .
"Start Export File Items");
615 $expLog->
write(date(
"[y-m-d H:i:s] ") .
"Finished Export File Items");
618 $expLog->
write(date(
"[y-m-d H:i:s] ") .
"Start Export Glossary Items");
620 $expLog->
write(date(
"[y-m-d H:i:s] ") .
"Finished Export Glossary Items");
622 $a_xml_writer->
xmlEndTag(
"ContentObject");
640 foreach ($terms as $term) {
641 $expLog->
write(date(
"[y-m-d H:i:s] ") .
"Page Object " . $term[
"obj_id"]);
645 $glo_term->exportXML($a_xml_writer, $a_inst);
657 $md2xml->setExportMode(
true);
658 $md2xml->startExport();
659 $a_xml_writer->
appendXML($md2xml->getXML());
665 string $a_target_dir,
668 foreach ($this->mob_ids as $mob_id) {
669 $expLog->
write(date(
"[y-m-d H:i:s] ") .
"Media Object " . $mob_id);
671 $media_obj->exportXML($a_xml_writer, $a_inst);
672 $media_obj->exportFiles($a_target_dir);
678 string $a_target_dir,
681 foreach ($this->file_ids as $file_id) {
682 $expLog->
write(date(
"[y-m-d H:i:s] ") .
"File Item " . $file_id);
683 $file_obj =
new ilObjFile($file_id,
false);
684 $file_obj->export($a_target_dir);
694 if ($a_tag ==
"Identifier" && $a_param ==
"Entry") {
700 public function delete():
bool 703 if (!parent::delete()) {
710 foreach ($terms as $term) {
711 $this->term_manager->deleteTerm((
int) $term[
"id"]);
720 $q =
"DELETE FROM glossary WHERE id = " . $this->db->quote($this->
getId());
721 $this->db->query(
$q);
732 return $glo_exp->buildExportFile();
739 $lng = $DIC->language();
743 foreach ($sms as $sm) {
745 $dep[$sm] =
$lng->
txt(
"glo_used_in_scorm");
753 if (count($tax_ids) > 0) {
755 return (
int) $tax_ids[0];
763 $new_obj = parent::cloneObject($target_id, $copy_id, $omit_tree);
773 if (!$cp_options->isRootNode($this->getRefId())) {
788 $this->content_style_domain->styleForRefId($this->
getRefId())->cloneTo($new_obj->getId());
794 $new_tax = $tax->cloneObject(0, 0,
true);
795 $map = $tax->getNodeMapping();
801 $new_tax_ass =
new ilTaxNodeAssignment(
"glo", $new_obj->getId(),
"term", $new_tax->getId());
805 $term_mappings = array();
808 $term_mappings[$term[
"id"]] = $new_term_id;
813 foreach ($assignmts as
$a) {
814 if ($map[$a[
"node_id"]] > 0) {
815 $new_tax_ass->addAssignment($map[$a[
"node_id"]], $new_term_id);
822 if (!empty($term_mappings)) {
823 $cp_options->appendMapping($this->
getRefId() .
'_glo_terms', $term_mappings);
828 $new_obj->addGlossaryForCollection($glo_id);
839 bool $ids_are_ref_ids =
false 841 $glo_ids = $a_glo_ids;
842 if ($ids_are_ref_ids) {
843 $glo_ids = array_map(
static function (
$id):
int {
848 $set = $this->db->query(
849 "SELECT id FROM glossary " .
850 " WHERE " . $this->db->in(
"id", $glo_ids,
false,
"integer") .
851 " AND is_online = " . $this->db->quote(
"y",
"text")
853 $online_glo_ids = array();
854 while ($rec = $this->db->fetchAssoc($set)) {
855 $online_glo_ids[] = $rec[
"id"];
858 if (!$ids_are_ref_ids) {
859 return $online_glo_ids;
862 $online_ref_ids = array_filter($a_glo_ids,
static function (
$ref_id) use ($online_glo_ids):
bool {
867 return $online_ref_ids;
874 $lng = $DIC->language();
876 if ($a_sub_type ==
"term") {
895 $found_pages = array();
896 foreach ($source_terms as $source_term) {
898 $c = $pg->getXMLContent();
899 foreach ($terms as $t) {
900 if (is_int(stripos(
$c, $t[
"term"]))) {
901 $found_pages[$source_term[
"id"]][
"terms"][] = $t;
902 if (!isset($found_pages[$source_term[
"id"]][
"page"])) {
903 $found_pages[$source_term[
"id"]][
"page"] = $pg;
911 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...
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)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
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.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static getUsageOfObject(int $a_obj_id, bool $a_include_titles=false)
quote($value, string $type)
exportFileItems(string $a_target_dir, ilLog $expLog)
loadLanguageModule(string $a_module)
Load language module.
appendXML(string $a_str)
append xml string to document
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
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)
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.
addAutoGlossary(int $glo_id)
getGlossariesForCollection()
setActiveGlossaryMenu(bool $a_act_glo_menu)
exportXMLMediaObjects(ilXmlWriter $a_xml_writer, int $a_inst, string $a_target_dir, ilLog $expLog)
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.
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
xmlEndTag(string $tag)
Writes an endtag.
getExportDirectory(string $a_type="xml")
static collectFileItems(ilPageObject $a_page, DOMDocument $a_domdoc)
Get all file items that are used within the page.
create(bool $a_upload=false)
__construct(int $a_id=0, bool $a_call_by_reference=true)
cloneMetaData(ilObject $target_obj)
Copy meta data.
createImportDirectory()
creates data directory for import files (data_dir/glo_data/glo_<id>/import, depending on data directo...
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)
exportXMLMetaData(ilXmlWriter $a_xml_writer)
static _createExportDirectory(int $a_obj_id, string $a_export_type="xml", string $a_obj_type="")
getPublicExportFile(string $a_type)
get public export file
static _getExportFiles(int $a_obj_id, $a_export_types="", string $a_obj_type="")
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
static getDataDir()
get data directory (outside webspace)
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)
exportXML(ilXmlWriter $a_xml_writer, int $a_inst, string $a_target_dir, ilLog $expLog)
static saveUsage(int $a_tax_id, int $a_obj_id)
createExportDirectory(string $a_type="xml")
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
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
xmlStartTag(string $tag, ?array $attrs=null, bool $empty=false, bool $encode=true, bool $escape=true)
Writes a starttag.
setShowTaxonomy(bool $a_val)
static yn2tf(string $a_yn)
static lookupAutoGlossaries(int $a_id)
removeGlossaryFromCollection(int $glo_id)
static _getInstance(int $a_copy_id)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
write(string $a_msg, $a_log_level=null)
logging
static getDeletionDependencies(int $obj_id)
getExportFiles()
Get export files.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
modifyExportIdentifier(string $a_tag, string $a_param, string $a_value)
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 makeDir(string $a_dir)
creates a new directory and inherits all filesystem permissions of the parent directory You may pass ...
static lookup(int $a_id, string $a_property)
Lookup glossary property.
exportXMLGlossaryItems(ilXmlWriter $a_xml_writer, int $a_inst, ilLog $expLog)