ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
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 
67  public function __construct($id, $name, $css_file = "", $image_directory = "", $font_directory = "", $sound_directory = "", $parent_style = "")
68  {
69  $this->setId($id);
70  $this->setName($name);
71 
72  if ($css_file == "") {
73  $css_file = $this->getId();
74  }
75 
76  if ($image_directory == "") {
77  $image_directory = "images";
78  }
79 
80  if ($font_directory == "") {
81  $font_directory = "fonts";
82  }
83 
84  if ($sound_directory == "") {
85  $sound_directory = "sound";
86  }
87 
88  $this->setCssFile($css_file);
92  $this->setSubstyleOf($parent_style);
93  }
94 
99  public static function parseFromXMLElement(SimpleXMLElement $xml_element)
100  {
101  $style = new self(
102  (string) $xml_element->attributes()["id"],
103  (string) $xml_element->attributes()["name"],
104  (string) $xml_element->attributes()["css_file"],
105  (string) $xml_element->attributes()["image_directory"],
106  (string) $xml_element->attributes()["font_directory"],
107  (string) $xml_element->attributes()["sound_directory"]
108  );
109  return $style;
110  }
111 
115  public function getId()
116  {
117  return $this->id;
118  }
119 
124  public function setId($id)
125  {
126  if (strpos($id, ' ') !== false) {
128  }
129  $this->id = str_replace(" ", "_", $id);
130  }
131 
135  public function getName()
136  {
137  return $this->name;
138  }
139 
143  public function setName($name)
144  {
145  $this->name = $name;
146  }
147 
151  public function getSoundDirectory()
152  {
153  return $this->sound_directory;
154  }
155 
160  {
161  $this->sound_directory = $sound_directory;
162  }
163 
167  public function getImageDirectory()
168  {
169  return $this->image_directory;
170  }
171 
176  {
177  $this->image_directory = $image_directory;
178  }
179 
183  public function getCssFile()
184  {
185  return $this->css_file;
186  }
187 
191  public function setCssFile($css_file)
192  {
193  $this->css_file = $css_file;
194  }
195 
199  public function getFontDirectory()
200  {
201  return $this->font_directory;
202  }
203 
208  {
209  $this->font_directory = $font_directory;
210  }
211 
217  public function getSubstyleOf()
218  {
219  return $this->substyle_of;
220  }
221 
227  public function setSubstyleOf($substyle_of)
228  {
229  $this->substyle_of = $substyle_of;
230  }
231 
237  public function isSubstyle()
238  {
239  return $this->getSubstyleOf() != "";
240  }
241 
248  public function referencesResource($resource)
249  {
250  return $this->getCssFile() == $resource
251  || $this->getImageDirectory() == $resource
252  || $this->getFontDirectory() == $resource
253  || $this->getSoundDirectory()== $resource;
254  }
255 }
Add rich text string
$style
Definition: example_012.php:70
setSubstyleOf($substyle_of)
Sets style as sub style of another.
getSubstyleOf()
Returns the parent style of this style if set.
static parseFromXMLElement(SimpleXMLElement $xml_element)
setSoundDirectory($sound_directory)
isSubstyle()
Return wheter this style is a substyle of another.
setFontDirectory($font_directory)
referencesResource($resource)
Checks if a resource (folder) relative to the style is referenced by this style.
setImageDirectory($image_directory)
Class for advanced editing exception handling in ILIAS.
__construct($id, $name, $css_file="", $image_directory="", $font_directory="", $sound_directory="", $parent_style="")
ilSkinStyleXML constructor.