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"),
181 "input" =>
"percentage",
182 "group" =>
"special"),
183 "transform" =>
array(
184 "values" =>
array(
"rotate(90deg)",
"rotate(180deg)",
"rotate(270deg)"),
186 "group" =>
"special"),
187 "transform-origin" =>
array(
188 "values" =>
array(
"horizontal" =>
array(
"left",
"center",
"right"),
189 "vertical" =>
array(
"top",
"center",
"bottom")),
190 "input" =>
"background_position",
191 "group" =>
"special"),
193 "values" =>
array(
"auto",
"default",
"crosshair",
"pointer",
"move",
194 "n-resize",
"ne-resize",
"e-resize",
"se-resize",
"s-resize",
"sw-resize",
195 "w-resize",
"nw-resize",
"text",
"wait",
"help"),
197 "group" =>
"special"),
199 "values" =>
array(
"both",
"left",
"right",
"none"),
201 "group" =>
"special"),
203 "list-style-type.ol" =>
array(
204 "values" =>
array(
"decimal",
"lower-roman",
"upper-roman",
205 "lower-alpha",
"upper-alpha",
"lower-greek",
"hebrew",
206 "decimal-leading-zero",
"cjk-ideographic",
"hiragana",
207 "katakana",
"hiragana-iroha",
"katakana-iroha",
"none"),
210 "list-style-type.ul" =>
array(
211 "values" =>
array(
"disc",
"circle",
"square",
215 "list-style-image.ul" =>
array(
217 "input" =>
"background_image",
219 "list-style-position.ol" =>
array(
220 "values" =>
array(
"inside",
"outside"),
223 "list-style-position.ul" =>
array(
224 "values" =>
array(
"inside",
"outside"),
228 "border-collapse" =>
array(
229 "values" =>
array(
"collapse",
"separate"),
233 "caption-side" =>
array(
234 "values" =>
array(
"top",
"bottom",
"left",
"right"),
244 "table" =>
array(
"table"),
"positioning" =>
array(
"h1",
"h2",
"h3",
"div",
"img",
"table",
"a",
"figure"));
248 "text_block" =>
array(
"text_block",
"heading1",
"heading2",
"heading3"),
249 "text_inline" =>
array(
"text_inline",
"sub",
"sup"),
250 "section" =>
array(
"section"),
251 "link" =>
array(
"link"),
252 "table" =>
array(
"table",
"table_cell",
"table_caption"),
253 "list" =>
array(
"list_o",
"list_u",
"list_item"),
254 "flist" =>
array(
"flist_cont",
"flist_head",
"flist",
"flist_li",
"flist_a"),
255 "media" =>
array(
"media_cont",
"media_caption",
"iim",
"marker"),
256 "tabs" =>
array(
"va_cntr",
"va_icntr",
"va_ihead",
"va_iheada",
"va_ihcap",
"va_icont",
257 "ha_cntr",
"ha_icntr",
"ha_ihead",
"ha_iheada",
"ha_ihcap",
"ha_icont",
"ca_cntr",
"ca_icntr",
"ca_ihead",
"ca_icont"),
258 "question" =>
array(
"question",
"qtitle",
"qanswer",
"qinput",
"qlinput",
"qsubmit",
"qfeedr",
"qfeedw",
259 "qimg",
"qordul",
"qordli",
"qimgd",
"qetitem",
"qetcorr",
"qover"),
260 "page" =>
array(
"page_frame",
"page_cont",
"page_title",
"page_fn",
261 "page_tnav",
"page_bnav",
"page_lnav",
"page_rnav",
"page_lnavlink",
"page_rnavlink",
262 "page_lnavimage",
"page_rnavimage"),
263 "glo" =>
array(
"glo_overlay",
"glo_ovtitle",
"glo_ovclink",
"glo_ovuglink",
"glo_ovuglistlink"),
264 "sco" =>
array(
"sco_title",
"sco_keyw",
"sco_desc",
"sco_desct",
"sco_obj",
"sco_objt",
"sco_fmess"),
265 "rte" =>
array(
"rte_menu",
"rte_mlink",
"rte_tree",
"rte_node",
"rte_tlink",
"rte_status",
266 "rte_tul",
"rte_tli",
"rte_texp",
"rte_tclink",
"rte_drag")
271 "text_block",
"text_inline",
"section",
"media_cont",
"table",
"table_cell",
"flist_li",
"table_caption",
273 "va_cntr",
"va_icntr",
"va_ihead",
"va_iheada",
"va_ihcap",
"va_icont",
274 "ha_cntr",
"ha_icntr",
"ha_ihead",
"ha_iheada",
"ha_ihcap",
"ha_icont",
275 "ca_cntr",
"ca_icntr",
"ca_ihead",
"ca_icont" 280 "table",
"table_cell" 285 "text_block" =>
"div",
289 "text_inline" =>
"span",
295 "table_cell" =>
"td",
296 "table_caption" =>
"caption",
297 "media_cont" =>
"figure",
298 "media_caption" =>
"div",
301 "glo_overlay" =>
"div",
302 "glo_ovtitle" =>
"h1",
303 "glo_ovclink" =>
"a",
304 "glo_ovuglink" =>
"a",
305 "glo_ovuglistlink" =>
"a",
306 "sco_title" =>
"div",
310 "sco_desct" =>
"div",
312 "sco_fmess" =>
"div",
319 "rte_status" =>
"div",
327 "flist_cont" =>
"div",
328 "flist_head" =>
"div",
342 "qlinput" =>
"textarea",
343 "qsubmit" =>
"input",
347 "page_frame" =>
"div",
348 "page_cont" =>
"div",
351 "page_tnav" =>
"div",
352 "page_bnav" =>
"div",
353 "page_lnav" =>
"div",
354 "page_rnav" =>
"div",
355 "page_lnavlink" =>
"a",
356 "page_rnavlink" =>
"a",
357 "page_lnavimage" =>
"img",
358 "page_rnavimage" =>
"img",
359 "page_title" =>
"h1",
364 "va_iheada" =>
"div",
369 "ha_iheada" =>
"div",
384 array(
"type" =>
"text_block",
"class" =>
"Standard"),
385 array(
"type" =>
"text_block",
"class" =>
"List"),
386 array(
"type" =>
"text_block",
"class" =>
"TableContent"),
387 array(
"type" =>
"heading1",
"class" =>
"Headline1"),
388 array(
"type" =>
"heading2",
"class" =>
"Headline2"),
389 array(
"type" =>
"heading3",
"class" =>
"Headline3"),
390 array(
"type" =>
"text_inline",
"class" =>
"Comment"),
391 array(
"type" =>
"text_inline",
"class" =>
"Emph"),
392 array(
"type" =>
"text_inline",
"class" =>
"Quotation"),
393 array(
"type" =>
"text_inline",
"class" =>
"Strong"),
394 array(
"type" =>
"text_inline",
"class" =>
"Accent"),
395 array(
"type" =>
"text_inline",
"class" =>
"Important"),
396 array(
"type" =>
"sup",
"class" =>
"Sup"),
397 array(
"type" =>
"sub",
"class" =>
"Sub"),
398 array(
"type" =>
"link",
"class" =>
"IntLink"),
399 array(
"type" =>
"link",
"class" =>
"ExtLink"),
400 array(
"type" =>
"link",
"class" =>
"FootnoteLink"),
401 array(
"type" =>
"link",
"class" =>
"FileLink"),
402 array(
"type" =>
"link",
"class" =>
"GlossaryLink"),
403 array(
"type" =>
"media_cont",
"class" =>
"MediaContainer"),
404 array(
"type" =>
"media_cont",
"class" =>
"MediaContainerMax50"),
405 array(
"type" =>
"media_cont",
"class" =>
"MediaContainerFull100"),
406 array(
"type" =>
"table",
"class" =>
"StandardTable"),
407 array(
"type" =>
"media_caption",
"class" =>
"MediaCaption"),
408 array(
"type" =>
"iim",
"class" =>
"ContentPopup"),
409 array(
"type" =>
"marker",
"class" =>
"Marker"),
410 array(
"type" =>
"page_frame",
"class" =>
"PageFrame"),
411 array(
"type" =>
"page_cont",
"class" =>
"PageContainer"),
412 array(
"type" =>
"page",
"class" =>
"Page"),
413 array(
"type" =>
"page_tnav",
"class" =>
"TopNavigation"),
414 array(
"type" =>
"page_bnav",
"class" =>
"BottomNavigation"),
415 array(
"type" =>
"page_lnav",
"class" =>
"LeftNavigation"),
416 array(
"type" =>
"page_rnav",
"class" =>
"RightNavigation"),
417 array(
"type" =>
"page_lnavlink",
"class" =>
"LeftNavigationLink"),
418 array(
"type" =>
"page_rnavlink",
"class" =>
"RightNavigationLink"),
419 array(
"type" =>
"page_lnavimage",
"class" =>
"LeftNavigationImage"),
420 array(
"type" =>
"page_rnavimage",
"class" =>
"RightNavigationImage"),
421 array(
"type" =>
"page_fn",
"class" =>
"Footnote"),
422 array(
"type" =>
"page_title",
"class" =>
"PageTitle"),
423 array(
"type" =>
"glo_overlay",
"class" =>
"GlossaryOverlay"),
424 array(
"type" =>
"glo_ovtitle",
"class" =>
"GlossaryOvTitle"),
425 array(
"type" =>
"glo_ovclink",
"class" =>
"GlossaryOvCloseLink"),
426 array(
"type" =>
"glo_ovuglink",
"class" =>
"GlossaryOvUnitGloLink"),
427 array(
"type" =>
"glo_ovuglistlink",
"class" =>
"GlossaryOvUGListLink"),
428 array(
"type" =>
"sco_title",
"class" =>
"Title"),
429 array(
"type" =>
"sco_desc",
"class" =>
"Description"),
430 array(
"type" =>
"sco_desct",
"class" =>
"DescriptionTop"),
431 array(
"type" =>
"sco_keyw",
"class" =>
"Keywords"),
432 array(
"type" =>
"sco_obj",
"class" =>
"Objective"),
433 array(
"type" =>
"sco_objt",
"class" =>
"ObjectiveTop"),
434 array(
"type" =>
"sco_fmess",
"class" =>
"FinalMessage"),
435 array(
"type" =>
"rte_menu",
"class" =>
"RTEMenu"),
436 array(
"type" =>
"rte_menu",
"class" =>
"RTELogo"),
437 array(
"type" =>
"rte_menu",
"class" =>
"RTELinkBar"),
438 array(
"type" =>
"rte_mlink",
"class" =>
"RTELink"),
439 array(
"type" =>
"rte_mlink",
"class" =>
"RTELinkDisabled"),
440 array(
"type" =>
"rte_tree",
"class" =>
"RTETree"),
441 array(
"type" =>
"rte_node",
"class" =>
"RTECourse"),
442 array(
"type" =>
"rte_node",
"class" =>
"RTEChapter"),
443 array(
"type" =>
"rte_node",
"class" =>
"RTESco"),
444 array(
"type" =>
"rte_node",
"class" =>
"RTEAsset"),
445 array(
"type" =>
"rte_node",
"class" =>
"RTECourseDisabled"),
446 array(
"type" =>
"rte_node",
"class" =>
"RTEChapterDisabled"),
447 array(
"type" =>
"rte_node",
"class" =>
"RTEScoDisabled"),
448 array(
"type" =>
"rte_node",
"class" =>
"RTEAssetDisabled"),
449 array(
"type" =>
"rte_status",
"class" =>
"RTEAsset"),
450 array(
"type" =>
"rte_status",
"class" =>
"RTECompleted"),
451 array(
"type" =>
"rte_status",
"class" =>
"RTENotAttempted"),
452 array(
"type" =>
"rte_status",
"class" =>
"RTERunning"),
453 array(
"type" =>
"rte_status",
"class" =>
"RTEIncomplete"),
454 array(
"type" =>
"rte_status",
"class" =>
"RTEPassed"),
455 array(
"type" =>
"rte_status",
"class" =>
"RTEFailed"),
456 array(
"type" =>
"rte_status",
"class" =>
"RTEBrowsed"),
457 array(
"type" =>
"rte_tlink",
"class" =>
"RTETreeLink"),
458 array(
"type" =>
"rte_tlink",
"class" =>
"RTETreeLinkDisabled"),
459 array(
"type" =>
"rte_tlink",
"class" =>
"RTETreeCurrent"),
460 array(
"type" =>
"rte_tul",
"class" =>
"RTETreeList"),
461 array(
"type" =>
"rte_tli",
"class" =>
"RTETreeItem"),
462 array(
"type" =>
"rte_texp",
"class" =>
"RTETreeExpanded"),
463 array(
"type" =>
"rte_texp",
"class" =>
"RTETreeCollapsed"),
464 array(
"type" =>
"rte_tree",
"class" =>
"RTETreeControl"),
465 array(
"type" =>
"rte_tclink",
"class" =>
"RTETreeControlLink"),
466 array(
"type" =>
"rte_drag",
"class" =>
"RTEDragBar"),
467 array(
"type" =>
"list_o",
"class" =>
"NumberedList"),
468 array(
"type" =>
"list_u",
"class" =>
"BulletedList"),
469 array(
"type" =>
"list_item",
"class" =>
"StandardListItem"),
470 array(
"type" =>
"question",
"class" =>
"Standard"),
471 array(
"type" =>
"question",
"class" =>
"SingleChoice"),
472 array(
"type" =>
"question",
"class" =>
"MultipleChoice"),
473 array(
"type" =>
"question",
"class" =>
"TextQuestion"),
474 array(
"type" =>
"question",
"class" =>
"OrderingQuestion"),
475 array(
"type" =>
"question",
"class" =>
"MatchingQuestion"),
476 array(
"type" =>
"question",
"class" =>
"ImagemapQuestion"),
477 array(
"type" =>
"question",
"class" =>
"ErrorText"),
478 array(
"type" =>
"question",
"class" =>
"TextSubset"),
479 array(
"type" =>
"question",
"class" =>
"ClozeTest"),
480 array(
"type" =>
"qtitle",
"class" =>
"Title"),
481 array(
"type" =>
"qanswer",
"class" =>
"Answer"),
482 array(
"type" =>
"qimg",
"class" =>
"QuestionImage"),
483 array(
"type" =>
"qimgd",
"class" =>
"ImageDetailsLink"),
484 array(
"type" =>
"qordul",
"class" =>
"OrderList"),
485 array(
"type" =>
"qordli",
"class" =>
"OrderListItem"),
486 array(
"type" =>
"qordul",
"class" =>
"OrderListHorizontal"),
487 array(
"type" =>
"qordli",
"class" =>
"OrderListItemHorizontal"),
488 array(
"type" =>
"qetitem",
"class" =>
"ErrorTextItem"),
489 array(
"type" =>
"qetitem",
"class" =>
"ErrorTextSelected"),
490 array(
"type" =>
"qetcorr",
"class" =>
"ErrorTextCorrected"),
491 array(
"type" =>
"qinput",
"class" =>
"TextInput"),
492 array(
"type" =>
"qlinput",
"class" =>
"LongTextInput"),
493 array(
"type" =>
"qsubmit",
"class" =>
"Submit"),
494 array(
"type" =>
"qfeedr",
"class" =>
"FeedbackRight"),
495 array(
"type" =>
"qfeedw",
"class" =>
"FeedbackWrong"),
496 array(
"type" =>
"qover",
"class" =>
"Correct"),
497 array(
"type" =>
"qover",
"class" =>
"Inorrect"),
498 array(
"type" =>
"qover",
"class" =>
"StatusMessage"),
499 array(
"type" =>
"qover",
"class" =>
"WrongAnswersMessage"),
500 array(
"type" =>
"flist_cont",
"class" =>
"FileListContainer"),
501 array(
"type" =>
"flist_head",
"class" =>
"FileListHeading"),
502 array(
"type" =>
"flist",
"class" =>
"FileList"),
503 array(
"type" =>
"flist_li",
"class" =>
"FileListItem"),
504 array(
"type" =>
"flist_a",
"class" =>
"FileListItemLink")
510 "caption" =>
"table_caption",
511 "row_head" =>
"table_cell",
512 "row_foot" =>
"table_cell",
513 "col_head" =>
"table_cell",
514 "col_foot" =>
"table_cell",
515 "odd_row" =>
"table_cell",
516 "even_row" =>
"table_cell",
517 "odd_col" =>
"table_cell",
518 "even_col" =>
"table_cell"),
519 "vaccordion" =>
array(
520 "va_cntr" =>
"va_cntr",
521 "va_icntr" =>
"va_icntr",
522 "va_ihead" =>
"va_ihead",
523 "va_iheada" =>
"va_iheada",
524 "va_ihcap" =>
"va_ihcap",
525 "va_icont" =>
"va_icont" 527 "haccordion" =>
array(
528 "ha_cntr" =>
"ha_cntr",
529 "ha_icntr" =>
"ha_icntr",
530 "ha_ihead" =>
"ha_ihead",
531 "ha_iheada" =>
"ha_iheada",
532 "ha_ihcap" =>
"ha_ihcap",
533 "ha_icont" =>
"ha_icont" 536 "ca_cntr" =>
"ca_cntr",
537 "ca_icntr" =>
"ca_icntr",
538 "ca_ihead" =>
"ca_ihead",
539 "ca_icont" =>
"ca_icont" 554 public function __construct($a_id = 0, $a_call_by_reference =
false)
558 $this->db = $DIC->database();
559 $this->lng = $DIC->language();
562 if ($a_call_by_reference) {
563 $this->
ilias->raiseError(
"Can't instantiate style object via reference id.", $this->
ilias->error_obj->FATAL);
566 parent::__construct($a_id,
false);
574 $this->
ilias->raiseError(
"Operation ilObjStyleSheet::setRefId() not allowed.", $this->
ilias->error_obj->FATAL);
591 $this->
ilias->raiseError(
"Operation ilObjStyleSheet::putInTree() not allowed.", $this->
ilias->error_obj->FATAL);
599 $this->
ilias->raiseError(
"Operation ilObjStyleSheet::createReference() not allowed.", $this->
ilias->error_obj->FATAL);
607 $this->up_to_date = $a_up_to_date;
615 return $this->up_to_date;
623 $this->scope = $a_scope;
641 $ilDB = $DIC->database();
643 $q =
"UPDATE style_data SET uptodate = " .
644 $ilDB->quote((
int) $a_up_to_date,
"integer") .
645 " WHERE id = " .
$ilDB->quote($a_id,
"integer");
646 $ilDB->manipulate($q);
656 $ilDB = $DIC->database();
658 $q =
"SELECT uptodate FROM style_data " .
659 " WHERE id = " .
$ilDB->quote($a_id,
"integer");
663 return (
boolean) $sty[
"uptodate"];
673 $ilDB = $DIC->database();
675 $q =
"UPDATE style_data SET standard = " .
676 $ilDB->quote((
int) $a_std,
"integer") .
677 " WHERE id = " .
$ilDB->quote($a_id,
"integer");
678 $ilDB->manipulate($q);
688 $ilDB = $DIC->database();
690 $q =
"UPDATE style_data SET category = " .
691 $ilDB->quote((
int) $a_scope,
"integer") .
692 " WHERE id = " .
$ilDB->quote($a_id,
"integer");
693 $ilDB->manipulate($q);
703 $ilDB = $DIC->database();
705 $q =
"SELECT * FROM style_data " .
706 " WHERE id = " .
$ilDB->quote($a_id,
"integer");
710 return (
boolean) $sty[
"standard"];
720 $ilDB = $DIC->database();
722 $q =
"UPDATE style_data SET active = " .
723 $ilDB->quote((
int) $a_active,
"integer") .
724 " WHERE id = " .
$ilDB->quote($a_id,
"integer");
725 $ilDB->manipulate($q);
735 $ilDB = $DIC->database();
737 $q =
"SELECT * FROM style_data " .
738 " WHERE id = " .
$ilDB->quote($a_id,
"integer");
742 return (
boolean) $sty[
"active"];
749 $a_exclude_default_style =
false,
750 $a_include_deactivated =
false,
755 $ilDB = $DIC->database();
757 $tree = $DIC->repositoryTree();
759 $default_style =
$ilSetting->get(
"default_content_style_id");
762 if (!$a_include_deactivated) {
763 $and_str =
" AND active = 1";
766 $q =
"SELECT * FROM style_data " .
767 " WHERE standard = 1" . $and_str;
771 if (!$a_exclude_default_style || $default_style != $sty[
"id"]) {
773 if ($a_scope > 0 && $sty[
"category"] > 0) {
774 if (
$tree->isInTree($sty[
"category"]) &&
775 $tree->isInTree($a_scope)) {
777 if (!in_array($sty[
"category"],
$path)) {
798 $ilAccess = $DIC->access();
799 $ilDB = $DIC->database();
801 $clonable_styles =
array();
803 $q =
"SELECT * FROM style_data";
804 $style_set =
$ilDB->query($q);
805 while ($style_rec =
$ilDB->fetchAssoc($style_set)) {
807 if ($style_rec[
"standard"] == 1) {
808 if ($style_rec[
"active"] == 1) {
812 include_once(
"./Modules/LearningModule/classes/class.ilObjContentObject.php");
814 if (count($obj_ids) == 0) {
815 $obj_ids = self::lookupObjectForStyle($style_rec[
"id"]);
817 foreach ($obj_ids as
$id) {
820 if ($ilAccess->checkAccess(
"write",
"", $ref_id)) {
827 $clonable_styles[$style_rec[
"id"]] =
832 asort($clonable_styles);
834 return $clonable_styles;
842 $this->meta_data = $a_meta_data;
850 if (!is_object(self::$basic_style_dom)) {
852 self::$basic_style_dom->load(self::$basic_style_file);
855 return self::$basic_style_dom;
863 return $this->meta_data;
869 public function create($a_from_style = 0, $a_import_mode =
false)
875 if ($a_from_style == 0) {
876 if (!$a_import_mode) {
883 self::$basic_style_image_dir,
888 $q =
"INSERT INTO style_data (id, uptodate, category) VALUES " .
889 "(" .
$ilDB->quote($this->
getId(),
"integer") .
", 0," .
891 $ilDB->manipulate($q);
897 $q =
"SELECT * FROM style_parameter WHERE style_id = " .
898 $ilDB->quote($a_from_style,
"integer");
899 $par_set =
$ilDB->query($q);
900 while ($par_rec =
$ilDB->fetchAssoc($par_set)) {
901 $def[] =
array(
"tag" => $par_rec[
"tag"],
"class" => $par_rec[
"class"],
902 "parameter" => $par_rec[
"parameter"],
"value" => $par_rec[
"value"],
903 "type" => $par_rec[
"type"],
"mq_id" => $par_rec[
"mq_id"],
"custom" => $par_rec[
"custom"]);
908 $q =
"SELECT * FROM style_char WHERE style_id = " .
909 $ilDB->quote($a_from_style,
"integer");
910 $par_set =
$ilDB->query($q);
911 while ($par_rec =
$ilDB->fetchAssoc($par_set)) {
912 $chars[] =
array(
"type" => $par_rec[
"type"],
"characteristic" => $par_rec[
"characteristic"]);
918 $mqs = $from_style->getMediaQueries();
919 $mq_mapping =
array();
920 foreach ($mqs as $mq) {
922 $mq_mapping[$mq[
"id"]] = $nid;
926 foreach (
$def as $sty) {
927 $id =
$ilDB->nextId(
"style_parameter");
928 $q =
"INSERT INTO style_parameter (id, style_id, tag, class, parameter, value, type, mq_id, custom) VALUES " .
930 $ilDB->quote(
$id,
"integer") .
"," .
931 $ilDB->quote($this->
getId(),
"integer") .
"," .
932 $ilDB->quote($sty[
"tag"],
"text") .
"," .
933 $ilDB->quote($sty[
"class"],
"text") .
"," .
934 $ilDB->quote($sty[
"parameter"],
"text") .
"," .
935 $ilDB->quote($sty[
"value"],
"text") .
"," .
936 $ilDB->quote($sty[
"type"],
"text") .
"," .
937 $ilDB->quote((
int) $mq_mapping[$sty[
"mq_id"]],
"integer") .
"," .
938 $ilDB->quote($sty[
"custom"],
"integer") .
940 $ilDB->manipulate($q);
944 foreach ($chars as $char) {
945 $q =
"INSERT INTO style_char (style_id, type, characteristic) VALUES " .
946 "(" .
$ilDB->quote($this->
getId(),
"integer") .
"," .
947 $ilDB->quote($char[
"type"],
"text") .
"," .
948 $ilDB->quote($char[
"characteristic"],
"text") .
")";
949 $ilDB->manipulate($q);
953 $q =
"INSERT INTO style_data (id, uptodate, category) VALUES " .
954 "(" .
$ilDB->quote($this->
getId(),
"integer") .
", 0," .
956 $ilDB->manipulate($q);
961 $from_style->getImagesDirectory(),
966 $colors = $from_style->getColors();
967 foreach ($colors as $c) {
968 $this->
addColor($c[
"name"], $c[
"code"]);
973 foreach ($tcts as $tct => $v) {
976 $this->
addTemplate($tct, $t[
"name"], $t[
"classes"]);
982 if (!$a_import_mode) {
998 $st =
$ilDB->manipulateF(
999 "DELETE FROM style_char WHERE style_id = %s AND type = %s AND characteristic = %s",
1000 array(
"integer",
"text",
"text"),
1005 $st =
$ilDB->manipulateF(
1006 "DELETE FROM style_parameter WHERE style_id = %s AND tag = %s AND type = %s AND class = %s",
1007 array(
"integer",
"text",
"text",
"text"),
1023 $set =
$ilDB->queryF(
1024 "SELECT style_id FROM style_char WHERE style_id = %s AND characteristic = %s AND type = %s",
1025 array(
"integer",
"text",
"text"),
1026 array($this->
getId(), $a_char, $a_style_type)
1028 if ($rec =
$ilDB->fetchAssoc($set)) {
1043 "INSERT INTO style_char (style_id, type, characteristic, hide)" .
1044 " VALUES (%s,%s,%s,%s) ",
1045 array(
"integer",
"text",
"text",
"integer"),
1075 $pars = $from_style->getParametersOfClass($a_from_type, $a_from_char);
1078 foreach ($pars as $p => $v) {
1079 if (substr($v, 0, 1) ==
"!") {
1080 $colors[] = substr($v, 1);
1092 foreach ($colors as $c) {
1094 $this->
addColor($c, $from_style->getColorCodeForName($c));
1107 $chars = $this->chars;
1109 if (is_array($this->chars_by_type[
$a_type])) {
1110 foreach ($this->chars_by_type[$a_type] as $c) {
1111 if ($a_include_core || !self::isCoreStyle($a_type, $c)) {
1118 foreach ($chars as $k => $char) {
1119 if ($a_type ==
"" && $this->hidden_chars[$char[
"type"] .
":" . $char[
"class"]]) {
1121 } elseif ($this->hidden_chars[$a_type .
":" . $char]) {
1135 $this->chars = $a_chars;
1147 "UPDATE style_char SET " .
1148 " hide = " .
$ilDB->quote((
int) $a_hide,
"integer") .
1149 " WHERE style_id = " .
$ilDB->quote($this->
getId(),
"integer") .
" AND " .
1151 " characteristic = " .
$ilDB->quote($a_char,
"text")
1162 $set =
$ilDB->query(
1163 "SELECT hide FROM style_char " .
1164 " WHERE style_id = " .
$ilDB->quote($this->getId(),
"integer") .
" AND " .
1166 " characteristic = " .
$ilDB->quote($a_char,
"text")
1168 $rec =
$ilDB->fetchAssoc($set);
1170 return $rec[
"hide"];
1183 $lng->loadLanguageModule(
"style");
1186 $new_obj->setTitle($this->
getTitle() .
" (" .
$lng->txt(
"sty_acopy") .
")");
1187 $new_obj->setType($this->
getType());
1189 $new_obj->create($this->
getId());
1191 $new_obj->writeStyleSetting(
1192 "disable_auto_margins",
1196 return $new_obj->getId();
1221 $tag = explode(
".", $a_tag);
1222 $value = $avail_params[$a_par][0];
1223 $id =
$ilDB->nextId(
"style_parameter");
1224 $q =
"INSERT INTO style_parameter (id,style_id, type, tag, class, parameter, value, mq_id, custom) VALUES " .
1226 $ilDB->quote(
$id,
"integer") .
"," .
1227 $ilDB->quote($this->
getId(),
"integer") .
"," .
1231 $ilDB->quote($a_par,
"text") .
"," .
1232 $ilDB->quote($value,
"text") .
"," .
1233 $ilDB->quote($a_mq_id,
"integer") .
"," .
1234 $ilDB->quote($a_custom,
"integer") .
1236 $ilDB->manipulate($q);
1262 if (!is_writable($sty_data_dir)) {
1263 $ilErr->raiseError(
"Style data directory (" . $sty_data_dir
1264 .
") not writeable.",
$ilErr->FATAL);
1267 $style_dir = $sty_data_dir .
"/sty_" . $a_style_id;
1269 if (!@is_dir($style_dir)) {
1270 $ilErr->raiseError(
"Creation of style directory failed (" .
1271 $style_dir .
").",
$ilErr->FATAL);
1275 $im_dir = $style_dir .
"/images";
1277 if (!@is_dir($im_dir)) {
1278 $ilErr->raiseError(
"Creation of Import Directory failed (" .
1279 $im_dir .
").",
$ilErr->FATAL);
1283 $thumb_dir = $style_dir .
"/images/thumbnails";
1285 if (!@is_dir($thumb_dir)) {
1286 $ilErr->raiseError(
"Creation of Import Directory failed (" .
1287 $thumb_dir .
").",
$ilErr->FATAL);
1326 foreach ($entries as $entry) {
1327 if (substr($entry[
"entry"], 0, 1) ==
".") {
1330 if ($entry[
"type"] !=
"dir") {
1345 @ilUtil::moveUploadedFile(
1346 $a_file[
"tmp_name"],
1380 $q =
"DELETE FROM style_parameter WHERE id = " .
1381 $ilDB->quote($a_id,
"integer");
1398 $q =
"DELETE FROM style_parameter WHERE " .
1399 " style_id = " .
$ilDB->quote($this->
getId(),
"integer") .
" AND " .
1400 " tag = " .
$ilDB->quote($a_tag,
"text") .
" AND " .
1401 " class = " .
$ilDB->quote($a_class,
"text") .
" AND " .
1402 " mq_id = " .
$ilDB->quote($a_mq_id,
"integer") .
" AND " .
1403 " custom = " .
$ilDB->quote($a_custom,
"integer") .
" AND " .
1404 " " .
$ilDB->equals(
"type",
$a_type,
"text",
true) .
" AND " .
1405 " parameter = " .
$ilDB->quote($a_par,
"text");
1407 $ilDB->manipulate($q);
1423 $q =
"DELETE FROM style_parameter WHERE " .
1424 " style_id = " .
$ilDB->quote($this->
getId(),
"integer") .
" AND " .
1425 " tag = " .
$ilDB->quote($a_tag,
"text") .
" AND " .
1426 " class = " .
$ilDB->quote($a_class,
"text") .
" AND " .
1427 " mq_id = " .
$ilDB->quote($a_mq_id,
"integer") .
" AND " .
1428 " custom = " .
$ilDB->quote(1,
"integer") .
" AND " .
1431 $ilDB->manipulate($q);
1446 $q =
"DELETE FROM style_parameter WHERE " .
1447 " style_id = " .
$ilDB->quote($this->
getId(),
"integer") .
" AND " .
1448 " class = " .
$ilDB->quote($a_class,
"text") .
" AND " .
1451 $ilDB->manipulate($q);
1458 public function delete()
1466 $def_style = $this->
ilias->getSetting(
"default_content_style_id");
1467 if ($def_style == $this->
getId()) {
1468 $this->
ilias->deleteSetting(
"default_content_style_id");
1472 $fixed_style = $this->
ilias->getSetting(
"fixed_content_style_id");
1473 if ($fixed_style == $this->
getId()) {
1474 $this->
ilias->deleteSetting(
"fixed_content_style_id");
1478 $q =
"DELETE FROM style_parameter WHERE style_id = " .
1480 $ilDB->manipulate($q);
1484 if (is_file($css_file_name)) {
1485 unlink($css_file_name);
1490 "DELETE FROM sty_media_query WHERE " .
1491 " style_id = " .
$ilDB->quote($this->getId(),
"integer")
1495 include_once(
"./Modules/LearningModule/classes/class.ilObjContentObject.php");
1499 $q =
"DELETE FROM style_data WHERE id = " .
1501 $ilDB->manipulate($q);
1514 $q =
"SELECT * FROM style_parameter WHERE style_id = " .
1515 $ilDB->quote($this->
getId(),
"integer") .
" ORDER BY tag, class, type, mq_id ";
1516 $style_set =
$ilDB->query($q);
1525 $this->end_styles =
array();
1526 while ($style_rec =
$ilDB->fetchAssoc($style_set)) {
1527 if ($style_rec[
"tag"] != $ctag || $style_rec[
"class"] != $cclass
1528 || $style_rec[
"type"] != $ctype || $style_rec[
"mq_id"] != $cmq_id) {
1530 if (is_array(
$tag)) {
1531 if (in_array($ctype,
array(
"ha_iheada",
"va_iheada"))) {
1532 $this->end_styles[] =
$tag;
1539 $ctag = $style_rec[
"tag"];
1540 $cclass = $style_rec[
"class"];
1541 $ctype = $style_rec[
"type"];
1542 $cmq_id = $style_rec[
"mq_id"];
1543 $tag[] = $style_rec;
1545 $this->style_class[$ctype][$cclass][$cmq_id][$style_rec[
"parameter"]] = $style_rec[
"value"];
1547 if (is_array(
$tag)) {
1550 foreach ($this->end_styles as
$s) {
1554 $q =
"SELECT * FROM style_data WHERE id = " .
1562 $this->chars =
array();
1563 $this->chars_by_type =
array();
1564 $q =
"SELECT * FROM style_char WHERE style_id = " .
1566 " ORDER BY type ASC, characteristic ASC";
1567 $par_set =
$ilDB->query($q);
1568 while ($par_rec =
$ilDB->fetchAssoc($par_set)) {
1569 $this->chars[] =
array(
"type" => $par_rec[
"type"],
"class" => $par_rec[
"characteristic"],
"hide" => $par_rec[
"hide"]);
1570 $this->chars_by_type[$par_rec[
"type"]][] = $par_rec[
"characteristic"];
1571 if ($par_rec[
"hide"]) {
1572 $this->hidden_chars[$par_rec[
"type"] .
":" . $par_rec[
"characteristic"]] =
true;
1585 if ($a_target_file ==
"") {
1588 $css_file_name = $a_target_file;
1590 $css_file = fopen($css_file_name,
"w");
1592 $page_background =
"";
1594 $mqs =
array(
array(
"mquery" =>
"",
"id" => 0));
1600 foreach ($mqs as $mq) {
1601 if ($mq[
"id"] > 0) {
1602 fwrite($css_file,
"@media " . $mq[
"mquery"] .
" {\n");
1606 if ($tag[0][
"mq_id"] != $mq[
"id"]) {
1609 fwrite($css_file, $tag[0][
"tag"] .
".ilc_" . $tag[0][
"type"] .
"_" . $tag[0][
"class"] .
"\n");
1612 if ($tag[0][
"tag"] ==
"td") {
1613 fwrite($css_file,
",th" .
".ilc_" . $tag[0][
"type"] .
"_" . $tag[0][
"class"] .
"\n");
1615 if (in_array($tag[0][
"tag"],
array(
"h1",
"h2",
"h3"))) {
1616 fwrite($css_file,
",div.ilc_text_block_" . $tag[0][
"class"] .
"\n");
1617 fwrite($css_file,
",body.ilc_text_block_" . $tag[0][
"class"] .
"\n");
1619 if ($tag[0][
"type"] ==
"section") {
1620 fwrite($css_file,
",a.ilc_" . $tag[0][
"type"] .
"_" . $tag[0][
"class"] .
"\n");
1622 if ($tag[0][
"type"] ==
"text_block") {
1623 fwrite($css_file,
",body.ilc_text_block_" . $tag[0][
"class"] .
"\n");
1625 fwrite($css_file,
"{\n");
1628 $t_border =
array();
1630 foreach ($tag as $par) {
1631 $cur_par = $par[
"parameter"];
1632 $cur_val = $par[
"value"];
1635 if (is_int(strpos($cur_par,
"color")) && substr(trim($cur_val), 0, 1) ==
"!") {
1639 if ($tag[0][
"type"] ==
"table" && is_int(strpos($par[
"parameter"],
"border"))) {
1640 $t_border[$cur_par] = $cur_val;
1643 if (in_array($cur_par,
array(
"background-image",
"list-style-image"))) {
1644 if (is_int(strpos($cur_val,
"/"))) {
1645 $cur_val =
"url(" . $cur_val .
")";
1647 if ($a_image_dir ==
"") {
1648 $cur_val =
"url(../sty/sty_" . $this->
getId() .
"/images/" . $cur_val .
")";
1650 $cur_val =
"url(" . $a_image_dir .
"/" . $cur_val .
")";
1655 if ($cur_par ==
"opacity") {
1656 $cur_val = ((int) $cur_val) / 100;
1659 fwrite($css_file,
"\t" . $cur_par .
": " . $cur_val .
";\n");
1662 if ($cur_par ==
"min-height") {
1663 fwrite($css_file,
"\t" .
"height" .
": " .
"auto !important" .
";\n");
1664 fwrite($css_file,
"\t" .
"height" .
": " . $cur_val .
";\n");
1668 if ($cur_par ==
"opacity") {
1669 fwrite($css_file,
"\t" .
'-ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=' . ($cur_val * 100) .
')"' .
";\n");
1670 fwrite($css_file,
"\t" .
'filter: alpha(opacity=' . ($cur_val * 100) .
')' .
";\n");
1671 fwrite($css_file,
"\t" .
'-moz-opacity: ' . $cur_val .
";\n");
1675 if ($cur_par ==
"transform") {
1676 fwrite($css_file,
"\t" .
'-webkit-transform: ' . $cur_val .
";\n");
1677 fwrite($css_file,
"\t" .
'-moz-transform: ' . $cur_val .
";\n");
1678 fwrite($css_file,
"\t" .
'-ms-transform: ' . $cur_val .
";\n");
1682 if ($cur_par ==
"transform-origin") {
1683 fwrite($css_file,
"\t" .
'-webkit-transform-origin: ' . $cur_val .
";\n");
1684 fwrite($css_file,
"\t" .
'-moz-transform-origin: ' . $cur_val .
";\n");
1685 fwrite($css_file,
"\t" .
'-ms-transform-origin: ' . $cur_val .
";\n");
1689 if ($tag[0][
"tag"] ==
"div" && $tag[0][
"class"] ==
"Page" 1690 && $cur_par ==
"background-color") {
1691 $page_background = $cur_val;
1694 fwrite($css_file,
"}\n");
1695 fwrite($css_file,
"\n");
1715 if ($page_background !=
"") {
1716 fwrite($css_file,
"td.ilc_Page\n");
1717 fwrite($css_file,
"{\n");
1718 fwrite($css_file,
"\t" .
"background-color: " . $page_background .
";\n");
1719 fwrite($css_file,
"}\n");
1721 if ($mq[
"id"] > 0) {
1722 fwrite($css_file,
"}\n");
1744 $fixed_style =
$ilSetting->get(
"fixed_content_style_id");
1745 if ($fixed_style > 0) {
1746 $a_style_id = $fixed_style;
1750 if ($a_style_id <= 0) {
1751 $a_style_id =
$ilSetting->get(
"default_content_style_id");
1769 if (is_array($this->style_class[
$a_type][$a_class][$a_mq_id])) {
1770 return $this->style_class[
$a_type][$a_class][$a_mq_id];
1786 $random = new \ilRandom();
1787 $rand = $random->int(1, 999999);
1791 $fixed_style =
$ilSetting->get(
"fixed_content_style_id");
1792 if ($fixed_style > 0) {
1793 $a_style_id = $fixed_style;
1797 if ($a_style_id <= 0) {
1798 $a_style_id =
$ilSetting->get(
"default_content_style_id");
1810 $path .=
"?dummy=$rand";
1812 require_once(
'./Services/WebAccessChecker/classes/class.ilWACSignedPath.php');
1817 return "./Services/COPage/css/content.css";
1828 return "./Services/COPage/css/print_content.css";
1838 return "./Services/COPage/css/syntaxhighlight.css";
1848 return "./Services/COPage/css/placeholder.css";
1859 $q =
"UPDATE style_data " .
1860 "SET category = " .
$ilDB->quote((
int) $this->
getScope(),
"integer") .
1861 " WHERE id = " .
$ilDB->quote($this->
getId(),
"integer");
1862 $ilDB->manipulate($q);
1875 $q =
"UPDATE style_parameter SET VALUE = " .
1876 $ilDB->quote($a_value,
"text") .
" WHERE id = " .
1877 $ilDB->quote($a_id,
"integer");
1878 $style_set =
$ilDB->manipulate($q);
1895 $ilDB = $DIC->database();
1897 $q =
"SELECT * FROM style_parameter WHERE " .
1898 " style_id = " .
$ilDB->quote($style_id,
"integer") .
" AND " .
1899 " tag = " .
$ilDB->quote($a_tag,
"text") .
" AND " .
1900 " class = " .
$ilDB->quote($a_class,
"text") .
" AND " .
1901 " mq_id = " .
$ilDB->quote($a_mq_id,
"integer") .
" AND " .
1902 " custom = " .
$ilDB->quote($a_custom,
"integer") .
" AND " .
1903 " " .
$ilDB->equals(
"type",
$a_type,
"text",
true) .
" AND " .
1904 " parameter = " .
$ilDB->quote($a_par,
"text");
1906 $set =
$ilDB->query($q);
1908 if ($rec = $set->fetchRow()) {
1909 $q =
"UPDATE style_parameter SET " .
1910 " value = " .
$ilDB->quote($a_val,
"text") .
" WHERE " .
1911 " style_id = " .
$ilDB->quote($style_id,
"integer") .
" AND " .
1912 " tag = " .
$ilDB->quote($a_tag,
"text") .
" AND " .
1913 " class = " .
$ilDB->quote($a_class,
"text") .
" AND " .
1914 " mq_id = " .
$ilDB->quote($a_mq_id,
"integer") .
" AND " .
1915 " custom = " .
$ilDB->quote($a_custom,
"integer") .
" AND " .
1916 " " .
$ilDB->equals(
"type",
$a_type,
"text",
true) .
" AND " .
1917 " parameter = " .
$ilDB->quote($a_par,
"text");
1919 $ilDB->manipulate($q);
1921 $id =
$ilDB->nextId(
"style_parameter");
1922 $q =
"INSERT INTO style_parameter (id, value, style_id, tag, class, type, parameter, mq_id, custom) VALUES " .
1924 $ilDB->quote(
$id,
"integer") .
"," .
1925 $ilDB->quote($a_val,
"text") .
"," .
1926 " " .
$ilDB->quote($style_id,
"integer") .
"," .
1927 " " .
$ilDB->quote($a_tag,
"text") .
"," .
1928 " " .
$ilDB->quote($a_class,
"text") .
"," .
1930 " " .
$ilDB->quote($a_par,
"text") .
"," .
1931 " " .
$ilDB->quote($a_mq_id,
"integer") .
"," .
1932 " " .
$ilDB->quote($a_custom,
"integer") .
1935 $ilDB->manipulate($q);
1953 $this->
style = $a_style;
1965 return str_replace(
"&",
"&", $a_str);
1974 $xml.=
"<StyleSheet>\n";
1981 foreach ($this->chars as $char) {
1983 "\" Type=\"" . $char[
"type"] .
"\" Class=\"" . $char[
"class"] .
"\">\n";
1985 if ($style[0][
"type"] == $char[
"type"] && $style[0][
"class"] == $char[
"class"]) {
1986 foreach ($style as
$tag) {
1987 $xml.=
"<StyleParameter Name=\"" . $tag[
"parameter"] .
"\" Value=\"" . $tag[
"value"] .
"\" Custom=\"" . $tag[
"custom"] .
"\" />\n";
1991 $xml.=
"</Style>\n";
1995 foreach ($this->
getColors() as $color) {
1996 $xml.=
"<StyleColor Name=\"" . $color[
"name"] .
"\" Code=\"" . $color[
"code"] .
"\"/>\n";
2001 foreach ($tcts as $tct => $v) {
2004 foreach ($ts as
$t) {
2005 $xml.=
"<StyleTemplate Type=\"" . $tct .
"\" Name=\"" . $t[
"name"] .
"\">\n";
2006 foreach ($t[
"classes"] as $ct => $c) {
2008 $xml.=
"<StyleTemplateClass ClassType=\"" . $ct .
"\" Class=\"" . $c .
"\"/>\n";
2011 $xml.=
"</StyleTemplate>\n";
2016 $xml.=
"</StyleSheet>";
2029 if (!is_writable($sty_data_dir)) {
2030 $this->
ilias->raiseError(
"Style data directory (" . $sty_data_dir
2031 .
") not writeable.", $this->
ilias->error_obj->FATAL);
2034 $style_dir = $sty_data_dir .
"/sty_" . $this->
getId();
2036 if (!@is_dir($style_dir)) {
2037 $this->
ilias->raiseError(
"Creation of style directory failed (" .
2038 $style_dir .
").", $this->
ilias->error_obj->FATAL);
2042 $ex_dir = $style_dir .
"/export";
2044 if (!@is_dir($ex_dir)) {
2045 $this->
ilias->raiseError(
"Creation of Import Directory failed (" .
2046 $ex_dir .
").", $this->
ilias->error_obj->FATAL);
2058 $style_dir = $sty_data_dir .
"/sty_" . $this->
getId();
2060 $ex_dir = $style_dir .
"/export";
2062 if (is_dir($ex_dir)) {
2076 if (!is_writable($ex_sub_dir)) {
2077 $this->
ilias->raiseError(
"Style data directory (" . $ex_sub_dir
2078 .
") not writeable.", $this->
ilias->error_obj->FATAL);
2080 $ex_sub_images_dir = $ex_sub_dir .
"/images";
2082 if (!is_writable($ex_sub_images_dir)) {
2083 $this->
ilias->raiseError(
"Style data directory (" . $ex_sub_images_dir
2084 .
") not writeable.", $this->
ilias->error_obj->FATAL);
2093 $this->export_sub_dir = $a_dir;
2101 if ($this->export_sub_dir ==
"") {
2102 return "sty_" . $this->
getId();
2104 return $this->export_sub_dir;
2140 $file = $a_dir .
"/style.xml";
2143 if (!($fp = @fopen(
$file,
"w"))) {
2144 die(
"<b>Error</b>: Could not open \"" .
$file .
"\" for writing" .
2145 " in <b>" . __FILE__ .
"</b> on line <b>" . __LINE__ .
"</b><br />");
2152 fwrite($fp, $this->
getXML());
2165 if (!is_writable($sty_data_dir)) {
2166 $this->
ilias->raiseError(
"Style data directory (" . $sty_data_dir
2167 .
") not writeable.", $this->
ilias->error_obj->FATAL);
2170 $style_dir = $sty_data_dir .
"/sty_" . $this->
getId();
2172 if (!@is_dir($style_dir)) {
2173 $this->
ilias->raiseError(
"Creation of style directory failed (" .
2174 $style_dir .
").", $this->
ilias->error_obj->FATAL);
2178 $im_dir = $style_dir .
"/import";
2180 if (!@is_dir($im_dir)) {
2181 $this->
ilias->raiseError(
"Creation of Import Directory failed (" .
2182 $im_dir .
").", $this->
ilias->error_obj->FATAL);
2191 public function import($a_file)
2198 if (is_array($a_file)) {
2199 ilUtil::moveUploadedFile(
2200 $a_file[
"tmp_name"],
2202 $im_dir .
"/" . $a_file[
"name"]
2204 $file_name = $a_file[
"name"];
2206 $pi = pathinfo($a_file);
2207 $file_name = $pi[
"basename"];
2208 copy($a_file, $im_dir .
"/" . $file_name);
2210 $file = pathinfo($file_name);
2213 if (strtolower(
$file[
"extension"] ==
"zip")) {
2215 $subdir = basename(
$file[
"basename"],
"." .
$file[
"extension"]);
2216 if (!is_dir($im_dir .
"/" . $subdir)) {
2219 $xml_file = $im_dir .
"/" . $subdir .
"/style.xml";
2221 $xml_file = $im_dir .
"/" . $file_name;
2230 if (is_dir($im_dir .
"/" . $subdir .
"/images")) {
2232 $im_dir .
"/" . $subdir .
"/images",
2250 $this->is_3_10_skin =
false;
2252 if (!$a_skip_parent_create) {
2255 include_once(
"./Services/Style/Content/classes/class.ilStyleImportParser.php");
2257 $importParser->startParsing();
2261 foreach ($style as
$tag) {
2262 $id =
$ilDB->nextId(
"style_parameter");
2265 if (in_array($tag[
"class"],
array(
"PageFrame",
"PageContainer")) &&
2266 $tag[
"tag"] ==
"table") {
2267 $tag[
"tag"] =
"div";
2268 if ($tag[
"parameter"] ==
"width" && $tag[
"value"] ==
"100%") {
2273 $q =
"INSERT INTO style_parameter (id,style_id, tag, class, parameter, type, value, custom) VALUES " .
2275 $ilDB->quote(
$id,
"integer") .
"," .
2276 $ilDB->quote($this->
getId(),
"integer") .
"," .
2277 $ilDB->quote($tag[
"tag"],
"text") .
"," .
2278 $ilDB->quote($tag[
"class"],
"text") .
"," .
2279 $ilDB->quote($tag[
"parameter"],
"text") .
"," .
2280 $ilDB->quote($tag[
"type"],
"text") .
"," .
2281 $ilDB->quote($tag[
"value"],
"text") .
"," .
2282 $ilDB->quote((
bool) $tag[
"custom"],
"integer") .
2284 $ilDB->manipulate($q);
2289 $this->is_3_10_skin =
true;
2290 if (is_array($this->chars)) {
2291 foreach ($this->chars as $char) {
2292 if ($char[
"type"] !=
"") {
2293 $s = substr($char[
"class"], strlen($char[
"class"]) - 6);
2294 if (
$s !=
":hover") {
2298 "style_id" =>
array(
"integer", $this->
getId()),
2299 "type" =>
array(
"text", $char[
"type"]),
2300 "characteristic" =>
array(
"text", $char[
"class"])),
2309 $this->is_3_10_skin =
false;
2316 $q =
"INSERT INTO style_data (id, uptodate) VALUES " .
2317 "(" .
$ilDB->quote($this->
getId(),
"integer") .
", 0)";
2318 $ilDB->manipulate($q);
2323 if ($this->is_3_10_skin) {
2336 foreach (self::$parameter as
$parameter => $props) {
2344 $input = self::$parameter[$par][
"input"];
2350 $subpar = self::$parameter[$par][
"subpar"];
2357 return self::$parameter;
2360 foreach (self::$parameter as $k => $v) {
2361 if (is_array(self::$filtered_groups[$v[
"group"]]) &&
2362 !in_array($a_tag, self::$filtered_groups[$v[
"group"]])) {
2372 return self::$filtered_groups;
2377 if ($a_no_percentage) {
2378 return self::$num_unit_no_perc;
2380 return self::$num_unit;
2385 return self::$parameter[$par][
"values"];
2395 return self::$style_super_types;
2400 return in_array(
$a_type, self::$expandable_types);
2405 return in_array(
$a_type, self::$hideable_types);
2410 foreach (self::$style_super_types as
$s =>
$t) {
2425 $c_styles =
array();
2426 foreach (self::$core_styles as $cstyle) {
2428 =
array(
"type" => $cstyle[
"type"],
2430 "class" => $cstyle[
"class"]);
2443 foreach (self::$core_styles as
$s) {
2444 if ($s[
"type"] ==
$a_type && $s[
"class"] == $a_class) {
2457 if ($a_template_type ==
"") {
2458 return self::$templates;
2461 return self::$templates[$a_template_type];
2467 return self::$pseudo_classes[
$tag];
2472 return self::$templates[
$t][$k];
2477 return self::$assigned_tags[
$a_type];
2486 foreach (self::$parameter as $p => $v) {
2487 $pars[$p] = $v[
"values"];
2511 $ilDB = $DIC->database();
2513 if ($a_styles ==
"") {
2522 $core_images =
array();
2523 $core_dir = self::$basic_style_image_dir;
2524 if (is_dir($core_dir)) {
2525 $dir = opendir($core_dir);
2526 while (
$file = readdir($dir)) {
2527 if (substr(
$file, 0, 1) !=
"." && is_file($core_dir .
"/" .
$file)) {
2528 $core_images[] =
$file;
2538 $set =
$ilDB->queryF(
2539 "SELECT * FROM style_char WHERE style_id = %s " .
2540 "AND type = %s AND characteristic = %s",
2541 array(
"integer",
"text",
"text"),
2542 array(
$id, $cs[
"type"], $cs[
"class"])
2546 if (!($rec =
$ilDB->fetchAssoc($set))) {
2548 "INSERT INTO style_char (style_id, type, characteristic) " .
2549 " VALUES (%s,%s,%s) ",
2550 array(
"integer",
"text",
"text"),
2551 array(
$id, $cs[
"type"], $cs[
"class"])
2555 $par_nodes = $xpath->query(
"/StyleSheet/Style[@Tag = '" . $cs[
"tag"] .
"' and @Type='" .
2556 $cs[
"type"] .
"' and @Class='" . $cs[
"class"] .
"']/StyleParameter");
2557 foreach ($par_nodes as $par_node) {
2559 $set =
$ilDB->queryF(
2560 "SELECT * FROM style_parameter WHERE style_id = %s " .
2561 "AND type = %s AND class = %s AND tag = %s AND parameter = %s",
2562 array(
"integer",
"text",
"text",
"text",
"text"),
2563 array(
$id, $cs[
"type"], $cs[
"class"],
2564 $cs[
"tag"], $par_node->getAttribute(
"Name"))
2568 if (!($rec =
$ilDB->fetchAssoc($set))) {
2569 $spid =
$ilDB->nextId(
"style_parameter");
2570 $st =
$ilDB->manipulateF(
2571 "INSERT INTO style_parameter (id, style_id, type, class, tag, parameter, value) " .
2572 " VALUES (%s,%s,%s,%s,%s,%s,%s)",
2573 array(
"integer",
"integer",
"text",
"text",
"text",
"text",
"text"),
2574 array($spid,
$id, $cs[
"type"], $cs[
"class"], $cs[
"tag"],
2575 $par_node->getAttribute(
"Name"), $par_node->getAttribute(
"Value"))
2585 reset($core_images);
2586 foreach ($core_images as $cim) {
2587 if (!is_file($imdir .
"/" . $cim)) {
2588 copy($core_dir .
"/" . $cim, $imdir .
"/" . $cim);
2613 $st =
$ilDB->prepareManip(
"UPDATE style_char SET type = ? WHERE characteristic = ?" .
2614 " AND style_id = ? ",
array(
"text",
"text",
"integer"));
2616 $ilDB->execute($st,
array(
"media_caption",
"MediaCaption", $this->
getId()));
2618 $ilDB->execute($st,
array(
"page_nav",
"LMNavigation", $this->
getId()));
2619 $ilDB->execute($st,
array(
"page_title",
"PageTitle", $this->
getId()));
2623 $st =
$ilDB->prepareManip(
"UPDATE style_parameter SET type = ? WHERE class = ?" .
2624 " AND style_id = ? ",
array(
"text",
"text",
"integer"));
2626 $ilDB->execute($st,
array(
"media_caption",
"MediaCaption", $this->
getId()));
2628 $ilDB->execute($st,
array(
"page_nav",
"LMNavigation", $this->
getId()));
2629 $ilDB->execute($st,
array(
"page_title",
"PageTitle", $this->
getId()));
2632 $st =
$ilDB->prepareManip(
"UPDATE style_parameter SET tag = ? WHERE class = ?" .
2633 " AND style_id = ? ",
array(
"text",
"text",
"integer"));
2637 $st =
$ilDB->prepareManip(
"UPDATE style_char SET characteristic = ? WHERE characteristic = ?" .
2638 " AND style_id = ? ",
array(
"text",
"text",
"integer"));
2639 $ilDB->execute($st,
array(
"MediaContainer",
"Media", $this->
getId()));
2643 $st =
$ilDB->prepareManip(
"UPDATE style_parameter SET class = ? WHERE class = ?" .
2644 " AND style_id = ? ",
array(
"text",
"text",
"integer"));
2645 $ilDB->execute($st,
array(
"MediaContainer",
"Media", $this->
getId()));
2649 $st =
$ilDB->prepareManip(
"DELETE FROM style_char WHERE type = ?" .
2650 " AND style_id = ? ",
array(
"text",
"integer"));
2652 $st =
$ilDB->prepareManip(
"DELETE FROM style_parameter WHERE type = ?" .
2653 " AND style_id = ? ",
array(
"text",
"integer"));
2669 $add_str =
" AND style_id = " .
$ilDB->quote($a_id,
"integer");
2672 $set =
$ilDB->query($q =
"SELECT DISTINCT style_id, tag, class FROM style_parameter WHERE " .
2673 $ilDB->equals(
"type",
"",
"text",
true) .
" " . $add_str);
2675 while ($rec =
$ilDB->fetchAssoc($set)) {
2678 switch ($rec[
"tag"]) {
2681 if (in_array($rec[
"class"],
array(
"Headline3",
"Headline1",
2682 "Headline2",
"TableContent",
"List",
"Standard",
"Remark",
2683 "Additional",
"Mnemonic",
"Citation",
"Example"))) {
2684 $types[] =
"text_block";
2686 if (in_array($rec[
"class"],
array(
"Block",
"Remark",
2687 "Additional",
"Mnemonic",
"Example",
"Excursus",
"Special"))) {
2688 $types[] =
"section";
2690 if (in_array($rec[
"class"],
array(
"Page",
"Footnote",
"PageTitle",
"LMNavigation"))) {
2696 $types[] =
"table_cell";
2700 if (in_array($rec[
"class"],
array(
"ExtLink",
"IntLink",
"FootnoteLink"))) {
2706 $types[] =
"text_inline";
2715 foreach ($types as
$t) {
2717 $set4 =
$ilDB->queryF(
2718 "SELECT * FROM style_char " .
2719 " WHERE style_id = %s AND type = %s AND characteristic = %s",
2720 array(
"integer",
"text",
"text"),
2721 array($rec[
"style_id"], $t, $rec[
"class"])
2723 if ($rec4 =
$ilDB->fetchAssoc($set4)) {
2728 "INSERT INTO style_char " .
2729 " (style_id, type, characteristic) VALUES " .
2731 array(
"integer",
"text",
"text"),
2732 array($rec[
"style_id"], $t, $rec[
"class"])
2738 if ($rec[
"type"] ==
"") {
2739 if (count($types) > 0) {
2741 "UPDATE style_parameter SET type = %s " .
2742 " WHERE style_id = %s AND class = %s AND " .
$ilDB->equals(
"type",
"",
"text",
true),
2743 array(
"text",
"integer",
"text"),
2744 array($types[0], $rec[
"style_id"], $rec[
"class"])
2749 if ($types[0] ==
"link") {
2751 "UPDATE style_parameter SET type = %s " .
2752 " WHERE style_id = %s AND (class = %s OR class = %s) AND " .
$ilDB->equals(
"type",
"",
"text",
true),
2753 array(
"text",
"integer",
"text",
"text"),
2754 array($types[0], $rec[
"style_id"], $rec[
"class"] .
":visited",
2755 $rec[
"class"] .
":hover")
2760 if (count($types) == 2) {
2763 $set2 =
$ilDB->queryF(
2764 "SELECT * FROM style_parameter " .
2765 " WHERE style_id = %s AND class = %s AND type = %s",
2766 array(
"integer",
"text",
"text"),
2767 array($rec[
"style_id"], $rec[
"class"], $types[0])
2769 while ($rec2 =
$ilDB->fetchAssoc($set2)) {
2771 $set3 =
$ilDB->queryF(
2772 "SELECT * FROM style_parameter " .
2773 " WHERE style_id = %s AND tag = %s AND class = %s AND type = %s AND parameter = %s",
2774 array(
"integer",
"text",
"text",
"text",
"text"),
2775 array($rec[
"style_id"], $rec[
"tag"], $rec[
"class"], $types[1], $rec[
"parameter"])
2777 if ($rec3 =
$ilDB->fetchAssoc($set3)) {
2780 $nid =
$ilDB->nextId(
"style_parameter");
2782 "INSERT INTO style_parameter " .
2783 " (id, style_id, tag, class, parameter, value, type) VALUES " .
2784 " (%s, %s,%s,%s,%s,%s,%s) ",
2785 array(
"integer",
"integer",
"text",
"text",
"text",
"text",
"text"),
2786 array($nid, $rec2[
"style_id"], $rec2[
"tag"], $rec2[
"class"],
2787 $rec2[
"parameter"], $rec2[
"value"], $types[1])
2803 $classes =
array(
"Example",
"Additional",
"Citation",
"Mnemonic",
"Remark");
2804 $pars =
array(
"margin-top",
"margin-bottom");
2806 foreach ($classes as $curr_class) {
2807 foreach ($pars as $curr_par) {
2808 $res2 =
$ilDB->queryF(
2809 "SELECT id FROM style_parameter WHERE style_id = %s" .
2810 " AND tag = %s AND class= %s AND parameter = %s",
2811 array(
"integer",
"text",
"text",
"text"),
2812 array($a_id,
"p", $curr_class, $curr_par)
2814 if ($row2 =
$ilDB->fetchAssoc($res2)) {
2816 "UPDATE style_parameter SET value= %s WHERE id = %s",
2817 array(
"text",
"integer"),
2818 array(
"10px", $row2[
"id"])
2821 $nid =
$ilDB->nextId(
"style_parameter");
2823 "INSERT INTO style_parameter " .
2824 "(id, style_id, tag, class, parameter,value) VALUES (%s,%s,%s,%s,%s,%s)",
2825 array(
"integer",
"integer",
"text",
"text",
"text",
"text"),
2826 array($nid, $a_id,
"div", $curr_class, $curr_par,
"10px")
2833 "UPDATE style_parameter SET tag = %s WHERE tag = %s and style_id = %s",
2834 array(
"text",
"text",
"integer"),
2835 array(
"div",
"p", $a_id)
2850 $set =
$ilDB->query(
"SELECT * FROM style_color WHERE " .
2851 "style_id = " .
$ilDB->quote($this->getId(),
"integer") .
" " .
2852 "ORDER BY color_name");
2855 while ($rec =
$ilDB->fetchAssoc($set)) {
2857 "name" => $rec[
"color_name"],
2858 "code" => $rec[
"color_code"]
2872 $ilDB->manipulate(
"INSERT INTO style_color (style_id, color_name, color_code)" .
2874 $ilDB->quote($this->getId(),
"integer") .
"," .
2875 $ilDB->quote($a_name,
"text") .
"," .
2876 $ilDB->quote($a_code,
"text") .
2889 $ilDB->manipulate(
"UPDATE style_color SET " .
2890 "color_name = " .
$ilDB->quote($a_new_name,
"text") .
", " .
2891 "color_code = " .
$ilDB->quote($a_code,
"text") .
2892 " WHERE style_id = " .
$ilDB->quote($this->
getId(),
"integer") .
2893 " AND color_name = " .
$ilDB->quote($a_name,
"text"));
2897 if ($a_name != $a_new_name) {
2898 $set =
$ilDB->query(
"SELECT * FROM style_parameter " .
2899 " WHERE style_id = " .
$ilDB->quote($this->getId(),
"integer") .
2901 " parameter = " .
$ilDB->quote(
"background-color",
"text") .
" OR " .
2902 " parameter = " .
$ilDB->quote(
"color",
"text") .
" OR " .
2903 " parameter = " .
$ilDB->quote(
"border-color",
"text") .
" OR " .
2904 " parameter = " .
$ilDB->quote(
"border-top-color",
"text") .
" OR " .
2905 " parameter = " .
$ilDB->quote(
"border-bottom-color",
"text") .
" OR " .
2906 " parameter = " .
$ilDB->quote(
"border-left-color",
"text") .
" OR " .
2907 " parameter = " .
$ilDB->quote(
"border-right-color",
"text") .
2909 while ($rec =
$ilDB->fetchAssoc($set)) {
2910 if ($rec[
"value"] ==
"!" . $a_name ||
2911 is_int(strpos($rec[
"value"],
"!" . $a_name .
"("))) {
2917 str_replace($a_name, $a_new_name, $rec[
"value"]),
2934 $ilDB->manipulate(
"DELETE FROM style_color WHERE " .
2935 " style_id = " .
$ilDB->quote($this->getId(),
"integer") .
" AND " .
2936 " color_name = " .
$ilDB->quote($a_name,
"text"));
2946 $set =
$ilDB->query(
"SELECT * FROM style_color WHERE " .
2947 "style_id = " .
$ilDB->quote($this->getId(),
"integer") .
" AND " .
2948 "color_name = " .
$ilDB->quote($a_color_name,
"text"));
2949 if ($rec =
$ilDB->fetchAssoc($set)) {
2962 $pos = strpos($a_name,
"(");
2964 $a_i = substr($a_name, $pos + 1);
2965 $a_i = str_replace(
")",
"", $a_i);
2966 $a_name = substr($a_name, 0, $pos);
2969 $set =
$ilDB->query(
"SELECT color_code FROM style_color WHERE " .
2970 " style_id = " .
$ilDB->quote($this->getId(),
"integer") .
" AND " .
2971 " color_name = " .
$ilDB->quote($a_name,
"text"));
2972 if ($rec =
$ilDB->fetchAssoc($set)) {
2974 return "#" . $rec[
"color_code"];
2993 $hls[
"l"] = $hls[
"l"] + ((255 - $hls[
"l"]) * ($a_i / 100));
2996 $hls[
"l"] = $hls[
"l"] - (($hls[
"l"]) * (-$a_i / 100));
3001 foreach ($rgb as $k => $v) {
3002 $rgb[$k] = str_pad(dechex($v), 2,
"0", STR_PAD_LEFT);
3005 return $rgb[
"r"] . $rgb[
"g"] . $rgb[
"b"];
3013 $r[
"r"] = substr($a_rgb, 0, 2);
3014 $r[
"g"] = substr($a_rgb, 2, 2);
3015 $r[
"b"] = substr($a_rgb, 4, 2);
3018 $r[
"r"] = (int) hexdec(
$r[
"r"]);
3019 $r[
"g"] = (int) hexdec(
$r[
"g"]);
3020 $r[
"b"] = (int) hexdec(
$r[
"b"]);
3031 $r = $a_rgb[
"r"] / 255;
3032 $g = $a_rgb[
"g"] / 255;
3033 $b = $a_rgb[
"b"] / 255;
3036 $max = max(
$r, $g, $b);
3037 $min = min(
$r, $g, $b);
3040 $l = ($max + $min) / 2;
3047 $s = ($max - $min) / ($max + $min);
3049 $s = ($max - $min) / (2.0 - $max - $min);
3053 $h = ($g - $b) / ($max - $min);
3054 } elseif ($g == $max) {
3055 $h = 2.0 + ($b -
$r) / ($max - $min);
3056 } elseif ($b == $max) {
3057 $h = 4.0 + (
$r - $g) / ($max - $min);
3061 $hls[
"h"] = round((
$h / 6) * 255);
3062 $hls[
"l"] = round(
$l * 255);
3063 $hls[
"s"] = round(
$s * 255);
3073 $h = $a_hls[
"h"] / 255;
3074 $l = $a_hls[
"l"] / 255;
3075 $s = $a_hls[
"s"] / 255;
3077 $rgb[
"r"] = $rgb[
"g"] = $rgb[
"b"] = 0;
3081 $rgb[
"r"] = $rgb[
"g"] = $rgb[
"b"] =
$l;
3084 $temp2 =
$l * (1.0 +
$s);
3089 $temp1 = 2.0 *
$l - $temp2;
3092 # For each of R, G, B, compute another temporary value, temp3, as follows: 3093 foreach ($rgb as $k => $v) {
3096 $temp3 =
$h + 1.0 / 3.0;
3104 $temp3 =
$h - 1.0/3.0;
3108 $temp3 = $temp3 + 1.0;
3111 $temp3 = $temp3 - 1.0;
3114 if (6.0 * $temp3 < 1) {
3115 $rgb[$k] = $temp1 + ($temp2 - $temp1) * 6.0 * $temp3;
3116 } elseif (2.0 * $temp3 < 1) {
3118 } elseif (3.0 * $temp3 < 2) {
3119 $rgb[$k] = $temp1 + ($temp2 - $temp1) * ((2.0/3.0) - $temp3) * 6.0;
3126 $rgb[
"r"] = round($rgb[
"r"] * 255);
3127 $rgb[
"g"] = round($rgb[
"g"] * 255);
3128 $rgb[
"b"] = round($rgb[
"b"] * 255);
3148 $set =
$ilDB->query(
"SELECT * FROM sty_media_query WHERE " .
3149 "style_id = " .
$ilDB->quote($this->getId(),
"integer") .
" " .
3150 "ORDER BY order_nr");
3153 while ($rec =
$ilDB->fetchAssoc($set)) {
3168 $id =
$ilDB->nextId(
"sty_media_query");
3169 if ($order_nr == 0) {
3173 $ilDB->manipulate(
"INSERT INTO sty_media_query (id, style_id, mquery, order_nr)" .
3175 $ilDB->quote(
$id,
"integer") .
"," .
3176 $ilDB->quote($this->
getId(),
"integer") .
"," .
3177 $ilDB->quote($a_mquery,
"text") .
"," .
3178 $ilDB->quote($order_nr,
"integer") .
3192 $set =
$ilDB->query(
3193 "SELECT max(order_nr) mnr FROM sty_media_query " .
3194 " WHERE style_id = " .
$ilDB->quote($this->getId(),
"integer")
3196 $rec =
$ilDB->fetchAssoc($set);
3198 return (
int) $rec[
"mnr"];
3212 "UPDATE sty_media_query SET " .
3213 " mquery = " .
$ilDB->quote($a_mquery,
"text") .
3214 " WHERE id = " .
$ilDB->quote($a_id,
"integer")
3228 $set =
$ilDB->query(
3229 "SELECT * FROM sty_media_query " .
3230 " WHERE id = " .
$ilDB->quote($a_id,
"integer")
3232 return $ilDB->fetchAssoc($set);
3245 "DELETE FROM sty_media_query WHERE " .
3246 " style_id = " .
$ilDB->quote($this->getId(),
"integer") .
3247 " AND id = " .
$ilDB->quote($a_id,
"integer")
3262 if (is_array($a_order_nr)) {
3263 foreach ($mqueries as $k => $mq) {
3264 $mqueries[$k][
"order_nr"] = $a_order_nr[$mq[
"id"]];
3269 foreach ($mqueries as $mq) {
3271 "UPDATE sty_media_query SET " .
3272 " order_nr = " .
$ilDB->quote($cnt,
"integer") .
3273 " WHERE id = " .
$ilDB->quote($mq[
"id"],
"integer")
3291 $set =
$ilDB->query(
"SELECT * FROM style_template WHERE " .
3292 "style_id = " .
$ilDB->quote($this->getId(),
"integer") .
" AND " .
3297 while ($rec =
$ilDB->fetchAssoc($set)) {
3311 $set =
$ilDB->query(
"SELECT * FROM style_template_class WHERE " .
3312 "template_id = " .
$ilDB->quote($a_tid,
"integer"));
3315 while ($rec =
$ilDB->fetchAssoc($set)) {
3316 $key = $rec[
"class_type"];
3317 $class[
$key] = $rec[
"class"];
3331 $tid =
$ilDB->nextId(
"style_template");
3332 $ilDB->manipulate($q =
"INSERT INTO style_template " .
3333 "(id, style_id, name, temp_type)" .
3335 $ilDB->quote($tid,
"integer") .
"," .
3336 $ilDB->quote($this->
getId(),
"integer") .
"," .
3337 $ilDB->quote($a_name,
"text") .
"," .
3341 foreach ($a_classes as
$t => $c) {
3342 $ilDB->manipulate($q =
"INSERT INTO style_template_class " .
3343 "(template_id, class_type, class)" .
3345 $ilDB->quote($tid,
"integer") .
"," .
3346 $ilDB->quote(
$t,
"text") .
"," .
3347 $ilDB->quote($c,
"text") .
3351 include_once(
"./Services/Style/Content/classes/class.ilObjStyleSheetGUI.php");
3367 $ilDB->manipulate(
"UPDATE style_template SET " .
3368 "name = " .
$ilDB->quote($a_name,
"text") .
3369 " WHERE id = " .
$ilDB->quote($a_t_id,
"integer"));
3372 "DELETE FROM style_template_class WHERE " .
3373 "template_id = " .
$ilDB->quote($a_t_id,
"integer")
3375 foreach ($a_classes as
$t => $c) {
3376 $ilDB->manipulate($q =
"INSERT INTO style_template_class " .
3377 "(template_id, class_type, class)" .
3379 $ilDB->quote($a_t_id,
"integer") .
"," .
3380 $ilDB->quote(
$t,
"text") .
"," .
3381 $ilDB->quote($c,
"text") .
3393 $ilDB->manipulate($q =
"INSERT INTO style_template_class " .
3394 "(template_id, class_type, class)" .
3396 $ilDB->quote($a_t_id,
"integer") .
"," .
3398 $ilDB->quote($a_class,
"text") .
3410 $set =
$ilDB->query(
"SELECT * FROM style_template WHERE " .
3411 "style_id = " .
$ilDB->quote($this->getId(),
"integer") .
" AND " .
3412 "name = " .
$ilDB->quote($a_template_name,
"text"));
3413 if ($rec =
$ilDB->fetchAssoc($set)) {
3426 $set =
$ilDB->query(
"SELECT * FROM style_template WHERE " .
3427 "style_id = " .
$ilDB->quote($this->getId(),
"integer") .
" " .
3428 " AND id = " .
$ilDB->quote($a_t_id,
"integer"));
3430 if ($rec =
$ilDB->fetchAssoc($set)) {
3444 return self::_lookupTemplateName($a_t_id);
3454 $ilDB = $DIC->database();
3456 $set =
$ilDB->query(
"SELECT name FROM style_template WHERE " .
3457 " id = " .
$ilDB->quote($a_t_id,
"integer"));
3459 if ($rec =
$ilDB->fetchAssoc($set)) {
3460 return $rec[
"name"];
3473 $tag =
"<StyleTemplates>";
3475 $ttypes =
array(
"table",
"vaccordion",
"haccordion",
"carousel");
3477 foreach ($ttypes as $ttype) {
3480 foreach ($ts as
$t) {
3494 $tag.=
'<StyleTemplate Name="' . $t[
"name"] .
'">';
3496 foreach ($atts as
$type => $t) {
3497 if ($c[
$type] !=
"") {
3498 $tag.=
'<StyleClass Type="' .
$type .
'" Value="' . $c[
$type] .
'" />';
3502 $tag.=
"</StyleTemplate>";
3506 $tag.=
"</StyleTemplates>";
3518 $a_preview_html = str_replace(
' width=""',
"", $a_preview_html);
3519 $a_preview_html = str_replace(
' valign="top"',
"", $a_preview_html);
3520 $a_preview_html = str_replace(
'<div class="ilc_text_block_TableContent">',
"<div>", $a_preview_html);
3523 if (strlen($a_preview_html) > 4000) {
3525 $a_preview_html =
"";
3527 $ilDB->manipulate(
"UPDATE style_template SET " .
3528 "preview = " .
$ilDB->quote($a_preview_html,
"text") .
3529 " WHERE id = " .
$ilDB->quote($a_t_id,
"integer"));
3539 $set =
$ilDB->query(
"SELECT preview FROM style_template " .
3540 " WHERE id = " .
$ilDB->quote($a_t_id,
"integer"));
3541 if ($rec =
$ilDB->fetchAssoc($set)) {
3542 return $rec[
"preview"];
3555 $ilDB = $DIC->database();
3557 $set =
$ilDB->query(
"SELECT id FROM style_template " .
3558 " WHERE style_id = " .
$ilDB->quote($a_style_id,
"integer") .
3559 " AND name = " .
$ilDB->quote($a_name,
"text"));
3560 if ($rec =
$ilDB->fetchAssoc($set)) {
3574 $ilDB->manipulate(
"DELETE FROM style_template WHERE " .
3575 " style_id = " .
$ilDB->quote($this->getId(),
"integer") .
" AND " .
3576 " id = " .
$ilDB->quote($a_t_id,
"integer"));
3579 "DELETE FROM style_template_class WHERE " .
3580 "template_id = " .
$ilDB->quote($a_t_id,
"integer")
3592 "DELETE FROM style_setting WHERE " .
3593 " style_id = " .
$ilDB->quote($this->getId(),
"integer") .
3594 " AND name = " .
$ilDB->quote($a_name,
"text")
3597 $ilDB->manipulate(
"INSERT INTO style_setting " .
3598 "(style_id, name, value) VALUES (" .
3599 $ilDB->quote($this->getId(),
"integer") .
"," .
3600 $ilDB->quote($a_name,
"text") .
"," .
3601 $ilDB->quote($a_value,
"text") .
3612 $set =
$ilDB->query(
3613 "SELECT value FROM style_setting " .
3614 " WHERE style_id = " .
$ilDB->quote($this->getId(),
"integer") .
3615 " AND name = " .
$ilDB->quote($a_name,
"text")
3617 $rec =
$ilDB->fetchAssoc($set);
3619 return $rec[
"value"];
3629 $ilDB = $DIC->database();
3634 "obj_id" =>
array(
"integer", (
int) $a_obj_id)),
3636 "style_id" =>
array(
"integer", (
int) $a_style_id))
3647 $ilDB = $DIC->database();
3649 $set =
$ilDB->query(
3650 "SELECT style_id FROM style_usage " .
3651 " WHERE obj_id = " .
$ilDB->quote($a_obj_id,
"integer")
3653 $rec =
$ilDB->fetchAssoc($set);
3656 return (
int) $rec[
"style_id"];
3669 $ilDB = $DIC->database();
3673 $set =
$ilDB->query(
3674 "SELECT DISTINCT obj_id FROM style_usage " .
3675 " WHERE style_id = " .
$ilDB->quote($a_style_id,
"integer")
3678 while ($rec =
$ilDB->fetchAssoc($set)) {
3679 $obj_ids[] = $rec[
"obj_id"];
static sortArray( $array, $a_array_sortby, $a_array_sortorder=0, $a_numeric=false, $a_keep_keys=false)
sortArray
static _lookupTemplateIdByName($a_style_id, $a_name)
Lookup table template preview.
static _lookupContObjIdByStyleId($a_style_id)
lookup style sheet ID
deleteMediaQuery($a_id)
Delete media query.
getXML()
get xml representation of style object todo: add mq_id
static _explodeRGB($a_rgb, $as_dec=false)
Explode an RGB string into an array.
static _writeScope($a_id, $a_scope)
Write scope.
static _getTemplateClassTypes($a_template_type="")
Get template class types.
static getContentPrintStyle()
get content print style
getHideStatus($a_type, $a_char)
Get characteristic hide status.
removeColor($a_name)
Remove a color.
characteristicExists($a_char, $a_style_type)
Check whether characteristic exists.
static getPlaceHolderStylePath()
get placeholder style path (for Page Layouts)
exportXML($a_dir)
export style xml file to directory
static _HLSToRGB($a_hls)
HLS to RGB (both arrays, 0..255)
static lookupObjectForStyle($a_style_id)
Lookup object style.
static _lookupTemplateName($a_t_id)
Lookup table template name for template ID.
do_3_10_Migration()
Migrates 3.10 style to 3.11 style.
static _getTemplatePreview($a_style, $a_type, $a_t_id, $a_small_mode=false)
Get table template preview.
setCharacteristics($a_chars)
Set characteristics.
getColors()
Get colors of style.
setRefId($a_ref_id)
Set ref id (show error message, since styles do not use ref ids)
static rCopy($a_sdir, $a_tdir, $preserveTimeAttributes=false)
Copies content of a directory $a_sdir recursively to a directory $a_tdir.
read()
read style properties
static _determineTag($a_type)
static _exists($a_id, $a_reference=false, $a_type=null)
checks if an object exists in object_data
deleteParameter($a_id)
delete style parameter
addTemplate($a_type, $a_name, $a_classes)
Add table template.
static $style_super_types
do_3_9_Migration($a_id)
Migrate old 3.9 styles.
getRefId()
Get ref id (show error message, since styles do not use ref ids)
copyImagesToDir($a_target)
Copy images to directory.
setExportSubDir($a_dir)
Set local directory, that will be included within the zip file.
deleteImage($a_file)
Delete an image.
lookupStyleSetting($a_name)
Lookup style setting.
setScope($a_scope)
Set scope.
updateMediaQuery($a_id, $a_mquery)
Update media query.
static unzip($a_file, $overwrite=false, $a_flat=false)
unzip file
static getDir($a_dir, $a_rec=false, $a_sub_dir="")
get directory
static _getStyleSuperTypeForType($a_type)
writeTemplatePreview($a_t_id, $a_preview_html)
Write table template preview.
static _lookupTitle($a_id)
lookup object title
static _getStandardStyles( $a_exclude_default_style=false, $a_include_deactivated=false, $a_scope=0)
Get standard styles.
static _deleteStyleAssignments($a_style_id)
delete all style references to style
deleteStyleParOfChar($a_type, $a_class)
Delete style parameters of characteristic.
copyCharacteristic( $a_from_style_id, $a_from_type, $a_from_char, $a_to_char)
Copy characteristic.
deleteCustomStylePars($a_tag, $a_class, $a_type, $a_mq_id=0)
Delete style parameter by tag/class/parameter.
static _lookupUpToDate($a_id)
Looup up to date.
static _getPseudoClasses($tag)
static _getClonableContentStyles()
Get all clonable styles (active standard styles and individual learning module styles with write perm...
writeCSSFile($a_target_file="", $a_image_dir="")
write css file to webspace directory
static _getStyleSuperTypes()
static lookupObjectStyle($a_obj_id)
Lookup object style.
& getMetaData()
get meta data object
createExportSubDirectory()
Create export directory.
static _getAllReferences($a_id)
get all reference ids of object
lookupTemplateName($a_t_id)
Lookup table template name for template ID.
do_3_10_CharMigration($a_id="")
This is more or less a copy of Services/Migration/DBUpdate_1385/classes ilStyleMigration->addMissingS...
getThumbnailsDirectory()
Get thumbnails directory.
static _lookupStandard($a_id)
Lookup standard flag.
handleXmlString($a_str)
Handle xml strin.
static writeStyleUsage($a_obj_id, $a_style_id)
Write style usage.
static _writeActive($a_id, $a_active)
Write active flag.
addColor($a_name, $a_code)
Add color.
getTemplate($a_t_id)
Get template.
addTemplateClass($a_t_id, $a_type, $a_class)
Update table template.
static _getBasicStyleDom()
Get basic style dom.
getImagesDirectory()
Get images directory.
templateExists($a_template_name)
Check whether template exists.
static resizeImage($a_from, $a_to, $a_width, $a_height, $a_constrain_prop=false)
resize image
foreach($_POST as $key=> $value) $res
static _addMissingStyleClassesToAllStyles($a_styles="")
Add missing style classes to all styles todo: add mq_id and custom handling.
getId()
get object id public
static _isExpandable($a_type)
writeStyleSetting($a_name, $a_value)
Write Style Setting.
static _getFilteredGroups()
getTemplateXML()
Get table template xml.
static _getCoreStyles()
Get core styles.
static getEffectiveContentStyleId($a_style_id, $a_type="")
Get effective Style Id.
getTitle()
get object title public
uploadImage($a_file)
Upload image.
getDescription()
get object description
addParameter($a_tag, $a_par, $a_type, $a_mq_id=0, $a_custom=false)
write style parameter to db
redirection script todo: (a better solution should control the processing via a xml file) ...
setUpToDate($a_up_to_date=true)
Set style up to date (false + update will trigger css generation next time)
saveHideStatus($a_type, $a_char, $a_hide)
Save characteristic hide status.
setStyle($a_style)
set styles
static getSyntaxStylePath()
get syntax style path
static signFile($path_to_file)
static getContentStylePath($a_style_id, $add_random=true)
get content style path
getParametersOfClass($a_type, $a_class, $a_mq_id=0)
Get parameters of class.
static $basic_style_image_dir
static zip($a_dir, $a_file, $compress_content=false)
zips given directory/file into given zip.file
getType()
get object type public
getCharacteristics($a_type="", $a_no_hidden=false, $a_include_core=true)
Get characteristics.
getStyleParameterGroups()
Get grouped parameter.
Create styles array
The data for the language used.
static _lookupType($a_id, $a_reference=false)
lookup object type
__construct($a_id=0, $a_call_by_reference=false)
Constructor public.
export()
Create export file.
getTemplates($a_type)
Get table templates of style.
static makeDir($a_dir)
creates a new directory and inherits all filesystem permissions of the parent directory You may pass ...
deleteStylePar($a_tag, $a_class, $a_par, $a_type, $a_mq_id=0, $a_custom=false)
Delete style parameter by tag/class/parameter.
static _getColorFlavor($a_rgb, $a_i)
Get color flavor.
determineTemplateStyleClassType($t, $k)
updateColor($a_name, $a_new_name, $a_code)
Update color.
static _createImagesDirectory($a_style_id)
Create images directory <data_dir>/sty/sty_<id>/images.
createExportDirectory()
Create export directory.
update($pash, $contents, Config $config)
getStyle()
todo: bad style! should return array of objects, not multi-dim-arrays
updateStyleParameter($a_id, $a_value)
update style parameter per id
static _addMissingStyleClassesToStyle($a_id)
Add missing style classes to all styles.
createReference()
Create a reference (show error message, since styles do not use ref ids)
static _getImagesDirectory($a_style_id)
Get images directory.
addCharacteristic($a_type, $a_char, $a_hidden=false)
Add characteristic.
static _RGBToHLS($a_rgb)
RGB to HLS (both arrays, 0..255)
getTemplateClasses($a_tid)
Get template classes.
static _getStyleParameterValues($par)
getMaxMQueryOrderNr()
Get maximum media query order nr.
static _writeStandard($a_id, $a_std)
Write standard flag.
replaceStylePar($a_tag, $a_class, $a_par, $a_val, $a_type, $a_mq_id=0, $a_custom=false)
Set style parameter per tag/class/parameter.
static getDataDir()
get data directory (outside webspace)
colorExists($a_color_name)
Check whether color exists.
deleteCharacteristic($a_type, $a_tag, $a_class)
Delete Characteristic.
static _getStyleParameterNumericUnits($a_no_percentage=false)
create($a_from_style=0, $a_import_mode=false)
Create a new style.
getExportSubDir()
The local directory, that will be included within the zip file.
createImportDirectory()
Create import directory.
getColorCodeForName($a_name)
Remove a color.
updateTemplate($a_t_id, $a_name, $a_classes)
Update table template.
static _getStyleParameters($a_tag="")
removeTemplate($a_t_id)
Remove table template.
static isCoreStyle($a_type, $a_class)
Is core style.
saveMediaQueryOrder($a_order_nr=null)
Save media query order.
static _isHideable($a_type)
assignMetaData(&$a_meta_data)
assign meta data object
cleanExportDirectory()
Clear export directory.
getImages()
Get images of style.
if(!file_exists("$old.txt")) if($old===$new) if(file_exists("$new.txt")) $file
createFromXMLFile($a_file, $a_skip_parent_create=false)
create style from xml file todo: add mq_id and custom
static _lookupActive($a_id)
Lookup active flag.
static _getStyleParameterInputType($par)
addMediaQuery($a_mquery, $order_nr=0)
Add media query.
static delDir($a_dir, $a_clean_only=false)
removes a dir and all its content (subdirs and files) recursively
static getWebspaceDir($mode="filesystem")
get webspace directory
static _getObjectsDataForType($a_type, $a_omit_trash=false)
get all objects of a certain type
static _replaceStylePar($style_id, $a_tag, $a_class, $a_par, $a_val, $a_type, $a_mq_id=0, $a_custom=false)
static _getStyleParameterSubPar($par)
createImagesDirectory()
Create images directory <data_dir>/sty/sty_<id>/images.
if(function_exists('posix_getuid') &&posix_getuid()===0) if(!array_key_exists('t', $options)) $tag
getMediaQueries()
Get colors of style.
ilClone()
clone style sheet (note: styles have no ref ids and return an object id)
getMediaQueryForId($a_id)
Get media query for id.
static getAvailableParameters()
Get available parameters.
static _writeUpToDate($a_id, $a_up_to_date)
Write up to date.
lookupTemplatePreview($a_t_id)
Lookup table template preview.
putInTree($a_parent_ref)
Put in tree (show error message, since styles do not use ref ids)
getUpToDate()
Get up to date.