ILIAS  release_7 Revision v7.30-3-g800a261c036
All Data Structures Namespaces Files Functions Variables Modules Pages
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 ilTermDefinitionEditorGUI: ilGlossaryDefPageGUI

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

Constructor & Destructor Documentation

◆ __construct()

ilTermDefinitionEditorGUI::__construct ( )

Constructor public.

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

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

34  {
35  global $DIC;
36 
37  $tpl = $DIC["tpl"];
38  $lng = $DIC->language();
39  $ilCtrl = $DIC->ctrl();
40  $ilTabs = $DIC->tabs();
41 
42  // initiate variables
43  $this->tpl = $tpl;
44  $this->lng = $lng;
45  $this->ctrl = $ilCtrl;
46  $this->glossary = new ilObjGlossary($_GET["ref_id"], true);
47  $this->definition = new ilGlossaryDefinition($_GET["def"]);
48  $this->term = new ilGlossaryTerm($this->definition->getTermId());
49  $this->term_glossary = new ilObjGlossary(ilGlossaryTerm::_lookGlossaryID($this->definition->getTermId()), false);
50  $this->tabs_gui = $ilTabs;
51 
52  $this->ctrl->saveParameter($this, array("def"));
53  }
$_GET["client_id"]
Glossary terms.
Class ilObjGlossary.
global $DIC
Definition: goto.php:24
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 56 of file class.ilTermDefinitionEditorGUI.php.

References $_GET, $ctrl, $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().

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

Referenced by setTabs().

201  {
202  // back to glossary
203  $this->tabs_gui->setBack2Target(
204  $this->lng->txt("glossary"),
205  $this->ctrl->getParentReturn($this)
206  );
207 
208  // back to upper context
209  $this->tabs_gui->setBackTarget(
210  $this->lng->txt("term"),
211  $this->ctrl->getLinkTargetByClass("ilglossarytermgui", "editTerm")
212  );
213  }
+ 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 178 of file class.ilTermDefinitionEditorGUI.php.

References $lng.

179  {
180  $lng = $this->lng;
181 
182  $this->tpl->loadStandardTemplate();
183  $this->tpl->setTitle($a_header_title);
184  $this->displayLocator();
185  //$this->setAdminTabs($a_type);
186  }

◆ saveShortText()

ilTermDefinitionEditorGUI::saveShortText ( )

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

217  {
218  $this->definition->updateShortText();
219  }

◆ setTabs()

ilTermDefinitionEditorGUI::setTabs ( )

output tabs

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

References getTabs().

Referenced by executeCommand().

192  {
193  // catch feedback message
194  $this->getTabs();
195  }
+ 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 16 of file class.ilTermDefinitionEditorGUI.php.

Referenced by executeCommand().

◆ $definition

ilTermDefinitionEditorGUI::$definition

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

◆ $glossary

ilTermDefinitionEditorGUI::$glossary

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

◆ $lng

ilTermDefinitionEditorGUI::$lng

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

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

◆ $tabs_gui

ilTermDefinitionEditorGUI::$tabs_gui
protected

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

◆ $term

ilTermDefinitionEditorGUI::$term

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

◆ $tpl

ilTermDefinitionEditorGUI::$tpl

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

Referenced by __construct(), and executeCommand().


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