19declare(strict_types=1);
73 $this->skin_factory =
new ilSkinFactory(
$DIC->language(), $this->getSystemStylesConf());
76 $this->
setSkin($this->skin_factory->skinFromXML($this->getSystemStylesConf()->getCustomizingSkinPath() . $skin_id .
'/template.xml'));
78 $this->
setSkin($this->skin_factory->skinFromXML($this->getSystemStylesConf()->getDefaultTemplatePath()));
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();
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();
193 $cust_skins_directory =
new RecursiveDirectoryIterator(
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)) {
243 if (isset(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']) {
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()
290 if (
$DIC->isDependencyAvailable(
'repositoryTree') &&
$ref_id &&
$DIC->repositoryTree()->isInTree((
int)
$ref_id)) {
293 if (isset($ref_ass[
$path[
$i]])) {
294 self::$current_style = $ref_ass[
$path[
$i]];
303 if (
$DIC->isDependencyAvailable(
'systemStyle') && !self::styleExistsForCurrentSkin(self::$current_style)) {
325 if (!self::getCachedAllStylesInformation()) {
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(),
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,
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) {
401 if (!self::skinExists($skin_id)) {
413 return $DIC->systemStyle()->getSkin()->hasStyle($style_id);
418 self::$current_style = $a_style;
427 return self::getAllSkins();
450 if (!isset(self::$cached_all_styles_information)) {
static _getNumberOfUsersForStyle(string $a_skin, string $a_style)
Factory to create Skin classes holds an manages the basic data of a skin as provide by the template o...
ilSkin holds an manages the basic data of a skin as provide by the template of the skin.
ilStyleDefinition acts as a wrapper of style related actions.
static setCachedAllStylesInformation(array $cached_all_styles_information)
static getCurrentSkin()
get the current skin use always this function instead of getting the account's skin the current skin ...
getSoundDirectory(string $style_id)
static string $current_style
currently selected style, used for caching
static skinExists(string $skin_id, ?ilSystemStyleConfig $system_style_config=null)
Check whether a skin exists.
static getCachedAllStylesInformation()
ilSkin $skin
Sets the current skin.
static setCurrentSkin(string $a_skin)
ilSkinFactory $skin_factory
getStyleName(string $a_id)
static styleExistsForCurrentSkin(string $style_id)
ilSystemStyleConfig $system_style_config
Used to wire this component up with the correct paths into the customizing directory.
static getAllSkinStyles()
Get all skins/styles as array (convenient for tables) Attention: tempalte_name/template_id in this ar...
static setCurrentStyle(string $a_style)
static array $cached_all_styles_information
Used for caching.
static setSkins(array $skins)
setSystemStylesConf(ilSystemStyleConfig $system_style_config)
getImageDirectory(string $style_id)
static styleExists(string $style_id)
__construct(string $skin_id='', ilSystemStyleConfig $system_style_config=null)
ilStyleDefinition constructor.
static getCurrentStyle()
get the current style or sub style use always this function instead of getting the account's style th...
static styleExistsForSkinId(string $skin_id, string $style_id)
ilSystemStyleConfig wraps all 'constants' to ensure the testability of all classes using those 'const...
Class for advanced editing exception handling in ILIAS.
Used to stack messages to be shown to the user.
static getSystemStyleCategoryAssignments(string $a_skin_id, string $a_style_id)
Get all system sub styles category assignments.
$a
thx to https://mlocati.github.io/php-cs-fixer-configurator for the examples
$messages
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...