ILIAS  release_8 Revision v8.24
ilSystemStyleMainGUI Class Reference

Settings UI class for system styles. More...

+ Collaboration diagram for ilSystemStyleMainGUI:

Public Member Functions

 executeCommand ()
 Main routing of the system styles. More...
 
 checkPermission (string $a_perm, bool $a_throw_exc=true)
 Checks permission for system styles. More...
 

Protected Member Functions

 executeDefaultCommand (ilSkinFactory $skin_factory, string $skin_id, string $style_id)
 
 setUnderworldTabs (string $sking_id, string $active='', bool $read_only=false)
 Sets the tab correctly if one system style is open (navigational underworld opened) More...
 
 setUnderworldTitle (string $skin_id, string $style_id, bool $read_only=false)
 Sets title correctly if one system style is opened. More...
 

Protected Attributes

ilCtrl $ctrl
 
ilLanguage $lng
 
ilTabsGUI $tabs
 
ilRbacSystem $rbacsystem
 
string $ref_id
 
ilGlobalTemplateInterface $tpl
 
ilHelpGUI $help
 
Factory $ui_factory
 
Renderer $renderer
 
ilIniFile $ilIniFile
 
ilLocatorGUI $locator
 
Services $global_screen
 
WrapperFactory $request_wrapper
 
RefineryFactory $refinery
 
ServerRequestInterface $request
 
ilToolbarGUI $toolbar
 
ilSkinFactory $skin_factory
 
FileUpload $upload
 
ilTree $tree
 
ilObjUser $user
 
ilSystemStyleMessageStack $message_stack
 

Detailed Description

Settings UI class for system styles.

Acts as main router for the systems styles and handles permissions checks, sets tabs and title as well as description of the content section. @ilCtrl_Calls ilSystemStyleMainGUI: ilSystemStyleOverviewGUI,ilSystemStyleSettingsGUI @ilCtrl_Calls ilSystemStyleMainGUI: ilSystemStyleLessGUI,ilSystemStyleIconsGUI,ilSystemStyleDocumentationGUI

Definition at line 36 of file class.ilSystemStyleMainGUI.php.

Member Function Documentation

◆ checkPermission()

ilSystemStyleMainGUI::checkPermission ( string  $a_perm,
bool  $a_throw_exc = true 
)

Checks permission for system styles.

Permissions work on two levels, ordinary rbac and the 'enable_system_styles_management' setting in the tools section of the ilias.ini.php

Exceptions
ilObjectException

Definition at line 268 of file class.ilSystemStyleMainGUI.php.

268 : bool
269 {
270 $has_perm = true;
271
273 if ($a_perm == 'sty_management') {
274 $has_perm = $this->ilIniFile->readVariable('tools', 'enable_system_styles_management') == '1';
275 $a_perm = 'sty_write_system';
276 if ($has_perm && !is_writable($config->getCustomizingSkinPath())) {
277 $this->message_stack->addMessage(new ilSystemStyleMessage(
278 $this->lng->txt('enable_system_styles_management_no_write_perm'),
280 ));
281 $this->message_stack->sendMessages();
282 $has_perm = false;
283 }
284 }
285
286 if ($has_perm) {
287 $has_perm = $this->rbacsystem->checkAccess($a_perm, (int) $this->ref_id);
288 }
289
290 if (!$has_perm) {
291 if ($a_throw_exc) {
292 throw new ilObjectException($this->lng->txt('sty_permission_denied'));
293 }
294 return false;
295 }
296 return true;
297 }
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...
ilSystemStyleConfig wraps all 'constants' to ensure the testability of all classes using those 'const...
if(!array_key_exists('PATH_INFO', $_SERVER)) $config
Definition: metadata.php:85

References $config, ILIAS\Repository\lng(), and ilSystemStyleMessage\TYPE_ERROR.

Referenced by executeCommand(), and executeDefaultCommand().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ executeCommand()

ilSystemStyleMainGUI::executeCommand ( )

Main routing of the system styles.

