19 declare(strict_types=1);
58 if (!$system_styles_conf) {
83 foreach ($this->
getSkin()->getStyles() as $style) {
84 $old_style =
new ilSkinStyle(
'',
'',
'-',
'-',
'-',
'-');
99 $old_customizing_skin_directory = $this->
getSystemStylesConf()->getCustomizingSkinPath() . $old_skin->getId() .
'/';
102 if ($old_skin->getId() != $this->
getSkin()->getId()) {
103 $this->file_system->move($old_customizing_skin_directory, $this->
getSkinDirectory());
116 $style = $this->
getSkin()->getStyle($style_id);
122 if ($style->getId().
"/".$style->getImageDirectory() != $old_style->
getId().
"/".$old_style->
getImageDirectory()
125 $this->file_system->changeResourceDirectory(
127 $style->getId().
"/".$style->getImageDirectory(),
131 $this->file_system->createResourceDirectory(
138 if ($style->getId().
"/".$style->getFontDirectory() != $old_style->
getId().
"/".$old_style->
getFontDirectory()
141 $this->file_system->changeResourceDirectory(
143 $style->getId().
"/".$style->getFontDirectory(),
147 $this->file_system->createResourceDirectory(
154 if ($style->getId().
"/".$style->getSoundDirectory() != $old_style->
getId().
"/".$old_style->
getSoundDirectory()
157 $this->file_system->changeResourceDirectory(
159 $style->getId().
"/".$style->getSoundDirectory(),
163 $this->file_system->createResourceDirectory(
170 if($style->getId() != $old_style->
getId()) {
172 $this->file_system->changeResourceDirectory(
232 $replacement_start =
"// ## Begin Replacement Variables";
233 $replacement_end =
"// ## End Replacement Variables";
237 if(!is_file(
$path)) {
240 $main_scss_content = file_get_contents(
$path);
243 $regex_part_to_replace_start =
"%$replacement_start.*?$replacement_end%s";
245 $replacement =
$settings->getVariablesForDelosOverride();
246 $new_variabales_content =
"$replacement_start $replacement $replacement_end";
248 $main_scss_content = preg_replace(
249 $regex_part_to_replace_start,
250 $new_variabales_content,
254 file_put_contents(
$path, $main_scss_content);
258 $this->
lng->txt(
'main_scss_created') .
' ' .
$path,
266 return "// # ITCSS structure 267 // Try to apply changes by only changing the variables in the settings 270 // Default Skin is loaded with the custom setting being applied. 272 $replacement_start .
"\n" .
273 $replacement_end .
"\n" .
275 "// Apply/load other styling changes here.";
287 $this->file_system->createResourceDirectory(
294 $settings->readAndreplaceContentOfFolder([
295 "@use \"../030-tools/" =>
"@use \"../../../../../../templates/default/030-tools/",
296 "@use \"../050-layout/" =>
"@use \"../../../../../../templates/default/050-layout/" 308 $this->file_system->createResourceDirectory(
325 public function delete():
void 327 $this->file_system->recursiveRemoveDir(self::getSkinDirectory());
349 $this->
lng->txt(
'style_assignments_deleted') .
' ' . $style->
getName(),
361 $this->file_system->removeResourceDirectory(
365 $this->file_system->removeResourceDirectory(
369 $this->file_system->removeResourceDirectory(
377 $this->
lng->txt(
'style_deleted') .
' ' . $style->
getName(),
402 $output_file = dirname($skin_directory) .
'/' . $this->
getSkin()->getId() .
'.zip';
418 $output = shell_exec(PATH_TO_SCSS .
' ' . $this->
getScssFilePath($style_id));
420 $Scss_error = shell_exec(PATH_TO_SCSS .
' ' . $this->
getScssFilePath($style_id) .
' 2>&1');
424 'Empty css output, unknown error.' 449 return $this->
getSkinDirectory() . $style_id .
"/".$this->getSkin()->getStyle($style_id)->getCssFile() .
'.css';
454 return $this->
getSkinDirectory() . $style_id .
"/".$this->getSkin()->getStyle($style_id)->getCssFile() .
'.scss';
459 return $this->
getSkinDirectory() . $style_id .
"/".$this->getScssSettingsFolderName();
464 return $this->system_styles_conf->getScssSettingsFolderName();
494 $this->
getSkin()->addStyle($style);
495 $old_style =
new ilSkinStyle(
'',
'',
'-',
'-',
'-',
'-');
const SKIN_ALREADY_EXISTS
setSystemStylesConf(ilSystemStyleConfig $system_styles_conf)
getScssSettingsPath(string $style_id)
getNewMainScssFileContent(string $replacement_start, string $replacement_end)
setMessageStack(ilSystemStyleMessageStack $message_stack)
createMainScssFile(ilSkinStyle $style)
Creates the main Scss file.
createScssStructure(ilSkinStyle $style)
Creates the Scss/css structure of a style.
ilSystemStyleConfig $system_styles_conf
Used to wire this component up with the correct pathes into the customizing directory.
addStyle(ilSkinStyle $style)
getCSSFilePath(string $style_id)
ilSystemStyleMessageStack $message_stack
Used to stack messages to be displayed to the user (mostly reports for failed actions) ...
getSoundsStylePath(string $style_id)
ilSkin $skin
Data-scope for the skin this container capsules.
File System Helper, to reduce deps.
resetImages(ilSkinStyle $style)
Copies (resets) the images from delos.
This class is responsible for all file system related actions related actions of a skin such as copyi...
getScssSettingsFolderName()
copySettingsFromDefault(ilSkinStyle $style)
Copies (resets) the settings files from delos.
getScssFilePath(string $style_id)
static deliverFileAttached(string $path_to_file, ?string $download_file_name=null, ?string $mime_type=null, bool $delete_file=false)
static deleteSubStyleCategoryAssignments(string $a_skin_id, string $a_style_id, string $a_substyle)
Delets a sub styles category assignment.
deleteStyle(ilSkinStyle $style)
Deletes a style completely.
copyCSSFromDefault(ilSkinStyle $style)
Copies (resets) the images from delos.
createTempZip()
Creates a temp zip file.
ilFileSystemHelper $file_system
updateStyle(string $style_id, ilSkinStyle $old_style)
Updates one single style.
ilSystemStyleConfig wraps all 'constants' to ensure the testability of all classes using those 'const...
isSubstyle()
Return wheter this style is a substyle of another.
create(ilSystemStyleMessageStack $message_stack)
Creates a new skin.
getFontsStylePath(string $style_id)
static zip(string $a_dir, string $a_file, bool $compress_content=false)
export()
Exports the complete skin to an zip file.
Used to stack messages to be shown to the user.
const SCSS_COMPILE_FAILED
compileScss(string $style_id)
__construct(ilLanguage $lng, ilSkin $skin, ilSystemStyleMessageStack $message_stack, ilSystemStyleConfig $system_styles_conf=null, ilFileSystemHelper $file_system=null)
getSubstyleOf()
Returns the parent style of this style if set.
getImagesStylePath(string $style_id)
updateSkin(ilSkin $old_skin=null)
Updates the skin.
ilSkin holds an manages the basic data of a skin as provide by the template of the skin...