ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
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.

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

References $DIC.

Member Function Documentation

◆ edit()

ilSystemStyleSettingsGUI::edit ( )
protected

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

112 {
113 $form = $this->editSystemStyleForm();
114 $this->getPropertiesValues($form);
115 $this->tpl->setContent($form->getHTML());
116
117 }
getPropertiesValues($form)
Get values for edit properties form.

References editSystemStyleForm(), and getPropertiesValues().

Referenced by executeCommand().

+ 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 294 of file class.ilSystemStyleSettingsGUI.php.

294 {
295 $form = new ilPropertyFormGUI();
296 $system_style_conf = new ilSystemStyleConfig();
297
298 $skin = ilSkinXML::parseFromXML($system_style_conf->getCustomizingSkinPath().$_GET["skin_id"]."/template.xml");
299 $style = $skin->getStyle($_GET["style_id"]);
300
301 $form->setFormAction($this->ctrl->getFormActionByClass("ilsystemstylesettingsgui"));
302
303
304 if(!$style->isSubstyle()){
305 $form->setTitle($this->lng->txt("skin"));
306
307 $ti = new ilTextInputGUI($this->lng->txt("skin_id"), "skin_id");
308 $ti->setMaxLength(128);
309 $ti->setSize(40);
310 $ti->setRequired(true);
311 $ti->setInfo($this->lng->txt("skin_id_description"));
312 $form->addItem($ti);
313
314 $ti = new ilTextInputGUI($this->lng->txt("skin_name"), "skin_name");
315 $ti->setInfo($this->lng->txt("skin_name_description"));
316 $ti->setMaxLength(128);
317 $ti->setSize(40);
318 $ti->setRequired(true);
319 $form->addItem($ti);
320
321 if($skin->isVersionChangeable()) {
322 $ti = new ilNonEditableValueGUI($this->lng->txt("skin_version"), "skin_version");
323 $ti->setInfo($this->lng->txt("skin_version_description"));
324 $ti->setValue($skin->getVersion());
325 $form->addItem($ti);
326 }
327
329 $section->setTitle($this->lng->txt("style"));
330 $form->addItem($section);
331 }else{
332 $form->setTitle($this->lng->txt("sub_style"));
333 }
334
335 $ti = new ilTextInputGUI($this->lng->txt("style_id"), "style_id");
336 $ti->setMaxLength(128);
337 $ti->setSize(40);
338 $ti->setRequired(true);
339 $ti->setInfo($this->lng->txt("style_id_description"));
340 $form->addItem($ti);
341
342 $ti = new ilTextInputGUI($this->lng->txt("style_name"), "style_name");
343 $ti->setMaxLength(128);
344 $ti->setSize(40);
345 $ti->setRequired(true);
346 $ti->setInfo($this->lng->txt("style_name_description"));
347 $form->addItem($ti);
348
349 $ti = new ilTextInputGUI($this->lng->txt("image_dir"), "image_dir");
350 $ti->setMaxLength(128);
351 $ti->setSize(40);
352 $ti->setInfo($this->lng->txt("image_dir_description"));
353 $form->addItem($ti);
354
355 $ti = new ilTextInputGUI($this->lng->txt("font_dir"), "font_dir");
356 $ti->setMaxLength(128);
357 $ti->setSize(40);
358 $ti->setInfo($this->lng->txt("font_dir_description"));
359 $form->addItem($ti);
360
361 $ti = new ilTextInputGUI($this->lng->txt("sound_dir"), "sound_dir");
362 $ti->setMaxLength(128);
363 $ti->setSize(40);
364 $ti->setInfo($this->lng->txt("sound_dir_description"));
365 $form->addItem($ti);
366
367 if(!$style->isSubstyle()){
369 $section->setTitle($this->lng->txt("system_style_activation"));
370 $form->addItem($section);
371
372 $active = new ilCheckboxInputGUI($this->lng->txt("system_style_activation"), "active");
373 $active->setInfo($this->lng->txt("system_style_activation_description"));
374
375 $set_default = new ilCheckboxInputGUI($this->lng->txt("default"), "default");
376 $set_default->setInfo($this->lng->txt("system_style_default_description"));
377 $active->addSubItem($set_default);
378
379 $set_personal = new ilCheckboxInputGUI($this->lng->txt("personal"), "personal");
380 $set_personal->setInfo($this->lng->txt("system_style_personal_description"));
381 $active->addSubItem($set_personal);
382
383
384 $form->addItem($active);
385 }
386
387 $form->addCommandButton("save", $this->lng->txt("save"));
388 $form->addCommandButton("cancel", $this->lng->txt("cancel"));
389
390 return $form;
391 }
$section
Definition: Utf8Test.php:83
$_GET["client_id"]
This class represents a checkbox property in a property form.
This class represents a section header in a property form.
This class represents a non editable value in a property form.
This class represents a property form user interface.
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

