ILIAS  release_7 Revision v7.30-3-g800a261c036
ilSystemStyleSettings Class Reference

This class acts as Model for all system styles settings related settings such as activated or default system styles etc, be it in database or inifile. More...

+ Collaboration diagram for ilSystemStyleSettings:

Static Public Member Functions

static _lookupActivatedStyle ($a_skin, $a_style)
 lookup if a style is activated More...
 
static _deactivateStyle ($a_skin, $a_style)
 deactivate system style More...
 
static _activateStyle ($a_skin, $a_style)
 activate system style More...
 
static getSystemStyleCategoryAssignments ($a_skin_id, $a_style_id)
 Get all system sub styles category assignments. More...
 
static getSubStyleCategoryAssignments ($a_skin_id, $a_style_id, $a_sub_style_id)
 Get all system category assignments of exactly one substyle. More...
 
static writeSystemStyleCategoryAssignment ( $a_skin_id, $a_style_id, $a_substyle, $a_ref_id)
 Sets a substyle category assignment. More...
 
static deleteSystemStyleCategoryAssignment ( $a_skin_id, $a_style_id, $a_substyle, $a_ref_id)
 Deletes all sub style category assignment of a system style. More...
 
static deleteSubStyleCategoryAssignments ($a_skin_id, $a_style_id, $a_substyle)
 Delets a sub styles category assignment. More...
 
static updateSkinIdAndStyleIDOfSubStyleCategoryAssignments (string $old_skin_id, string $old_style_id, string $new_skin_id, string $new_style_id)
 Updates an assignment, e.g. More...
 
static updateSubStyleIdfSubStyleCategoryAssignments (string $old_substyle_id, string $new_substyle_id)
 Updates an assignment, e.g. More...
 
static setCurrentUserPrefStyle ($skin_id, $style_id)
 Sets a users preferred system skin/style by using the user object. More...
 
static getCurrentUserPrefSkin ()
 Gets a users preferred skin by using the user object. More...
 
static getCurrentUserPrefStyle ()
 Gets a users preferred style by using the user object. More...
 
static setCurrentDefaultStyle ($skin_id, $style_id)
 Sets the default style of the system. More...
 
static resetDefaultToDelos ()
 
static getCurrentDefaultSkin ()
 Gets default Skin of the System. More...
 
static getCurrentDefaultStyle ()
 Gets default style of the system. More...
 

Detailed Description

This class acts as Model for all system styles settings related settings such as activated or default system styles etc, be it in database or inifile.

Do not use this class to get the current system style, use ilStyleDefinition insteaed.

Semantics of terms style, sub style, skin, template --> see ilStyleDefinition

Author
Alex Killing alex..nosp@m.kill.nosp@m.ing@g.nosp@m.mx.d.nosp@m.e
Timon Amstutz timon.nosp@m..ams.nosp@m.tutz@.nosp@m.ilub.nosp@m..unib.nosp@m.e.ch
Version
$Id$

Definition at line 19 of file class.ilSystemStyleSettings.php.

Member Function Documentation

◆ _activateStyle()

static ilSystemStyleSettings::_activateStyle (   $a_skin,
  $a_style 
)
static

activate system style

Parameters
$a_skin
$a_style

Definition at line 71 of file class.ilSystemStyleSettings.php.

72 {
73 global $DIC;
74
75 $q = "DELETE FROM settings_deactivated_s" .
76 " WHERE skin = " . $DIC->database()->quote($a_skin, "text") .
77 " AND style = " . $DIC->database()->quote($a_style, "text");
78
79 $DIC->database()->manipulate($q);
80 }
global $DIC
Definition: goto.php:24

References $DIC.

Referenced by _deactivateStyle(), ilSystemStyleSettingsGUI\saveStyle(), ilSystemStyleOverviewGUI\saveStyleSettings(), and setCurrentDefaultStyle().

+ Here is the caller graph for this function:

◆ _deactivateStyle()

