2 include_once(
"Services/Style/System/classes/Utilities/class.ilSkinStyleXML.php");
3 include_once(
"Services/Style/System/classes/class.ilStyleDefinition.php");
4 include_once(
"Services/Style/System/classes/Exceptions/class.ilSystemStyleException.php");
5 include_once(
"Services/Style/System/classes/Utilities/class.ilSystemStyleMessageStack.php");
6 include_once(
"Services/Style/System/classes/Utilities/class.ilSystemStyleMessage.php");
7 include_once(
"Services/Style/System/classes/Less/class.ilSystemStyleLessFile.php");
8 include_once(
"Services/Style/System/classes/Utilities/class.ilSystemStyleConfig.php");
58 $this->lng = $DIC->language();
93 if ($skin_id !=
"default")
139 $old_customizing_skin_directory = $this->
getSystemStylesConf()->getCustomizingSkinPath().$old_skin->getId().
"/";
228 $references_ids =
array();
230 if($style->referencesResource($resource)){
231 $references_ids[] = $style->getId();
234 return $references_ids;
248 mkdir(
$path,0777,
true);
251 self::xCopy($source,
$path);
270 if(file_exists($absolut_new_dir)){
280 mkdir($absolut_new_dir,0777,
true);
281 self::xCopy($absolut_old_dir, $absolut_new_dir);
283 new ilSystemStyleMessage($this->lng->txt(
"dir_copied_from").
" ".$absolut_old_dir.
" ".$this->lng->txt(
"to").
" ".$absolut_new_dir,
287 self::recursiveRemoveDir(self::getSkinDirectory().$old_dir);
309 if(file_exists($absolut_dir)) {
393 foreach (scandir($src) as
$file) {
394 $src_file = rtrim($src,
'/') .
'/' .
$file;
395 $dest_file = rtrim($dest,
'/') .
'/' .
$file;
396 if (!is_readable($src_file)) {
399 if (substr($file, 0, 1) !=
".") {
400 if (is_dir($src_file)) {
401 if (!file_exists($dest_file)) {
408 self::xCopy($src_file, $dest_file);
411 copy($src_file,$dest_file);
427 $objects = scandir($dir);
428 foreach ($objects as $object) {
429 if ($object !=
"." && $object !=
"..") {
430 if (is_dir($dir.
"/".$object))
431 self::recursiveRemoveDir($dir.
"/".$object);
433 unlink($dir.
"/".$object);
449 $less_delos_import = str_replace(
"./",
"../../../../",$less_delos_import);
450 $content =
"@import \"".$less_delos_import.
"\";\n";
452 $content .=
"// Import Custom Less Files here\n";
454 $content .=
"@import \"".$this->getLessVariablesName($style->
getId()).
"\";\n";
464 public function move($from,$to){
472 public function delete(){
473 self::recursiveRemoveDir(self::getSkinDirectory());
486 if(file_exists(
$path)){
533 $new_skin_id_addon =
"";
536 $new_skin_id_addon .=
"Copy";
541 mkdir($new_skin_path,0777,
true);
561 $rel_tmp_zip =
"../".$this->getSkin()->getId().
".zip";
578 if(!$system_styles_conf){
582 $skin_id = preg_replace(
'/[^A-Za-z0-9\-_]/',
'', rtrim($name,
".zip"));
588 $skin_path = $system_styles_conf->getCustomizingSkinPath().$skin_id;
589 mkdir($skin_path,0777,
true);
591 $temp_zip_path = $skin_path.
"/".$name;
593 move_uploaded_file ( $import_zip_path ,$temp_zip_path );
595 rename( $import_zip_path ,$temp_zip_path );
598 unlink($temp_zip_path);
600 return self::generateFromId($skin_id,$message_stack,$system_styles_conf);
609 $main_less_content = file_get_contents($main_path);
610 $main_less_content = str_replace(
"@import \"".$old_style_import,
611 "@import \"".$new_style_import,
613 file_put_contents($main_path,$main_less_content);
626 $output = shell_exec(PATH_TO_LESSC.
" ".$this->getLessFilePath($style_id));
628 $less_error = shell_exec(PATH_TO_LESSC.
" ".$this->getLessFilePath($style_id).
" 2>&1");
657 return $this->
getSystemStylesConf()->getCustomizingSkinPath().$this->getSkin()->getId().
"/";
666 return $this->
getSkinDirectory().$this->getSkin()->getStyle($style_id)->getCssFile().
".css";
674 return $this->
getSkinDirectory().$this->getSkin()->getStyle($style_id)->getCssFile().
".less";
690 return $this->
getSkin()->getStyle($style_id)->getCssFile().
"-variables.less";
698 return $this->
getSkinDirectory().$this->getSkin()->getStyle($style_id)->getImageDirectory();
706 return self::$message_stack;
721 $this->
getSkin()->addStyle($style);
move($from, $to)
Used to move a complete directory of a skin.
createLessStructure(ilSkinStyleXML $style)
Creates the less/css structure of a style.
const SKIN_ALREADY_EXISTS
updateSkin(ilSkinXML $old_skin)
Updates the skin.
createTempZip()
Creates a temp zip file.
const LESSC_NOT_INSTALLED
setSystemStylesConf($system_styles_conf)
deleteStyle(ilSkinStyleXML $style)
Deletes a style completely.
getLessFilePath($style_id)
This class is responsible for all file system related actions related actions of a skin such as copyi...
removeResourceDirectory($dir)
Deletes a resource directory.
create(ilSystemStyleMessageStack $message_stack)
Creates a new skin.
getSubstyleOf()
Returns the parent style of this style if set.
getLessVariablesFilePath($style_id)
deleteFile($path)
Deletes a given file in the container.
const FOLDER_CREATION_FAILED
static unzip($a_file, $overwrite=false, $a_flat=false)
unzip file
addMessage(ilSystemStyleMessage $message)
Add a message to be displayed by the stack.
ilSkinXml holds an manages the basic data of a skin as provide by the template of the skin...
getLessMainFileDefautContent(ilSkinStyleXML $style)
Returns the main less default content if a new style is created.
getImagesSkinPath($style_id)
createMainLessFile(ilSkinStyleXML $style)
Creates the main less file.
const FILE_CREATION_FAILED
isSubstyle()
Return wheter this style is a substyle of another.
if(!is_dir( $entity_dir)) exit("Fatal Error ([A-Za-z0-9]+)\+" &#(? foreach( $entity_files as $file) $output
updateStyle($style_id, ilSkinStyleXML $old_style)
Updates one single style.
getLessVariablesName($style_id)
static deliverFileAttached($path_to_file, $download_file_name=null, $mime_type=null, $delete_file=false)
addStyle(ilSkinStyleXML $style)
static setMessageStack($message_stack)
createResourceDirectory($source, $target)
Creates a resource directory (sound, images or fonts) by copying from the source (mostly delos) ...
static recursiveRemoveDir($dir)
Recursive delete of a folder.
copyCSSFromDefault(ilSkinStyleXML $style)
Copies (resets) the images from delos.
static deleteSubStyleCategoryAssignments($a_skin_id, $a_style_id, $a_substyle)
Delets a sub styles category assignment.
Class for advanced editing exception handling in ILIAS.
const FILE_OPENING_FAILED
static zip($a_dir, $a_file, $compress_content=false)
zips given directory/file into given zip.file
static skinExists($skin_id, ilSystemStyleConfig $system_style_config=null)
Check whether a skin exists.
Create styles array
The data for the language used.
static generateFromId($skin_id, ilSystemStyleMessageStack $message_stack=null, ilSystemStyleConfig $system_styles_conf=null)
Generate the container class by parsing the corresponding XML.
copyVariablesFromDefault(ilSkinStyleXML $style)
Copies (resets) the variables file from delos.
ilSystemStyleConfig wraps all 'constants' to ensure the testability of all classes using those 'const...
__construct(ilSkinXML $skin, ilSystemStyleMessageStack $message_stack=null, ilSystemStyleConfig $system_styles_conf=null)
ilSystemStyleSkinContainer constructor.
changeResourceDirectory($new_dir, $old_dir)
Alters the name/path of a resource directory.
resourcesStyleReferences($resource)
Checks if a given resource (folder) is still referenced by a style of the containers skin...
Used to stack messages to be shown to the user.
changeVariablesImport($main_path, $old_style_import, $new_style_import)
resetImages(ilSkinStyleXML $style)
Copies (resets) the images from delos.
getCSSFilePath($style_id)
const LESS_COMPILE_FAILED
if(!file_exists("$old.txt")) if($old===$new) if(file_exists("$new.txt")) $file
copy()
Copies a complete Skin.
export()
Exports the complete skin to an zip file.
static xCopy($src, $dest)
Recursive copy of a folder.