Resets ilCtrl Parameter for all subsequent generation of links.

Exceptions
ilCtrlException

Definition at line 95 of file class.ilSystemStyleMainGUI.php.

95 : void
96 {
97 $next_class = $this->ctrl->getNextClass($this);
98
99 $this->help->setScreenIdComponent('sty');
100 $this->help->setScreenId('system_styles');
101
103 $skin_factory = new ilSkinFactory($this->lng);
104
105 if ($this->request_wrapper->query()->has('skin_id') && $this->request_wrapper->query()->has('style_id')) {
106 $skin_id = $this->request_wrapper->query()->retrieve('skin_id', $this->refinery->kindlyTo()->string());
107 $style_id = $this->request_wrapper->query()->retrieve('style_id', $this->refinery->kindlyTo()->string());
108 } else {
109 $skin_id = $config->getDefaultSkinId();
110 $style_id = $config->getDefaultStyleId();
111 }
112
113 $this->ctrl->setParameterByClass('ilsystemstylesettingsgui', 'skin_id', $skin_id);
114 $this->ctrl->setParameterByClass('ilsystemstylesettingsgui', 'style_id', $style_id);
115 $this->ctrl->setParameterByClass('ilsystemstylelessgui', 'skin_id', $skin_id);
116 $this->ctrl->setParameterByClass('ilsystemstylelessgui', 'style_id', $style_id);
117 $this->ctrl->setParameterByClass('ilsystemstyleiconsgui', 'skin_id', $skin_id);
118 $this->ctrl->setParameterByClass('ilsystemstyleiconsgui', 'style_id', $style_id);
119 $this->ctrl->setParameterByClass('ilsystemstyledocumentationgui', 'skin_id', $skin_id);
120 $this->ctrl->setParameterByClass('ilsystemstyledocumentationgui', 'style_id', $style_id);
121
122 try {
123 switch ($next_class) {
124
125 case 'ilsystemstylesettingsgui':
126 $this->help->setSubScreenId('settings');
127 $this->checkPermission('sty_management');
128 $this->setUnderworldTabs($skin_id, 'settings');
129 $this->setUnderworldTitle($skin_id, $style_id);
130 $system_styles_settings = new ilSystemStyleSettingsGUI(
131 $this->ctrl,
132 $this->lng,
133 $this->tpl,
134 $this->tabs,
135 $this->ui_factory,
136 $this->renderer,
138 $this->request_wrapper,
139 $this->refinery,
140 $this->toolbar,
141 $this->user,
142 $this->request,
143 $this->tree,
144 $skin_id,
145 $style_id
146 );
147 $this->ctrl->forwardCommand($system_styles_settings);
148 break;
149 case 'ilsystemstylelessgui':
150 $this->help->setSubScreenId('less');
151 $this->checkPermission('sty_management');
152 $this->setUnderworldTabs($skin_id, 'less');
153 $this->setUnderworldTitle($skin_id, $style_id);
154 $system_styles_less = new ilSystemStyleLessGUI(
155 $this->ctrl,
156 $this->lng,
157 $this->tpl,
158 $this->ui_factory,
159 $this->renderer,
160 $this->request,
161 $this->toolbar,
162 $this->refinery,
164 $skin_id,
165 $style_id
166 );
167 $this->ctrl->forwardCommand($system_styles_less);
168 break;
169 case 'ilsystemstyleiconsgui':
170 $this->help->setSubScreenId('icons');
171 $this->checkPermission('sty_management');
172 $this->setUnderworldTabs($skin_id, 'icons');
173 $this->setUnderworldTitle($skin_id, $style_id);
174 $system_styles_icons = new ilSystemStyleIconsGUI(
175 $this->ctrl,
176 $this->lng,
177 $this->tpl,
178 $this->ui_factory,
179 $this->renderer,
180 $this->request_wrapper,
181 $this->toolbar,
182 $this->refinery,
184 $this->tabs,
185 $this->upload,
186 $skin_id,
187 $style_id
188 );
189 $this->ctrl->forwardCommand($system_styles_icons);
190 break;
191 case 'ilsystemstyledocumentationgui':
192 $this->help->setSubScreenId('documentation');
193 $read_only = !$this->checkPermission('sty_management', false);
194 $this->setUnderworldTabs($skin_id, 'documentation', $read_only);
195 $this->setUnderworldTitle($skin_id, $style_id, $read_only);
196 $node_id = '';
197 if ($this->request_wrapper->query()->has('node_id')) {
198 $node_id = $this->request_wrapper->query()->retrieve(
199 'node_id',
200 $this->refinery->kindlyTo()->string()
201 );
202 }
203 $goto_link = (new ilKSDocumentationGotoLink())->generateGotoLink($node_id, $skin_id, $style_id);
204 $this->global_screen->tool()->context()->current()->addAdditionalData(
206 true
207 );
208 $this->tpl->setPermanentLink('stys', (int) $this->ref_id, $goto_link);
209 $entries = new Entries();
210 $entries->addEntriesFromArray(include ilSystemStyleDocumentationGUI::DATA_PATH);
211 $documentation_gui = new ilSystemStyleDocumentationGUI(
212 $this->tpl,
213 $this->ctrl,
214 $this->ui_factory,
215 $this->renderer
216 );
217 $documentation_gui->show($entries, $node_id);
218 break;
219 case 'ilsystemstyleoverviewgui':
220 default:
221 $this->executeDefaultCommand($skin_factory, $skin_id, $style_id);
222 break;
223 }
224 } catch (ilObjectException $e) {
225 $this->message_stack->addMessage(new ilSystemStyleMessage(
226 $e->getMessage(),
228 ));
229 $this->message_stack->sendMessages();
230 $this->executeDefaultCommand($skin_factory, $skin_id, $style_id);
231 }
232 }
Factory to create Skin classes holds an manages the basic data of a skin as provide by the template o...
Renders the Overview of the Examples in the Administration.
@ilCtrl_Calls ilSystemStyleIconsGUI:
executeDefaultCommand(ilSkinFactory $skin_factory, string $skin_id, string $style_id)
setUnderworldTabs(string $sking_id, string $active='', bool $read_only=false)
Sets the tab correctly if one system style is open (navigational underworld opened)
checkPermission(string $a_perm, bool $a_throw_exc=true)
Checks permission for system styles.
setUnderworldTitle(string $skin_id, string $style_id, bool $read_only=false)
Sets title correctly if one system style is opened.

