19 declare(strict_types=1);
    64             $skin_id = self::getCurrentSkin();
    67         if (!$system_style_config) {
    76             $this->
setSkin($this->skin_factory->skinFromXML($this->getSystemStylesConf()->getCustomizingSkinPath() . $skin_id . 
'/template.xml'));
    78             $this->
setSkin($this->skin_factory->skinFromXML($this->getSystemStylesConf()->getDefaultTemplatePath()));
    91         if (!$DIC || is_array($DIC)) {
    94         if ($DIC->isDependencyAvailable(
'systemStyle') && is_object($DIC->systemStyle()->getSkin())) {
    95             return $DIC->systemStyle()->getSkin()->getId();
    99             if ($DIC->isDependencyAvailable(
'user') && is_object($DIC->user()) && property_exists(
   103                 $skin_id = $DIC->user()->skin;
   104                 if ($skin_id && !self::skinExists($skin_id)) {
   105                     if($DIC->isDependencyAvailable(
'systemStyle')) {
   107                         $message_text = $DIC->language()->txt(
'set_skin_does_not_exist') . 
' ' . $skin_id;
   111                     $skin_id = $system_style_conf->getDefaultSkinId();
   113                 return $skin_id === 
'' ? $system_style_conf->getDefaultSkinId() : $skin_id;
   125         return $this->
getSkin()->getStyles();
   130         return $this->
getSkin()->getName();
   138         return $this->
getSkin()->getStyle($a_id);
   146         return $this->
getSkin()->getStyle($a_id)->getName();
   158             return $this->
getSkin()->getStyle($style_id)->getImageDirectory();
   169         return $this->
getSkin()->getStyle($style_id)->getSoundDirectory();
   175     public static function getAllSkins(?
ilSystemStyleConfig $system_style_config = null): array
   178             if (!$system_style_config) {
   195                     FilesystemIterator::SKIP_DOTS
   197                 foreach ($cust_skins_directory as $skin_folder) {
   198                     if ($skin_folder->isDir()) {
   199                         $template_path = $skin_folder->getRealPath() . 
'/template.xml';
   200                         if (file_exists($template_path)) {
   201                             $skin = $skin_factory->skinFromXML($template_path);
   208             self::setSkins($skins);
   219         if (!$system_style_config) {
   243         if (isset(self::$current_style)) {
   244             return self::$current_style;
   247         if (!$DIC || is_array($DIC) || !$DIC->isDependencyAvailable(
'user')) {
   251         if (array_key_exists(
'style', $DIC->user()->prefs) && $DIC->user()->prefs[
'style']) {
   252             self::setCurrentStyle($DIC->user()->prefs[
'style']);
   258         if ($DIC->isDependencyAvailable(
'systemStyle') && self::styleExistsForCurrentSkin(self::$current_style)) {
   259             if ($DIC->systemStyle()->getSkin()->hasStyleSubstyles(self::$current_style)) {
   262                     self::getCurrentSkin(),
   265                 if (count($assignments) > 0) {
   267                     foreach ($assignments as 
$a) {
   268                         if ($DIC->systemStyle()->getSkin()->hasStyle($a[
'substyle'])) {
   269                             $ref_ass[$a[
'ref_id']] = $a[
'substyle'];
   275                     if ($DIC->http()->wrapper()->query()->has(
'ref_id')) {
   276                         $ref_id = $DIC->http()->wrapper()->query()->retrieve(
   278                             $DIC->refinery()->kindlyTo()->string()
   280                     } elseif ($DIC->http()->wrapper()->query()->has(
'target')) {
   281                         $target = $DIC->http()->wrapper()->query()->retrieve(
   283                             $DIC->refinery()->kindlyTo()->string()
   285                         $target_arr = explode(
'_', $target);
   286                         $ref_id = $target_arr[1] ?? 
'';
   290                     if ($DIC->isDependencyAvailable(
'repositoryTree') && 
$ref_id && $DIC->repositoryTree()->isInTree((
int) 
$ref_id)) {
   291                         $path = $DIC->repositoryTree()->getPathId((
int) $ref_id);
   292                         for ($i = count(
$path) - 1; $i >= 0; $i--) {
   293                             if (isset($ref_ass[
$path[$i]])) {
   294                                 self::$current_style = $ref_ass[
$path[$i]];
   295                                 return self::$current_style;
   303         if ($DIC->isDependencyAvailable(
'systemStyle') && !self::styleExistsForCurrentSkin(self::$current_style)) {
   305             $message_text = $DIC->language()->txt(
'set_style_does_not_exist') . 
' ' . self::$current_style;
   313         return self::$current_style;
   325         if (!self::getCachedAllStylesInformation()) {
   328             $skins = $DIC->systemStyle()->getSkins();
   330             foreach ($skins as $skin) {
   331                 foreach ($skin->getStyles() as $style) {
   335                     if ($style->getSubstyleOf()) {
   336                         $parent_name = $skin->getStyle($style->getSubstyleOf())->getName();
   344                     $all_styles[$skin->getId() . 
':' . $style->getId()] = [
   345                         'title' => $skin->getName() . 
' / ' . $style->getName(),
   346                         'id' => $skin->getId() . 
':' . $style->getId(),
   347                         'skin_id' => $skin->getId(),
   348                         'skin_name' => $skin->getName(),
   349                         'template_id' => $skin->getId(),
   350                         'template_name' => $skin->getName(),
   351                         'style_id' => $style->getId(),
   352                         'style_name' => $style->getName(),
   353                         'substyle_of' => $style->getSubstyleOf(),
   354                         'substyle_of_name' => $parent_name,
   355                         'users' => $num_users,
   360             self::setCachedAllStylesInformation($all_styles);
   363         return self::getCachedAllStylesInformation();
   373         if ($DIC->isDependencyAvailable(
'systemStyle') && $DIC->systemStyle()->getSkin()->getName() != $a_skin) {
   375             if (!self::styleExistsForCurrentSkin(self::$current_style)) {
   376                 $styleDefinition->setCurrentStyle($DIC->systemStyle()->getSkin()->getDefaultStyle()->getId());
   386         foreach (self::getSkins() as $skin) {
   387             if ($skin->hasStyle($style_id)) {
   401         if (!self::skinExists($skin_id)) {
   405         $skin = $factory->skinStyleContainerFromId($skin_id, 
new ilSystemStyleMessageStack($DIC->ui()->mainTemplate()))->getSkin();
   406         return $skin->hasStyle($style_id);
   413         return $DIC->systemStyle()->getSkin()->hasStyle($style_id);
   418         self::$current_style = $a_style;
   427         return self::getAllSkins();
   433     public static function setSkins(array $skins): void
   450         if (!isset(self::$cached_all_styles_information)) {
   453         return self::$cached_all_styles_information;
 static setCachedAllStylesInformation(array $cached_all_styles_information)
 
static setCurrentStyle(string $a_style)
 
getStyleName(string $a_id)
 
getSoundDirectory(string $style_id)
 
ilSystemStyleConfig $system_style_config
Used to wire this component up with the correct paths into the customizing directory. 
 
static styleExists(string $style_id)
 
Factory to create Skin classes holds an manages the basic data of a skin as provide by the template o...
 
static getCachedAllStylesInformation()
 
static string $current_style
currently selected style, used for caching 
 
static styleExistsForCurrentSkin(string $style_id)
 
static getSystemStyleCategoryAssignments(string $a_skin_id, string $a_style_id)
Get all system sub styles category assignments. 
 
static _getNumberOfUsersForStyle(string $a_skin, string $a_style)
 
$messages
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
 
static getAllSkinStyles()
Get all skins/styles as array (convenient for tables) Attention: tempalte_name/template_id in this ar...
 
static getCurrentSkin()
get the current skin use always this function instead of getting the account's skin the current skin ...
 
ilSkinFactory $skin_factory
 
static styleExistsForSkinId(string $skin_id, string $style_id)
 
static setSkins(array $skins)
 
static array $cached_all_styles_information
Used for caching. 
 
ilSkin $skin
Sets the current skin. 
 
ilSystemStyleConfig wraps all 'constants' to ensure the testability of all classes using those 'const...
 
setSystemStylesConf(ilSystemStyleConfig $system_style_config)
 
static skinExists(string $skin_id, ?ilSystemStyleConfig $system_style_config=null)
Check whether a skin exists. 
 
__construct(string $skin_id='', ilSystemStyleConfig $system_style_config=null)
ilStyleDefinition constructor. 
 
static setCurrentSkin(string $a_skin)
 
getImageDirectory(string $style_id)
 
Used to stack messages to be shown to the user. 
 
ilStyleDefinition acts as a wrapper of style related actions. 
 
$a
thx to https://mlocati.github.io/php-cs-fixer-configurator for the examples 
 
static getCurrentStyle()
get the current style or sub style use always this function instead of getting the account's style th...
 
ilSkin holds an manages the basic data of a skin as provide by the template of the skin...