3 declare(strict_types=1);
42 protected Presentation\PresentationGUIRequest
$request;
43 protected Presentation\PresentationManager
$manager;
55 $this->
ctrl = $DIC->ctrl();
56 $this->
user = $DIC->user();
57 $this->
lng = $DIC->language();
58 $this->tpl = $DIC->ui()->mainTemplate();
59 $this->tabs_gui = $DIC->tabs();
60 $this->nav_history = $DIC[
"ilNavigationHistory"];
61 $this->ui_fac = $DIC->ui()->factory();
62 $this->ui_ren = $DIC->ui()->renderer();
63 $this->parent_obj = $parent_object;
67 $this->request = $DIC->glossary()
72 $this->manager = $DIC->glossary()
75 ->presentation($this->glossary);
76 $this->filter_service = $DIC->uiService()->filter();
77 $this->content_style = $DIC->contentStyle();
82 $next_class = $this->
ctrl->getNextClass($this);
83 $cmd = $this->
ctrl->getCmd();
85 switch ($next_class) {
87 $cmd = $this->
ctrl->getCmd(
"show");
95 if ($this->request->getPageLength() === -1) {
96 $page_length = (
int) $this->
user->getPref(
"hits_per_page") ?: 9999;
97 $this->manager->setSessionPageLength($page_length);
98 } elseif ($this->request->getPageLength() > 0) {
99 $page_length = $this->request->getPageLength();
100 $this->manager->setSessionPageLength($page_length);
101 } elseif ($this->manager->getSessionPageLength() > 0) {
102 $page_length = $this->manager->getSessionPageLength();
104 $page_length = (
int) $this->
user->getPref(
"hits_per_page") ?: 9999;
112 $this->
ctrl->setParameter($this,
"term_id",
"");
113 $this->tabs_gui->activateTab(
"terms");
115 $this->nav_history->addItem(
116 $this->glossary->getRefId(),
117 $this->
ctrl->getLinkTargetByClass(
"ilGlossaryPresentationGUI",
"listTerms"),
121 $this->content_style->gui()->addCss(
123 $this->glossary->getRefId()
127 $this->filter_data = $this->filter_service->getData($filter);
128 $this->manager->setSessionLetter($this->filter_data[
"letter"] ??
"");
132 $this->tpl->setContent($this->ui_ren->render([$filter, $panel]));
133 $this->tpl->setPermanentLink(
"glo", $this->glossary->getRefId());
138 $first_letters = $this->glossary->getFirstLetters($this->tax_node);
140 if (!empty($session_letter) && !in_array($session_letter, $first_letters)) {
141 $first_letters[$session_letter] = $session_letter;
144 $filter = $this->filter_service->standard(
145 self::class .
"_filter_" . $this->glossary->getRefId(),
146 $this->
ctrl->getLinkTarget($this,
"show"),
148 "letter" => $this->ui_fac->input()->field()->select(
149 $this->
lng->txt(
"glo_term_letter"),
152 "term" => $this->ui_fac->input()->field()->text($this->
lng->txt(
"cont_term")),
153 "definition" => $this->ui_fac->input()->field()->text($this->
lng->txt(
"cont_definition"))
169 $terms = $this->glossary->getTermList(
170 $this->filter_data[
"term"] ??
"",
171 $this->filter_data[
"letter"] ??
"",
172 $this->filter_data[
"definition"] ??
"",
181 $terms_sliced = array_slice(
183 $this->request->getCurrentPage() * $page_length,
188 foreach ($terms_sliced as $term) {
189 $subs[] = $this->ui_fac->panel()->sub(
191 $this->ui_fac->legacy($this->parent_obj->listDefinitions(
192 $this->request->getRefId(),
202 $panel = $this->ui_fac->panel()->standard($this->
lng->txt(
"cont_terms"), $subs);
203 if (!$this->offline) {
204 $pagination = $this->ui_fac->viewControl()->pagination()
206 $this->
ctrl->getLinkTarget($this,
"show"),
209 ->withTotalEntries(count($terms))
210 ->withPageSize($page_length)
211 ->withMaxPaginationButtons(5)
212 ->withCurrentPage($this->request->getCurrentPage());
217 ->withViewControls([$pagination])
218 ->withActions($dropdown);
226 $hpp = ($this->
user->getPref(
"hits_per_page") != 9999)
227 ? $this->
user->getPref(
"hits_per_page")
228 : $this->
lng->txt(
"no_limit");
230 $terms_per_page_sel = [-1 => $this->
lng->txt(
"default") .
" (" . $hpp .
")", 5 =>
"5", 10 =>
"10",
231 15 =>
"15", 20 =>
"20", 30 =>
"30", 40 =>
"40", 50 =>
"50", 100 =>
"100"];
233 foreach ($terms_per_page_sel as $count => $count_text) {
234 $this->
ctrl->setParameter($this->parent_obj,
"page_length", $count);
235 $items[] = $this->ui_fac->button()->shy($count_text, $this->
ctrl->getLinkTarget($this,
"show"));
236 $this->
ctrl->setParameter($this->parent_obj,
"page_length",
"");
238 $dropdown = $this->ui_fac->dropdown()->standard($items)
239 ->withLabel($page_length .
" " . $this->
lng->txt(
"glo_terms_per_page"));
247 $panel_html = $this->ui_ren->render($panel);
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 stripSlashes(string $a_str, bool $a_strip_html=true, string $a_allow="")
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
ilGlobalTemplateInterface $tpl
Presentation PresentationManager $manager
ILIAS Style Content Service $content_style
ilUIFilterService $filter_service
initDropdown(int $page_length)
__construct( $parent_object, ilObjGlossary $glossary, bool $offline, int $tax_node=0,)
ilNavigationHistory $nav_history
Last visited history for repository items.
initPanel(int $page_length=0)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Presentation PresentationGUIRequest $request
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...