19 declare(strict_types=1);
    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') . 
' ';
    40         $cnt_set = $DIC->database()->query(
$q);
    41         $cnt_rec = $DIC->database()->fetchAssoc($cnt_set);
    43         if ($cnt_rec[
'cnt'] > 0) {
    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') . 
')';
    63         $DIC->database()->manipulate(
$q);
    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');
    77         $DIC->database()->manipulate(
$q);
    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')
    95         while (($rec = $DIC->database()->fetchAssoc($set))) {
    97                 'substyle' => $rec[
'substyle'],
    98                 'ref_id' => $rec[
'category_ref_id']
   111         string $a_sub_style_id
   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')
   123         while (($rec = $DIC->database()->fetchAssoc($set))) {
   125                 'substyle' => $rec[
'substyle'],
   126                 'ref_id' => $rec[
'category_ref_id']
   144         $assignments = self::getSubStyleCategoryAssignments($a_skin_id, $a_style_id, $a_substyle);
   146         foreach ($assignments as $assignment) {
   147             if ($assignment[
'ref_id'] == $a_ref_id) {
   150                     $a_substyle . 
': ' . $a_ref_id
   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') .
   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'));
   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'));
   200         string $old_style_id,
   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'));
   217         string $old_substyle_id,
   218         string $new_substyle_id
   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'));
   234         $DIC->user()->setPref(
'skin', $skin_id);
   235         $DIC->user()->setPref(
'style', $style_id);
   236         $DIC->user()->update();
   246         return $DIC->user()->getPref(
'skin');
   256         return $DIC->user()->getPref(
'style');
   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);
   276         self::setCurrentDefaultStyle($system_style_conf->getDefaultSkinId(), $system_style_conf->getDefaultSkinId());
   287         $skin_id = $DIC->clientIni()->readVariable(
'layout', 
'skin');
   290             self::resetDefaultToDelos();
   291             $skin_id = $DIC->clientIni()->readVariable(
'layout', 
'skin');
   303         $skin_id = $DIC->clientIni()->readVariable(
'layout', 
'skin');
   304         $style_id = $DIC->clientIni()->readVariable(
'layout', 
'style');
   307             self::resetDefaultToDelos();
   308             $style_id = $DIC->clientIni()->readVariable(
'layout', 
'style');
 const SUBSTYLE_ASSIGNMENT_EXISTS
 
static _lookupActivatedStyle(string $a_skin, string $a_style)
lookup if a style is activated 
 
static writeSystemStyleCategoryAssignment(string $a_skin_id, string $a_style_id, string $a_substyle, string $a_ref_id)
Sets a substyle category assignment. 
 
static getCurrentUserPrefSkin()
Gets a users preferred skin by using the user object. 
 
static getCurrentDefaultSkin()
Gets default Skin of the System. 
 
static resetDefaultToDelos()
 
static getCurrentUserPrefStyle()
Gets a users preferred style by using the user object. 
 
static _deactivateStyle(string $a_skin, string $a_style)
deactivate system style 
 
static getSystemStyleCategoryAssignments(string $a_skin_id, string $a_style_id)
Get all system sub styles category assignments. 
 
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. 
 
static _activateStyle(string $a_skin, string $a_style)
activate system style 
 
static styleExistsForSkinId(string $skin_id, string $style_id)
 
static getSubStyleCategoryAssignments(string $a_skin_id, string $a_style_id, string $a_sub_style_id)
Get all system category assignments of exactly one substyle. 
 
static updateSkinIdAndStyleIDOfSubStyleCategoryAssignments(string $old_skin_id, string $old_style_id, string $new_skin_id, string $new_style_id)
Updates an assignment, e.g. 
 
static deleteSubStyleCategoryAssignments(string $a_skin_id, string $a_style_id, string $a_substyle)
Delets a sub styles category assignment. 
 
static setCurrentDefaultStyle(string $skin_id, string $style_id)
Sets the default style of the system. 
 
This class acts as Model for all system styles settings related settings such as activated or default...
 
ilSystemStyleConfig wraps all 'constants' to ensure the testability of all classes using those 'const...
 
static skinExists(string $skin_id, ?ilSystemStyleConfig $system_style_config=null)
Check whether a skin exists. 
 
static getCurrentDefaultStyle()
Gets default style of the system. 
 
static updateSubStyleIdfSubStyleCategoryAssignments(string $old_substyle_id, string $new_substyle_id)
Updates an assignment, e.g. 
 
static setCurrentUserPrefStyle(string $skin_id, string $style_id)
Sets a users preferred system skin/style by using the user object.