ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
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 ()
 
 createSystemStyleForm ()
 
 importSystemStyleForm ()
 
 cloneSystemStyleForm ()
 
 copyStyle ()
 
 deleteStyle ()
 
 deleteStyles ()
 
 checkDeletable ($skin_id, $style_id, ilSystemStyleMessageStack $message_stack)
 
 confirmDelete ()
 
 importStyle ()
 
 export ()
 
 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

◆ addSubStyleForms()

ilSystemStyleOverviewGUI::addSubStyleForms ( )
protected
Returns
ilPropertyFormGUI

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

670 {
671 $form = new ilPropertyFormGUI();
672 $form->setFormAction($this->ctrl->getFormAction($this));
673 $form->setTitle($this->lng->txt("sty_create_new_system_sub_style"));
674
675
676 $ti = new ilTextInputGUI($this->lng->txt("sub_style_id"), "sub_style_id");
677 $ti->setInfo($this->lng->txt("sub_style_id_description"));
678 $ti->setMaxLength(128);
679 $ti->setSize(40);
680 $ti->setRequired(true);
681 $form->addItem($ti);
682
683 $ti = new ilTextInputGUI($this->lng->txt("sub_style_name"), "sub_style_name");
684 $ti->setInfo($this->lng->txt("sub_style_name_description"));
685 $ti->setMaxLength(128);
686 $ti->setSize(40);
687 $ti->setRequired(true);
688 $form->addItem($ti);
689
690 // source
691 $ti = new ilSelectInputGUI($this->lng->txt("parent"), "parent_style");
692 $ti->setRequired(true);
693 $ti->setInfo($this->lng->txt("sub_style_parent_style_description"));
694 $styles = ilStyleDefinition::getAllSkinStyles();
695 $options = array();
696 foreach ($styles as $id => $style) {
697 $system_style_conf = new ilSystemStyleConfig();
698 if ($style["skin_id"]!=$system_style_conf->getDefaultSkinId() && !$style["substyle_of"]) {
699 $options[$id] = $style['title'];
700 }
701 }
702 $ti->setOptions($options);
703
704 $form->addItem($ti);
705 $form->addCommandButton("saveNewSubStyle", $this->lng->txt("save"));
706 $form->addCommandButton("cancel", $this->lng->txt("cancel"));
707
708 return $form;
709 }
if(!isset( $_REQUEST[ 'ReturnTo'])) if(!isset($_REQUEST['AuthId'])) $options
Definition: as_login.php:20
This class represents a property form user interface.
This class represents a selection list property in a property form.
ilSystemStyleConfig wraps all 'constants' to ensure the testability of all classes using those 'const...
This class represents a text property in a property form.
$style
Definition: example_012.php:70
if(!array_key_exists('StateId', $_REQUEST)) $id
if(isset($_POST['submit'])) $form

References $form, $id, $options, $style, and $styles.

Referenced by saveNewSubStyle().

+ 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 }

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

564 {
565 $passed = true;
566 if (ilObjUser::_getNumberOfUsersForStyle($skin_id, $style_id) > 0) {
567 $message_stack->addMessage(new ilSystemStyleMessage($style_id . ": " . $this->lng->txt("cant_delete_if_users_assigned"), ilSystemStyleMessage::TYPE_ERROR));
568 $passed = false;
569 }
570 if (ilSystemStyleSettings::_lookupActivatedStyle($skin_id, $style_id) > 0) {
571 $message_stack->addMessage(new ilSystemStyleMessage($style_id . ": " . $this->lng->txt("cant_delete_activated_style"), ilSystemStyleMessage::TYPE_ERROR));
572 $passed = false;
573 }
575 $message_stack->addMessage(new ilSystemStyleMessage($style_id . ": " . $this->lng->txt("cant_delete_default_style"), ilSystemStyleMessage::TYPE_ERROR));
576 $passed = false;
577 }
578
579 if (ilSystemStyleSkinContainer::generateFromId($skin_id)->getSkin()->getSubstylesOfStyle($style_id)) {
580 $message_stack->addMessage(new ilSystemStyleMessage($style_id . ": " . $this->lng->txt("cant_delete_style_with_substyles"), ilSystemStyleMessage::TYPE_ERROR));
581 $passed = false;
582 }
583 return $passed;
584 }
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
266 $all_styles = ilStyleDefinition::getAllSkinStyles();
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(), 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 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);
427 $styles = ilStyleDefinition::getAllSkinStyles();
428 $options = array();
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 $form, $id, $options, $style, and $styles.

