ILIAS  release_4-3 Revision
 All Data Structures Namespaces Files Functions Variables Groups Pages
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 {
15  var $mode;
16  var $temp_var;
17  var $tree;
18  var $obj;
19  var $lng;
20  var $tpl;
21 
22 
24  {
25  global $lng, $tpl, $tree;
26 
27  $this->mode = "edit";
28  $this->temp_var = "LOCATOR";
29  $this->lng =& $lng;
30  $this->tpl =& $tpl;
31  $this->tree =& $tree;
32  }
33 
34  function setTemplateVariable($a_temp_var)
35  {
36  $this->temp_var = $a_temp_var;
37  }
38 
39  function setTerm(&$a_term)
40  {
41  $this->term =& $a_term;
42  }
43 
44  function setGlossary(&$a_glossary)
45  {
46  $this->glossary =& $a_glossary;
47  }
48 
49  function setDefinition(&$a_def)
50  {
51  $this->definition =& $a_def;
52  }
53 
54  function setMode($a_mode)
55  {
56  $this->mode = $a_mode;
57  }
58 
62  function display()
63  {
64  global $lng, $ilCtrl, $ilLocator, $tpl;
65 
66  // repository links
67  $ilLocator->addRepositoryItems();
68 
69  // glossary link
70  $title = $this->glossary->getTitle();
71  if ($this->mode == "edit")
72  {
73  $link = $ilCtrl->getLinkTargetByClass("ilobjglossarygui", "listTerms");
74  }
75  else
76  {
77  $ilCtrl->setParameterByClass("ilglossarypresentationgui", "term_id", "");
78  $link = $ilCtrl->getLinkTargetByClass("ilglossarypresentationgui");
79  if (is_object($this->term))
80  {
81  $ilCtrl->setParameterByClass("ilglossarypresentationgui", "term_id", $this->term->getId());
82  }
83  }
84  $ilLocator->addItem($title, $link, "");
85 
86  if (is_object($this->term) && $this->mode != "edit")
87  {
88  $ilCtrl->setParameterByClass("ilglossarypresentationgui", "term_id", $this->term->getId());
89  $ilLocator->addItem($this->term->getTerm(),
90  $ilCtrl->getLinkTargetByClass("ilglossarypresentationgui", "listDefinitions"));
91  $ilCtrl->setParameterByClass("ilglossarypresentationgui", "term_id", $_GET["term_id"]);
92  }
93 
94  if (is_object($this->definition))
95  {
96  $title = $this->term->getTerm()." (".$this->lng->txt("cont_definition")." ".$this->definition->getNr().")";
97  if ($this->mode == "edit")
98  {
99  $link = $ilCtrl->getLinkTargetByClass("ilpageobjectgui", "edit");
100  }
101  else
102  {
103  $ilCtrl->setParameterByClass("ilglossarypresentationgui", "def", $_GET["def"]);
104  $link = $ilCtrl->getLinkTargetByClass("ilglossarypresentationgui", "view");
105  }
106  $ilLocator->addItem($title, $link);
107  }
108 
109  $tpl->setLocator();
110  }
111 
112 }
113 ?>