46 bool $a_call_by_reference =
true
49 $this->tpl =
$DIC[
"tpl"];
51 $this->db =
$DIC->database();
52 $this->
user = $DIC->user();
55 $this->content_style_domain =
$DIC
58 $this->term_manager =
$DIC->glossary()->internal()->domain()->term($this);
63 $id = parent::create();
73 'id' => array(
'integer', $this->
getId()),
74 'is_online' => array(
'text',
'n'),
76 'pres_mode' => array(
'text',
'table'),
77 'snippet_length' => array(
'integer', 200)
89 public function read(): void
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);
107 $set = $this->db->query(
108 "SELECT * FROM glo_glossaries " .
109 " WHERE id = " . $this->db->quote($this->getId(),
"integer")
112 while ($rec = $this->db->fetchAssoc($set)) {
113 $glos[] = $rec[
"glo_id"];
122 $this->virtual_mode = $a_mode;
123 $this->
virtual =
true;
127 $this->virtual_mode =
"none";
128 $this->
virtual =
false;
145 $this->pres_mode = $a_val;
156 $this->snippet_length = $a_val;
161 return ($this->snippet_length > 0)
162 ? $this->snippet_length
168 $this->online = $a_online;
183 $q =
"SELECT is_online FROM glossary WHERE id = " .
200 $db =
$DIC->database();
202 $set = $db->query(
"SELECT $a_property FROM glossary WHERE id = " .
203 $db->quote($a_id,
"integer"));
204 $rec = $db->fetchAssoc($set);
206 return $rec[$a_property];
211 return (
int) self::lookup($a_id,
"snippet_length");
217 $this->glo_menu_active = $a_act_glo_menu;
222 return $this->glo_menu_active;
227 $this->show_tax = $a_val;
232 return $this->show_tax;
237 $this->flashcards_active = $a_flash;
242 return $this->flashcards_active;
247 $this->flashcards_mode = $a_flash;
252 return $this->flashcards_mode;
261 $this->auto_glossaries = array();
262 foreach ($a_val as $v) {
263 $this->addAutoGlossary($v);
270 !in_array($glo_id, $this->auto_glossaries)) {
271 $this->auto_glossaries[] = $glo_id;
280 return $this->auto_glossaries;
287 foreach ($this->getAutoGlossaries() as $g) {
288 if ($g != $a_glo_id) {
292 $this->setAutoGlossaries($glo_ids);
297 $this->updateMetaData();
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())
312 'id' => array(
'integer', $this->
getId())
316 $this->updateAutoGlossaries();
317 return parent::update();
323 $this->db->manipulate(
324 "DELETE FROM glo_glossaries WHERE " .
325 " id = " . $this->db->quote($this->getId(),
"integer")
327 foreach ($this->getAutoGlossaries() as $glo_id) {
331 'id' => array(
'integer', $this->
getId()),
332 'glo_id' => array(
'integer', $glo_id)
343 $db =
$DIC->database();
347 "SELECT * FROM glo_glossaries " .
348 " WHERE id = " . $db->quote($a_id,
"integer")
351 while ($rec = $db->fetchAssoc($set)) {
352 $glos[] = (
int) $rec[
"glo_id"];
362 $set = $this->db->query(
363 "SELECT * FROM glossary_collection " .
364 " WHERE id = " . $this->db->quote($this->getId(),
"integer")
367 while ($rec = $this->db->fetchAssoc($set)) {
368 $glos[] = (
int) $rec[
"glo_id"];
377 "glossary_collection",
379 "id" => [
"integer", $this->
getId()],
380 "glo_id" => [
"integer", $glo_id]
388 $this->db->manipulate(
389 "DELETE FROM glossary_collection WHERE " .
390 " id = " . $this->db->quote($this->getId(),
"integer") .
391 " AND glo_id = " . $this->db->quote($glo_id,
"integer")
396 string $searchterm =
"",
397 string $a_letter =
"",
400 bool $a_include_offline_childs =
false,
401 bool $a_add_amet_fields =
false,
402 ?array $a_amet_filter =
null,
403 bool $a_omit_virtual =
false,
404 bool $a_include_references =
false
406 if ($a_omit_virtual) {
407 $glo_ref_ids[] = $this->getRefId();
409 $glo_ref_ids = $this->getAllGlossaryIds($a_include_offline_childs,
true);
419 $a_include_references
427 $glo_ids = $this->getAllGlossaryIds();
429 return $first_letters;
437 bool $a_include_offline_childs =
false,
438 bool $ids_are_ref_ids =
false
442 $tree =
$DIC->repositoryTree();
444 if ($this->isVirtual()) {
447 $virtual_mode = $this->getRefId() ? $this->getVirtualMode() :
'';
448 if ($virtual_mode ===
"coll") {
449 $glo_ids = $this->getGlossariesForCollection();
450 if ($ids_are_ref_ids) {
452 foreach ($glo_ids as $obj_id) {
455 $glo_ids = $glo_ref_ids;
458 if (!$a_include_offline_childs) {
459 $glo_ids = $this->removeOfflineGlossaries($glo_ids, $ids_are_ref_ids);
463 if ($ids_are_ref_ids) {
464 if (!in_array($this->getRefId(), $glo_ids)) {
465 $glo_ids[] = $this->getRefId();
467 } elseif (!in_array($this->
getId(), $glo_ids)) {
468 $glo_ids[] = $this->
getId();
470 } elseif ($ids_are_ref_ids) {
471 $glo_ids = [$this->getRefId()];
473 $glo_ids = [$this->
getId()];
489 public function delete():
bool
492 if (!parent::delete()) {
497 if (!$this->isVirtual()) {
498 $terms = $this->getTermList();
499 foreach ($terms as $term) {
500 $this->term_manager->deleteTerm((
int) $term[
"id"]);
509 $q =
"DELETE FROM glossary WHERE id = " . $this->db->quote($this->
getId());
510 $this->db->query(
$q);
513 $this->deleteMetaData();
526 foreach ($sms as $sm) {
527 $lng->loadLanguageModule(
"content");
528 $dep[$sm] =
$lng->txt(
"glo_used_in_scorm");
536 if (count($tax_ids) > 0) {
538 return (
int) $tax_ids[0];
546 $new_obj = parent::cloneObject($target_id, $copy_id, $omit_tree);
547 $this->cloneMetaData($new_obj);
556 if (!$cp_options->isRootNode($this->getRefId())) {
557 $new_obj->setOnline($this->getOnline());
561 $new_obj->setDescription($this->getDescription());
562 $new_obj->setVirtualMode($this->getVirtualMode());
563 $new_obj->setPresentationMode($this->getPresentationMode());
564 $new_obj->setSnippetLength($this->getSnippetLength());
565 $new_obj->setAutoGlossaries($this->getAutoGlossaries());
566 $new_obj->setActiveFlashcards($this->isActiveFlashcards());
567 $new_obj->setFlashcardsMode($this->getFlashcardsMode());
571 $this->content_style_domain->styleForRefId($this->getRefId())->cloneTo($new_obj->getId());
574 if (($tax_id = $this->getTaxonomyId()) > 0) {
577 $new_tax = $tax->cloneObject(0, 0,
true);
578 $map = $tax->getNodeMapping();
584 $new_tax_ass =
new ilTaxNodeAssignment(
"glo", $new_obj->getId(),
"term", $new_tax->getId());
588 $term_mappings = array();
591 $term_mappings[$term[
"id"]] = $new_term_id;
595 $assignmts = $tax_ass->getAssignmentsOfItem($term[
"id"]);
596 foreach ($assignmts as
$a) {
597 if ($map[
$a[
"node_id"]] > 0) {
598 $new_tax_ass->addAssignment($map[
$a[
"node_id"]], $new_term_id);
605 if (!empty($term_mappings)) {
606 $cp_options->appendMapping($this->getRefId() .
'_glo_terms', $term_mappings);
610 foreach ($this->getGlossariesForCollection() as $glo_id) {
611 $new_obj->addGlossaryForCollection($glo_id);
622 bool $ids_are_ref_ids =
false
624 $glo_ids = $a_glo_ids;
625 if ($ids_are_ref_ids) {
626 $glo_ids = array_map(
static function (
$id):
int {
631 $set = $this->db->query(
632 "SELECT id FROM glossary " .
633 " WHERE " . $this->db->in(
"id", $glo_ids,
false,
"integer") .
634 " AND is_online = " . $this->db->quote(
"y",
"text")
636 $online_glo_ids = array();
637 while ($rec = $this->db->fetchAssoc($set)) {
638 $online_glo_ids[] = $rec[
"id"];
641 if (!$ids_are_ref_ids) {
642 return $online_glo_ids;
645 $online_ref_ids = array_filter($a_glo_ids,
static function (
$ref_id) use ($online_glo_ids):
bool {
650 return $online_ref_ids;
659 if ($a_sub_type ==
"term") {
660 $lng->loadLanguageModule(
"glo");
678 $found_pages = array();
679 foreach ($source_terms as $source_term) {
681 $c = $pg->getXMLContent();
682 foreach ($terms as $t) {
683 if (is_int(stripos(
$c, $t[
"term"]))) {
684 $found_pages[$source_term[
"id"]][
"terms"][] = $t;
685 if (!isset($found_pages[$source_term[
"id"]][
"page"])) {
686 $found_pages[$source_term[
"id"]][
"page"] = $pg;
694 foreach ($found_pages as
$id => $fp) {
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
static _getInstance(int $a_copy_id)
static _createExportDirectory(int $a_obj_id, string $a_export_type="xml", string $a_obj_type="")
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
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...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static _lookGlossaryTerm(int $term_id)
get glossary term
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 getFirstLetters(array $a_glo_id, int $a_tax_node=0)
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...
setSnippetLength(int $a_val)
Set definition snippet length (in overview)
static getAdvMDSubItemTitle(int $a_obj_id, string $a_sub_type, int $a_sub_id)
static lookupAutoGlossaries(int $a_id)
ILIAS Style Content DomainService $content_style_domain
static lookupSnippetLength(int $a_id)
removeAutoGlossary(int $a_glo_id)
ilGlossaryDefPage $page_object
getAllGlossaryIds(bool $a_include_offline_childs=false, bool $ids_are_ref_ids=false)
Get all glossary ids.
supportsLongTextQuery()
Is long text search supported.
setActiveGlossaryMenu(bool $a_act_glo_menu)
addGlossaryForCollection(int $glo_id)
setVirtualMode(string $a_mode)
getFirstLetters(int $a_tax_node=0)
setShowTaxonomy(bool $a_val)
ilGlobalTemplateInterface $tpl
ILIAS Glossary Term TermManager $term_manager
setPresentationMode(string $a_val)
removeOfflineGlossaries(array $a_glo_ids, bool $ids_are_ref_ids=false)
Remove offline glossaries from obj id array.
__construct(int $a_id=0, bool $a_call_by_reference=true)
cloneObject(int $target_id, int $copy_id=0, bool $omit_tree=false)
static getDeletionDependencies(int $obj_id)
Get deletion dependencies.
createExportDirectory(string $a_type="xml")
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)
setAutoGlossaries(array $a_val)
addAutoGlossary(int $glo_id)
static _lookupOnline(int $a_id)
removeGlossaryFromCollection(int $glo_id)
create(bool $a_upload=false)
setFlashcardsMode(string $a_flash)
autoLinkGlossaryTerms(int $a_glo_ref_id)
Auto link glossary terms.
setActiveFlashcards(bool $a_flash)
getGlossariesForCollection()
setOnline(bool $a_online)
static lookup(int $a_id, string $a_property)
Lookup glossary property.
getExportDirectory(string $a_type="xml")
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)
static saveUsage(int $a_tax_id, int $a_obj_id)
Class ilObject Basic functions for all objects.
static _lookupObjectId(int $ref_id)
static _lookupType(int $id, bool $reference=false)
static _getAllReferences(int $id)
get all reference ids for object ID
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...
static yn2tf(string $a_yn)
quote($value, string $type)
query(string $query)
Run a (read-only) Query on the database.
fetchAssoc(ilDBStatement $statement)
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
$a
thx to https://mlocati.github.io/php-cs-fixer-configurator for the examples
if(!file_exists('../ilias.ini.php'))