References $_GET, $section, and $style.

Referenced by edit(), and save().

+ Here is the caller graph for this function:

◆ executeCommand()

ilSystemStyleSettingsGUI::executeCommand ( )

Execute command.

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

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
73 switch ($cmd)
74 {
75 case "deleteAssignments":
76 $assign_gui = new ilSubStyleAssignmentGUI($this);
77 $assign_gui->deleteAssignments($skin,$style);
78 break;
79 case "saveAssignment":
80 $assign_gui = new ilSubStyleAssignmentGUI($this);
81 $assign_gui->saveAssignment($skin,$style);
82 break;
83 case "addAssignment":
84 $assign_gui = new ilSubStyleAssignmentGUI($this);
85 $assign_gui->addAssignment($skin,$style);
86 break;
87 case "assignStyle":
88 $assign_gui = new ilSubStyleAssignmentGUI($this);
89 $assign_gui->assignStyle($skin,$style);
90 break;
91 case "save":
92 case "edit":
93 $this->$cmd();
94 break;
95 default:
96 $this->edit();
97 break;
98 }
99 }
$cmd
Definition: sahs_server.php:35

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

+ Here is the call graph for this function:

◆ getPropertiesValues()

ilSystemStyleSettingsGUI::getPropertiesValues (   $form)

Get values for edit properties form.

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

123 {
124 global $DIC;
125
126 if(!$_GET["skin_id"]){
128 }
129 if(!$_GET["style_id"]){
131 }
132 $system_style_config = new ilSystemStyleConfig();
133 $skin = ilSkinXML::parseFromXML($system_style_config->getCustomizingSkinPath().$_GET["skin_id"]."/template.xml");
134 $style = $skin->getStyle($_GET["style_id"]);
135 $values["skin_id"] = $skin->getId();
136 $values["skin_name"] = $skin->getName();
137 $values["style_id"] = $style->getId();
138 $values["style_name"] = $style->getName();
139 $values["image_dir"] = $style->getImageDirectory();
140 $values["font_dir"] = $style->getFontDirectory();
141 $values["sound_dir"] = $style->getSoundDirectory();
142
143
144 if($style->isSubstyle()){
145 $values["parent_style"] = $style->getSubstyleOf();
146 }else{
147 $values["active"] = ilSystemStyleSettings::_lookupActivatedStyle($skin->getId(),$style->getId());
148 $is_personal_style = $DIC->user()->getPref("skin")==$skin->getId() && $DIC->user()->getPref("style") == $style->getId();
149 $values["personal"] = $is_personal_style;
151 $values["default"] = $is_default_style;
152 }
153
154 $form->setValuesByArray($values);
155 }
Class for advanced editing exception handling in ILIAS.
static getCurrentDefaultStyle()
Gets default style of the system.
static _lookupActivatedStyle($a_skin, $a_style)
lookup if a style is activated
static getCurrentDefaultSkin()
Gets default Skin of the System.

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

Referenced by edit().

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

◆ save()

ilSystemStyleSettingsGUI::save ( )
protected

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

158 {
159 $form = $this->editSystemStyleForm();
160
161 $message_stack = new ilSystemStyleMessageStack();
162 if ($form->checkInput())
163 {
164
165 try{
166 $system_style_conf = new ilSystemStyleConfig();
167 $skin = ilSkinXML::parseFromXML($system_style_conf->getCustomizingSkinPath().$_GET["skin_id"]."/template.xml");
168 $style = $skin->getStyle($_GET["style_id"]);
169
170 if($style->isSubstyle()){
171 $this->saveSubStyle($message_stack);
172 }else{
173 $this->saveStyle($message_stack);
174 }
175
176 $message_stack->prependMessage(new ilSystemStyleMessage($this->lng->txt("msg_sys_style_update"),ilSystemStyleMessage::TYPE_SUCCESS));
177 $message_stack->sendMessages(true);
178 $this->ctrl->redirectByClass("ilSystemStyleSettingsGUI");
179 }catch(ilSystemStyleException $e){
180 ilUtil::sendFailure($e->getMessage(), true);
181 }
182 }else
183
184 $message_stack->sendMessages();
185
186 $form->setValuesByPost();
187 $this->tpl->setContent($form->getHTML());
188 }
Used to stack messages to be shown to the user.
saveSubStyle(ilSystemStyleMessageStack $message_stack)
saveStyle(ilSystemStyleMessageStack $message_stack)
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.

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

+ Here is the call graph for this function:

◆ saveStyle()

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

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

