ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
ilStyleDefinition Class Reference

ilStyleDefinition acts as a wrapper of style related actions. More...

+ Collaboration diagram for ilStyleDefinition:

Public Member Functions

 __construct ($skin_id="", ilSystemStyleConfig $system_style_config=null)
 ilStyleDefinition constructor. More...
 
 getStyles ()
 
 getTemplateName ()
 
 getStyle ($a_id)
 
 getStyleName ($a_id)
 
 getImageDirectory ($style_id)
 
 getSoundDirectory ($style_id)
 
 getSkin ()
 
 setSkin ($skin)
 
 getSystemStylesConf ()
 
 setSystemStylesConf ($system_style_config)
 

Static Public Member Functions

static getAllTemplates ()
 
static skinExists ($skin_id, ilSystemStyleConfig $system_style_config=null)
 Check whether a skin exists. More...
 
static styleExists ($style_id)
 
static styleExistsForSkinId ($skin_id, $style_id)
 
static setCurrentStyle ($a_style)
 
static getSkins ()
 
static setSkins ($skins)
 

Static Public Attributes

static $current_style = false
 
static $skins = []
 

Static Protected Member Functions

static getCachedAllStylesInformation ()
 
static setCachedAllStylesInformation ($cached_all_styles_information)
 

Protected Attributes

 $skin
 
 $system_style_config
 

Static Protected Attributes

static $cached_all_styles_information = null
 

Detailed Description

ilStyleDefinition acts as a wrapper of style related actions.

Use this class to get the systems current style. Currently some of the logic is not clearly separated from ilSystemStyleSettings. This is due to legacy reasons. In a future refactoring, this class might be completely merged with ilSystemStyleSettings.

The following terminology is used:

(system) style: A style that can be set as system style for the complete ILIAS installations. This includes, less css, fonts, icons and sounds as well as possible html tpl files to overide ILIAS templates. (stystem) sub style: A sub style can be assigned to exactly one system style to be displayed for a set of categories. skin: A skin can hold multiple style. A skin is defined by it's folder carrying the name of the skin and the template.xml in this exact folder, listing the skins styles and substyles. Mostly a skin caries exactly one style. Through the GUI in the administration it is not possible to define multiple style per skin. It is however possible to define multiple sub styles for one style stored in one skin. template: The template is the xml file of the skin storing the skin styles and sub styles information.

Skins, styles ans stub styles are always used globally (not client specific).

This class is currently also used as global $styleDefinition.

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 42 of file class.ilStyleDefinition.php.

Constructor & Destructor Documentation

◆ __construct()

ilStyleDefinition::__construct (   $skin_id = "",
ilSystemStyleConfig  $system_style_config = null 
)

ilStyleDefinition constructor.

Parameters
string$skin_id
ilSystemStyleConfig | null$system_style_config

Definition at line 83 of file class.ilStyleDefinition.php.

References $DIC, $system_style_config, getSystemStylesConf(), ilUtil\sendFailure(), setSkin(), and setSystemStylesConf().

84  {
85  if ($skin_id == "") {
86  $skin_id = self::getCurrentSkin();
87  }
88 
89  if (!$system_style_config) {
91  } else {
92  $this->setSystemStylesConf($system_style_config);
93  }
94 
95  if ($skin_id != $this->getSystemStylesConf()->getDefaultSkinId()) {
96  $this->setSkin(ilSkinXML::parseFromXML($this->getSystemStylesConf()->getCustomizingSkinPath() . $skin_id . "/template.xml"));
97  } else {
98  $this->setSkin(ilSkinXML::parseFromXML($this->getSystemStylesConf()->getDefaultTemplatePath()));
99  }
100  }
setSystemStylesConf($system_style_config)
ilSystemStyleConfig wraps all 'constants' to ensure the testability of all classes using those 'const...
+ Here is the call graph for this function:

Member Function Documentation

◆ getAllTemplates()

static ilStyleDefinition::getAllTemplates ( )
static
Deprecated:
due to bad naming.
Returns
ilSkinXML[]

Definition at line 240 of file class.ilStyleDefinition.php.

241  {
242  return self::getAllSkins();
243  }

◆ getCachedAllStylesInformation()

static ilStyleDefinition::getCachedAllStylesInformation ( )
staticprotected
Returns
array|null

