ILIAS  release_8 Revision v8.24
ilSkinFactory Class Reference

Factory to create Skin classes holds an manages the basic data of a skin as provide by the template of the skin. More...

+ Collaboration diagram for ilSkinFactory:

Public Member Functions

 __construct (ilLanguage $lng, ?ilSystemStyleConfig $config=null)
 
 skinStyleContainerFromId (string $skin_id, ilSystemStyleMessageStack $message_stack)
 Get container class is responsible for all file system related actions related actions of a skin such as copying files and folders, generating a new skin, deleting a skin etc. More...
 
 skinStyleContainerFromZip (string $import_zip_path, string $name, ilSystemStyleMessageStack $message_stack)
 Imports a skin from zip. More...
 
 copyFromSkinStyleContainer (ilSkinStyleContainer $container, ilFileSystemHelper $file_system, ilSystemStyleMessageStack $message_stack, string $new_skin_txt_addon='Copy')
 Copies a complete Skin. More...
 

Protected Attributes

ilSystemStyleConfig $config
 
ilLanguage $lng
 

Detailed Description

Factory to create Skin classes holds an manages the basic data of a skin as provide by the template of the skin.

Definition at line 24 of file class.ilSkinFactory.php.

Constructor & Destructor Documentation

◆ __construct()

ilSkinFactory::__construct ( ilLanguage  $lng,
?ilSystemStyleConfig  $config = null 
)

Definition at line 29 of file class.ilSkinFactory.php.

30 {
31 $this->lng = $lng;
32
33 if ($config) {
34 $this->config = $config;
35 } else {
36 $this->config = new ilSystemStyleConfig();
37 }
38 }
ilSystemStyleConfig $config
ilSystemStyleConfig wraps all 'constants' to ensure the testability of all classes using those 'const...

References $config, $lng, and ILIAS\Repository\lng().

+ Here is the call graph for this function:

Member Function Documentation

◆ copyFromSkinStyleContainer()

ilSkinFactory::copyFromSkinStyleContainer ( ilSkinStyleContainer  $container,
ilFileSystemHelper  $file_system,
ilSystemStyleMessageStack  $message_stack,
string  $new_skin_txt_addon = 'Copy' 
)

Copies a complete Skin.

Exceptions
ilSystemStyleException

Definition at line 142 of file class.ilSkinFactory.php.

148 $new_skin_id_addon = '';
149 $new_skin_name_addon = '';
150
152 $container->getSkin()->getId() . $new_skin_id_addon,
153 $container->getSystemStylesConf()
154 )) {
155 $new_skin_id_addon .= $new_skin_txt_addon;
156 $new_skin_name_addon .= ' ' . $new_skin_txt_addon;
157 }
158
159 $new_skin_path = rtrim($container->getSkinDirectory(), '/') . $new_skin_id_addon;
160
161 mkdir($new_skin_path, 0775, true);
162 $file_system->recursiveCopy($container->getSkinDirectory(), $new_skin_path);
163 $skin_container = $this->skinStyleContainerFromId($container->getSkin()->getId() . $new_skin_id_addon, $message_stack);
164 $skin_container->getSkin()->setName($skin_container->getSkin()->getName() . $new_skin_name_addon);
165 $skin_container->getSkin()->setVersion('0.1');
166 $skin_container->updateSkin($skin_container->getSkin());
167 return $skin_container;
168 }
recursiveCopy(string $src, string $dest)
Recursive copy of a folder.
skinStyleContainerFromId(string $skin_id, ilSystemStyleMessageStack $message_stack)
Get container class is responsible for all file system related actions related actions of a skin such...
This class is responsible for all file system related actions related actions of a skin such as copyi...
static skinExists(string $skin_id, ?ilSystemStyleConfig $system_style_config=null)
Check whether a skin exists.
$container
@noRector
Definition: wac.php:14

◆ skinStyleContainerFromId()

ilSkinFactory::skinStyleContainerFromId ( string  $skin_id,
ilSystemStyleMessageStack  $message_stack 
)

Get container class is responsible for all file system related actions related actions of a skin such as copying files and folders, generating a new skin, deleting a skin etc.

Exceptions
ilSystemStyleException

Definition at line 85 of file class.ilSkinFactory.php.

89 if (!$skin_id) {
91 }
92
93 if ($skin_id != 'default') {
94 return new ilSkinStyleContainer(
95 $this->lng,
96 $this->skinFromXML($this->config->getCustomizingSkinPath() . $skin_id . '/template.xml'),
97 $message_stack,
98 $this->config
99 );
100 } else {
101 return new ilSkinStyleContainer(
102 $this->lng,
103 $this->skinFromXML($this->config->getDefaultTemplatePath()),
104 $message_stack,
105 $this->config,
106 );
107 }
108 }
Class for advanced editing exception handling in ILIAS.

References ilSystemStyleException\NO_SKIN_ID.

Referenced by ilSystemStyleOverviewGUI\__construct(), and ilSystemStyleIconsGUI\__construct().

+ Here is the caller graph for this function:

◆ skinStyleContainerFromZip()

ilSkinFactory::skinStyleContainerFromZip ( string  $import_zip_path,
string  $name,
ilSystemStyleMessageStack  $message_stack 
)

Imports a skin from zip.

Exceptions
ilSystemStyleException

Definition at line 114 of file class.ilSkinFactory.php.

119 $skin_id = preg_replace('/[^A-Za-z0-9\-_]/', '', rtrim($name, '.zip'));
120
121 while (ilStyleDefinition::skinExists($skin_id, $this->config)) {
122 $skin_id .= 'Copy';
123 }
124
125 $skin_path = $this->config->getCustomizingSkinPath() . $skin_id;
126
127 mkdir($skin_path, 0775, true);
128
129 $temp_zip_path = $skin_path . '/' . $name;
130 rename($import_zip_path, $temp_zip_path);
131
132 ilFileUtils::unzip($temp_zip_path);
133 unlink($temp_zip_path);
134
135 return $this->skinStyleContainerFromId($skin_id, $message_stack);
136 }
static unzip(string $path_to_zip_file, bool $overwrite_existing=false, bool $unpack_flat=false)
if($format !==null) $name
Definition: metadata.php:247

Field Documentation

◆ $config

ilSystemStyleConfig ilSkinFactory::$config
protected

Definition at line 26 of file class.ilSkinFactory.php.

Referenced by __construct().

◆ $lng

ilLanguage ilSkinFactory::$lng
protected

Definition at line 27 of file class.ilSkinFactory.php.

Referenced by __construct().


The documentation for this class was generated from the following file: