ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
ilTermDefinitionEditorGUI Class Reference

GUI class for glossary term definition editor. More...

+ Collaboration diagram for ilTermDefinitionEditorGUI:

Public Member Functions

 __construct ()
 Constructor public. More...
 
 executeCommand ()
 
 main_header ($a_header_title)
 output main header (title and locator) More...
 
 setTabs ()
 output tabs More...
 
 getTabs ()
 get tabs More...
 
 saveShortText ()
 

Data Fields

 $tpl
 
 $lng
 
 $glossary
 
 $definition
 
 $term
 

Protected Attributes

 $ctrl
 
 $tabs_gui
 

Detailed Description

GUI class for glossary term definition editor.

Author
Alex Killing alex..nosp@m.kill.nosp@m.ing@g.nosp@m.mx.d.nosp@m.e
Version
$Id$

ilTermDefinitionEditorGUI: ilGlossaryDefPageGUI

Definition at line 19 of file class.ilTermDefinitionEditorGUI.php.

Constructor & Destructor Documentation

◆ __construct()

ilTermDefinitionEditorGUI::__construct ( )

Constructor public.

Definition at line 41 of file class.ilTermDefinitionEditorGUI.php.

References $_GET, $DIC, $ilCtrl, $lng, $tpl, ilGlossaryTerm\_lookGlossaryID(), and array.

42  {
43  global $DIC;
44 
45  $tpl = $DIC["tpl"];
46  $lng = $DIC->language();
47  $ilCtrl = $DIC->ctrl();
48  $ilTabs = $DIC->tabs();
49 
50  // initiate variables
51  $this->tpl = $tpl;
52  $this->lng = $lng;
53  $this->ctrl = $ilCtrl;
54  $this->glossary = new ilObjGlossary($_GET["ref_id"], true);
55  $this->definition = new ilGlossaryDefinition($_GET["def"]);
56  $this->term = new ilGlossaryTerm($this->definition->getTermId());
57  $this->term_glossary = new ilObjGlossary(ilGlossaryTerm::_lookGlossaryID($this->definition->getTermId()), false);
58  $this->tabs_gui = $ilTabs;
59 
60  $this->ctrl->saveParameter($this, array("def"));
61  }
global $DIC
Definition: saml.php:7
$_GET["client_id"]
Class ilGlossaryTerm.
Class ilObjGlossary.
global $ilCtrl
Definition: ilias.php:18
Create styles array
The data for the language used.
static _lookGlossaryID($term_id)
get glossary id form term id
Class ilGlossaryDefinition.
+ Here is the call graph for this function:

Member Function Documentation

◆ executeCommand()

ilTermDefinitionEditorGUI::executeCommand ( )

Definition at line 64 of file class.ilTermDefinitionEditorGUI.php.

References $_GET, $ctrl, $ilCtrl, $lng, $ret, $tpl, ilObjStyleSheet\getContentStylePath(), ilObjStyleSheet\getEffectiveContentStyleId(), ilMD\getGeneral(), ilUtil\getImagePath(), ilGlossaryTerm\getNumberOfUsages(), ilPageObjectGUI\getPageObject(), ilObjStyleSheet\getSyntaxStylePath(), ilUtil\sendInfo(), ilPageObjectGUI\setEditPreview(), setTabs(), and ilMDBase\update().

