ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
class.ilSkinStyle.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
22{
26 protected string $id = '';
27
31 protected string $name = '';
32
36 protected string $sound_directory_name = '';
37
41 protected string $image_directory = '';
42
46 protected string $font_directory = '';
47
51 protected string $sound_directory = '';
52
56 protected string $css_file = '';
57
61 protected string $substyle_of = '';
62
63 public function __construct(
64 string $id,
65 string $name,
66 string $css_file = '',
67 string $image_directory = '',
68 string $font_directory = '',
69 string $sound_directory = '',
70 string $parent_style = ''
71 ) {
72 $this->setId($id);
73 $this->setName($name);
74
75 if ($css_file == '') {
76 $css_file = $this->getId();
77 }
78
79 if ($image_directory == '') {
80 $image_directory = 'images';
81 }
82
83 if ($font_directory == '') {
84 $font_directory = 'fonts';
85 }
86
87 if ($sound_directory == '') {
88 $sound_directory = 'sound';
89 }
90
91 $this->setCssFile($css_file);
92 $this->setImageDirectory($image_directory);
93 $this->setFontDirectory($font_directory);
94 $this->setSoundDirectory($sound_directory);
95 $this->setSubstyleOf($parent_style);
96 }
97
101 public static function parseFromXMLElement(SimpleXMLElement $xml_element): ilSkinStyle
102 {
103 return 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 }
112
113 public function getId(): string
114 {
115 return $this->id;
116 }
117
121 public function setId(string $id): void
122 {
123 if (strpos($id, ' ') !== false) {
125 }
126 $this->id = str_replace(' ', '_', $id);
127 }
128
129 public function getName(): string
130 {
131 return $this->name;
132 }
133
134 public function setName(string $name): void
135 {
136 $this->name = $name;
137 }
138
139 public function getSoundDirectory(): string
140 {
142 }
143
144 public function setSoundDirectory(string $sound_directory): void
145 {
146 $this->sound_directory = $sound_directory;
147 }
148
149 public function getImageDirectory(): string
150 {
152 }
153
154 public function setImageDirectory(string $image_directory): void
155 {
156 $this->image_directory = $image_directory;
157 }
158
159 public function getCssFile(): string
160 {
161 return $this->css_file;
162 }
163
164 public function setCssFile(string $css_file): void
165 {
166 $this->css_file = $css_file;
167 }
168
169 public function getFontDirectory(): string
170 {
172 }
173
174 public function setFontDirectory(string $font_directory): void
175 {
176 $this->font_directory = $font_directory;
177 }
178
182 public function getSubstyleOf(): string
183 {
184 return $this->substyle_of;
185 }
186
190 public function setSubstyleOf(string $substyle_of): void
191 {
192 $this->substyle_of = $substyle_of;
193 }
194
198 public function isSubstyle(): bool
199 {
200 return $this->getSubstyleOf() != '';
201 }
202}
string $css_file
Css file name of the skin.
setFontDirectory(string $font_directory)
string $name
Name of the style visible in all UI elements.
isSubstyle()
Return wheter this style is a substyle of another.
setCssFile(string $css_file)
string $sound_directory_name
Directory to store sound files into.
setId(string $id)
string $id
Id of the skin.
string $font_directory
Directory to store fonts into.
__construct(string $id, string $name, string $css_file='', string $image_directory='', string $font_directory='', string $sound_directory='', string $parent_style='')
getSubstyleOf()
Returns the parent style of this style if set.
string $sound_directory
Directory to store sound into.
setSoundDirectory(string $sound_directory)
string $image_directory
Directory to store image files into.
setImageDirectory(string $image_directory)
string $substyle_of
Parent of the skin if set.
static parseFromXMLElement(SimpleXMLElement $xml_element)
setSubstyleOf(string $substyle_of)
Sets style as sub style of another.
setName(string $name)
Class for advanced editing exception handling in ILIAS.