ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
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 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 74 of file class.ilSystemStyleSettings.php.

References $ilDB.

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

75  {
76  global $ilDB;
77 
78  $q = "DELETE FROM settings_deactivated_s".
79  " WHERE skin = ".$ilDB->quote($a_skin, "text").
80  " AND style = ".$ilDB->quote($a_style, "text");
81 
82  $ilDB->manipulate($q);
83  }
global $ilDB
+ 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 55 of file class.ilSystemStyleSettings.php.

References $ilDB, and _activateStyle().

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

56  {
57  global $ilDB;
58 
59  ilSystemStyleSettings::_activateStyle($a_skin, $a_style);
60  $q = "INSERT into settings_deactivated_s".
61  " (skin, style) VALUES ".
62  " (".$ilDB->quote($a_skin, "text").",".
63  " ".$ilDB->quote($a_style, "text").")";
64 
65  $ilDB->manipulate($q);
66  }
static _activateStyle($a_skin, $a_style)
activate system style
global $ilDB
+ 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.

References $ilDB.

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

29  {
30  global $ilDB;
31 
32  $q = "SELECT count(*) cnt FROM settings_deactivated_s".
33  " WHERE skin = ".$ilDB->quote($a_skin, "text").
34  " AND style = ".$ilDB->quote($a_style, "text")." ";
35 
36  $cnt_set = $ilDB->query($q);
37  $cnt_rec = $ilDB->fetchAssoc($cnt_set);
38 
39  if ($cnt_rec["cnt"] > 0)
40  {
41  return false;
42  }
43  else
44  {
45  return true;
46  }
47  }
global $ilDB
+ 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 200 of file class.ilSystemStyleSettings.php.

References $ilDB.

Referenced by ilSystemStyleSkinContainer\deleteStyle().

201  {
202  global $ilDB;
203 
204  $ilDB->manipulate("DELETE FROM syst_style_cat WHERE ".
205  " skin_id = ".$ilDB->quote($a_skin_id, "text").
206  " AND style_id = ".$ilDB->quote($a_style_id, "text").
207  " AND substyle = ".$ilDB->quote($a_substyle, "text"));
208  }
global $ilDB
+ 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.

References $ilDB.

Referenced by ilSubStyleAssignmentGUI\deleteAssignments().

183  {
184  global $ilDB;
185 
186  $ilDB->manipulate("DELETE FROM syst_style_cat WHERE ".
187  " skin_id = ".$ilDB->quote($a_skin_id, "text").
188  " AND style_id = ".$ilDB->quote($a_style_id, "text").
189  " AND substyle = ".$ilDB->quote($a_substyle, "text").
190  " AND category_ref_id = ".$ilDB->quote($a_ref_id, "integer"));
191  }
global $ilDB
+ Here is the caller graph for this function:

◆ getCurrentDefaultSkin()

static ilSystemStyleSettings::getCurrentDefaultSkin ( )
static

Gets default Skin of the System.

Returns
string

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

References $DIC, and ilStyleDefinition\skinExists().

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

273  {
274  global $DIC;
275  $skin_id = $DIC['ilias']->ini->readVariable("layout","skin");
276 
277  if(!ilStyleDefinition::skinExists($skin_id)){
278  self::resetDefaultToDelos();
279  $skin_id = $DIC['ilias']->ini->readVariable("layout","skin");
280  }
281  return $skin_id;
282  }
static skinExists($skin_id, ilSystemStyleConfig $system_style_config=null)
Check whether a skin exists.
global $DIC
+ 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
string

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

References $DIC, and ilStyleDefinition\styleExistsForSkinId().

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

288  {
289  global $DIC;
290  $skin_id = $DIC['ilias']->ini->readVariable("layout","skin");
291  $style_id = $DIC['ilias']->ini->readVariable("layout","style");
292 
293  if(!ilStyleDefinition::styleExistsForSkinId($skin_id,$style_id)){
294  self::resetDefaultToDelos();
295  $style_id = $DIC['ilias']->ini->readVariable("layout","style");
296  }
297  return $style_id;
298  }
static styleExistsForSkinId($skin_id, $style_id)
global $DIC
+ 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 229 of file class.ilSystemStyleSettings.php.

