Go to the documentation of this file.00001 <?php
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00033 class ilGlossaryLocatorGUI
00034 {
00035 var $mode;
00036 var $temp_var;
00037 var $tree;
00038 var $obj;
00039 var $lng;
00040 var $tpl;
00041
00042
00043 function ilGlossaryLocatorGUI()
00044 {
00045 global $lng, $tpl, $tree;
00046
00047 $this->mode = "edit";
00048 $this->temp_var = "LOCATOR";
00049 $this->lng =& $lng;
00050 $this->tpl =& $tpl;
00051 $this->tree =& $tree;
00052 }
00053
00054 function setTemplateVariable($a_temp_var)
00055 {
00056 $this->temp_var = $a_temp_var;
00057 }
00058
00059 function setTerm(&$a_term)
00060 {
00061 $this->term =& $a_term;
00062 }
00063
00064 function setGlossary(&$a_glossary)
00065 {
00066 $this->glossary =& $a_glossary;
00067 }
00068
00069 function setDefinition(&$a_def)
00070 {
00071 $this->definition =& $a_def;
00072 }
00073
00074 function setMode($a_mode)
00075 {
00076 $this->mode = $a_mode;
00077 }
00078
00082 function display()
00083 {
00084 global $lng, $ilCtrl;
00085
00086 $this->tpl->addBlockFile("LOCATOR", "locator", "tpl.locator.html");
00087
00088 $path = $this->tree->getPathFull($_GET["ref_id"]);
00089
00090 if (is_object($this->term))
00091 {
00092 $modifier = 0;
00093 }
00094 else
00095 {
00096 $modifier = 1;
00097 }
00098
00099 switch($this->mode)
00100 {
00101 case "edit":
00102 $repository = "./repository.php";
00103 break;
00104
00105 case "presentation":
00106 $script = "ilias.php?baseClass=ilGlossaryPresentationGUI";
00107 $repository = "./repository.php";
00108 break;
00109 }
00110
00111
00112
00113
00114 foreach ($path as $key => $row)
00115 {
00116
00117
00118
00119
00120
00121 if (($key < count($path) - $modifier))
00122 {
00123 $this->tpl->touchBlock("locator_separator");
00124 }
00125
00126
00127 $this->tpl->setCurrentBlock("locator_item");
00128 $t_frame = "";
00129 if ($row["child"] == $this->tree->getRootId())
00130 {
00131 $title = $this->lng->txt("repository");
00132 $link = $repository."?cmd=frameset&ref_id=".$row["child"];
00133 $t_frame = ilFrameTargetInfo::_getFrame("MainContent");
00134 }
00135 else if (($_GET["ref_id"] == $row["child"]))
00136 {
00137 $title = $this->glossary->getTitle();
00138 if ($this->mode == "edit")
00139 {
00140 $link = $ilCtrl->getLinkTargetByClass("ilobjglossarygui", "listTerms");
00141 }
00142 else
00143 {
00144 $link = $script."&ref_id=".$_GET["ref_id"];
00145 }
00146 }
00147 else
00148 {
00149 $title = $row["title"];
00150 $link = $repository."?cmd=frameset&ref_id=".$row["child"];
00151 $t_frame = ilFrameTargetInfo::_getFrame("MainContent");
00152 }
00153 $this->tpl->setVariable("ITEM", $title);
00154 $this->tpl->setVariable("LINK_ITEM", $link);
00155 if ($t_frame != "")
00156 {
00157 $this->tpl->setVariable("LINK_TARGET", " target=\"$t_frame\" ");
00158 }
00159 $this->tpl->parseCurrentBlock();
00160 }
00161
00162
00163
00164
00165
00166
00167
00168
00169 if (is_object($this->term) && $this->mode != "edit")
00170 {
00171 $this->tpl->setCurrentBlock("locator_item");
00172 $this->tpl->setVariable("ITEM", $this->term->getTerm());
00173
00174
00175
00176
00177
00178
00179
00180 $this->tpl->setVariable("LINK_ITEM", $script."&ref_id=".$_GET["ref_id"].
00181 "&cmd=listDefinitions&term_id=".$this->term->getId());
00182
00183 $this->tpl->parseCurrentBlock();
00184 }
00185
00186
00187
00188 if (is_object($this->definition))
00189 {
00190 $this->tpl->setCurrentBlock("locator_item");
00191 $this->tpl->setVariable("ITEM", $this->term->getTerm()." (".
00192 $this->lng->txt("cont_definition")." ".
00193 $this->definition->getNr().")");
00194 if ($this->mode == "edit")
00195 {
00196 $this->tpl->setVariable("LINK_ITEM",
00197 $ilCtrl->getLinkTargetByClass("ilpageobjectgui", "view"));
00198 }
00199 else
00200 {
00201 $this->tpl->setVariable("LINK_ITEM", $script."&ref_id=".$_GET["ref_id"].
00202 "&cmd=view&def=".$_GET["def"]);
00203 }
00204 $this->tpl->parseCurrentBlock();
00205 }
00206
00207
00208
00209 $this->tpl->setCurrentBlock("locator");
00210 $this->tpl->setVariable("TXT_LOCATOR", $debug.$this->lng->txt("locator"));
00211 $this->tpl->parseCurrentBlock();
00212 }
00213
00214 }
00215 ?>