ILIAS  trunk Revision v11.0_alpha-1744-gb0451eebef4
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
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 (string $a_skin, string $a_style)
 lookup if a style is activated More...
 
static _deactivateStyle (string $a_skin, string $a_style)
 deactivate system style More...
 
static _activateStyle (string $a_skin, string $a_style)
 activate system style More...
 
static getSystemStyleCategoryAssignments (string $a_skin_id, string $a_style_id)
 Get all system sub styles category assignments. More...
 
static getSubStyleCategoryAssignments (string $a_skin_id, string $a_style_id, string $a_sub_style_id)
 Get all system category assignments of exactly one substyle. More...
 
static writeSystemStyleCategoryAssignment (string $a_skin_id, string $a_style_id, string $a_substyle, string $a_ref_id)
 Sets a substyle category assignment. More...
 
static deleteSystemStyleCategoryAssignment (string $a_skin_id, string $a_style_id, string $a_substyle, string $a_ref_id)
 Deletes all sub style category assignment of a system style. More...
 
static deleteSubStyleCategoryAssignments (string $a_skin_id, string $a_style_id, string $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 (string $skin_id, string $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 (string $skin_id, string $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

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

Member Function Documentation

◆ _activateStyle()

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

activate system style

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

References $DIC, and $q.

Referenced by _deactivateStyle(), ilSystemStyleConfigGUI\handleStyleActivation(), and ilSystemStyleOverviewGUI\saveStyleSettings().

69  : void
70  {
71  global $DIC;
72 
73  $q = 'DELETE FROM settings_deactivated_s' .
74  ' WHERE skin = ' . $DIC->database()->quote($a_skin, 'text') .
75  ' AND style = ' . $DIC->database()->quote($a_style, 'text');
76 
77  $DIC->database()->manipulate($q);
78  }
global $DIC
Definition: shib_login.php:22
$q
Definition: shib_logout.php:21
+ Here is the caller graph for this function:

◆ _deactivateStyle()

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

deactivate system style

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

References $DIC, $q, and _activateStyle().

Referenced by ilSystemStyleConfigGUI\handleStyleActivation(), and ilSystemStyleOverviewGUI\saveStyleSettings().

53  : void
54  {
55  global $DIC;
56 
57  ilSystemStyleSettings::_activateStyle($a_skin, $a_style);
58  $q = 'INSERT into settings_deactivated_s' .
59  ' (skin, style) VALUES ' .
60  ' (' . $DIC->database()->quote($a_skin, 'text') . ',' .
61  ' ' . $DIC->database()->quote($a_style, 'text') . ')';
62 
63  $DIC->database()->manipulate($q);
64  }
static _activateStyle(string $a_skin, string $a_style)
activate system style
global $DIC
Definition: shib_login.php:22
$q
Definition: shib_logout.php:21
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _lookupActivatedStyle()

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

lookup if a style is activated

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

References $DIC, and $q.

Referenced by ilSystemStyleConfigGUI\editSystemStyleForm(), ilSystemStylesTableGUI\fillRow(), ilObjUserGUI\initForm(), and ilPersonalSettingsGUI\initGeneralSettingsForm().

32  : bool
33  {
34  global $DIC;
35 
36  $q = 'SELECT count(*) cnt FROM settings_deactivated_s' .
37  ' WHERE skin = ' . $DIC->database()->quote($a_skin, 'text') .
38  ' AND style = ' . $DIC->database()->quote($a_style, 'text') . ' ';
39 
40  $cnt_set = $DIC->database()->query($q);
41  $cnt_rec = $DIC->database()->fetchAssoc($cnt_set);
42 
43  if ($cnt_rec['cnt'] > 0) {
44  return false;
45  } else {
46  return true;
47  }
48  }
global $DIC
Definition: shib_login.php:22
$q
Definition: shib_logout.php:21
+ Here is the caller graph for this function:

◆ deleteSubStyleCategoryAssignments()

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

Delets a sub styles category assignment.

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

References $DIC.

185  : void
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  }
global $DIC
Definition: shib_login.php:22

◆ deleteSystemStyleCategoryAssignment()

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

Deletes all sub style category assignment of a system style.

This is used if a system style is deleted completely

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

References $DIC.

Referenced by ilSubStyleAssignmentGUI\deleteAssignments().

172  : void {
173  global $DIC;
174 
175  $DIC->database()->manipulate('DELETE FROM syst_style_cat WHERE ' .
176  ' skin_id = ' . $DIC->database()->quote($a_skin_id, 'text') .
177  ' AND style_id = ' . $DIC->database()->quote($a_style_id, 'text') .
178  ' AND substyle = ' . $DIC->database()->quote($a_substyle, 'text') .
179  ' AND category_ref_id = ' . $DIC->database()->quote($a_ref_id, 'integer'));
180  }
global $DIC
Definition: shib_login.php:22
+ Here is the caller graph for this function:

◆ getCurrentDefaultSkin()

static ilSystemStyleSettings::getCurrentDefaultSkin ( )
static

Gets default Skin of the System.

Returns
string

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

References $DIC, and ilStyleDefinition\skinExists().

Referenced by ilSystemStyleConfigGUI\editSystemStyleForm(), ilSystemStylesTableGUI\fillRow(), and ilSystemStyleConfigGUI\handleStyleActivation().

283  : string
284  {
285  global $DIC;
286 
287  $skin_id = $DIC->clientIni()->readVariable('layout', 'skin');
288 
289  if (!ilStyleDefinition::skinExists($skin_id)) {
290  self::resetDefaultToDelos();
291  $skin_id = $DIC->clientIni()->readVariable('layout', 'skin');
292  }
293  return $skin_id;
294  }
global $DIC
Definition: shib_login.php:22
static skinExists(string $skin_id, ?ilSystemStyleConfig $system_style_config=null)
Check whether a skin exists.
+ 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.

Exceptions
ilSystemStyleException

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

References $DIC, and ilStyleDefinition\styleExistsForSkinId().

Referenced by ilSystemStyleConfigGUI\editSystemStyleForm(), ilSystemStylesTableGUI\fillRow(), and ilSystemStyleConfigGUI\handleStyleActivation().

300  : string
301  {
302  global $DIC;
303  $skin_id = $DIC->clientIni()->readVariable('layout', 'skin');
304  $style_id = $DIC->clientIni()->readVariable('layout', 'style');
305 
306  if (!ilStyleDefinition::styleExistsForSkinId($skin_id, $style_id)) {
307  self::resetDefaultToDelos();
308  $style_id = $DIC->clientIni()->readVariable('layout', 'style');
309  }
310  return $style_id;
311  }
static styleExistsForSkinId(string $skin_id, string $style_id)
global $DIC
Definition: shib_login.php:22
+ 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.

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

References $DIC.

Referenced by ilSystemStyleConfigGUI\handleStyleActivation().

242  : string
243  {
244  global $DIC;
245 
246  return $DIC->user()->getPref('skin');
247  }
global $DIC
Definition: shib_login.php:22
+ Here is the caller graph for this function:

◆ getCurrentUserPrefStyle()

static ilSystemStyleSettings::getCurrentUserPrefStyle ( )
static

Gets a users preferred style by using the user object.

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

References $DIC.

Referenced by ilSystemStyleConfigGUI\handleStyleActivation().

252  : string
253  {
254  global $DIC;
255 
256  return $DIC->user()->getPref('style');
257  }
global $DIC
Definition: shib_login.php:22
+ Here is the caller graph for this function:

◆ getSubStyleCategoryAssignments()

static ilSystemStyleSettings::getSubStyleCategoryAssignments ( string  $a_skin_id,
string  $a_style_id,
string  $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.

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

References $DIC.

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

112  : array {
113  global $DIC;
114 
115  $assignmnts = [];
116 
117  $set = $DIC->database()->query(
118  'SELECT substyle, category_ref_id FROM syst_style_cat ' .
119  ' WHERE skin_id = ' . $DIC->database()->quote($a_skin_id, 'text') .
120  ' AND substyle = ' . $DIC->database()->quote($a_sub_style_id, 'text') .
121  ' AND style_id = ' . $DIC->database()->quote($a_style_id, 'text')
122  );
123  while (($rec = $DIC->database()->fetchAssoc($set))) {
124  $assignmnts[] = [
125  'substyle' => $rec['substyle'],
126  'ref_id' => $rec['category_ref_id']
127  ];
128  }
129  return $assignmnts;
130  }
global $DIC
Definition: shib_login.php:22
+ Here is the caller graph for this function:

◆ getSystemStyleCategoryAssignments()

static ilSystemStyleSettings::getSystemStyleCategoryAssignments ( string  $a_skin_id,
string  $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.

Returns
array ('substyle' => substyle_id, 'ref id' => cat_ref_id)

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

References $DIC.

Referenced by ilStyleDefinition\getCurrentStyle().

85  : array
86  {
87  global $DIC;
88 
89  $assignments = [];
90  $set = $DIC->database()->query(
91  'SELECT substyle, category_ref_id FROM syst_style_cat ' .
92  ' WHERE skin_id = ' . $DIC->database()->quote($a_skin_id, 'text') .
93  ' AND style_id = ' . $DIC->database()->quote($a_style_id, 'text')
94  );
95  while (($rec = $DIC->database()->fetchAssoc($set))) {
96  $assignments[] = [
97  'substyle' => $rec['substyle'],
98  'ref_id' => $rec['category_ref_id']
99  ];
100  }
101  return $assignments;
102  }
global $DIC
Definition: shib_login.php:22
+ Here is the caller graph for this function:

◆ resetDefaultToDelos()

static ilSystemStyleSettings::resetDefaultToDelos ( )
static

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

272  : void
273  {
274  $system_style_conf = new ilSystemStyleConfig();
275 
276  self::setCurrentDefaultStyle($system_style_conf->getDefaultSkinId(), $system_style_conf->getDefaultSkinId());
277  }
ilSystemStyleConfig wraps all 'constants' to ensure the testability of all classes using those 'const...

◆ setCurrentDefaultStyle()

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

Sets the default style of the system.

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

References $DIC.

Referenced by ilSystemStyleConfigGUI\handleStyleActivation(), and ilSystemStyleOverviewGUI\saveStyleSettings().

262  : void
263  {
264  global $DIC;
265 
266  $DIC->clientIni()->setVariable('layout', 'skin', $skin_id);
267  $DIC->clientIni()->setVariable('layout', 'style', $style_id);
268  $DIC->clientIni()->write();
269  self::_activateStyle($skin_id, $style_id);
270  }
global $DIC
Definition: shib_login.php:22
+ Here is the caller graph for this function:

◆ setCurrentUserPrefStyle()

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

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

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

References $DIC.

Referenced by ilSystemStyleConfigGUI\handleStyleActivation().

230  : void
231  {
232  global $DIC;
233 
234  $DIC->user()->setPref('skin', $skin_id);
235  $DIC->user()->setPref('style', $style_id);
236  $DIC->user()->update();
237  }
global $DIC
Definition: shib_login.php:22
+ 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.

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

References $DIC.

Referenced by ilSystemStyleConfigGUI\save().

203  : void {
204  global $DIC;
205 
206  $DIC->database()->manipulate('UPDATE syst_style_cat ' .
207  ' SET skin_id = ' . $DIC->database()->quote($new_skin_id, 'text')
208  . ', style_id = ' . $DIC->database()->quote($new_style_id, 'text') .
209  ' WHERE skin_id = ' . $DIC->database()->quote($old_skin_id, 'text') .
210  ' AND style_id = ' . $DIC->database()->quote($old_style_id, 'text'));
211  }
global $DIC
Definition: shib_login.php:22
+ 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.

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

References $DIC.

Referenced by ilSystemStyleConfigGUI\save().

219  : void {
220  global $DIC;
221 
222  $DIC->database()->manipulate('UPDATE syst_style_cat ' .
223  ' SET substyle = ' . $DIC->database()->quote($new_substyle_id, 'text') .
224  ' WHERE substyle = ' . $DIC->database()->quote($old_substyle_id, 'text'));
225  }
global $DIC
Definition: shib_login.php:22
+ Here is the caller graph for this function:

◆ writeSystemStyleCategoryAssignment()

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

Sets a substyle category assignment.

Exceptions
ilSystemStyleException

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

References $DIC, and ilSystemStyleException\SUBSTYLE_ASSIGNMENT_EXISTS.

Referenced by ilSubStyleAssignmentGUI\saveAssignment().

141  : void {
142  global $DIC;
143 
144  $assignments = self::getSubStyleCategoryAssignments($a_skin_id, $a_style_id, $a_substyle);
145 
146  foreach ($assignments as $assignment) {
147  if ($assignment['ref_id'] == $a_ref_id) {
148  throw new ilSystemStyleException(
150  $a_substyle . ': ' . $a_ref_id
151  );
152  }
153  }
154  $DIC->database()->manipulate('INSERT INTO syst_style_cat ' .
155  '(skin_id, style_id, substyle, category_ref_id) VALUES (' .
156  $DIC->database()->quote($a_skin_id, 'text') . ',' .
157  $DIC->database()->quote($a_style_id, 'text') . ',' .
158  $DIC->database()->quote($a_substyle, 'text') . ',' .
159  $DIC->database()->quote($a_ref_id, 'integer') .
160  ')');
161  }
global $DIC
Definition: shib_login.php:22
+ Here is the caller graph for this function:

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