Definition at line 497 of file class.ilStyleDefinition.php.

498  {
499  return self::$cached_all_styles_information;
500  }

◆ getImageDirectory()

ilStyleDefinition::getImageDirectory (   $style_id)
Parameters
$style_id
Returns
string
Exceptions
ilSystemStyleException

Definition at line 177 of file class.ilStyleDefinition.php.

References getSkin(), getStyle(), ilSystemStyleException\NO_STYLE_ID, and ilSystemStyleException\NOT_EXISTING_STYLE.

178  {
179  if (!$style_id) {
181  }
182  if (!$this->getSkin()->getStyle($style_id)) {
184  }
185  return $this->getSkin()->getStyle($style_id)->getImageDirectory();
186  }
Class for advanced editing exception handling in ILIAS.
+ Here is the call graph for this function:

◆ getSkin()

ilStyleDefinition::getSkin ( )
Returns
ilSkinXML

Definition at line 481 of file class.ilStyleDefinition.php.

References $skin.

Referenced by getImageDirectory(), getSoundDirectory(), getStyle(), getStyleName(), getStyles(), and getTemplateName().

482  {
483  return $this->skin;
484  }
+ Here is the caller graph for this function:

◆ getSkins()

static ilStyleDefinition::getSkins ( )
static
Returns
ilSkinXML[]

Definition at line 465 of file class.ilStyleDefinition.php.

Referenced by ilUtil\getStyleSheetLocation().

466  {
467  return self::getAllSkins();
468  }
+ Here is the caller graph for this function:

◆ getSoundDirectory()

ilStyleDefinition::getSoundDirectory (   $style_id)
Parameters
$style_id
Returns
string

Definition at line 192 of file class.ilStyleDefinition.php.

References $skin, $skins, $system_style_config, and getSkin().

193  {
194  return $this->getSkin()->getStyle($style_id)->getSoundDirectory();
195  }
+ Here is the call graph for this function:

◆ getStyle()

ilStyleDefinition::getStyle (   $a_id)
Parameters
$a_id
Returns
ilSkinStyleXML

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

References getSkin().

Referenced by getImageDirectory().

159  {
160  return $this->getSkin()->getStyle($a_id);
161  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getStyleName()

ilStyleDefinition::getStyleName (   $a_id)
Parameters
$a_id
Returns
string

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

References getSkin().

168  {
169  return $this->getSkin()->getStyle($a_id)->getName();
170  }
+ Here is the call graph for this function:

◆ getStyles()

ilStyleDefinition::getStyles ( )
Returns
ilSkinStyleXML[]

Definition at line 139 of file class.ilStyleDefinition.php.

References getSkin().

140  {
141  return $this->getSkin()->getStyles();
142  }
+ Here is the call graph for this function:

◆ getSystemStylesConf()

ilStyleDefinition::getSystemStylesConf ( )
Returns
ilSystemStyleConfig

Definition at line 513 of file class.ilStyleDefinition.php.

References $system_style_config.

Referenced by __construct().

514  {
516  }
+ Here is the caller graph for this function:

◆ getTemplateName()

ilStyleDefinition::getTemplateName ( )
Returns
string

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

References getSkin().

149  {
150  return $this->getSkin()->getName();
151  }
+ Here is the call graph for this function:

◆ setCachedAllStylesInformation()

static ilStyleDefinition::setCachedAllStylesInformation (   $cached_all_styles_information)
staticprotected
Parameters
array | null$cached_all_styles_information

Definition at line 505 of file class.ilStyleDefinition.php.

References $cached_all_styles_information.

506  {
507  self::$cached_all_styles_information = $cached_all_styles_information;
508  }

◆ setCurrentStyle()

static ilStyleDefinition::setCurrentStyle (   $a_style)
static
Parameters
$a_style

Definition at line 457 of file class.ilStyleDefinition.php.

458  {
459  self::$current_style = $a_style;
460  }

◆ setSkin()

ilStyleDefinition::setSkin (   $skin)
Parameters
ilSkinXML$skin

Definition at line 489 of file class.ilStyleDefinition.php.

References $skin.

Referenced by __construct().

490  {
491  $this->skin = $skin;
492  }
+ Here is the caller graph for this function:

◆ setSkins()

static ilStyleDefinition::setSkins (   $skins)
static
Parameters
ilSkinXML[]$skins

Definition at line 473 of file class.ilStyleDefinition.php.

References $skins.

474  {
475  self::$skins = $skins;
476  }

◆ setSystemStylesConf()

ilStyleDefinition::setSystemStylesConf (   $system_style_config)
Parameters
$system_style_config

Definition at line 521 of file class.ilStyleDefinition.php.

References $system_style_config.

Referenced by __construct().

522  {
523  $this->system_style_config = $system_style_config;
524  }
+ Here is the caller graph for this function:

◆ skinExists()

static ilStyleDefinition::skinExists (   $skin_id,
ilSystemStyleConfig  $system_style_config = null 
)
static

Check whether a skin exists.

Not using array_key_exists($skin_id,self::getAllSkins()); for performance reasons

Parameters
string$skin_id
ilSystemStyleConfig | null$system_style_config
Returns
bool

Definition at line 251 of file class.ilStyleDefinition.php.

References $_GET, $DIC, $i, $path, $skin, $skins, $style, $system_style_config, $target_arr, ilObjUser\_getNumberOfUsersForStyle(), ilSystemStyleSettings\getSystemStyleCategoryAssignments(), and ilUtil\sendFailure().

Referenced by ilSystemStyleSkinContainer\copy(), ilSystemStyleSettings\getCurrentDefaultSkin(), ilSystemStyleSkinContainer\import(), ilObjUser\read(), and ilSystemStyleOverviewGUI\saveNewSystemStyle().

252  {
253  if (!$system_style_config) {
254  $system_style_config = new ilSystemStyleConfig();
255  }
256 
257  if ($skin_id == $system_style_config->getDefaultSkinId()) {
258  if (is_file($system_style_config->getDefaultTemplatePath())) {
259  return true;
260  }
261  } else {
262  if (is_file($system_style_config->getCustomizingSkinPath() . $skin_id . "/template.xml")) {
263  return true;
264  }
265  }
266  return false;
267  }
ilSystemStyleConfig wraps all 'constants' to ensure the testability of all classes using those 'const...
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ styleExists()

static ilStyleDefinition::styleExists (   $style_id)
static
Parameters
$style_id
Returns
bool

Definition at line 415 of file class.ilStyleDefinition.php.

References $skin.

Referenced by ilSystemStylesTableGUI\getStyles(), and ilSystemStyleOverviewGUI\moveUserStyles().

416  {
417  foreach (self::getSkins() as $skin) {
418  if ($skin->hasStyle($style_id)) {
419  return true;
420  }
421  }
422  return false;
423  }
+ Here is the caller graph for this function:

◆ styleExistsForSkinId()

static ilStyleDefinition::styleExistsForSkinId (   $skin_id,
  $style_id 
)
static
Parameters
$skin_id
$style_id
Returns
bool
Exceptions
ilSystemStyleException

Definition at line 431 of file class.ilStyleDefinition.php.

References $skin, and ilSystemStyleSkinContainer\generateFromId().

Referenced by ilSystemStyleSettings\getCurrentDefaultStyle(), and ilObjUser\read().

432  {
433  if (!self::skinExists($skin_id)) {
434  return false;
435  }
436  $skin = ilSystemStyleSkinContainer::generateFromId($skin_id)->getSkin();
437  return $skin->hasStyle($style_id);
438  }
static generateFromId($skin_id, ilSystemStyleMessageStack $message_stack=null, ilSystemStyleConfig $system_styles_conf=null)
Generate the container class by parsing the corresponding XML.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ $cached_all_styles_information

ilStyleDefinition::$cached_all_styles_information = null
staticprotected

Definition at line 68 of file class.ilStyleDefinition.php.

Referenced by setCachedAllStylesInformation().

◆ $current_style

ilStyleDefinition::$current_style = false
static

Definition at line 49 of file class.ilStyleDefinition.php.

◆ $skin

ilStyleDefinition::$skin
protected

◆ $skins

ilStyleDefinition::$skins = []
static

Definition at line 55 of file class.ilStyleDefinition.php.

Referenced by getSoundDirectory(), setSkins(), and skinExists().

◆ $system_style_config

ilStyleDefinition::$system_style_config
protected

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