ILIAS  release_4-4 Revision
All Data Structures Namespaces Files Functions Variables Modules Pages
ilSystemStyleHTMLExport Class Reference

HTML export class for system styles. More...

+ Collaboration diagram for ilSystemStyleHTMLExport:

Public Member Functions

 __construct ($a_exp_dir)
 Initialisation. More...
 
 createDirectories ()
 Create directories. More...
 
 addImage ($a_file, $a_exp_file_name="")
 Add (icon) image to the list of images to be exported. More...
 
 export ()
 Export. More...
 

Private Attributes

 $exp_dir = ""
 
 $images = array()
 

Detailed Description

HTML export class for system styles.

Author
Alex Killing alex..nosp@m.kill.nosp@m.ing@g.nosp@m.mx.d.nosp@m.e
Version
Id

Definition at line 11 of file class.ilSystemStyleHTMLExport.php.

Constructor & Destructor Documentation

◆ __construct()

ilSystemStyleHTMLExport::__construct (   $a_exp_dir)

Initialisation.

Parameters
string$a_exp_direxport directory

Definition at line 21 of file class.ilSystemStyleHTMLExport.php.

References addImage().

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.png");
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.png");
36  $this->addImage("icon_st_s.png");
37  $this->addImage("icon_pg.png");
38  $this->addImage("icon_pg_s.png");
39  $this->addImage("icon_lm.png");
40  $this->addImage("icon_lm_s.png");
41  $this->addImage("nav_arr_L.png");
42  $this->addImage("nav_arr_R.png");
43  $this->addImage("browser/forceexp.png");
44  $this->addImage("download.png");
45  }
addImage($a_file, $a_exp_file_name="")
Add (icon) image to the list of images to be exported.
+ Here is the call graph for this function:

Member Function Documentation

◆ addImage()

ilSystemStyleHTMLExport::addImage (   $a_file,
  $a_exp_file_name = "" 
)

Add (icon) image to the list of images to be exported.

Parameters

Definition at line 64 of file class.ilSystemStyleHTMLExport.php.

Referenced by __construct().

65  {
66  $this->images[] = array("file" => $a_file,
67  "exp_file_name" => $a_file);
68  }
+ Here is the caller graph for this function:

◆ createDirectories()

ilSystemStyleHTMLExport::createDirectories ( )

Create directories.

Definition at line 50 of file class.ilSystemStyleHTMLExport.php.

References ilUtil\makeDir().

Referenced by export().

51  {
52  ilUtil::makeDir($this->style_dir);
53  ilUtil::makeDir($this->style_img_dir);
54  ilUtil::makeDir($this->img_dir);
55  ilUtil::makeDir($this->img_browser_dir);
56  }
static makeDir($a_dir)
creates a new directory and inherits all filesystem permissions of the parent directory You may pass ...
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ export()

ilSystemStyleHTMLExport::export ( )

Export.

Parameters

Definition at line 76 of file class.ilSystemStyleHTMLExport.php.

References $ilUser, createDirectories(), ilUtil\getImagePath(), and ilUtil\getStyleSheetLocation().

77  {
78  global $ilUser;
79 
80  $this->createDirectories();
81 
82  // export system style sheet
83  $location_stylesheet = ilUtil::getStyleSheetLocation("filesystem");
84  $style_name = $ilUser->prefs["style"].".css";
85  copy($location_stylesheet, $this->style_dir."/".$style_name);
86  $fh = fopen($location_stylesheet, "r");
87  $css = fread($fh, filesize($location_stylesheet));
88  preg_match_all("/url\(([^\)]*)\)/",$css,$files);
89  foreach (array_unique($files[1]) as $fileref)
90  {
91  $fileref = dirname($location_stylesheet)."/".$fileref;
92  if (is_file($fileref))
93  {
94  copy($fileref, $this->style_img_dir."/".basename($fileref));
95  }
96  }
97  fclose($fh);
98 
99  // export (icon) images
100  foreach ($this->images as $im)
101  {
102  $from = $to = $im["file"];
103  if ($im["exp_file_name"] != "")
104  {
105  $to = $im["exp_file_name"];
106  }
107  copy(ilUtil::getImagePath($from, false, "filesystem"),
108  $this->img_dir."/".$to);
109  }
110  }
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)
global $ilUser
Definition: imgupload.php:15
+ Here is the call graph for this function:

Field Documentation

◆ $exp_dir

ilSystemStyleHTMLExport::$exp_dir = ""
private

Definition at line 13 of file class.ilSystemStyleHTMLExport.php.

◆ $images

ilSystemStyleHTMLExport::$images = array()
private

Definition at line 14 of file class.ilSystemStyleHTMLExport.php.


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