2include_once(
"Services/Style/System/classes/Exceptions/class.ilSystemStyleException.php");
3include_once(
"Services/Style/System/classes/Utilities/class.ilSkinStyleXML.php");
59 public static function parseFromXML(
$path =
""){
61 $xml =
new SimpleXMLElement(file_get_contents(
$path));
67 $skin =
new self(
$id,(string)$xml->attributes()[
"name"]);
68 $skin->setVersion((
string)$xml->attributes()[
"version"]);
76 foreach($xml->children() as $style_xml){
83 if($style_xml->getName() ==
"substyle") {
87 $style->setSubstyleOf($last_style->getId());
103 $xml =
new SimpleXMLElement(
'<?xml version="1.0" encoding="UTF-8"?><template/>');
104 $xml->addAttribute(
"xmlns",
"http://www.w3.org");
105 $xml->addAttribute(
"version",$this->
getVersion());
106 $xml->addAttribute(
"name",$this->
getName());
111 if(!
$style->isSubstyle()){
120 $dom =
new DOMDocument(
'1.0',
'utf-8');
121 $dom->formatOutput =
true;
122 $dom->loadXML($xml->asXML());
123 return $dom->saveXML();
135 $xml_style = $xml->addChild(
"substyle");
138 $xml_style = $xml->addChild(
"style");
140 $xml_style->addAttribute(
"id",
$style->getId());
141 $xml_style->addAttribute(
"name",
$style->getName());
142 $xml_style->addAttribute(
"image_directory",
$style->getImageDirectory());
143 $xml_style->addAttribute(
"css_file",
$style->getCssFile());
144 $xml_style->addAttribute(
"sound_directory",
$style->getSoundDirectory());
145 $xml_style->addAttribute(
"font_directory",
$style->getFontDirectory());
168 unset($this->styles[$index]);
206 return array_values($this->styles)[0];
215 return current($this->styles) !==
false;
222 return key($this->styles);
236 reset($this->styles);
243 return count($this->styles);
260 if (strpos(
$id,
' ') !==
false) {
263 $this->
id = str_replace(
" ",
"_",
$id);
325 $this->version = implode(
'.', $v);
332 return ($this->version !=
'$Id$');
340 $substyles = array();
344 if(
$style->getId() != $style_id &&
$style->isSubstyle()){
345 if(
$style->getSubstyleOf() == $style_id){
362 if(
$style->getId() != $style_id &&
$style->isSubstyle()){
363 if(
$style->getSubstyleOf() == $style_id){
An exception for terminatinating execution or to throw for unit testing.
static parseFromXMLElement(SimpleXMLElement $xml_element)
ilSkinXml holds an manages the basic data of a skin as provide by the template of the skin.
asXML()
Stores the skin and all it's styles as xml.
valid()
Iterator implementations.
hasStyleSubstyles($style_id)
Returns wheter a given style has substyles.
getSubstylesOfStyle($style_id)
addChildToXML(SimpleXMLElement $xml, ilSkinStyleXML $style)
Used to generate the xml for styles contained by the skin.
__construct($id, $name)
ilSkinXML constructor.
addStyle(ilSkinStyleXML $style)
count()
Countable implementations.
Class for advanced editing exception handling in ILIAS.
const INVALID_CHARACTERS_IN_ID
const FILE_OPENING_FAILED