References $DIC.

Referenced by ilSystemStyleSettingsGUI\saveStyle().

229  {
230  global $DIC;
231 
232  return $DIC->user()->getPref("skin");
233  }
global $DIC
+ 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 240 of file class.ilSystemStyleSettings.php.

References $DIC.

Referenced by ilSystemStyleSettingsGUI\saveStyle().

240  {
241  global $DIC;
242 
243  return $DIC->user()->getPref("style");
244  }
global $DIC
+ 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 121 of file class.ilSystemStyleSettings.php.

References $ilDB.

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

122  {
123  global $ilDB;
124 
125  $assignmnts = [];
126 
127  $set = $ilDB->query("SELECT substyle, category_ref_id FROM syst_style_cat ".
128  " WHERE skin_id = ".$ilDB->quote($a_skin_id, "text").
129  " AND substyle = ".$ilDB->quote($a_sub_style_id, "text").
130  " AND style_id = ".$ilDB->quote($a_style_id, "text")
131  );
132  while (($rec = $ilDB->fetchAssoc($set)))
133  {
134  $assignmnts[] = [
135  "substyle" => $rec["substyle"],
136  "ref_id" => $rec["category_ref_id"]
137  ];
138  }
139  return $assignmnts;
140  }
global $ilDB
+ 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 93 of file class.ilSystemStyleSettings.php.

References $ilDB.

Referenced by ilStyleDefinition\skinExists().

94  {
95  global $ilDB;
96 
97  $assignments = [];
98  $set = $ilDB->query("SELECT substyle, category_ref_id FROM syst_style_cat ".
99  " WHERE skin_id = ".$ilDB->quote($a_skin_id, "text").
100  " AND style_id = ".$ilDB->quote($a_style_id, "text")
101  );
102  while (($rec = $ilDB->fetchAssoc($set)))
103  {
104  $assignments[] = [
105  "substyle" => $rec["substyle"],
106  "ref_id" => $rec["category_ref_id"]
107  ];
108  }
109  return $assignments;
110  }
global $ilDB
+ Here is the caller graph for this function:

◆ resetDefaultToDelos()

static ilSystemStyleSettings::resetDefaultToDelos ( )
static

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

262  {
263  $system_style_conf = new ilSystemStyleConfig();
264 
265  self::setCurrentDefaultStyle($system_style_conf->getDefaultSkinId(),$system_style_conf->getDefaultSkinId());
266  }
ilSystemStyleConfig wraps all 'constants' to ensure the testability of all classes using those 'const...

◆ setCurrentDefaultStyle()

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

Sets the default style of the system.

Parameters
$skin_id
$style_id

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

References $DIC.

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

252  {
253  global $DIC;
254 
255  $DIC['ilias']->ini->setVariable("layout","skin", $skin_id);
256  $DIC['ilias']->ini->setVariable("layout","style",$style_id);
257  $DIC['ilias']->ini->write();
258  self::_activateStyle($skin_id, $style_id);
259 
260  }
global $DIC
+ 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 216 of file class.ilSystemStyleSettings.php.

References $DIC.

Referenced by ilSystemStyleSettingsGUI\saveStyle().

216  {
217  global $DIC;
218 
219  $DIC->user()->setPref("skin",$skin_id);
220  $DIC->user()->setPref("style",$style_id);
221  $DIC->user()->update();
222  }
global $DIC
+ 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 151 of file class.ilSystemStyleSettings.php.

References $ilDB, and ilSystemStyleException\SUBSTYLE_ASSIGNMENT_EXISTS.

Referenced by ilSubStyleAssignmentGUI\saveAssignment().

153  {
154  global $ilDB;
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  $ilDB->manipulate("INSERT INTO syst_style_cat ".
164  "(skin_id, style_id, substyle, category_ref_id) VALUES (".
165  $ilDB->quote($a_skin_id, "text").",".
166  $ilDB->quote($a_style_id, "text").",".
167  $ilDB->quote($a_substyle, "text").",".
168  $ilDB->quote($a_ref_id, "integer").
169  ")");
170  }
Class for advanced editing exception handling in ILIAS.
global $ilDB
+ Here is the caller graph for this function:

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