◆ confirmDelete()

ilSystemStyleOverviewGUI::confirmDelete ( )
protected

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

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

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

+ Here is the call graph for this function:

◆ copyStyle()

ilSystemStyleOverviewGUI::copyStyle ( )
protected

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

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

References $_POST, $container, 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 354 of file class.ilSystemStyleOverviewGUI.php.

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

References $form.

Referenced by saveNewSystemStyle().

+ Here is the caller graph for this function:

◆ deleteStyle()

ilSystemStyleOverviewGUI::deleteStyle ( )
protected

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

510 {
511 $skin_id = $_GET["skin_id"];
512 $style_id = $_GET["style_id"];
513 $message_stack = new ilSystemStyleMessageStack();
514
515 if ($this->checkDeletable($skin_id, $style_id, $message_stack)) {
516 $delete_form_table = new ilSystemStyleDeleteGUI();
518 $delete_form_table->addStyle($container->getSkin(), $container->getSkin()->getStyle($style_id));
519 $this->tpl->setContent($delete_form_table->getDeleteStyleFormHTML());
520 } else {
521 $message_stack->prependMessage(new ilSystemStyleMessage($this->lng->txt("style_not_deleted"), ilSystemStyleMessage::TYPE_ERROR));
522 $message_stack->sendMessages(true);
523 $this->edit();
524 }
525 }
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 526 of file class.ilSystemStyleOverviewGUI.php.

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

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.
if(empty($password)) $table
Definition: pwgen.php:24

References $id, $options, $si, $table, 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 631 of file class.ilSystemStyleOverviewGUI.php.

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

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

+ Here is the call graph for this function:

◆ importStyle()

ilSystemStyleOverviewGUI::importStyle ( )
protected

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

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

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

+ Here is the call graph for this function:

◆ importSystemStyleForm()

ilSystemStyleOverviewGUI::importSystemStyleForm ( )
protected
Returns
ilPropertyFormGUI

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

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

References $form.

Referenced by importStyle().

+ Here is the caller graph for this function:

◆ isManagementEnabled()

ilSystemStyleOverviewGUI::isManagementEnabled ( )
Returns
boolean

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

767 {
769 }

References $management_enabled.

Referenced by edit(), and executeCommand().

+ Here is the caller graph for this function:

◆ isReadOnly()

ilSystemStyleOverviewGUI::isReadOnly ( )
Returns
boolean

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

751 {
752 return $this->read_only;
753 }

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) {
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)
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
$from

References $_POST, $from, $style, ilObjUser\_getAllUserAssignedStyles(), ilObjUser\_moveUsersToStyle(), ilUtil\sendSuccess(), and ilStyleDefinition\styleExists().

+ Here is the call graph for this function:

◆ saveNewSubStyle()

ilSystemStyleOverviewGUI::saveNewSubStyle ( )
protected

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

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

References $_POST, $container, $form, $style, addSubStyleForms(), ilSystemStyleSkinContainer\generateFromId(), ilUtil\sendFailure(), ilUtil\sendSuccess(), 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, $form, $style, createSystemStyleForm(), ilUtil\sendFailure(), ilUtil\sendSuccess(), 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)) {
226 $all_styles = ilStyleDefinition::getAllSkinStyles();
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(), 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 774 of file class.ilSystemStyleOverviewGUI.php.

775 {
776 $this->management_enabled = $management_enabled;
777 }

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

759 {
760 $this->read_only = $read_only;
761 }

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 }

References $table.

Field Documentation

◆ $ctrl

ilSystemStyleOverviewGUI::$ctrl
protected

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

◆ $DIC

ilSystemStyleOverviewGUI::$DIC
protected

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

Referenced by __construct().

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