ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
class.ilGlossaryPresentationGUI.php
Go to the documentation of this file.
1<?php
2
3/* Copyright (c) 1998-2019 ILIAS open source, Extended GPL, see docs/LICENSE */
4
6
14{
18 protected $ctrl;
19
23 protected $tabs_gui;
24
28 protected $access;
29
33 protected $error;
34
38 protected $nav_history;
39
43 protected $toolbar;
44
48 protected $user;
49
53 protected $help;
54
58 protected $glossary;
59
63 protected $glossary_gui;
64
68 protected $tpl;
69
73 protected $lng;
74
78 protected $tax_node;
79
83 protected $tax_id;
84
88 protected $tax;
89
90
94 protected $service;
95
99 protected $term_id;
100
105
110
115
120
125
130
135
136
141 public function __construct($export_format = "", $export_dir = "")
142 {
143 global $DIC;
144
145 $this->export_format = $export_format;
146 $this->setOfflineDirectory($export_dir);
147 $this->offline = ($export_format != "");
148 $this->access = $DIC->access();
149 $this->error = $DIC["ilErr"];
150 $this->nav_history = $DIC["ilNavigationHistory"];
151 $this->toolbar = $DIC->toolbar();
152 $this->user = $DIC->user();
153 $this->help = $DIC["ilHelp"];
154 $lng = $DIC->language();
155 $tpl = $DIC->ui()->mainTemplate();
156 $ilCtrl = $DIC->ctrl();
157 $ilTabs = $DIC->tabs();
158
159 $this->tabs_gui = $ilTabs;
160 $this->tpl = $tpl;
161 $this->lng = $lng;
162 $this->ctrl = $ilCtrl;
163 $this->ctrl->saveParameter($this, array("ref_id", "letter", "tax_node"));
164
165 // note: using $DIC->http()->request()->getQueryParams() here will
166 // fail, since the goto magic currently relies on setting $_GET
167 $this->initByRequest($_GET);
168 }
169
179 public function initByRequest(array $query_params)
180 {
181 $this->service = new Presentation\GlossaryPresentationService(
182 $this->user,
183 $query_params,
184 $this->offline
185 );
186
187 $request = $this->service->getRequest();
188
189 $this->requested_ref_id = $request->getRequestedRefId();
190 $this->term_id = $request->getRequestedTermId();
191 $this->glossary_gui = $this->service->getGlossaryGUI();
192 $this->glossary = $this->service->getGlossary();
193 $this->requested_def_page_id = $request->getRequestedDefinitionPageId();
194 $this->requested_search_str = $request->getRequestedSearchString();
195 $this->requested_file_id = $request->getRequestedFileId();
196 $this->requested_mob_id = $request->getRequestedMobId();
197 $this->requested_export_type = (string) $query_params["type"];
198
199
200 // determine term id and check whether it is valid (belongs to
201 // current glossary or a virtual (online) sub-glossary)
202 $glo_ids = $this->glossary->getAllGlossaryIds();
203 if (!is_array($glo_ids)) {
204 $glo_ids = array($glo_ids);
205 }
206 $term_glo_id = ilGlossaryTerm::_lookGlossaryID($this->term_id);
207 if (!in_array($term_glo_id, $glo_ids) && !ilGlossaryTermReferences::isReferenced($glo_ids, $this->term_id)) {
208 if ((int) $this->term_id > 0) {
209 throw new ilGlossaryException("Term ID does not match the glossary.");
210 }
211 $this->term_id = 0;
212 }
213
214 $this->tax_node = 0;
215 $this->tax_id = $this->glossary->getTaxonomyId();
216 if ($this->tax_id > 0 && $this->glossary->getShowTaxonomy()) {
217 $this->tax = new ilObjTaxonomy($this->tax_id);
218 }
219 $requested_tax_node = $request->getRequestedTaxNode();
220 if ((int) $requested_tax_node > 1 && $this->tax->getTree()->readRootId() != $requested_tax_node) {
221 $this->tax_node = $requested_tax_node;
222 }
223
224 $this->requested_letter = $request->getRequestedLetter();
225 }
226
230 public function injectTemplate($tpl)
231 {
232 $this->tpl = $tpl;
233 }
234
238 public function setOfflineMode($a_offline = true)
239 {
240 $this->offline = $a_offline;
241 }
242
246 public function offlineMode()
247 {
248 return $this->offline;
249 }
250
254 public function setOfflineDirectory($a_dir)
255 {
256 $this->offline_dir = $a_dir;
257 }
258
259
263 public function getOfflineDirectory()
264 {
265 return $this->offline_dir;
266 }
267
268
272 public function executeCommand()
273 {
275 $ilAccess = $this->access;
277
278 $lng->loadLanguageModule("content");
279
280 $next_class = $this->ctrl->getNextClass($this);
281 $cmd = $this->ctrl->getCmd("listTerms");
282
283 // check write permission
284 if (!$ilAccess->checkAccess("read", "", $this->requested_ref_id) &&
285 !($ilAccess->checkAccess("visible", "", $this->requested_ref_id) &&
286 ($cmd == "infoScreen" || strtolower($next_class) == "ilinfoscreengui"))) {
287 $ilErr->raiseError($lng->txt("permission_denied"), $ilErr->MESSAGE);
288 }
289
290 if ($cmd != "listDefinitions") {
291 $this->prepareOutput();
292 }
293
294 switch ($next_class) {
295 case "ilnotegui":
296 $this->setTabs();
297 $ret = $this->listDefinitions();
298 break;
299
300 case "ilinfoscreengui":
301 $ret = $this->outputInfoScreen();
302 break;
303
304 case "ilpresentationlisttablegui":
305 $prtab = $this->getPresentationTable();
306 $this->ctrl->forwardCommand($prtab);
307 return;
308 break;
309
310 case "ilglossarydefpagegui":
311 $page_gui = new ilGlossaryDefPageGUI($this->requested_def_page_id);
312 $this->basicPageGuiInit($page_gui);
313 $this->ctrl->forwardCommand($page_gui);
314 break;
315
316 default:
317 $ret = $this->$cmd();
318 break;
319 }
320 $this->tpl->printToStdout();
321 }
322
323 public function prepareOutput()
324 {
325 $this->tpl->loadStandardTemplate();
326 $title = $this->glossary->getTitle();
327
328 $this->tpl->setTitle($title);
329 $this->tpl->setTitleIcon(ilUtil::getImagePath("icon_glo.svg"));
330
331 $this->setLocator();
332 }
333
334
341 public function basicPageGuiInit(\ilPageObjectGUI $a_page_gui)
342 {
344 $this->glossary->getStyleSheetId(),
345 "glo"
346 ));
347 if (!$this->offlineMode()) {
348 $a_page_gui->setOutputMode("presentation");
349 $this->fill_on_load_code = true;
350 } else {
351 $a_page_gui->setOutputMode("offline");
352 $a_page_gui->setOfflineDirectory($this->getOfflineDirectory());
353 $this->fill_on_load_code = false;
354 }
355 if (!$this->offlineMode()) {
356 $this->ctrl->setParameter($this, "pg_id", $a_page_gui->getId());
357 }
358 $a_page_gui->setFileDownloadLink($this->getLink($this->requested_ref_id, "downloadFile"));
359 $a_page_gui->setFullscreenLink($this->getLink($this->requested_ref_id, "fullscreen"));
360 }
361
365 public function listTerms()
366 {
367 $ilNavigationHistory = $this->nav_history;
368 $ilAccess = $this->access;
370 $ilToolbar = $this->toolbar;
372 $ilTabs = $this->tabs_gui;
374
375
376 if (!$ilAccess->checkAccess("read", "", $this->requested_ref_id)) {
377 $ilErr->raiseError($lng->txt("permission_denied"), $ilErr->MESSAGE);
378 }
379
380 if (!$this->offlineMode()) {
381 $ilNavigationHistory->addItem(
382 $this->requested_ref_id,
383 $this->ctrl->getLinkTarget($this, "listTerms"),
384 "glo"
385 );
386
387 // alphabetical navigation
388 $ai = new ilAlphabetInputGUI($lng->txt("glo_quick_navigation"), "first");
389
390 $ai->setFixDBUmlauts(true);
391
392 $first_letters = $this->glossary->getFirstLetters($this->tax_node);
393 if (!is_array($first_letters)) {
394 $first_letters = [];
395 }
396 if (!in_array($this->requested_letter, $first_letters)) {
397 $first_letters[] = ilUtil::stripSlashes($this->requested_letter);
398 }
399 $ai->setLetters($first_letters);
400
401 $ai->setParentCommand($this, "chooseLetter");
402 $ai->setHighlighted($this->requested_letter);
403 $ilToolbar->addInputItem($ai, true);
404 }
405
406 $ret = $this->listTermByGiven();
407 $ilCtrl->setParameter($this, "term_id", "");
408
409 $ilTabs->activateTab("terms");
410
411 // show taxonomy
412 $this->showTaxonomy();
413
414 $this->tpl->setPermanentLink("glo", $this->glossary->getRefId());
415
416 return $ret;
417 }
418
422 public function listTermByGiven()
423 {
425 $ilAccess = $this->access;
428
429 if (!$ilAccess->checkAccess("read", "", $this->requested_ref_id)) {
430 $ilErr->raiseError($lng->txt("permission_denied"), $ilErr->MESSAGE);
431 }
432
433 $this->lng->loadLanguageModule("meta");
434
435 $this->setTabs();
436
437 // load template for table
438 // $this->tpl->addBlockfile("ADM_CONTENT", "adm_content", "tpl.table.html");
439
440 if ($this->glossary->getPresentationMode() == "full_def") {
441 $this->setContentStyles();
442 }
443
444 $table = $this->getPresentationTable();
445
446 if (!$this->offlineMode()) {
447 $tpl->setContent($ilCtrl->getHTML($table));
448 } else {
449 $this->tpl->setVariable("ADM_CONTENT", $table->getHTML());
450 return $this->tpl->printToString();
451 }
452 }
453
457 protected function setContentStyles()
458 {
460
461 if (!$this->offlineMode()) {
463 $this->glossary->getStyleSheetId(),
464 "glo"
465 )));
467 } else {
468 $tpl->addCss("content.css");
469 $tpl->addCss("syntaxhighlight.css");
470 }
471 }
472
479 public function getPresentationTable()
480 {
481 $table = new ilPresentationListTableGUI(
482 $this,
483 "listTerms",
484 $this->glossary,
485 $this->offlineMode(),
486 $this->tax_node,
487 $this->glossary->getTaxonomyId()
488 );
489 return $table;
490 }
491
495 public function applyFilter()
496 {
497 $ilTabs = $this->tabs_gui;
498
499 $prtab = $this->getPresentationTable();
500 $prtab->resetOffset();
501 $prtab->writeFilterToSession();
502 $this->listTerms();
503 }
504
509 public function resetFilter()
510 {
511 $prtab = $this->getPresentationTable();
512 $prtab->resetOffset();
513 $prtab->resetFilter();
514 $this->listTerms();
515 }
516
520 public function listDefinitions($a_ref_id = 0, $a_term_id = 0, $a_get_html = false, $a_page_mode = ilPageObjectGUI::PRESENTATION)
521 {
523 $ilAccess = $this->access;
527
528 if ($a_ref_id == 0) {
529 $ref_id = (int) $this->requested_ref_id;
530 } else {
531 $ref_id = $a_ref_id;
532 }
533 if ($a_term_id == 0) {
535 } else {
536 $term_id = $a_term_id;
537 }
538
539 if (!$ilAccess->checkAccess("read", "", $ref_id)) {
540 $ilErr->raiseError($lng->txt("permission_denied"), $ilErr->MESSAGE);
541 }
542
543 // tabs
544 if ($this->glossary->getPresentationMode() != "full_def" &&
545 $a_page_mode != ilPageObjectGUI::PRINTING) {
546 $this->showDefinitionTabs("term_content");
547 }
548
549 $term = new ilGlossaryTerm($term_id);
550
551 if (!$a_get_html) {
552 $tpl->loadStandardTemplate();
553
554 $this->setContentStyles();
555
556 if (!$this->offlineMode()) {
557 $this->setLocator();
558 }
559
560 $tpl->setTitleIcon(ilUtil::getImagePath("icon_glo.svg"));
561 $tpl->setTitle($this->lng->txt("cont_term") . ": " . $term->getTerm());
562
563 // advmd block
564 $cmd = null;
565 if ($ilAccess->checkAccess("write", "", $this->requested_ref_id)) {
566 $cmd = array("edit" => $this->ctrl->getLinkTargetByClass(array("ilglossaryeditorgui", "ilobjglossarygui", "ilglossarytermgui", "ilobjectmetadatagui"), ""));
567 }
568 $mdgui = new ilObjectMetaDataGUI($this->glossary, "term", $term->getId());
569 $tpl->setRightContent($mdgui->getBlockHTML($cmd));
570 }
571
572 $def_tpl = new ilTemplate("tpl.glossary_definition_list.html", true, true, "Modules/Glossary");
573
575 $def_tpl->setVariable("TXT_TERM", $term->getTerm());
576 $this->mobs = array();
577
578 // toc
579 if (count($defs) > 1 && $a_page_mode == ilPageObjectGUI::PRESENTATION) {
580 $def_tpl->setCurrentBlock("toc");
581 for ($j = 1; $j <= count($defs); $j++) {
582 $def_tpl->setCurrentBlock("toc_item");
583 $def_tpl->setVariable("TOC_DEF_NR", $j);
584 $def_tpl->setVariable("TOC_DEF", $lng->txt("cont_definition"));
585 $def_tpl->parseCurrentBlock();
586 }
587 $def_tpl->setCurrentBlock("toc");
588 $def_tpl->parseCurrentBlock();
589 }
590
591 for ($j = 0; $j < count($defs); $j++) {
592 $def = $defs[$j];
593 $page_gui = new ilGlossaryDefPageGUI($def["id"]);
594 $this->basicPageGuiInit($page_gui);
595 $page_gui->setGlossary($this->glossary);
596 $page_gui->setOutputMode($a_page_mode);
597 $page_gui->setStyleId($this->glossary->getStyleSheetId());
598 $page = $page_gui->getPageObject();
599
600 // internal links
601 $page->buildDom();
602
603 if ($this->offlineMode()) {
604 $page_gui->setOutputMode("offline");
605 $page_gui->setOfflineDirectory($this->getOfflineDirectory());
606 }
607 $page_gui->setFullscreenLink($this->getLink($ref_id, "fullscreen", $term_id, $def["id"]));
608
609 $page_gui->setTemplateOutput(false);
610 $page_gui->setRawPageContent(true);
611 if (!$this->offlineMode()) {
612 $output = $page_gui->showPage();
613 } else {
614 $output = $page_gui->presentation($page_gui->getOutputMode());
615 }
616
617 if (count($defs) > 1) {
618 $def_tpl->setCurrentBlock("definition_header");
619 $def_tpl->setVariable(
620 "TXT_DEFINITION",
621 $this->lng->txt("cont_definition") . " " . ($j + 1)
622 );
623 $def_tpl->setVariable("DEF_NR", ($j + 1));
624 $def_tpl->parseCurrentBlock();
625 }
626
627 $def_tpl->setCurrentBlock("definition");
628 $def_tpl->setVariable("PAGE_CONTENT", $output);
629 $def_tpl->parseCurrentBlock();
630 }
631
632 // display possible backlinks
633 $sources = ilInternalLink::_getSourcesOfTarget('git', $this->term_id, 0);
634
635 if ($sources) {
636 $backlist_shown = false;
637 foreach ($sources as $src) {
638 $type = explode(':', $src['type']);
639
640 if ($type[0] == 'lm') {
641 if ($type[1] == 'pg') {
642 $title = ilLMPageObject::_getPresentationTitle($src['id']);
643 $lm_id = ilLMObject::_lookupContObjID($src['id']);
644 $lm_title = ilObject::_lookupTitle($lm_id);
645 $def_tpl->setCurrentBlock('backlink_item');
646 $ref_ids = ilObject::_getAllReferences($lm_id);
647 $access = false;
648 foreach ($ref_ids as $rid) {
649 if ($ilAccess->checkAccess("read", "", $rid)) {
650 $access = true;
651 }
652 }
653 if ($access) {
654 $def_tpl->setCurrentBlock("backlink_item");
655 $def_tpl->setVariable("BACKLINK_LINK", ILIAS_HTTP_PATH . "/goto.php?target=" . $type[1] . "_" . $src['id']);
656 $def_tpl->setVariable("BACKLINK_ITEM", $lm_title . ": " . $title);
657 $def_tpl->parseCurrentBlock();
658 $backlist_shown = true;
659 }
660 }
661 }
662 }
663 if ($backlist_shown) {
664 $def_tpl->setCurrentBlock("backlink_list");
665 $def_tpl->setVariable("BACKLINK_TITLE", $this->lng->txt('glo_term_used_in'));
666 $def_tpl->parseCurrentBlock();
667 }
668 }
669
670 if (!$a_get_html) {
671 $tpl->setPermanentLink("git", $term_id, "", ILIAS_HTTP_PATH .
672 "/goto.php?target=" .
673 "git" .
674 "_" . $term_id . "_" . $ref_id . "&client_id=" . CLIENT_ID);
675
676 // show taxonomy
677 $this->showTaxonomy();
678 }
679
680 // highlighting?
681 if ($this->requested_search_str != "" && !$this->offlineMode()) {
682 $cache = ilUserSearchCache::_getInstance($ilUser->getId());
683 $cache->switchSearchType(ilUserSearchCache::LAST_QUERY);
684 $search_string = $cache->getQuery();
685
686 $p = new ilQueryParser($search_string);
687 $p->parse();
688
689 $words = $p->getQuotedWords();
690 if (is_array($words)) {
691 foreach ($words as $w) {
692 ilTextHighlighterGUI::highlight("ilGloContent", $w, $tpl);
693 }
694 }
695 $this->fill_on_load_code = true;
696 }
697 $tpl->setContent($def_tpl->get());
698 if ($this->offlineMode()) {
699 return $tpl->printToString();
700 } elseif ($a_get_html) {
701 return $def_tpl->get();
702 }
703 }
704
711 public function showDefinitionTabs($a_act)
712 {
713 $ilTabs = $this->tabs_gui;
716 $ilHelp = $this->help;
717
718 if (!$this->offlineMode()) {
719 $ilHelp->setScreenIdComponent("glo");
720
721 $ilCtrl->setParameter($this, "term_id", "");
722 $back = $ilCtrl->getLinkTarget($this, "listTerms");
723 $ilCtrl->setParameter($this, "term_id", $this->term_id);
724 $ilCtrl->saveParameter($this, "term_id");
725
726 $ilTabs->setBackTarget($this->lng->txt("obj_glo"), $back);
727
728 $ilTabs->addTab(
729 "term_content",
730 $lng->txt("content"),
731 $ilCtrl->getLinkTarget($this, "listDefinitions")
732 );
733
734 $ilTabs->addTab(
735 "print_view",
736 $lng->txt("print_view"),
737 $ilCtrl->getLinkTarget($this, "printViewSelection")
738 );
739
740 $ilCtrl->setParameterByClass("ilglossarytermgui", "term_id", $this->term_id);
741 if (ilGlossaryTerm::_lookGlossaryID($this->term_id) == $this->glossary->getId()) {
742 $ilTabs->addNonTabbedLink(
743 "editing_view",
744 $lng->txt("glo_editing_view"),
745 $ilCtrl->getLinkTargetByClass(array("ilglossaryeditorgui", "ilobjglossarygui", "ilglossarytermgui"), "listDefinitions")
746 );
747 //"ilias.php?baseClass=ilGlossaryEditorGUI&amp;ref_id=".$this->requested_ref_id."&amp;edit_term=".$this->term_id);
748 }
749 $ilTabs->activateTab($a_act);
750 }
751 }
752
753
757 public function fullscreen()
758 {
759 $html = $this->media("fullscreen");
760 return $html;
761 }
762
766 public function media($a_mode = "media")
767 {
768 $this->tpl = new ilGlobalTemplate("tpl.fullscreen.html", true, true, "Services/COPage");
769 $this->tpl->setVariable("LOCATION_STYLESHEET", ilUtil::getStyleSheetLocation());
770 $this->tpl->setVariable(
771 "LOCATION_CONTENT_STYLESHEET",
772 ilObjStyleSheet::getContentStylePath($this->glossary->getStyleSheetId())
773 );
774
775 //$int_links = $page_object->getInternalLinks();
776 $med_links = ilMediaItem::_getMapAreasIntLinks($this->requested_mob_id);
777
778 // later
779 //$link_xml = $this->getLinkXML($med_links, $this->getLayoutLinkTargets());
780
781 $link_xlm = "";
782
783 $media_obj = new ilObjMediaObject($this->requested_mob_id);
784
785 $xml = "<dummy>";
786 // todo: we get always the first alias now (problem if mob is used multiple
787 // times in page)
788 $xml .= $media_obj->getXML(IL_MODE_ALIAS);
789 $xml .= $media_obj->getXML(IL_MODE_OUTPUT);
790 $xml .= $link_xml;
791 $xml .= "</dummy>";
792
793 $xsl = file_get_contents("./Services/COPage/xsl/page.xsl");
794 $args = array( '/_xml' => $xml, '/_xsl' => $xsl );
795 $xh = xslt_create();
796
797 if (!$this->offlineMode()) {
798 $enlarge_path = ilUtil::getImagePath("enlarge.svg", false, "output");
799 $wb_path = ilUtil::getWebspaceDir("output") . "/";
800 } else {
801 $enlarge_path = "images/enlarge.svg";
802 $wb_path = "";
803 }
804
805 $mode = $a_mode;
806
807 $this->ctrl->setParameter($this, "obj_type", "MediaObject");
808 $fullscreen_link =
809 $this->getLink($this->requested_ref_id, "fullscreen");
810 $this->ctrl->clearParameters($this);
811
812 $params = array('mode' => $mode, 'enlarge_path' => $enlarge_path,
813 'link_params' => "ref_id=" . $this->requested_ref_id,'fullscreen_link' => $fullscreen_link,
814 'ref_id' => $this->requested_ref_id, 'pg_frame' => $pg_frame, 'webspace_path' => $wb_path);
815 $output = xslt_process($xh, "arg:/_xml", "arg:/_xsl", null, $args, $params);
816 echo xslt_error($xh);
817 xslt_free($xh);
818
819 // unmask user html
820 $this->tpl->setVariable("MEDIA_CONTENT", $output);
821
822 $this->tpl->parseCurrentBlock();
823 if ($this->offlineMode()) {
824 $html = $this->tpl->get();
825 return $html;
826 }
827 }
828
832 public function showDownloadList()
833 {
834 $ilAccess = $this->access;
836 $ilTabs = $this->tabs_gui;
837
838 if (!$ilAccess->checkAccess("read", "", $this->requested_ref_id)) {
839 $ilErr->raiseError($lng->txt("permission_denied"), $ilErr->MESSAGE);
840 }
841
842 $this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.glo_download_list.html", "Modules/Glossary");
843
844 $this->setTabs();
845 $ilTabs->activateTab("download");
846
847 // set title header
848 $this->tpl->setTitle($this->glossary->getTitle());
849 $this->tpl->setTitleIcon(ilUtil::getImagePath("icon_glo.svg"));
850
851 // create table
852 $tbl = new ilTableGUI();
853
854 // load files templates
855 $this->tpl->addBlockfile("DOWNLOAD_TABLE", "download_table", "tpl.table.html");
856
857 // load template for table content data
858 $this->tpl->addBlockfile("TBL_CONTENT", "tbl_content", "tpl.download_file_row.html", "Modules/Glossary");
859
860 $export_files = array();
861 $types = array("xml", "html");
862 foreach ($types as $type) {
863 if ($this->glossary->getPublicExportFile($type) != "") {
864 $dir = $this->glossary->getExportDirectory($type);
865 if (is_file($this->glossary->getExportDirectory($type) . "/" .
866 $this->glossary->getPublicExportFile($type))) {
867 $size = filesize($this->glossary->getExportDirectory($type) . "/" .
868 $this->glossary->getPublicExportFile($type));
869 $export_files[] = array("type" => $type,
870 "file" => $this->glossary->getPublicExportFile($type),
871 "size" => $size);
872 }
873 }
874 }
875
876 $num = 0;
877
878 $tbl->setTitle($this->lng->txt("download"));
879
880 $tbl->setHeaderNames(array($this->lng->txt("cont_format"),
881 $this->lng->txt("cont_file"),
882 $this->lng->txt("size"), $this->lng->txt("date"),
883 ""));
884
885 $cols = array("format", "file", "size", "date", "download");
886 $header_params = array("ref_id" => $this->requested_ref_id,
887 "cmd" => "showDownloadList", "cmdClass" => strtolower(get_class($this)));
888 $tbl->setHeaderVars($cols, $header_params);
889 $tbl->setColumnWidth(array("10%", "30%", "20%", "20%","20%"));
890 $tbl->disable("sort");
891 // footer
892 $tbl->disable("footer");
893 $tbl->setMaxCount(count($export_files));
894
895 $tbl->render();
896 if (count($export_files) > 0) {
897 $i = 0;
898 foreach ($export_files as $exp_file) {
899 $this->tpl->setCurrentBlock("tbl_content");
900 $this->tpl->setVariable("TXT_FILENAME", $exp_file["file"]);
901
902 $css_row = ilUtil::switchColor($i++, "tblrow1", "tblrow2");
903 $this->tpl->setVariable("CSS_ROW", $css_row);
904
905 $this->tpl->setVariable("TXT_SIZE", $exp_file["size"]);
906 $this->tpl->setVariable("TXT_FORMAT", strtoupper($exp_file["type"]));
907 $this->tpl->setVariable("CHECKBOX_ID", $exp_file["type"] . ":" . $exp_file["file"]);
908
909 $file_arr = explode("__", $exp_file["file"]);
910 $this->tpl->setVariable("TXT_DATE", date("Y-m-d H:i:s", $file_arr[0]));
911
912 $this->tpl->setVariable("TXT_DOWNLOAD", $this->lng->txt("download"));
913 $this->ctrl->setParameter($this, "type", $exp_file["type"]);
914 $this->tpl->setVariable(
915 "LINK_DOWNLOAD",
916 $this->ctrl->getLinkTarget($this, "downloadExportFile")
917 );
918
919 $this->tpl->parseCurrentBlock();
920 }
921 } //if is_array
922 else {
923 $this->tpl->setVariable("TXT_OBJECT_NOT_FOUND", $this->lng->txt("obj_not_found"));
924 $this->tpl->setVariable("NUM_COLS", 5);
925 $this->tpl->parseCurrentBlock();
926 }
927
928 //$this->tpl->show();
929 }
930
934 public function downloadExportFile()
935 {
936 $ilAccess = $this->access;
939
940 if (!$ilAccess->checkAccess("read", "", $this->requested_ref_id)) {
941 $ilErr->raiseError($lng->txt("permission_denied"), $ilErr->error_obj->MESSAGE);
942 }
943
944 $file = $this->glossary->getPublicExportFile($this->requested_export_type);
945 if ($this->glossary->getPublicExportFile($this->requested_export_type) != "") {
946 $dir = $this->glossary->getExportDirectory($this->requested_export_type);
947 if (is_file($dir . "/" . $file)) {
948 ilUtil::deliverFile($dir . "/" . $file, $file);
949 exit;
950 }
951 }
952 $ilErr->raiseError($this->lng->txt("file_not_found"), $ilErr->MESSAGE);
953 }
954
962 public function setLocator($a_tree = "", $a_id = "")
963 {
964 $gloss_loc = new ilGlossaryLocatorGUI();
965 $gloss_loc->setMode("presentation");
966 if (!empty($this->term_id)) {
967 $term = new ilGlossaryTerm($this->term_id);
968 $gloss_loc->setTerm($term);
969 }
970 $gloss_loc->setGlossary($this->glossary);
971 //$gloss_loc->setDefinition($this->definition);
972 $gloss_loc->display();
973 }
974
978 public function downloadFile()
979 {
980 $ilAccess = $this->access;
983
984 if (!$ilAccess->checkAccess("read", "", $this->requested_ref_id)) {
985 $ilErr->raiseError($lng->txt("permission_denied"), $ilErr->MESSAGE);
986 }
987
988 $file = explode("_", $this->requested_file_id);
989 $fileObj = new ilObjFile($file[count($file) - 1], false);
990 $fileObj->sendFile();
991 exit;
992 }
993
997 public function setTabs()
998 {
999 $this->getTabs();
1000 }
1001
1002
1006 public function getLink(
1007 $a_ref_id,
1008 $a_cmd = "",
1009 $a_term_id = "",
1010 $a_def_id = "",
1011 $a_frame = "",
1012 $a_type = ""
1013 ) {
1014 if ($a_cmd == "") {
1015 $a_cmd = "layout";
1016 }
1017 //$script = "glossary_presentation.php";
1018
1019 // handle online links
1020 if (!$this->offlineMode()) {
1021 //$link = $script."?ref_id=".$a_ref_id;
1022 switch ($a_cmd) {
1023 case "fullscreen":
1024 $this->ctrl->setParameter($this, "def_id", $a_def_id);
1025 $link = $this->ctrl->getLinkTarget($this, "fullscreen");
1026 break;
1027
1028 default:
1029 $link .= "&amp;cmd=" . $a_cmd;
1030 if ($a_frame != "") {
1031 $this->ctrl->setParameter($this, "frame", $a_frame);
1032 }
1033 if ($a_obj_id != "") {
1034 switch ($a_type) {
1035 case "MediaObject":
1036 $this->ctrl->setParameter($this, "mob_id", $a_obj_id);
1037 break;
1038
1039 default:
1040 $this->ctrl->setParameter($this, "def_id", $a_def_id);
1041 break;
1042 }
1043 }
1044 if ($a_type != "") {
1045 $this->ctrl->setParameter($this, "obj_type", $a_type);
1046 }
1047 $link = $this->ctrl->getLinkTarget($this, $a_cmd);
1048// $link = str_replace("&", "&amp;", $link);
1049 break;
1050 }
1051 } else { // handle offline links
1052 switch ($a_cmd) {
1053 case "downloadFile":
1054 break;
1055
1056 case "fullscreen":
1057 $link = "fullscreen.html"; // id is handled by xslt
1058 break;
1059
1060 case "layout":
1061 break;
1062
1063 case "glossary":
1064 $link = "term_" . $a_obj_id . ".html";
1065 break;
1066
1067 case "media":
1068 $link = "media_" . $a_obj_id . ".html";
1069 break;
1070
1071 default:
1072 break;
1073 }
1074 }
1075 $this->ctrl->clearParameters($this);
1076 return $link;
1077 }
1078
1085 public function printViewSelection()
1086 {
1088 $lng = $this->lng;
1089 $ilToolbar = $this->toolbar;
1091 $tpl = $this->tpl;
1092 $ilTabs = $this->tabs_gui;
1093
1094 $ilCtrl->saveParameter($this, "term_id");
1095
1096 if ((int) $this->term_id == 0) {
1097 $this->setTabs();
1098 $ilTabs->activateTab("print_view");
1099 } else {
1100 $tpl->setTitleIcon(ilUtil::getImagePath("icon_glo.svg"));
1101 $term = new ilGlossaryTerm((int) $this->term_id);
1102 $tpl->setTitle($this->lng->txt("cont_term") . ": " . $term->getTerm());
1103 $this->showDefinitionTabs("print_view");
1104 }
1105
1107
1108 $tpl->setContent($this->form->getHTML());
1109 }
1110
1115 {
1116 $lng = $this->lng;
1118
1119 $terms = $this->glossary->getTermList();
1120
1121 $this->form = new ilPropertyFormGUI();
1122 //$this->form->setTarget("print_view");
1123 $this->form->setFormAction($ilCtrl->getFormAction($this));
1124
1125 // selection type
1126 $radg = new ilRadioGroupInputGUI($lng->txt("cont_selection"), "sel_type");
1127 $radg->setValue("glossary");
1128
1129 // current term
1130 if ((int) $this->term_id > 0) {
1131 $op1 = new ilRadioOption($lng->txt("cont_current_term"), "term");
1132 $radg->addOption($op1);
1133 $radg->setValue("term");
1134 }
1135
1136 // whole glossary
1137 $op2 = new ilRadioOption($lng->txt("cont_whole_glossary")
1138 . " (" . $lng->txt("cont_terms") . ": " . count($terms) . ")", "glossary");
1139 $radg->addOption($op2);
1140
1141 // selected topic
1142 if (($t_id = $this->glossary->getTaxonomyId()) > 0 && $this->glossary->getShowTaxonomy()) {
1143 $op4 = new ilRadioOption($lng->txt("cont_selected_topic"), "sel_topic");
1144 $radg->addOption($op4);
1145
1146 // topic drop down
1148 $t_id,
1149 false,
1150 $lng->txt("cont_topic"),
1151 "topic",
1152 false
1153 );
1154 if ($this->tax_node > 0) {
1155 $si->setValue((int) $this->tax_node);
1156 }
1157 $op4->addSubItem($si);
1158 }
1159
1160 // selected terms
1161 $op3 = new ilRadioOption($lng->txt("cont_selected_terms"), "selection");
1162 $radg->addOption($op3);
1163
1164 $nl = new ilNestedListInputGUI("", "obj_id");
1165 $op3->addSubItem($nl);
1166 //var_dump($terms);
1167 foreach ($terms as $t) {
1168 $nl->addListNode($t["id"], $t["term"], 0, false, false);
1169 }
1170
1171 $this->form->addItem($radg);
1172
1173 $this->form->addCommandButton("printView", $lng->txt("cont_show_print_view"));
1174 $this->form->setPreventDoubleSubmission(false);
1175
1176 $this->form->setTitle($lng->txt("cont_print_selection"));
1177 }
1178
1185 public function printView()
1186 {
1187 $ilAccess = $this->access;
1188 $tpl = $this->tpl;
1189
1190 $this->tabs_gui->setBackTarget(
1191 $this->lng->txt("back"),
1192 $this->ctrl->getLinkTarget($this, "printViewSelection")
1193 );
1194
1195 if (!$ilAccess->checkAccess("read", "", $this->requested_ref_id)) {
1196 return;
1197 }
1198
1199 $terms = array();
1200 switch ($_POST["sel_type"]) {
1201 case "glossary":
1202 $ts = $this->glossary->getTermList();
1203 foreach ($ts as $t) {
1204 $terms[] = $t["id"];
1205 }
1206 break;
1207
1208 case "sel_topic":
1209 $t_id = $this->glossary->getTaxonomyId();
1210 $items = ilObjTaxonomy::getSubTreeItems("glo", $this->glossary->getId(), "term", $t_id, (int) $_POST["topic"]);
1211 foreach ($items as $i) {
1212 if ($i["item_type"] == "term") {
1213 $terms[] = $i["item_id"];
1214 }
1215 }
1216 break;
1217
1218 case "selection":
1219 if (is_array($_POST["obj_id"])) {
1220 $terms = $_POST["obj_id"];
1221 } else {
1222 $terms = array();
1223 }
1224 break;
1225
1226 case "term":
1227 $terms = array($this->term_id);
1228 break;
1229 }
1230
1231 //$tpl->addCss(ilObjStyleSheet::getContentPrintStyle());
1232 $tpl->addOnLoadCode("il.Util.print();");
1233
1234 // determine target frames for internal links
1235
1236 $page_content = "";
1237 foreach ($terms as $t_id) {
1238 $page_content .= $this->listDefinitions($this->requested_ref_id, $t_id, true, ilPageObjectGUI::PRINTING);
1239 }
1240 $tpl->setContent($page_content);
1241 }
1242
1246 public function getTabs()
1247 {
1248 $ilAccess = $this->access;
1249 $lng = $this->lng;
1251 $ilHelp = $this->help;
1252
1253 $ilHelp->setScreenIdComponent("glo");
1254
1255 if (!$this->offlineMode()) {
1256 if ($this->ctrl->getCmd() != "listDefinitions") {
1257 if ($ilAccess->checkAccess("read", "", $this->requested_ref_id)) {
1258 $this->tabs_gui->addTab(
1259 "terms",
1260 $lng->txt("cont_terms"),
1261 $ilCtrl->getLinkTarget($this, "listTerms")
1262 );
1263 }
1264
1265 $this->tabs_gui->addTab(
1266 "info",
1267 $lng->txt("info_short"),
1268 $ilCtrl->getLinkTarget($this, "infoScreen")
1269 );
1270
1271
1272 // glossary menu
1273 if ($ilAccess->checkAccess("read", "", $this->requested_ref_id)) {
1274 $this->tabs_gui->addTab(
1275 "print_view",
1276 $lng->txt("cont_print_view"),
1277 $ilCtrl->getLinkTarget($this, "printViewSelection")
1278 );
1279
1280 // download links
1281 if ($this->glossary->isActiveDownloads()) {
1282 $this->tabs_gui->addTab(
1283 "download",
1284 $lng->txt("download"),
1285 $ilCtrl->getLinkTarget($this, "showDownloadList")
1286 );
1287 }
1288 //}
1289 }
1290
1291 if ($ilAccess->checkAccess("write", "", (int) $this->requested_ref_id) ||
1292 $ilAccess->checkAccess("edit_content", "", (int) $this->requested_ref_id)) {
1293 $this->tabs_gui->addNonTabbedLink(
1294 "editing_view",
1295 $lng->txt("glo_editing_view"),
1296 "ilias.php?baseClass=ilGlossaryEditorGUI&amp;ref_id=" . (int) $this->requested_ref_id,
1297 "_top"
1298 );
1299 }
1300 }
1301 } else {
1302 $this->tabs_gui->addTarget(
1303 "cont_back",
1304 "index.html#term_" . $this->term_id,
1305 "",
1306 ""
1307 );
1308 }
1309 }
1310
1316 public function infoScreen()
1317 {
1318 $this->ctrl->setCmd("showSummary");
1319 $this->ctrl->setCmdClass("ilinfoscreengui");
1320 $this->outputInfoScreen();
1321 }
1322
1326 public function outputInfoScreen()
1327 {
1328 $ilAccess = $this->access;
1329 $ilTabs = $this->tabs_gui;
1330
1331 $this->setTabs();
1332 $ilTabs->activateTab("info");
1333 $this->lng->loadLanguageModule("meta");
1334
1335 $info = new ilInfoScreenGUI($this->glossary_gui);
1336 $info->enablePrivateNotes();
1337 //$info->enableLearningProgress();
1338
1339 $info->enableNews();
1340 if ($ilAccess->checkAccess("write", "", $this->requested_ref_id)) {
1341 $info->enableNewsEditing();
1342 $news_set = new ilSetting("news");
1343 $enable_internal_rss = $news_set->get("enable_rss_for_internal");
1344 if ($enable_internal_rss) {
1345 $info->setBlockProperty("news", "settings", true);
1346 }
1347 }
1348
1349 // show standard meta data section
1350 $info->addMetaDataSections($this->glossary->getId(), 0, $this->glossary->getType());
1351
1352 ilObjGlossaryGUI::addUsagesToInfo($info, $this->glossary->getId());
1353
1354 if ($this->offlineMode()) {
1355 $this->tpl->setContent($info->getHTML());
1356 return $this->tpl->get();
1357 } else {
1358 // forward the command
1359 $this->ctrl->forwardCommand($info);
1360 }
1361 }
1362
1369 public function chooseLetter()
1370 {
1372
1373 $ilCtrl->redirect($this, "listTerms");
1374 }
1375
1380 public function showTaxonomy()
1381 {
1382 global $DIC;
1383
1384 $tpl = $this->tpl;
1386 if (!$this->offlineMode() && $this->glossary->getShowTaxonomy()) {
1387 $tax_ids = ilObjTaxonomy::getUsageOfObject($this->glossary->getId());
1388 if (count($tax_ids) > 0) {
1389 $tax_id = $tax_ids[0];
1390 $DIC->globalScreen()->tool()->context()->current()
1391 ->addAdditionalData(
1393 true
1394 );
1395 $DIC->globalScreen()->tool()->context()->current()
1396 ->addAdditionalData(
1398 $ctrl->getCurrentClassPath()
1399 );
1400 $DIC->globalScreen()->tool()->context()->current()
1401 ->addAdditionalData(
1403 $tax_id
1404 );
1405 $DIC->globalScreen()->tool()->context()->current()
1406 ->addAdditionalData(
1408 "listTerms"
1409 );
1410 $DIC->globalScreen()->tool()->context()->current()
1411 ->addAdditionalData(
1413 "showTaxonomy"
1414 );
1415
1416 $tax_exp = new ilTaxonomyExplorerGUI(
1417 get_class($this),
1418 "showTaxonomy",
1419 $tax_id,
1420 "ilglossarypresentationgui",
1421 "listTerms"
1422 );
1423 if (!$tax_exp->handleCommand()) {
1424 //$tpl->setLeftNavContent($tax_exp->getHTML());
1425 //$tpl->setLeftContent($tax_exp->getHTML()."&nbsp;");
1426 }
1427 return;
1428 }
1429 }
1430 }
1431}
user()
Definition: user.php:4
$size
Definition: RandomTest.php:84
$_GET["client_id"]
$_POST["username"]
An exception for terminatinating execution or to throw for unit testing.
error($a_errmsg)
set error message @access public
const IL_MODE_ALIAS
const IL_MODE_OUTPUT
This class represents a text property in a property form.
special template class to simplify handling of ITX/PEAR
Glossary definition page GUI class.
static getDefinitionList($a_term_id)
static
downloadFile()
download file of file lists
getPresentationTable()
Get presentation table.
listDefinitions($a_ref_id=0, $a_term_id=0, $a_get_html=false, $a_page_mode=ilPageObjectGUI::PRESENTATION)
list definitions of a term
basicPageGuiInit(\ilPageObjectGUI $a_page_gui)
Basic page gui initialisation.
initPrintViewSelectionForm()
Init print view selection form.
media($a_mode="media")
show media object
getLink( $a_ref_id, $a_cmd="", $a_term_id="", $a_def_id="", $a_frame="", $a_type="")
handles links for learning module presentation
initByRequest(array $query_params)
Init services and this class by request params.
setOfflineDirectory($a_dir)
Set offline directory.
__construct($export_format="", $export_dir="")
Constructor @access public.
infoScreen()
this one is called from the info button in the repository not very nice to set cmdClass/Cmd manually,...
setOfflineMode($a_offline=true)
set offline mode (content is generated for offline package)
resetFilter()
Reset filter (note: this function existed before data table filter has been introduced.
setLocator($a_tree="", $a_id="")
set Locator
downloadExportFile()
send download file (xml/html)
offlineMode()
checks wether offline content generation is activated
static isReferenced($a_glo_id, $a_term_id)
Is a term referenced by one or multiple glossaries.
static _lookGlossaryID($term_id)
get glossary id form term id
Class ilInfoScreenGUI.
static _lookupContObjID($a_id)
get learning module / digibook id for lm object
static _getPresentationTitle( $a_pg_id, $a_mode=self::CHAPTER_TITLE, $a_include_numbers=false, $a_time_scheduled_activation=false, $a_force_content=false, $a_lm_id=0, $a_lang="-", $a_include_short=false)
presentation title doesn't have to be page title, it may be chapter title + page title or chapter tit...
static _getMapAreasIntLinks($a_mob_id)
get all internal links of map areas of a mob
This class represents a (nested) list of checkboxes (could be extended for radio items,...
Class ilObjFile.
static addUsagesToInfo($info, $glo_id)
Add usages to info.
Class ilObjMediaObject.
static getSyntaxStylePath()
get syntax style path
static getEffectiveContentStyleId($a_style_id, $a_type="")
Get effective Style Id.
static getContentStylePath($a_style_id, $add_random=true, $add_token=true)
get content style path
static getUsageOfObject($a_obj_id, $a_include_titles=false)
Get usage of object.
static getSubTreeItems($a_comp, $a_obj_id, $a_item_type, $a_tax_id, $a_node)
Get all assigned items under a node.
Class ilObjectMetaDataGUI.
static _lookupTitle($a_id)
lookup object title
static _getAllReferences($a_id)
get all reference ids of object
Class ilPageObjectGUI.
setOutputMode($a_mode=self::PRESENTATION)
Set Output Mode.
setFileDownloadLink($a_download_link)
Set file download link.
setFullscreenLink($a_fullscreen_link)
Set fullscreen link.
setStyleId($a_styleid)
Set Style Id.
setOfflineDirectory($offdir)
set offline directory to offdir
Term list table for presentation mode.
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.
Class ilTableGUI.
Input GUI class for taxonomy assignments.
Taxonomy explorer GUI class.
special template class to simplify handling of ITX/PEAR
static highlight($a_dom_node_id, $a_text, $a_tpl=null)
Searches for all occurences of a text (case-insensitive) and highlights it.
static _getInstance($a_usr_id)
Get singleton instance.
static getWebspaceDir($mode="filesystem")
get webspace directory
static getStyleSheetLocation($mode="output", $a_css_name="", $a_css_location="")
get full style sheet file name (path inclusive) of current user
static switchColor($a_num, $a_css1, $a_css2)
switches style sheets for each even $a_num (used for changing colors of different result rows)
static deliverFile( $a_file, $a_filename, $a_mime='', $isInline=false, $removeAfterDelivery=false, $a_exit_after=true)
deliver file for download via browser.
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
help()
Definition: help.php:2
global $ilCtrl
Definition: ilias.php:18
xslt_error(&$proc)
xslt_free(&$proc)
xslt_create()
exit
Definition: login.php:29
$i
Definition: metadata.php:24
$xml
Definition: metadata.php:332
$ret
Definition: parser.php:6
$type
$ilErr
Definition: raiseError.php:18
$ilUser
Definition: imgupload.php:18
$a_type
Definition: workflow.php:92
$DIC
Definition: xapitoken.php:46
$cols
Definition: xhr_table.php:11