ILIAS  release_9 Revision v9.13-25-g2c18ec4c24f
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. ilSystemStyleMainGUI: ilSystemStyleOverviewGUI,ilSystemStyleConfigGUI ilSystemStyleMainGUI: ilSystemStyleScssGUI,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 267 of file class.ilSystemStyleMainGUI.php.

References ILIAS\Repository\lng(), ilIniFile\readVariable(), and ilSystemStyleMessage\TYPE_ERROR.

Referenced by executeCommand(), and executeDefaultCommand().

267  : bool
268  {
269  $has_perm = true;
270 
271  $config = new ilSystemStyleConfig();
272  if ($a_perm == 'sty_management') {
273  $has_perm = $this->ilIniFile->readVariable('tools', 'enable_system_styles_management') == '1';
274  $a_perm = 'sty_write_system';
275  if ($has_perm && !is_writable($config->getCustomizingSkinPath())) {
276  $this->message_stack->addMessage(new ilSystemStyleMessage(
277  $this->lng->txt('enable_system_styles_management_no_write_perm'),
279  ));
280  $this->message_stack->sendMessages();
281  $has_perm = false;
282  }
283  }
284 
285  if ($has_perm) {
286  $has_perm = $this->rbacsystem->checkAccess($a_perm, (int) $this->ref_id);
287  }
288 
289  if (!$has_perm) {
290  if ($a_throw_exc) {
291  throw new ilObjectException($this->lng->txt('sty_permission_denied'));
292  }
293  return false;
294  }
295  return true;
296  }
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...
readVariable(string $a_group, string $a_var_name)
reads a single variable from a group
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
+ 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.

References Vendor\Package\$e, 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().

95  : void
96  {
97  $next_class = $this->ctrl->getNextClass($this);
98 
99  $this->help->setScreenIdComponent('sty');
100  $this->help->setScreenId('system_styles');
101 
102  $config = new ilSystemStyleConfig();
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(ilSystemStyleConfigGUI::class, 'skin_id', $skin_id);
114  $this->ctrl->setParameterByClass(ilSystemStyleConfigGUI::class, 'style_id', $style_id);
115  $this->ctrl->setParameterByClass(ilSystemStyleScssGUI::class, 'skin_id', $skin_id);
116  $this->ctrl->setParameterByClass(ilSystemStyleScssGUI::class, 'style_id', $style_id);
117  $this->ctrl->setParameterByClass(ilSystemStyleIconsGUI::class, 'skin_id', $skin_id);
118  $this->ctrl->setParameterByClass(ilSystemStyleIconsGUI::class, 'style_id', $style_id);
119  $this->ctrl->setParameterByClass(ilSystemStyleDocumentationGUI::class, 'skin_id', $skin_id);
120  $this->ctrl->setParameterByClass(ilSystemStyleDocumentationGUI::class, 'style_id', $style_id);
121 
122  try {
123  switch ($next_class) {
124  case strtolower(ilSystemStyleConfigGUI::class):
125  $this->help->setSubScreenId('settings');
126  $this->checkPermission('sty_management');
127  $this->setUnderworldTabs($skin_id, 'settings');
128  $this->setUnderworldTitle($skin_id, $style_id);
129  $system_styles_settings = new ilSystemStyleConfigGUI(
130  $this->ctrl,
131  $this->lng,
132  $this->tpl,
133  $this->tabs,
134  $this->ui_factory,
135  $this->renderer,
137  $this->request_wrapper,
138  $this->refinery,
139  $this->toolbar,
140  $this->user,
141  $this->request,
142  $this->tree,
143  $skin_id,
144  $style_id
145  );
146  $this->ctrl->forwardCommand($system_styles_settings);
147  break;
148  case strtolower(ilSystemStyleScssGUI::class):
149  $this->help->setSubScreenId('scss');
150  $this->checkPermission('sty_management');
151  $this->setUnderworldTabs($skin_id, 'scss');
152  $this->setUnderworldTitle($skin_id, $style_id);
153  $system_styles_scss = new ilSystemStyleScssGUI(
154  $this->ctrl,
155  $this->lng,
156  $this->tpl,
157  $this->ui_factory,
158  $this->renderer,
159  $this->request,
160  $this->toolbar,
161  $this->refinery,
163  $skin_id,
164  $style_id
165  );
166  $this->ctrl->forwardCommand($system_styles_scss);
167  break;
168  case strtolower(ilSystemStyleIconsGUI::class):
169  $this->help->setSubScreenId('icons');
170  $this->checkPermission('sty_management');
171  $this->setUnderworldTabs($skin_id, 'icons');
172  $this->setUnderworldTitle($skin_id, $style_id);
173  $system_styles_icons = new ilSystemStyleIconsGUI(
174  $this->ctrl,
175  $this->lng,
176  $this->tpl,
177  $this->ui_factory,
178  $this->renderer,
179  $this->request_wrapper,
180  $this->toolbar,
181  $this->refinery,
183  $this->tabs,
184  $this->upload,
185  $skin_id,
186  $style_id
187  );
188  $this->ctrl->forwardCommand($system_styles_icons);
189  break;
190  case strtolower(ilSystemStyleDocumentationGUI::class):
191  $this->help->setSubScreenId('documentation');
192  $read_only = !$this->checkPermission('sty_management', false);
193  $this->setUnderworldTabs($skin_id, 'documentation', $read_only);
194  $this->setUnderworldTitle($skin_id, $style_id, $read_only);
195  $node_id = '';
196  if ($this->request_wrapper->query()->has('node_id')) {
197  $node_id = $this->request_wrapper->query()->retrieve(
198  'node_id',
199  $this->refinery->kindlyTo()->string()
200  );
201  }
202  $goto_link = (new ilKSDocumentationGotoLink())->generateGotoLink($node_id, $skin_id, $style_id);
203  $this->global_screen->tool()->context()->current()->addAdditionalData(
205  true
206  );
207  $this->tpl->setPermanentLink('stys', (int) $this->ref_id, $goto_link);
208  $entries = new Entries();
209  $entries->addEntriesFromArray(include ilSystemStyleDocumentationGUI::DATA_PATH);
210  $documentation_gui = new ilSystemStyleDocumentationGUI(
211  $this->tpl,
212  $this->ctrl,
213  $this->ui_factory,
214  $this->renderer
215  );
216  $documentation_gui->show($entries, $node_id);
217  break;
218  case strtolower(ilSystemStyleOverviewGUI::class):
219  default:
220  $this->executeDefaultCommand($skin_factory, $skin_id, $style_id);
221  break;
222  }
223  } catch (ilObjectException $e) {
224  $this->message_stack->addMessage(new ilSystemStyleMessage(
225  $e->getMessage(),
227  ));
228  $this->message_stack->sendMessages();
229  $this->executeDefaultCommand($skin_factory, $skin_id, $style_id);
230  }
231  }
Factory to create Skin classes holds an manages the basic data of a skin as provide by the template o...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
setUnderworldTitle(string $skin_id, string $style_id, bool $read_only=false)
Sets title correctly if one system style is opened.
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.
Renders the Overview of the Examples in the Administration.
ilSystemStyleConfig wraps all 'constants' to ensure the testability of all classes using those 'const...
executeDefaultCommand(ilSkinFactory $skin_factory, string $skin_id, string $style_id)
+ Here is the call graph for this function:

