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");
86 $skin_id = self::getCurrentSkin();
110 public static function getCurrentSkin()
116 global
$DIC,$ilias, $styleDefinition;
118 if (is_object($styleDefinition) && is_object($styleDefinition->getSkin())) {
119 return $styleDefinition->getSkin()->getId();
123 if (is_object($ilias) && is_object($ilias->account) && property_exists($ilias->account,
"skin")) {
124 $skin_id = $ilias->account->skin;
125 if (!self::skinExists($skin_id)) {
127 $skin_id = $system_style_conf->getDefaultSkinId();
141 return $this->
getSkin()->getStyles();
150 return $this->
getSkin()->getName();
160 return $this->
getSkin()->getStyle($a_id);
169 return $this->
getSkin()->getStyle($a_id)->getName();
185 return $this->
getSkin()->getStyle($style_id)->getImageDirectory();
194 return $this->
getSkin()->getStyle($style_id)->getSoundDirectory();
219 foreach ($cust_skins_directory as $skin_folder) {
220 if ($skin_folder->isDir()) {
221 $template_path = $skin_folder->getRealPath() .
"/template.xml";
222 if (file_exists($template_path)) {
223 $skin = ilSkinXML::parseFromXML($template_path);
242 return self::getAllSkins();
277 public static function getCurrentStyle()
284 global $ilias, $styleDefinition, $tree;
286 if (self::$current_style) {
287 return self::$current_style;
290 if (!is_object($ilias)) {
294 self::setCurrentStyle($ilias->account->prefs[
'style']);
296 if (is_object($styleDefinition) && self::styleExistsForCurrentSkin(self::$current_style)) {
297 if ($styleDefinition->getSkin()->hasStyleSubstyles(self::$current_style)) {
300 if (count($assignments) > 0) {
302 foreach ($assignments as $a) {
303 if ($styleDefinition->getSkin()->hasStyle($a[
"substyle"])) {
304 $ref_ass[$a[
"ref_id"]] = $a[
"substyle"];
309 if (
$_GET[
"ref_id"]) {
310 $ref_id =
$_GET[
"ref_id"];
311 } elseif (
$_GET[
"target"]) {
317 if (is_object($tree) && $ref_id && $tree->isInTree($ref_id)) {
318 $path = $tree->getPathId($ref_id);
320 if (isset($ref_ass[
$path[
$i]])) {
321 self::$current_style = $ref_ass[
$path[
$i]];
322 return self::$current_style;
330 if (!self::styleExistsForCurrentSkin(self::$current_style)) {
331 ilUtil::sendFailure($DIC->language()->txt(
"set_style_does_not_exist") .
" " . self::$current_style);
333 self::setCurrentSkin($system_style_config->getDefaultSkinId());
334 self::setCurrentStyle($system_style_config->getDefaultStyleId());
337 return self::$current_style;
346 public static function getAllSkinStyles()
351 global $styleDefinition;
355 if (!self::getCachedAllStylesInformation()) {
358 $skins = $styleDefinition->getSkins();
361 foreach ($skin->getStyles() as
$style) {
365 if (
$style->getSubstyleOf()) {
366 $parent_name = $skin->getStyle(
$style->getSubstyleOf())->getName();
370 $all_styles[$skin->getId() .
":" .
$style->getId()] = [
371 "title" => $skin->getName() .
" / " .
$style->getName(),
372 "id" => $skin->getId() .
":" .
$style->getId(),
373 "skin_id" => $skin->getId(),
374 "skin_name" => $skin->getName(),
375 "template_id" => $skin->getId(),
376 "template_name" => $skin->getName(),
377 "style_id" =>
$style->getId(),
378 "style_name" =>
$style->getName(),
379 "substyle_of" =>
$style->getSubstyleOf(),
380 "substyle_of_name" => $parent_name,
381 "users" => $num_users
385 self::setCachedAllStylesInformation($all_styles);
388 return self::getCachedAllStylesInformation();
395 public static function setCurrentSkin($a_skin)
400 global $styleDefinition;
402 if (is_object($styleDefinition) && $styleDefinition->getSkin()->getName() != $a_skin) {
404 if (!self::styleExistsForCurrentSkin(self::$current_style)) {
405 $styleDefinition->setCurrentStyle($styleDefinition->getSkin()->getDefaultStyle()->getId());
417 foreach (self::getSkins() as
$skin) {
418 if ($skin->hasStyle($style_id)) {
433 if (!self::skinExists($skin_id)) {
437 return $skin->hasStyle($style_id);
444 public static function styleExistsForCurrentSkin($style_id)
449 global $styleDefinition;
451 return $styleDefinition->getSkin()->hasStyle($style_id);
459 self::$current_style = $a_style;
467 return self::getAllSkins();
499 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)
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.
getSoundDirectory($style_id)
static setCurrentStyle($a_style)