19declare(strict_types=1);
 
   83        foreach ($this->
getSkin()->getStyles() as $style) {
 
   84            $this->file_system->createResourceDirectory(
 
   88            $this->file_system->createResourceDirectory(
 
   92            $this->file_system->createResourceDirectory(
 
   98            } 
catch (Exception 
$e) {
 
  100                    $this->
lng->txt(
'less_compile_failed') . 
' ' . $e->getMessage(),
 
  117        $old_customizing_skin_directory = $this->
getSystemStylesConf()->getCustomizingSkinPath() . $old_skin->getId() . 
'/';
 
  120        if ($old_skin->getId() != $this->getSkin()->getId()) {
 
  121            $this->file_system->move($old_customizing_skin_directory, $this->
getSkinDirectory());
 
  134        $style = $this->
getSkin()->getStyle($style_id);
 
  137                $this->file_system->changeResourceDirectory(
 
  139                    $style->getImageDirectory(),
 
  144                $this->file_system->createResourceDirectory(
 
  153                $this->file_system->changeResourceDirectory(
 
  155                    $style->getFontDirectory(),
 
  160                $this->file_system->createResourceDirectory(
 
  169                $this->file_system->changeResourceDirectory(
 
  171                    $style->getSoundDirectory(),
 
  176                $this->file_system->createResourceDirectory(
 
  186                $this->getLessFilePath($style->getId())
 
  195                $this->getLessVariablesFilePath($style->getId())
 
  204            $this->getLessVariablesName($style->getId())
 
  210                $this->getCSSFilePath($style->getId())
 
  215            } 
catch (Exception 
$e) {
 
  234        $references_ids = [];
 
  235        foreach ($this->
getSkin()->getStyles() as $style) {
 
  236            if ($style->referencesResource($resource)) {
 
  237                $references_ids[] = $style->getId();
 
  240        return $references_ids;
 
  264                $this->
lng->txt(
'main_less_created') . 
' ' . 
$path,
 
  287        $this->file_system->createResourceDirectory(
 
  307        $content .= 
"// Import Custom Less Files here\n";
 
  316    public function delete(): 
void 
  318        $this->file_system->recursiveRemoveDir(self::getSkinDirectory());
 
  321                $this->
lng->txt(
'skin_deleted') . $this->getSkinDirectory(),
 
  340                    $this->
lng->txt(
'style_assignments_deleted') . 
' ' . $style->
getName(),
 
  352        $this->file_system->removeResourceDirectory(
 
  357        $this->file_system->removeResourceDirectory(
 
  362        $this->file_system->removeResourceDirectory(
 
  371                $this->
lng->txt(
'style_deleted') . 
' ' . $style->
getName(),
 
  395        $rel_tmp_zip = 
'../' . $this->
getSkin()->getId() . 
'.zip';
 
  402        string $old_style_import,
 
  403        string $new_style_import
 
  405        $main_less_content = file_get_contents($main_path);
 
  406        $main_less_content = str_replace(
 
  407            "@import \"" . $old_style_import,
 
  408            "@import \"" . $new_style_import,
 
  411        file_put_contents($main_path, $main_less_content);
 
  419        if (!PATH_TO_LESSC) {
 
  423        $output = shell_exec(PATH_TO_LESSC . 
' ' . $this->getLessFilePath($style_id));
 
  425            $less_error = shell_exec(PATH_TO_LESSC . 
' ' . $this->getLessFilePath($style_id) . 
' 2>&1');
 
  429                    'Empty css output, unknown error.' 
  434        file_put_contents($this->getCSSFilePath($style_id), $output);
 
  449        return $this->getSystemStylesConf()->getCustomizingSkinPath() . $this->getSkin()->getId() . 
'/';
 
  454        return $this->getSkinDirectory() . $this->getSkin()->getStyle($style_id)->getCssFile() . 
'.css';
 
  459        return $this->getSkinDirectory() . $this->getSkin()->getStyle($style_id)->getCssFile() . 
'.less';
 
  464        return $this->getSkinDirectory() . $this->getLessVariablesName($style_id);
 
  469        return $this->getSkin()->getStyle($style_id)->getCssFile() . 
'-variables.less';
 
  474        return $this->getSkinDirectory() . $this->getSkin()->getStyle($style_id)->getImageDirectory();
 
  479        return $this->message_stack;
 
  484        $this->message_stack = $message_stack;
 
  489        $this->getSkin()->addStyle($style);
 
  491        $this->updateStyle($style->
getId(), $old_style);
 
  496        $this->getSkin()->writeToXMLFile($this->getSkinDirectory() . 
'template.xml');
 
  501        return $this->system_styles_conf;
 
  506        $this->system_styles_conf = $system_styles_conf;
 
static deliverFileAttached(string $path_to_file, ?string $download_file_name=null, ?string $mime_type=null, bool $delete_file=false)
 
File System Helper, to reduce deps.
 
static zip(string $a_dir, string $a_file, bool $compress_content=false)
zips given directory/file into given zip.file
 
This class is responsible for all file system related actions related actions of a skin such as copyi...
 
getLessFilePath(string $style_id)
 
updateSkin(ilSkin $old_skin=null)
Updates the skin.
 
export()
Exports the complete skin to an zip file.
 
__construct(ilLanguage $lng, ilSkin $skin, ilSystemStyleMessageStack $message_stack, ilSystemStyleConfig $system_styles_conf=null, ilFileSystemHelper $file_system=null)
 
createLessStructure(ilSkinStyle $style)
Creates the less/css structure of a style.
 
getLessMainFileDefautContent(ilSkinStyle $style)
Returns the main less default content if a new style is created.
 
createTempZip()
Creates a temp zip file.
 
deleteStyle(ilSkinStyle $style)
Deletes a style completely.
 
getLessVariablesFilePath(string $style_id)
 
ilSystemStyleConfig $system_styles_conf
Used to wire this component up with the correct pathes into the customizing directory.
 
ilSkin $skin
Data-scope for the skin this container capsules.
 
addStyle(ilSkinStyle $style)
 
ilFileSystemHelper $file_system
 
create(ilSystemStyleMessageStack $message_stack)
Creates a new skin.
 
setSystemStylesConf(ilSystemStyleConfig $system_styles_conf)
 
getImagesSkinPath(string $style_id)
 
getCSSFilePath(string $style_id)
 
compileLess(string $style_id)
 
createMainLessFile(ilSkinStyle $style)
Creates the main less file.
 
getLessVariablesName(string $style_id)
 
resourcesStyleReferences(string $resource)
Checks if a given resource (folder) is still referenced by a style of the containers skin.
 
resetImages(ilSkinStyle $style)
Copies (resets) the images from delos.
 
ilSystemStyleMessageStack $message_stack
Used to stack messages to be displayed to the user (mostly reports for failed actions)
 
setMessageStack(ilSystemStyleMessageStack $message_stack)
 
updateStyle(string $style_id, ilSkinStyle $old_style)
Updates one single style.
 
copyVariablesFromDefault(ilSkinStyle $style)
Copies (resets) the variables file from delos.
 
copyCSSFromDefault(ilSkinStyle $style)
Copies (resets) the images from delos.
 
changeVariablesImport(string $main_path, string $old_style_import, string $new_style_import)
 
isSubstyle()
Return wheter this style is a substyle of another.
 
getSubstyleOf()
Returns the parent style of this style if set.
 
ilSkin holds an manages the basic data of a skin as provide by the template of the skin.
 
ilSystemStyleConfig wraps all 'constants' to ensure the testability of all classes using those 'const...
 
Class for advanced editing exception handling in ILIAS.
 
const LESSC_NOT_INSTALLED
 
const SKIN_ALREADY_EXISTS
 
const LESS_COMPILE_FAILED
 
Used to stack messages to be shown to the user.
 
addMessage(ilSystemStyleMessage $message)
Add a message to be displayed by the stack.
 
static deleteSubStyleCategoryAssignments(string $a_skin_id, string $a_style_id, string $a_substyle)
Delets a sub styles category assignment.