static ilSystemStyleSettings::_deactivateStyle (   $a_skin,
  $a_style 
)
static

deactivate system style

Parameters
$a_skin
$a_style

Definition at line 52 of file class.ilSystemStyleSettings.php.

53 {
54 global $DIC;
55
57 $q = "INSERT into settings_deactivated_s" .
58 " (skin, style) VALUES " .
59 " (" . $DIC->database()->quote($a_skin, "text") . "," .
60 " " . $DIC->database()->quote($a_style, "text") . ")";
61
62 $DIC->database()->manipulate($q);
63 }
static _activateStyle($a_skin, $a_style)
activate system style

References $DIC, and _activateStyle().

Referenced by ilSystemStyleSettingsGUI\saveStyle(), and ilSystemStyleOverviewGUI\saveStyleSettings().

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

◆ _lookupActivatedStyle()

static ilSystemStyleSettings::_lookupActivatedStyle (   $a_skin,
  $a_style 
)
static

lookup if a style is activated

Parameters
$a_skin
$a_style
Returns
bool

Definition at line 28 of file class.ilSystemStyleSettings.php.

29 {
30 global $DIC;
31
32 $q = "SELECT count(*) cnt FROM settings_deactivated_s" .
33 " WHERE skin = " . $DIC->database()->quote($a_skin, "text") .
34 " AND style = " . $DIC->database()->quote($a_style, "text") . " ";
35
36 $cnt_set = $DIC->database()->query($q);
37 $cnt_rec = $DIC->database()->fetchAssoc($cnt_set);
38
39 if ($cnt_rec["cnt"] > 0) {
40 return false;
41 } else {
42 return true;
43 }
44 }

References $DIC.

Referenced by ilSoapInstallationInfoXMLWriter\__buildClient(), ilUserImportParser\__construct(), ilSystemStyleOverviewGUI\checkDeletable(), ilSystemStylesTableGUI\fillRow(), ilSystemStyleSettingsGUI\getPropertiesValues(), and ilPersonalSettingsGUI\initGeneralSettingsForm().

+ Here is the caller graph for this function:

◆ deleteSubStyleCategoryAssignments()

static ilSystemStyleSettings::deleteSubStyleCategoryAssignments (   $a_skin_id,
  $a_style_id,
  $a_substyle 
)
static

Delets a sub styles category assignment.

Parameters
$a_skin_id
$a_style_id
$a_substyle

Definition at line 203 of file class.ilSystemStyleSettings.php.

204 {
205 global $DIC;
206
207 $DIC->database()->manipulate("DELETE FROM syst_style_cat WHERE " .
208 " skin_id = " . $DIC->database()->quote($a_skin_id, "text") .
209 " AND style_id = " . $DIC->database()->quote($a_style_id, "text") .
210 " AND substyle = " . $DIC->database()->quote($a_substyle, "text"));
211 }

References $DIC.

Referenced by ilSystemStyleSkinContainer\deleteStyle().

+ Here is the caller graph for this function:

◆ deleteSystemStyleCategoryAssignment()

static ilSystemStyleSettings::deleteSystemStyleCategoryAssignment (   $a_skin_id,
  $a_style_id,
  $a_substyle,
  $a_ref_id 
)
static

Deletes all sub style category assignment of a system style.

This is used if a system style is deleted completely

Parameters
$a_skin_id
$a_style_id
$a_substyle
$a_ref_id

Definition at line 181 of file class.ilSystemStyleSettings.php.

186 {
187 global $DIC;
188
189 $DIC->database()->manipulate("DELETE FROM syst_style_cat WHERE " .
190 " skin_id = " . $DIC->database()->quote($a_skin_id, "text") .
191 " AND style_id = " . $DIC->database()->quote($a_style_id, "text") .
192 " AND substyle = " . $DIC->database()->quote($a_substyle, "text") .
193 " AND category_ref_id = " . $DIC->database()->quote($a_ref_id, "integer"));
194 }