References $config, Vendor\Package\$e, $ref_id, $skin_factory, checkPermission(), ILIAS\Repository\ctrl(), ilSystemStyleDocumentationGUI\DATA_PATH, executeDefaultCommand(), ILIAS\Repository\help(), ILIAS\Repository\lng(), ILIAS\Repository\refinery(), setUnderworldTabs(), setUnderworldTitle(), ilSystemStyleDocumentationGUI\SHOW_TREE, ILIAS\Repository\tabs(), ILIAS\Repository\toolbar(), ilSystemStyleMessage\TYPE_ERROR, ILIAS\Repository\upload(), and ILIAS\Repository\user().

+ Here is the call graph for this function:

◆ executeDefaultCommand()

ilSystemStyleMainGUI::executeDefaultCommand ( ilSkinFactory  $skin_factory,
string  $skin_id,
string  $style_id 
)
protected

Definition at line 234 of file class.ilSystemStyleMainGUI.php.

234 : void
235 {
236 $this->help->setSubScreenId('overview');
237 $this->checkPermission('visible,read');
238 $read_only = !$this->checkPermission('sty_write_system', false);
239 $management_enabled = $this->checkPermission('sty_management', false);
240 $system_styles_overview = new ilSystemStyleOverviewGUI(
241 $this->ctrl,
242 $this->lng,
243 $this->tpl,
244 $this->ui_factory,
245 $this->renderer,
246 $this->request_wrapper,
247 $this->toolbar,
248 $this->refinery,
249 $skin_factory,
250 $this->upload,
251 $this->tabs,
252 $this->help,
253 $skin_id,
254 $style_id,
255 $this->ref_id,
256 $read_only,
257 $management_enabled
258 );
259
260 $this->ctrl->forwardCommand($system_styles_overview);
261 }

