ILIAS  release_8 Revision v8.24
ilSystemStyleOverviewGUI Class Reference
+ Collaboration diagram for ilSystemStyleOverviewGUI:

Public Member Functions

 __construct (ilCtrl $ctrl, ilLanguage $lng, ilGlobalTemplateInterface $tpl, Factory $ui_factory, Renderer $renderer, WrapperFactory $request_wrapper, ilToolbarGUI $toolbar, Refinery $refinery, ilSkinFactory $skin_factory, FileUpload $upload, ilTabsGUI $tabs, ilHelpGUI $help, string $skin_id, string $style_id, string $ref_id, bool $read_only, bool $management_enabled)
 
 executeCommand ()
 
 edit ()
 
 moveUserStyles ()
 
 saveStyleSettings ()
 
 isReadOnly ()
 
 setReadOnly (bool $read_only)
 
 isManagementEnabled ()
 
 setManagementEnabled (bool $management_enabled)
 

Protected Member Functions

 view ()
 
 cancel ()
 
 checkStyleSettings (ilSystemStyleMessageStack $message_stack, array $active_styles)
 
 addSystemStyle ()
 
 saveNewSystemStyle ()
 
 addSystemStyleForms ()
 
 createSystemStyleForm ()
 
 importSystemStyleForm ()
 
 cloneSystemStyleForm ()
 
 copyStyle ()
 
 deleteStyle ()
 
 deleteStyles ()
 
 checkDeletable (string $skin_id, string $style_id, ilSystemStyleMessageStack $message_stack)
 
 confirmDelete ()
 
 export ()
 
 addSubStyle ()
 
 addSubStyleForms ()
 
 saveNewSubStyle ()
 

Protected Attributes

ilCtrl $ctrl
 
ilToolbarGUI $toolbar
 
ilLanguage $lng
 
ilGlobalTemplateInterface $tpl
 
ilSkinFactory $skin_factory
 
ilFileSystemHelper $file_system
 
ilSkinStyleContainer $style_container
 
ilSystemStyleMessageStack $message_stack
 
Factory $ui_factory
 
Renderer $renderer
 
WrapperFactory $request_wrapper
 
Refinery $refinery
 
ilSystemStyleConfig $config
 
ilTabsGUI $tabs
 
ilHelpGUI $help
 
FileUpload $upload
 
string $ref_id
 
bool $read_only = true
 
bool $management_enabled = false
 
string $style_id
 

Detailed Description

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

Constructor & Destructor Documentation

◆ __construct()

ilSystemStyleOverviewGUI::__construct ( ilCtrl  $ctrl,
ilLanguage  $lng,
ilGlobalTemplateInterface  $tpl,
Factory  $ui_factory,
Renderer  $renderer,
WrapperFactory  $request_wrapper,
ilToolbarGUI  $toolbar,
Refinery  $refinery,
ilSkinFactory  $skin_factory,
FileUpload  $upload,
ilTabsGUI  $tabs,
ilHelpGUI  $help,
string  $skin_id,
string  $style_id,
string  $ref_id,
bool  $read_only,
bool  $management_enabled 
)

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

69 {
70 $this->ctrl = $ctrl;
71 $this->lng = $lng;
72 $this->tpl = $tpl;
73 $this->ui_factory = $ui_factory;
74 $this->renderer = $renderer;
75 $this->request_wrapper = $request_wrapper;
76 $this->toolbar = $toolbar;
77 $this->refinery = $refinery;
78 $this->tabs = $tabs;
79 $this->style_id = $style_id;
80 $this->message_stack = new ilSystemStyleMessageStack($this->tpl);
81 $this->skin_factory = $skin_factory;
82 $this->style_container = $this->skin_factory->skinStyleContainerFromId($skin_id, $this->message_stack);
83 $this->help = $help;
84 $this->ref_id = $ref_id;
85 $this->file_system = new ilFileSystemHelper($this->lng, $this->message_stack);
86 $this->upload = $upload;
87 $this->config = new ilSystemStyleConfig();
88 $this->setReadOnly($read_only);
90 }
File System Helper, to reduce deps.
skinStyleContainerFromId(string $skin_id, ilSystemStyleMessageStack $message_stack)
Get container class is responsible for all file system related actions related actions of a skin such...
ilSystemStyleConfig wraps all 'constants' to ensure the testability of all classes using those 'const...
Used to stack messages to be shown to the user.
setManagementEnabled(bool $management_enabled)

References $ctrl, $help, $lng, $ref_id, $refinery, $renderer, $request_wrapper, $skin_factory, $style_id, $tabs, $toolbar, $tpl, $ui_factory, $upload, ILIAS\Repository\ctrl(), ILIAS\Repository\help(), ILIAS\Repository\lng(), ILIAS\Repository\refinery(), setManagementEnabled(), setReadOnly(), ilSkinFactory\skinStyleContainerFromId(), ILIAS\Repository\tabs(), ILIAS\Repository\toolbar(), and ILIAS\Repository\upload().

+ Here is the call graph for this function:

Member Function Documentation

◆ addSubStyle()

ilSystemStyleOverviewGUI::addSubStyle ( )
protected

Since clearTargets also clears the help screen ids

Definition at line 706 of file class.ilSystemStyleOverviewGUI.php.

