ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
ilSystemStyleOverviewGUI Class Reference
+ Collaboration diagram for ilSystemStyleOverviewGUI:

Public Member Functions

 __construct ($read_only, $management_enabled)
 Constructor. More...
 
 executeCommand ()
 Execute command. More...
 
 edit ()
 Edit. More...
 
 moveUserStyles ()
 Move user styles. More...
 
 saveStyleSettings ()
 Save skin and style settings. More...
 
 isReadOnly ()
 
 setReadOnly ($read_only)
 
 isManagementEnabled ()
 
 setManagementEnabled ($management_enabled)
 

Protected Member Functions

 view ()
 
 cancel ()
 
 checkStyleSettings (ilSystemStyleMessageStack $message_stack)
 
 addSystemStyle ()
 create More...
 
 saveNewSystemStyle ()
 
 addSystemStyleForms ()
 create More...
 
 createSystemStyleForm ()
 
 importSystemStyleForm ()
 
 cloneSystemStyleForm ()
 
 copyStyle ()
 
 deleteStyle ()
 
 deleteStyles ()
 
 checkDeletable ($skin_id, $style_id, ilSystemStyleMessageStack $message_stack)
 
 confirmDelete ()
 
 importStyle ()
 
 export ()
 
 addSubStyle ()
 
 addSubStyleForms ()
 
 saveNewSubStyle ()
 

Protected Attributes

 $ctrl
 
 $toolbar
 
 $lng
 
 $tpl
 
 $DIC
 
 $ref_id
 
 $read_only = true
 
 $management_enabled = false
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilSystemStyleOverviewGUI::__construct (   $read_only,
  $management_enabled 
)

Constructor.

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

67 {
68 global $DIC;
69
70 $this->ilias = $DIC["ilias"];
71 $this->dic = $DIC;
72 $this->ctrl = $DIC->ctrl();
73 $this->toolbar = $DIC->toolbar();
74 $this->lng = $DIC->language();
75 $this->tpl = $DIC["tpl"];
76
77 $this->ref_id = (int) $_GET["ref_id"];
78
79 $this->setReadOnly($read_only);
81 }
$_GET["client_id"]
redirection script todo: (a better solution should control the processing via a xml file)

References $_GET, $DIC, $management_enabled, $read_only, setManagementEnabled(), and setReadOnly().

+ 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 643 of file class.ilSystemStyleOverviewGUI.php.

644 {
645 global $DIC;
646
647 $DIC->tabs()->clearTargets();
651 $DIC->help()->setScreenIdComponent("sty");
652 $DIC->help()->setScreenId("system_styles");
653 $DIC->help()->setSubScreenId("create_sub");
654
655 $form = $this->addSubStyleForms();
656
657 $this->tpl->setContent($form->getHTML());
658 }

References $DIC, and addSubStyleForms().

+ Here is the call graph for this function:

◆ addSubStyleForms()

ilSystemStyleOverviewGUI::addSubStyleForms ( )
protected
Returns
ilPropertyFormGUI

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

664 {
665 $form = new ilPropertyFormGUI();
666 $form->setFormAction($this->ctrl->getFormAction($this));
667 $form->setTitle($this->lng->txt("sty_create_new_system_sub_style"));
668
669
670 $ti = new ilTextInputGUI($this->lng->txt("sub_style_id"), "sub_style_id");
671 $ti->setInfo($this->lng->txt("sub_style_id_description"));
672 $ti->setMaxLength(128);
673 $ti->setSize(40);
674 $ti->setRequired(true);
675 $form->addItem($ti);
676
677 $ti = new ilTextInputGUI($this->lng->txt("sub_style_name"), "sub_style_name");
678 $ti->setInfo($this->lng->txt("sub_style_name_description"));
679 $ti->setMaxLength(128);
680 $ti->setSize(40);
681 $ti->setRequired(true);
682 $form->addItem($ti);
683
684 // source
685 $ti = new ilSelectInputGUI($this->lng->txt("parent"), "parent_style");
686 $ti->setRequired(true);
687 $ti->setInfo($this->lng->txt("sub_style_parent_style_description"));
689 $options = array();
690 foreach ($styles as $id => $style) {
691 $system_style_conf = new ilSystemStyleConfig();
692 if ($style["skin_id"] != $system_style_conf->getDefaultSkinId() && !$style["substyle_of"]) {
693 $options[$id] = $style['title'];
694 }
695 }
696 $ti->setOptions($options);
697
698 $form->addItem($ti);
699 $form->addCommandButton("saveNewSubStyle", $this->lng->txt("save"));
700 $form->addCommandButton("cancel", $this->lng->txt("cancel"));
701
702 return $form;
703 }
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...
ilSystemStyleConfig wraps all 'constants' to ensure the testability of all classes using those 'const...
This class represents a text property in a property form.