◆ executeDefaultCommand()

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

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

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().

233  : void
234  {
235  $this->help->setSubScreenId('overview');
236  $this->checkPermission('visible,read');
237  $read_only = !$this->checkPermission('sty_write_system', false);
238  $management_enabled = $this->checkPermission('sty_management', false);
239  $system_styles_overview = new ilSystemStyleOverviewGUI(
240  $this->ctrl,
241  $this->lng,
242  $this->tpl,
243  $this->ui_factory,
244  $this->renderer,
245  $this->request_wrapper,
246  $this->toolbar,
247  $this->refinery,
248  $skin_factory,
249  $this->upload,
250  $this->tabs,
251  $this->help,
252  $skin_id,
253  $style_id,
254  $this->ref_id,
255  $read_only,
256  $management_enabled
257  );
258 
259  $this->ctrl->forwardCommand($system_styles_overview);
260  }
checkPermission(string $a_perm, bool $a_throw_exc=true)
Checks permission for system styles.
+ 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 302 of file class.ilSystemStyleMainGUI.php.

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

Referenced by executeCommand().

302  : void
303  {
304  $this->tabs->clearTargets();
305 
306  if ($read_only) {
307  $this->locator->clearItems();
308  $this->tpl->setLocator();
309  return;
310  }
311 
315  $this->help->setScreenIdComponent('sty');
316  $this->help->setScreenId('system_styles');
317  $this->tabs->setBackTarget($this->lng->txt('back'), $this->ctrl->getLinkTarget($this));
318  $config = new ilSystemStyleConfig();
319  if ($sking_id != $config->getDefaultSkinId()) {
320  $this->tabs->addTab(
321  'settings',
322  $this->lng->txt('settings'),
323  $this->ctrl->getLinkTargetByClass('ilsystemstyleconfiggui')
324  );
325  $this->tabs->addTab(
326  'scss',
327  $this->lng->txt('scss'),
328  $this->ctrl->getLinkTargetByClass('ilsystemstylescssgui')
329  );
330  $this->tabs->addTab(
331  'icons',
332  $this->lng->txt('icons'),
333  $this->ctrl->getLinkTargetByClass('ilsystemstyleiconsgui')
334  );
335  }
336 
337  $this->tabs->addTab(
338  'documentation',
339  $this->lng->txt('documentation'),
340  $this->ctrl->getLinkTargetByClass(ilSystemStyleDocumentationGUI::class)
341  );
342 
343  $this->tabs->activateTab($active);
344  }
ilSystemStyleConfig wraps all 'constants' to ensure the testability of all classes using those 'const...
+ 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 350 of file class.ilSystemStyleMainGUI.php.

References ILIAS\Repository\lng().

Referenced by executeCommand().

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

◆ $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.

◆ $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: