ILIAS  release_7 Revision v7.30-3-g800a261c036
All Data Structures Namespaces Files Functions Variables Modules Pages
ilSystemStyleSettingsGUI Class Reference
+ Collaboration diagram for ilSystemStyleSettingsGUI:

Public Member Functions

 __construct ()
 Constructor. More...
 
 executeCommand ()
 Execute command. More...
 
 getPropertiesValues ($form)
 Get values for edit properties form. More...
 

Protected Member Functions

 setSubStyleSubTabs ($active="")
 
 edit ()
 
 save ()
 
 saveStyle (ilSystemStyleMessageStack $message_stack)
 
 saveSubStyle (ilSystemStyleMessageStack $message_stack)
 
 editSystemStyleForm ()
 

Protected Attributes

 $ctrl
 
 $lng
 
 $tpl
 
 $tabs
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilSystemStyleSettingsGUI::__construct ( )

Constructor.

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

References $DIC.

43  {
44  global $DIC;
45 
46  $this->ctrl = $DIC->ctrl();
47  $this->lng = $DIC->language();
48  $this->tabs = $DIC->tabs();
49 
50  $this->tpl = $DIC["tpl"];
51  }
global $DIC
Definition: goto.php:24

Member Function Documentation

◆ edit()

ilSystemStyleSettingsGUI::edit ( )
protected

Definition at line 110 of file class.ilSystemStyleSettingsGUI.php.

References editSystemStyleForm(), and getPropertiesValues().

Referenced by executeCommand().

111  {
112  $form = $this->editSystemStyleForm();
113  $this->getPropertiesValues($form);
114  $this->tpl->setContent($form->getHTML());
115  }
getPropertiesValues($form)
Get values for edit properties form.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ editSystemStyleForm()

ilSystemStyleSettingsGUI::editSystemStyleForm ( )
protected
Returns
ilPropertyFormGUI
Exceptions
ilSystemStyleException

Definition at line 311 of file class.ilSystemStyleSettingsGUI.php.

References $_GET, $section, ilNonEditableValueGUI\setInfo(), and ilFormPropertyGUI\setInfo().

Referenced by edit(), and save().

312  {
313  $form = new ilPropertyFormGUI();
314  $system_style_conf = new ilSystemStyleConfig();
315 
316  $skin = ilSkinXML::parseFromXML($system_style_conf->getCustomizingSkinPath() . $_GET["skin_id"] . "/template.xml");
317  $style = $skin->getStyle($_GET["style_id"]);
318 
319  $form->setFormAction($this->ctrl->getFormActionByClass("ilsystemstylesettingsgui"));
320 
321 
322  if (!$style->isSubstyle()) {
323  $form->setTitle($this->lng->txt("skin"));
324 
325  $ti = new ilTextInputGUI($this->lng->txt("skin_id"), "skin_id");
326  $ti->setMaxLength(128);
327  $ti->setSize(40);
328  $ti->setRequired(true);
329  $ti->setInfo($this->lng->txt("skin_id_description"));
330  $form->addItem($ti);
331 
332  $ti = new ilTextInputGUI($this->lng->txt("skin_name"), "skin_name");
333  $ti->setInfo($this->lng->txt("skin_name_description"));
334  $ti->setMaxLength(128);
335  $ti->setSize(40);
336  $ti->setRequired(true);
337  $form->addItem($ti);
338 
339  if ($skin->isVersionChangeable()) {
340  $ti = new ilNonEditableValueGUI($this->lng->txt("skin_version"), "skin_version");
341  $ti->setInfo($this->lng->txt("skin_version_description"));
342  $ti->setValue($skin->getVersion());
343  $form->addItem($ti);
344  }
345 
347  $section->setTitle($this->lng->txt("style"));
348  $form->addItem($section);
349  } else {
350  $form->setTitle($this->lng->txt("sub_style"));
351  }
352 
353  $ti = new ilTextInputGUI($this->lng->txt("style_id"), "style_id");
354  $ti->setMaxLength(128);
355  $ti->setSize(40);
356  $ti->setRequired(true);
357  $ti->setInfo($this->lng->txt("style_id_description"));
358  $form->addItem($ti);
359 
360  $ti = new ilTextInputGUI($this->lng->txt("style_name"), "style_name");
361  $ti->setMaxLength(128);
362  $ti->setSize(40);
363  $ti->setRequired(true);
364  $ti->setInfo($this->lng->txt("style_name_description"));
365  $form->addItem($ti);
366 
367  $ti = new ilTextInputGUI($this->lng->txt("image_dir"), "image_dir");
368  $ti->setMaxLength(128);
369  $ti->setSize(40);
370  $ti->setInfo($this->lng->txt("image_dir_description"));
371  $form->addItem($ti);
372 
373  $ti = new ilTextInputGUI($this->lng->txt("font_dir"), "font_dir");
374  $ti->setMaxLength(128);
375  $ti->setSize(40);
376  $ti->setInfo($this->lng->txt("font_dir_description"));
377  $form->addItem($ti);
378 
379  $ti = new ilTextInputGUI($this->lng->txt("sound_dir"), "sound_dir");
380  $ti->setMaxLength(128);
381  $ti->setSize(40);
382  $ti->setInfo($this->lng->txt("sound_dir_description"));
383  $form->addItem($ti);
384 
385  if (!$style->isSubstyle()) {
387  $section->setTitle($this->lng->txt("system_style_activation"));
388  $form->addItem($section);
389 
390  $active = new ilCheckboxInputGUI($this->lng->txt("system_style_activation"), "active");
391  $active->setInfo($this->lng->txt("system_style_activation_description"));
392 
393  $set_default = new ilCheckboxInputGUI($this->lng->txt("default"), "default");
394  $set_default->setInfo($this->lng->txt("system_style_default_description"));
395  $active->addSubItem($set_default);
396 
397  $set_personal = new ilCheckboxInputGUI($this->lng->txt("personal"), "personal");
398  $set_personal->setInfo($this->lng->txt("system_style_personal_description"));
399  $active->addSubItem($set_personal);
400 
401 
402  $form->addItem($active);
403  }
404 
405  $form->addCommandButton("save", $this->lng->txt("save"));
406  $form->addCommandButton("cancel", $this->lng->txt("cancel"));
407 
408  return $form;
409  }
This class represents a property form user interface.
$_GET["client_id"]
This class represents a section header in a property form.
setInfo($a_info)
Set Information Text.
This class represents a checkbox property in a property form.
setInfo($a_info)
Set Information Text.
$section
Definition: Utf8Test.php:83
ilSystemStyleConfig wraps all 'constants' to ensure the testability of all classes using those 'const...
This class represents a non editable value in a property form.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ executeCommand()

ilSystemStyleSettingsGUI::executeCommand ( )

Execute command.

Definition at line 57 of file class.ilSystemStyleSettingsGUI.php.

References $_GET, edit(), and setSubStyleSubTabs().

58  {
59  $cmd = $this->ctrl->getCmd() ? $this->ctrl->getCmd():"edit";
60  $system_style_conf = new ilSystemStyleConfig();
61  $skin = ilSkinXML::parseFromXML($system_style_conf->getCustomizingSkinPath() . $_GET["skin_id"] . "/template.xml");
62  $style = $skin->getStyle($_GET["style_id"]);
63 
64  if ($style->isSubstyle()) {
65  if ($cmd == "edit" || $cmd == "view") {
66  $this->setSubStyleSubTabs("edit");
67  } else {
68  $this->setSubStyleSubTabs("assignStyle");
69  }
70  }
71 
72  switch ($cmd) {
73  case "deleteAssignments":
74  $assign_gui = new ilSubStyleAssignmentGUI($this);
75  $assign_gui->deleteAssignments($skin, $style);
76  break;
77  case "saveAssignment":
78  $assign_gui = new ilSubStyleAssignmentGUI($this);
79  $assign_gui->saveAssignment($skin, $style);
80  break;
81  case "addAssignment":
82  $assign_gui = new ilSubStyleAssignmentGUI($this);
83  $assign_gui->addAssignment($skin, $style);
84  break;
85  case "assignStyle":
86  $assign_gui = new ilSubStyleAssignmentGUI($this);
87  $assign_gui->assignStyle($skin, $style);
88  break;
89  case "save":
90  case "edit":
91  $this->$cmd();
92  break;
93  default:
94  $this->edit();
95  break;
96  }
97  }
$_GET["client_id"]
ilSystemStyleConfig wraps all 'constants' to ensure the testability of all classes using those 'const...
+ Here is the call graph for this function:

◆ getPropertiesValues()

ilSystemStyleSettingsGUI::getPropertiesValues (   $form)

Get values for edit properties form.

Definition at line 120 of file class.ilSystemStyleSettingsGUI.php.