References ilStyleDefinition\getAllSkinStyles().

Referenced by addSubStyle(), and saveNewSubStyle().

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

◆ addSystemStyle()

ilSystemStyleOverviewGUI::addSystemStyle ( )
protected

create

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

284 {
285 $this->addSystemStyleForms();
286 }

References addSystemStyleForms().

+ Here is the call graph for this function:

◆ addSystemStyleForms()

ilSystemStyleOverviewGUI::addSystemStyleForms ( )
protected

create

Since clearTargets also clears the help screen ids

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

328 {
329 global $DIC;
330
331 $DIC->tabs()->clearTargets();
335 $DIC->help()->setScreenIdComponent("sty");
336 $DIC->help()->setScreenId("system_styles");
337 $DIC->help()->setSubScreenId("create");
338
339 $forms = array();
340
341 $forms[] = $this->createSystemStyleForm();
342 $forms[] = $this->importSystemStyleForm();
343 $forms[] = $this->cloneSystemStyleForm();
344
345 $this->tpl->setContent($this->getCreationFormsHTML($forms));
346 }

References $DIC, cloneSystemStyleForm(), createSystemStyleForm(), and importSystemStyleForm().

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 133 of file class.ilSystemStyleOverviewGUI.php.

134 {
135 $this->edit();
136 }

References edit().

+ Here is the call graph for this function:

◆ checkDeletable()

ilSystemStyleOverviewGUI::checkDeletable (   $skin_id,
  $style_id,
ilSystemStyleMessageStack  $message_stack 
)
protected
Parameters
$skin_id
$style_id
ilSystemStyleMessageStack$message_stack
Returns
bool
Exceptions
ilSystemStyleException

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

561 {
562 $passed = true;
563 if (ilObjUser::_getNumberOfUsersForStyle($skin_id, $style_id) > 0) {
564 $message_stack->addMessage(new ilSystemStyleMessage($style_id . ": " . $this->lng->txt("cant_delete_if_users_assigned"), ilSystemStyleMessage::TYPE_ERROR));
565 $passed = false;
566 }
567 if (ilSystemStyleSettings::_lookupActivatedStyle($skin_id, $style_id) > 0) {
568 $message_stack->addMessage(new ilSystemStyleMessage($style_id . ": " . $this->lng->txt("cant_delete_activated_style"), ilSystemStyleMessage::TYPE_ERROR));
569 $passed = false;
570 }
572 $message_stack->addMessage(new ilSystemStyleMessage($style_id . ": " . $this->lng->txt("cant_delete_default_style"), ilSystemStyleMessage::TYPE_ERROR));
573 $passed = false;
574 }
575
576 if (ilSystemStyleSkinContainer::generateFromId($skin_id)->getSkin()->getSubstylesOfStyle($style_id)) {
577 $message_stack->addMessage(new ilSystemStyleMessage($style_id . ": " . $this->lng->txt("cant_delete_style_with_substyles"), ilSystemStyleMessage::TYPE_ERROR));
578 $passed = false;
579 }
580 return $passed;
581 }
static _getNumberOfUsersForStyle($a_skin, $a_style)
skins and styles
addMessage(ilSystemStyleMessage $message)
Add a message to be displayed by the stack.
static _lookupActivatedStyle($a_skin, $a_style)
lookup if a style is activated
static getCurrentDefaultSkin()
Gets default Skin of the System.
static generateFromId($skin_id, ilSystemStyleMessageStack $message_stack=null, ilSystemStyleConfig $system_styles_conf=null)
Generate the container class by parsing the corresponding XML.

References ilObjUser\_getNumberOfUsersForStyle(), ilSystemStyleSettings\_lookupActivatedStyle(), ilSystemStyleMessageStack\addMessage(), ilSystemStyleSkinContainer\generateFromId(), ilSystemStyleSettings\getCurrentDefaultSkin(), 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)
protected
Parameters
ilSystemStyleMessageStack$message_stack
Returns
bool

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

251 {
252 $passed = true;
253
254 if (count($_POST["st_act"]) < 1) {
255 $passed = false;
256 $message_stack->addMessage(new ilSystemStyleMessage($this->lng->txt("at_least_one_style"), ilSystemStyleMessage::TYPE_ERROR));
257 }
258
259 if (!isset($_POST["st_act"][$_POST["default_skin_style"]])) {
260 $passed = false;
261 $message_stack->addMessage(new ilSystemStyleMessage($this->lng->txt("cant_deactivate_default_style"), ilSystemStyleMessage::TYPE_ERROR));
262 }
263
264 // check if a style should be deactivated, that still has
265 // a user assigned to
267
268 foreach ($all_styles as $st) {
269 if (!isset($_POST["st_act"][$st["id"]])) {
270 if (ilObjUser::_getNumberOfUsersForStyle($st["template_id"], $st["style_id"]) > 0) {
271 $passed = false;
272 $message_stack->addMessage(new ilSystemStyleMessage($st["style_name"] . ": " . $this->lng->txt("cant_deactivate_if_users_assigned"), ilSystemStyleMessage::TYPE_ERROR));
273 }
274 }
275 }
276 return $passed;
277 }
$_POST["username"]

References $_POST, ilObjUser\_getNumberOfUsersForStyle(), ilSystemStyleMessageStack\addMessage(), ilStyleDefinition\getAllSkinStyles(), 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
Returns
ilPropertyFormGUI

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

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

References ilStyleDefinition\getAllSkinStyles().

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 583 of file class.ilSystemStyleOverviewGUI.php.

584 {
585 $message_stack = new ilSystemStyleMessageStack();
586
587 foreach ($_POST as $key => $skin_style_id) {
588 if (is_string($skin_style_id) && strpos($key, 'style') !== false) {
589 try {
590 $imploded_skin_style_id = explode(":", $skin_style_id);
591 $container = ilSystemStyleSkinContainer::generateFromId($imploded_skin_style_id[0], $message_stack);
592 $syle = $container->getSkin()->getStyle($imploded_skin_style_id[1]);
593 $container->deleteStyle($syle);
594 if (!$container->getSkin()->hasStyles()) {
595 $container->delete();
596 }
597 } catch (Exception $e) {
598 $message_stack->addMessage(new ilSystemStyleMessage($e->getMessage(), ilSystemStyleMessage::TYPE_ERROR));
599 }
600 }
601 }
602 $message_stack->sendMessages(true);
603 $this->ctrl->redirect($this);
604 }
Used to stack messages to be shown to the user.
$container
Definition: wac.php:13

References $_POST, $container, Vendor\Package\$e, ilSystemStyleSkinContainer\generateFromId(), and ilSystemStyleMessage\TYPE_ERROR.

+ Here is the call graph for this function:

◆ copyStyle()

ilSystemStyleOverviewGUI::copyStyle ( )
protected

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

484 {
485 $message_stack = new ilSystemStyleMessageStack();
486
487 $imploded_skin_style_id = explode(":", $_POST['source_style']);
488 $skin_id = $imploded_skin_style_id[0];
489 $style_id = $imploded_skin_style_id[1];
490
491 try {
492 $container = ilSystemStyleSkinContainer::generateFromId($skin_id, $message_stack);
493 $new_container = $container->copy();
494 $message_stack->prependMessage(new ilSystemStyleMessage($this->lng->txt("style_copied"), ilSystemStyleMessage::TYPE_SUCCESS));
495 $this->ctrl->setParameterByClass('ilSystemStyleSettingsGUI', 'skin_id', $new_container->getSkin()->getId());
496 $this->ctrl->setParameterByClass('ilSystemStyleSettingsGUI', 'style_id', $new_container->getSkin()->getStyle($style_id)->getId());
497 } catch (Exception $e) {
498 $message_stack->addMessage(new ilSystemStyleMessage($e->getMessage(), ilSystemStyleMessage::TYPE_ERROR));
499 }
500
501
502 $message_stack->sendMessages(true);
503 $this->ctrl->redirectByClass("ilSystemStyleSettingsGUI");
504 }

References $_POST, $container, Vendor\Package\$e, ilSystemStyleSkinContainer\generateFromId(), ilSystemStyleMessage\TYPE_ERROR, and ilSystemStyleMessage\TYPE_SUCCESS.

+ Here is the call graph for this function:

◆ createSystemStyleForm()

ilSystemStyleOverviewGUI::createSystemStyleForm ( )
protected
Returns
ilPropertyFormGUI

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

352 {
353 $form = new ilPropertyFormGUI();
354 $form->setFormAction($this->ctrl->getFormAction($this));
355 $form->setTitle($this->lng->txt("sty_create_new_system_style"));
356
357 $ti = new ilTextInputGUI($this->lng->txt("skin_id"), "skin_id");
358 $ti->setInfo($this->lng->txt("skin_id_description"));
359 $ti->setMaxLength(128);
360 $ti->setSize(40);
361 $ti->setRequired(true);
362 $form->addItem($ti);
363
364 $ti = new ilTextInputGUI($this->lng->txt("skin_name"), "skin_name");
365 $ti->setInfo($this->lng->txt("skin_name_description"));
366 $ti->setMaxLength(128);
367 $ti->setSize(40);
368 $ti->setRequired(true);
369 $form->addItem($ti);
370
371 $ti = new ilTextInputGUI($this->lng->txt("style_id"), "style_id");
372 $ti->setInfo($this->lng->txt("style_id_description"));
373 $ti->setMaxLength(128);
374 $ti->setSize(40);
375 $ti->setRequired(true);
376 $form->addItem($ti);
377
378 $ti = new ilTextInputGUI($this->lng->txt("style_name"), "style_name");
379 $ti->setInfo($this->lng->txt("style_name_description"));
380 $ti->setMaxLength(128);
381 $ti->setSize(40);
382 $ti->setRequired(true);
383 $form->addItem($ti);
384
385 $form->addCommandButton("saveNewSystemStyle", $this->lng->txt("save"));
386 $form->addCommandButton("cancel", $this->lng->txt("cancel"));
387
388 return $form;
389 }

Referenced by addSystemStyleForms(), and saveNewSystemStyle().

+ Here is the caller graph for this function:

◆ deleteStyle()

ilSystemStyleOverviewGUI::deleteStyle ( )
protected

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

507 {
508 $skin_id = $_GET["skin_id"];
509 $style_id = $_GET["style_id"];
510 $message_stack = new ilSystemStyleMessageStack();
511
512 if ($this->checkDeletable($skin_id, $style_id, $message_stack)) {
513 $delete_form_table = new ilSystemStyleDeleteGUI();
515 $delete_form_table->addStyle($container->getSkin(), $container->getSkin()->getStyle($style_id));
516 $this->tpl->setContent($delete_form_table->getDeleteStyleFormHTML());
517 } else {
518 $message_stack->prependMessage(new ilSystemStyleMessage($this->lng->txt("style_not_deleted"), ilSystemStyleMessage::TYPE_ERROR));
519 $message_stack->sendMessages(true);
520 $this->edit();
521 }
522 }
checkDeletable($skin_id, $style_id, ilSystemStyleMessageStack $message_stack)

References $_GET, $container, checkDeletable(), edit(), ilSystemStyleSkinContainer\generateFromId(), and ilSystemStyleMessage\TYPE_ERROR.

+ Here is the call graph for this function:

◆ deleteStyles()

ilSystemStyleOverviewGUI::deleteStyles ( )
protected

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

524 {
525 $delete_form_table = new ilSystemStyleDeleteGUI();
526 $message_stack = new ilSystemStyleMessageStack();
527
528 $all_deletable = true;
529 foreach ($_POST['id'] as $skin_style_id) {
530 $imploded_skin_style_id = explode(":", $skin_style_id);
531 $skin_id = $imploded_skin_style_id[0];
532 $style_id = $imploded_skin_style_id[1];
533 if (!$this->checkDeletable($skin_id, $style_id, $message_stack)) {
534 $all_deletable = false;
535 }
536 }
537 if ($all_deletable) {
538 foreach ($_POST['id'] as $skin_style_id) {
539 $imploded_skin_style_id = explode(":", $skin_style_id);
540 $skin_id = $imploded_skin_style_id[0];
541 $style_id = $imploded_skin_style_id[1];
543 $delete_form_table->addStyle($container->getSkin(), $container->getSkin()->getStyle($style_id));
544 }
545 $this->tpl->setContent($delete_form_table->getDeleteStyleFormHTML());
546 } else {
547 $message_stack->prependMessage(new ilSystemStyleMessage($this->lng->txt("styles_not_deleted"), ilSystemStyleMessage::TYPE_ERROR));
548 $message_stack->sendMessages(true);
549 $this->edit();
550 }
551 }

References $_POST, $container, checkDeletable(), edit(), ilSystemStyleSkinContainer\generateFromId(), and ilSystemStyleMessage\TYPE_ERROR.

+ Here is the call graph for this function:

◆ edit()

ilSystemStyleOverviewGUI::edit ( )

Edit.

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

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

References $si, ilStyleDefinition\getAllSkinStyles(), ilLinkButton\getInstance(), ilSubmitButton\getInstance(), and isManagementEnabled().

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

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

◆ executeCommand()

ilSystemStyleOverviewGUI::executeCommand ( )

Execute command.

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

87 {
88 $cmd = $this->ctrl->getCmd();
89
90 if ($cmd == "") {
91 $cmd = $this->isReadOnly()?"view":"edit";
92 }
93
94
95 switch ($cmd) {
96 case "addSystemStyle":
97 case "addSubStyle":
98 case "saveNewSystemStyle":
99 case "saveNewSubStyle":
100 case "copyStyle":
101 case "importStyle":
102 case "deleteStyles":
103 case "deleteStyle":
104 case "confirmDelete":
105 if (!$this->isManagementEnabled()) {
106 throw new ilObjectException($this->lng->txt("permission_denied"));
107 }
108 $this->$cmd();
109 return;
110 case "cancel":
111 case "edit":
112 case "export":
113 case "moveUserStyles":
114 case "saveStyleSettings":
115 if ($this->isReadOnly()) {
116 throw new ilObjectException($this->lng->txt("permission_denied"));
117 }
118 $this->$cmd();
119 return;
120 case "view":
121 $this->$cmd();
122 return;
123
124 }
125 }
Base exception class for object service.

References isManagementEnabled(), and isReadOnly().

+ Here is the call graph for this function:

◆ export()

ilSystemStyleOverviewGUI::export ( )
protected

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

629 {
630 $skin_id = $_GET["skin_id"];
632 try {
633 $container->export();
634 } catch (Exception $e) {
635 ilUtil::sendFailure($this->lng->txt("zip_export_failed") . " " . $e->getMessage());
636 }
637 }
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.

References $_GET, $container, Vendor\Package\$e, ilSystemStyleSkinContainer\generateFromId(), and ilUtil\sendFailure().

+ Here is the call graph for this function:

◆ importStyle()

ilSystemStyleOverviewGUI::importStyle ( )
protected

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

610 {
611 $form = $this->importSystemStyleForm();
612
613 if ($form->checkInput()) {
614 $message_stack = new ilSystemStyleMessageStack();
615 $imported_container = ilSystemStyleSkinContainer::import($_POST['importfile']['tmp_name'], $_POST['importfile']['name'], $message_stack);
616 $this->ctrl->setParameterByClass('ilSystemStyleSettingsGUI', 'skin_id', $imported_container->getSkin()->getId());
617 $this->ctrl->setParameterByClass('ilSystemStyleSettingsGUI', 'style_id', $imported_container->getSkin()->getDefaultStyle()->getId());
618 $message_stack->addMessage(new ilSystemStyleMessage($this->lng->txt("style_imported") . " " . $imported_container->getSkinDirectory(), ilSystemStyleMessage::TYPE_SUCCESS));
619
620 $message_stack->sendMessages(true);
621 $this->ctrl->redirectByClass("ilSystemStyleSettingsGUI");
622 }
623
624 // display only this form to correct input
625 $form->setValuesByPost();
626 $this->tpl->setContent($form->getHTML());
627 }
static import($import_zip_path, $name, ilSystemStyleMessageStack $message_stack=null, $system_styles_conf=null, $uploaded=true)
Imports a skin from zip.

References $_POST, ilSystemStyleSkinContainer\import(), importSystemStyleForm(), and ilSystemStyleMessage\TYPE_SUCCESS.

+ Here is the call graph for this function:

◆ importSystemStyleForm()

ilSystemStyleOverviewGUI::importSystemStyleForm ( )
protected
Returns
ilPropertyFormGUI

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

395 {
396 $form = new ilPropertyFormGUI();
397 $form->setFormAction($this->ctrl->getFormAction($this));
398 $form->setTitle($this->lng->txt("sty_import_system_style"));
399
400 // title
401 $file_input = new ilFileInputGUI($this->lng->txt("import_file"), "importfile");
402 $file_input->setRequired(true);
403 $file_input->setSuffixes(array("zip"));
404 $form->addItem($file_input);
405
406 $form->addCommandButton("importStyle", $this->lng->txt("import"));
407 $form->addCommandButton("cancel", $this->lng->txt("cancel"));
408
409 return $form;
410 }
This class represents a file property in a property form.

Referenced by addSystemStyleForms(), and importStyle().

+ Here is the caller graph for this function:

◆ isManagementEnabled()

ilSystemStyleOverviewGUI::isManagementEnabled ( )
Returns
boolean

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

761 {
763 }

References $management_enabled.

Referenced by edit(), and executeCommand().

+ Here is the caller graph for this function:

◆ isReadOnly()

ilSystemStyleOverviewGUI::isReadOnly ( )
Returns
boolean

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

745 {
746 return $this->read_only;
747 }

References $read_only.

Referenced by executeCommand().

+ Here is the caller graph for this function:

◆ moveUserStyles()

ilSystemStyleOverviewGUI::moveUserStyles ( )

Move user styles.

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

193 {
194 $to = explode(":", $_POST["to_style"]);
195
196 if ($_POST["from_style"] == "other") {
197 // get all user assigned styles
198 $all_user_styles = ilObjUser::_getAllUserAssignedStyles();
199
200 // move users that are not assigned to
201 // currently existing style
202 foreach ($all_user_styles as $style) {
203 if (!ilStyleDefinition::styleExists($style)) {
204 $style_arr = explode(":", $style);
205 ilObjUser::_moveUsersToStyle($style_arr[0], $style_arr[1], $to[0], $to[1]);
206 }
207 }
208 } else {
209 $from = explode(":", $_POST["from_style"]);
210 ilObjUser::_moveUsersToStyle($from[0], $from[1], $to[0], $to[1]);
211 }
212
213 ilUtil::sendSuccess($this->lng->txt("msg_obj_modified"), true);
214 $this->ctrl->redirect($this, "edit");
215 }
static _getAllUserAssignedStyles()
skins and styles
static _moveUsersToStyle($a_from_skin, $a_from_style, $a_to_skin, $a_to_style)
skins and styles
static styleExists($style_id)