References checkPermission(), ILIAS\Repository\ctrl(), ILIAS\Repository\help(), ILIAS\Repository\lng(), ILIAS\Repository\refinery(), ILIAS\Repository\tabs(), ILIAS\Repository\toolbar(), and ILIAS\Repository\upload().

Referenced by executeCommand().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setUnderworldTabs()

ilSystemStyleMainGUI::setUnderworldTabs ( string  $sking_id,
string  $active = '',
bool  $read_only = false 
)
protected

Sets the tab correctly if one system style is open (navigational underworld opened)

Exceptions
ilCtrlException

Since clearTargets also clears the help screen ids

Definition at line 303 of file class.ilSystemStyleMainGUI.php.

303 : void
304 {
305 $this->tabs->clearTargets();
306
307 if ($read_only) {
308 $this->locator->clearItems();
309 $this->tpl->setLocator();
310 return;
311 }
312
316 $this->help->setScreenIdComponent('sty');
317 $this->help->setScreenId('system_styles');
318 $this->tabs->setBackTarget($this->lng->txt('back'), $this->ctrl->getLinkTarget($this));
320 if ($sking_id != $config->getDefaultSkinId()) {
321 $this->tabs->addTab(
322 'settings',
323 $this->lng->txt('settings'),
324 $this->ctrl->getLinkTargetByClass('ilsystemstylesettingsgui')
325 );
326 $this->tabs->addTab(
327 'less',
328 $this->lng->txt('less'),
329 $this->ctrl->getLinkTargetByClass('ilsystemstylelessgui')
330 );
331 $this->tabs->addTab(
332 'icons',
333 $this->lng->txt('icons'),
334 $this->ctrl->getLinkTargetByClass('ilsystemstyleiconsgui')
335 );
336 }
337
338 $this->tabs->addTab(
339 'documentation',
340 $this->lng->txt('documentation'),
341 $this->ctrl->getLinkTargetByClass('ilsystemstyledocumentationgui')
342 );
343
344 $this->tabs->activateTab($active);
345 }

References $config, ILIAS\Repository\help(), ILIAS\Repository\lng(), ILIAS\Repository\locator(), and ILIAS\Repository\tabs().

Referenced by executeCommand().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setUnderworldTitle()

ilSystemStyleMainGUI::setUnderworldTitle ( string  $skin_id,
string  $style_id,
bool  $read_only = false 
)
protected

Sets title correctly if one system style is opened.

Exceptions
ilSystemStyleException

Definition at line 351 of file class.ilSystemStyleMainGUI.php.

351 : void
352 {
353 $skin = $this->skin_factory->skinStyleContainerFromId($skin_id, $this->message_stack)->getSkin();
354 $style = $skin->getStyle($style_id);
355
356 if ($read_only) {
357 $this->tpl->setTitle($this->lng->txt('documentation'));
358
359 if ($style->isSubstyle()) {
360 $this->tpl->setDescription(
361 $this->lng->txt('ks_documentation_of_substyle')
362 . " '"
363 . $style->getName() . "' " .
364 $this->lng->txt('of_parent') . " '" . $skin->getStyle($style->getSubstyleOf())->getName() . "' " .
365 $this->lng->txt('from_skin') . ' ' . $skin->getName()
366 );
367 } else {
368 $this->tpl->setDescription(
369 $this->lng->txt('ks_documentation_of_style') . " '" . $style->getName() . "' " .
370 $this->lng->txt('from_skin') . " '" . $skin->getName() . "'"
371 );
372 }
373 } else {
374 $this->tpl->setTitle($style->getName());
375 if ($style->isSubstyle()) {
376 $this->tpl->setDescription(
377 $this->lng->txt('settings_of_substyle') . " '" . $style->getName() . "' " .
378 $this->lng->txt('of_parent') . " '" . $skin->getStyle($style->getSubstyleOf())->getName() . "' " .
379 $this->lng->txt('from_skin') . ' ' . $skin->getName()
380 );
381 } else {
382 $this->tpl->setDescription(
383 $this->lng->txt('settings_of_style') . " '" . $style->getName() . "' " .
384 $this->lng->txt('from_skin') . " '" . $skin->getName() . "'"
385 );
386 }
387 }
388 }