706 : void
707 {
708 $this->tabs->clearTargets();
712 $this->help->setScreenIdComponent('sty');
713 $this->help->setScreenId('system_styles');
714 $this->help->setSubScreenId('create_sub');
715
716 $form = $this->addSubStyleForms();
717
718 $this->tpl->setContent($form->getHTML());
719 }

References ILIAS\Repository\help(), and ILIAS\Repository\tabs().

+ Here is the call graph for this function:

◆ addSubStyleForms()

ilSystemStyleOverviewGUI::addSubStyleForms ( )
protected

Definition at line 721 of file class.ilSystemStyleOverviewGUI.php.

722 {
723 $form = new ilPropertyFormGUI();
724 $form->setFormAction($this->ctrl->getFormAction($this));
725 $form->setTitle($this->lng->txt('sty_create_new_system_sub_style'));
726
727 $ti = new ilTextInputGUI($this->lng->txt('sub_style_id'), 'sub_style_id');
728 $ti->setInfo($this->lng->txt('sub_style_id_description'));
729 $ti->setMaxLength(128);
730 $ti->setSize(40);
731 $ti->setRequired(true);
732 $form->addItem($ti);
733
734 $ti = new ilTextInputGUI($this->lng->txt('sub_style_name'), 'sub_style_name');
735 $ti->setInfo($this->lng->txt('sub_style_name_description'));
736 $ti->setMaxLength(128);
737 $ti->setSize(40);
738 $ti->setRequired(true);
739 $form->addItem($ti);
740
741 // source
742 $ti = new ilSelectInputGUI($this->lng->txt('parent'), 'parent_style');
743 $ti->setRequired(true);
744 $ti->setInfo($this->lng->txt('sub_style_parent_style_description'));
746 $options = [];
747 foreach ($styles as $id => $style) {
748 $system_style_conf = new ilSystemStyleConfig();
749 if ($style['skin_id'] != $system_style_conf->getDefaultSkinId() && !$style['substyle_of']) {
750 $options[$id] = $style['title'];
751 }
752 }
753 $ti->setOptions($options);
754
755 $form->addItem($ti);
756 $form->addCommandButton('saveNewSubStyle', $this->lng->txt('save'));
757 $form->addCommandButton('cancel', $this->lng->txt('cancel'));
758
759 return $form;
760 }
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
This class represents a property form user interface.
This class represents a selection list property in a property form.
static getAllSkinStyles()
Get all skins/styles as array (convenient for tables) Attention: tempalte_name/template_id in this ar...
This class represents a text property in a property form.

References $id, ILIAS\Repository\ctrl(), ilStyleDefinition\getAllSkinStyles(), and ILIAS\Repository\lng().

+ Here is the call graph for this function:

◆ addSystemStyle()

ilSystemStyleOverviewGUI::addSystemStyle ( )
protected

Definition at line 294 of file class.ilSystemStyleOverviewGUI.php.

294 : void
295 {
296 $this->addSystemStyleForms();
297 }

References addSystemStyleForms().

+ Here is the call graph for this function:

◆ addSystemStyleForms()

ilSystemStyleOverviewGUI::addSystemStyleForms ( )
protected

Since clearTargets also clears the help screen ids

Definition at line 341 of file class.ilSystemStyleOverviewGUI.php.

341 : void
342 {
343 $this->tabs->clearTargets();
347 $this->help->setScreenIdComponent('sty');
348 $this->help->setScreenId('system_styles');
349 $this->help->setSubScreenId('create');
350
351 $forms = [];
352
353 $forms[] = $this->createSystemStyleForm();
354 $forms[] = $this->importSystemStyleForm();
355 $forms[] = $this->cloneSystemStyleForm();
356
357 $this->tpl->setContent($this->getCreationFormsHTML($forms));
358 }

References cloneSystemStyleForm(), createSystemStyleForm(), ILIAS\Repository\help(), importSystemStyleForm(), and ILIAS\Repository\tabs().

Referenced by addSystemStyle().

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

◆ cancel()

ilSystemStyleOverviewGUI::cancel ( )
protected

Definition at line 139 of file class.ilSystemStyleOverviewGUI.php.

139 : void
140 {
141 $this->edit();
142 }

References edit().

+ Here is the call graph for this function:

◆ checkDeletable()

ilSystemStyleOverviewGUI::checkDeletable ( string  $skin_id,
string  $style_id,
ilSystemStyleMessageStack  $message_stack 
)
protected

Definition at line 583 of file class.ilSystemStyleOverviewGUI.php.

587 : bool {
588 $passed = true;
591 $style_id . ': ' . $this->lng->txt('cant_delete_if_users_assigned'),
593 ));
594 $passed = false;
595 }
598 $style_id . ': ' . $this->lng->txt('cant_delete_activated_style'),
600 ));
601 $passed = false;
602 }
605 $style_id . ': ' . $this->lng->txt('cant_delete_default_style'),
607 ));
608 $passed = false;
609 }
610
611 if ($this->skin_factory->skinStyleContainerFromId($skin_id, $this->message_stack)->getSkin()->getSubstylesOfStyle($style_id)) {
613 $style_id . ': ' . $this->lng->txt('cant_delete_style_with_substyles'),
615 ));
616 $passed = false;
617 }
618 return $passed;
619 }
static _getNumberOfUsersForStyle(string $a_skin, string $a_style)
addMessage(ilSystemStyleMessage $message)
Add a message to be displayed by the stack.
ilSystemStyleMessageStack $message_stack
static _lookupActivatedStyle(string $a_skin, string $a_style)
lookup if a style is activated
static getCurrentDefaultSkin()
Gets default Skin of the System.

