13 require_once(
"./Services/Xml/classes/class.ilSaxParser.php");
43 if ($a_template_id ==
"")
46 $a_template_id = self::getCurrentSkin();
50 $this->template_id = $a_template_id;
52 if ($a_template_id ==
"default")
74 if (is_array($this->styles))
86 return $this->template_id;
92 return $this->template_name;
98 return $this->styles[$a_id];
104 return $this->styles[$a_id][
"name"];
110 if ($a_substyle != $a_master_style && $a_substyle !=
"")
112 return $this->styles[$a_master_style][
"substyle"][$a_substyle][
"image_directory"];
114 return $this->styles[$a_master_style][
"image_directory"];
119 return $this->styles[$a_id][
"sound_directory"];
126 $skins[] = array(
"id" =>
"default");
127 if ($dp = @opendir(
"./Customizing/global/skin"))
129 while ((
$file = readdir($dp)) !=
false)
132 if (is_dir(
"./Customizing/global/skin/".
$file) &&
$file !=
"." &&
$file !=
".." &&
$file !=
"CVS"
135 if (is_file(
"./Customizing/global/skin/".
$file.
"/template.xml"))
169 xml_set_object($a_xml_parser,$this);
170 xml_set_element_handler($a_xml_parser,
'handlerBeginTag',
'handlerEndTag');
171 xml_set_character_data_handler($a_xml_parser,
'handlerCharacterData');
184 if (!isset($a_attribs[
"sound_directory"]))
186 $a_attribs[
"sound_directory"] =
"";
189 if (!isset($a_attribs[
"browsers"]))
191 $a_attribs[
"browsers"] =
"";
197 $this->template_name = $a_attribs[
"name"];
201 $this->last_style_id = $a_attribs[
"id"];
202 $this->styles[$a_attribs[
"id"]] =
203 array(
"id" => $a_attribs[
"id"],
204 "name" => $a_attribs[
"name"],
205 "css_file" => $a_attribs[
"id"].
".css",
206 "image_directory" => $a_attribs[
"image_directory"],
207 "sound_directory" => $a_attribs[
"sound_directory"]
210 explode(
",", $a_attribs[
"browsers"]);
211 foreach ($browsers as $val)
213 $this->styles[$a_attribs[
"id"]][
"browsers"][] = trim($val);
218 $this->styles[$this->last_style_id][
"substyle"][$a_attribs[
"id"]] =
219 array(
"id" => $a_attribs[
"id"],
220 "name" => $a_attribs[
"name"],
221 "css_file" => $a_attribs[
"id"].
".css",
222 "image_directory" => $a_attribs[
"image_directory"],
223 "sound_directory" => $a_attribs[
"sound_directory"]
240 if ($skin ==
"default")
242 if (is_file(
"./templates/".$skin.
"/template.xml") &&
243 is_file(
"./templates/".$skin.
"/".$style.
".css")
251 if (is_file(
"./Customizing/global/skin/".$skin.
"/template.xml") &&
252 is_file(
"./Customizing/global/skin/".$skin.
"/".$style.
".css")
270 if ($skin ==
"default")
272 if (is_file(
"./templates/".$skin.
"/template.xml"))
279 if (is_file(
"./Customizing/global/skin/".$skin.
"/template.xml"))
297 $a_data = preg_replace(
"/\n/",
"",$a_data);
298 $a_data = preg_replace(
"/\t+/",
"",$a_data);
302 switch($this->current_tag)
330 public static function getCurrentSkin()
337 if(isset(self::$current_skin))
342 if(is_object($ilias))
344 return $ilias->account->skin;
360 global
$ilias, $tree, $styleDefinition, $tree;
362 if (isset(self::$current_style))
367 if(!is_object($ilias))
372 $cs = $ilias->account->prefs[
'style'];
374 if (is_object($styleDefinition))
377 $styles = $styleDefinition->getStyles();
378 if (is_array($styles[$cs][
"substyle"]))
382 if (count($assignmnts) > 0)
385 foreach ($assignmnts as $a)
387 $ref_ass[$a[
"ref_id"]] = $a[
"substyle"];
391 if (is_object($tree) &&
$_GET[
"ref_id"] > 0 &&
392 $tree->isInTree(
$_GET[
"ref_id"]))
394 $path = $tree->getPathId((
int)
$_GET[
"ref_id"]);
395 for ($i = count(
$path) - 1; $i >= 0; $i--)
397 if (isset($ref_ass[
$path[$i]]))
399 self::$current_style = $ref_ass[
$path[$i]];
408 if (
$_GET[
"ref_id"] !=
"")
410 self::$current_style = $cs;
428 if (isset(self::$current_master_style))
433 $cs = $ilias->account->prefs[
'style'];
435 self::$current_master_style = $cs;
448 global $styleDefinition;
450 if (is_object($styleDefinition)
451 and $styleDefinition->getTemplateId() != $a_skin)
454 $styleDefinition->startParsing();
457 self::$current_skin = $a_skin;
468 self::$current_style = $a_style;
479 global $styleDefinition;
481 $all_styles = array();
483 $templates = $styleDefinition->getAllTemplates();
485 foreach ($templates as $template)
489 $styleDef->startParsing();
490 $styles = $styleDef->getStyles();
492 foreach ($styles as $style)
497 $all_styles[$template[
"id"].
":".$style[
"id"]] =
499 "title" => $styleDef->getTemplateName().
" / ".$style[
"name"],
500 "id" => $template[
"id"].
":".$style[
"id"],
501 "template_id" => $template[
"id"],
502 "style_id" => $style[
"id"],
503 "template_name" => $styleDef->getTemplateName(),
504 "substyle" => $style[
"substyle"],
505 "style_name" => $style[
"name"],
506 "users" => $num_users
525 $assignmnts = array();
526 $set = $ilDB->query(
"SELECT substyle, category_ref_id FROM syst_style_cat ".
527 " WHERE skin_id = ".$ilDB->quote($a_skin_id,
"text").
528 " AND style_id = ".$ilDB->quote($a_style_id,
"text")
530 while ($rec = $ilDB->fetchAssoc($set))
532 $assignmnts[] = array(
"substyle" => $rec[
"substyle"],
533 "ref_id" => $rec[
"category_ref_id"]);
545 $a_substyle, $a_ref_id)
549 $ilDB->manipulate(
"INSERT INTO syst_style_cat ".
550 "(skin_id, style_id, substyle, category_ref_id) VALUES (".
551 $ilDB->quote($a_skin_id,
"text").
",".
552 $ilDB->quote($a_style_id,
"text").
",".
553 $ilDB->quote($a_substyle,
"text").
",".
554 $ilDB->quote($a_ref_id,
"integer").
565 $a_substyle, $a_ref_id)
569 $ilDB->manipulate(
"DELETE FROM syst_style_cat WHERE ".
570 " skin_id = ".$ilDB->quote($a_skin_id,
"text").
571 " AND style_id = ".$ilDB->quote($a_style_id,
"text").
572 " AND substyle = ".$ilDB->quote($a_substyle,
"text").
573 " AND category_ref_id = ".$ilDB->quote($a_ref_id,
"integer"));