2 include_once(
"Services/Style/System/classes/Utilities/class.ilSkinXML.php");
3 include_once(
"Services/Style/System/classes/Utilities/class.ilSystemStyleSkinContainer.php");
4 include_once(
"Services/Style/System/classes/class.ilSystemStyleSettings.php");
5 include_once(
"Services/Style/System/classes/Utilities/class.ilSystemStyleConfig.php");
87 $skin_id = self::getCurrentSkin();
118 if ($DIC->isDependencyAvailable(
"systemStyle") && is_object($DIC->systemStyle()->getSkin())) {
119 return $DIC->systemStyle()->getSkin()->getId();
123 if ($DIC->isDependencyAvailable(
"user") && is_object($DIC->user()) && property_exists($DIC->user(),
"skin")) {
124 $skin_id = $DIC->user()->skin;
125 if (!self::skinExists($skin_id)) {
127 $skin_id = $system_style_conf->getDefaultSkinId();
141 return $this->
getSkin()->getStyles();
150 return $this->
getSkin()->getName();
161 return $this->
getSkin()->getStyle($a_id);
171 return $this->
getSkin()->getStyle($a_id)->getName();
187 return $this->
getSkin()->getStyle($style_id)->getImageDirectory();
197 return $this->
getSkin()->getStyle($style_id)->getSoundDirectory();
222 foreach ($cust_skins_directory as $skin_folder) {
223 if ($skin_folder->isDir()) {
224 $template_path = $skin_folder->getRealPath() .
"/template.xml";
225 if (file_exists($template_path)) {
226 $skin = ilSkinXML::parseFromXML($template_path);
247 return self::getAllSkins();
287 if (self::$current_style) {
288 return self::$current_style;
291 if (!$DIC || !$DIC->isDependencyAvailable(
"user")) {
295 self::setCurrentStyle($DIC->user()->prefs[
'style']);
297 if ($DIC->isDependencyAvailable(
"systemStyle") && self::styleExistsForCurrentSkin(self::$current_style)) {
298 if ($DIC->systemStyle()->getSkin()->hasStyleSubstyles(self::$current_style)) {
301 if (count($assignments) > 0) {
303 foreach ($assignments as $a) {
304 if ($DIC->systemStyle()->getSkin()->hasStyle($a[
"substyle"])) {
305 $ref_ass[$a[
"ref_id"]] = $a[
"substyle"];
310 if (
$_GET[
"ref_id"]) {
311 $ref_id =
$_GET[
"ref_id"];
312 } elseif (
$_GET[
"target"]) {
318 if ($DIC->isDependencyAvailable(
"repositoryTree") && $ref_id && $DIC->repositoryTree()->isInTree($ref_id)) {
319 $path = $DIC->repositoryTree()->getPathId($ref_id);
321 if (isset($ref_ass[
$path[
$i]])) {
322 self::$current_style = $ref_ass[
$path[
$i]];
323 return self::$current_style;
331 if (!self::styleExistsForCurrentSkin(self::$current_style)) {
332 ilUtil::sendFailure($DIC->language()->txt(
"set_style_does_not_exist") .
" " . self::$current_style);
334 self::setCurrentSkin($system_style_config->getDefaultSkinId());
335 self::setCurrentStyle($system_style_config->getDefaultStyleId());
338 return self::$current_style;
352 if (!self::getCachedAllStylesInformation()) {
355 $skins = $DIC->systemStyle()->getSkins();
358 foreach ($skin->getStyles() as
$style) {
362 if (
$style->getSubstyleOf()) {
363 $parent_name = $skin->getStyle(
$style->getSubstyleOf())->getName();
367 $all_styles[$skin->getId() .
":" .
$style->getId()] = [
368 "title" => $skin->getName() .
" / " .
$style->getName(),
369 "id" => $skin->getId() .
":" .
$style->getId(),
370 "skin_id" => $skin->getId(),
371 "skin_name" => $skin->getName(),
372 "template_id" => $skin->getId(),
373 "template_name" => $skin->getName(),
374 "style_id" =>
$style->getId(),
375 "style_name" =>
$style->getName(),
376 "substyle_of" =>
$style->getSubstyleOf(),
377 "substyle_of_name" => $parent_name,
378 "users" => $num_users
382 self::setCachedAllStylesInformation($all_styles);
385 return self::getCachedAllStylesInformation();
397 if ($DIC->isDependencyAvailable(
"systemStyle") && $DIC->systemStyle()->getSkin()->getName() != $a_skin) {
399 if (!self::styleExistsForCurrentSkin(self::$current_style)) {
400 $styleDefinition->setCurrentStyle($DIC->systemStyle()->getSkin()->getDefaultStyle()->getId());
413 foreach (self::getSkins() as
$skin) {
414 if ($skin->hasStyle($style_id)) {
429 if (!self::skinExists($skin_id)) {
433 return $skin->hasStyle($style_id);
444 return $DIC->systemStyle()->getSkin()->hasStyle($style_id);
452 self::$current_style = $a_style;
461 return self::getAllSkins();
493 return self::$cached_all_styles_information;
static _getNumberOfUsersForStyle($a_skin, $a_style)
skins and styles
static styleExists($style_id)
static getSystemStyleCategoryAssignments($a_skin_id, $a_style_id)
Get all system sub styles category assignments.
static getCachedAllStylesInformation()
static styleExistsForSkinId($skin_id, $style_id)
static $cached_all_styles_information
getImageDirectory($style_id)
setSystemStylesConf($system_style_config)
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
static setCurrentSkin($a_skin)
Class for advanced editing exception handling in ILIAS.
static skinExists($skin_id, ilSystemStyleConfig $system_style_config=null)
Check whether a skin exists.
static generateFromId($skin_id, ilSystemStyleMessageStack $message_stack=null, ilSystemStyleConfig $system_styles_conf=null)
Generate the container class by parsing the corresponding XML.
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
ilSystemStyleConfig wraps all 'constants' to ensure the testability of all classes using those 'const...
__construct($skin_id="", ilSystemStyleConfig $system_style_config=null)
ilStyleDefinition constructor.
static setCachedAllStylesInformation($cached_all_styles_information)
ilStyleDefinition acts as a wrapper of style related actions.
static getCurrentStyle()
get the current style or sub style
static styleExistsForCurrentSkin($style_id)
getSoundDirectory($style_id)
static setCurrentStyle($a_style)