ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
class.ilGlossaryPresentationGUI.php
Go to the documentation of this file.
1<?php
2
26{
27 protected \ILIAS\Glossary\Taxonomy\TaxonomyManager $tax_manager;
28 protected \ILIAS\COPage\Xsl\XslManager $xsl;
29 protected \ILIAS\GlobalScreen\Services $global_screen;
30 protected \ILIAS\Glossary\InternalGUIService $gui;
31 protected array $mobs;
32 protected bool $fill_on_load_code;
33 protected string $offline_dir;
35 protected bool $offline;
36 protected string $export_format;
37 protected ilCtrl $ctrl;
42 protected \ilObjUser $user;
43 protected \ilHelpGUI $help;
44 protected \ilObjGlossary $glossary;
45 protected \ilObjGlossaryGUI $glossary_gui;
46 protected \ilGlobalTemplateInterface $tpl;
47 protected \ilLanguage $lng;
48 protected int $tax_node;
49 protected int $tax_id;
50 protected \ilObjTaxonomy $tax;
51 protected int $term_id;
52 protected int $requested_ref_id;
53 protected string $requested_letter;
55 protected string $requested_search_str;
56 protected string $requested_file_id;
57 protected int $requested_mob_id;
58 protected \ILIAS\Style\Content\Service $content_style_service;
59 protected \ILIAS\Style\Content\GUIService $content_style_gui;
60 protected \ILIAS\Style\Content\Object\ObjectFacade $content_style_domain;
61
62 public function __construct(
63 string $export_format = "",
64 string $export_dir = ""
65 ) {
66 global $DIC;
67
68 $service = $DIC->glossary()->internal();
69 $domain = $service->domain();
70
71 $this->gui = $gui = $service->gui();
72
73 $this->access = $DIC->access();
74 $this->user = $domain->user();
75 $this->lng = $DIC->language();
76
77 $this->toolbar = $gui->toolbar();
78 $this->help = $gui->help();
79 $this->nav_history = $DIC["ilNavigationHistory"];
80 $this->tpl = $gui->ui()->mainTemplate();
81 $this->ctrl = $gui->ctrl();
82 $this->tabs_gui = $gui->tabs();
83 $this->global_screen = $gui->globalScreen();
84
85 $this->export_format = $export_format;
86 $this->setOfflineDirectory($export_dir);
87 $this->offline = ($export_format !== "");
88
89 $this->ctrl->saveParameter($this, array("ref_id", "letter", "tax_node"));
90 $this->content_style_service =
91 $DIC->contentStyle();
92 $this->initByRequest();
93 $this->xsl = $DIC->copage()->internal()->domain()->xsl();
94 $this->tax_manager = $domain->taxonomy($this->glossary);
95 }
96
104 public function initByRequest(?array $query_params = null): void
105 {
106 $request = $this->gui
107 ->presentation()
108 ->request($query_params);
109
110 $this->requested_ref_id = $request->getRefId();
111 $this->term_id = $request->getTermId();
112 $this->glossary_gui = $this->gui->presentation()->ObjGlossaryGUI($this->requested_ref_id);
113 $this->glossary = $this->glossary_gui->getGlossary();
114 $this->requested_def_page_id = $request->getDefinitionPageId();
115 $this->requested_search_str = $request->getSearchString();
116 $this->requested_file_id = $request->getFileId();
117 $this->requested_mob_id = $request->getMobId();
118
119 // determine term id and check whether it is valid (belongs to
120 // current glossary or a virtual (online) sub-glossary)
121 $glo_ids = $this->glossary->getAllGlossaryIds();
122 $term_glo_id = ilGlossaryTerm::_lookGlossaryID($this->term_id);
123 if (!in_array($term_glo_id, $glo_ids) && !ilGlossaryTermReferences::isReferenced($glo_ids, $this->term_id)) {
124 if ($this->term_id > 0) {
125 throw new ilGlossaryException("Term ID does not match the glossary.");
126 }
127 $this->term_id = 0;
128 }
129
130 $this->tax_node = 0;
131 $this->tax_id = $this->glossary->getTaxonomyId();
132 if ($this->tax_id > 0 && $this->glossary->getShowTaxonomy()) {
133 $this->tax = new ilObjTaxonomy($this->tax_id);
134 }
135 $requested_tax_node = $request->getTaxNode();
136 if ($requested_tax_node > 1 && $this->tax->getTree()->readRootId() != $requested_tax_node) {
137 $this->tax_node = $requested_tax_node;
138 }
139
140 $this->requested_letter = $request->getLetter();
141
142 $this->content_style_domain = $this->content_style_service->domain()->styleForRefId($this->glossary->getRefId());
143 $this->content_style_gui = $this->content_style_service->gui();
144 }
145
147 {
148 $this->tpl = $tpl;
149 }
150
154 public function setOfflineMode(bool $a_offline = true): void
155 {
156 $this->offline = $a_offline;
157 }
158
162 public function offlineMode(): bool
163 {
164 return $this->offline;
165 }
166
167 public function setOfflineDirectory(string $a_dir): void
168 {
169 $this->offline_dir = $a_dir;
170 }
171
172 public function getOfflineDirectory(): string
173 {
174 return $this->offline_dir;
175 }
176
180 public function executeCommand(): void
181 {
183 $ilAccess = $this->access;
184
185 $lng->loadLanguageModule("content");
186
187 $next_class = $this->ctrl->getNextClass($this);
188 if ($this->glossary->isActiveFlashcards()) {
189 $cmd = $this->ctrl->getCmd("showFlashcards");
190 } else {
191 $cmd = $this->ctrl->getCmd("listTerms");
192 }
193
194 // check write permission
195 if (!$ilAccess->checkAccess("read", "", $this->requested_ref_id) &&
196 !($ilAccess->checkAccess("visible", "", $this->requested_ref_id) &&
197 ($cmd == "infoScreen" || strtolower($next_class) == "ilinfoscreengui"))) {
198 throw new ilPermissionException($lng->txt("permission_denied"));
199 }
200
201 if ($cmd != "listDefinitions") {
202 $this->prepareOutput();
203 }
204
205 switch ($next_class) {
206 case "ilnotegui":
207 $this->setTabs();
208 $ret = $this->listDefinitions();
209 break;
210
211 case "ilinfoscreengui":
212 $ret = $this->outputInfoScreen();
213 break;
214
215 case "ilpresentationfullgui":
216 $this->setTabs();
217 $this->showTaxonomy();
218 $full_gui = $this->gui->presentation()
219 ->PresentationFullGUI($this, $this->glossary, $this->offlineMode(), $this->tax_node);
220 $this->ctrl->forwardCommand($full_gui);
221 break;
222
223 case "ilpresentationtablegui":
224 $this->setTabs();
225 $this->showTaxonomy();
226 $pt_gui = $this->gui->presentation()
227 ->PresentationTableGUI($this, $this->glossary, $this->offlineMode(), $this->tax_node);
228 $this->ctrl->forwardCommand($pt_gui);
229 break;
230
231 case "ilglossarydefpagegui":
232 $page_gui = new ilGlossaryDefPageGUI($this->requested_def_page_id);
233 $this->basicPageGuiInit($page_gui);
234 $this->ctrl->forwardCommand($page_gui);
235 break;
236
237 case "ilglossaryflashcardgui":
238 $flash_gui = new ilGlossaryFlashcardGUI();
239 $this->ctrl->forwardCommand($flash_gui);
240 break;
241
242 case "ilglossaryflashcardboxgui":
243 $flash_box_gui = new ilGlossaryFlashcardBoxGUI();
244 $this->ctrl->forwardCommand($flash_box_gui);
245 break;
246
247 default:
248 $this->$cmd();
249 break;
250 }
251 $this->tpl->printToStdout();
252 }
253
254 public function prepareOutput(): void
255 {
256 $this->tpl->loadStandardTemplate();
257 $title = $this->glossary->getTitle();
258
259 $this->tpl->setTitle($title);
260 $this->tpl->setTitleIcon(ilUtil::getImagePath("standard/icon_glo.svg"));
261
262 $this->setLocator();
263 }
264
265
269 public function basicPageGuiInit(
270 \ilPageObjectGUI $a_page_gui
271 ): void {
272 $a_page_gui->setStyleId($this->content_style_domain->getEffectiveStyleId());
273 if (!$this->offlineMode()) {
274 $a_page_gui->setOutputMode("presentation");
275 $this->fill_on_load_code = true;
276 } else {
277 $a_page_gui->setOutputMode("offline");
278 $a_page_gui->setOfflineDirectory($this->getOfflineDirectory());
279 $this->fill_on_load_code = false;
280 }
281 if (!$this->offlineMode()) {
282 $this->ctrl->setParameter($this, "pg_id", $a_page_gui->getId());
283 }
284 $a_page_gui->setFileDownloadLink($this->getLink($this->requested_ref_id, "downloadFile"));
285 $a_page_gui->setFullscreenLink($this->getLink($this->requested_ref_id, "fullscreen"));
286 }
287
288 public function listTerms(): void
289 {
290 $ilNavigationHistory = $this->nav_history;
291 $ilAccess = $this->access;
293 $ilToolbar = $this->toolbar;
294 $ilCtrl = $this->ctrl;
295 $ilTabs = $this->tabs_gui;
296
297 if (!$ilAccess->checkAccess("read", "", $this->requested_ref_id)) {
298 throw new ilPermissionException($lng->txt("permission_denied"));
299 }
300
301 $ret = "";
302 if ($this->glossary->getPresentationMode() == "full_def") {
303 $this->listTermByGivenAsPanel();
304 } else {
305 if (!$this->offlineMode()) {
306 $ilNavigationHistory->addItem(
307 $this->requested_ref_id,
308 $this->ctrl->getLinkTarget($this, "listTerms"),
309 "glo"
310 );
311 }
312 $this->listTermByGivenAsTable();
313 }
314 }
315
319 public function listTermByGivenAsTable(): void
320 {
321 $ilCtrl = $this->ctrl;
322 $ilAccess = $this->access;
324 $tpl = $this->tpl;
325
326 if (!$ilAccess->checkAccess("read", "", $this->requested_ref_id)) {
327 throw new ilPermissionException($lng->txt("permission_denied"));
328 }
329
330 $ilCtrl->redirectByClass("ilPresentationTableGUI", "show");
331 }
332
336 public function listTermByGivenAsPanel(): void
337 {
338 $ilCtrl = $this->ctrl;
339
340 $ilCtrl->redirectByClass("ilPresentationFullGUI", "show");
341 }
342
343 protected function setContentStyles(): void
344 {
345 $tpl = $this->tpl;
346
347 if (!$this->offlineMode()) {
348 $this->content_style_gui->addCss($tpl, $this->glossary->getRefId());
350 } else {
351 $tpl->addCss("content.css");
352 $tpl->addCss("syntaxhighlight.css");
353 }
354 }
355
360 {
361 $pres_table = $this->gui->presentation()->PresentationTableGUI(
362 $this,
363 $this->glossary,
364 $this->offlineMode(),
365 $this->tax_node
366 );
367 return $pres_table;
368 }
369
373 public function listDefinitions(
374 int $a_ref_id = 0,
375 int $a_term_id = 0,
376 bool $a_get_html = false,
377 bool $render_term = true,
378 string $a_page_mode = ilPageObjectGUI::PRESENTATION,
379 bool $render_page_container = true
380 ): string {
381 $ilUser = $this->user;
382 $ilAccess = $this->access;
384 $tpl = $this->tpl;
385
386 if ($a_ref_id == 0) {
388 } else {
389 $ref_id = $a_ref_id;
390 }
391 if ($a_term_id == 0) {
392 $term_id = $this->term_id;
393 } else {
394 $term_id = $a_term_id;
395 }
396
397 if (!$ilAccess->checkAccess("read", "", $ref_id)) {
398 throw new ilPermissionException($lng->txt("permission_denied"));
399 }
400
401 try {
402 $term = new ilGlossaryTerm($term_id);
403 } catch (Exception $e) {
404 return "";
405 }
406
407 if (!$a_get_html) {
408 $tpl->loadStandardTemplate();
409
410 $this->setContentStyles();
411
412 if (!$this->offlineMode()) {
413 $this->setLocator();
414 }
415
416 $tpl->setTitleIcon(ilUtil::getImagePath("standard/icon_glo.svg"));
417 $tpl->setTitle($this->lng->txt("cont_term") . ": " . $term->getTerm());
418
419 // advmd block
420 $cmd = null;
421 if ($ilAccess->checkAccess("write", "", $this->requested_ref_id)) {
422 $cmd = array("edit" => $this->ctrl->getLinkTargetByClass(array("ilglossaryeditorgui", "ilobjglossarygui", "ilglossarytermgui", "ilobjectmetadatagui"), ""));
423 }
424 $mdgui = new ilObjectMetaDataGUI($this->glossary, "term", $term->getId());
425 $tpl->setRightContent($mdgui->getBlockHTML($cmd));
426 }
427
428 $def_tpl = new ilTemplate("tpl.glossary_definition_list.html", true, true, "components/ILIAS/Glossary");
429
430 if ($render_page_container) {
431 $def_tpl->touchBlock("page_container_1");
432 $def_tpl->touchBlock("page_container_2");
433 }
434
435 if ($render_term) {
436 $def_tpl->setVariable("TXT_TERM", $term->getTerm());
437 }
438 $this->mobs = array();
439
440 $page_gui = new ilGlossaryDefPageGUI($term_id);
441 $this->basicPageGuiInit($page_gui);
442 $page_gui->setGlossary($this->glossary);
443 $page_gui->setOutputMode($a_page_mode);
444 $page_gui->setStyleId($this->content_style_domain->getEffectiveStyleId());
445 $page = $page_gui->getPageObject();
446
447 // internal links
448 $page->buildDom();
449
450 if ($this->offlineMode()) {
451 $page_gui->setOutputMode("offline");
452 $page_gui->setOfflineDirectory($this->getOfflineDirectory());
453 }
454 $page_gui->setFullscreenLink($this->getLink($ref_id, "fullscreen", $term_id));
455
456 $page_gui->setTemplateOutput(false);
457 $page_gui->setRawPageContent(true);
458 if (!$this->offlineMode()) {
459 $output = $page_gui->showPage();
460 } else {
461 $output = $page_gui->presentation($page_gui->getOutputMode());
462 }
463
464 $def_tpl->setCurrentBlock("definition");
465 $def_tpl->setVariable("PAGE_CONTENT", $output);
466 $def_tpl->parseCurrentBlock();
467
468 // display possible backlinks
469 $sources = ilInternalLink::_getSourcesOfTarget('git', $this->term_id, 0);
470
471 if ($sources) {
472 $backlist_shown = false;
473 foreach ($sources as $src) {
474 $type = explode(':', $src['type']);
475
476 if ($type[0] == 'lm' && $type[1] == 'pg') {
477 $title = ilLMPageObject::_getPresentationTitle($src['id']);
478 $lm_id = ilLMObject::_lookupContObjID($src['id']);
479 $lm_title = ilObject::_lookupTitle($lm_id);
480 $def_tpl->setCurrentBlock('backlink_item');
481 $ref_ids = ilObject::_getAllReferences($lm_id);
482 $access = false;
483 foreach ($ref_ids as $rid) {
484 if ($ilAccess->checkAccess("read", "", $rid)) {
485 $access = true;
486 }
487 }
488 if ($access) {
489 $def_tpl->setCurrentBlock("backlink_item");
490 $def_tpl->setVariable("BACKLINK_LINK", ILIAS_HTTP_PATH . "/goto.php?target=" . $type[1] . "_" . $src['id']);
491 $def_tpl->setVariable("BACKLINK_ITEM", $lm_title . ": " . $title);
492 $def_tpl->parseCurrentBlock();
493 $backlist_shown = true;
494 }
495 }
496 }
497 if ($backlist_shown) {
498 $def_tpl->setCurrentBlock("backlink_list");
499 $def_tpl->setVariable("BACKLINK_TITLE", $this->lng->txt('glo_term_used_in'));
500 $def_tpl->parseCurrentBlock();
501 }
502 }
503
504 if (!$a_get_html) {
505 $tpl->setPermanentLink("git", null, $term_id . "_" . $ref_id);
506
507 // show taxonomy
508 $this->showTaxonomy();
509 }
510
511 // highlighting?
512 if ($this->requested_search_str != "" && !$this->offlineMode()) {
513 $cache = ilUserSearchCache::_getInstance($ilUser->getId());
514 $cache->switchSearchType(ilUserSearchCache::LAST_QUERY);
515 $search_string = $cache->getQuery();
516
517 $p = new ilQueryParser($search_string);
518 $p->parse();
519
520 $words = $p->getQuotedWords();
521 foreach ($words as $w) {
522 ilTextHighlighterGUI::highlight("ilGloContent", $w, $tpl);
523 }
524 $this->fill_on_load_code = true;
525 }
526 $tpl->setContent($def_tpl->get());
527 if ($this->offlineMode()) {
528 return $tpl->printToString();
529 } elseif ($a_get_html) {
530 return $def_tpl->get();
531 }
532 return "";
533 }
534
535 public function fullscreen(): string
536 {
537 $html = $this->media("fullscreen");
538 return $html;
539 }
540
544 public function media(string $a_mode = "media"): string
545 {
546 $this->tpl = new ilGlobalTemplate("tpl.fullscreen.html", true, true, "components/ILIAS/COPage");
547 $this->tpl->setVariable("LOCATION_STYLESHEET", ilUtil::getStyleSheetLocation());
548 $this->tpl->setVariable(
549 "LOCATION_CONTENT_STYLESHEET",
550 ilObjStyleSheet::getContentStylePath($this->content_style_domain->getEffectiveStyleId())
551 );
552
553 //$int_links = $page_object->getInternalLinks();
554 $med_links = ilMediaItem::_getMapAreasIntLinks($this->requested_mob_id);
555
556 // later
557 //$link_xml = $this->getLinkXML($med_links, $this->getLayoutLinkTargets());
558
559 $link_xml = "";
560
561 $media_obj = new ilObjMediaObject($this->requested_mob_id);
562
563 $xml = "<dummy>";
564 // todo: we get always the first alias now (problem if mob is used multiple
565 // times in page)
566 $xml .= $media_obj->getXML(IL_MODE_ALIAS);
567 $xml .= $media_obj->getXML(IL_MODE_OUTPUT);
568 $xml .= $link_xml;
569 $xml .= "</dummy>";
570
571 if (!$this->offlineMode()) {
572 $enlarge_path = ilUtil::getImagePath("media/enlarge.svg", false, "output");
573 $wb_path = ilFileUtils::getWebspaceDir("output") . "/";
574 } else {
575 $enlarge_path = "images/media/enlarge.svg";
576 $wb_path = "";
577 }
578
579 $mode = $a_mode;
580
581 $this->ctrl->setParameter($this, "obj_type", "MediaObject");
582 $fullscreen_link =
583 $this->getLink($this->requested_ref_id, "fullscreen");
584 $this->ctrl->clearParameters($this);
585
586 $params = array('mode' => $mode, 'enlarge_path' => $enlarge_path,
587 'link_params' => "ref_id=" . $this->requested_ref_id,'fullscreen_link' => $fullscreen_link,
588 'enable_html_mob' => ilObjMediaObject::isTypeAllowed("html") ? "y" : "n",
589 'ref_id' => $this->requested_ref_id, 'pg_frame' => "", 'webspace_path' => $wb_path);
590 $output = $this->xsl->process($xml, $params);
591
592 // unmask user html
593 $this->tpl->setVariable("MEDIA_CONTENT", $output);
594
595 $this->tpl->parseCurrentBlock();
596 if ($this->offlineMode()) {
597 $html = $this->tpl->get();
598 return $html;
599 }
600 return "";
601 }
602
603 public function setLocator(): void
604 {
605 $gloss_loc = new ilGlossaryLocatorGUI();
606 $gloss_loc->setMode("presentation");
607 if (!empty($this->term_id)) {
608 $term = new ilGlossaryTerm($this->term_id);
609 $gloss_loc->setTerm($term);
610 }
611 $gloss_loc->setGlossary($this->glossary);
612 $gloss_loc->display();
613 }
614
615 public function downloadFile(): void
616 {
617 $ilAccess = $this->access;
619
620 if (!$ilAccess->checkAccess("read", "", $this->requested_ref_id)) {
621 throw new ilPermissionException($lng->txt("permission_denied"));
622 }
623
624 $file = explode("_", $this->requested_file_id);
625 $fileObj = new ilObjFile($file[count($file) - 1], false);
626 $fileObj->sendFile();
627 exit;
628 }
629
630 public function setTabs(): void
631 {
632 $this->getTabs();
633 }
634
635 public function getLink(
636 int $a_ref_id,
637 string $a_cmd = "",
638 int $a_term_id = 0,
639 string $a_frame = "",
640 string $a_type = ""
641 ): string {
642 $link = "";
643 if ($a_cmd == "") {
644 $a_cmd = "layout";
645 }
646 //$script = "glossary_presentation.php";
647
648 // handle online links
649 if (!$this->offlineMode()) {
650 //$link = $script."?ref_id=".$a_ref_id;
651 switch ($a_cmd) {
652 case "fullscreen":
653 $this->ctrl->setParameter($this, "term_id", $a_term_id);
654 $link = $this->ctrl->getLinkTarget($this, "fullscreen");
655 break;
656
657 default:
658 $link .= "&amp;cmd=" . $a_cmd;
659 if ($a_frame != "") {
660 $this->ctrl->setParameter($this, "frame", $a_frame);
661 }
662 if ($a_type != "") {
663 $this->ctrl->setParameter($this, "obj_type", $a_type);
664 }
665 $link = $this->ctrl->getLinkTarget($this, $a_cmd);
666 break;
667 }
668 } else { // handle offline links
669 switch ($a_cmd) {
670 case "fullscreen":
671 $link = "fullscreen.html"; // id is handled by xslt
672 break;
673
674 case "glossary":
675 $link = "term_" . $a_term_id . ".html";
676 break;
677
678 case "downloadFile":
679 case "layout":
680 default:
681 break;
682 }
683 }
684 $this->ctrl->clearParameters($this);
685 return $link;
686 }
687
688 public function printViewSelection(): void
689 {
690 $ilCtrl = $this->ctrl;
691 $tpl = $this->tpl;
692 $ilTabs = $this->tabs_gui;
693
694 $this->setTabs();
695 $ilTabs->activateTab("print_view");
696
697 $this->initPrintViewSelectionForm();
698
699 $tpl->setContent($this->form->getHTML());
700 }
701
705 public function initPrintViewSelectionForm(): void
706 {
708 $ilCtrl = $this->ctrl;
709
710 $terms = $this->glossary->getTermList();
711
712 $this->form = new ilPropertyFormGUI();
713 //$this->form->setTarget("print_view");
714 $this->form->setFormAction($ilCtrl->getFormAction($this));
715
716 // selection type
717 $radg = new ilRadioGroupInputGUI($lng->txt("cont_selection"), "sel_type");
718 $radg->setValue("glossary");
719
720 // whole glossary
721 $op1 = new ilRadioOption($lng->txt("cont_whole_glossary")
722 . " (" . $lng->txt("cont_terms") . ": " . count($terms) . ")", "glossary");
723 $radg->addOption($op1);
724
725 // selected topic
726 if (($t_id = $this->glossary->getTaxonomyId()) > 0 && $this->glossary->getShowTaxonomy()) {
727 $op3 = new ilRadioOption($lng->txt("cont_selected_topic"), "sel_topic");
728 $radg->addOption($op3);
729
730 // topic drop down
731 $si = new ilTaxAssignInputGUI(
732 $t_id,
733 false,
734 $lng->txt("cont_topic"),
735 "topic",
736 false
737 );
738 if ($this->tax_node > 0) {
739 $si->setValue($this->tax_node);
740 }
741 $op3->addSubItem($si);
742 }
743
744 // selected terms
745 $op2 = new ilRadioOption($lng->txt("cont_selected_terms"), "selection");
746 $radg->addOption($op2);
747
748 $nl = new ilNestedListInputGUI("", "obj_id");
749 $op2->addSubItem($nl);
750 foreach ($terms as $t) {
751 $nl->addListNode((string) $t["id"], (string) $t["term"], "0", false, false);
752 }
753
754 $this->form->addItem($radg);
755
756 $this->form->addCommandButton("printView", $lng->txt("cont_show_print_view"));
757 $this->form->setPreventDoubleSubmission(false);
758
759 $this->form->setTitle($lng->txt("cont_print_selection"));
760 }
761
762 public function printView(): void
763 {
764 $ilAccess = $this->access;
765 $tpl = $this->tpl;
766
767 $this->tabs_gui->setBackTarget(
768 $this->lng->txt("back"),
769 $this->ctrl->getLinkTarget($this, "printViewSelection")
770 );
771
772 if (!$ilAccess->checkAccess("read", "", $this->requested_ref_id)) {
773 return;
774 }
775
776 $this->initPrintViewSelectionForm();
777 $this->form->checkInput();
778
779 $terms = array();
780 switch ($this->form->getInput("sel_type")) {
781 case "glossary":
782 $ts = $this->glossary->getTermList();
783 foreach ($ts as $t) {
784 $terms[] = $t["id"];
785 }
786 break;
787
788 case "sel_topic":
789 $t_id = $this->glossary->getTaxonomyId();
790 $items = ilObjTaxonomy::getSubTreeItems("glo", $this->glossary->getId(), "term", $t_id, (int) $this->form->getInput("topic"));
791 foreach ($items as $i) {
792 if ($i["item_type"] == "term") {
793 $terms[] = $i["item_id"];
794 }
795 }
796 break;
797
798 case "selection":
799 $terms = $this->form->getInput("obj_id");
800 break;
801 }
802
803 //$tpl->addCss(ilObjStyleSheet::getContentPrintStyle());
804 $tpl->addOnLoadCode("il.Util.print();");
805
806 // determine target frames for internal links
807
808 $page_content = "";
809 foreach ($terms as $t_id) {
810 $page_content .= $this->listDefinitions($this->requested_ref_id, $t_id, true, true, ilPageObjectGUI::PRINTING);
811 }
812 $tpl->setContent($page_content);
813 }
814
815 public function getTabs(): void
816 {
817 $ilAccess = $this->access;
819 $ilCtrl = $this->ctrl;
820 $ilHelp = $this->help;
821
822 $ilHelp->setScreenIdComponent("glo");
823
824 if (!$this->offlineMode()) {
825 if ($this->ctrl->getCmd() != "listDefinitions") {
826 if ($ilAccess->checkAccess("read", "", $this->requested_ref_id)) {
827 if ($this->glossary->isActiveFlashcards()) {
828 $this->tabs_gui->addTab(
829 "flashcards",
830 $lng->txt("glo_flashcards"),
831 $ilCtrl->getLinkTarget($this, "showFlashcards")
832 );
833 }
834 $this->tabs_gui->addTab(
835 "terms",
836 $lng->txt("content"),
837 $ilCtrl->getLinkTarget($this, "listTerms")
838 );
839 }
840
841 $this->tabs_gui->addTab(
842 "info",
843 $lng->txt("info_short"),
844 $ilCtrl->getLinkTarget($this, "infoScreen")
845 );
846
847
848 // glossary menu
849 if ($ilAccess->checkAccess("read", "", $this->requested_ref_id)) {
850 $this->tabs_gui->addTab(
851 "print_view",
852 $lng->txt("cont_print_view"),
853 $ilCtrl->getLinkTarget($this, "printViewSelection")
854 );
855 }
856
857 if ($ilAccess->checkAccess("write", "", $this->requested_ref_id) ||
858 $ilAccess->checkAccess("edit_content", "", $this->requested_ref_id)) {
859 $this->tabs_gui->addNonTabbedLink(
860 "editing_view",
861 $lng->txt("glo_editing_view"),
862 "ilias.php?baseClass=ilGlossaryEditorGUI&amp;ref_id=" . $this->requested_ref_id
863 );
864 } elseif ($ilAccess->checkAccess("edit_permission", "", $this->requested_ref_id)) {
865 $this->tabs_gui->addNonTabbedLink(
866 "editing_view",
867 $lng->txt("glo_editing_view"),
868 $ilCtrl->getLinkTargetByClass([
869 ilGlossaryEditorGUI::class,
870 ilObjGlossaryGUI::class,
871 ilPermissionGUI::class
872 ], "perm")
873 );
874 }
875 }
876 } else {
877 $this->tabs_gui->addTarget(
878 "cont_back",
879 "index.html#term_" . $this->term_id,
880 "",
881 ""
882 );
883 }
884 }
885
889 public function infoScreen(): void
890 {
891 $this->ctrl->redirectByClass(ilInfoScreenGUI::class, "showSummary");
892 }
893
894 public function outputInfoScreen(): string
895 {
896 $ilAccess = $this->access;
897 $ilTabs = $this->tabs_gui;
898
899 $this->setTabs();
900 $ilTabs->activateTab("info");
901 $this->lng->loadLanguageModule("meta");
902
903 $info = new ilInfoScreenGUI($this->glossary_gui);
904 $info->enablePrivateNotes();
905 //$info->enableLearningProgress();
906
907 $info->enableNews();
908 if ($ilAccess->checkAccess("write", "", $this->requested_ref_id)) {
909 $info->enableNewsEditing();
910 $news_set = new ilSetting("news");
911 $enable_internal_rss = $news_set->get("enable_rss_for_internal");
912 if ($enable_internal_rss) {
913 $info->setBlockProperty("news", "settings", true);
914 }
915 }
916
917 // show standard meta data section
918 $info->addMetaDataSections($this->glossary->getId(), 0, $this->glossary->getType());
919
920 ilObjGlossaryGUI::addUsagesToInfo($info, $this->glossary->getId());
921
922 if ($this->offlineMode()) {
923 $this->tpl->setContent($info->getHTML());
924 return $this->tpl->get();
925 } else {
926 // forward the command
927 $this->ctrl->forwardCommand($info);
928 }
929 return "";
930 }
931
932 public function showTaxonomy(): void
933 {
934 $ctrl = $this->ctrl;
935
936 if ($this->offlineMode() || !$this->tax_manager->showInPresentation()) {
937 return;
938 }
939
940 $tax_id = $this->tax_manager->getTaxonomyId();
941
942 $tool_context = $this->global_screen->tool()->context()->current();
943
944 $tool_context->addAdditionalData(
946 true
947 );
948 $tool_context->addAdditionalData(
950 [self::class]
951 );
952 $tool_context->addAdditionalData(
954 $tax_id
955 );
956 $tool_context->addAdditionalData(
958 "listTerms"
959 );
960 $tool_context->addAdditionalData(
962 "showTaxonomy"
963 );
964 }
965
966 public function showFlashcards(): void
967 {
968 $ilTabs = $this->tabs_gui;
969 $ilNavigationHistory = $this->nav_history;
970
971 $this->setTabs();
972 $ilTabs->activateTab("flashcards");
973 $ilNavigationHistory->addItem(
974 $this->requested_ref_id,
975 $this->ctrl->getLinkTarget($this, "showFlashcards"),
976 "glo"
977 );
978 $flashcards = new ilGlossaryFlashcardGUI();
979 $flashcards->listBoxes();
980 }
981}
const IL_MODE_ALIAS
const IL_MODE_OUTPUT
Class ilCtrl provides processing control methods.
static getWebspaceDir(string $mode="filesystem")
get webspace directory
special template class to simplify handling of ITX/PEAR
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...
GUI class for glossary flashcard boxes.
GUI class for glossary flashcards.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
initByRequest(?array $query_params=null)
Init services and this class by request params.
ILIAS Style Content Service $content_style_service
getPresentationTable()
Get presentation table.
basicPageGuiInit(\ilPageObjectGUI $a_page_gui)
Basic page gui initialisation.
initPrintViewSelectionForm()
Init print view selection form.
injectTemplate(ilGlobalTemplateInterface $tpl)
getLink(int $a_ref_id, string $a_cmd="", int $a_term_id=0, string $a_frame="", string $a_type="")
media(string $a_mode="media")
show media object
infoScreen()
this one is called from the info button in the repository
ILIAS GlobalScreen Services $global_screen
ILIAS Glossary InternalGUIService $gui
ILIAS Glossary Taxonomy TaxonomyManager $tax_manager
setOfflineMode(bool $a_offline=true)
set offline mode (content is generated for offline package)
ILIAS Style Content Object ObjectFacade $content_style_domain
listDefinitions(int $a_ref_id=0, int $a_term_id=0, bool $a_get_html=false, bool $render_term=true, string $a_page_mode=ilPageObjectGUI::PRESENTATION, bool $render_page_container=true)
list definitions of a term
ILIAS Style Content GUIService $content_style_gui
__construct(string $export_format="", string $export_dir="")
offlineMode()
checks wether offline content generation is activated
static isReferenced(array $a_glo_id, int $a_term_id)
Is a term referenced by a set of glossaries.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static _lookGlossaryID(int $term_id)
get glossary id form term id
Class ilInfoScreenGUI.
static _lookupContObjID(int $a_id)
get learning module id for lm object
static _getPresentationTitle(int $a_pg_id, string $a_mode=self::CHAPTER_TITLE, bool $a_include_numbers=false, bool $a_time_scheduled_activation=false, bool $a_force_content=false, int $a_lm_id=0, string $a_lang="-", bool $a_include_short=false)
presentation title doesn't have to be page title, it may be chapter title + page title or chapter tit...
loadLanguageModule(string $a_module)
Load language module.
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...
static _getMapAreasIntLinks(int $a_mob_id)
get all internal links of map areas of a mob
Last visited history for repository items.
This class represents a (nested) list of checkboxes (could be extended for radio items,...
Class ilObjFile.
static addUsagesToInfo(ilInfoScreenGUI $info, int $glo_id)
Add usages to info screen.
static isTypeAllowed(string $a_type)
static getContentStylePath(int $a_style_id, bool $add_random=true, bool $add_token=true)
get content style path static (to avoid full reading)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static getSubTreeItems(string $a_comp, int $a_obj_id, string $a_item_type, int $a_tax_id, $a_node)
Get all assigned items under a node.
Class ilObjectMetaDataGUI.
static _getAllReferences(int $id)
get all reference ids for object ID
static _lookupTitle(int $obj_id)
Class ilPageObjectGUI.
setOutputMode(string $a_mode=self::PRESENTATION)
setOfflineDirectory(string $offdir)
setFullscreenLink(string $a_fullscreen_link)
setFileDownloadLink(string $a_download_link)
This class represents a property form user interface.
This class represents a property in a property form.
This class represents an option in a radio group.
ILIAS Setting Class.
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...
special template class to simplify handling of ITX/PEAR
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static _getInstance(int $a_usr_id)
static getImagePath(string $image_name, string $module_path="", string $mode="output", bool $offline=false)
get image path (for images located in a template directory)
static getStyleSheetLocation(string $mode="output", string $a_css_name="")
get full style sheet file name (path inclusive) of current user
exit
$info
Definition: entry_point.php:21
$requested_ref_id
Definition: feed.php:40
Interface ilAccessHandler This interface combines all available interfaces which can be called via gl...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
$ref_id
Definition: ltiauth.php:66
if(! $DIC->user() ->getId()||!ilLTIConsumerAccess::hasCustomProviderCreationAccess()) $params
Definition: ltiregstart.php:31
$service
Definition: ltiresult.php:36
form( $class_path, string $cmd, string $submit_caption="")
global $lng
Definition: privfeed.php:31
global $DIC
Definition: shib_login.php:26