ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
class.ilSystemStyleHTMLExport.php
Go to the documentation of this file.
1<?php
2/* Copyright (c) 1998-2011 ILIAS open source, Extended GPL, see docs/LICENSE */
3
12{
13 private $exp_dir = "";
14 private $images = array();
15
21 function __construct($a_exp_dir)
22 {
23 $this->exp_dir = $a_exp_dir;
24 $this->style_dir = $a_exp_dir."/style";
25 $this->style_img_dir = $a_exp_dir."/style/images";
26 $this->img_dir = $a_exp_dir."/images";
27 $this->img_browser_dir = $a_exp_dir."/images/browser";
28
29 // add standard images
30 $this->addImage("enlarge.svg");
31 $this->addImage("browser/blank.png", "/browser/plus.png");
32 $this->addImage("browser/blank.png", "/browser/minus.png");
33 $this->addImage("browser/blank.png", "/browser/blank.png");
34 $this->addImage("spacer.png");
35 $this->addImage("icon_st.svg");
36 $this->addImage("icon_pg.svg");
37 $this->addImage("icon_lm.svg");
38 $this->addImage("nav_arr_L.png");
39 $this->addImage("nav_arr_R.png");
40 }
41
46 {
47 ilUtil::makeDir($this->style_dir);
48 ilUtil::makeDir($this->style_img_dir);
49 ilUtil::makeDir($this->img_dir);
50 ilUtil::makeDir($this->img_browser_dir);
51 }
52
59 function addImage($a_file, $a_exp_file_name = "")
60 {
61 $this->images[] = array("file" => $a_file,
62 "exp_file_name" => $a_file);
63 }
64
71 function export()
72 {
73 global $ilUser;
74
75 $this->createDirectories();
76
77 // export system style sheet
78 $location_stylesheet = ilUtil::getStyleSheetLocation("filesystem");
79 $style_name = $ilUser->prefs["style"].".css";
80 copy($location_stylesheet, $this->style_dir."/".$style_name);
81 $fh = fopen($location_stylesheet, "r");
82 $css = fread($fh, filesize($location_stylesheet));
83 preg_match_all("/url\‍(([^\‍)]*)\‍)/",$css,$files);
84 foreach (array_unique($files[1]) as $fileref)
85 {
86 $fileref = dirname($location_stylesheet)."/".$fileref;
87 if (is_file($fileref))
88 {
89 copy($fileref, $this->style_img_dir."/".basename($fileref));
90 }
91 }
92 fclose($fh);
93
94 // export (icon) images
95 foreach ($this->images as $im)
96 {
97 $from = $to = $im["file"];
98 if ($im["exp_file_name"] != "")
99 {
100 $to = $im["exp_file_name"];
101 }
102 copy(ilUtil::getImagePath($from, false, "filesystem"),
103 $this->img_dir."/".$to);
104 }
105 }
106
107}
108
109?>
HTML export class for system styles.
__construct($a_exp_dir)
Initialisation.
addImage($a_file, $a_exp_file_name="")
Add (icon) image to the list of images to be exported.
static getStyleSheetLocation($mode="output", $a_css_name="", $a_css_location="")
get full style sheet file name (path inclusive) of current user
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
static makeDir($a_dir)
creates a new directory and inherits all filesystem permissions of the parent directory You may pass ...
global $ilUser
Definition: imgupload.php:15