ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
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  {
97  $this->setSkin(ilSkinXML::parseFromXML($this->getSystemStylesConf()->getCustomizingSkinPath().$skin_id."/template.xml"));
98 
99  }else{
100  $this->setSkin(ilSkinXML::parseFromXML($this->getSystemStylesConf()->getDefaultTemplatePath()));
101  }
102  }
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 243 of file class.ilStyleDefinition.php.

243  {
244  return self::getAllSkins();
245  }

◆ getCachedAllStylesInformation()

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

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

510  {
511  return self::$cached_all_styles_information;
512  }

◆ getImageDirectory()

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

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

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

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

◆ getSkin()

ilStyleDefinition::getSkin ( )
Returns
ilSkinXML

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

References $skin.

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

494  {
495  return $this->skin;
496  }
+ Here is the caller graph for this function:

◆ getSkins()

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

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

Referenced by ilUtil\getStyleSheetLocation().

478  {
479  return self::getAllSkins();
480  }
+ Here is the caller graph for this function:

◆ getSoundDirectory()

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

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

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

196  {
197  return $this->getSkin()->getStyle($style_id)->getSoundDirectory();
198  }
+ Here is the call graph for this function:

◆ getStyle()

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

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

References getSkin().

Referenced by getImageDirectory().

162  {
163  return $this->getSkin()->getStyle($a_id);
164  }
+ 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 170 of file class.ilStyleDefinition.php.

References getSkin().

171  {
172  return $this->getSkin()->getStyle($a_id)->getName();
173  }
+ Here is the call graph for this function:

◆ getStyles()

ilStyleDefinition::getStyles ( )
Returns
ilSkinStyleXML[]

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

References getSkin().

143  {
144  return $this->getSkin()->getStyles();
145  }
+ Here is the call graph for this function:

◆ getSystemStylesConf()

ilStyleDefinition::getSystemStylesConf ( )
Returns
ilSystemStyleConfig

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

References $system_style_config.

Referenced by __construct().

526  {
528  }
+ Here is the caller graph for this function:

◆ getTemplateName()

ilStyleDefinition::getTemplateName ( )
Returns
string

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

References getSkin().

152  {
153  return $this->getSkin()->getName();
154  }
+ 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 517 of file class.ilStyleDefinition.php.

References $cached_all_styles_information.

518  {
519  self::$cached_all_styles_information = $cached_all_styles_information;
520  }

◆ setCurrentStyle()

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

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

470  {
471  self::$current_style = $a_style;
472  }

◆ setSkin()

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

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

References $skin.

Referenced by __construct().

502  {
503  $this->skin = $skin;
504  }
+ Here is the caller graph for this function:

◆ setSkins()

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

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

References $skins.

486  {
487  self::$skins = $skins;
488  }

◆ setSystemStylesConf()

ilStyleDefinition::setSystemStylesConf (   $system_style_config)
Parameters
$system_style_config

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

References $system_style_config.

Referenced by __construct().

534  {
535  $this->system_style_config = $system_style_config;
536  }
+ 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 253 of file class.ilStyleDefinition.php.

References $_GET, $DIC, $path, $ref_id, $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().

254  {
255  if(!$system_style_config){
256  $system_style_config = new ilSystemStyleConfig();
257  }
258 
259  if ($skin_id == $system_style_config->getDefaultSkinId())
260  {
261  if (is_file($system_style_config->getDefaultTemplatePath()))
262  {
263  return true;
264  }
265  }
266  else
267  {
268  if (is_file($system_style_config->getCustomizingSkinPath().$skin_id."/template.xml"))
269  {
270  return true;
271  }
272  }
273  return false;
274  }
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 429 of file class.ilStyleDefinition.php.

References $skin.

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

429  {
430  foreach(self::getSkins() as $skin)
431  {
432  if($skin->hasStyle($style_id)){
433  return true;
434  }
435  }
436  return false;
437  }
+ 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 445 of file class.ilStyleDefinition.php.

References $skin, and ilSystemStyleSkinContainer\generateFromId().

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

445  {
446  if(!self::skinExists($skin_id)){
447  return false;
448  }
449  $skin = ilSystemStyleSkinContainer::generateFromId($skin_id)->getSkin();
450  return $skin->hasStyle($style_id);
451  }
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: