ILIAS  release_8 Revision v8.24
class.ilGlossaryLocatorGUI.php
Go to the documentation of this file.
1<?php
2
20
26{
29 protected ?ilGlossaryTerm $term = null;
30 protected ilCtrl $ctrl;
32
33 public string $mode;
34 public string $temp_var;
35 public ilTree $tree;
39
40 public function __construct()
41 {
42 global $DIC;
43
44 $this->ctrl = $DIC->ctrl();
45 $this->locator = $DIC["ilLocator"];
46 $lng = $DIC->language();
47 $tpl = $DIC["tpl"];
48 $tree = $DIC->repositoryTree();
49
50 $this->mode = "edit";
51 $this->temp_var = "LOCATOR";
52 $this->lng = $lng;
53 $this->tpl = $tpl;
54 $this->tree = $tree;
55 $this->presentation_request = $DIC->glossary()
56 ->internal()
57 ->gui()
58 ->presentation()
59 ->request();
60 }
61
62 public function setTemplateVariable(string $a_temp_var): void
63 {
64 $this->temp_var = $a_temp_var;
65 }
66
67 public function setTerm(ilGlossaryTerm $a_term): void
68 {
69 $this->term = $a_term;
70 }
71
72 public function setGlossary(ilObjGlossary $a_glossary): void
73 {
74 $this->glossary = $a_glossary;
75 }
76
77 public function setDefinition(ilGlossaryDefinition $a_def): void
78 {
79 $this->definition = $a_def;
80 }
81
82 public function setMode(string $a_mode): void
83 {
84 $this->mode = $a_mode;
85 }
86
90 public function display(): void
91 {
92 $ilCtrl = $this->ctrl;
93 $ilLocator = $this->locator;
95
96 // repository links
97 $ilLocator->addRepositoryItems();
98
99 // glossary link
100 $title = $this->glossary->getTitle();
101 if ($this->mode == "edit") {
102 $link = $ilCtrl->getLinkTargetByClass("ilobjglossarygui", "listTerms");
103 } else {
104 $ilCtrl->setParameterByClass("ilglossarypresentationgui", "term_id", "");
105 $link = $ilCtrl->getLinkTargetByClass("ilglossarypresentationgui");
106 if (is_object($this->term)) {
107 $ilCtrl->setParameterByClass("ilglossarypresentationgui", "term_id", $this->term->getId());
108 }
109 }
110 $ilLocator->addItem($title, $link, "");
111
112 if (is_object($this->term) && $this->mode != "edit") {
113 $ilCtrl->setParameterByClass("ilglossarypresentationgui", "term_id", $this->term->getId());
114 $ilLocator->addItem(
115 $this->term->getTerm(),
116 $ilCtrl->getLinkTargetByClass("ilglossarypresentationgui", "listDefinitions")
117 );
118 $ilCtrl->setParameterByClass(
119 "ilglossarypresentationgui",
120 "term_id",
121 $this->presentation_request->getTermId()
122 );
123 }
124
125 if (is_object($this->definition)) {
126 $title = $this->term->getTerm() . " (" . $this->lng->txt("cont_definition") . " " . $this->definition->getNr() . ")";
127 if ($this->mode == "edit") {
128 $link = $ilCtrl->getLinkTargetByClass("ilglossarydefpagegui", "edit");
129 } else {
130 $ilCtrl->setParameterByClass(
131 "ilglossarypresentationgui",
132 "def",
133 $this->presentation_request->getDefinitionId()
134 );
135 $link = $ilCtrl->getLinkTargetByClass("ilglossarypresentationgui", "view");
136 }
137 $ilLocator->addItem($title, $link);
138 }
139
140 $tpl->setLocator();
141 }
142}
Class ilCtrl provides processing control methods.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
ilGlobalTemplateInterface $tpl
setTemplateVariable(string $a_temp_var)
setGlossary(ilObjGlossary $a_glossary)
ilGlossaryDefinition $definition
PresentationGUIRequest $presentation_request
setTerm(ilGlossaryTerm $a_term)
setDefinition(ilGlossaryDefinition $a_def)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
language handling
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...
global $DIC
Definition: feed.php:28
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
setLocator()
Insert locator.