References $message_stack, $style_id, ilSystemStyleMessageStack\addMessage(), ILIAS\Repository\lng(), and ilSystemStyleMessage\TYPE_ERROR.

Referenced by deleteStyle(), and deleteStyles().

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

◆ checkStyleSettings()

ilSystemStyleOverviewGUI::checkStyleSettings ( ilSystemStyleMessageStack  $message_stack,
array  $active_styles 
)
protected

Definition at line 251 of file class.ilSystemStyleOverviewGUI.php.

251 : bool
252 {
253 $passed = true;
254
255 if (count($active_styles) < 1) {
256 $passed = false;
258 $this->lng->txt('at_least_one_style'),
260 ));
261 }
262
263 $default_style = $this->request_wrapper->post()->retrieve(
264 'default_skin_style',
265 $this->refinery->kindlyTo()->string()
266 );
267
268 if (!isset($active_styles[$default_style])) {
269 $passed = false;
271 $this->lng->txt('cant_deactivate_default_style'),
273 ));
274 }
275
276 // check if a style should be deactivated, that still has
277 // a user assigned to
279
280 foreach ($all_styles as $style) {
281 if (!isset($active_styles[$style['id']])) {
282 if (ilObjUser::_getNumberOfUsersForStyle($style['template_id'], $style['style_id']) > 0) {
283 $passed = false;
285 $style['style_name'] . ': ' . $this->lng->txt('cant_deactivate_if_users_assigned'),
287 ));
288 }
289 }
290 }
291 return $passed;
292 }

References $message_stack, ilObjUser\_getNumberOfUsersForStyle(), ilSystemStyleMessageStack\addMessage(), ilStyleDefinition\getAllSkinStyles(), ILIAS\Repository\lng(), ILIAS\Repository\refinery(), and ilSystemStyleMessage\TYPE_ERROR.

Referenced by saveStyleSettings().

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

◆ cloneSystemStyleForm()

ilSystemStyleOverviewGUI::cloneSystemStyleForm ( )
protected

Definition at line 418 of file class.ilSystemStyleOverviewGUI.php.

419 {
420 $form = new ilPropertyFormGUI();
421 $form->setFormAction($this->ctrl->getFormAction($this));
422 $form->setTitle($this->lng->txt('sty_copy_other_system_style'));
423
424 // source
425 $ti = new ilSelectInputGUI($this->lng->txt('sty_source'), 'source_style');
426 $ti->setRequired(true);
428 $options = [];
429 foreach ($styles as $id => $style) {
430 $system_style_conf = new ilSystemStyleConfig();
431 if ($style['skin_id'] != $system_style_conf->getDefaultSkinId()) {
432 $options[$id] = $style['title'];
433 }
434 }
435 $ti->setOptions($options);
436
437 $form->addItem($ti);
438
439 $form->addCommandButton('copyStyle', $this->lng->txt('copy'));
440 $form->addCommandButton('cancel', $this->lng->txt('cancel'));
441
442 return $form;
443 }

References $id, ILIAS\Repository\ctrl(), ilStyleDefinition\getAllSkinStyles(), and ILIAS\Repository\lng().

Referenced by addSystemStyleForms().

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

◆ confirmDelete()

ilSystemStyleOverviewGUI::confirmDelete ( )
protected

Definition at line 621 of file class.ilSystemStyleOverviewGUI.php.

621 : void
622 {
623 $i = 0;
624 while ($this->request_wrapper->post()->has('style_' . $i)) {
625 try {
626 $skin_style_id = $this->request_wrapper->post()->retrieve(
627 'style_' . $i,
628 $this->refinery->string()->splitString(':')
629 );
630 $container = $this->skin_factory->skinStyleContainerFromId($skin_style_id[0], $this->message_stack);
631 $syle = $container->getSkin()->getStyle($skin_style_id[1]);
632 $container->deleteStyle($syle);
633 if (!$container->getSkin()->hasStyles()) {
634 $container->delete();
635 }
636 } catch (Exception $e) {
637 $this->message_stack->addMessage(new ilSystemStyleMessage(
638 $e->getMessage(),
640 ));
641 }
642 $i++;
643 }
644 $this->message_stack->sendMessages();
645 $this->ctrl->redirect($this);
646 }
$i
Definition: metadata.php:41
$container
@noRector
Definition: wac.php:14

References $container, Vendor\Package\$e, $i, ILIAS\Repository\ctrl(), ILIAS\Repository\refinery(), and ilSystemStyleMessage\TYPE_ERROR.

+ Here is the call graph for this function:

◆ copyStyle()

ilSystemStyleOverviewGUI::copyStyle ( )
protected

Definition at line 482 of file class.ilSystemStyleOverviewGUI.php.