65  {
66  $tpl = $this->tpl;
68  $lng = $this->lng;
69 
70  $next_class = $this->ctrl->getNextClass($this);
71  $cmd = $this->ctrl->getCmd();
72 
73  // content style
74  $this->tpl->setCurrentBlock("ContentStyle");
75  $this->tpl->setVariable(
76  "LOCATION_CONTENT_STYLESHEET",
77  ilObjStyleSheet::getContentStylePath($this->term_glossary->getStyleSheetId())
78  );
79  $this->tpl->parseCurrentBlock();
80 
81  // syntax style
82  $this->tpl->setCurrentBlock("SyntaxStyle");
83  $this->tpl->setVariable(
84  "LOCATION_SYNTAX_STYLESHEET",
86  );
87  $this->tpl->parseCurrentBlock();
88 
89  require_once("./Modules/Glossary/classes/class.ilGlossaryLocatorGUI.php");
90  $gloss_loc = new ilGlossaryLocatorGUI();
91  $gloss_loc->setTerm($this->term);
92  $gloss_loc->setGlossary($this->glossary);
93  $gloss_loc->setDefinition($this->definition);
94 
95  // $this->tpl->getStandardTemplate();
96  $this->tpl->setTitle($this->term->getTerm() . " - " .
97  $this->lng->txt("cont_definition") . " " .
98  $this->definition->getNr());
99  if ($this->ctrl->getNextClass() == "ilglossarydefpagegui") {
100  $this->tpl->setTitleIcon(ilUtil::getImagePath("icon_glo.svg"));
101  }
102 
103  switch ($next_class) {
104 
105  case "ilglossarydefpagegui":
106 
107  // output number of usages
108  if ($ilCtrl->getCmd() == "edit" &&
109  $ilCtrl->getCmdClass() == "ilglossarydefpagegui") {
110  $nr = ilGlossaryTerm::getNumberOfUsages($_GET["term_id"]);
111  if ($nr > 0) {
112  $link = "[<a href='" .
113  $ilCtrl->getLinkTargetByClass("ilglossarytermgui", "listUsages") .
114  "'>" . $lng->txt("glo_list_usages") . "</a>]";
115  ilUtil::sendInfo(sprintf(
116  $lng->txt("glo_term_is_used_n_times"),
117  $nr
118  ) . " " . $link);
119  }
120  }
121 
122  // not so nice, to do: revise locator handling
123  if ($this->ctrl->getNextClass() == "ilglossarydefpagegui"
124  || $this->ctrl->getCmdClass() == "ileditclipboardgui") {
125  $gloss_loc->display();
126  }
127  $this->setTabs();
128  $this->ctrl->setReturnByClass("ilGlossaryDefPageGUI", "edit");
129  $this->ctrl->setReturn($this, "listDefinitions");
130  $page_gui = new ilGlossaryDefPageGUI($this->definition->getId());
131  $page = $page_gui->getPageObject();
132  $this->definition->assignPageObject($page);
133  $page->addUpdateListener($this, "saveShortText");
134  $page_gui->setEditPreview(true);
135 
136  // metadata
137  // ... set title to term, if no title is given
138  include_once("./Services/MetaData/classes/class.ilMD.php");
139  $md = new ilMD($this->term_glossary->getId(), $this->definition->getId(), "gdf");
140  $md_gen = $md->getGeneral();
141  if ($md_gen->getTitle() == "") {
142  $md_gen->setTitle($this->term->getTerm());
143  $md_gen->update();
144  }
145 
146  $page_gui->activateMetaDataEditor($this->term_glossary, "gdf", $this->definition->getId());
147 
148  $page_gui->setSourcecodeDownloadScript("ilias.php?baseClass=ilGlossaryPresentationGUI&amp;ref_id=" . $_GET["ref_id"]);
149  $page_gui->setFullscreenLink("ilias.php?baseClass=ilGlossaryPresentationGUI&amp;cmd=fullscreen&amp;ref_id=" . $_GET["ref_id"]);
150  $page_gui->setTemplateTargetVar("ADM_CONTENT");
151  $page_gui->setOutputMode("edit");
152 
153  $page_gui->setStyleId(ilObjStyleSheet::getEffectiveContentStyleId(
154  $this->term_glossary->getStyleSheetId(),
155  "glo"
156  ));
157  $page_gui->setLocator($gloss_loc);
158  $page_gui->setIntLinkReturn($this->ctrl->getLinkTargetByClass(
159  "ilobjglossarygui",
160  "quickList",
161  "",
162  false,
163  false
164  ));
165  $page_gui->setPageBackTitle($this->lng->txt("cont_definition"));
166  $page_gui->setLinkParams("ref_id=" . $_GET["ref_id"]);
167  $page_gui->setHeader($this->term->getTerm());
168  $page_gui->setFileDownloadLink("ilias.php?baseClass=ilGlossaryPresentationGUI&amp;cmd=downloadFile&amp;ref_id=" . $_GET["ref_id"]);
169  $page_gui->setPresentationTitle($this->term->getTerm());
170  $ret = $this->ctrl->forwardCommand($page_gui);
171  $tpl->setContent($ret);
172  break;
173 
174  default:
175  $this->setTabs();
176  $gloss_loc->display();
177  $ret = $this->$cmd();
178  break;
179 
180  }
181  }
setEditPreview($a_editpreview)
Set Display first Edit tab, then Preview tab, instead of Page and Edit.
getPageObject()
Get Page Object.
$_GET["client_id"]
static getNumberOfUsages($a_term_id)
Get number of usages.
global $ilCtrl
Definition: ilias.php:18
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)
static getEffectiveContentStyleId($a_style_id, $a_type="")
Get effective Style Id.
& getGeneral()
Definition: class.ilMD.php:40
static getSyntaxStylePath()
get syntax style path
static getContentStylePath($a_style_id, $add_random=true)
get content style path
Glossary definition page GUI class.
$ret
Definition: parser.php:6
+ Here is the call graph for this function:

