ILIAS  release_7 Revision v7.30-3-g800a261c036
class.ilGlossaryLocatorGUI.php
Go to the documentation of this file.
1<?php
2
3/* Copyright (c) 1998-2012 ILIAS open source, Extended GPL, see docs/LICENSE */
4
14{
18 protected $ctrl;
19
23 protected $locator;
24
25 public $mode;
26 public $temp_var;
27 public $tree;
28 public $obj;
29 public $lng;
30 public $tpl;
31
32
33 public function __construct()
34 {
35 global $DIC;
36
37 $this->ctrl = $DIC->ctrl();
38 $this->locator = $DIC["ilLocator"];
39 $lng = $DIC->language();
40 $tpl = $DIC["tpl"];
41 $tree = $DIC->repositoryTree();
42
43 $this->mode = "edit";
44 $this->temp_var = "LOCATOR";
45 $this->lng = $lng;
46 $this->tpl = $tpl;
47 $this->tree = $tree;
48 }
49
50 public function setTemplateVariable($a_temp_var)
51 {
52 $this->temp_var = $a_temp_var;
53 }
54
55 public function setTerm(&$a_term)
56 {
57 $this->term = $a_term;
58 }
59
60 public function setGlossary(&$a_glossary)
61 {
62 $this->glossary = $a_glossary;
63 }
64
65 public function setDefinition(&$a_def)
66 {
67 $this->definition = $a_def;
68 }
69
70 public function setMode($a_mode)
71 {
72 $this->mode = $a_mode;
73 }
74
78 public function display()
79 {
81 $ilCtrl = $this->ctrl;
82 $ilLocator = $this->locator;
84
85 // repository links
86 $ilLocator->addRepositoryItems();
87
88 // glossary link
89 $title = $this->glossary->getTitle();
90 if ($this->mode == "edit") {
91 $link = $ilCtrl->getLinkTargetByClass("ilobjglossarygui", "listTerms");
92 } else {
93 $ilCtrl->setParameterByClass("ilglossarypresentationgui", "term_id", "");
94 $link = $ilCtrl->getLinkTargetByClass("ilglossarypresentationgui");
95 if (is_object($this->term)) {
96 $ilCtrl->setParameterByClass("ilglossarypresentationgui", "term_id", $this->term->getId());
97 }
98 }
99 $ilLocator->addItem($title, $link, "");
100
101 if (is_object($this->term) && $this->mode != "edit") {
102 $ilCtrl->setParameterByClass("ilglossarypresentationgui", "term_id", $this->term->getId());
103 $ilLocator->addItem(
104 $this->term->getTerm(),
105 $ilCtrl->getLinkTargetByClass("ilglossarypresentationgui", "listDefinitions")
106 );
107 $ilCtrl->setParameterByClass("ilglossarypresentationgui", "term_id", $_GET["term_id"]);
108 }
109
110 if (is_object($this->definition)) {
111 $title = $this->term->getTerm() . " (" . $this->lng->txt("cont_definition") . " " . $this->definition->getNr() . ")";
112 if ($this->mode == "edit") {
113 $link = $ilCtrl->getLinkTargetByClass("ilglossarydefpagegui", "edit");
114 } else {
115 $ilCtrl->setParameterByClass("ilglossarypresentationgui", "def", $_GET["def"]);
116 $link = $ilCtrl->getLinkTargetByClass("ilglossarypresentationgui", "view");
117 }
118 $ilLocator->addItem($title, $link);
119 }
120
121 $tpl->setLocator();
122 }
123}
$_GET["client_id"]
An exception for terminatinating execution or to throw for unit testing.
global $DIC
Definition: goto.php:24