ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
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 = [];
15
21 public 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
45 public function createDirectories()
46 {
47 ilUtil::makeDir($this->style_dir);
48 ilUtil::makeDir($this->img_dir);
49 ilUtil::makeDir($this->img_browser_dir);
50 }
51
58 public function addImage($a_file, $a_exp_file_name = "")
59 {
60 $this->images[] = ["file" => $a_file,
61 "exp_file_name" => $a_exp_file_name];
62 }
63
67 public function export()
68 {
69 global $ilUser;
70
71 $this->createDirectories();
72
73 // export system style sheet
74 $location_stylesheet = ilUtil::getStyleSheetLocation("filesystem");
75 foreach (
76 $iterator = new \RecursiveIteratorIterator(
77 new \RecursiveDirectoryIterator(dirname($location_stylesheet), \RecursiveDirectoryIterator::SKIP_DOTS),
78 \RecursiveIteratorIterator::SELF_FIRST
79 ) as $item
80 ) {
81 if ($item->isDir()) {
82 mkdir($this->style_dir . DIRECTORY_SEPARATOR . $iterator->getSubPathName());
83 } else {
84 copy($item, $this->style_dir . DIRECTORY_SEPARATOR . $iterator->getSubPathName());
85 }
86 }
87
88 // export (icon) images
89 foreach ($this->images as $im) {
90 $from = $to = $im["file"];
91 if ($im["exp_file_name"] != "") {
92 $to = $im["exp_file_name"];
93 }
94 copy(
95 ilUtil::getImagePath($from, false, "filesystem"),
96 $this->img_dir . "/" . $to
97 );
98 }
99 }
100}
An exception for terminatinating execution or to throw for unit testing.
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 ...
$from
$ilUser
Definition: imgupload.php:18