References $DIC.

Referenced by ilSubStyleAssignmentGUI\deleteAssignments().

+ Here is the caller graph for this function:

◆ getCurrentDefaultSkin()

static ilSystemStyleSettings::getCurrentDefaultSkin ( )
static

Gets default Skin of the System.

Returns
string

Definition at line 319 of file class.ilSystemStyleSettings.php.

320 {
321 global $DIC;
322
323 $skin_id = $DIC->clientIni()->readVariable("layout", "skin");
324
325 if (!ilStyleDefinition::skinExists($skin_id)) {
327 $skin_id = $DIC->clientIni()->readVariable("layout", "skin");
328 }
329 return $skin_id;
330 }
static skinExists($skin_id, ilSystemStyleConfig $system_style_config=null)
Check whether a skin exists.

References $DIC, resetDefaultToDelos(), and ilStyleDefinition\skinExists().

Referenced by ilSystemStyleOverviewGUI\checkDeletable(), ilSystemStylesTableGUI\fillRow(), ilSystemStyleSettingsGUI\getPropertiesValues(), and ilSystemStyleSettingsGUI\saveStyle().

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

◆ getCurrentDefaultStyle()

static ilSystemStyleSettings::getCurrentDefaultStyle ( )
static

Gets default style of the system.

Returns
mixed
Exceptions
ilSystemStyleException

Definition at line 338 of file class.ilSystemStyleSettings.php.

339 {
340 global $DIC;
341 $skin_id = $DIC->clientIni()->readVariable("layout", "skin");
342 $style_id = $DIC->clientIni()->readVariable("layout", "style");
343
344 if (!ilStyleDefinition::styleExistsForSkinId($skin_id, $style_id)) {
346 $style_id = $DIC->clientIni()->readVariable("layout", "style");
347 }
348 return $style_id;
349 }
static styleExistsForSkinId($skin_id, $style_id)

References $DIC, resetDefaultToDelos(), and ilStyleDefinition\styleExistsForSkinId().

Referenced by ilSystemStylesTableGUI\fillRow(), ilSystemStyleSettingsGUI\getPropertiesValues(), and ilSystemStyleSettingsGUI\saveStyle().

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

◆ getCurrentUserPrefSkin()

static ilSystemStyleSettings::getCurrentUserPrefSkin ( )
static

Gets a users preferred skin by using the user object.

Returns
bool

Definition at line 272 of file class.ilSystemStyleSettings.php.

273 {
274 global $DIC;
275
276 return $DIC->user()->getPref("skin");
277 }

References $DIC.

Referenced by ilSystemStyleSettingsGUI\saveStyle().

+ Here is the caller graph for this function:

◆ getCurrentUserPrefStyle()

static ilSystemStyleSettings::getCurrentUserPrefStyle ( )
static

Gets a users preferred style by using the user object.

Returns
bool

Definition at line 284 of file class.ilSystemStyleSettings.php.

285 {
286 global $DIC;
287
288 return $DIC->user()->getPref("style");
289 }

References $DIC.

Referenced by ilSystemStyleSettingsGUI\saveStyle().

+ Here is the caller graph for this function:

◆ getSubStyleCategoryAssignments()

static ilSystemStyleSettings::getSubStyleCategoryAssignments (   $a_skin_id,
  $a_style_id,
  $a_sub_style_id 
)
static

Get all system category assignments of exactly one substyle.

This is used to check wheter a system sub style is to be used in a particular category.

Parameters
$a_skin_id
$a_style_id
$a_sub_style_id
Returns
array

Definition at line 118 of file class.ilSystemStyleSettings.php.