References $_POST, ilObjUser\_getAllUserAssignedStyles(), ilObjUser\_moveUsersToStyle(), and ilStyleDefinition\styleExists().

+ Here is the call graph for this function:

◆ saveNewSubStyle()

ilSystemStyleOverviewGUI::saveNewSubStyle ( )
protected

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

706 {
707 $form = $this->addSubStyleForms();
708
709 if ($form->checkInput()) {
710 try {
711 $imploded_parent_skin_style_id = explode(":", $_POST['parent_style']);
712 $parent_skin_id = $imploded_parent_skin_style_id[0];
713 $parent_style_id = $imploded_parent_skin_style_id[1];
714
716
717 if (array_key_exists($_POST['sub_style_id'], $container->getSkin()->getSubstylesOfStyle($parent_style_id))) {
719 }
720
721 $sub_style_id = $_POST['sub_style_id'];
722
723 $style = new ilSkinStyleXML($_POST['sub_style_id'], $_POST['sub_style_name']);
724 $style->setSubstyleOf($parent_style_id);
725 $container->addStyle($style);
726
727 $this->ctrl->setParameterByClass('ilSystemStyleSettingsGUI', 'skin_id', $parent_skin_id);
728 $this->ctrl->setParameterByClass('ilSystemStyleSettingsGUI', 'style_id', $sub_style_id);
729 ilUtil::sendSuccess($this->lng->txt("msg_sub_style_created"), true);
730 $this->ctrl->redirectByClass("ilSystemStyleSettingsGUI");
731 } catch (ilSystemStyleException $e) {
732 ilUtil::sendFailure($e->getMessage(), true);
733 }
734 }
735
736 // display only this form to correct input
737 $form->setValuesByPost();
738 $this->tpl->setContent($form->getHTML());
739 }
Class for advanced editing exception handling in ILIAS.

References $_POST, $container, Vendor\Package\$e, addSubStyleForms(), ilSystemStyleSkinContainer\generateFromId(), ilUtil\sendFailure(), and ilSystemStyleException\SUBSTYLE_ASSIGNMENT_EXISTS.

+ Here is the call graph for this function:

◆ saveNewSystemStyle()

ilSystemStyleOverviewGUI::saveNewSystemStyle ( )
protected

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

290 {
291 $form = $this->createSystemStyleForm();
292
293 if ($form->checkInput()) {
294 $message_stack = new ilSystemStyleMessageStack();
295 if (ilStyleDefinition::skinExists($_POST["skin_id"])) {
296 ilUtil::sendFailure($this->lng->txt("skin_id_exists"));
297 } else {
298 try {
299 $skin = new ilSkinXML($_POST["skin_id"], $_POST["skin_name"]);
300 $style = new ilSkinStyleXML($_POST["style_id"], $_POST["style_name"]);
301 $skin->addStyle($style);
303 $container->create($message_stack);
304 $this->ctrl->setParameterByClass('ilSystemStyleSettingsGUI', 'skin_id', $skin->getId());
305 $this->ctrl->setParameterByClass('ilSystemStyleSettingsGUI', 'style_id', $style->getId());
306 if ($message_stack->hasMessages()) {
307 $message_stack->sendMessages(true);
308 } else {
309 ilUtil::sendSuccess($this->lng->txt("msg_sys_style_created"), true);
310 }
311 $this->ctrl->redirectByClass("ilSystemStyleSettingsGUI");
312 } catch (ilSystemStyleException $e) {
313 $message_stack->addMessage(new ilSystemStyleMessage($e->getMessage(), ilSystemStyleMessage::TYPE_ERROR));
314 }
315 }
316 $message_stack->sendMessages();
317 }
318
319 // display only this form to correct input
320 $form->setValuesByPost();
321 $this->tpl->setContent($form->getHTML());
322 }
ilSkinXml holds an manages the basic data of a skin as provide by the template of the skin.
static skinExists($skin_id, ilSystemStyleConfig $system_style_config=null)
Check whether a skin exists.
This class is responsible for all file system related actions related actions of a skin such as copyi...

References $_POST, $container, Vendor\Package\$e, createSystemStyleForm(), ilUtil\sendFailure(), ilStyleDefinition\skinExists(), and ilSystemStyleMessage\TYPE_ERROR.

+ Here is the call graph for this function:

◆ saveStyleSettings()

ilSystemStyleOverviewGUI::saveStyleSettings ( )

Save skin and style settings.

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

222 {
223 $message_stack = new ilSystemStyleMessageStack();
224
225 if ($this->checkStyleSettings($message_stack)) {
227 foreach ($all_styles as $st) {
228 if (!isset($_POST["st_act"][$st["id"]])) {
229 ilSystemStyleSettings::_deactivateStyle($st["template_id"], $st["style_id"]);
230 } else {
231 ilSystemStyleSettings::_activateStyle($st["template_id"], $st["style_id"]);
232 }
233 }
234
235 //set default skin and style
236 if ($_POST["default_skin_style"] != "") {
237 $sknst = explode(":", $_POST["default_skin_style"]);
239 }
240 $message_stack->addMessage(new ilSystemStyleMessage($this->lng->txt("msg_obj_modified"), ilSystemStyleMessage::TYPE_SUCCESS));
241 }
242 $message_stack->sendMessages(true);
243 $this->ctrl->redirect($this, "edit");
244 }
checkStyleSettings(ilSystemStyleMessageStack $message_stack)
static setCurrentDefaultStyle($skin_id, $style_id)
Sets the default style of the system.
static _activateStyle($a_skin, $a_style)
activate system style
static _deactivateStyle($a_skin, $a_style)
deactivate system style

References $_POST, ilSystemStyleSettings\_activateStyle(), ilSystemStyleSettings\_deactivateStyle(), checkStyleSettings(), ilStyleDefinition\getAllSkinStyles(), ilSystemStyleSettings\setCurrentDefaultStyle(), and ilSystemStyleMessage\TYPE_SUCCESS.

+ Here is the call graph for this function:

◆ setManagementEnabled()

ilSystemStyleOverviewGUI::setManagementEnabled (   $management_enabled)
Parameters
boolean$management_enabled

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

769 {
770 $this->management_enabled = $management_enabled;
771 }

References $management_enabled.

Referenced by __construct().

+ Here is the caller graph for this function:

◆ setReadOnly()

ilSystemStyleOverviewGUI::setReadOnly (   $read_only)
Parameters
boolean$read_only

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

753 {
754 $this->read_only = $read_only;
755 }

References $read_only.

Referenced by __construct().

+ Here is the caller graph for this function:

◆ view()

ilSystemStyleOverviewGUI::view ( )
protected

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

128 {
129 $table = new ilSystemStylesTableGUI($this, "edit", true);
130 $this->tpl->setContent($table->getHTML());
131 }

Field Documentation

◆ $ctrl

ilSystemStyleOverviewGUI::$ctrl
protected

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

◆ $DIC

ilSystemStyleOverviewGUI::$DIC
protected

◆ $lng

ilSystemStyleOverviewGUI::$lng
protected

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

◆ $management_enabled

ilSystemStyleOverviewGUI::$management_enabled = false
protected

◆ $read_only

ilSystemStyleOverviewGUI::$read_only = true
protected

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

Referenced by __construct(), isReadOnly(), and setReadOnly().

◆ $ref_id

ilSystemStyleOverviewGUI::$ref_id
protected

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

◆ $toolbar

ilSystemStyleOverviewGUI::$toolbar
protected

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

◆ $tpl

ilSystemStyleOverviewGUI::$tpl
protected

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


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