482 : void
483 {
484 $imploded_skin_style_id = $this->request_wrapper->post()->retrieve(
485 'source_style',
486 $this->refinery->string()->splitString(':')
487 );
488 $skin_id = $imploded_skin_style_id[0];
489 $style_id = $imploded_skin_style_id[1];
490
491 try {
492 $container = $this->skin_factory->skinStyleContainerFromId($skin_id, $this->message_stack);
493 $new_container = $this->skin_factory->copyFromSkinStyleContainer(
495 $this->file_system,
496 $this->message_stack,
497 $this->lng->txt('sty_acopy')
498 );
499 $this->message_stack->prependMessage(new ilSystemStyleMessage(
500 $this->lng->txt('style_copied'),
502 ));
503 $this->ctrl->setParameterByClass('ilSystemStyleSettingsGUI', 'skin_id', $new_container->getSkin()->getId());
504 $this->ctrl->setParameterByClass(
505 'ilSystemStyleSettingsGUI',
506 'style_id',
507 $new_container->getSkin()->getStyle($style_id)->getId()
508 );
509 $this->message_stack->addMessage(new ilSystemStyleMessage(
510 $this->lng->txt('directory_created') . ' ' . $new_container->getSkinDirectory(),
512 ));
513 } catch (Exception $e) {
514 $this->message_stack->addMessage(new ilSystemStyleMessage(
515 $e->getMessage(),
517 ));
518 }
519 $this->message_stack->sendMessages();
520 $this->ctrl->redirectByClass('ilSystemStyleSettingsGUI');
521 }

References $container, Vendor\Package\$e, $style_id, ILIAS\Repository\ctrl(), ILIAS\Repository\lng(), ILIAS\Repository\refinery(), ilSystemStyleMessage\TYPE_ERROR, and ilSystemStyleMessage\TYPE_SUCCESS.

+ Here is the call graph for this function:

◆ createSystemStyleForm()

ilSystemStyleOverviewGUI::createSystemStyleForm ( )
protected

Definition at line 360 of file class.ilSystemStyleOverviewGUI.php.

361 {
362 $form = new ilPropertyFormGUI();
363 $form->setFormAction($this->ctrl->getFormAction($this));
364 $form->setTitle($this->lng->txt('sty_create_new_system_style'));
365
366 $ti = new ilTextInputGUI($this->lng->txt('skin_id'), 'skin_id');
367 $ti->setInfo($this->lng->txt('skin_id_description'));
368 $ti->setMaxLength(128);
369 $ti->setSize(40);
370 $ti->setRequired(true);
371 $form->addItem($ti);
372
373 $ti = new ilTextInputGUI($this->lng->txt('skin_name'), 'skin_name');
374 $ti->setInfo($this->lng->txt('skin_name_description'));
375 $ti->setMaxLength(128);
376 $ti->setSize(40);
377 $ti->setRequired(true);
378 $form->addItem($ti);
379
380 $ti = new ilTextInputGUI($this->lng->txt('style_id'), 'style_id');
381 $ti->setInfo($this->lng->txt('style_id_description'));
382 $ti->setMaxLength(128);
383 $ti->setSize(40);
384 $ti->setRequired(true);
385 $form->addItem($ti);
386
387 $ti = new ilTextInputGUI($this->lng->txt('style_name'), 'style_name');
388 $ti->setInfo($this->lng->txt('style_name_description'));
389 $ti->setMaxLength(128);
390 $ti->setSize(40);
391 $ti->setRequired(true);
392 $form->addItem($ti);
393
394 $form->addCommandButton('saveNewSystemStyle', $this->lng->txt('save'));
395 $form->addCommandButton('cancel', $this->lng->txt('cancel'));
396
397 return $form;
398 }

References ILIAS\Repository\ctrl(), and ILIAS\Repository\lng().

Referenced by addSystemStyleForms(), and saveNewSystemStyle().

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

◆ deleteStyle()

ilSystemStyleOverviewGUI::deleteStyle ( )
protected

Definition at line 523 of file class.ilSystemStyleOverviewGUI.php.

523 : void
524 {
525 $skin_id = $this->style_container->getSkin()->getId();
527
528 if ($this->checkDeletable($skin_id, $style_id, $this->message_stack)) {
529 $delete_form_table = new ilSystemStyleDeleteGUI($this->lng, $this->ctrl);
530 $container = $this->skin_factory->skinStyleContainerFromId($skin_id, $this->message_stack);
531 $delete_form_table->addStyle(
532 $container->getSkin(),
533 $container->getSkin()->getStyle($style_id),
534 $container->getImagesSkinPath($style_id) . '/icon_stys.svg'
535 );
536 $this->tpl->setContent($delete_form_table->getDeleteStyleFormHTML());
537 } else {
538 $this->message_stack->prependMessage(new ilSystemStyleMessage(
539 $this->lng->txt('style_not_deleted'),
541 ));
542 $this->edit();
543 }
544 }
checkDeletable(string $skin_id, string $style_id, ilSystemStyleMessageStack $message_stack)

References $container, $style_id, checkDeletable(), ILIAS\Repository\ctrl(), edit(), ILIAS\Repository\lng(), and ilSystemStyleMessage\TYPE_ERROR.

+ Here is the call graph for this function:

◆ deleteStyles()

ilSystemStyleOverviewGUI::deleteStyles ( )
protected

