5 require_once
"./Services/Object/classes/class.ilObject.php";
19 public static $num_unit = array(
"px",
"em",
"ex",
"%",
"pt",
"pc",
"in",
"mm",
"cm");
25 "values" => array(
"xx-small",
"x-small",
"small",
"medium",
"large",
"x-large",
"xx-large",
"smaller",
"larger"),
26 "input" =>
"fontsize",
28 "font-family" => array(
32 "font-style" => array(
33 "values" => array(
"italic",
"oblique",
"normal"),
36 "font-weight" => array(
37 "values" => array(
"bold",
"normal",
"bolder",
"lighter"),
40 "font-variant" => array(
41 "values" => array(
"small-caps",
"normal"),
44 "word-spacing" => array(
46 "input" =>
"numeric_no_perc",
48 "letter-spacing" => array(
50 "input" =>
"numeric_no_perc",
52 "text-decoration" => array(
53 "values" => array(
"underline",
"overline",
"line-through",
"blink",
"none"),
56 "text-transform" => array(
57 "values" => array(
"capitalize",
"uppercase",
"lowercase",
"none"),
64 "text-indent" => array(
68 "line-height" => array(
72 "vertical-align" => array(
73 "values" => array(
"top",
"middle",
"bottom",
"baseline",
"sub",
"super",
74 "text-top",
"text-bottom"),
77 "text-align" => array(
78 "values" => array(
"left",
"center",
"right",
"justify"),
81 "white-space" => array(
82 "values" => array(
"normal",
"pre",
"nowrap"),
87 "input" =>
"trbl_numeric",
88 "subpar" => array(
"margin",
"margin-top",
"margin-right",
89 "margin-bottom",
"margin-left"),
90 "group" =>
"margin_and_padding"),
93 "input" =>
"trbl_numeric",
94 "subpar" => array(
"padding",
"padding-top",
"padding-right",
95 "padding-bottom",
"padding-left"),
96 "group" =>
"margin_and_padding"),
97 "border-width" => array(
98 "values" => array(
"thin",
"medium",
"thick"),
99 "input" =>
"border_width",
100 "subpar" => array(
"border-width",
"border-top-width",
"border-right-width",
101 "border-bottom-width",
"border-left-width"),
102 "group" =>
"border"),
103 "border-color" => array(
105 "input" =>
"trbl_color",
106 "subpar" => array(
"border-color",
"border-top-color",
"border-right-color",
107 "border-bottom-color",
"border-left-color"),
108 "group" =>
"border"),
109 "border-style" => array(
110 "values" => array(
"none",
"hidden",
"dotted",
"dashed",
"solid",
"double",
111 "groove",
"ridge",
"inset",
"outset"),
112 "input" =>
"border_style",
113 "subpar" => array(
"border-style",
"border-top-style",
"border-right-style",
114 "border-bottom-style",
"border-left-style"),
115 "group" =>
"border"),
117 "background-color" => array(
120 "group" =>
"background"),
121 "background-image" => array(
123 "input" =>
"background_image",
124 "group" =>
"background"),
125 "background-repeat" => array(
126 "values" => array(
"repeat",
"repeat-x",
"repeat-y",
"no-repeat"),
128 "group" =>
"background"),
129 "background-attachment" => array(
130 "values" => array(
"fixed",
"scroll"),
132 "group" =>
"background"),
133 "background-position" => array(
134 "values" => array(
"horizontal" => array(
"left",
"center",
"right"),
135 "vertical" => array(
"top",
"center",
"bottom")),
136 "input" =>
"background_position",
137 "group" =>
"background"),
140 "values" => array(
"absolute",
"fixed",
"relative",
"static"),
142 "group" =>
"positioning"),
145 "input" =>
"numeric",
146 "group" =>
"positioning"),
149 "input" =>
"numeric",
150 "group" =>
"positioning"),
153 "input" =>
"numeric",
154 "group" =>
"positioning"),
157 "input" =>
"numeric",
158 "group" =>
"positioning"),
161 "input" =>
"numeric",
162 "group" =>
"positioning"),
165 "input" =>
"numeric",
166 "group" =>
"positioning"),
167 "min-height" => array(
169 "input" =>
"numeric",
170 "group" =>
"positioning"),
172 "values" => array(
"left",
"right",
"none"),
174 "group" =>
"positioning"),
176 "values" => array(
"visible",
"hidden",
"scroll",
"auto"),
178 "group" =>
"positioning"),
182 "input" =>
"percentage",
183 "group" =>
"special"),
185 "values" => array(
"auto",
"default",
"crosshair",
"pointer",
"move",
186 "n-resize",
"ne-resize",
"e-resize",
"se-resize",
"s-resize",
"sw-resize",
187 "w-resize",
"nw-resize",
"text",
"wait",
"help"),
189 "group" =>
"special"),
191 "values" => array (
"both",
"left",
"right",
"none"),
193 "group" =>
"special"),
195 "list-style-type.ol" => array(
196 "values" => array (
"decimal",
"lower-roman",
"upper-roman",
197 "lower-alpha",
"upper-alpha",
"lower-greek",
"hebrew",
198 "decimal-leading-zero",
"cjk-ideographic",
"hiragana",
199 "katakana",
"hiragana-iroha",
"katakana-iroha",
"none"),
202 "list-style-type.ul" => array(
203 "values" => array (
"disc",
"circle",
"square",
207 "list-style-image.ul" => array(
209 "input" =>
"background_image",
211 "list-style-position.ol" => array(
212 "values" => array (
"inside",
"outside"),
215 "list-style-position.ul" => array(
216 "values" => array (
"inside",
"outside"),
220 "border-collapse" => array(
221 "values" => array (
"collapse",
"separate"),
225 "caption-side" => array(
226 "values" => array (
"top",
"bottom",
"left",
"right"),
235 array(
"ol" => array(
"ol"),
"ul" => array(
"ul"),
236 "table" => array(
"table"),
"positioning" => array(
"h1",
"h2",
"h3",
"div",
"img",
"table",
"a"));
240 "text_block" => array(
"text_block",
"heading1",
"heading2",
"heading3"),
241 "text_inline" => array(
"text_inline"),
242 "section" => array(
"section"),
243 "link" => array(
"link"),
244 "table" => array(
"table",
"table_cell",
"table_caption"),
245 "list" => array(
"list_o",
"list_u",
"list_item"),
246 "flist" => array(
"flist_cont",
"flist_head",
"flist",
"flist_li",
"flist_a"),
247 "media" => array(
"media_cont",
"media_caption",
"iim",
"marker"),
248 "tabs" => array(
"va_cntr",
"va_icntr",
"va_ihead",
"va_icont",
249 "ha_cntr",
"ha_icntr",
"ha_ihead",
"ha_icont"),
250 "question" => array(
"question",
"qtitle",
"qanswer",
"qinput",
"qlinput",
"qsubmit",
"qfeedr",
"qfeedw",
251 "qimg",
"qordul",
"qordli",
"qimgd",
"qetitem",
"qetcorr",
"qover"),
252 "page" => array(
"page_frame",
"page_cont",
"page_title",
"page_fn",
253 "page_tnav",
"page_bnav",
"page_lnav",
"page_rnav",
"page_lnavlink",
"page_rnavlink",
254 "page_lnavimage",
"page_rnavimage"),
255 "glo" => array(
"glo_overlay",
"glo_ovtitle",
"glo_ovclink",
"glo_ovuglink",
"glo_ovuglistlink"),
256 "sco" => array(
"sco_title",
"sco_keyw",
"sco_desc",
"sco_desct",
"sco_obj",
"sco_objt",
"sco_fmess"),
257 "rte" => array(
"rte_menu",
"rte_mlink",
"rte_tree",
"rte_node",
"rte_tlink",
"rte_status",
258 "rte_tul",
"rte_tli",
"rte_texp",
"rte_tclink",
"rte_drag")
263 "text_block",
"section",
"media_cont",
"table",
"table_cell",
"flist_li",
"table_caption",
265 "va_cntr",
"va_icntr",
"va_ihead",
"va_icont",
266 "ha_cntr",
"ha_icntr",
"ha_ihead",
"ha_icont"
271 "table",
"table_cell"
276 "text_block" =>
"div",
280 "text_inline" =>
"span",
284 "table_cell" =>
"td",
285 "table_caption" =>
"caption",
286 "media_cont" =>
"table",
287 "media_caption" =>
"div",
290 "glo_overlay" =>
"div",
291 "glo_ovtitle" =>
"h1",
292 "glo_ovclink" =>
"a",
293 "glo_ovuglink" =>
"a",
294 "glo_ovuglistlink" =>
"a",
295 "sco_title" =>
"div",
299 "sco_desct" =>
"div",
301 "sco_fmess" =>
"div",
308 "rte_status" =>
"div",
316 "flist_cont" =>
"div",
317 "flist_head" =>
"div",
331 "qlinput" =>
"textarea",
332 "qsubmit" =>
"input",
336 "page_frame" =>
"div",
337 "page_cont" =>
"div",
340 "page_tnav" =>
"div",
341 "page_bnav" =>
"div",
342 "page_lnav" =>
"div",
343 "page_rnav" =>
"div",
344 "page_lnavlink" =>
"a",
345 "page_rnavlink" =>
"a",
346 "page_lnavimage" =>
"img",
347 "page_rnavimage" =>
"img",
348 "page_title" =>
"h1",
361 array (
"a" => array(
"hover"),
"div" => array(
"hover"),
"img" => array(
"hover"));
365 array(
"type" =>
"text_block",
"class" =>
"Standard"),
366 array(
"type" =>
"text_block",
"class" =>
"List"),
367 array(
"type" =>
"text_block",
"class" =>
"TableContent"),
368 array(
"type" =>
"heading1",
"class" =>
"Headline1"),
369 array(
"type" =>
"heading2",
"class" =>
"Headline2"),
370 array(
"type" =>
"heading3",
"class" =>
"Headline3"),
371 array(
"type" =>
"text_inline",
"class" =>
"Comment"),
372 array(
"type" =>
"text_inline",
"class" =>
"Emph"),
373 array(
"type" =>
"text_inline",
"class" =>
"Quotation"),
374 array(
"type" =>
"text_inline",
"class" =>
"Strong"),
375 array(
"type" =>
"text_inline",
"class" =>
"Accent"),
376 array(
"type" =>
"text_inline",
"class" =>
"Important"),
377 array(
"type" =>
"link",
"class" =>
"IntLink"),
378 array(
"type" =>
"link",
"class" =>
"ExtLink"),
379 array(
"type" =>
"link",
"class" =>
"FootnoteLink"),
380 array(
"type" =>
"link",
"class" =>
"FileLink"),
381 array(
"type" =>
"link",
"class" =>
"GlossaryLink"),
382 array(
"type" =>
"media_cont",
"class" =>
"MediaContainer"),
383 array(
"type" =>
"table",
"class" =>
"StandardTable"),
384 array(
"type" =>
"media_caption",
"class" =>
"MediaCaption"),
385 array(
"type" =>
"iim",
"class" =>
"ContentPopup"),
386 array(
"type" =>
"marker",
"class" =>
"Marker"),
387 array(
"type" =>
"page_frame",
"class" =>
"PageFrame"),
388 array(
"type" =>
"page_cont",
"class" =>
"PageContainer"),
389 array(
"type" =>
"page",
"class" =>
"Page"),
390 array(
"type" =>
"page_tnav",
"class" =>
"TopNavigation"),
391 array(
"type" =>
"page_bnav",
"class" =>
"BottomNavigation"),
392 array(
"type" =>
"page_lnav",
"class" =>
"LeftNavigation"),
393 array(
"type" =>
"page_rnav",
"class" =>
"RightNavigation"),
394 array(
"type" =>
"page_lnavlink",
"class" =>
"LeftNavigationLink"),
395 array(
"type" =>
"page_rnavlink",
"class" =>
"RightNavigationLink"),
396 array(
"type" =>
"page_lnavimage",
"class" =>
"LeftNavigationImage"),
397 array(
"type" =>
"page_rnavimage",
"class" =>
"RightNavigationImage"),
398 array(
"type" =>
"page_fn",
"class" =>
"Footnote"),
399 array(
"type" =>
"page_title",
"class" =>
"PageTitle"),
400 array(
"type" =>
"glo_overlay",
"class" =>
"GlossaryOverlay"),
401 array(
"type" =>
"glo_ovtitle",
"class" =>
"GlossaryOvTitle"),
402 array(
"type" =>
"glo_ovclink",
"class" =>
"GlossaryOvCloseLink"),
403 array(
"type" =>
"glo_ovuglink",
"class" =>
"GlossaryOvUnitGloLink"),
404 array(
"type" =>
"glo_ovuglistlink",
"class" =>
"GlossaryOvUGListLink"),
405 array(
"type" =>
"sco_title",
"class" =>
"Title"),
406 array(
"type" =>
"sco_desc",
"class" =>
"Description"),
407 array(
"type" =>
"sco_desct",
"class" =>
"DescriptionTop"),
408 array(
"type" =>
"sco_keyw",
"class" =>
"Keywords"),
409 array(
"type" =>
"sco_obj",
"class" =>
"Objective"),
410 array(
"type" =>
"sco_objt",
"class" =>
"ObjectiveTop"),
411 array(
"type" =>
"sco_fmess",
"class" =>
"FinalMessage"),
412 array(
"type" =>
"rte_menu",
"class" =>
"RTEMenu"),
413 array(
"type" =>
"rte_menu",
"class" =>
"RTELogo"),
414 array(
"type" =>
"rte_menu",
"class" =>
"RTELinkBar"),
415 array(
"type" =>
"rte_mlink",
"class" =>
"RTELink"),
416 array(
"type" =>
"rte_mlink",
"class" =>
"RTELinkDisabled"),
417 array(
"type" =>
"rte_tree",
"class" =>
"RTETree"),
418 array(
"type" =>
"rte_node",
"class" =>
"RTECourse"),
419 array(
"type" =>
"rte_node",
"class" =>
"RTEChapter"),
420 array(
"type" =>
"rte_node",
"class" =>
"RTESco"),
421 array(
"type" =>
"rte_node",
"class" =>
"RTEAsset"),
422 array(
"type" =>
"rte_node",
"class" =>
"RTECourseDisabled"),
423 array(
"type" =>
"rte_node",
"class" =>
"RTEChapterDisabled"),
424 array(
"type" =>
"rte_node",
"class" =>
"RTEScoDisabled"),
425 array(
"type" =>
"rte_node",
"class" =>
"RTEAssetDisabled"),
426 array(
"type" =>
"rte_status",
"class" =>
"RTEAsset"),
427 array(
"type" =>
"rte_status",
"class" =>
"RTECompleted"),
428 array(
"type" =>
"rte_status",
"class" =>
"RTENotAttempted"),
429 array(
"type" =>
"rte_status",
"class" =>
"RTERunning"),
430 array(
"type" =>
"rte_status",
"class" =>
"RTEIncomplete"),
431 array(
"type" =>
"rte_status",
"class" =>
"RTEPassed"),
432 array(
"type" =>
"rte_status",
"class" =>
"RTEFailed"),
433 array(
"type" =>
"rte_status",
"class" =>
"RTEBrowsed"),
434 array(
"type" =>
"rte_tlink",
"class" =>
"RTETreeLink"),
435 array(
"type" =>
"rte_tlink",
"class" =>
"RTETreeLinkDisabled"),
436 array(
"type" =>
"rte_tlink",
"class" =>
"RTETreeCurrent"),
437 array(
"type" =>
"rte_tul",
"class" =>
"RTETreeList"),
438 array(
"type" =>
"rte_tli",
"class" =>
"RTETreeItem"),
439 array(
"type" =>
"rte_texp",
"class" =>
"RTETreeExpanded"),
440 array(
"type" =>
"rte_texp",
"class" =>
"RTETreeCollapsed"),
441 array(
"type" =>
"rte_tree",
"class" =>
"RTETreeControl"),
442 array(
"type" =>
"rte_tclink",
"class" =>
"RTETreeControlLink"),
443 array(
"type" =>
"rte_drag",
"class" =>
"RTEDragBar"),
444 array(
"type" =>
"list_o",
"class" =>
"NumberedList"),
445 array(
"type" =>
"list_u",
"class" =>
"BulletedList"),
446 array(
"type" =>
"list_item",
"class" =>
"StandardListItem"),
447 array(
"type" =>
"question",
"class" =>
"Standard"),
448 array(
"type" =>
"question",
"class" =>
"SingleChoice"),
449 array(
"type" =>
"question",
"class" =>
"MultipleChoice"),
450 array(
"type" =>
"question",
"class" =>
"TextQuestion"),
451 array(
"type" =>
"question",
"class" =>
"OrderingQuestion"),
452 array(
"type" =>
"question",
"class" =>
"MatchingQuestion"),
453 array(
"type" =>
"question",
"class" =>
"ImagemapQuestion"),
454 array(
"type" =>
"question",
"class" =>
"ErrorText"),
455 array(
"type" =>
"question",
"class" =>
"TextSubset"),
456 array(
"type" =>
"question",
"class" =>
"ClozeTest"),
457 array(
"type" =>
"qtitle",
"class" =>
"Title"),
458 array(
"type" =>
"qanswer",
"class" =>
"Answer"),
459 array(
"type" =>
"qimg",
"class" =>
"QuestionImage"),
460 array(
"type" =>
"qimgd",
"class" =>
"ImageDetailsLink"),
461 array(
"type" =>
"qordul",
"class" =>
"OrderList"),
462 array(
"type" =>
"qordli",
"class" =>
"OrderListItem"),
463 array(
"type" =>
"qordul",
"class" =>
"OrderListHorizontal"),
464 array(
"type" =>
"qordli",
"class" =>
"OrderListItemHorizontal"),
465 array(
"type" =>
"qetitem",
"class" =>
"ErrorTextItem"),
466 array(
"type" =>
"qetitem",
"class" =>
"ErrorTextSelected"),
467 array(
"type" =>
"qetcorr",
"class" =>
"ErrorTextCorrected"),
468 array(
"type" =>
"qinput",
"class" =>
"TextInput"),
469 array(
"type" =>
"qlinput",
"class" =>
"LongTextInput"),
470 array(
"type" =>
"qsubmit",
"class" =>
"Submit"),
471 array(
"type" =>
"qfeedr",
"class" =>
"FeedbackRight"),
472 array(
"type" =>
"qfeedw",
"class" =>
"FeedbackWrong"),
473 array(
"type" =>
"qover",
"class" =>
"Correct"),
474 array(
"type" =>
"qover",
"class" =>
"Inorrect"),
475 array(
"type" =>
"qover",
"class" =>
"StatusMessage"),
476 array(
"type" =>
"qover",
"class" =>
"WrongAnswersMessage"),
477 array(
"type" =>
"flist_cont",
"class" =>
"FileListContainer"),
478 array(
"type" =>
"flist_head",
"class" =>
"FileListHeading"),
479 array(
"type" =>
"flist",
"class" =>
"FileList"),
480 array(
"type" =>
"flist_li",
"class" =>
"FileListItem"),
481 array(
"type" =>
"flist_a",
"class" =>
"FileListItemLink")
487 "caption" =>
"table_caption",
488 "row_head" =>
"table_cell",
489 "row_foot" =>
"table_cell",
490 "col_head" =>
"table_cell",
491 "col_foot" =>
"table_cell",
492 "odd_row" =>
"table_cell",
493 "even_row" =>
"table_cell",
494 "odd_col" =>
"table_cell",
495 "even_col" =>
"table_cell"),
496 "vaccordion" => array(
497 "va_cntr" =>
"va_cntr",
498 "va_icntr" =>
"va_icntr",
499 "va_ihead" =>
"va_ihead",
500 "va_icont" =>
"va_icont"
502 "haccordion" => array(
503 "ha_cntr" =>
"ha_cntr",
504 "ha_icntr" =>
"ha_icntr",
505 "ha_ihead" =>
"ha_ihead",
506 "ha_icont" =>
"ha_icont"
524 $this->style = array();
525 if($a_call_by_reference)
527 $this->ilias->raiseError(
"Can't instantiate style object via reference id.",$this->ilias->error_obj->FATAL);
538 $this->ilias->raiseError(
"Operation ilObjStyleSheet::setRefId() not allowed.",$this->ilias->error_obj->FATAL);
555 $this->ilias->raiseError(
"Operation ilObjStyleSheet::putInTree() not allowed.",$this->ilias->error_obj->FATAL);
563 $this->ilias->raiseError(
"Operation ilObjStyleSheet::createReference() not allowed.",$this->ilias->error_obj->FATAL);
571 $this->up_to_date = $a_up_to_date;
579 return $this->up_to_date;
587 $this->scope = $a_scope;
605 $q =
"UPDATE style_data SET uptodate = ".
606 $ilDB->quote((
int) $a_up_to_date,
"integer").
607 " WHERE id = ".$ilDB->quote($a_id,
"integer");
608 $ilDB->manipulate($q);
618 $q =
"SELECT uptodate FROM style_data ".
619 " WHERE id = ".$ilDB->quote($a_id,
"integer");
620 $res = $ilDB->query($q);
621 $sty = $ilDB->fetchAssoc(
$res);
623 return (
boolean) $sty[
"uptodate"];
633 $q =
"UPDATE style_data SET standard = ".
634 $ilDB->quote((
int) $a_std,
"integer").
635 " WHERE id = ".$ilDB->quote($a_id,
"integer");
636 $ilDB->manipulate($q);
646 $q =
"UPDATE style_data SET category = ".
647 $ilDB->quote((
int) $a_scope,
"integer").
648 " WHERE id = ".$ilDB->quote($a_id,
"integer");
649 $ilDB->manipulate($q);
659 $q =
"SELECT * FROM style_data ".
660 " WHERE id = ".$ilDB->quote($a_id,
"integer");
661 $res = $ilDB->query($q);
662 $sty = $ilDB->fetchAssoc(
$res);
664 return (
boolean) $sty[
"standard"];
674 $q =
"UPDATE style_data SET active = ".
675 $ilDB->quote((
int) $a_active,
"integer").
676 " WHERE id = ".$ilDB->quote($a_id,
"integer");
677 $ilDB->manipulate($q);
687 $q =
"SELECT * FROM style_data ".
688 " WHERE id = ".$ilDB->quote($a_id,
"integer");
689 $res = $ilDB->query($q);
690 $sty = $ilDB->fetchAssoc(
$res);
692 return (
boolean) $sty[
"active"];
699 $a_include_deactivated =
false, $a_scope = 0)
701 global $ilDB,
$ilias, $tree;
703 $default_style = $ilias->getSetting(
"default_content_style_id");
706 if (!$a_include_deactivated)
708 $and_str =
" AND active = 1";
711 $q =
"SELECT * FROM style_data ".
712 " WHERE standard = 1".$and_str;
713 $res = $ilDB->query($q);
715 while($sty = $ilDB->fetchAssoc(
$res))
717 if (!$a_exclude_default_style || $default_style != $sty[
"id"])
720 if ($a_scope > 0 && $sty[
"category"] > 0)
722 if ($tree->isInTree($sty[
"category"]) &&
723 $tree->isInTree($a_scope))
725 $path = $tree->getPathId($a_scope);
726 if (!in_array($sty[
"category"],
$path))
746 global $ilAccess, $ilDB;
748 $clonable_styles = array();
750 $q =
"SELECT * FROM style_data";
751 $style_set = $ilDB->query($q);
752 while($style_rec = $ilDB->fetchAssoc($style_set))
755 if ($style_rec[
"standard"] == 1)
757 if ($style_rec[
"active"] == 1)
764 include_once(
"./Modules/LearningModule/classes/class.ilObjContentObject.php");
766 foreach($obj_ids as
$id)
771 if ($ilAccess->checkAccess(
"write",
"", $ref_id))
780 $clonable_styles[$style_rec[
"id"]] =
784 return $clonable_styles;
792 $this->meta_data =& $a_meta_data;
802 if (!is_object(self::$basic_style_dom))
804 self::$basic_style_dom =
new DOMDocument();
805 self::$basic_style_dom->load(self::$basic_style_file);
816 return $this->meta_data;
822 function create($a_from_style = 0, $a_import_mode =
false)
828 if ($a_from_style == 0)
845 $q =
"SELECT * FROM style_parameter WHERE style_id = ".
846 $ilDB->quote($a_from_style,
"integer");
847 $par_set = $ilDB->query($q);
848 while($par_rec = $ilDB->fetchAssoc($par_set))
850 $def[] = array(
"tag" => $par_rec[
"tag"],
"class" => $par_rec[
"class"],
851 "parameter" => $par_rec[
"parameter"],
"value" => $par_rec[
"value"],
852 "type" => $par_rec[
"type"]);
857 $q =
"SELECT * FROM style_char WHERE style_id = ".
858 $ilDB->quote($a_from_style,
"integer");
859 $par_set = $ilDB->query($q);
860 while($par_rec = $ilDB->fetchAssoc($par_set))
862 $chars[] = array(
"type" => $par_rec[
"type"],
"characteristic" => $par_rec[
"characteristic"]);
866 foreach ($def as $sty)
868 $id = $ilDB->nextId(
"style_parameter");
869 $q =
"INSERT INTO style_parameter (id, style_id, tag, class, parameter, value, type) VALUES ".
871 $ilDB->quote(
$id,
"integer").
",".
872 $ilDB->quote($this->
getId(),
"integer").
",".
873 $ilDB->quote($sty[
"tag"],
"text").
",".
874 $ilDB->quote($sty[
"class"],
"text").
",".
875 $ilDB->quote($sty[
"parameter"],
"text").
",".
876 $ilDB->quote($sty[
"value"],
"text").
",".
877 $ilDB->quote($sty[
"type"],
"text").
")";
878 $ilDB->manipulate($q);
882 foreach ($chars as $char)
884 $q =
"INSERT INTO style_char (style_id, type, characteristic) VALUES ".
885 "(".$ilDB->quote($this->
getId(),
"integer").
",".
886 $ilDB->quote($char[
"type"],
"text").
",".
887 $ilDB->quote($char[
"characteristic"],
"text").
")";
888 $ilDB->manipulate($q);
892 $q =
"INSERT INTO style_data (id, uptodate, category) VALUES ".
893 "(".$ilDB->quote($this->
getId(),
"integer").
", 0,".
894 $ilDB->quote((
int) $this->
getScope(),
"integer").
")";
895 $ilDB->manipulate($q);
904 $colors = $from_style->getColors();
905 foreach ($colors as $c)
907 $this->
addColor($c[
"name"], $c[
"code"]);
912 foreach ($tcts as $tct => $v)
917 $this->
addTemplate($tct, $t[
"name"], $t[
"classes"]);
939 if (empty(
$core_styles[$a_type.
".".$a_tag.
".".$a_class]))
942 $st = $ilDB->manipulateF(
943 "DELETE FROM style_char WHERE style_id = %s AND type = %s AND characteristic = %s",
944 array(
"integer",
"text",
"text"),
945 array($this->
getId(), $a_type, $a_class));
948 $st = $ilDB->manipulateF(
"DELETE FROM style_parameter WHERE style_id = %s AND tag = %s AND type = %s AND class = %s",
949 array(
"integer",
"text",
"text",
"text"),
950 array($this->
getId(), $a_tag, $a_type, $a_class));
964 $set = $ilDB->queryF(
965 "SELECT style_id FROM style_char WHERE style_id = %s AND characteristic = %s AND type = %s",
966 array(
"integer",
"text",
"text"),
967 array($this->
getId(), $a_char, $a_style_type));
968 if ($rec = $ilDB->fetchAssoc($set))
983 $ilDB->manipulateF(
"INSERT INTO style_char (style_id, type, characteristic, hide)".
984 " VALUES (%s,%s,%s,%s) ",
985 array(
"integer",
"text",
"text",
"integer"),
986 array($this->
getId(), $a_type, $a_char, $a_hidden));
999 $a_from_type, $a_from_char, $a_to_char)
1011 $pars = $from_style->getParametersOfClass($a_from_type, $a_from_char);
1014 foreach ($pars as $p => $v)
1016 if (substr($v, 0, 1) ==
"!")
1018 $colors[] = substr($v, 1);
1021 $a_to_char, $p, $v, $a_from_type);
1025 foreach ($colors as $c)
1029 $this->
addColor($c, $from_style->getColorCodeForName($c));
1043 $chars = $this->chars;
1045 if (is_array($this->chars_by_type[$a_type]))
1047 $chars = $this->chars_by_type[$a_type];
1052 foreach ($chars as $k => $char)
1054 if ($a_type ==
"" && $this->hidden_chars[$char[
"type"].
":".$char[
"class"]])
1058 else if ($this->hidden_chars[$a_type.
":".$char])
1073 $this->chars = $a_chars;
1084 $ilDB->manipulate(
"UPDATE style_char SET ".
1085 " hide = ".$ilDB->quote((
int) $a_hide,
"integer").
1086 " WHERE style_id = ".$ilDB->quote($this->
getId(),
"integer").
" AND ".
1087 " type = ".$ilDB->quote($a_type,
"text").
" AND ".
1088 " characteristic = ".$ilDB->quote($a_char,
"text")
1099 $set = $ilDB->query(
"SELECT hide FROM style_char ".
1100 " WHERE style_id = ".$ilDB->quote($this->getId(),
"integer").
" AND ".
1101 " type = ".$ilDB->quote($a_type,
"text").
" AND ".
1102 " characteristic = ".$ilDB->quote($a_char,
"text")
1104 $rec = $ilDB->fetchAssoc($set);
1106 return $rec[
"hide"];
1119 $lng->loadLanguageModule(
"style");
1122 $new_obj->setTitle($this->
getTitle().
" (".$lng->txt(
"sty_acopy").
")");
1123 $new_obj->setType($this->
getType());
1125 $new_obj->create($this->
getId());
1127 $new_obj->writeStyleSetting(
"disable_auto_margins",
1130 return $new_obj->getId();
1153 $tag = explode(
".", $a_tag);
1154 $value = $avail_params[$a_par][0];
1155 $id = $ilDB->nextId(
"style_parameter");
1156 $q =
"INSERT INTO style_parameter (id,style_id, type, tag, class, parameter, value) VALUES ".
1158 $ilDB->quote(
$id,
"integer").
",".
1159 $ilDB->quote($this->
getId(),
"integer").
",".
1160 $ilDB->quote($a_type,
"text").
",".
1161 $ilDB->quote($tag[0],
"text").
",".
1162 $ilDB->quote($tag[1],
"text").
",".
1163 $ilDB->quote($a_par,
"text").
",".
1164 $ilDB->quote($value,
"text").
")";
1165 $ilDB->manipulate($q);
1189 if(!is_writable($sty_data_dir))
1191 $ilErr->raiseError(
"Style data directory (".$sty_data_dir
1192 .
") not writeable.", $ilErr->FATAL);
1195 $style_dir = $sty_data_dir.
"/sty_".$a_style_id;
1197 if(!@is_dir($style_dir))
1199 $ilErr->raiseError(
"Creation of style directory failed (".
1200 $style_dir.
").",$ilErr->FATAL);
1204 $im_dir = $style_dir.
"/images";
1206 if(!@is_dir($im_dir))
1208 $ilErr->raiseError(
"Creation of Import Directory failed (".
1209 $im_dir.
").", $ilErr->FATAL);
1213 $thumb_dir = $style_dir.
"/images/thumbnails";
1215 if(!@is_dir($thumb_dir))
1217 $ilErr->raiseError(
"Creation of Import Directory failed (".
1218 $thumb_dir.
").", $ilErr->FATAL);
1258 foreach($entries as $entry)
1260 if (substr($entry[
"entry"],0,1) ==
".")
1264 if ($entry[
"type"] !=
"dir")
1310 $q =
"DELETE FROM style_parameter WHERE id = ".
1311 $ilDB->quote($a_id,
"integer");
1327 $q =
"DELETE FROM style_parameter WHERE ".
1328 " style_id = ".$ilDB->quote($this->
getId(),
"integer").
" AND ".
1329 " tag = ".$ilDB->quote($a_tag,
"text").
" AND ".
1330 " class = ".$ilDB->quote($a_class,
"text").
" AND ".
1331 " ".$ilDB->equals(
"type", $a_type,
"text",
true).
" AND ".
1332 " parameter = ".$ilDB->quote($a_par,
"text");
1334 $ilDB->manipulate($q);
1349 $q =
"DELETE FROM style_parameter WHERE ".
1350 " style_id = ".$ilDB->quote($this->
getId(),
"integer").
" AND ".
1351 " class = ".$ilDB->quote($a_class,
"text").
" AND ".
1352 " ".$ilDB->equals(
"type", $a_type,
"text",
true);
1354 $ilDB->manipulate($q);
1369 $def_style = $this->ilias->getSetting(
"default_content_style_id");
1370 if ($def_style == $this->
getId())
1372 $this->ilias->deleteSetting(
"default_content_style_id");
1376 $fixed_style = $this->ilias->getSetting(
"fixed_content_style_id");
1377 if ($fixed_style == $this->
getId())
1379 $this->ilias->deleteSetting(
"fixed_content_style_id");
1383 $q =
"DELETE FROM style_parameter WHERE style_id = ".
1384 $ilDB->quote($this->
getId(),
"integer");
1385 $ilDB->manipulate($q);
1389 if (is_file($css_file_name))
1391 unlink($css_file_name);
1395 include_once(
"./Modules/LearningModule/classes/class.ilObjContentObject.php");
1399 $q =
"DELETE FROM style_data WHERE id = ".
1400 $ilDB->quote($this->
getId(),
"integer");
1401 $ilDB->manipulate($q);
1415 $q =
"SELECT * FROM style_parameter WHERE style_id = ".
1416 $ilDB->quote($this->
getId(),
"integer").
" ORDER BY tag, class, type ";
1417 $style_set = $ilDB->query($q);
1421 $this->style = array();
1422 while($style_rec = $ilDB->fetchAssoc($style_set))
1424 if ($style_rec[
"tag"] != $ctag || $style_rec[
"class"] != $cclass
1425 || $style_rec[
"type"] != $ctype)
1430 $this->style[] = $tag;
1434 $ctag = $style_rec[
"tag"];
1435 $cclass = $style_rec[
"class"];
1436 $ctype = $style_rec[
"type"];
1437 $tag[] = $style_rec;
1438 $this->style_class[$ctype][$cclass][$style_rec[
"parameter"]] = $style_rec[
"value"];
1442 $this->style[] = $tag;
1445 $q =
"SELECT * FROM style_data WHERE id = ".
1446 $ilDB->quote($this->
getId(),
"integer");
1447 $res = $ilDB->query($q);
1448 $sty = $ilDB->fetchAssoc(
$res);
1453 $this->chars = array();
1454 $this->chars_by_type = array();
1455 $q =
"SELECT * FROM style_char WHERE style_id = ".
1456 $ilDB->quote($this->
getId(),
"integer").
1457 " ORDER BY type ASC, characteristic ASC";
1458 $par_set = $ilDB->query($q);
1459 while($par_rec = $ilDB->fetchAssoc($par_set))
1461 $this->chars[] = array(
"type" => $par_rec[
"type"],
"class" => $par_rec[
"characteristic"],
"hide" => $par_rec[
"hide"]);
1462 $this->chars_by_type[$par_rec[
"type"]][] = $par_rec[
"characteristic"];
1463 if ($par_rec[
"hide"])
1465 $this->hidden_chars[$par_rec[
"type"].
":".$par_rec[
"characteristic"]] =
true;
1477 if ($a_target_file ==
"")
1483 $css_file_name = $a_target_file;
1485 $css_file = fopen($css_file_name,
"w");
1487 $page_background =
"";
1491 fwrite ($css_file, $tag[0][
"tag"].
".ilc_".$tag[0][
"type"].
"_".$tag[0][
"class"].
"\n");
1492 if ($tag[0][
"tag"] ==
"td")
1494 fwrite ($css_file,
",th".
".ilc_".$tag[0][
"type"].
"_".$tag[0][
"class"].
"\n");
1496 if (in_array($tag[0][
"tag"], array(
"h1",
"h2",
"h3")))
1498 fwrite ($css_file,
",div.ilc_text_block_".$tag[0][
"class"].
"\n");
1499 fwrite ($css_file,
",body.ilc_text_block_".$tag[0][
"class"].
"\n");
1501 if ($tag[0][
"type"] ==
"text_block")
1503 fwrite ($css_file,
",body.ilc_text_block_".$tag[0][
"class"].
"\n");
1505 fwrite ($css_file,
"{\n");
1508 $t_border = array();
1510 foreach($tag as $par)
1512 $cur_par = $par[
"parameter"];
1513 $cur_val = $par[
"value"];
1516 if (is_int(strpos($cur_par,
"color")) && substr(trim($cur_val), 0, 1) ==
"!")
1521 if ($tag[0][
"type"] ==
"table" && is_int(strpos($par[
"parameter"],
"border")))
1523 $t_border[$cur_par] = $cur_val;
1526 if (in_array($cur_par, array(
"background-image",
"list-style-image")))
1528 if (is_int(strpos($cur_val,
"/")))
1530 $cur_val =
"url(".$cur_val.
")";
1534 if ($a_image_dir ==
"")
1536 $cur_val =
"url(../sty/sty_".$this->getId().
"/images/".$cur_val.
")";
1540 $cur_val =
"url(".$a_image_dir.
"/".$cur_val.
")";
1545 if ($cur_par ==
"opacity")
1547 $cur_val = ((int) $cur_val) / 100;
1550 fwrite ($css_file,
"\t".$cur_par.
": ".$cur_val.
";\n");
1553 if ($cur_par ==
"min-height")
1555 fwrite ($css_file,
"\t".
"height".
": ".
"auto !important".
";\n");
1556 fwrite ($css_file,
"\t".
"height".
": ".$cur_val.
";\n");
1560 if ($cur_par ==
"opacity")
1562 fwrite ($css_file,
"\t".
'-ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity='.($cur_val * 100).
')"'.
";\n");
1563 fwrite ($css_file,
"\t".
'filter: alpha(opacity='.($cur_val * 100).
')'.
";\n");
1564 fwrite ($css_file,
"\t".
'-moz-opacity: '.$cur_val.
";\n");
1568 if ($tag[0][
"tag"] ==
"div" && $tag[0][
"class"] ==
"Page"
1569 && $cur_par ==
"background-color")
1571 $page_background = $cur_val;
1574 fwrite ($css_file,
"}\n");
1575 fwrite ($css_file,
"\n");
1595 if ($page_background !=
"")
1597 fwrite ($css_file,
"td.ilc_Page\n");
1598 fwrite ($css_file,
"{\n");
1599 fwrite ($css_file,
"\t".
"background-color: ".$page_background.
";\n");
1600 fwrite ($css_file,
"}\n");
1619 $fixed_style = $ilSetting->get(
"fixed_content_style_id");
1620 if ($fixed_style > 0)
1622 $a_style_id = $fixed_style;
1626 if ($a_style_id <= 0)
1628 $a_style_id = $ilSetting->get(
"default_content_style_id");
1647 if (is_array($this->style_class[$a_type][$a_class]))
1649 return $this->style_class[$a_type][$a_class];
1663 $rand = rand(1,999999);
1667 $fixed_style = $ilias->getSetting(
"fixed_content_style_id");
1668 if ($fixed_style > 0)
1670 $a_style_id = $fixed_style;
1674 if ($a_style_id <= 0)
1676 $a_style_id = $ilias->getSetting(
"default_content_style_id");
1689 "/css/style_".$a_style_id.
".css?dummy=$rand";
1693 return "./Services/COPage/css/content.css";
1704 return "./Services/COPage/css/print_content.css";
1714 return "./Services/COPage/css/syntaxhighlight.css";
1724 return "./Services/COPage/css/placeholder.css";
1735 $q =
"UPDATE style_data ".
1736 "SET category = ".$ilDB->quote((
int) $this->
getScope(),
"integer").
1737 " WHERE id = ".$ilDB->quote($this->
getId(),
"integer");
1738 $ilDB->manipulate($q);
1751 $q =
"UPDATE style_parameter SET VALUE = ".
1752 $ilDB->quote($a_value,
"text").
" WHERE id = ".
1753 $ilDB->quote($a_id,
"integer");
1754 $style_set = $ilDB->manipulate($q);
1770 $q =
"SELECT * FROM style_parameter WHERE ".
1771 " style_id = ".$ilDB->quote($style_id,
"integer").
" AND ".
1772 " tag = ".$ilDB->quote($a_tag,
"text").
" AND ".
1773 " class = ".$ilDB->quote($a_class,
"text").
" AND ".
1774 " ".$ilDB->equals(
"type", $a_type,
"text",
true).
" AND ".
1775 " parameter = ".$ilDB->quote($a_par,
"text");
1777 $set = $ilDB->query($q);
1779 if ($rec = $set->fetchRow())
1781 $q =
"UPDATE style_parameter SET ".
1782 " value = ".$ilDB->quote($a_val,
"text").
" WHERE ".
1783 " style_id = ".$ilDB->quote($style_id,
"integer").
" AND ".
1784 " tag = ".$ilDB->quote($a_tag,
"text").
" AND ".
1785 " class = ".$ilDB->quote($a_class,
"text").
" AND ".
1786 " ".$ilDB->equals(
"type", $a_type,
"text",
true).
" AND ".
1787 " parameter = ".$ilDB->quote($a_par,
"text");
1789 $ilDB->manipulate($q);
1793 $id = $ilDB->nextId(
"style_parameter");
1794 $q =
"INSERT INTO style_parameter (id, value, style_id, tag, class, type, parameter) VALUES ".
1796 $ilDB->quote(
$id,
"integer").
",".
1797 $ilDB->quote($a_val,
"text").
",".
1798 " ".$ilDB->quote($this->
getId(),
"integer").
",".
1799 " ".$ilDB->quote($a_tag,
"text").
",".
1800 " ".$ilDB->quote($a_class,
"text").
",".
1801 " ".$ilDB->quote($a_type,
"text").
",".
1802 " ".$ilDB->quote($a_par,
"text").
")";
1804 $ilDB->manipulate($q);
1822 $this->style = $a_style;
1834 return str_replace(
"&",
"&", $a_str);
1842 $xml.=
"<StyleSheet>\n";
1845 $xml.=
"<Title>".$this->handleXmlString($this->
getTitle()).
"</Title>";
1846 $xml.=
"<Description>".$this->handleXmlString($this->
getDescription()).
"</Description>\n";
1849 foreach($this->chars as $char)
1851 $xml.=
"<Style Tag=\"".ilObjStyleSheet::_determineTag($char[
"type"]).
1852 "\" Type=\"".$char[
"type"].
"\" Class=\"".$char[
"class"].
"\">\n";
1853 foreach($this->style as
$style)
1855 if ($style[0][
"type"] == $char[
"type"] && $style[0][
"class"] == $char[
"class"])
1857 foreach($style as $tag)
1859 $xml.=
"<StyleParameter Name=\"".$tag[
"parameter"].
"\" Value=\"".$tag[
"value"].
"\"/>\n";
1863 $xml.=
"</Style>\n";
1869 $xml.=
"<StyleColor Name=\"".$color[
"name"].
"\" Code=\"".$color[
"code"].
"\"/>\n";
1874 foreach ($tcts as $tct => $v)
1880 $xml.=
"<StyleTemplate Type=\"".$tct.
"\" Name=\"".$t[
"name"].
"\">\n";
1881 foreach ($t[
"classes"] as $ct => $c)
1885 $xml.=
"<StyleTemplateClass ClassType=\"".$ct.
"\" Class=\"".$c.
"\"/>\n";
1888 $xml.=
"</StyleTemplate>\n";
1893 $xml.=
"</StyleSheet>";
1906 if(!is_writable($sty_data_dir))
1908 $this->ilias->raiseError(
"Style data directory (".$sty_data_dir
1909 .
") not writeable.",$this->ilias->error_obj->FATAL);
1912 $style_dir = $sty_data_dir.
"/sty_".$this->
getId();
1914 if(!@is_dir($style_dir))
1916 $this->ilias->raiseError(
"Creation of style directory failed (".
1917 $style_dir.
").",$this->ilias->error_obj->FATAL);
1921 $ex_dir = $style_dir.
"/export";
1923 if(!@is_dir($ex_dir))
1925 $this->ilias->raiseError(
"Creation of Import Directory failed (".
1926 $ex_dir.
").",$this->ilias->error_obj->FATAL);
1938 $style_dir = $sty_data_dir.
"/sty_".$this->
getId();
1940 $ex_dir = $style_dir.
"/export";
1942 if (is_dir($ex_dir))
1957 if(!is_writable($ex_sub_dir))
1959 $this->ilias->raiseError(
"Style data directory (".$ex_sub_dir
1960 .
") not writeable.",$this->ilias->error_obj->FATAL);
1962 $ex_sub_images_dir = $ex_sub_dir.
"/images";
1964 if(!is_writable($ex_sub_images_dir))
1966 $this->ilias->raiseError(
"Style data directory (".$ex_sub_images_dir
1967 .
") not writeable.",$this->ilias->error_obj->FATAL);
1976 $this->export_sub_dir = $a_dir;
1984 if ($this->export_sub_dir ==
"")
1986 return "sty_".$this->getId();
1990 return $this->export_sub_dir;
2004 $this->
exportXML($ex_dir.
"/".$this->getExportSubDir());
2007 $ex_dir.
"/".$this->getExportSubDir().
"/images");
2008 if (is_file($ex_dir.
"/".$this->getExportSubDir().
".zip"))
2010 unlink($ex_dir.
"/".$this->getExportSubDir().
".zip");
2023 $file = $a_dir.
"/style.xml";
2026 if (!($fp = @fopen(
$file,
"w")))
2028 die (
"<b>Error</b>: Could not open \"".
$file.
"\" for writing".
2029 " in <b>".__FILE__.
"</b> on line <b>".__LINE__.
"</b><br />");
2036 fwrite($fp, $this->
getXML());
2050 if(!is_writable($sty_data_dir))
2052 $this->ilias->raiseError(
"Style data directory (".$sty_data_dir
2053 .
") not writeable.",$this->ilias->error_obj->FATAL);
2056 $style_dir = $sty_data_dir.
"/sty_".$this->
getId();
2058 if(!@is_dir($style_dir))
2060 $this->ilias->raiseError(
"Creation of style directory failed (".
2061 $style_dir.
").",$this->ilias->error_obj->FATAL);
2065 $im_dir = $style_dir.
"/import";
2067 if(!@is_dir($im_dir))
2069 $this->ilias->raiseError(
"Creation of Import Directory failed (".
2070 $im_dir.
").",$this->ilias->error_obj->FATAL);
2079 function import($a_file)
2086 if (is_array($a_file))
2089 $a_file[
"name"], $im_dir.
"/".$a_file[
"name"]);
2090 $file_name = $a_file[
"name"];
2094 $pi = pathinfo($a_file);
2095 $file_name = $pi[
"basename"];
2096 copy($a_file, $im_dir.
"/".$file_name);
2098 $file = pathinfo($file_name);
2101 if (strtolower(
$file[
"extension"] ==
"zip"))
2104 $subdir = basename(
$file[
"basename"],
".".
$file[
"extension"]);
2105 if (!is_dir($im_dir.
"/".$subdir))
2109 $xml_file = $im_dir.
"/".$subdir.
"/style.xml";
2113 $xml_file = $im_dir.
"/".$file_name;
2122 if (is_dir($im_dir.
"/".$subdir.
"/images"))
2125 $this->getImagesDirectory());
2140 $this->is_3_10_skin =
false;
2142 if (!$a_skip_parent_create)
2146 include_once(
"./Services/Style/classes/class.ilStyleImportParser.php");
2148 $importParser->startParsing();
2151 foreach ($this->style as
$style)
2153 foreach($style as $tag)
2155 $id = $ilDB->nextId(
"style_parameter");
2158 if (in_array($tag[
"class"], array(
"PageFrame",
"PageContainer")) &&
2159 $tag[
"tag"] ==
"table")
2161 $tag[
"tag"] =
"div";
2162 if ($tag[
"parameter"] ==
"width" && $tag[
"value"] ==
"100%")
2168 $q =
"INSERT INTO style_parameter (id,style_id, tag, class, parameter, type, value) VALUES ".
2170 $ilDB->quote(
$id,
"integer").
",".
2171 $ilDB->quote($this->
getId(),
"integer").
",".
2172 $ilDB->quote($tag[
"tag"],
"text").
",".
2173 $ilDB->quote($tag[
"class"],
"text").
",".
2174 $ilDB->quote($tag[
"parameter"],
"text").
",".
2175 $ilDB->quote($tag[
"type"],
"text").
",".
2176 $ilDB->quote($tag[
"value"],
"text").
")";
2178 $ilDB->manipulate($q);
2183 $this->is_3_10_skin =
true;
2184 if (is_array($this->chars))
2186 foreach ($this->chars as $char)
2188 if ($char[
"type"] !=
"")
2190 $s = substr($char[
"class"], strlen($char[
"class"]) - 6);
2193 $q =
"INSERT INTO style_char (style_id, type, characteristic) VALUES ".
2194 "(".$ilDB->quote($this->
getId(),
"integer").
",".
2195 $ilDB->quote($char[
"type"],
"text").
",".
2196 $ilDB->quote($char[
"class"],
"text").
")";
2197 $ilDB->manipulate($q);
2198 $this->is_3_10_skin =
false;
2205 $q =
"INSERT INTO style_data (id, uptodate) VALUES ".
2206 "(".$ilDB->quote($this->
getId(),
"integer").
", 0)";
2207 $ilDB->manipulate($q);
2212 if ($this->is_3_10_skin)
2226 foreach (self::$parameter as
$parameter => $props)
2235 $input = self::$parameter[$par][
"input"];
2241 $subpar = self::$parameter[$par][
"subpar"];
2252 foreach (self::$parameter as $k => $v)
2254 if (is_array(self::$filtered_groups[$v[
"group"]]) &&
2255 !in_array($a_tag, self::$filtered_groups[$v[
"group"]]))
2271 if ($a_no_percentage)
2280 return self::$parameter[$par][
"values"];
2295 return in_array($a_type, self::$expandable_types);
2300 return in_array($a_type, self::$hideable_types);
2305 foreach (self::$style_super_types as $s =>
$t)
2307 if (in_array($a_type,
$t))
2323 $c_styles = array();
2324 foreach (self::$core_styles as $cstyle)
2327 = array(
"type" => $cstyle[
"type"],
2329 "class" => $cstyle[
"class"]);
2339 if ($a_template_type ==
"")
2344 return self::$templates[$a_template_type];
2350 return self::$pseudo_classes[$tag];
2355 return self::$templates[
$t][$k];
2360 return self::$assigned_tags[$a_type];
2369 foreach(self::$parameter as $p => $v)
2371 $pars[$p] = $v[
"values"];
2383 $styles = array(array(
"id" => $a_id));
2394 if ($a_styles ==
"")
2400 $styles = $a_styles;
2406 $core_images = array();
2408 if (is_dir($core_dir))
2410 $dir = opendir($core_dir);
2411 while(
$file = readdir($dir))
2413 if (substr(
$file, 0, 1) !=
"." && is_file($core_dir.
"/".
$file))
2415 $core_images[] =
$file;
2420 foreach ($styles as
$style)
2427 $set = $ilDB->queryF(
"SELECT * FROM style_char WHERE style_id = %s ".
2428 "AND type = %s AND characteristic = %s",
2429 array(
"integer",
"text",
"text"),
2430 array(
$id, $cs[
"type"], $cs[
"class"]));
2433 if (!($rec = $ilDB->fetchAssoc($set)))
2436 "INSERT INTO style_char (style_id, type, characteristic) ".
2437 " VALUES (%s,%s,%s) ",
2438 array(
"integer",
"text",
"text"),
2439 array(
$id, $cs[
"type"], $cs[
"class"]));
2441 $xpath =
new DOMXPath($bdom);
2442 $par_nodes = $xpath->query(
"/StyleSheet/Style[@Tag = '".$cs[
"tag"].
"' and @Type='".
2443 $cs[
"type"].
"' and @Class='".$cs[
"class"].
"']/StyleParameter");
2444 foreach ($par_nodes as $par_node)
2447 $set = $ilDB->queryF(
"SELECT * FROM style_parameter WHERE style_id = %s ".
2448 "AND type = %s AND class = %s AND tag = %s AND parameter = %s",
2449 array(
"integer",
"text",
"text",
"text",
"text"),
2450 array(
$id, $cs[
"type"], $cs[
"class"],
2451 $cs[
"tag"], $par_node->getAttribute(
"Name")));
2454 if (!($rec = $ilDB->fetchAssoc($set)))
2456 $spid = $ilDB->nextId(
"style_parameter");
2457 $st = $ilDB->manipulateF(
"INSERT INTO style_parameter (id, style_id, type, class, tag, parameter, value) ".
2458 " VALUES (%s,%s,%s,%s,%s,%s,%s)",
2459 array(
"integer",
"integer",
"text",
"text",
"text",
"text",
"text"),
2460 array($spid,
$id, $cs[
"type"], $cs[
"class"], $cs[
"tag"],
2461 $par_node->getAttribute(
"Name"), $par_node->getAttribute(
"Value")));
2470 reset($core_images);
2471 foreach($core_images as $cim)
2473 if (!is_file($imdir.
"/".$cim))
2475 copy($core_dir.
"/".$cim, $imdir.
"/".$cim);
2500 $st = $ilDB->prepareManip(
"UPDATE style_char SET type = ? WHERE characteristic = ?".
2501 " AND style_id = ? ", array(
"text",
"text",
"integer"));
2502 $ilDB->execute($st, array(
"media_cont",
"Media", $this->
getId()));
2503 $ilDB->execute($st, array(
"media_caption",
"MediaCaption", $this->
getId()));
2504 $ilDB->execute($st, array(
"page_fn",
"Footnote", $this->
getId()));
2505 $ilDB->execute($st, array(
"page_nav",
"LMNavigation", $this->
getId()));
2506 $ilDB->execute($st, array(
"page_title",
"PageTitle", $this->
getId()));
2507 $ilDB->execute($st, array(
"page_cont",
"Page", $this->
getId()));
2510 $st = $ilDB->prepareManip(
"UPDATE style_parameter SET type = ? WHERE class = ?".
2511 " AND style_id = ? ", array(
"text",
"text",
"integer"));
2512 $ilDB->execute($st, array(
"media_cont",
"Media", $this->
getId()));
2513 $ilDB->execute($st, array(
"media_caption",
"MediaCaption", $this->
getId()));
2514 $ilDB->execute($st, array(
"page_fn",
"Footnote", $this->
getId()));
2515 $ilDB->execute($st, array(
"page_nav",
"LMNavigation", $this->
getId()));
2516 $ilDB->execute($st, array(
"page_title",
"PageTitle", $this->
getId()));
2517 $ilDB->execute($st, array(
"table",
"Page", $this->
getId()));
2519 $st = $ilDB->prepareManip(
"UPDATE style_parameter SET tag = ? WHERE class = ?".
2520 " AND style_id = ? ", array(
"text",
"text",
"integer"));
2521 $ilDB->execute($st, array(
"div",
"MediaCaption", $this->
getId()));
2524 $st = $ilDB->prepareManip(
"UPDATE style_char SET characteristic = ? WHERE characteristic = ?".
2525 " AND style_id = ? ", array(
"text",
"text",
"integer"));
2526 $ilDB->execute($st, array(
"MediaContainer",
"Media", $this->
getId()));
2527 $ilDB->execute($st, array(
"PageContainer",
"Page", $this->
getId()));
2530 $st = $ilDB->prepareManip(
"UPDATE style_parameter SET class = ? WHERE class = ?".
2531 " AND style_id = ? ", array(
"text",
"text",
"integer"));
2532 $ilDB->execute($st, array(
"MediaContainer",
"Media", $this->
getId()));
2533 $ilDB->execute($st, array(
"PageContainer",
"Page", $this->
getId()));
2536 $st = $ilDB->prepareManip(
"DELETE FROM style_char WHERE type = ?".
2537 " AND style_id = ? ", array(
"text",
"integer"));
2538 $ilDB->execute($st, array(
"page_cont", $this->
getId()));
2539 $st = $ilDB->prepareManip(
"DELETE FROM style_parameter WHERE type = ?".
2540 " AND style_id = ? ", array(
"text",
"integer"));
2541 $ilDB->execute($st, array(
"page_cont", $this->
getId()));
2558 $add_str =
" AND style_id = ".$ilDB->quote($a_id,
"integer");
2561 $set = $ilDB->query($q =
"SELECT DISTINCT style_id, tag, class FROM style_parameter WHERE ".
2562 $ilDB->equals(
"type",
"",
"text",
true).
" ".$add_str);
2564 while ($rec = $ilDB->fetchAssoc($set))
2568 switch ($rec[
"tag"])
2572 if (in_array($rec[
"class"], array(
"Headline3",
"Headline1",
2573 "Headline2",
"TableContent",
"List",
"Standard",
"Remark",
2574 "Additional",
"Mnemonic",
"Citation",
"Example")))
2576 $types[] =
"text_block";
2578 if (in_array($rec[
"class"], array(
"Block",
"Remark",
2579 "Additional",
"Mnemonic",
"Example",
"Excursus",
"Special")))
2581 $types[] =
"section";
2583 if (in_array($rec[
"class"], array(
"Page",
"Footnote",
"PageTitle",
"LMNavigation")))
2590 $types[] =
"table_cell";
2594 if (in_array($rec[
"class"], array(
"ExtLink",
"IntLink",
"FootnoteLink")))
2601 $types[] =
"text_inline";
2610 foreach ($types as
$t)
2613 $set4 = $ilDB->queryF(
"SELECT * FROM style_char ".
2614 " WHERE style_id = %s AND type = %s AND characteristic = %s",
2615 array(
"integer",
"text",
"text"),
2616 array($rec[
"style_id"], $t, $rec[
"class"]));
2617 if ($rec4 = $ilDB->fetchAssoc($set4))
2624 $ilDB->manipulateF(
"INSERT INTO style_char ".
2625 " (style_id, type, characteristic) VALUES ".
2627 array(
"integer",
"text",
"text"),
2628 array($rec[
"style_id"], $t, $rec[
"class"]));
2633 if ($rec[
"type"] ==
"")
2635 if (count($types) > 0)
2637 $ilDB->manipulateF(
"UPDATE style_parameter SET type = %s ".
2638 " WHERE style_id = %s AND class = %s AND ".$ilDB->equals(
"type",
"",
"text",
true),
2639 array(
"text",
"integer",
"text"),
2640 array($types[0], $rec[
"style_id"], $rec[
"class"]));
2644 if ($types[0] ==
"link")
2646 $ilDB->manipulateF(
"UPDATE style_parameter SET type = %s ".
2647 " WHERE style_id = %s AND (class = %s OR class = %s) AND ".$ilDB->equals(
"type",
"",
"text",
true),
2648 array(
"text",
"integer",
"text",
"text"),
2649 array($types[0], $rec[
"style_id"], $rec[
"class"].
":visited",
2650 $rec[
"class"].
":hover"));
2654 if (count($types) == 2)
2658 $set2 = $ilDB->queryF(
"SELECT * FROM style_parameter ".
2659 " WHERE style_id = %s AND class = %s AND type = %s",
2660 array(
"integer",
"text",
"text"),
2661 array($rec[
"style_id"], $rec[
"class"], $types[0]));
2662 while ($rec2 = $ilDB->fetchAssoc($set2))
2665 $set3 = $ilDB->queryF(
"SELECT * FROM style_parameter ".
2666 " WHERE style_id = %s AND tag = %s AND class = %s AND type = %s AND parameter = %s",
2667 array(
"integer",
"text",
"text",
"text",
"text"),
2668 array($rec[
"style_id"], $rec[
"tag"], $rec[
"class"], $types[1], $rec[
"parameter"]));
2669 if ($rec3 = $ilDB->fetchAssoc($set3))
2675 $nid = $ilDB->nextId(
"style_parameter");
2676 $ilDB->manipulateF(
"INSERT INTO style_parameter ".
2677 " (id, style_id, tag, class, parameter, value, type) VALUES ".
2678 " (%s, %s,%s,%s,%s,%s,%s) ",
2679 array(
"integer",
"integer",
"text",
"text",
"text",
"text",
"text"),
2680 array($nid, $rec2[
"style_id"], $rec2[
"tag"], $rec2[
"class"],
2681 $rec2[
"parameter"], $rec2[
"value"], $types[1]));
2696 $classes = array(
"Example",
"Additional",
"Citation",
"Mnemonic",
"Remark");
2697 $pars = array(
"margin-top",
"margin-bottom");
2699 foreach ($classes as $curr_class)
2701 foreach ($pars as $curr_par)
2703 $res2 = $ilDB->queryF(
"SELECT id FROM style_parameter WHERE style_id = %s".
2704 " AND tag = %s AND class= %s AND parameter = %s",
2705 array(
"integer",
"text",
"text",
"text"),
2706 array($a_id,
"p", $curr_class, $curr_par));
2707 if ($row2 = $ilDB->fetchAssoc($res2))
2709 $ilDB->manipulateF(
"UPDATE style_parameter SET value= %s WHERE id = %s",
2710 array(
"text",
"integer"),
2711 array(
"10px", $row2[
"id"]));
2715 $nid = $ilDB->nextId(
"style_parameter");
2716 $ilDB->manipulateF(
"INSERT INTO style_parameter ".
2717 "(id, style_id, tag, class, parameter,value) VALUES (%s,%s,%s,%s,%s,%s)",
2718 array(
"integer",
"integer",
"text",
"text",
"text",
"text"),
2719 array($nid, $a_id,
"div", $curr_class, $curr_par,
"10px"));
2724 $ilDB->manipulateF(
"UPDATE style_parameter SET tag = %s WHERE tag = %s and style_id = %s",
2725 array(
"text",
"text",
"integer"),
2726 array(
"div",
"p", $a_id));
2738 $set = $ilDB->query(
"SELECT * FROM style_color WHERE ".
2739 "style_id = ".$ilDB->quote($this->getId(),
"integer").
" ".
2740 "ORDER BY color_name");
2743 while ($rec = $ilDB->fetchAssoc($set))
2746 "name" => $rec[
"color_name"],
2747 "code" => $rec[
"color_code"]
2761 $ilDB->manipulate(
"INSERT INTO style_color (style_id, color_name, color_code)".
2763 $ilDB->quote($this->getId(),
"integer").
",".
2764 $ilDB->quote($a_name,
"text").
",".
2765 $ilDB->quote($a_code,
"text").
2778 $ilDB->manipulate(
"UPDATE style_color SET ".
2779 "color_name = ".$ilDB->quote($a_new_name,
"text").
", ".
2780 "color_code = ".$ilDB->quote($a_code,
"text").
2781 " WHERE style_id = ".$ilDB->quote($this->
getId(),
"integer").
2782 " AND color_name = ".$ilDB->quote($a_name,
"text"));
2786 if ($a_name != $a_new_name)
2788 $set = $ilDB->query(
"SELECT * FROM style_parameter ".
2789 " WHERE style_id = ".$ilDB->quote($this->getId(),
"integer").
2791 " parameter = ".$ilDB->quote(
"background-color",
"text").
" OR ".
2792 " parameter = ".$ilDB->quote(
"color",
"text").
" OR ".
2793 " parameter = ".$ilDB->quote(
"border-color",
"text").
" OR ".
2794 " parameter = ".$ilDB->quote(
"border-top-color",
"text").
" OR ".
2795 " parameter = ".$ilDB->quote(
"border-bottom-color",
"text").
" OR ".
2796 " parameter = ".$ilDB->quote(
"border-left-color",
"text").
" OR ".
2797 " parameter = ".$ilDB->quote(
"border-right-color",
"text").
2799 while ($rec = $ilDB->fetchAssoc($set))
2801 if ($rec[
"value"] ==
"!".$a_name ||
2802 is_int(strpos($rec[
"value"],
"!".$a_name.
"(")))
2806 $rec[
"parameter"], str_replace($a_name, $a_new_name, $rec[
"value"]), $rec[
"type"]);
2819 $ilDB->manipulate(
"DELETE FROM style_color WHERE ".
2820 " style_id = ".$ilDB->quote($this->getId(),
"integer").
" AND ".
2821 " color_name = ".$ilDB->quote($a_name,
"text"));
2831 $set = $ilDB->query(
"SELECT * FROM style_color WHERE ".
2832 "style_id = ".$ilDB->quote($this->getId(),
"integer").
" AND ".
2833 "color_name = ".$ilDB->quote($a_color_name,
"text"));
2834 if ($rec = $ilDB->fetchAssoc($set))
2848 $pos = strpos($a_name,
"(");
2851 $a_i = substr($a_name, $pos + 1);
2852 $a_i = str_replace(
")",
"", $a_i);
2853 $a_name = substr($a_name, 0, $pos);
2856 $set = $ilDB->query(
"SELECT color_code FROM style_color WHERE ".
2857 " style_id = ".$ilDB->quote($this->getId(),
"integer").
" AND ".
2858 " color_name = ".$ilDB->quote($a_name,
"text"));
2859 if ($rec = $ilDB->fetchAssoc($set))
2863 return "#".$rec[
"color_code"];
2867 return "#".ilObjStyleSheet::_getColorFlavor($rec[
"color_code"],
2883 $hls[
"l"] = $hls[
"l"] + ((255 - $hls[
"l"]) * ($a_i / 100));
2887 $hls[
"l"] = $hls[
"l"] - (($hls[
"l"]) * (-$a_i / 100));
2892 foreach ($rgb as $k => $v)
2894 $rgb[$k] = str_pad(dechex($v), 2,
"0", STR_PAD_LEFT);
2897 return $rgb[
"r"].$rgb[
"g"].$rgb[
"b"];
2905 $r[
"r"] = substr($a_rgb, 0, 2);
2906 $r[
"g"] = substr($a_rgb, 2, 2);
2907 $r[
"b"] = substr($a_rgb, 4, 2);
2911 $r[
"r"] = (int) hexdec($r[
"r"]);
2912 $r[
"g"] = (int) hexdec($r[
"g"]);
2913 $r[
"b"] = (int) hexdec($r[
"b"]);
2924 $r = $a_rgb[
"r"] / 255;
2925 $g = $a_rgb[
"g"] / 255;
2926 $b = $a_rgb[
"b"] / 255;
2929 $max = max($r,$g,$b);
2930 $min = min($r,$g,$b);
2933 $l = ($max + $min) / 2;
2944 $s = ($max - $min) / ($max + $min);
2948 $s = ($max - $min) / (2.0 - $max - $min);
2953 $h = ($g - $b) / ($max - $min);
2955 else if ($g == $max)
2957 $h = 2.0 + ($b - $r) / ($max - $min);
2959 else if ($b == $max)
2961 $h = 4.0 + ($r - $g) / ($max - $min);
2965 $hls[
"h"] = round(($h / 6) * 255);
2966 $hls[
"l"] = round($l * 255);
2967 $hls[
"s"] = round($s * 255);
2977 $h = $a_hls[
"h"] / 255;
2978 $l = $a_hls[
"l"] / 255;
2979 $s = $a_hls[
"s"] / 255;
2981 $rgb[
"r"] = $rgb[
"g"] = $rgb[
"b"] = 0;
2986 $rgb[
"r"] = $rgb[
"g"] = $rgb[
"b"] = $l;
2993 $temp2 = $l * (1.0 + $s);
2997 $temp2 = $l + $s - $l * $s;
3000 $temp1 = 2.0 * $l - $temp2;
3003 # For each of R, G, B, compute another temporary value, temp3, as follows:
3004 foreach ($rgb as $k => $v)
3009 $temp3 = $h + 1.0 / 3.0;
3017 $temp3 = $h - 1.0/3.0;
3022 $temp3 = $temp3 + 1.0;
3026 $temp3 = $temp3 - 1.0;
3029 if (6.0 * $temp3 < 1)
3031 $rgb[$k] = $temp1 + ($temp2 - $temp1) * 6.0 * $temp3;
3033 else if (2.0 * $temp3 < 1)
3037 else if (3.0 * $temp3 < 2)
3039 $rgb[$k] = $temp1 + ($temp2 - $temp1) * ((2.0/3.0) - $temp3) * 6.0;
3048 $rgb[
"r"] = round($rgb[
"r"] * 255);
3049 $rgb[
"g"] = round($rgb[
"g"] * 255);
3050 $rgb[
"b"] = round($rgb[
"b"] * 255);
3066 $set = $ilDB->query(
"SELECT * FROM style_template WHERE ".
3067 "style_id = ".$ilDB->quote($this->getId(),
"integer").
" AND ".
3068 "temp_type = ".$ilDB->quote($a_type,
"text").
" ".
3072 while ($rec = $ilDB->fetchAssoc($set))
3087 $set = $ilDB->query(
"SELECT * FROM style_template_class WHERE ".
3088 "template_id = ".$ilDB->quote($a_tid,
"integer"));
3091 while ($rec = $ilDB->fetchAssoc($set))
3093 $key = $rec[
"class_type"];
3094 $class[$key] = $rec[
"class"];
3108 $tid = $ilDB->nextId(
"style_template");
3109 $ilDB->manipulate($q =
"INSERT INTO style_template ".
3110 "(id, style_id, name, temp_type)".
3112 $ilDB->quote($tid,
"integer").
",".
3113 $ilDB->quote($this->
getId(),
"integer").
",".
3114 $ilDB->quote($a_name,
"text").
",".
3115 $ilDB->quote($a_type,
"text").
3118 foreach ($a_classes as
$t => $c)
3120 $ilDB->manipulate($q =
"INSERT INTO style_template_class ".
3121 "(template_id, class_type, class)".
3123 $ilDB->quote($tid,
"integer").
",".
3124 $ilDB->quote(
$t,
"text").
",".
3125 $ilDB->quote($c,
"text").
3129 include_once(
"./Services/Style/classes/class.ilObjStyleSheetGUI.php");
3143 $ilDB->manipulate(
"UPDATE style_template SET ".
3144 "name = ".$ilDB->quote($a_name,
"text").
3145 " WHERE id = ".$ilDB->quote($a_t_id,
"integer"));
3147 $ilDB->manipulate(
"DELETE FROM style_template_class WHERE ".
3148 "template_id = ".$ilDB->quote($a_t_id,
"integer")
3150 foreach ($a_classes as
$t => $c)
3152 $ilDB->manipulate($q =
"INSERT INTO style_template_class ".
3153 "(template_id, class_type, class)".
3155 $ilDB->quote($a_t_id,
"integer").
",".
3156 $ilDB->quote(
$t,
"text").
",".
3157 $ilDB->quote($c,
"text").
3170 $set = $ilDB->query(
"SELECT * FROM style_template WHERE ".
3171 "style_id = ".$ilDB->quote($this->getId(),
"integer").
" AND ".
3172 "name = ".$ilDB->quote($a_template_name,
"text"));
3173 if ($rec = $ilDB->fetchAssoc($set))
3187 $set = $ilDB->query(
"SELECT * FROM style_template WHERE ".
3188 "style_id = ".$ilDB->quote($this->getId(),
"integer").
" ".
3189 " AND id = ".$ilDB->quote($a_t_id,
"integer"));
3191 if ($rec = $ilDB->fetchAssoc($set))
3208 $set = $ilDB->query(
"SELECT name FROM style_template WHERE ".
3209 " id = ".$ilDB->quote($a_t_id,
"integer"));
3211 if ($rec = $ilDB->fetchAssoc($set))
3213 return $rec[
"name"];
3226 $tag =
"<StyleTemplates>";
3228 $ttypes = array(
"table",
"vaccordion",
"haccordion");
3230 foreach ($ttypes as $ttype)
3249 $tag.=
'<StyleTemplate Name="'.$t[
"name"].
'">';
3251 foreach ($atts as
$type => $t)
3253 if ($c[
$type] !=
"")
3255 $tag.=
'<StyleClass Type="'.$type.
'" Value="'.$c[
$type].
'" />';
3259 $tag.=
"</StyleTemplate>";
3263 $tag.=
"</StyleTemplates>";
3275 $a_preview_html = str_replace(
' width=""',
"", $a_preview_html);
3276 $a_preview_html = str_replace(
' valign="top"',
"", $a_preview_html);
3277 $a_preview_html = str_replace(
'<div class="ilc_text_block_TableContent">',
"<div>", $a_preview_html);
3280 if (strlen($a_preview_html) > 4000)
3283 $a_preview_html =
"";
3285 $ilDB->manipulate(
"UPDATE style_template SET ".
3286 "preview = ".$ilDB->quote($a_preview_html,
"text").
3287 " WHERE id = ".$ilDB->quote($a_t_id,
"integer"));
3297 $set = $ilDB->query(
"SELECT preview FROM style_template ".
3298 " WHERE id = ".$ilDB->quote($a_t_id,
"integer"));
3299 if ($rec = $ilDB->fetchAssoc($set))
3301 return $rec[
"preview"];
3314 $set = $ilDB->query(
"SELECT id FROM style_template ".
3315 " WHERE style_id = ".$ilDB->quote($a_style_id,
"integer").
3316 " AND name = ".$ilDB->quote($a_name,
"text"));
3317 if ($rec = $ilDB->fetchAssoc($set))
3332 $ilDB->manipulate(
"DELETE FROM style_template WHERE ".
3333 " style_id = ".$ilDB->quote($this->getId(),
"integer").
" AND ".
3334 " id = ".$ilDB->quote($a_t_id,
"integer"));
3336 $ilDB->manipulate(
"DELETE FROM style_template_class WHERE ".
3337 "template_id = ".$ilDB->quote($a_t_id,
"integer")
3349 $ilDB->manipulate(
"DELETE FROM style_setting WHERE ".
3350 " style_id = ".$ilDB->quote($this->getId(),
"integer").
3351 " AND name = ".$ilDB->quote($a_name,
"text")
3354 $ilDB->manipulate(
"INSERT INTO style_setting ".
3355 "(style_id, name, value) VALUES (".
3356 $ilDB->quote($this->getId(),
"integer").
",".
3357 $ilDB->quote($a_name,
"text").
",".
3358 $ilDB->quote($a_value,
"text").
3369 $set = $ilDB->query(
"SELECT value FROM style_setting ".
3370 " WHERE style_id = ".$ilDB->quote($this->getId(),
"integer").
3371 " AND name = ".$ilDB->quote($a_name,
"text")
3373 $rec = $ilDB->fetchAssoc($set);
3375 return $rec[
"value"];
3385 $ilDB->replace(
"style_usage", array(
3386 "obj_id" => array(
"integer", (
int) $a_obj_id)),
3388 "style_id" => array(
"integer", (
int) $a_style_id))
3399 $set = $ilDB->query(
"SELECT style_id FROM style_usage ".
3400 " WHERE obj_id = ".$ilDB->quote($a_obj_id,
"integer")
3402 $rec = $ilDB->fetchAssoc($set);
3406 return (
int) $rec[
"style_id"];