13 require_once(
"./Services/Xml/classes/class.ilSaxParser.php");
 
   43                 if ($a_template_id == 
"")
 
   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)
 
  334                 return isset(self::$current_skin) ? self::$current_skin :
 
  335                                                                                         $ilias->account->skin;
 
  348                 global 
$ilias, $tree, $styleDefinition, $tree;  
 
  350                 if (isset(self::$current_style))
 
  355                 $cs = $ilias->account->prefs[
'style'];
 
  357                 if (is_object($styleDefinition))
 
  360                         $styles = $styleDefinition->getStyles();
 
  361                         if (is_array($styles[$cs][
"substyle"]))
 
  365                                 if (count($assignmnts) > 0)
 
  368                                         foreach ($assignmnts as $a)
 
  370                                                 $ref_ass[$a[
"ref_id"]] = $a[
"substyle"];
 
  374                                         if (is_object($tree) && 
$_GET[
"ref_id"] > 0 &&
 
  375                                                 $tree->isInTree(
$_GET[
"ref_id"]))
 
  377                                                 $path = $tree->getPathId((
int) 
$_GET[
"ref_id"]);
 
  378                                                 for ($i = count(
$path) - 1; $i >= 0; $i--)
 
  380                                                         if (isset($ref_ass[
$path[$i]]))
 
  382                                                                 self::$current_style = $ref_ass[
$path[$i]];
 
  391                 if (
$_GET[
"ref_id"] != 
"")
 
  393                         self::$current_style = $cs;
 
  411                 if (isset(self::$current_master_style))
 
  416                 $cs = $ilias->account->prefs[
'style'];
 
  418                 self::$current_master_style = $cs;
 
  431                 global $styleDefinition;
 
  433                 if (is_object($styleDefinition)
 
  434                 and $styleDefinition->getTemplateId() != $a_skin)
 
  437                         $styleDefinition->startParsing();
 
  440                 self::$current_skin = $a_skin;
 
  451                 self::$current_style = $a_style;
 
  462                 global $styleDefinition;
 
  464                 $all_styles = array();
 
  466                 $templates = $styleDefinition->getAllTemplates();
 
  468                 foreach ($templates as $template)
 
  472                         $styleDef->startParsing();
 
  473                         $styles = $styleDef->getStyles();
 
  475                         foreach ($styles as $style)
 
  480                                 $all_styles[$template[
"id"].
":".$style[
"id"]] =
 
  482                                                 "title" => $styleDef->getTemplateName().
" / ".$style[
"name"],
 
  483                                                 "id" => $template[
"id"].
":".$style[
"id"],
 
  484                                                 "template_id" => $template[
"id"],
 
  485                                                 "style_id" => $style[
"id"],
 
  486                                                 "template_name" => $styleDef->getTemplateName(),
 
  487                                                 "substyle" => $style[
"substyle"],
 
  488                                                 "style_name" => $style[
"name"],
 
  489                                                 "users" => $num_users
 
  508                 $assignmnts = array();
 
  509                 $set = $ilDB->query(
"SELECT substyle, category_ref_id FROM syst_style_cat ".
 
  510                         " WHERE skin_id = ".$ilDB->quote($a_skin_id, 
"text").
 
  511                         " AND style_id = ".$ilDB->quote($a_style_id, 
"text")
 
  513                 while ($rec = $ilDB->fetchAssoc($set))
 
  515                         $assignmnts[] = array(
"substyle" => $rec[
"substyle"],
 
  516                                 "ref_id" => $rec[
"category_ref_id"]);
 
  528                 $a_substyle, $a_ref_id)
 
  532                 $ilDB->manipulate(
"INSERT INTO syst_style_cat ".
 
  533                         "(skin_id, style_id, substyle, category_ref_id) VALUES (".
 
  534                         $ilDB->quote($a_skin_id, 
"text").
",".
 
  535                         $ilDB->quote($a_style_id, 
"text").
",".
 
  536                         $ilDB->quote($a_substyle, 
"text").
",".
 
  537                         $ilDB->quote($a_ref_id, 
"integer").
 
  548                 $a_substyle, $a_ref_id)
 
  552                 $ilDB->manipulate(
"DELETE FROM syst_style_cat WHERE ".
 
  553                         " skin_id = ".$ilDB->quote($a_skin_id, 
"text").
 
  554                         " AND style_id = ".$ilDB->quote($a_style_id, 
"text").
 
  555                         " AND substyle = ".$ilDB->quote($a_substyle, 
"text").
 
  556                         " AND category_ref_id = ".$ilDB->quote($a_ref_id, 
"integer"));