References $_GET, $DIC, ilSystemStyleSettings\_lookupActivatedStyle(), ilSystemStyleSettings\getCurrentDefaultSkin(), ilSystemStyleSettings\getCurrentDefaultStyle(), ilSystemStyleException\NO_SKIN_ID, and ilSystemStyleException\NO_STYLE_ID.

Referenced by edit().

121  {
122  global $DIC;
123 
124  if (!$_GET["skin_id"]) {
126  }
127  if (!$_GET["style_id"]) {
129  }
130  $system_style_config = new ilSystemStyleConfig();
131  $skin = ilSkinXML::parseFromXML($system_style_config->getCustomizingSkinPath() . $_GET["skin_id"] . "/template.xml");
132  $style = $skin->getStyle($_GET["style_id"]);
133  $values["skin_id"] = $skin->getId();
134  $values["skin_name"] = $skin->getName();
135  $values["style_id"] = $style->getId();
136  $values["style_name"] = $style->getName();
137  $values["image_dir"] = $style->getImageDirectory();
138  $values["font_dir"] = $style->getFontDirectory();
139  $values["sound_dir"] = $style->getSoundDirectory();
140 
141 
142  if ($style->isSubstyle()) {
143  $values["parent_style"] = $style->getSubstyleOf();
144  } else {
145  $values["active"] = ilSystemStyleSettings::_lookupActivatedStyle($skin->getId(), $style->getId());
146  $is_personal_style = $DIC->user()->getPref("skin") == $skin->getId() && $DIC->user()->getPref("style") == $style->getId();
147  $values["personal"] = $is_personal_style;
148  $is_default_style = ilSystemStyleSettings::getCurrentDefaultSkin() == $skin->getId() && ilSystemStyleSettings::getCurrentDefaultStyle() == $style->getId();
149  $values["default"] = $is_default_style;
150  }
151 
152  $form->setValuesByArray($values);
153  }
static getCurrentDefaultSkin()
Gets default Skin of the System.
$_GET["client_id"]
static _lookupActivatedStyle($a_skin, $a_style)
lookup if a style is activated
global $DIC
Definition: goto.php:24
Class for advanced editing exception handling in ILIAS.
ilSystemStyleConfig wraps all 'constants' to ensure the testability of all classes using those 'const...
static getCurrentDefaultStyle()
Gets default style of the system.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ save()

ilSystemStyleSettingsGUI::save ( )
protected

Definition at line 156 of file class.ilSystemStyleSettingsGUI.php.

References $_GET, Vendor\Package\$e, editSystemStyleForm(), saveStyle(), saveSubStyle(), ilUtil\sendFailure(), and ilSystemStyleMessage\TYPE_SUCCESS.

157  {
158  $form = $this->editSystemStyleForm();
159 
160  $message_stack = new ilSystemStyleMessageStack();
161  if ($form->checkInput()) {
162  try {
163  $system_style_conf = new ilSystemStyleConfig();
164  $skin = ilSkinXML::parseFromXML($system_style_conf->getCustomizingSkinPath() . $_GET["skin_id"] . "/template.xml");
165  $style = $skin->getStyle($_GET["style_id"]);
166 
167  if ($style->isSubstyle()) {
168  $this->saveSubStyle($message_stack);
169  } else {
170  $this->saveStyle($message_stack);
171  }
172 
173  $message_stack->prependMessage(new ilSystemStyleMessage($this->lng->txt("msg_sys_style_update"), ilSystemStyleMessage::TYPE_SUCCESS));
174  $message_stack->sendMessages(true);
175  $this->ctrl->redirectByClass("ilSystemStyleSettingsGUI");
176  } catch (ilSystemStyleException $e) {
177  ilUtil::sendFailure($e->getMessage(), true);
178  }
179  } else {
180  $message_stack->sendMessages();
181  }
182 
183  $form->setValuesByPost();
184  $this->tpl->setContent($form->getHTML());
185  }
$_GET["client_id"]
Class for advanced editing exception handling in ILIAS.
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
ilSystemStyleConfig wraps all 'constants' to ensure the testability of all classes using those 'const...
Used to stack messages to be shown to the user.
saveStyle(ilSystemStyleMessageStack $message_stack)
saveSubStyle(ilSystemStyleMessageStack $message_stack)
+ Here is the call graph for this function:

◆ saveStyle()

ilSystemStyleSettingsGUI::saveStyle ( ilSystemStyleMessageStack  $message_stack)
protected
Parameters
ilSystemStyleMessageStack$message_stack
Exceptions
ilSystemStyleException

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

References $_GET, $_POST, $container, $DIC, ilSystemStyleSettings\_activateStyle(), ilSystemStyleSettings\_deactivateStyle(), ilSystemStyleMessageStack\addMessage(), ilSystemStyleSkinContainer\generateFromId(), ilSystemStyleSettings\getCurrentDefaultSkin(), ilSystemStyleSettings\getCurrentDefaultStyle(), ilSystemStyleSettings\getCurrentUserPrefSkin(), ilSystemStyleSettings\getCurrentUserPrefStyle(), ilSystemStyleSettings\setCurrentDefaultStyle(), ilSystemStyleSettings\setCurrentUserPrefStyle(), ilSystemStyleMessage\TYPE_SUCCESS, and ilSystemStyleSettings\updateSkinIdAndStyleIDOfSubStyleCategoryAssignments().

Referenced by save().

193  {
194  global $DIC;
195 
196  $container = ilSystemStyleSkinContainer::generateFromId($_GET['skin_id'], $message_stack);
197  $old_skin = clone $container->getSkin();
198  $old_style = clone $old_skin->getStyle($_GET["style_id"]);
199 
200  $new_skin = $container->getSkin();
201  $new_skin->setId($_POST["skin_id"]);
202  $new_skin->setName($_POST["skin_name"]);
203  $new_skin->getVersionStep($_POST['skin_version']);
204 
205  $new_style_id = $_POST["style_id"];
206  $new_skin->updateParentStyleOfSubstyles($old_style->getId(), $new_style_id);
207 
208  $new_style = $new_skin->getStyle($_GET["style_id"]);
209  $new_style->setId($new_style_id);
210  $new_style->setName($_POST["style_name"]);
211  $new_style->setCssFile($_POST["style_id"]);
212  $new_style->setImageDirectory($_POST["image_dir"]);
213  $new_style->setSoundDirectory($_POST["sound_dir"]);
214  $new_style->setFontDirectory($_POST["font_dir"]);
215 
216  $container->updateSkin($old_skin);
217  $container->updateStyle($new_style->getId(), $old_style);
218 
220  $old_skin->getId(),
221  $old_style->getId(),
222  $new_skin->getId(),
223  $new_style->getId()
224  );
225 
226  if ($_POST["active"] == 1) {
227  ilSystemStyleSettings::_activateStyle($new_skin->getId(), $new_style->getId());
228  if ($_POST["personal"] == 1) {
229  ilSystemStyleSettings::setCurrentUserPrefStyle($new_skin->getId(), $new_style->getId());
230  }
231  if ($_POST["default"] == 1) {
232  ilSystemStyleSettings::setCurrentDefaultStyle($new_skin->getId(), $new_style->getId());
233  }
234  } else {
235  ilSystemStyleSettings::_deactivateStyle($new_skin->getId(), $new_style->getId());
236  $_POST["personal"] = 0;
237  $_POST["default"] = 0;
238  }
239 
240  $system_style_conf = new ilSystemStyleConfig();
241 
242  //If style has been unset as personal style
243  if (!$_POST["personal"] && $DIC->user()->getPref("skin") == $new_skin->getId()) {
244  //Reset to default if possible, else change to delos
245  if (!$_POST["default"]) {
249  );
250  } else {
252  $system_style_conf->getDefaultSkinId(),
253  $system_style_conf->getDefaultStyleId()
254  );
255  }
256  $message_stack->addMessage(
258  $this->lng->txt("personal_style_set_to") . " " . ilSystemStyleSettings::getCurrentUserPrefSkin() . ":" . ilSystemStyleSettings::getCurrentUserPrefStyle(),
260  )
261  );
262  }
263  if (!$_POST["default"] && ilSystemStyleSettings::getCurrentDefaultSkin() == $new_skin->getId()) {
265  $system_style_conf->getDefaultSkinId(),
266  $system_style_conf->getDefaultStyleId()
267  );
268  $message_stack->addMessage(
270  $this->lng->txt("default_style_set_to") . " " . $system_style_conf->getDefaultSkinId() . ": " . $system_style_conf->getDefaultStyleId(),
272  )
273  );
274  }
275  $this->ctrl->setParameterByClass('ilSystemStyleSettingsGUI', 'skin_id', $new_skin->getId());
276  $this->ctrl->setParameterByClass('ilSystemStyleSettingsGUI', 'style_id', $new_style->getId());
277  }
static _deactivateStyle($a_skin, $a_style)
deactivate system style
static getCurrentUserPrefSkin()
Gets a users preferred skin by using the user object.
static getCurrentDefaultSkin()
Gets default Skin of the System.
$_GET["client_id"]
static setCurrentDefaultStyle($skin_id, $style_id)
Sets the default style of the system.
static getCurrentUserPrefStyle()
Gets a users preferred style by using the user object.
addMessage(ilSystemStyleMessage $message)
Add a message to be displayed by the stack.
$container
Definition: wac.php:13
static updateSkinIdAndStyleIDOfSubStyleCategoryAssignments(string $old_skin_id, string $old_style_id, string $new_skin_id, string $new_style_id)
Updates an assignment, e.g.
global $DIC
Definition: goto.php:24
static setCurrentUserPrefStyle($skin_id, $style_id)
Sets a users preferred system skin/style by using the user object.
static generateFromId($skin_id, ilSystemStyleMessageStack $message_stack=null, ilSystemStyleConfig $system_styles_conf=null)
Generate the container class by parsing the corresponding XML.
ilSystemStyleConfig wraps all 'constants' to ensure the testability of all classes using those 'const...
static _activateStyle($a_skin, $a_style)
activate system style
static getCurrentDefaultStyle()
Gets default style of the system.
$_POST["username"]
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ saveSubStyle()

ilSystemStyleSettingsGUI::saveSubStyle ( ilSystemStyleMessageStack  $message_stack)
protected
Parameters
$message_stack
Exceptions
ilSystemStyleException

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

References $_GET, $_POST, $container, ilSystemStyleSkinContainer\generateFromId(), and ilSystemStyleSettings\updateSubStyleIdfSubStyleCategoryAssignments().

Referenced by save().

284  {
285  $container = ilSystemStyleSkinContainer::generateFromId($_GET['skin_id'], $message_stack);
286  $skin = $container->getSkin();
287  $old_substyle = clone $skin->getStyle($_GET["style_id"]);
288 
289  $new_substyle = $skin->getStyle($_GET["style_id"]);
290  $new_substyle->setId($_POST["style_id"]);
291  $new_substyle->setName($_POST["style_name"]);
292  $new_substyle->setCssFile($_POST["style_id"]);
293  $new_substyle->setImageDirectory($_POST["image_dir"]);
294  $new_substyle->setSoundDirectory($_POST["sound_dir"]);
295  $new_substyle->setFontDirectory($_POST["font_dir"]);
296  $new_substyle->setSubstyleOf($old_substyle->getSubstyleOf());
297 
298  $container->updateSkin($skin);
299  $container->updateStyle($new_substyle->getId(), $old_substyle);
300 
301  ilSystemStyleSettings::updateSubStyleIdfSubStyleCategoryAssignments($old_substyle->getId(), $new_substyle->getId());
302 
303  $this->ctrl->setParameterByClass('ilSystemStyleSettingsGUI', 'skin_id', $skin->getId());
304  $this->ctrl->setParameterByClass('ilSystemStyleSettingsGUI', 'style_id', $new_substyle->getId());
305  }
$_GET["client_id"]
$container
Definition: wac.php:13
static generateFromId($skin_id, ilSystemStyleMessageStack $message_stack=null, ilSystemStyleConfig $system_styles_conf=null)
Generate the container class by parsing the corresponding XML.
$_POST["username"]
static updateSubStyleIdfSubStyleCategoryAssignments(string $old_substyle_id, string $new_substyle_id)
Updates an assignment, e.g.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setSubStyleSubTabs()

ilSystemStyleSettingsGUI::setSubStyleSubTabs (   $active = "")
protected
Parameters
string$active

Definition at line 102 of file class.ilSystemStyleSettingsGUI.php.

Referenced by executeCommand().

103  {
104  $this->tabs->addSubTab('edit', $this->lng->txt('settings'), $this->ctrl->getLinkTargetByClass('ilsystemstylesettingsgui'));
105  $this->tabs->addSubTab('assignStyle', $this->lng->txt('assignment'), $this->ctrl->getLinkTargetByClass('ilsystemstylesettingsgui', "assignStyle"));
106 
107  $this->tabs->activateSubTab($active);
108  }
+ Here is the caller graph for this function:

Field Documentation

◆ $ctrl

ilSystemStyleSettingsGUI::$ctrl
protected

Definition at line 22 of file class.ilSystemStyleSettingsGUI.php.

◆ $lng

ilSystemStyleSettingsGUI::$lng
protected

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

◆ $tabs

ilSystemStyleSettingsGUI::$tabs
protected

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

◆ $tpl

ilSystemStyleSettingsGUI::$tpl
protected

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


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