119 {
120 global $DIC;
121
122 $assignmnts = [];
123
124 $set = $DIC->database()->query(
125 "SELECT substyle, category_ref_id FROM syst_style_cat " .
126 " WHERE skin_id = " . $DIC->database()->quote($a_skin_id, "text") .
127 " AND substyle = " . $DIC->database()->quote($a_sub_style_id, "text") .
128 " AND style_id = " . $DIC->database()->quote($a_style_id, "text")
129 );
130 while (($rec = $DIC->database()->fetchAssoc($set))) {
131 $assignmnts[] = [
132 "substyle" => $rec["substyle"],
133 "ref_id" => $rec["category_ref_id"]
134 ];
135 }
136 return $assignmnts;
137 }

References $DIC.

Referenced by ilSystemStylesTableGUI\fillRow(), ilSysStyleCatAssignmentTableGUI\getStyleCatAssignments(), and writeSystemStyleCategoryAssignment().

+ Here is the caller graph for this function:

◆ getSystemStyleCategoryAssignments()

static ilSystemStyleSettings::getSystemStyleCategoryAssignments (   $a_skin_id,
  $a_style_id 
)
static

Get all system sub styles category assignments.

This is used to check wheter a system sub style is to be used in a particular category.

Parameters
string$a_skin_idskin id
string$a_style_idstyle id
Returns
array ('substyle' => substyle_id, 'ref id' => cat_ref_id)

Definition at line 90 of file class.ilSystemStyleSettings.php.

91 {
92 global $DIC;
93
94 $assignments = [];
95 $set = $DIC->database()->query(
96 "SELECT substyle, category_ref_id FROM syst_style_cat " .
97 " WHERE skin_id = " . $DIC->database()->quote($a_skin_id, "text") .
98 " AND style_id = " . $DIC->database()->quote($a_style_id, "text")
99 );
100 while (($rec = $DIC->database()->fetchAssoc($set))) {
101 $assignments[] = [
102 "substyle" => $rec["substyle"],
103 "ref_id" => $rec["category_ref_id"]
104 ];
105 }
106 return $assignments;
107 }

References $DIC.

Referenced by ilStyleDefinition\getCurrentStyle().

+ Here is the caller graph for this function:

◆ resetDefaultToDelos()

static ilSystemStyleSettings::resetDefaultToDelos ( )
static

Definition at line 307 of file class.ilSystemStyleSettings.php.

308 {
309 $system_style_conf = new ilSystemStyleConfig();
310
311 self::setCurrentDefaultStyle($system_style_conf->getDefaultSkinId(), $system_style_conf->getDefaultSkinId());
312 }
ilSystemStyleConfig wraps all 'constants' to ensure the testability of all classes using those 'const...
static setCurrentDefaultStyle($skin_id, $style_id)
Sets the default style of the system.

References setCurrentDefaultStyle().

Referenced by getCurrentDefaultSkin(), and getCurrentDefaultStyle().

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

◆ setCurrentDefaultStyle()

static ilSystemStyleSettings::setCurrentDefaultStyle (   $skin_id,
  $style_id 
)
static

Sets the default style of the system.

Parameters
$skin_id
$style_id

Definition at line 297 of file class.ilSystemStyleSettings.php.

298 {
299 global $DIC;
300
301 $DIC->clientIni()->setVariable("layout", "skin", $skin_id);
302 $DIC->clientIni()->setVariable("layout", "style", $style_id);
303 $DIC->clientIni()->write();
304 self::_activateStyle($skin_id, $style_id);
305 }

References $DIC, and _activateStyle().

Referenced by resetDefaultToDelos(), ilSystemStyleSettingsGUI\saveStyle(), and ilSystemStyleOverviewGUI\saveStyleSettings().

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

◆ setCurrentUserPrefStyle()

static ilSystemStyleSettings::setCurrentUserPrefStyle (   $skin_id,
  $style_id 
)
static

Sets a users preferred system skin/style by using the user object.

Parameters
$skin_id
$style_id

Definition at line 258 of file class.ilSystemStyleSettings.php.

259 {
260 global $DIC;
261
262 $DIC->user()->setPref("skin", $skin_id);
263 $DIC->user()->setPref("style", $style_id);
264 $DIC->user()->update();
265 }

