19declare(strict_types=1);
26use Psr\Http\Message\ServerRequestInterface;
80 $this->style_container = $this->skin_factory->skinStyleContainerFromId($skin_id, $this->message_stack);
85 $cmd = $this->
ctrl->getCmd() ? $this->
ctrl->getCmd() :
'edit';
86 $style = $this->style_container->getSkin()->getStyle($this->style_id);
95 $this->request_wrapper,
101 case 'deleteAssignments':
102 $assign_gui->deleteAssignments($this->style_container->getSkin(), $style);
104 case 'saveAssignment':
105 $assign_gui->saveAssignment($this->style_container->getSkin(), $style);
107 case 'addAssignment':
108 $assign_gui->addAssignment();
111 $assign_gui->assignStyle($this->style_container->getSkin(), $style);
123 protected function edit(): void
126 $this->tpl->setContent($this->
renderer->render($form));
129 protected function save(): void
131 $new_skin = $this->style_container->getSkin();
132 $new_style = $new_skin->getStyle($this->style_id);
133 $old_skin = clone $new_skin;
134 $old_style = clone $new_style;
137 $form = $form->withRequest($this->request);
138 $result = $form->getData();
142 $new_skin->updateParentStyleOfSubstyles($old_style->getId(), $new_style->getId());
143 $this->style_container->updateSkin($old_skin);
144 $this->style_container->updateStyle($new_style->getId(), $old_style);
146 if ($old_style->isSubstyle()) {
147 $new_style->setSubstyleOf($old_style->getSubstyleOf());
161 $result[
'activation_section'],
168 $this->
ctrl->setParameterByClass(
'ilsystemstyleconfiggui',
'skin_id', $new_skin->getId());
169 $this->
ctrl->setParameterByClass(
'ilsystemstyleconfiggui',
'style_id', $new_style->getId());
171 $this->message_stack->sendMessages();
172 $this->
ctrl->redirectByClass(
'ilsystemstyleconfiggui');
181 $this->tpl->setContent($this->
renderer->render(
182 array_merge($this->message_stack->getUIComponentsMessages($this->ui_factory), [$form])
187 ?array $activation_values,
196 if (is_array($activation_values)) {
198 $personal = (bool) $activation_values[
'personal'];
199 $default = (bool) $activation_values[
'default'];
216 if (!$personal && $this->
user->getPref(
'skin') == $skin_id) {
225 $system_style_conf->getDefaultSkinId(),
226 $system_style_conf->getDefaultStyleId()
231 $this->
lng->txt(
'personal_style_set_to') .
' ' .
239 $system_style_conf->getDefaultSkinId(),
240 $system_style_conf->getDefaultStyleId()
244 $this->
lng->txt(
'default_style_set_to') .
' ' . $system_style_conf->getDefaultSkinId() .
': ' . $system_style_conf->getDefaultStyleId(),
256 $f = $this->ui_factory->input();
257 $skin = $this->style_container->getSkin();
258 $style = $skin->getStyle($this->style_id);
260 if (!$style->isSubstyle()) {
262 $skin_fields[] =
$f->field()->text($this->
lng->txt(
'skin_id'), $this->lng->txt(
'skin_id_description'))
264 ->withValue($skin->getId())
265 ->withAdditionalTransformation($this->
refinery->custom()->transformation(
266 function ($v) use ($skin) {
271 $skin_fields[] =
$f->field()->text($this->
lng->txt(
'skin_name'), $this->lng->txt(
'skin_name_description'))
273 ->withValue($skin->getName())
274 ->withAdditionalTransformation($this->
refinery->custom()->transformation(
275 function ($v) use ($skin) {
280 if ($skin->isVersionChangeable()) {
281 $skin_fields[] =
$f->field()->text(
282 $this->
lng->txt(
'skin_version'),
283 $this->lng->txt(
'skin_version_description')
286 ->withValue($skin->getVersion())
287 ->withAdditionalTransformation($this->
refinery->custom()->transformation(
288 function ($v) use ($skin) {
289 $skin->getVersionStep($v);
293 $sections[] =
$f->field()->section($skin_fields, $this->
lng->txt(
'skin'));
296 $style_id =
$f->field()->text($this->
lng->txt(
'style_id'), $this->lng->txt(
'style_id_description'))
298 ->withValue($style->getId())
299 ->withAdditionalTransformation($this->
refinery->custom()->transformation(
300 function ($v) use ($style) {
302 $style->setCssFile($v);
305 $style_name =
$f->field()->text($this->
lng->txt(
'style_name'), $this->lng->txt(
'style_name_description'))
307 ->withValue($style->getName())
308 ->withAdditionalTransformation($this->
refinery->custom()->transformation(
309 function ($v) use ($style) {
313 $image_dir =
$f->field()->text($this->
lng->txt(
'image_dir'), $this->lng->txt(
'image_dir_description'))
314 ->withValue($style->getImageDirectory())
315 ->withAdditionalTransformation($this->
refinery->custom()->transformation(
316 function ($v) use ($style) {
317 $style->setImageDirectory($v);
320 $font_dir =
$f->field()->text($this->
lng->txt(
'font_dir'), $this->lng->txt(
'font_dir_description'))
321 ->withValue($style->getFontDirectory())
322 ->withAdditionalTransformation($this->
refinery->custom()->transformation(
323 function ($v) use ($style) {
324 $style->setFontDirectory($v);
327 $sound_dir =
$f->field()->text($this->
lng->txt(
'sound_dir'), $this->lng->txt(
'sound_dir_description'))
328 ->withValue($style->getSoundDirectory())
329 ->withAdditionalTransformation($this->
refinery->custom()->transformation(
330 function ($v) use ($style) {
331 $style->setSoundDirectory($v);
334 $section_name = $this->
lng->txt(
'style');
335 if ($style->isSubstyle()) {
336 $this->
lng->txt(
'sub_style');
338 $sections[] =
$f->field()->section([$style_id, $style_name, $image_dir, $font_dir, $sound_dir], $section_name);
340 if (!$style->isSubstyle()) {
342 $activation_values =
null;
344 $is_personal_style = $this->
user->getPref(
'skin') == $skin->getId()
345 && $this->
user->getPref(
'style') == $style->getId();
348 $activation_values = [
'default' => $is_default_style,
'personal' => $is_personal_style];
351 $default =
$f->field()->checkbox(
352 $this->
lng->txt(
'default'),
353 $this->lng->txt(
'system_style_default_description')
356 $personal =
$f->field()->checkbox(
357 $this->
lng->txt(
'personal'),
358 $this->lng->txt(
'system_style_personal_description')
361 $activation =
$f->field()->optionalGroup(
362 [
'default' => $default,
'personal' => $personal],
363 $this->
lng->txt(
'system_style_activation'),
364 $this->lng->txt(
'system_style_activation_description')
365 )->withValue($activation_values);
366 $sections[
'activation_section'] =
$f->field()->section(
367 [
'activation' => $activation],
368 $this->
lng->txt(
'system_style_activation')
370 ->withAdditionalTransformation($this->
refinery->custom()->transformation(
372 return $v[
'activation'];
377 return $f->container()->form()->standard($this->
ctrl->getFormActionByClass(
378 'ilsystemstyleconfiggui',
Builds a Color from either hex- or rgb values.
Class ilCtrl provides processing control methods.
Factory to create Skin classes holds an manages the basic data of a skin as provide by the template o...
This class is responsible for all file system related actions related actions of a skin such as copyi...
ilGlobalTemplateInterface $tpl
__construct(ilCtrl $ctrl, ilLanguage $lng, ilGlobalTemplateInterface $tpl, ilTabsGUI $tabs, Factory $ui_factory, Renderer $renderer, ilSkinFactory $skin_factory, WrapperFactory $request_wrapper, Refinery $refinery, ilToolbarGUI $toolbar, ilObjUser $user, ServerRequestInterface $request, ilTree $tree, string $skin_id, string $style_id)
ServerRequestInterface $request
WrapperFactory $request_wrapper
handleStyleActivation(?array $activation_values, string $skin_id, string $style_id, ilSystemStyleMessageStack $message_stack)
ilSkinFactory $skin_factory
ilSystemStyleMessageStack $message_stack
ilSkinStyleContainer $style_container
ilSystemStyleConfig wraps all 'constants' to ensure the testability of all classes using those 'const...
Class for advanced editing exception handling in ILIAS.
Used to stack messages to be shown to the user.
addMessage(ilSystemStyleMessage $message)
Add a message to be displayed by the stack.
static _activateStyle(string $a_skin, string $a_style)
activate system style
static getCurrentDefaultStyle()
Gets default style of the system.
static updateSubStyleIdfSubStyleCategoryAssignments(string $old_substyle_id, string $new_substyle_id)
Updates an assignment, e.g.
static getCurrentUserPrefSkin()
Gets a users preferred skin by using the user object.
static _lookupActivatedStyle(string $a_skin, string $a_style)
lookup if a style is activated
static _deactivateStyle(string $a_skin, string $a_style)
deactivate system style
static updateSkinIdAndStyleIDOfSubStyleCategoryAssignments(string $old_skin_id, string $old_style_id, string $new_skin_id, string $new_style_id)
Updates an assignment, e.g.
static getCurrentDefaultSkin()
Gets default Skin of the System.
static setCurrentUserPrefStyle(string $skin_id, string $style_id)
Sets a users preferred system skin/style by using the user object.
static setCurrentDefaultStyle(string $skin_id, string $style_id)
Sets the default style of the system.
static getCurrentUserPrefStyle()
Gets a users preferred style by using the user object.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Tree class data representation in hierachical trees using the Nested Set Model with Gaps by Joe Celco...
This is how the factory for UI elements looks.
An entity that renders components to a string output.