Definition at line 546 of file class.ilSystemStyleOverviewGUI.php.

546 : void
547 {
548 $delete_form_table = new ilSystemStyleDeleteGUI($this->lng, $this->ctrl);
549
550 $all_deletable = true;
551
552 $skin_ids = $this->request_wrapper->post()->retrieve('id', $this->refinery->identity());
553 foreach ($skin_ids as $skin_style_id) {
554 $imploded_skin_style_id = explode(':', $skin_style_id);
555 $skin_id = $imploded_skin_style_id[0];
556 $style_id = $imploded_skin_style_id[1];
557 if (!$this->checkDeletable($skin_id, $style_id, $this->message_stack)) {
558 $all_deletable = false;
559 }
560 }
561 if ($all_deletable) {
562 foreach ($skin_ids as $skin_style_id) {
563 $imploded_skin_style_id = explode(':', $skin_style_id);
564 $skin_id = $imploded_skin_style_id[0];
565 $style_id = $imploded_skin_style_id[1];
566 $container = $this->skin_factory->skinStyleContainerFromId($skin_id, $this->message_stack);
567 $delete_form_table->addStyle(
568 $container->getSkin(),
569 $container->getSkin()->getStyle($style_id),
570 $container->getImagesSkinPath($style_id) . '/icon_stys.svg'
571 );
572 }
573 $this->tpl->setContent($delete_form_table->getDeleteStyleFormHTML());
574 } else {
575 $this->message_stack->prependMessage(new ilSystemStyleMessage(
576 $this->lng->txt('styles_not_deleted'),
578 ));
579 $this->edit();
580 }
581 }

References $container, $style_id, checkDeletable(), ILIAS\Repository\ctrl(), edit(), ILIAS\Repository\lng(), ILIAS\Repository\refinery(), and ilSystemStyleMessage\TYPE_ERROR.

+ Here is the call graph for this function:

◆ edit()

ilSystemStyleOverviewGUI::edit ( )

Definition at line 144 of file class.ilSystemStyleOverviewGUI.php.

144 : void
145 {
146 if ($this->isManagementEnabled()) {
147 // Add Button for adding skins
148 $this->toolbar->addComponent($this->ui_factory->button()->standard(
149 $this->lng->txt('add_system_style'),
150 $this->ctrl->getLinkTarget($this, 'addSystemStyle')
151 ));
152
153 // Add Button for adding sub styles
154 $add_sub = $this->ui_factory->button()->standard(
155 $this->lng->txt('add_substyle'),
156 $this->ctrl->getLinkTarget($this, 'addSubStyle')
157 );
158 if (count(ilStyleDefinition::getAllSkins()) == 1) {
159 $add_sub = $add_sub->withUnavailableAction();
160 }
161 $this->toolbar->addComponent($add_sub);
162 $this->toolbar->addSeparator();
163 }
164
165 // from styles selector
166 $si = new ilSelectInputGUI(
167 $this->lng->txt('sty_move_user_styles') . ': ' . $this->lng->txt('sty_from'),
168 'from_style'
169 );
170
171 $options = [];
172 foreach (ilStyleDefinition::getAllSkinStyles() as $id => $skin_style) {
173 if (!$skin_style['substyle_of']) {
174 $options[$id] = $skin_style['title'];
175 }
176 }
177 $si->setOptions($options + ['other' => $this->lng->txt('other')]);
178
179 $this->toolbar->addInputItem($si, true);
180
181 $si = new ilSelectInputGUI($this->lng->txt('sty_to'), 'to_style');
182 $si->setOptions($options);
183 $this->toolbar->addInputItem($si, true);
184 $this->toolbar->addComponent($this->ui_factory->button()->standard($this->lng->txt('sty_move_style'), ''));
185
186 $this->toolbar->setFormAction($this->ctrl->getLinkTarget($this, 'moveUserStyles'));
187
188 $table = new ilSystemStylesTableGUI($this, 'edit');
189 $table->addActions($this->isManagementEnabled());
190 $this->tpl->setContent($table->getHTML());
191 }
TableGUI class for system styles.

References $id, ILIAS\Repository\ctrl(), ilStyleDefinition\getAllSkinStyles(), isManagementEnabled(), ILIAS\Repository\lng(), and ILIAS\Repository\toolbar().

Referenced by cancel(), deleteStyle(), deleteStyles(), and moveUserStyles().

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

◆ executeCommand()

ilSystemStyleOverviewGUI::executeCommand ( )

Definition at line 92 of file class.ilSystemStyleOverviewGUI.php.

92 : void
93 {
94 $cmd = $this->ctrl->getCmd();
95
96 if ($cmd == '') {
97 $cmd = $this->isReadOnly() ? 'view' : 'edit';
98 }
99
100 switch ($cmd) {
101 case 'addSystemStyle':
102 case 'addSubStyle':
103 case 'saveNewSystemStyle':
104 case 'saveNewSubStyle':
105 case 'copyStyle':
106 case 'importStyle':
107 case 'deleteStyles':
108 case 'deleteStyle':
109 case 'confirmDelete':
110 if (!$this->isManagementEnabled()) {
111 throw new ilObjectException($this->lng->txt('permission_denied'));
112 }
113 $this->$cmd();
114 break;
115 case 'cancel':
116 case 'edit':
117 case 'export':
118 case 'moveUserStyles':
119 case 'saveStyleSettings':
120 if ($this->isReadOnly()) {
121 throw new ilObjectException($this->lng->txt('permission_denied'));
122 }
123 $this->$cmd();
124 break;
125 case 'view':
126 $this->$cmd();
127 break;
128
129 }
130 $this->message_stack->sendMessages();
131 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...

References ILIAS\Repository\ctrl(), isManagementEnabled(), isReadOnly(), and ILIAS\Repository\lng().

+ Here is the call graph for this function:

◆ export()

ilSystemStyleOverviewGUI::export ( )
protected

Definition at line 690 of file class.ilSystemStyleOverviewGUI.php.

690 : void
691 {
692 $container = $this->skin_factory->skinStyleContainerFromId($this->style_container->getSkin()->getId(), $this->message_stack);
693 try {
694 $container->export();
695 } catch (Exception $e) {
696 $this->message_stack->addMessage(new ilSystemStyleMessage(
697 $this->lng->txt('zip_export_failed') . ' ' . $e->getMessage(),
699 ));
700 }
701 }

References $container, Vendor\Package\$e, ILIAS\Repository\lng(), and ilSystemStyleMessage\TYPE_ERROR.

+ Here is the call graph for this function:

◆ importSystemStyleForm()

ilSystemStyleOverviewGUI::importSystemStyleForm ( )
protected

Definition at line 400 of file class.ilSystemStyleOverviewGUI.php.

401 {
402 $form = new ilPropertyFormGUI();
403 $form->setFormAction($this->ctrl->getFormAction($this, 'importStyle'));
404 $form->setTitle($this->lng->txt('sty_import_system_style'));
405
406 // title
407 $file_input = new ilFileInputGUI($this->lng->txt('import_file'), 'importfile');
408 $file_input->setRequired(true);
409 $file_input->setSuffixes(['zip']);
410 $form->addItem($file_input);
411
412 $form->addCommandButton('importStyle', $this->lng->txt('import'));
413 $form->addCommandButton('cancel', $this->lng->txt('cancel'));
414
415 return $form;
416 }
This class represents a file property in a property form.

References ILIAS\Repository\ctrl(), and ILIAS\Repository\lng().

Referenced by addSystemStyleForms().

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

◆ isManagementEnabled()

ilSystemStyleOverviewGUI::isManagementEnabled ( )

Definition at line 830 of file class.ilSystemStyleOverviewGUI.php.

830 : bool
831 {
833 }

Referenced by edit(), and executeCommand().

+ Here is the caller graph for this function:

◆ isReadOnly()

ilSystemStyleOverviewGUI::isReadOnly ( )

Definition at line 820 of file class.ilSystemStyleOverviewGUI.php.

820 : bool
821 {
822 return $this->read_only;
823 }

Referenced by executeCommand().

+ Here is the caller graph for this function:

◆ moveUserStyles()

ilSystemStyleOverviewGUI::moveUserStyles ( )

Definition at line 193 of file class.ilSystemStyleOverviewGUI.php.

193 : void
194 {
195 $to = $this->request_wrapper->post()->retrieve('to_style', $this->refinery->string()->splitString(':'));
196
197 $from_style = $this->request_wrapper->post()->retrieve('from_style', $this->refinery->kindlyTo()->string());
198
199 if ($from_style == 'other') {
200 // get all user assigned styles
201 $all_user_styles = ilObjUser::_getAllUserAssignedStyles();
202
203 // move users that are not assigned to
204 // currently existing style
205 foreach ($all_user_styles as $style) {
206 if (!ilStyleDefinition::styleExists($style)) {
207 $style_arr = explode(':', $style);
208 ilObjUser::_moveUsersToStyle($style_arr[0], $style_arr[1], $to[0], $to[1]);
209 }
210 }
211 } else {
212 $from = explode(':', $from_style);
213 ilObjUser::_moveUsersToStyle($from[0], $from[1], $to[0], $to[1]);
214 }
215
216 $this->message_stack->addMessage(new ilSystemStyleMessage($this->lng->txt('msg_obj_modified')));
217 $this->edit();
218 }
static _getAllUserAssignedStyles()
static _moveUsersToStyle(string $a_from_skin, string $a_from_style, string $a_to_skin, string $a_to_style)
static styleExists(string $style_id)

References ilObjUser\_getAllUserAssignedStyles(), ilObjUser\_moveUsersToStyle(), edit(), ILIAS\Repository\lng(), ILIAS\Repository\refinery(), and ilStyleDefinition\styleExists().

+ Here is the call graph for this function:

◆ saveNewSubStyle()

ilSystemStyleOverviewGUI::saveNewSubStyle ( )
protected

Definition at line 762 of file class.ilSystemStyleOverviewGUI.php.

762 : void
763 {
764 $form = $this->addSubStyleForms();
765
766 if ($form->checkInput()) {
767 try {
768 $skin_style_ids = $this->request_wrapper->post()->retrieve(
769 'parent_style',
770 $this->refinery->string()->splitString(':')
771 );
772
773 $parent_skin_id = $skin_style_ids[0];
774 $parent_style_id = $skin_style_ids[1];
775
776 $container = $this->skin_factory->skinStyleContainerFromId($parent_skin_id, $this->message_stack);
777
778 $sub_style_id = $this->request_wrapper->post()->retrieve(
779 'sub_style_id',
780 $this->refinery->kindlyTo()->string()
781 );
782
783 if (array_key_exists(
784 $sub_style_id,
785 $container->getSkin()->getSubstylesOfStyle($parent_style_id)
786 )) {
787 throw new ilSystemStyleException(
789 $sub_style_id
790 );
791 }
792
793 $sub_style_name = $this->request_wrapper->post()->retrieve(
794 'sub_style_name',
795 $this->refinery->kindlyTo()->string()
796 );
797
798 $style = new ilSkinStyle($sub_style_id, $sub_style_name);
799 $style->setSubstyleOf($parent_style_id);
800 $container->addStyle($style);
801
802 $this->ctrl->setParameterByClass('ilSystemStyleSettingsGUI', 'skin_id', $parent_skin_id);
803 $this->ctrl->setParameterByClass('ilSystemStyleSettingsGUI', 'style_id', $sub_style_id);
804 $this->message_stack->addMessage(new ilSystemStyleMessage($this->lng->txt('msg_sub_style_created')));
805 $this->message_stack->sendMessages();
806 $this->ctrl->redirectByClass('ilSystemStyleSettingsGUI');
807 } catch (ilSystemStyleException $e) {
808 $this->message_stack->addMessage(new ilSystemStyleMessage(
809 $e->getMessage(),
811 ));
812 }
813 }
814
815 // display only this form to correct input
816 $form->setValuesByPost();
817 $this->tpl->setContent($form->getHTML());
818 }
Class for advanced editing exception handling in ILIAS.

References $container, Vendor\Package\$e, ILIAS\Repository\ctrl(), ILIAS\Repository\lng(), ILIAS\Repository\refinery(), ilSystemStyleException\SUBSTYLE_ASSIGNMENT_EXISTS, and ilSystemStyleMessage\TYPE_ERROR.

+ Here is the call graph for this function:

◆ saveNewSystemStyle()

ilSystemStyleOverviewGUI::saveNewSystemStyle ( )
protected

Definition at line 299 of file class.ilSystemStyleOverviewGUI.php.

299 : void
300 {
301 $form = $this->createSystemStyleForm();
302
303 if ($form->checkInput()) {
304 $skin_id = $this->request_wrapper->post()->retrieve('skin_id', $this->refinery->kindlyTo()->string());
305 $style_id = $this->request_wrapper->post()->retrieve('style_id', $this->refinery->kindlyTo()->string());
306
307 $skin_name = $this->request_wrapper->post()->retrieve('skin_name', $this->refinery->kindlyTo()->string());
308 $style_name = $this->request_wrapper->post()->retrieve('style_name', $this->refinery->kindlyTo()->string());
309
310 if (ilStyleDefinition::skinExists($skin_id)) {
311 $this->message_stack->addMessage(new ilSystemStyleMessage(
312 $this->lng->txt('skin_id_exists'),
314 ));
315 } else {
316 try {
317 $skin = new ilSkin($skin_id, $skin_name);
318 $style = new ilSkinStyle($style_id, $style_name);
319 $skin->addStyle($style);
320 $container = new ilSkinStyleContainer($this->lng, $skin, $this->message_stack);
321 $container->create($this->message_stack);
322 $this->ctrl->setParameterByClass('ilSystemStyleSettingsGUI', 'skin_id', $skin->getId());
323 $this->ctrl->setParameterByClass('ilSystemStyleSettingsGUI', 'style_id', $style->getId());
324 $this->message_stack->addMessage(new ilSystemStyleMessage($this->lng->txt('msg_sys_style_created')));
325 $this->message_stack->sendMessages();
326 $this->ctrl->redirectByClass('ilSystemStyleSettingsGUI');
327 } catch (ilSystemStyleException $e) {
328 $this->message_stack->addMessage(new ilSystemStyleMessage(
329 $e->getMessage(),
331 ));
332 }
333 }
334 }
335
336 // display only this form to correct input
337 $form->setValuesByPost();
338 $this->tpl->setContent($form->getHTML());
339 }
This class is responsible for all file system related actions related actions of a skin such as copyi...
ilSkin holds an manages the basic data of a skin as provide by the template of the skin.
static skinExists(string $skin_id, ?ilSystemStyleConfig $system_style_config=null)
Check whether a skin exists.

References $container, Vendor\Package\$e, $style_id, createSystemStyleForm(), ILIAS\Repository\ctrl(), ILIAS\Repository\lng(), ILIAS\Repository\refinery(), ilStyleDefinition\skinExists(), and ilSystemStyleMessage\TYPE_ERROR.

+ Here is the call graph for this function:

◆ saveStyleSettings()

ilSystemStyleOverviewGUI::saveStyleSettings ( )

Definition at line 220 of file class.ilSystemStyleOverviewGUI.php.

220 : void
221 {
222 $active_styles = $this->request_wrapper->post()->retrieve('st_act', $this->refinery->identity());
223
224 if ($this->checkStyleSettings($this->message_stack, $active_styles)) {
226 foreach ($all_styles as $style) {
227 if (!isset($active_styles[$style['id']])) {
228 ilSystemStyleSettings::_deactivateStyle($style['template_id'], $style['style_id']);
229 } else {
230 ilSystemStyleSettings::_activateStyle($style['template_id'], $style['style_id']);
231 }
232 }
233
234 //set default skin and style
235 if ($this->request_wrapper->post()->has('default_skin_style')) {
236 $sknst = $this->request_wrapper->post()->retrieve(
237 'default_skin_style',
238 $this->refinery->string()->splitString(':')
239 );
241 }
242 $this->message_stack->addMessage(new ilSystemStyleMessage(
243 $this->lng->txt('msg_obj_modified'),
245 ));
246 }
247 $this->message_stack->sendMessages();
248 $this->ctrl->redirect($this, 'edit');
249 }
checkStyleSettings(ilSystemStyleMessageStack $message_stack, array $active_styles)
static _activateStyle(string $a_skin, string $a_style)
activate system style
static _deactivateStyle(string $a_skin, string $a_style)
deactivate system style
static setCurrentDefaultStyle(string $skin_id, string $style_id)
Sets the default style of the system.

References ilSystemStyleSettings\_activateStyle(), ilSystemStyleSettings\_deactivateStyle(), checkStyleSettings(), ILIAS\Repository\ctrl(), ilStyleDefinition\getAllSkinStyles(), ILIAS\Repository\lng(), ILIAS\Repository\refinery(), ilSystemStyleSettings\setCurrentDefaultStyle(), and ilSystemStyleMessage\TYPE_SUCCESS.

+ Here is the call graph for this function:

◆ setManagementEnabled()

ilSystemStyleOverviewGUI::setManagementEnabled ( bool  $management_enabled)

Definition at line 835 of file class.ilSystemStyleOverviewGUI.php.

835 : void
836 {
837 $this->management_enabled = $management_enabled;
838 }

Referenced by __construct().

+ Here is the caller graph for this function:

◆ setReadOnly()

ilSystemStyleOverviewGUI::setReadOnly ( bool  $read_only)

Definition at line 825 of file class.ilSystemStyleOverviewGUI.php.

825 : void
826 {
827 $this->read_only = $read_only;
828 }

Referenced by __construct().

+ Here is the caller graph for this function:

◆ view()

ilSystemStyleOverviewGUI::view ( )
protected

Definition at line 133 of file class.ilSystemStyleOverviewGUI.php.

133 : void
134 {
135 $table = new ilSystemStylesTableGUI($this, 'edit');
136 $this->tpl->setContent($table->getHTML());
137 }

Field Documentation

◆ $config

ilSystemStyleConfig ilSystemStyleOverviewGUI::$config
protected

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

◆ $ctrl

ilCtrl ilSystemStyleOverviewGUI::$ctrl
protected

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

Referenced by __construct().

◆ $file_system

ilFileSystemHelper ilSystemStyleOverviewGUI::$file_system
protected

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

◆ $help

ilHelpGUI ilSystemStyleOverviewGUI::$help
protected

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

Referenced by __construct().

◆ $lng

ilLanguage ilSystemStyleOverviewGUI::$lng
protected

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

Referenced by __construct().

◆ $management_enabled

bool ilSystemStyleOverviewGUI::$management_enabled = false
protected

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

◆ $message_stack

ilSystemStyleMessageStack ilSystemStyleOverviewGUI::$message_stack
protected

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

Referenced by checkDeletable(), and checkStyleSettings().

◆ $read_only

bool ilSystemStyleOverviewGUI::$read_only = true
protected

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

◆ $ref_id

string ilSystemStyleOverviewGUI::$ref_id
protected

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

Referenced by __construct().

◆ $refinery

Refinery ilSystemStyleOverviewGUI::$refinery
protected

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

Referenced by __construct().

◆ $renderer

Renderer ilSystemStyleOverviewGUI::$renderer
protected

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

Referenced by __construct().

◆ $request_wrapper

WrapperFactory ilSystemStyleOverviewGUI::$request_wrapper
protected

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

Referenced by __construct().

◆ $skin_factory

ilSkinFactory ilSystemStyleOverviewGUI::$skin_factory
protected

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

Referenced by __construct().

◆ $style_container

ilSkinStyleContainer ilSystemStyleOverviewGUI::$style_container
protected

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

◆ $style_id

string ilSystemStyleOverviewGUI::$style_id
protected

◆ $tabs

ilTabsGUI ilSystemStyleOverviewGUI::$tabs
protected

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

Referenced by __construct().

◆ $toolbar

ilToolbarGUI ilSystemStyleOverviewGUI::$toolbar
protected

Definition at line 30 of file class.ilSystemStyleOverviewGUI.php.

Referenced by __construct().

◆ $tpl

ilGlobalTemplateInterface ilSystemStyleOverviewGUI::$tpl
protected

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

Referenced by __construct().

◆ $ui_factory

Factory ilSystemStyleOverviewGUI::$ui_factory
protected

Definition at line 37 of file class.ilSystemStyleOverviewGUI.php.

Referenced by __construct().

◆ $upload

FileUpload ilSystemStyleOverviewGUI::$upload
protected

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

Referenced by __construct().


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