References $DIC.

Referenced by ilSystemStyleSettingsGUI\saveStyle().

+ Here is the caller graph for this function:

◆ updateSkinIdAndStyleIDOfSubStyleCategoryAssignments()

static ilSystemStyleSettings::updateSkinIdAndStyleIDOfSubStyleCategoryAssignments ( string  $old_skin_id,
string  $old_style_id,
string  $new_skin_id,
string  $new_style_id 
)
static

Updates an assignment, e.g.

in case of ID Change through GUI.

Parameters
string$old_skin_id
string$old_style_id
string$new_skin_id
string$new_style_id

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

226 {
227 global $DIC;
228
229 $DIC->database()->manipulate("UPDATE syst_style_cat " .
230 " SET skin_id = " . $DIC->database()->quote($new_skin_id, "text")
231 . ", style_id = " . $DIC->database()->quote($new_style_id, "text") .
232 " WHERE skin_id = " . $DIC->database()->quote($old_skin_id, "text") .
233 " AND style_id = " . $DIC->database()->quote($old_style_id, "text"));
234 }

References $DIC.

Referenced by ilSystemStyleSettingsGUI\saveStyle().

+ Here is the caller graph for this function:

◆ updateSubStyleIdfSubStyleCategoryAssignments()

static ilSystemStyleSettings::updateSubStyleIdfSubStyleCategoryAssignments ( string  $old_substyle_id,
string  $new_substyle_id 
)
static

Updates an assignment, e.g.

in case of ID Change through GUI.

Parameters
string$old_substyle_id
string$new_substyle_id

Definition at line 241 of file class.ilSystemStyleSettings.php.

244 {
245 global $DIC;
246
247 $DIC->database()->manipulate("UPDATE syst_style_cat " .
248 " SET substyle = " . $DIC->database()->quote($new_substyle_id, "text") .
249 " WHERE substyle = " . $DIC->database()->quote($old_substyle_id, "text"));
250 }

References $DIC.

Referenced by ilSystemStyleSettingsGUI\saveSubStyle().

+ Here is the caller graph for this function:

◆ writeSystemStyleCategoryAssignment()

static ilSystemStyleSettings::writeSystemStyleCategoryAssignment (   $a_skin_id,
  $a_style_id,
  $a_substyle,
  $a_ref_id 
)
static

Sets a substyle category assignment.

Parameters
$a_skin_id
$a_style_id
$a_substyle
$a_ref_id
Exceptions
ilSystemStyleException

Definition at line 148 of file class.ilSystemStyleSettings.php.

153 {
154 global $DIC;
155
156 $assignments = self::getSubStyleCategoryAssignments($a_skin_id, $a_style_id, $a_substyle);
157
158 foreach ($assignments as $assignment) {
159 if ($assignment["ref_id"] == $a_ref_id) {
160 throw new ilSystemStyleException(ilSystemStyleException::SUBSTYLE_ASSIGNMENT_EXISTS, $a_substyle . ": " . $a_ref_id);
161 }
162 }
163 $DIC->database()->manipulate("INSERT INTO syst_style_cat " .
164 "(skin_id, style_id, substyle, category_ref_id) VALUES (" .
165 $DIC->database()->quote($a_skin_id, "text") . "," .
166 $DIC->database()->quote($a_style_id, "text") . "," .
167 $DIC->database()->quote($a_substyle, "text") . "," .
168 $DIC->database()->quote($a_ref_id, "integer") .
169 ")");
170 }
Class for advanced editing exception handling in ILIAS.
static getSubStyleCategoryAssignments($a_skin_id, $a_style_id, $a_sub_style_id)
Get all system category assignments of exactly one substyle.

References $DIC, getSubStyleCategoryAssignments(), and ilSystemStyleException\SUBSTYLE_ASSIGNMENT_EXISTS.

Referenced by ilSubStyleAssignmentGUI\saveAssignment().

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

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