ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
class.ilTermDefinitionEditorGUI.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
5
6require_once("./Services/Style/Content/classes/class.ilObjStyleSheet.php");
7require_once ("./Modules/Glossary/classes/class.ilGlossaryDefPageGUI.php");
8
20{
21 var $ilias;
22 var $tpl;
23 var $lng;
26 var $term;
27
32 function __construct()
33 {
34 global $ilias, $tpl, $lng, $objDefinition, $ilCtrl, $ilTabs;
35
36 // initiate variables
37 $this->ilias = $ilias;
38 $this->tpl = $tpl;
39 $this->lng = $lng;
40 $this->ctrl = $ilCtrl;
41 $this->glossary = new ilObjGlossary($_GET["ref_id"], true);
42 $this->definition = new ilGlossaryDefinition($_GET["def"]);
43 $this->term = new ilGlossaryTerm($this->definition->getTermId());
44 $this->term_glossary = new ilObjGlossary(ilGlossaryTerm::_lookGlossaryID($this->definition->getTermId()), false);
45 $this->tabs_gui = $ilTabs;
46
47 $this->ctrl->saveParameter($this, array("def"));
48 }
49
50
51 function executeCommand()
52 {
53 global $tpl, $ilCtrl, $lng;
54
55 $next_class = $this->ctrl->getNextClass($this);
56 $cmd = $this->ctrl->getCmd();
57
58 // content style
59 $this->tpl->setCurrentBlock("ContentStyle");
60 $this->tpl->setVariable("LOCATION_CONTENT_STYLESHEET",
61 ilObjStyleSheet::getContentStylePath($this->term_glossary->getStyleSheetId()));
62 $this->tpl->parseCurrentBlock();
63
64 // syntax style
65 $this->tpl->setCurrentBlock("SyntaxStyle");
66 $this->tpl->setVariable("LOCATION_SYNTAX_STYLESHEET",
68 $this->tpl->parseCurrentBlock();
69
70 require_once ("./Modules/Glossary/classes/class.ilGlossaryLocatorGUI.php");
71 $gloss_loc = new ilGlossaryLocatorGUI();
72 $gloss_loc->setTerm($this->term);
73 $gloss_loc->setGlossary($this->glossary);
74 $gloss_loc->setDefinition($this->definition);
75
76// $this->tpl->getStandardTemplate();
77 $this->tpl->setTitle($this->term->getTerm()." - ".
78 $this->lng->txt("cont_definition")." ".
79 $this->definition->getNr());
80 if ($this->ctrl->getNextClass() == "ilglossarydefpagegui")
81 {
82 $this->tpl->setTitleIcon(ilUtil::getImagePath("icon_glo.svg"));
83 }
84
85 switch ($next_class)
86 {
87
88 case "ilglossarydefpagegui":
89
90 // output number of usages
91 if ($ilCtrl->getCmd() == "edit" &&
92 $ilCtrl->getCmdClass() == "ilglossarydefpagegui")
93 {
95 if ($nr > 0)
96 {
97 $link = "[<a href='".
98 $ilCtrl->getLinkTargetByClass("ilglossarytermgui", "listUsages").
99 "'>".$lng->txt("glo_list_usages")."</a>]";
100 ilUtil::sendInfo(sprintf($lng->txt("glo_term_is_used_n_times"),
101 $nr)." ".$link);
102 }
103 }
104
105 // not so nice, to do: revise locator handling
106 if ($this->ctrl->getNextClass() == "ilglossarydefpagegui"
107 || $this->ctrl->getCmdClass() == "ileditclipboardgui")
108 {
109 $gloss_loc->display();
110 }
111 $this->setTabs();
112 $this->ctrl->setReturnByClass("ilGlossaryDefPageGUI", "edit");
113 $this->ctrl->setReturn($this, "listDefinitions");
114 $page_gui = new ilGlossaryDefPageGUI($this->definition->getId());
115 $page = $page_gui->getPageObject();
116 $this->definition->assignPageObject($page);
117 $page->addUpdateListener($this, "saveShortText");
118 $page_gui->setEditPreview(true);
119
120 // metadata
121 // ... set title to term, if no title is given
122 include_once("./Services/MetaData/classes/class.ilMD.php");
123 $md = new ilMD($this->term_glossary->getId(), $this->definition->getId(), "gdf");
124 $md_gen = $md->getGeneral();
125 if ($md_gen->getTitle() == "")
126 {
127 $md_gen->setTitle($this->term->getTerm());
128 $md_gen->update();
129 }
130
131 $page_gui->activateMetaDataEditor($this->term_glossary, "gdf", $this->definition->getId());
132
133 $page_gui->setSourcecodeDownloadScript("ilias.php?baseClass=ilGlossaryPresentationGUI&amp;ref_id=".$_GET["ref_id"]);
134 $page_gui->setFullscreenLink("ilias.php?baseClass=ilGlossaryPresentationGUI&amp;cmd=fullscreen&amp;ref_id=".$_GET["ref_id"]);
135 $page_gui->setTemplateTargetVar("ADM_CONTENT");
136 $page_gui->setOutputMode("edit");
137
139 $this->term_glossary->getStyleSheetId(), "glo"));
140 $page_gui->setLocator($gloss_loc);
141 $page_gui->setIntLinkReturn($this->ctrl->getLinkTargetByClass("ilobjglossarygui", "quickList",
142 "", false, false));
143 $page_gui->setPageBackTitle($this->lng->txt("cont_definition"));
144 $page_gui->setLinkParams("ref_id=".$_GET["ref_id"]);
145 $page_gui->setHeader($this->term->getTerm());
146 $page_gui->setFileDownloadLink("ilias.php?baseClass=ilGlossaryPresentationGUI&amp;cmd=downloadFile&amp;ref_id=".$_GET["ref_id"]);
147 $page_gui->setPresentationTitle($this->term->getTerm());
148 $ret = $this->ctrl->forwardCommand($page_gui);
149 $tpl->setContent($ret);
150 break;
151
152 default:
153 $this->setTabs();
154 $gloss_loc->display();
155 $ret = $this->$cmd();
156 break;
157
158 }
159 }
160
161
165 function main_header($a_header_title)
166 {
167 global $lng;
168
169 $this->tpl->getStandardTemplate();
170 $this->tpl->setTitle($a_header_title);
171 $this->displayLocator();
172 //$this->setAdminTabs($a_type);
173 }
174
178 function setTabs()
179 {
180 // catch feedback message
181 $this->getTabs();
182 }
183
187 function getTabs()
188 {
189 // back to glossary
190 $this->tabs_gui->setBack2Target($this->lng->txt("glossary"),
191 $this->ctrl->getParentReturn($this));
192
193 // back to upper context
194 $this->tabs_gui->setBackTarget($this->lng->txt("term"),
195 $this->ctrl->getLinkTargetByClass("ilglossarytermgui", "editTerm"));
196
197 }
198
199
200 function saveShortText()
201 {
202 $this->definition->updateShortText();
203 }
204}
205?>
sprintf('%.4f', $callTime)
$_GET["client_id"]
An exception for terminatinating execution or to throw for unit testing.
Glossary definition page GUI class.
Class ilGlossaryDefinition.
Class ilGlossaryTerm.
static getNumberOfUsages($a_term_id)
Get number of usages.
static _lookGlossaryID($term_id)
get glossary id form term id
Class ilObjGlossary.
static getSyntaxStylePath()
get syntax style path
static getEffectiveContentStyleId($a_style_id, $a_type="")
Get effective Style Id.
static getContentStylePath($a_style_id)
get content style path
GUI class for glossary term definition editor.
main_header($a_header_title)
output main header (title and locator)
__construct()
Constructor @access public.
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
global $ilCtrl
Definition: ilias.php:18
redirection script todo: (a better solution should control the processing via a xml file)
$ret
Definition: parser.php:6
$cmd
Definition: sahs_server.php:35