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();
112 public static function getCurrentSkin()
118 global
$DIC,$ilias, $styleDefinition;
120 if(is_object($styleDefinition) && is_object($styleDefinition->getSkin())){
121 return $styleDefinition->getSkin()->getId();
126 if (is_object($ilias) && is_object($ilias->account) && property_exists($ilias->account,
"skin")) {
127 $skin_id = $ilias->account->skin;
128 if(!self::skinExists($skin_id)){
130 $skin_id = $system_style_conf->getDefaultSkinId();
144 return $this->
getSkin()->getStyles();
153 return $this->
getSkin()->getName();
163 return $this->
getSkin()->getStyle($a_id);
172 return $this->
getSkin()->getStyle($a_id)->getName();
188 return $this->
getSkin()->getStyle($style_id)->getImageDirectory();
197 return $this->
getSkin()->getStyle($style_id)->getSoundDirectory();
220 $cust_skins_directory =
new RecursiveDirectoryIterator(
$system_style_config->getCustomizingSkinPath(),FilesystemIterator::SKIP_DOTS);
221 foreach ($cust_skins_directory as $skin_folder) {
222 if($skin_folder->isDir()){
223 $template_path = $skin_folder->getRealPath().
"/template.xml";
224 if (file_exists($template_path))
226 $skin = ilSkinXML::parseFromXML($template_path);
244 return self::getAllSkins();
284 public static function getCurrentStyle()
291 global $ilias, $styleDefinition, $tree;
293 if (self::$current_style)
295 return self::$current_style;
298 if(!is_object($ilias))
303 self::setCurrentStyle($ilias->account->prefs[
'style']);
305 if (is_object($styleDefinition) && self::styleExistsForCurrentSkin(self::$current_style)) {
307 if ($styleDefinition->getSkin()->hasStyleSubstyles(self::$current_style)) {
310 if (count($assignments) > 0) {
312 foreach ($assignments as $a) {
313 if($styleDefinition->getSkin()->hasStyle($a[
"substyle"]))
314 $ref_ass[$a[
"ref_id"]] = $a[
"substyle"];
318 if (
$_GET[
"ref_id"]) {
320 }
else if (
$_GET[
"target"]) {
329 for ($i = count(
$path) - 1; $i >= 0; $i--) {
330 if (isset($ref_ass[
$path[$i]])) {
331 self::$current_style = $ref_ass[
$path[$i]];
332 return self::$current_style;
340 if(!self::styleExistsForCurrentSkin(self::$current_style)){
341 ilUtil::sendFailure($DIC->language()->txt(
"set_style_does_not_exist").
" ".self::$current_style);
343 self::setCurrentSkin($system_style_config->getDefaultSkinId());
344 self::setCurrentStyle($system_style_config->getDefaultStyleId());
347 return self::$current_style;
356 public static function getAllSkinStyles()
361 global $styleDefinition;
365 if(!self::getCachedAllStylesInformation()){
368 $skins = $styleDefinition->getSkins();
372 foreach ($skin->getStyles() as
$style)
377 if(
$style->getSubstyleOf()){
378 $parent_name = $skin->getStyle(
$style->getSubstyleOf())->getName();
382 $all_styles[$skin->getId().
":".
$style->getId()] = [
383 "title" => $skin->getName().
" / ".
$style->getName(),
384 "id" => $skin->getId().
":".
$style->getId(),
385 "skin_id" => $skin->getId(),
386 "skin_name" => $skin->getName(),
387 "template_id" => $skin->getId(),
388 "template_name" => $skin->getName(),
389 "style_id" =>
$style->getId(),
390 "style_name" =>
$style->getName(),
391 "substyle_of" =>
$style->getSubstyleOf(),
392 "substyle_of_name" => $parent_name,
393 "users" => $num_users
397 self::setCachedAllStylesInformation($all_styles);
401 return self::getCachedAllStylesInformation();
408 public static function setCurrentSkin($a_skin)
413 global $styleDefinition;
415 if (is_object($styleDefinition) && $styleDefinition->getSkin()->getName() != $a_skin)
418 if(!self::styleExistsForCurrentSkin(self::$current_style)){
419 $styleDefinition->setCurrentStyle($styleDefinition->getSkin()->getDefaultStyle()->getId());
430 foreach(self::getSkins() as
$skin)
432 if($skin->hasStyle($style_id)){
446 if(!self::skinExists($skin_id)){
450 return $skin->hasStyle($style_id);
457 public static function styleExistsForCurrentSkin($style_id){
461 global $styleDefinition;
463 return $styleDefinition->getSkin()->hasStyle($style_id);
471 self::$current_style = $a_style;
479 return self::getAllSkins();
511 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)