ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
class.ilSkinStyleXML.php
Go to the documentation of this file.
1<?php
8{
13 protected $id = "";
14
20 protected $name = "";
21
27 protected $sound_directory = "";
28
34 protected $image_directory = "";
35
41 protected $font_directory = "";
42
48 protected $css_file = "";
49
55 protected $substyle_of = "";
56
68 public function __construct($id, $name, $css_file = "", $image_directory = "", $font_directory = "", $sound_directory = "", $parent_style = "")
69 {
70 $this->setId($id);
71 $this->setName($name);
72
73 if ($css_file == "") {
74 $css_file = $this->getId();
75 }
76
77 if ($image_directory == "") {
78 $image_directory = "images";
79 }
80
81 if ($font_directory == "") {
82 $font_directory = "fonts";
83 }
84
85 if ($sound_directory == "") {
86 $sound_directory = "sound";
87 }
88
89 $this->setCssFile($css_file);
93 $this->setSubstyleOf($parent_style);
94 }
95
101 public static function parseFromXMLElement(SimpleXMLElement $xml_element)
102 {
103 $style = new self(
104 (string) $xml_element->attributes()["id"],
105 (string) $xml_element->attributes()["name"],
106 (string) $xml_element->attributes()["css_file"],
107 (string) $xml_element->attributes()["image_directory"],
108 (string) $xml_element->attributes()["font_directory"],
109 (string) $xml_element->attributes()["sound_directory"]
110 );
111 return $style;
112 }
113
117 public function getId()
118 {
119 return $this->id;
120 }
121
126 public function setId($id)
127 {
128 if (strpos($id, ' ') !== false) {
130 }
131 $this->id = str_replace(" ", "_", $id);
132 }
133
137 public function getName()
138 {
139 return $this->name;
140 }
141
145 public function setName($name)
146 {
147 $this->name = $name;
148 }
149
153 public function getSoundDirectory()
154 {
156 }
157
162 {
163 $this->sound_directory = $sound_directory;
164 }
165
169 public function getImageDirectory()
170 {
172 }
173
178 {
179 $this->image_directory = $image_directory;
180 }
181
185 public function getCssFile()
186 {
187 return $this->css_file;
188 }
189
193 public function setCssFile($css_file)
194 {
195 $this->css_file = $css_file;
196 }
197
201 public function getFontDirectory()
202 {
204 }
205
210 {
211 $this->font_directory = $font_directory;
212 }
213
219 public function getSubstyleOf()
220 {
221 return $this->substyle_of;
222 }
223
230 {
231 $this->substyle_of = $substyle_of;
232 }
233
239 public function isSubstyle()
240 {
241 return $this->getSubstyleOf() != "";
242 }
243
250 public function referencesResource($resource)
251 {
252 return $this->getCssFile() == $resource
253 || $this->getImageDirectory() == $resource
254 || $this->getFontDirectory() == $resource
255 || $this->getSoundDirectory() == $resource;
256 }
257}
An exception for terminatinating execution or to throw for unit testing.
__construct($id, $name, $css_file="", $image_directory="", $font_directory="", $sound_directory="", $parent_style="")
ilSkinStyleXML constructor.
setImageDirectory($image_directory)
getSubstyleOf()
Returns the parent style of this style if set.
isSubstyle()
Return wheter this style is a substyle of another.
referencesResource($resource)
Checks if a resource (folder) relative to the style is referenced by this style.
static parseFromXMLElement(SimpleXMLElement $xml_element)
setFontDirectory($font_directory)
setSoundDirectory($sound_directory)
setSubstyleOf($substyle_of)
Sets style as sub style of another.
Class for advanced editing exception handling in ILIAS.
$style
Definition: example_012.php:70