25 require_once
"./classes/class.ilObject.php";
49 $this->style = array();
50 if($a_call_by_reference)
52 $this->ilias->raiseError(
"Can't instantiate style object via reference id.",$this->ilias->error_obj->FATAL);
60 $this->ilias->raiseError(
"Operation ilObjStyleSheet::setRefId() not allowed.",$this->ilias->error_obj->FATAL);
71 $this->ilias->raiseError(
"Operation ilObjStyleSheet::putInTree() not allowed.",$this->ilias->error_obj->FATAL);
76 $this->ilias->raiseError(
"Operation ilObjStyleSheet::createReference() not allowed.",$this->ilias->error_obj->FATAL);
81 $this->up_to_date = $a_up_to_date;
86 return $this->up_to_date;
91 $this->scope = $a_scope;
103 $q =
"UPDATE style_data SET uptodate = ".$ilDB->quote((
int) $a_up_to_date).
104 " WHERE id = ".$ilDB->quote($a_id);
115 $q =
"SELECT * FROM style_data ".
116 " WHERE id = ".$ilDB->quote($a_id);
117 $res = $ilDB->query($q);
120 return (
boolean) $sty[
"uptodate"];
130 $q =
"UPDATE style_data SET standard = ".$ilDB->quote((
int) $a_std).
131 " WHERE id = ".$ilDB->quote($a_id);
142 $q =
"UPDATE style_data SET category = ".$ilDB->quote((
int) $a_scope).
143 " WHERE id = ".$ilDB->quote($a_id);
154 $q =
"SELECT * FROM style_data ".
155 " WHERE id = ".$ilDB->quote($a_id);
156 $res = $ilDB->query($q);
159 return (
boolean) $sty[
"standard"];
169 $q =
"UPDATE style_data SET active = ".$ilDB->quote((
int) $a_active).
170 " WHERE id = ".$ilDB->quote($a_id);
181 $q =
"SELECT * FROM style_data ".
182 " WHERE id = ".$ilDB->quote($a_id);
183 $res = $ilDB->query($q);
186 return (
boolean) $sty[
"active"];
193 $a_include_deactivated =
false, $a_scope = 0)
195 global $ilDB,
$ilias, $tree;
197 $default_style = $ilias->getSetting(
"default_content_style_id");
200 if (!$a_include_deactivated)
202 $and_str =
" AND active = 1";
205 $q =
"SELECT * FROM style_data ".
206 " WHERE standard = 1".$and_str;
207 $res = $ilDB->query($q);
211 if (!$a_exclude_default_style || $default_style != $sty[
"id"])
214 if ($a_scope > 0 && $sty[
"category"] > 0)
216 if ($tree->isInTree($sty[
"category"]) &&
217 $tree->isInTree($a_scope))
219 $path = $tree->getPathId($a_scope);
220 if (!in_array($sty[
"category"], $path))
241 global $ilAccess, $ilDB;
243 $clonable_styles = array();
245 $q =
"SELECT * FROM style_data, object_data ".
246 " WHERE object_data.obj_id = style_data.id ";
247 $style_set = $ilDB->query($q);
251 if ($style_rec[
"standard"] == 1)
253 if ($style_rec[
"active"] == 1)
260 include_once(
"./Modules/LearningModule/classes/class.ilObjContentObject.php");
262 foreach($obj_ids as
$id)
267 if ($ilAccess->checkAccess(
"write",
"", $ref_id))
276 $clonable_styles[$style_rec[
"id"]] =
280 return $clonable_styles;
288 $this->meta_data =& $a_meta_data;
296 return $this->meta_data;
305 if ($a_from_style == 0)
308 array(
"tag" =>
"div",
"class" =>
"PageTitle",
"parameter" =>
"margin-top" ,
"value" =>
"5px"),
309 array(
"tag" =>
"div",
"class" =>
"PageTitle",
"parameter" =>
"margin-bottom" ,
"value" =>
"20px"),
310 array(
"tag" =>
"div",
"class" =>
"PageTitle",
"parameter" =>
"font-size" ,
"value" =>
"140%"),
311 array(
"tag" =>
"div",
"class" =>
"PageTitle",
"parameter" =>
"padding-bottom" ,
"value" =>
"3px"),
312 array(
"tag" =>
"div",
"class" =>
"PageTitle",
"parameter" =>
"border-bottom-width" ,
"value" =>
"1px"),
313 array(
"tag" =>
"div",
"class" =>
"PageTitle",
"parameter" =>
"border-bottom-style" ,
"value" =>
"solid"),
314 array(
"tag" =>
"div",
"class" =>
"PageTitle",
"parameter" =>
"border-color" ,
"value" =>
"#000000"),
316 array(
"tag" =>
"span",
"class" =>
"Strong",
"parameter" =>
"font-weight" ,
"value" =>
"bold"),
317 array(
"tag" =>
"span",
"class" =>
"Emph",
"parameter" =>
"font-style" ,
"value" =>
"italic"),
318 array(
"tag" =>
"span",
"class" =>
"Comment",
"parameter" =>
"color" ,
"value" =>
"green"),
319 array(
"tag" =>
"span",
"class" =>
"Quotation",
"parameter" =>
"color" ,
"value" =>
"brown"),
320 array(
"tag" =>
"span",
"class" =>
"Quotation",
"parameter" =>
"font-style" ,
"value" =>
"italic"),
322 array(
"tag" =>
"a",
"class" =>
"FootnoteLink",
"parameter" =>
"color" ,
"value" =>
"blue"),
323 array(
"tag" =>
"a",
"class" =>
"FootnoteLink",
"parameter" =>
"font-weight" ,
"value" =>
"normal"),
324 array(
"tag" =>
"a",
"class" =>
"FootnoteLink:hover",
"parameter" =>
"color" ,
"value" =>
"#000000"),
325 array(
"tag" =>
"div",
"class" =>
"Footnote",
"parameter" =>
"margin-top" ,
"value" =>
"5px"),
326 array(
"tag" =>
"div",
"class" =>
"Footnote",
"parameter" =>
"margin-bottom" ,
"value" =>
"5px"),
327 array(
"tag" =>
"div",
"class" =>
"Footnote",
"parameter" =>
"font-style" ,
"value" =>
"italic"),
329 array(
"tag" =>
"a",
"class" =>
"IntLink",
"parameter" =>
"color" ,
"value" =>
"blue"),
330 array(
"tag" =>
"a",
"class" =>
"IntLink:visited",
"parameter" =>
"color" ,
"value" =>
"blue"),
331 array(
"tag" =>
"a",
"class" =>
"IntLink",
"parameter" =>
"font-weight" ,
"value" =>
"normal"),
332 array(
"tag" =>
"a",
"class" =>
"IntLink",
"parameter" =>
"text-decoration" ,
"value" =>
"underline"),
333 array(
"tag" =>
"a",
"class" =>
"IntLink:hover",
"parameter" =>
"color" ,
"value" =>
"#000000"),
335 array(
"tag" =>
"a",
"class" =>
"ExtLink",
"parameter" =>
"color" ,
"value" =>
"blue"),
336 array(
"tag" =>
"a",
"class" =>
"ExtLink:visited",
"parameter" =>
"color" ,
"value" =>
"blue"),
337 array(
"tag" =>
"a",
"class" =>
"ExtLink",
"parameter" =>
"font-weight" ,
"value" =>
"normal"),
338 array(
"tag" =>
"a",
"class" =>
"ExtLink",
"parameter" =>
"text-decoration" ,
"value" =>
"underline"),
339 array(
"tag" =>
"a",
"class" =>
"ExtLink:hover",
"parameter" =>
"color" ,
"value" =>
"#000000"),
341 array(
"tag" =>
"div",
"class" =>
"LMNavigation",
"parameter" =>
"background-color" ,
"value" =>
"#EEEEEE"),
342 array(
"tag" =>
"div",
"class" =>
"LMNavigation",
"parameter" =>
"border-style" ,
"value" =>
"outset"),
343 array(
"tag" =>
"div",
"class" =>
"LMNavigation",
"parameter" =>
"border-color" ,
"value" =>
"#EEEEEE"),
344 array(
"tag" =>
"div",
"class" =>
"LMNavigation",
"parameter" =>
"border-width" ,
"value" =>
"1px"),
345 array(
"tag" =>
"div",
"class" =>
"Page",
"parameter" =>
"background-color" ,
"value" =>
"#FFFFFF"),
346 array(
"tag" =>
"div",
"class" =>
"Page",
"parameter" =>
"padding" ,
"value" =>
"0px"),
347 array(
"tag" =>
"div",
"class" =>
"Page",
"parameter" =>
"margin" ,
"value" =>
"0px"),
348 array(
"tag" =>
"td",
"class" =>
"Cell1",
"parameter" =>
"background-color" ,
"value" =>
"#FFCCCC"),
349 array(
"tag" =>
"td",
"class" =>
"Cell2",
"parameter" =>
"background-color" ,
"value" =>
"#CCCCFF"),
350 array(
"tag" =>
"td",
"class" =>
"Cell3",
"parameter" =>
"background-color" ,
"value" =>
"#CCFFCC"),
351 array(
"tag" =>
"td",
"class" =>
"Cell4",
"parameter" =>
"background-color" ,
"value" =>
"#FFFFCC"),
353 array(
"tag" =>
"div",
"class" =>
"Standard",
"parameter" =>
"margin-top" ,
"value" =>
"10px"),
354 array(
"tag" =>
"div",
"class" =>
"Standard",
"parameter" =>
"margin-bottom" ,
"value" =>
"10px"),
356 array(
"tag" =>
"div",
"class" =>
"List",
"parameter" =>
"margin-top" ,
"value" =>
"3px"),
357 array(
"tag" =>
"div",
"class" =>
"List",
"parameter" =>
"margin-bottom" ,
"value" =>
"3px"),
359 array(
"tag" =>
"div",
"class" =>
"Headline1",
"parameter" =>
"margin-top" ,
"value" =>
"20px"),
360 array(
"tag" =>
"div",
"class" =>
"Headline1",
"parameter" =>
"margin-bottom" ,
"value" =>
"10px"),
361 array(
"tag" =>
"div",
"class" =>
"Headline1",
"parameter" =>
"font-size" ,
"value" =>
"140%"),
363 array(
"tag" =>
"div",
"class" =>
"Headline2",
"parameter" =>
"margin-top" ,
"value" =>
"20px"),
364 array(
"tag" =>
"div",
"class" =>
"Headline2",
"parameter" =>
"margin-bottom" ,
"value" =>
"10px"),
365 array(
"tag" =>
"div",
"class" =>
"Headline2",
"parameter" =>
"font-size" ,
"value" =>
"130%"),
367 array(
"tag" =>
"div",
"class" =>
"Headline3",
"parameter" =>
"margin-top" ,
"value" =>
"20px"),
368 array(
"tag" =>
"div",
"class" =>
"Headline3",
"parameter" =>
"margin-bottom" ,
"value" =>
"10px"),
369 array(
"tag" =>
"div",
"class" =>
"Headline3",
"parameter" =>
"font-size" ,
"value" =>
"120%"),
371 array(
"tag" =>
"div",
"class" =>
"Example",
"parameter" =>
"padding-left" ,
"value" =>
"20px"),
372 array(
"tag" =>
"div",
"class" =>
"Example",
"parameter" =>
"border-left-width" ,
"value" =>
"3px"),
373 array(
"tag" =>
"div",
"class" =>
"Example",
"parameter" =>
"border-left-style" ,
"value" =>
"solid"),
374 array(
"tag" =>
"div",
"class" =>
"Example",
"parameter" =>
"border-left-color" ,
"value" =>
"blue"),
375 array(
"tag" =>
"div",
"class" =>
"Example",
"parameter" =>
"margin-top" ,
"value" =>
"10px"),
376 array(
"tag" =>
"div",
"class" =>
"Example",
"parameter" =>
"margin-bottom" ,
"value" =>
"10px"),
378 array(
"tag" =>
"div",
"class" =>
"Citation",
"parameter" =>
"color" ,
"value" =>
"brown"),
379 array(
"tag" =>
"div",
"class" =>
"Citation",
"parameter" =>
"font-style" ,
"value" =>
"italic"),
380 array(
"tag" =>
"div",
"class" =>
"Citation",
"parameter" =>
"margin-top" ,
"value" =>
"10px"),
381 array(
"tag" =>
"div",
"class" =>
"Citation",
"parameter" =>
"margin-bottom" ,
"value" =>
"10px"),
383 array(
"tag" =>
"div",
"class" =>
"Mnemonic",
"parameter" =>
"margin-left" ,
"value" =>
"20px"),
384 array(
"tag" =>
"div",
"class" =>
"Mnemonic",
"parameter" =>
"margin-right" ,
"value" =>
"20px"),
385 array(
"tag" =>
"div",
"class" =>
"Mnemonic",
"parameter" =>
"padding" ,
"value" =>
"10px"),
386 array(
"tag" =>
"div",
"class" =>
"Mnemonic",
"parameter" =>
"border-width" ,
"value" =>
"2px"),
387 array(
"tag" =>
"div",
"class" =>
"Mnemonic",
"parameter" =>
"border-style" ,
"value" =>
"solid"),
388 array(
"tag" =>
"div",
"class" =>
"Mnemonic",
"parameter" =>
"border-color" ,
"value" =>
"red"),
389 array(
"tag" =>
"div",
"class" =>
"Mnemonic",
"parameter" =>
"margin-top" ,
"value" =>
"10px"),
390 array(
"tag" =>
"div",
"class" =>
"Mnemonic",
"parameter" =>
"margin-bottom" ,
"value" =>
"10px"),
392 array(
"tag" =>
"div",
"class" =>
"Additional",
"parameter" =>
"padding" ,
"value" =>
"10px"),
393 array(
"tag" =>
"div",
"class" =>
"Additional",
"parameter" =>
"border-width" ,
"value" =>
"1px"),
394 array(
"tag" =>
"div",
"class" =>
"Additional",
"parameter" =>
"border-style" ,
"value" =>
"solid"),
395 array(
"tag" =>
"div",
"class" =>
"Additional",
"parameter" =>
"border-color" ,
"value" =>
"blue"),
396 array(
"tag" =>
"div",
"class" =>
"Additional",
"parameter" =>
"margin-top" ,
"value" =>
"10px"),
397 array(
"tag" =>
"div",
"class" =>
"Additional",
"parameter" =>
"margin-bottom" ,
"value" =>
"10px"),
399 array(
"tag" =>
"div",
"class" =>
"Remark",
"parameter" =>
"padding" ,
"value" =>
"10px"),
400 array(
"tag" =>
"div",
"class" =>
"Remark",
"parameter" =>
"border-width" ,
"value" =>
"1px"),
401 array(
"tag" =>
"div",
"class" =>
"Remark",
"parameter" =>
"border-style" ,
"value" =>
"solid"),
402 array(
"tag" =>
"div",
"class" =>
"Remark",
"parameter" =>
"border-color" ,
"value" =>
"#909090"),
403 array(
"tag" =>
"div",
"class" =>
"Remark",
"parameter" =>
"background-color" ,
"value" =>
"#D0D0D0"),
404 array(
"tag" =>
"div",
"class" =>
"Remark",
"parameter" =>
"text-align" ,
"value" =>
"center"),
405 array(
"tag" =>
"div",
"class" =>
"Remark",
"parameter" =>
"margin-top" ,
"value" =>
"10px"),
406 array(
"tag" =>
"div",
"class" =>
"Remark",
"parameter" =>
"margin-bottom" ,
"value" =>
"10px"),
408 array(
"tag" =>
"div",
"class" =>
"Block",
"parameter" =>
"padding-left" ,
"value" =>
"10px"),
409 array(
"tag" =>
"div",
"class" =>
"Block",
"parameter" =>
"padding-right" ,
"value" =>
"10px"),
410 array(
"tag" =>
"div",
"class" =>
"Block",
"parameter" =>
"padding-top" ,
"value" =>
"5px"),
411 array(
"tag" =>
"div",
"class" =>
"Block",
"parameter" =>
"padding-bottom" ,
"value" =>
"5px"),
412 array(
"tag" =>
"div",
"class" =>
"Block",
"parameter" =>
"border-width" ,
"value" =>
"1px"),
413 array(
"tag" =>
"div",
"class" =>
"Block",
"parameter" =>
"border-style" ,
"value" =>
"solid"),
414 array(
"tag" =>
"div",
"class" =>
"Block",
"parameter" =>
"border-color" ,
"value" =>
"#A0A0A0"),
415 array(
"tag" =>
"div",
"class" =>
"Block",
"parameter" =>
"background-color" ,
"value" =>
"#FFFFFF"),
416 array(
"tag" =>
"div",
"class" =>
"Block",
"parameter" =>
"margin-top" ,
"value" =>
"10px"),
417 array(
"tag" =>
"div",
"class" =>
"Block",
"parameter" =>
"margin-bottom" ,
"value" =>
"10px"),
419 array(
"tag" =>
"div",
"class" =>
"Special",
"parameter" =>
"padding-left" ,
"value" =>
"10px"),
420 array(
"tag" =>
"div",
"class" =>
"Special",
"parameter" =>
"padding-right" ,
"value" =>
"10px"),
421 array(
"tag" =>
"div",
"class" =>
"Special",
"parameter" =>
"padding-top" ,
"value" =>
"5px"),
422 array(
"tag" =>
"div",
"class" =>
"Special",
"parameter" =>
"padding-bottom" ,
"value" =>
"5px"),
423 array(
"tag" =>
"div",
"class" =>
"Special",
"parameter" =>
"border-width" ,
"value" =>
"1px"),
424 array(
"tag" =>
"div",
"class" =>
"Special",
"parameter" =>
"border-style" ,
"value" =>
"solid"),
425 array(
"tag" =>
"div",
"class" =>
"Special",
"parameter" =>
"border-color" ,
"value" =>
"#A0A0A0"),
426 array(
"tag" =>
"div",
"class" =>
"Special",
"parameter" =>
"background-color" ,
"value" =>
"#FFF7F7"),
427 array(
"tag" =>
"div",
"class" =>
"Special",
"parameter" =>
"margin-top" ,
"value" =>
"10px"),
428 array(
"tag" =>
"div",
"class" =>
"Special",
"parameter" =>
"margin-bottom" ,
"value" =>
"10px"),
430 array(
"tag" =>
"div",
"class" =>
"Excursus",
"parameter" =>
"padding-left" ,
"value" =>
"10px"),
431 array(
"tag" =>
"div",
"class" =>
"Excursus",
"parameter" =>
"padding-right" ,
"value" =>
"10px"),
432 array(
"tag" =>
"div",
"class" =>
"Excursus",
"parameter" =>
"padding-top" ,
"value" =>
"5px"),
433 array(
"tag" =>
"div",
"class" =>
"Excursus",
"parameter" =>
"padding-bottom" ,
"value" =>
"5px"),
434 array(
"tag" =>
"div",
"class" =>
"Excursus",
"parameter" =>
"border-width" ,
"value" =>
"1px"),
435 array(
"tag" =>
"div",
"class" =>
"Excursus",
"parameter" =>
"border-style" ,
"value" =>
"solid"),
436 array(
"tag" =>
"div",
"class" =>
"Excursus",
"parameter" =>
"border-color" ,
"value" =>
"#A0A0A0"),
437 array(
"tag" =>
"div",
"class" =>
"Excursus",
"parameter" =>
"background-color" ,
"value" =>
"#F7FFF7"),
438 array(
"tag" =>
"div",
"class" =>
"Excursus",
"parameter" =>
"margin-top" ,
"value" =>
"10px"),
439 array(
"tag" =>
"div",
"class" =>
"Excursus",
"parameter" =>
"margin-bottom" ,
"value" =>
"10px"),
441 array(
"tag" =>
"div",
"class" =>
"TableContent",
"parameter" =>
"margin-left" ,
"value" =>
"0px"),
442 array(
"tag" =>
"div",
"class" =>
"TableContent",
"parameter" =>
"margin-right" ,
"value" =>
"0px"),
443 array(
"tag" =>
"div",
"class" =>
"TableContent",
"parameter" =>
"margin-top" ,
"value" =>
"0px"),
444 array(
"tag" =>
"div",
"class" =>
"TableContent",
"parameter" =>
"margin-bottom" ,
"value" =>
"0px"),
445 array(
"tag" =>
"div",
"class" =>
"TableContent",
"parameter" =>
"padding-left" ,
"value" =>
"0px"),
446 array(
"tag" =>
"div",
"class" =>
"TableContent",
"parameter" =>
"padding-right" ,
"value" =>
"0px"),
447 array(
"tag" =>
"div",
"class" =>
"TableContent",
"parameter" =>
"padding-top" ,
"value" =>
"0px"),
448 array(
"tag" =>
"div",
"class" =>
"TableContent",
"parameter" =>
"padding-bottom" ,
"value" =>
"0px"),
450 array(
"tag" =>
"table",
"class" =>
"Media",
"parameter" =>
"background-color" ,
"value" =>
"#F5F5F5"),
451 array(
"tag" =>
"table",
"class" =>
"Media",
"parameter" =>
"padding" ,
"value" =>
"0px"),
452 array(
"tag" =>
"table",
"class" =>
"Media",
"parameter" =>
"margin" ,
"value" =>
"10px"),
454 array(
"tag" =>
"td",
"class" =>
"MediaCaption",
"parameter" =>
"padding" ,
"value" =>
"5px")
460 $q =
"SELECT * FROM style_parameter WHERE style_id = ".$ilDB->quote($a_from_style);
461 $par_set = $ilDB->query($q);
464 $def[] = array(
"tag" => $par_rec[
"tag"],
"class" => $par_rec[
"class"],
465 "parameter" => $par_rec[
"parameter"] ,
"value" => $par_rec[
"value"]);
470 foreach ($def as $sty)
472 $q =
"INSERT INTO style_parameter (style_id, tag, class, parameter, value) VALUES ".
473 "(".$ilDB->quote($this->
getId()).
",".
474 $ilDB->quote($sty[
"tag"]).
",".
475 $ilDB->quote($sty[
"class"]).
",".
476 $ilDB->quote($sty[
"parameter"]).
",".
477 $ilDB->quote($sty[
"value"]).
")";
482 $q =
"INSERT INTO style_data (id, uptodate, category) VALUES ".
483 "(".$ilDB->quote($this->
getId()).
", 0,".
484 $ilDB->quote($this->
getScope()).
")";
502 $new_obj->setTitle($this->
getTitle());
503 $new_obj->setType($this->
getType());
505 $new_obj->create($this->
getId());
507 return $new_obj->getId();
522 $tag = explode(
".", $a_tag);
523 $value = $avail_params[$a_par][0];
524 $q =
"INSERT INTO style_parameter (style_id, tag, class, parameter, value) VALUES ".
525 "(".$ilDB->quote($this->
getId()).
",".$ilDB->quote($tag[0]).
",".
526 $ilDB->quote($tag[1]).
527 ",".$ilDB->quote($a_par).
",".$ilDB->quote($value).
")";
528 $this->ilias->db->query($q);
542 $q =
"DELETE FROM style_parameter WHERE id = ".$ilDB->quote($a_id);
543 $this->ilias->db->query($q);
554 $q =
"DELETE FROM style_parameter WHERE ".
555 " style_id = ".$ilDB->quote($this->
getId()).
" AND ".
556 " tag = ".$ilDB->quote($a_tag).
" AND ".
557 " class = ".$ilDB->quote($a_class).
" AND ".
558 " parameter = ".$ilDB->quote($a_par);
560 $this->ilias->db->query($q);
574 $def_style = $this->ilias->getSetting(
"default_content_style_id");
575 if ($def_style == $this->
getId())
577 $this->ilias->deleteSetting(
"default_content_style_id");
581 $fixed_style = $this->ilias->getSetting(
"fixed_content_style_id");
582 if ($fixed_style == $this->
getId())
584 $this->ilias->deleteSetting(
"fixed_content_style_id");
588 $q =
"DELETE FROM style_parameter WHERE style_id = ".$ilDB->quote($this->
getId());
593 if (is_file($css_file_name))
595 unlink($css_file_name);
599 include_once(
"./Modules/LearningModule/classes/class.ilObjContentObject.php");
603 $q =
"DELETE FROM style_data WHERE id = ".$ilDB->quote($this->
getId());
618 $q =
"SELECT * FROM style_parameter WHERE style_id = ".
619 $ilDB->quote($this->
getId()).
" ORDER BY tag, class ";
620 $style_set = $this->ilias->db->query($q);
623 $this->style = array();
626 if ($style_rec[
"tag"] != $ctag || $style_rec[
"class"] != $cclass)
631 $this->style[] = $tag;
635 $ctag = $style_rec[
"tag"];
636 $cclass = $style_rec[
"class"];
641 $this->style[] = $tag;
644 $q =
"SELECT * FROM style_data WHERE id = ".$ilDB->quote($this->
getId());
645 $res = $ilDB->query($q);
659 if ($a_target_file ==
"")
665 $css_file_name = $a_target_file;
667 $css_file = fopen($css_file_name,
"w");
669 $page_background =
"";
673 fwrite ($css_file, $tag[0][
"tag"].
".ilc_".$tag[0][
"class"].
"\n");
674 fwrite ($css_file,
"{\n");
676 foreach($tag as $par)
678 fwrite ($css_file,
"\t".$par[
"parameter"].
": ".$par[
"value"].
";\n");
681 if ($tag[0][
"tag"] ==
"div" && $tag[0][
"class"] ==
"Page"
682 && $par[
"parameter"] ==
"background-color")
684 $page_background = $par[
"value"];
687 fwrite ($css_file,
"}\n");
688 fwrite ($css_file,
"\n");
691 if ($page_background !=
"")
693 fwrite ($css_file,
"td.ilc_Page\n");
694 fwrite ($css_file,
"{\n");
695 fwrite ($css_file,
"\t".
"background-color: ".$page_background.
";\n");
696 fwrite ($css_file,
"}\n");
714 $rand = rand(1,999999);
718 $fixed_style = $ilias->getSetting(
"fixed_content_style_id");
719 if ($fixed_style > 0)
721 $a_style_id = $fixed_style;
725 if ($a_style_id <= 0)
727 $a_style_id = $ilias->getSetting(
"default_content_style_id");
740 "/css/style_".$a_style_id.
".css?dummy=$rand";
744 return "./Services/COPage/css/content.css";
755 return "./Services/COPage/css/print_content.css";
765 return "./Services/COPage/css/syntaxhighlight.css";
776 $q =
"UPDATE style_data ".
777 "SET category = ".$ilDB->quote($this->
getScope());
791 $q =
"UPDATE style_parameter SET VALUE=".
792 $ilDB->quote($a_value).
" WHERE id = ".
794 $style_set = $this->ilias->db->query($q);
805 $q =
"SELECT * FROM style_parameter WHERE ".
806 " style_id = ".$ilDB->quote($this->
getId()).
" AND ".
807 " tag = ".$ilDB->quote($a_tag).
" AND ".
808 " class = ".$ilDB->quote($a_class).
" AND ".
809 " parameter = ".$ilDB->quote($a_par);
811 $set = $ilDB->query($q);
813 if ($rec = $set->fetchRow())
815 $q =
"UPDATE style_parameter SET ".
816 " value = ".$ilDB->quote($a_val).
" WHERE ".
817 " style_id = ".$ilDB->quote($this->
getId()).
" AND ".
818 " tag = ".$ilDB->quote($a_tag).
" AND ".
819 " class = ".$ilDB->quote($a_class).
" AND ".
820 " parameter = ".$ilDB->quote($a_par);
826 $q =
"INSERT INTO style_parameter (value, style_id, tag, class, parameter) VALUES ".
827 " (".$ilDB->quote($a_val).
",".
828 " ".$ilDB->quote($this->
getId()).
",".
829 " ".$ilDB->quote($a_tag).
",".
830 " ".$ilDB->quote($a_class).
",".
831 " ".$ilDB->quote($a_par).
")";
851 $this->style = $a_style;
860 $xml.=
"<StyleSheet>";
861 $xml.=
"<Title>".$this->getTitle().
"</Title>";
862 $xml.=
"<Description>".$this->getDescription().
"</Description>";
863 foreach($this->style as
$style)
865 $xml.=
"<Style Tag=\"".$style[0][
"tag"].
"\" Class=\"".$style[0][
"class"].
"\">";
866 foreach($style as $tag)
868 $xml.=
"<StyleParameter Name=\"".$tag[
"parameter"].
"\" Value=\"".$tag[
"value"].
"\"/>";
872 $xml.=
"</StyleSheet>";
883 $file = $a_dir.
"/style.xml";
886 if (!($fp = @fopen(
$file,
"w")))
888 die (
"<b>Error</b>: Could not open \"".
$file.
"\" for writing".
889 " in <b>".__FILE__.
"</b> on line <b>".__LINE__.
"</b><br />");
896 fwrite($fp, $this->
getXML());
911 include_once(
"./Services/Style/classes/class.ilStyleImportParser.php");
913 $importParser->startParsing();
916 foreach ($this->style as
$style)
918 foreach($style as $tag)
920 $q =
"INSERT INTO style_parameter (style_id, tag, class, parameter, value) VALUES ".
921 "(".$ilDB->quote($this->
getId()).
",".
922 $ilDB->quote($tag[
"tag"]).
",".
923 $ilDB->quote($tag[
"class"]).
924 ",".$ilDB->quote($tag[
"parameter"]).
",".
925 $ilDB->quote($tag[
"value"]).
")";
926 $this->ilias->db->query($q);
931 $q =
"INSERT INTO style_data (id, uptodate) VALUES ".
932 "(".$ilDB->quote($this->
getId()).
", 0)";
945 $tags = array(
"a.FootnoteLink",
"a.FootnoteLink:hover",
"a.IntLink",
"a.IntLink:hover",
946 "a.IntLink:visited",
"a.IntLink:active",
947 "a.ExtLink",
"a.ExtLink:hover",
"a.ExtLink:visited",
"a.ExtLink:active",
948 "div.Footnote",
"div.LMNavigation",
"div.Page",
"div.PageTitle",
"span.Comment",
949 "span.Emph",
"span.Quotation",
"span.Strong",
950 "td.Cell1",
"td.Cell2",
"td.Cell3",
"td.Cell4",
951 "div.Standard",
"div.List",
"div.Headline1",
"div.Headline2",
"div.Headline3",
952 "div.Example",
"div.Citation",
"div.Mnemonic",
"div.Additional",
"div.Remark",
953 "div.Block",
"div.Special",
"div.Excursus",
955 "table.Media",
"td.MediaCaption");
963 "font-family" => array(),
964 "font-style" => array(
"italic",
"oblique",
"normal"),
965 "font-variant" => array(
"small-caps",
"normal"),
966 "font-weight" => array(
"bold",
"normal",
"bolder",
"lighter"),
967 "font-stretch" => array(
"wider",
"narrower",
"condensed",
"semi-condensed",
968 "extra-condensed",
"ultra-condensed",
"expanded",
"semi-expanded",
969 "extra-expanded",
"ultra-expanded",
"normal"),
970 "font-size" => array(),
971 "word-spacing" => array(),
972 "letter-spacing" => array(),
973 "text-decoration" => array(
"underline",
"overline",
"line-through",
"blink",
"none"),
974 "text-transform" => array(
"capitalize",
"uppercase",
"lowercase",
"none"),
977 "text-indent" => array(),
978 "line-height" => array(),
979 "vertical-align" => array(
"top",
"middle",
"bottom",
"baseline",
"sub",
"super",
980 "text-top",
"text-bottom"),
981 "text-align" => array(
"left",
"center",
"right",
"justify"),
982 "white-space" => array(
"normal",
"pre",
"nowrap"),
985 "margin-top" => array(),
986 "margin-bottom" => array(),
987 "margin-left" => array(),
988 "margin-right" => array(),
990 "padding" => array(),
991 "padding-top" => array(),
992 "padding-bottom" => array(),
993 "padding-left" => array(),
994 "padding-right" => array(),
996 "border-width" => array(),
997 "border-top-width" => array(),
998 "border-bottom-width" => array(),
999 "border-left-width" => array(),
1000 "border-right-width" => array(),
1002 "border-color" => array(),
1003 "border-top-color" => array(),
1004 "border-bottom-color" => array(),
1005 "border-left-color" => array(),
1006 "border-right-color" => array(),
1008 "border-style" => array(
"none",
"hidden",
"dotted",
"dashed",
"solid",
"double",
1009 "groove",
"ridge",
"inset",
"outset"),
1010 "border-top-style" => array(
"none",
"hidden",
"dotted",
"dashed",
"solid",
"double",
1011 "groove",
"ridge",
"inset",
"outset"),
1012 "border-bottom-style" => array(
"none",
"hidden",
"dotted",
"dashed",
"solid",
"double",
1013 "groove",
"ridge",
"inset",
"outset"),
1014 "border-left-style" => array(
"none",
"hidden",
"dotted",
"dashed",
"solid",
"double",
1015 "groove",
"ridge",
"inset",
"outset"),
1016 "border-right-style" => array(
"none",
"hidden",
"dotted",
"dashed",
"solid",
"double",
1017 "groove",
"ridge",
"inset",
"outset"),
1019 "background-color" => array(),
1020 "background-image" => array(),
1021 "background-repeat" => array(
"repeat",
"repeat-x",
"repeat-y",
"no-repeat"),
1022 "background-attachment" => array(
"fixed",
"scroll"),
1023 "background-position" => array(
"top",
"center",
"middle",
"bottom",
"left",
"right"),
1025 "cursor" => array(
"auto",
"default",
"crosshair",
"pointer",
"move",
1026 "n-resize",
"ne-resize",
"e-resize",
"se-resize",
"s-resize",
"sw-resize",
1027 "w-resize",
"nw-resize",
"text",
"wait",
"help"),
1028 "clear" => array (
"non",
"left",
"right",
"both")