References ILIAS\Repository\lng().

Referenced by executeCommand().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ $ctrl

ilCtrl ilSystemStyleMainGUI::$ctrl
protected

Definition at line 38 of file class.ilSystemStyleMainGUI.php.

◆ $global_screen

Services ilSystemStyleMainGUI::$global_screen
protected

Definition at line 49 of file class.ilSystemStyleMainGUI.php.

◆ $help

ilHelpGUI ilSystemStyleMainGUI::$help
protected

Definition at line 44 of file class.ilSystemStyleMainGUI.php.

◆ $ilIniFile

ilIniFile ilSystemStyleMainGUI::$ilIniFile
protected

Definition at line 47 of file class.ilSystemStyleMainGUI.php.

◆ $lng

ilLanguage ilSystemStyleMainGUI::$lng
protected

Definition at line 39 of file class.ilSystemStyleMainGUI.php.

◆ $locator

ilLocatorGUI ilSystemStyleMainGUI::$locator
protected

Definition at line 48 of file class.ilSystemStyleMainGUI.php.

◆ $message_stack

ilSystemStyleMessageStack ilSystemStyleMainGUI::$message_stack
protected

Definition at line 58 of file class.ilSystemStyleMainGUI.php.

◆ $rbacsystem

ilRbacSystem ilSystemStyleMainGUI::$rbacsystem
protected

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

◆ $ref_id

string ilSystemStyleMainGUI::$ref_id
protected

Definition at line 42 of file class.ilSystemStyleMainGUI.php.

Referenced by executeCommand().

◆ $refinery

RefineryFactory ilSystemStyleMainGUI::$refinery
protected

Definition at line 51 of file class.ilSystemStyleMainGUI.php.

◆ $renderer

Renderer ilSystemStyleMainGUI::$renderer
protected

Definition at line 46 of file class.ilSystemStyleMainGUI.php.

◆ $request

ServerRequestInterface ilSystemStyleMainGUI::$request
protected

Definition at line 52 of file class.ilSystemStyleMainGUI.php.

◆ $request_wrapper

WrapperFactory ilSystemStyleMainGUI::$request_wrapper
protected

Definition at line 50 of file class.ilSystemStyleMainGUI.php.

◆ $skin_factory

ilSkinFactory ilSystemStyleMainGUI::$skin_factory
protected

Definition at line 54 of file class.ilSystemStyleMainGUI.php.

Referenced by executeCommand().

◆ $tabs

ilTabsGUI ilSystemStyleMainGUI::$tabs
protected

Definition at line 40 of file class.ilSystemStyleMainGUI.php.

◆ $toolbar

ilToolbarGUI ilSystemStyleMainGUI::$toolbar
protected

Definition at line 53 of file class.ilSystemStyleMainGUI.php.

◆ $tpl

ilGlobalTemplateInterface ilSystemStyleMainGUI::$tpl
protected

Definition at line 43 of file class.ilSystemStyleMainGUI.php.

◆ $tree

ilTree ilSystemStyleMainGUI::$tree
protected

Definition at line 56 of file class.ilSystemStyleMainGUI.php.

◆ $ui_factory

Factory ilSystemStyleMainGUI::$ui_factory
protected

Definition at line 45 of file class.ilSystemStyleMainGUI.php.

◆ $upload

FileUpload ilSystemStyleMainGUI::$upload
protected

Definition at line 55 of file class.ilSystemStyleMainGUI.php.

◆ $user

ilObjUser ilSystemStyleMainGUI::$user
protected

Definition at line 57 of file class.ilSystemStyleMainGUI.php.


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