◆ getTabs()

ilTermDefinitionEditorGUI::getTabs ( )

get tabs

Definition at line 209 of file class.ilTermDefinitionEditorGUI.php.

Referenced by setTabs().

210  {
211  // back to glossary
212  $this->tabs_gui->setBack2Target(
213  $this->lng->txt("glossary"),
214  $this->ctrl->getParentReturn($this)
215  );
216 
217  // back to upper context
218  $this->tabs_gui->setBackTarget(
219  $this->lng->txt("term"),
220  $this->ctrl->getLinkTargetByClass("ilglossarytermgui", "editTerm")
221  );
222  }
+ Here is the caller graph for this function:

◆ main_header()

ilTermDefinitionEditorGUI::main_header (   $a_header_title)

output main header (title and locator)

Definition at line 187 of file class.ilTermDefinitionEditorGUI.php.

References $lng.

188  {
189  $lng = $this->lng;
190 
191  $this->tpl->getStandardTemplate();
192  $this->tpl->setTitle($a_header_title);
193  $this->displayLocator();
194  //$this->setAdminTabs($a_type);
195  }

◆ saveShortText()

ilTermDefinitionEditorGUI::saveShortText ( )

Definition at line 225 of file class.ilTermDefinitionEditorGUI.php.

226  {
227  $this->definition->updateShortText();
228  }

◆ setTabs()

ilTermDefinitionEditorGUI::setTabs ( )

output tabs

Definition at line 200 of file class.ilTermDefinitionEditorGUI.php.

References getTabs().

Referenced by executeCommand().

201  {
202  // catch feedback message
203  $this->getTabs();
204  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ $ctrl

ilTermDefinitionEditorGUI::$ctrl
protected

Definition at line 24 of file class.ilTermDefinitionEditorGUI.php.

Referenced by executeCommand().

◆ $definition

ilTermDefinitionEditorGUI::$definition

Definition at line 34 of file class.ilTermDefinitionEditorGUI.php.

◆ $glossary

ilTermDefinitionEditorGUI::$glossary

Definition at line 33 of file class.ilTermDefinitionEditorGUI.php.

◆ $lng

ilTermDefinitionEditorGUI::$lng

Definition at line 32 of file class.ilTermDefinitionEditorGUI.php.

Referenced by __construct(), executeCommand(), and main_header().

◆ $tabs_gui

ilTermDefinitionEditorGUI::$tabs_gui
protected

Definition at line 29 of file class.ilTermDefinitionEditorGUI.php.

◆ $term

ilTermDefinitionEditorGUI::$term

Definition at line 35 of file class.ilTermDefinitionEditorGUI.php.

◆ $tpl

ilTermDefinitionEditorGUI::$tpl

Definition at line 31 of file class.ilTermDefinitionEditorGUI.php.

Referenced by __construct(), and executeCommand().


The documentation for this class was generated from the following file: