19 declare(strict_types=1);
68 bool $management_enabled
94 $cmd = $this->
ctrl->getCmd();
101 case 'addSystemStyle':
103 case 'saveNewSystemStyle':
104 case 'saveNewSubStyle':
109 case 'confirmDelete':
118 case 'moveUserStyles':
119 case 'saveStyleSettings':
129 $this->message_stack->sendMessages();
132 protected function view(): void
135 $this->tpl->setContent($table->getHTML().$table->getModalsHtml());
142 if (!$skin_style[
'substyle_of'] && $style_name != $skin_style[
'style_name']) {
143 $options[
$id] = $skin_style[
'title'];
147 $default =
"default:delos";
148 if($style_name ==
"Delos") {
149 $default = key($options);
152 if(count($options) == 0) {
156 $txt = $this->
lng->txt(
'sty_move_user_styles').
' '.$this->
lng->txt(
'sty_to');
158 $byline = $this->
lng->txt(
'sty_move_user_styles') .
' ' .
159 $this->
lng->txt(
'sty_from') .
' ' . $style_name;
161 $select = $this->ui_factory->input()->field()
162 ->select(
$txt, $options, $byline)
163 ->withValue($default)
164 ->withAdditionalTransformation($this->
refinery->string()->splitString(
':'))
165 ->withRequired(
true);
167 return $this->ui_factory->modal()->roundtrip(
168 $this->
lng->txt(
'change_assignment'),
170 [
"new_style" => $select],
171 $this->
ctrl->getLinkTargetByClass(ilSystemStyleOverviewGUI::class,
'moveUserStyles')
184 $this->
toolbar->addComponent($this->ui_factory->button()->standard(
185 $this->
lng->txt(
'add_system_style'),
186 $this->
ctrl->getLinkTarget($this,
'addSystemStyle')
190 $add_sub = $this->ui_factory->button()->standard(
191 $this->
lng->txt(
'add_substyle'),
192 $this->
ctrl->getLinkTarget($this,
'addSubStyle')
194 if (count(ilStyleDefinition::getAllSkins()) == 1) {
195 $add_sub = $add_sub->withUnavailableAction();
197 $this->
toolbar->addComponent($add_sub);
202 $this->tpl->setContent($table->getHTML().$table->getModalsHtml());
209 $request = $DIC->http()->request();
212 [$new_skin, $new_style] = $modal->getData()[
"new_style"];
214 $old_skin = $this->request_wrapper->query()->retrieve(
'old_skin_id', $this->
refinery->kindlyTo()->string());
215 $old_style = $this->request_wrapper->query()->retrieve(
'old_style_id', $this->
refinery->kindlyTo()->string());
217 if ($old_style ==
'other') {
223 foreach ($all_user_styles as $style) {
225 [$old_skin, $old_style] = explode(
':', $style);
234 $this->
ctrl->redirect($this,
'edit');
239 $active_styles = $this->request_wrapper->post()->retrieve(
'st_act', $this->
refinery->identity());
243 foreach ($all_styles as $style) {
244 if (!isset($active_styles[$style[
'id']])) {
252 if ($this->request_wrapper->post()->has(
'default_skin_style')) {
253 $sknst = $this->request_wrapper->post()->retrieve(
254 'default_skin_style',
255 $this->
refinery->string()->splitString(
':')
260 $this->
lng->txt(
'msg_obj_modified'),
264 $this->message_stack->sendMessages();
265 $this->
ctrl->redirect($this,
'edit');
272 if (count($active_styles) < 1) {
275 $this->
lng->txt(
'at_least_one_style'),
280 $default_style = $this->request_wrapper->post()->retrieve(
281 'default_skin_style',
282 $this->
refinery->kindlyTo()->string()
285 if (!isset($active_styles[$default_style])) {
288 $this->
lng->txt(
'cant_deactivate_default_style'),
297 foreach ($all_styles as $style) {
298 if (!isset($active_styles[$style[
'id']])) {
302 $style[
'style_name'] .
': ' . $this->
lng->txt(
'cant_deactivate_if_users_assigned'),
320 if ($form->checkInput()) {
321 $skin_id = $this->request_wrapper->post()->retrieve(
'skin_id', $this->
refinery->kindlyTo()->string());
322 $style_id = $this->request_wrapper->post()->retrieve(
'style_id', $this->
refinery->kindlyTo()->string());
324 $skin_name = $this->request_wrapper->post()->retrieve(
'skin_name', $this->
refinery->kindlyTo()->string());
325 $style_name = $this->request_wrapper->post()->retrieve(
'style_name', $this->
refinery->kindlyTo()->string());
329 $this->
lng->txt(
'skin_id_exists'),
334 $skin =
new ilSkin($skin_id, $skin_name);
336 $skin->addStyle($style);
339 $this->
ctrl->setParameterByClass(ilSystemStyleConfigGUI::class,
'skin_id', $skin->getId());
340 $this->
ctrl->setParameterByClass(ilSystemStyleConfigGUI::class,
'style_id', $style->getId());
342 $this->message_stack->sendMessages();
343 $this->
ctrl->redirectByClass(ilSystemStyleConfigGUI::class);
354 $form->setValuesByPost();
355 $this->tpl->setContent($form->getHTML());
360 $this->
tabs->clearTargets();
364 $this->
help->setScreenIdComponent(
'sty');
365 $this->
help->setScreenId(
'system_styles');
366 $this->
help->setSubScreenId(
'create');
374 $this->tpl->setContent($this->getCreationFormsHTML($forms));
380 $form->setFormAction($this->
ctrl->getFormAction($this));
381 $form->setTitle($this->
lng->txt(
'sty_create_new_system_style'));
384 $ti->setInfo($this->
lng->txt(
'skin_id_description'));
385 $ti->setMaxLength(128);
387 $ti->setRequired(
true);
391 $ti->setInfo($this->
lng->txt(
'skin_name_description'));
392 $ti->setMaxLength(128);
394 $ti->setRequired(
true);
398 $ti->setInfo($this->
lng->txt(
'style_id_description'));
399 $ti->setMaxLength(128);
401 $ti->setRequired(
true);
405 $ti->setInfo($this->
lng->txt(
'style_name_description'));
406 $ti->setMaxLength(128);
408 $ti->setRequired(
true);
411 $form->addCommandButton(
'saveNewSystemStyle', $this->
lng->txt(
'save'));
412 $form->addCommandButton(
'cancel', $this->
lng->txt(
'cancel'));
420 $form->setFormAction($this->
ctrl->getFormAction($this,
'importStyle'));
421 $form->setTitle($this->
lng->txt(
'sty_import_system_style'));
426 $file_input->setSuffixes([
'zip']);
427 $form->addItem($file_input);
429 $form->addCommandButton(
'importStyle', $this->
lng->txt(
'import'));
430 $form->addCommandButton(
'cancel', $this->
lng->txt(
'cancel'));
438 $form->setFormAction($this->
ctrl->getFormAction($this));
439 $form->setTitle($this->
lng->txt(
'sty_copy_other_system_style'));
446 foreach ($styles as
$id => $style) {
448 if ($style[
'skin_id'] != $system_style_conf->getDefaultSkinId()) {
449 $options[
$id] = $style[
'title'];
452 $ti->setOptions($options);
456 $form->addCommandButton(
'copyStyle', $this->
lng->txt(
'copy'));
457 $form->addCommandButton(
'cancel', $this->
lng->txt(
'cancel'));
462 protected function getCreationFormsHTML(array $a_forms):
string 464 include_once(
'./Services/Accordion/classes/class.ilAccordionGUI.php');
469 foreach ($a_forms as $form_type => $cf) {
473 $htpl =
new ilTemplate(
'tpl.creation_acc_head.html',
true,
true,
'Services/Object');
477 if (method_exists($this,
'getCreationFormTitle')) {
478 $form_title = $this->getCreationFormTitle($form_type);
481 $form_title = $cf->getTitle();
485 $htpl->setVariable(
'TITLE', $this->
lng->txt(
'option') .
' ' . $cnt .
': ' .
488 $cf->setTitleIcon(
'');
489 $cf->setTableWidth(
'100%');
491 $acc->addItem($htpl->get(), $cf->getHTML());
496 return "<div class='ilCreationFormSection'>" . $acc->getHTML() .
'</div>';
501 $imploded_skin_style_id = $this->request_wrapper->post()->retrieve(
503 $this->
refinery->string()->splitString(
':')
505 $skin_id = $imploded_skin_style_id[0];
506 $style_id = $imploded_skin_style_id[1];
509 $container = $this->skin_factory->skinStyleContainerFromId($skin_id, $this->message_stack);
510 $new_container = $this->skin_factory->copyFromSkinStyleContainer(
513 $this->message_stack,
514 $this->
lng->txt(
'sty_acopy')
517 $this->
lng->txt(
'style_copied'),
520 $this->
ctrl->setParameterByClass(
'ilsystemstyleconfiggui',
'skin_id', $new_container->getSkin()->getId());
521 $this->
ctrl->setParameterByClass(
522 'ilsystemstyleconfiggui',
524 $new_container->getSkin()->getStyle($style_id)->getId()
527 $this->
lng->txt(
'directory_created') .
' ' . $new_container->getSkinDirectory(),
536 $this->message_stack->sendMessages();
537 $this->
ctrl->redirectByClass(
'ilsystemstyleconfiggui');
542 $skin_id = $this->style_container->getSkin()->getId();
545 if ($this->
checkDeletable($skin_id, $style_id, $this->message_stack)) {
547 $container = $this->skin_factory->skinStyleContainerFromId($skin_id, $this->message_stack);
548 $delete_form_table->addStyle(
551 $container->getImagesStylePath($style_id) .
'/standard/icon_stys.svg' 553 $this->tpl->setContent($delete_form_table->getDeleteStyleFormHTML());
556 $this->
lng->txt(
'style_not_deleted'),
567 $all_deletable =
true;
569 $skin_ids = $this->request_wrapper->post()->retrieve(
'id', $this->
refinery->identity());
570 foreach ($skin_ids as $skin_style_id) {
571 $imploded_skin_style_id = explode(
':', $skin_style_id);
572 $skin_id = $imploded_skin_style_id[0];
573 $style_id = $imploded_skin_style_id[1];
574 if (!$this->
checkDeletable($skin_id, $style_id, $this->message_stack)) {
575 $all_deletable =
false;
578 if ($all_deletable) {
579 foreach ($skin_ids as $skin_style_id) {
580 $imploded_skin_style_id = explode(
':', $skin_style_id);
581 $skin_id = $imploded_skin_style_id[0];
582 $style_id = $imploded_skin_style_id[1];
583 $container = $this->skin_factory->skinStyleContainerFromId($skin_id, $this->message_stack);
584 $delete_form_table->addStyle(
587 $container->getImagesStylePath($style_id) .
'/standard/icon_stys.svg' 590 $this->tpl->setContent($delete_form_table->getDeleteStyleFormHTML());
593 $this->
lng->txt(
'styles_not_deleted'),
608 $style_id .
': ' . $this->
lng->txt(
'cant_delete_if_users_assigned'),
615 $style_id .
': ' . $this->
lng->txt(
'cant_delete_activated_style'),
622 $style_id .
': ' . $this->
lng->txt(
'cant_delete_default_style'),
628 if ($this->skin_factory->skinStyleContainerFromId($skin_id, $this->message_stack)->getSkin()->getSubstylesOfStyle($style_id)) {
630 $style_id .
': ' . $this->
lng->txt(
'cant_delete_style_with_substyles'),
641 while ($this->request_wrapper->post()->has(
'style_' . $i)) {
643 $skin_style_id = $this->request_wrapper->post()->retrieve(
645 $this->
refinery->string()->splitString(
':')
647 $container = $this->skin_factory->skinStyleContainerFromId($skin_style_id[0], $this->message_stack);
648 $syle =
$container->getSkin()->getStyle($skin_style_id[1]);
661 $this->message_stack->sendMessages();
662 $this->
ctrl->redirect($this);
665 protected function importStyle():
void 669 if ($form->checkInput() && $this->
upload->hasUploads()) {
671 $result = array_values($this->
upload->getResults())[0];
673 $this->
upload->moveOneFileTo(
680 $imported_container = $this->skin_factory->skinStyleContainerFromZip(
681 $this->config->getCustomizingSkinPath() . $result->getName(),
685 $this->
ctrl->setParameterByClass(
686 'ilsystemstyleconfiggui',
688 $imported_container->getSkin()->getId()
690 $this->
ctrl->setParameterByClass(
691 'ilsystemstyleconfiggui',
693 $imported_container->getSkin()->getDefaultStyle()->getId()
696 $this->
lng->txt(
'style_imported') .
' ' . $imported_container->getSkinDirectory(),
699 $this->message_stack->sendMessages();
700 $this->
ctrl->redirectByClass(
'ilsystemstyleconfiggui');
703 $form->setValuesByPost();
704 $this->tpl->setContent($form->getHTML());
710 $this->style_container->export();
713 $this->
lng->txt(
'zip_export_failed') .
' ' . $e->getMessage(),
724 $this->
tabs->clearTargets();
728 $this->
help->setScreenIdComponent(
'sty');
729 $this->
help->setScreenId(
'system_styles');
730 $this->
help->setSubScreenId(
'create_sub');
734 $this->tpl->setContent($form->getHTML());
740 $form->setFormAction($this->
ctrl->getFormAction($this));
741 $form->setTitle($this->
lng->txt(
'sty_create_new_system_sub_style'));
744 $ti->setInfo($this->
lng->txt(
'sub_style_id_description'));
745 $ti->setMaxLength(128);
747 $ti->setRequired(
true);
751 $ti->setInfo($this->
lng->txt(
'sub_style_name_description'));
752 $ti->setMaxLength(128);
754 $ti->setRequired(
true);
760 $ti->setInfo($this->
lng->txt(
'sub_style_parent_style_description'));
763 foreach ($styles as
$id => $style) {
765 if ($style[
'skin_id'] != $system_style_conf->getDefaultSkinId() && !$style[
'substyle_of']) {
766 $options[
$id] = $style[
'title'];
769 $ti->setOptions($options);
772 $form->addCommandButton(
'saveNewSubStyle', $this->
lng->txt(
'save'));
773 $form->addCommandButton(
'cancel', $this->
lng->txt(
'cancel'));
782 if ($form->checkInput()) {
784 $skin_style_ids = $this->request_wrapper->post()->retrieve(
786 $this->
refinery->string()->splitString(
':')
789 $parent_skin_id = $skin_style_ids[0];
790 $parent_style_id = $skin_style_ids[1];
792 $container = $this->skin_factory->skinStyleContainerFromId($parent_skin_id, $this->message_stack);
794 $sub_style_id = $this->request_wrapper->post()->retrieve(
796 $this->
refinery->kindlyTo()->string()
799 if (array_key_exists(
801 $container->getSkin()->getSubstylesOfStyle($parent_style_id)
809 $sub_style_name = $this->request_wrapper->post()->retrieve(
811 $this->
refinery->kindlyTo()->string()
814 $style =
new ilSkinStyle($sub_style_id, $sub_style_name);
815 $style->setSubstyleOf($parent_style_id);
817 $this->
ctrl->setParameterByClass(
'ilsystemstyleconfiggui',
'skin_id', $parent_skin_id);
818 $this->
ctrl->setParameterByClass(
'ilsystemstyleconfiggui',
'style_id', $sub_style_id);
820 $this->message_stack->sendMessages();
821 $this->
ctrl->redirectByClass(
'ilsystemstyleconfiggui');
831 $form->setValuesByPost();
832 $this->tpl->setContent($form->getHTML());
An entity that renders components to a string output.
ilGlobalTemplateInterface $tpl
WrapperFactory $request_wrapper
const SUBSTYLE_ASSIGNMENT_EXISTS
static _lookupActivatedStyle(string $a_skin, string $a_style)
lookup if a style is activated
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static styleExists(string $style_id)
ilFileSystemHelper $file_system
static getCurrentDefaultSkin()
Gets default Skin of the System.
Factory to create Skin classes holds an manages the basic data of a skin as provide by the template o...
Class ChatMainBarProvider .
static _moveUsersToStyle(string $a_from_skin, string $a_from_style, string $a_to_skin, string $a_to_style)
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...
File System Helper, to reduce deps.
addMessage(ilSystemStyleMessage $message)
Add a message to be displayed by the stack.
getAssignmentCreationModal(string $style_name="")
static _deactivateStyle(string $a_skin, string $a_style)
deactivate system style
setReadOnly(bool $read_only)
static _getNumberOfUsersForStyle(string $a_skin, string $a_style)
static _activateStyle(string $a_skin, string $a_style)
activate system style
This class is responsible for all file system related actions related actions of a skin such as copyi...
static getAllSkinStyles()
Get all skins/styles as array (convenient for tables) Attention: tempalte_name/template_id in this ar...
skinStyleContainerFromId(string $skin_id, ilSystemStyleMessageStack $message_stack)
Get container class is responsible for all file system related actions related actions of a skin such...
static setCurrentDefaultStyle(string $skin_id, string $style_id)
Sets the default style of the system.
checkStyleSettings(ilSystemStyleMessageStack $message_stack, array $active_styles)
ilSkinFactory $skin_factory
ilSystemStyleConfig wraps all 'constants' to ensure the testability of all classes using those 'const...
__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)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static skinExists(string $skin_id, ?ilSystemStyleConfig $system_style_config=null)
Check whether a skin exists.
ilSystemStyleMessageStack $message_stack
Used to stack messages to be shown to the user.
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
ilSystemStyleConfig $config
TableGUI class for system styles.
ilSkinStyleContainer $style_container
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
setManagementEnabled(bool $management_enabled)
static _getAllUserAssignedStyles()
checkDeletable(string $skin_id, string $style_id, ilSystemStyleMessageStack $message_stack)
ilSkin holds an manages the basic data of a skin as provide by the template of the skin...