195 {
196 global $DIC;
197
198 $container = ilSystemStyleSkinContainer::generateFromId($_GET['skin_id'],$message_stack);
199 $old_skin = clone $container->getSkin();
200 $old_style = clone $old_skin->getStyle($_GET["style_id"]);
201
202 $new_skin = $container->getSkin();
203 $new_skin->setId($_POST["skin_id"]);
204 $new_skin->setName($_POST["skin_name"]);
205 $new_skin->getVersionStep($_POST['skin_version']);
206
207 $new_style = $new_skin->getStyle($_GET["style_id"]);
208 $new_style->setId($_POST["style_id"]);
209 $new_style->setName($_POST["style_name"]);
210 $new_style->setCssFile($_POST["style_id"]);
211 $new_style->setImageDirectory($_POST["image_dir"]);
212 $new_style->setSoundDirectory($_POST["sound_dir"]);
213 $new_style->setFontDirectory($_POST["font_dir"]);
214
215 $container->updateSkin($old_skin);
216 $container->updateStyle($new_style->getId(),$old_style);
217
218
219 if($_POST["active"] == 1){
220 ilSystemStyleSettings::_activateStyle($new_skin->getId(),$new_style->getId());
221 if($_POST["personal"]==1){
222 ilSystemStyleSettings::setCurrentUserPrefStyle($new_skin->getId(),$new_style->getId());
223 }
224 if($_POST["default"]==1){
225 ilSystemStyleSettings::setCurrentDefaultStyle($new_skin->getId(),$new_style->getId());
226 }
227 }else{
228 ilSystemStyleSettings::_deactivateStyle($new_skin->getId(),$new_style->getId());
229 $_POST["personal"] = 0;
230 $_POST["default"] = 0;
231 }
232
233 $system_style_conf = new ilSystemStyleConfig();
234
235 //If style has been unset as personal style
236 if(!$_POST["personal"] && $DIC->user()->getPref("skin") == $new_skin->getId()){
237 //Reset to default if possible, else change to delos
238 if(!$_POST["default"] ){
241 );
242 }else{
244 $system_style_conf->getDefaultSkinId(),$system_style_conf->getDefaultStyleId()
245 );
246 }
247 $message_stack->addMessage(new ilSystemStyleMessage(
250 );
251 }
252 if(!$_POST["default"] && ilSystemStyleSettings::getCurrentDefaultSkin() == $new_skin->getId()){
254 $system_style_conf->getDefaultSkinId(),$system_style_conf->getDefaultStyleId()
255 );
256 $message_stack->addMessage(new ilSystemStyleMessage(
257 $this->lng->txt("default_style_set_to")." ".$system_style_conf->getDefaultSkinId().": ".$system_style_conf->getDefaultStyleId(),
259 );
260 }
261 $this->ctrl->setParameterByClass('ilSystemStyleSettingsGUI','skin_id',$new_skin->getId());
262 $this->ctrl->setParameterByClass('ilSystemStyleSettingsGUI','style_id',$new_style->getId());
263 }
$_POST["username"]
addMessage(ilSystemStyleMessage $message)
Add a message to be displayed by the stack.
static getCurrentUserPrefSkin()
Gets a users preferred skin by using the user object.
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
static setCurrentUserPrefStyle($skin_id, $style_id)
Sets a users preferred system skin/style by using the user object.
static getCurrentUserPrefStyle()
Gets a users preferred 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.

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

Referenced by save().

+ 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 269 of file class.ilSystemStyleSettingsGUI.php.

269 {
270 $container = ilSystemStyleSkinContainer::generateFromId($_GET['skin_id'],$message_stack);
271 $skin = $container->getSkin();
272 $old_substyle = clone $skin->getStyle($_GET["style_id"]);
273
274 $new_substyle = $skin->getStyle($_GET["style_id"]);
275 $new_substyle->setId($_POST["style_id"]);
276 $new_substyle->setName($_POST["style_name"]);
277 $new_substyle->setCssFile($_POST["style_id"]);
278 $new_substyle->setImageDirectory($_POST["image_dir"]);
279 $new_substyle->setSoundDirectory($_POST["sound_dir"]);
280 $new_substyle->setFontDirectory($_POST["font_dir"]);
281 $new_substyle->setSubstyleOf($old_substyle->getSubstyleOf());
282
283 $container->updateSkin($skin);
284 $container->updateStyle($new_substyle->getId(),$old_substyle);
285
286 $this->ctrl->setParameterByClass('ilSystemStyleSettingsGUI','skin_id',$skin->getId());
287 $this->ctrl->setParameterByClass('ilSystemStyleSettingsGUI','style_id',$new_substyle->getId());
288 }

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

Referenced by save().

+ 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 104 of file class.ilSystemStyleSettingsGUI.php.

104 {
105
106 $this->tabs->addSubTab('edit', $this->lng->txt('settings'), $this->ctrl->getLinkTargetByClass('ilsystemstylesettingsgui'));
107 $this->tabs->addSubTab('assignStyle', $this->lng->txt('assignment'), $this->ctrl->getLinkTargetByClass('ilsystemstylesettingsgui',"assignStyle"));
108
109 $this->tabs->activateSubTab($active);
110 }

Referenced by executeCommand().

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