ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
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  static function parseFromXMLElement(SimpleXMLElement $xml_element){
100  $style = new self((string)$xml_element->attributes()["id"],
101  (string)$xml_element->attributes()["name"],
102  (string)$xml_element->attributes()["css_file"],
103  (string)$xml_element->attributes()["image_directory"],
104  (string)$xml_element->attributes()["font_directory"],
105  (string)$xml_element->attributes()["sound_directory"]
106 
107  );
108  return $style;
109  }
110 
114  public function getId()
115  {
116  return $this->id;
117  }
118 
123  public function setId($id)
124  {
125  if (strpos($id, ' ') !== false) {
127  }
128  $this->id = str_replace(" ","_",$id);
129  }
130 
134  public function getName()
135  {
136  return $this->name;
137  }
138 
142  public function setName($name)
143  {
144  $this->name = $name;
145  }
146 
150  public function getSoundDirectory()
151  {
152  return $this->sound_directory;
153  }
154 
159  {
160  $this->sound_directory = $sound_directory;
161  }
162 
166  public function getImageDirectory()
167  {
168  return $this->image_directory;
169  }
170 
175  {
176  $this->image_directory = $image_directory;
177  }
178 
182  public function getCssFile()
183  {
184  return $this->css_file;
185  }
186 
190  public function setCssFile($css_file)
191  {
192  $this->css_file = $css_file;
193  }
194 
198  public function getFontDirectory()
199  {
200  return $this->font_directory;
201  }
202 
207  {
208  $this->font_directory = $font_directory;
209  }
210 
216  public function getSubstyleOf()
217  {
218  return $this->substyle_of;
219  }
220 
226  public function setSubstyleOf($substyle_of)
227  {
228  $this->substyle_of = $substyle_of;
229  }
230 
236  public function isSubstyle(){
237  return $this->getSubstyleOf() != "";
238  }
239 
246  public function referencesResource($resource){
247  return $this->getCssFile() == $resource
248  || $this->getImageDirectory() == $resource
249  || $this->getFontDirectory() == $resource
250  || $this->getSoundDirectory()== $resource;
251  }
252 }
$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)
Add rich text string
The name of the decorator.
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.