ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
class.ilLMEditorGUI.php
Go to the documentation of this file.
1<?php
2
20
27{
28 protected \ILIAS\GlobalScreen\ScreenContext\ContextServices $tool_context;
29 protected ilCtrl $ctrl;
32 protected ilHelpGUI $help;
34 protected ilLanguage $lng;
36 protected int $ref_id;
38 protected ilLMTree $tree;
39 protected int $obj_id;
40 protected int $requested_active_node = 0;
41 protected bool $to_page = false;
43 protected \ILIAS\Style\Content\GUIService $content_style_gui;
44
45 public function __construct()
46 {
47 global $DIC;
48
49 $this->rbacsystem = $DIC->rbac()->system();
50 $this->help = $DIC->help();
51 $tpl = $DIC->ui()->mainTemplate();
52 $lng = $DIC->language();
53 $objDefinition = $DIC["objDefinition"];
54 $ilCtrl = $DIC->ctrl();
55 $rbacsystem = $DIC->rbac()->system();
56 $ilNavigationHistory = $DIC["ilNavigationHistory"];
57
58 $lng->loadLanguageModule("content");
60
61 $this->request = $DIC
62 ->learningModule()
63 ->internal()
64 ->gui()
65 ->editing()
66 ->request();
67
68 $this->ref_id = $this->request->getRefId();
69 $this->obj_id = $this->request->getObjId();
70
71 // check write permission
72 if (!$rbacsystem->checkAccess("write", $this->ref_id)) {
73 throw new ilPermissionException($lng->txt("permission_denied"));
74 }
75
76 $this->ctrl = $ilCtrl;
77 $this->tool_context = $DIC->globalScreen()->tool()->context();
78
79 $this->ctrl->saveParameter($this, array("ref_id", "transl"));
80
81 // initiate variables
82 $this->tpl = $tpl;
83 $this->lng = $lng;
84 $this->objDefinition = $objDefinition;
85
88 $this->lm_obj = $lm_obj;
89 $this->tree = new ilLMTree($this->lm_obj->getId());
90
91 $ilNavigationHistory->addItem(
92 $this->ref_id,
93 "ilias.php?baseClass=ilLMEditorGUI&ref_id=" . $this->ref_id,
94 "lm"
95 );
96
97 $this->requested_active_node = $this->request->getActiveNode();
98 $this->to_page = $this->request->getToPage();
99
100 $this->checkRequestParameters();
101 $cs = $DIC->contentStyle();
102 $this->content_style_gui = $cs->gui();
103 }
104
110 protected function checkRequestParameters(): void
111 {
112 $forwards_to_role = $this->ctrl->checkCurrentPathForClass("ilobjrolegui");
113
114 if (!$forwards_to_role && $this->obj_id > 0 && ilLMObject::_lookupContObjID($this->obj_id) != $this->lm_obj->getId()) {
115 throw new ilException("Object ID does not match learning module.");
116 }
117 if ($this->requested_active_node > 0 && ilLMObject::_lookupContObjID($this->requested_active_node) != $this->lm_obj->getId()) {
118 throw new ilException("Active node does not match learning module.");
119 }
120 }
121
122
127 public function executeCommand(): void
128 {
129 global $DIC;
130
131 $this->tool_context->claim()->repository();
132
133 $cmd = "";
134
136 $loc = $DIC["ilLocator"];
137 $loc->addRepositoryItems($this->ref_id);
138
139 if ($this->to_page) {
140 $this->ctrl->setParameterByClass("illmpageobjectgui", "obj_id", $this->obj_id);
141 $this->ctrl->redirectByClass(array("ilobjlearningmodulegui", "illmpageobjectgui"), "edit");
142 }
143
144 $this->showTree();
145
146 $next_class = $this->ctrl->getNextClass($this);
147
148 // show footer
149 $show_footer = ($cmd !== "explorer");
150
151 switch ($next_class) {
152 case "ilobjlearningmodulegui":
153 $this->main_header();
154 $lm_gui = new ilObjLearningModuleGUI("", $this->ref_id, true, false);
155
156 $ret = $this->ctrl->forwardCommand($lm_gui);
157 if (strcmp($cmd, "explorer") != 0) {
158 $this->displayLocator();
159 }
160 // (horrible) workaround for preventing template engine
161 // from hiding paragraph text that is enclosed
162 // in curly brackets (e.g. "{a}", see ilPageObjectGUI::showPage())
163 // @todo 6.0
164 /*
165 $output = $this->tpl->getSpecial("DEFAULT", true, true, $show_footer,true);
166 $output = str_replace("&#123;", "{", $output);
167 $output = str_replace("&#125;", "}", $output);
168 header('Content-type: text/html; charset=UTF-8');
169 echo $output;*/
170 $this->tpl->printToStdout();
171 break;
172
173 default:
174 $this->ctrl->redirectByClass(array("ilobjlearningmodulegui"), "");
175 break;
176 }
177 }
178
182 public function showTree(): void
183 {
185
186 $this->tool_context->current()->addAdditionalData(ilLMEditGSToolProvider::SHOW_TREE, true);
187
188 $exp = new ilLMEditorExplorerGUI($this, "showTree", $this->lm_obj);
189 $exp->handleCommand();
190 }
191
195 public function main_header(): void
196 {
197 $this->tpl->loadStandardTemplate();
198
199 // content style
200 $this->content_style_gui->addCss(
201 $this->tpl,
202 $this->lm_obj->getRefId()
203 );
204
205 // syntax style
206 $this->tpl->setCurrentBlock("SyntaxStyle");
207 $this->tpl->setVariable(
208 "LOCATION_SYNTAX_STYLESHEET",
210 );
211 $this->tpl->parseCurrentBlock();
212 }
213
214
218 public function displayLocator(): void
219 {
220 $this->tpl->setLocator();
221 }
222}
Class ilCtrl provides processing control methods.
Base class for ILIAS Exception handling.
Help GUI class.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
GUI class for learning module editor.
ILIAS Style Content GUIService $content_style_gui
ilObjLearningModule $lm_obj
ILIAS GlobalScreen ScreenContext ContextServices $tool_context
ilRbacSystem $rbacsystem
checkRequestParameters()
Check request parameters.
ilGlobalTemplateInterface $tpl
EditingGUIRequest $request
ilNavigationHistory $nav_history
main_header()
output main header (title and locator)
displayLocator()
Display locator.
ilObjectDefinition $objDefinition
static _lookupContObjID(int $a_id)
get learning module id for lm object
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
language handling
loadLanguageModule(string $a_module)
Load language module.
txt(string $a_topic, string $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
Last visited history for repository items.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
parses the objects.xml it handles the xml-description of all ilias objects
static getInstanceByRefId(int $ref_id, bool $stop_on_error=true)
get an instance of an Ilias object by reference id
class ilRbacSystem system function like checkAccess, addActiveRole ... Supporting system functions ar...
checkAccess(string $a_operations, int $a_ref_id, string $a_type="")
checkAccess represents the main method of the RBAC-system in ILIAS3 developers want to use With this ...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
global $DIC
Definition: shib_login.php:26