19 declare(strict_types=1);
31 protected \ILIAS\Style\Content\InternalRepoService
$repo;
44 public static array
$num_unit = array(
"px",
"em",
"rem",
"ex",
"%",
"pt",
"pc",
"in",
"mm",
"cm");
45 public static array
$num_unit_no_perc = array(
"px",
"em",
"rem",
"ex",
"pt",
"pc",
"in",
"mm",
"cm");
50 "values" => array(
"xx-small",
"x-small",
"small",
"medium",
"large",
"x-large",
"xx-large",
"smaller",
"larger"),
51 "input" =>
"fontsize",
53 "font-family" => array(
57 "font-style" => array(
58 "values" => array(
"italic",
"oblique",
"normal"),
61 "font-weight" => array(
62 "values" => array(
"bold",
"normal",
"bolder",
"lighter"),
65 "font-variant" => array(
66 "values" => array(
"small-caps",
"normal"),
69 "word-spacing" => array(
71 "input" =>
"numeric_no_perc",
73 "letter-spacing" => array(
75 "input" =>
"numeric_no_perc",
77 "text-decoration" => array(
78 "values" => array(
"underline",
"overline",
"line-through",
"blink",
"none"),
81 "text-transform" => array(
82 "values" => array(
"capitalize",
"uppercase",
"lowercase",
"none"),
89 "text-indent" => array(
93 "line-height" => array(
97 "vertical-align" => array(
98 "values" => array(
"top",
"middle",
"bottom",
"baseline",
"sub",
"super",
99 "text-top",
"text-bottom"),
102 "text-align" => array(
103 "values" => array(
"left",
"center",
"right",
"justify"),
106 "white-space" => array(
107 "values" => array(
"normal",
"pre",
"nowrap"),
112 "input" =>
"trbl_numeric",
113 "subpar" => array(
"margin",
"margin-top",
"margin-right",
114 "margin-bottom",
"margin-left"),
115 "group" =>
"margin_and_padding"),
118 "input" =>
"trbl_numeric",
119 "subpar" => array(
"padding",
"padding-top",
"padding-right",
120 "padding-bottom",
"padding-left"),
121 "group" =>
"margin_and_padding"),
122 "border-width" => array(
123 "values" => array(
"thin",
"medium",
"thick"),
124 "input" =>
"border_width",
125 "subpar" => array(
"border-width",
"border-top-width",
"border-right-width",
126 "border-bottom-width",
"border-left-width"),
127 "group" =>
"border"),
128 "border-color" => array(
130 "input" =>
"trbl_color",
131 "subpar" => array(
"border-color",
"border-top-color",
"border-right-color",
132 "border-bottom-color",
"border-left-color"),
133 "group" =>
"border"),
134 "border-style" => array(
135 "values" => array(
"none",
"hidden",
"dotted",
"dashed",
"solid",
"double",
136 "groove",
"ridge",
"inset",
"outset"),
137 "input" =>
"border_style",
138 "subpar" => array(
"border-style",
"border-top-style",
"border-right-style",
139 "border-bottom-style",
"border-left-style"),
140 "group" =>
"border"),
142 "background-color" => array(
145 "group" =>
"background"),
146 "background-image" => array(
148 "input" =>
"background_image",
149 "group" =>
"background"),
150 "background-repeat" => array(
151 "values" => array(
"repeat",
"repeat-x",
"repeat-y",
"no-repeat"),
153 "group" =>
"background"),
154 "background-attachment" => array(
155 "values" => array(
"fixed",
"scroll"),
157 "group" =>
"background"),
158 "background-position" => array(
159 "values" => array(
"horizontal" => array(
"left",
"center",
"right"),
160 "vertical" => array(
"top",
"center",
"bottom")),
161 "input" =>
"background_position",
162 "group" =>
"background"),
165 "values" => array(
"absolute",
"fixed",
"relative",
"static"),
167 "group" =>
"positioning"),
170 "input" =>
"numeric",
171 "group" =>
"positioning"),
174 "input" =>
"numeric",
175 "group" =>
"positioning"),
178 "input" =>
"numeric",
179 "group" =>
"positioning"),
182 "input" =>
"numeric",
183 "group" =>
"positioning"),
186 "input" =>
"numeric",
187 "group" =>
"positioning"),
190 "input" =>
"numeric",
191 "group" =>
"positioning"),
192 "min-height" => array(
194 "input" =>
"numeric",
195 "group" =>
"positioning"),
197 "values" => array(
"left",
"right",
"none"),
199 "group" =>
"positioning"),
201 "values" => array(
"visible",
"hidden",
"scroll",
"auto"),
203 "group" =>
"positioning"),
206 "input" =>
"percentage",
207 "group" =>
"special"),
208 "transform" => array(
209 "values" => array(
"rotate(90deg)",
"rotate(180deg)",
"rotate(270deg)"),
211 "group" =>
"special"),
212 "transform-origin" => array(
213 "values" => array(
"horizontal" => array(
"left",
"center",
"right"),
214 "vertical" => array(
"top",
"center",
"bottom")),
215 "input" =>
"background_position",
216 "group" =>
"special"),
218 "values" => array(
"auto",
"default",
"crosshair",
"pointer",
"move",
219 "n-resize",
"ne-resize",
"e-resize",
"se-resize",
"s-resize",
"sw-resize",
220 "w-resize",
"nw-resize",
"text",
"wait",
"help"),
222 "group" =>
"special"),
224 "values" => array(
"both",
"left",
"right",
"none"),
226 "group" =>
"special"),
228 "list-style-type.ol" => array(
229 "values" => array(
"decimal",
"lower-roman",
"upper-roman",
230 "lower-alpha",
"upper-alpha",
"lower-greek",
"hebrew",
231 "decimal-leading-zero",
"cjk-ideographic",
"hiragana",
232 "katakana",
"hiragana-iroha",
"katakana-iroha",
"none"),
235 "list-style-type.ul" => array(
236 "values" => array(
"disc",
"circle",
"square",
240 "list-style-image.ul" => array(
242 "input" =>
"background_image",
244 "list-style-position.ol" => array(
245 "values" => array(
"inside",
"outside"),
248 "list-style-position.ul" => array(
249 "values" => array(
"inside",
"outside"),
253 "border-collapse" => array(
254 "values" => array(
"collapse",
"separate"),
258 "caption-side" => array(
259 "values" => array(
"top",
"bottom",
"left",
"right"),
268 array(
"ol" => array(
"ol"),
"ul" => array(
"ul"),
269 "table" => array(
"table"),
"positioning" => array(
"h1",
"h2",
"h3",
"div",
"img",
"table",
"a",
"figure",
"li",
"p"));
273 "text_block" => array(
"text_block",
"heading1",
"heading2",
"heading3",
"code_block"),
274 "text_inline" => array(
"text_inline",
"sub",
"sup",
"code_inline",
"strong",
"em"),
275 "section" => array(
"section"),
276 "link" => array(
"link"),
277 "table" => array(
"table",
"table_cell",
"table_caption"),
278 "list" => array(
"list_o",
"list_u",
"list_item"),
279 "flist" => array(
"flist_cont",
"flist_head",
"flist",
"flist_li",
"flist_a"),
280 "media" => array(
"media_cont",
"media_caption",
"iim",
"marker"),
281 "tabs" => array(
"va_cntr",
"va_icntr",
"va_ihead",
"va_iheada",
"va_ihcap",
"va_icont",
282 "ha_cntr",
"ha_icntr",
"ha_ihead",
"ha_iheada",
"ha_ihcap",
"ha_icont",
"ca_cntr",
"ca_icntr",
"ca_ihead",
"ca_icont"),
283 "question" => array(
"question",
"qtitle",
"qanswer",
"qinput",
"qlinput",
"qsubmit",
"qfeedr",
"qfeedw",
284 "qimg",
"qordul",
"qordli",
"qimgd",
"qetitem",
"qetcorr",
"qover"),
285 "page" => array(
"page_cont",
"page_title",
"page_fn")
291 "text_inline",
"section",
"media_cont",
"media_caption",
"table",
"table_cell",
"flist_li",
"table_caption",
292 "list_o",
"list_u",
"list_item",
293 "va_cntr",
"va_icntr",
"va_ihead",
"va_iheada",
"va_ihcap",
"va_icont",
294 "ha_cntr",
"ha_icntr",
"ha_ihead",
"ha_iheada",
"ha_ihcap",
"ha_icont",
295 "ca_cntr",
"ca_icntr",
"ca_ihead",
"ca_icont" 300 "table",
"table_cell" 309 "code_block" =>
"pre",
311 "text_inline" =>
"span",
312 "code_inline" =>
"code",
315 "strong" =>
"strong",
319 "table_cell" =>
"td",
320 "table_caption" =>
"caption",
321 "media_cont" =>
"figure",
322 "media_caption" =>
"div",
328 "flist_cont" =>
"div",
329 "flist_head" =>
"div",
343 "qlinput" =>
"textarea",
344 "qsubmit" =>
"input",
348 "page_cont" =>
"div",
351 "page_title" =>
"h1",
356 "va_iheada" =>
"div",
361 "ha_iheada" =>
"div",
374 "div" => [
"hover",
"before"],
381 array(
"type" =>
"text_block",
"class" =>
"Standard"),
382 array(
"type" =>
"text_block",
"class" =>
"List"),
383 array(
"type" =>
"text_block",
"class" =>
"TableContent"),
384 array(
"type" =>
"code_block",
"class" =>
"Code"),
385 array(
"type" =>
"heading1",
"class" =>
"Headline1"),
386 array(
"type" =>
"heading2",
"class" =>
"Headline2"),
387 array(
"type" =>
"heading3",
"class" =>
"Headline3"),
388 array(
"type" =>
"text_inline",
"class" =>
"Comment"),
389 array(
"type" =>
"em",
"class" =>
"Emph"),
390 array(
"type" =>
"text_inline",
"class" =>
"Quotation"),
391 array(
"type" =>
"strong",
"class" =>
"Strong"),
392 array(
"type" =>
"text_inline",
"class" =>
"Accent"),
393 array(
"type" =>
"text_inline",
"class" =>
"Important"),
394 array(
"type" =>
"code_inline",
"class" =>
"CodeInline"),
395 array(
"type" =>
"sup",
"class" =>
"Sup"),
396 array(
"type" =>
"sub",
"class" =>
"Sub"),
397 array(
"type" =>
"link",
"class" =>
"IntLink"),
398 array(
"type" =>
"link",
"class" =>
"ExtLink"),
399 array(
"type" =>
"link",
"class" =>
"FootnoteLink"),
400 array(
"type" =>
"link",
"class" =>
"FileLink"),
401 array(
"type" =>
"link",
"class" =>
"GlossaryLink"),
402 array(
"type" =>
"media_cont",
"class" =>
"MediaContainer"),
403 array(
"type" =>
"media_cont",
"class" =>
"MediaContainerMax50"),
404 array(
"type" =>
"media_cont",
"class" =>
"MediaContainerFull100"),
405 array(
"type" =>
"table",
"class" =>
"StandardTable"),
406 array(
"type" =>
"media_caption",
"class" =>
"MediaCaption"),
407 array(
"type" =>
"iim",
"class" =>
"ContentPopup"),
408 array(
"type" =>
"marker",
"class" =>
"Marker"),
409 array(
"type" =>
"page_cont",
"class" =>
"PageContainer"),
410 array(
"type" =>
"page",
"class" =>
"Page"),
411 array(
"type" =>
"page_fn",
"class" =>
"Footnote"),
412 array(
"type" =>
"page_title",
"class" =>
"PageTitle"),
413 array(
"type" =>
"list_o",
"class" =>
"NumberedList"),
414 array(
"type" =>
"list_u",
"class" =>
"BulletedList"),
415 array(
"type" =>
"list_item",
"class" =>
"StandardListItem"),
416 array(
"type" =>
"question",
"class" =>
"Standard"),
417 array(
"type" =>
"question",
"class" =>
"SingleChoice"),
418 array(
"type" =>
"question",
"class" =>
"MultipleChoice"),
419 array(
"type" =>
"question",
"class" =>
"TextQuestion"),
420 array(
"type" =>
"question",
"class" =>
"OrderingQuestion"),
421 array(
"type" =>
"question",
"class" =>
"MatchingQuestion"),
422 array(
"type" =>
"question",
"class" =>
"ImagemapQuestion"),
423 array(
"type" =>
"question",
"class" =>
"ErrorText"),
424 array(
"type" =>
"question",
"class" =>
"TextSubset"),
425 array(
"type" =>
"question",
"class" =>
"ClozeTest"),
426 array(
"type" =>
"qtitle",
"class" =>
"Title"),
427 array(
"type" =>
"qanswer",
"class" =>
"Answer"),
428 array(
"type" =>
"qimg",
"class" =>
"QuestionImage"),
429 array(
"type" =>
"qimgd",
"class" =>
"ImageDetailsLink"),
430 array(
"type" =>
"qordul",
"class" =>
"OrderList"),
431 array(
"type" =>
"qordli",
"class" =>
"OrderListItem"),
432 array(
"type" =>
"qordul",
"class" =>
"OrderListHorizontal"),
433 array(
"type" =>
"qordli",
"class" =>
"OrderListItemHorizontal"),
434 array(
"type" =>
"qetitem",
"class" =>
"ErrorTextItem"),
435 array(
"type" =>
"qetitem",
"class" =>
"ErrorTextSelected"),
436 array(
"type" =>
"qetcorr",
"class" =>
"ErrorTextCorrected"),
437 array(
"type" =>
"qinput",
"class" =>
"TextInput"),
438 array(
"type" =>
"qlinput",
"class" =>
"LongTextInput"),
439 array(
"type" =>
"qsubmit",
"class" =>
"Submit"),
440 array(
"type" =>
"qfeedr",
"class" =>
"FeedbackRight"),
441 array(
"type" =>
"qfeedw",
"class" =>
"FeedbackWrong"),
442 array(
"type" =>
"qover",
"class" =>
"Correct"),
443 array(
"type" =>
"qover",
"class" =>
"Inorrect"),
444 array(
"type" =>
"qover",
"class" =>
"StatusMessage"),
445 array(
"type" =>
"qover",
"class" =>
"WrongAnswersMessage"),
446 array(
"type" =>
"flist_cont",
"class" =>
"FileListContainer"),
447 array(
"type" =>
"flist_head",
"class" =>
"FileListHeading"),
448 array(
"type" =>
"flist",
"class" =>
"FileList"),
449 array(
"type" =>
"flist_li",
"class" =>
"FileListItem"),
450 array(
"type" =>
"flist_a",
"class" =>
"FileListItemLink")
456 "caption" =>
"table_caption",
457 "row_head" =>
"table_cell",
458 "row_foot" =>
"table_cell",
459 "col_head" =>
"table_cell",
460 "col_foot" =>
"table_cell",
461 "odd_row" =>
"table_cell",
462 "even_row" =>
"table_cell",
463 "odd_col" =>
"table_cell",
464 "even_col" =>
"table_cell"),
465 "vaccordion" => array(
466 "va_cntr" =>
"va_cntr",
467 "va_icntr" =>
"va_icntr",
468 "va_ihead" =>
"va_ihead",
469 "va_iheada" =>
"va_iheada",
470 "va_ihcap" =>
"va_ihcap",
471 "va_icont" =>
"va_icont" 473 "haccordion" => array(
474 "ha_cntr" =>
"ha_cntr",
475 "ha_icntr" =>
"ha_icntr",
476 "ha_ihead" =>
"ha_ihead",
477 "ha_iheada" =>
"ha_iheada",
478 "ha_ihcap" =>
"ha_ihcap",
479 "ha_icont" =>
"ha_icont" 482 "ca_cntr" =>
"ca_cntr",
483 "ca_icntr" =>
"ca_icntr",
484 "ca_ihead" =>
"ca_ihead",
485 "ca_icont" =>
"ca_icont" 497 bool $a_call_by_reference =
false 501 $this->db = $DIC->database();
502 $this->
lng = $DIC->language();
504 $this->style = array();
505 $this->
ilias = $DIC[
"ilias"];
506 $this->domain = $DIC->contentStyle()->internal()->domain();
508 if ($a_call_by_reference) {
509 $this->
ilias->raiseError(
"Can't instantiate style object via reference id.", $this->
ilias->error_obj->FATAL);
512 $this->repo = $DIC->contentStyle()->internal()->repo();
517 return self::$basic_style_zip;
525 $this->up_to_date = $a_up_to_date;
535 $this->scope = $a_scope;
549 $ilDB = $DIC->database();
551 $q =
"UPDATE style_data SET uptodate = " .
552 $ilDB->quote((
int) $a_up_to_date,
"integer") .
553 " WHERE id = " .
$ilDB->quote($a_id,
"integer");
560 $ilDB = $DIC->database();
562 $q =
"UPDATE style_data SET owner_obj = " .
563 $ilDB->quote((
int) $obj_id,
"integer") .
564 " WHERE id = " .
$ilDB->quote($style_id,
"integer");
572 $ilDB = $DIC->database();
574 $q =
"SELECT uptodate FROM style_data " .
575 " WHERE id = " .
$ilDB->quote($a_id,
"integer");
579 return (
bool) $sty[
"uptodate"];
591 $ilDB = $DIC->database();
593 $q =
"UPDATE style_data SET standard = " .
594 $ilDB->quote((
int) $a_std,
"integer") .
595 " WHERE id = " .
$ilDB->quote($a_id,
"integer");
603 $ilDB = $DIC->database();
605 $q =
"UPDATE style_data SET category = " .
606 $ilDB->quote($a_scope,
"integer") .
607 " WHERE id = " .
$ilDB->quote($a_id,
"integer");
618 $ilDB = $DIC->database();
620 $q =
"SELECT * FROM style_data " .
621 " WHERE id = " .
$ilDB->quote($a_id,
"integer");
625 return (
bool) ($sty[
"standard"] ??
false);
632 $ilDB = $DIC->database();
634 $q =
"UPDATE style_data SET active = " .
635 $ilDB->quote((
int) $a_active,
"integer") .
636 " WHERE id = " .
$ilDB->quote($a_id,
"integer");
647 $ilDB = $DIC->database();
649 $q =
"SELECT * FROM style_data " .
650 " WHERE id = " .
$ilDB->quote($a_id,
"integer");
654 return (
bool) $sty[
"active"];
662 bool $a_exclude_default_style =
false,
663 bool $a_include_deactivated =
false,
668 $ilDB = $DIC->database();
670 $tree = $DIC->repositoryTree();
672 $default_style =
$ilSetting->get(
"default_content_style_id");
675 if (!$a_include_deactivated) {
676 $and_str =
" AND active = 1";
679 $q =
"SELECT * FROM style_data " .
680 " WHERE standard = 1" . $and_str;
684 if (!$a_exclude_default_style || $default_style != $sty[
"id"]) {
686 if ($a_scope > 0 && $sty[
"category"] > 0) {
690 if (!in_array((
int) $sty[
"category"],
$path)) {
712 $ilAccess = $DIC->access();
713 $ilDB = $DIC->database();
715 $clonable_styles = array();
717 $q =
"SELECT * FROM style_data";
719 while ($style_rec =
$ilDB->fetchAssoc($style_set)) {
721 if ($style_rec[
"standard"] == 1) {
722 if ($style_rec[
"active"] == 1) {
727 if (count($obj_ids) == 0) {
728 $obj_ids = self::lookupObjectForStyle((
int) $style_rec[
"id"]);
730 foreach ($obj_ids as
$id) {
733 if ($ilAccess->checkAccess(
"write",
"", $ref_id)) {
740 $clonable_styles[(
int) $style_rec[
"id"]] =
745 asort($clonable_styles);
747 return $clonable_styles;
752 if (!is_object(self::$basic_style_dom)) {
754 self::$basic_style_dom->load(self::$basic_style_file);
757 return self::$basic_style_dom;
762 return self::$basic_style_image_dir;
770 int $a_from_style = 0,
771 bool $a_import_mode =
false 777 $id = parent::create();
781 $access_manager =
$service->domain()->access(
783 $DIC->user()->getId()
785 $access_manager->enableWrite(
true);
786 $color_manager =
$service->domain()->color($this->
getId(), $access_manager);
788 if ($a_from_style == 0) {
789 if (!$a_import_mode) {
790 throw new Exception(
"Can't create style without a from style in non-import mode.");
793 $q =
"INSERT INTO style_data (id, uptodate, category) VALUES " .
794 "(" .
$ilDB->quote($this->
getId(),
"integer") .
", 0," .
801 $q =
"SELECT * FROM style_parameter WHERE style_id = " .
802 $ilDB->quote($a_from_style,
"integer");
804 while ($par_rec =
$ilDB->fetchAssoc($par_set)) {
805 $def[] = array(
"tag" => $par_rec[
"tag"],
"class" => $par_rec[
"class"],
806 "parameter" => $par_rec[
"parameter"],
"value" => $par_rec[
"value"],
807 "type" => $par_rec[
"type"],
"mq_id" => $par_rec[
"mq_id"],
"custom" => $par_rec[
"custom"]);
810 $char_repo = $this->repo->characteristic();
811 $char_repo->cloneAllFromStyle($a_from_style, $this->
getId());
816 $mqs = $from_style->getMediaQueries();
817 $mq_mapping = array();
818 foreach ($mqs as $mq) {
820 $mq_mapping[$mq[
"id"]] = $nid;
824 foreach ($def as $sty) {
825 $id =
$ilDB->nextId(
"style_parameter");
826 $q =
"INSERT INTO style_parameter (id, style_id, tag, class, parameter, value, type, mq_id, custom) VALUES " .
828 $ilDB->quote(
$id,
"integer") .
"," .
829 $ilDB->quote($this->
getId(),
"integer") .
"," .
830 $ilDB->quote($sty[
"tag"],
"text") .
"," .
831 $ilDB->quote($sty[
"class"],
"text") .
"," .
832 $ilDB->quote($sty[
"parameter"],
"text") .
"," .
833 $ilDB->quote($sty[
"value"],
"text") .
"," .
834 $ilDB->quote($sty[
"type"],
"text") .
"," .
835 $ilDB->quote((
int) ($mq_mapping[$sty[
"mq_id"]] ?? 0),
"integer") .
"," .
836 $ilDB->quote($sty[
"custom"],
"integer") .
842 $q =
"INSERT INTO style_data (id, uptodate, category) VALUES " .
843 "(" .
$ilDB->quote($this->
getId(),
"integer") .
", 0," .
848 $this->domain->style($this->
getId())->cloneResourceContainer($from_style->getId());
850 $colors = $from_style->getColors();
851 foreach ($colors as
$c) {
852 $color_manager->addColor($c[
"name"], $c[
"code"]);
857 foreach ($tcts as $tct => $v) {
858 $templates = $from_style->getTemplates($tct);
859 foreach ($templates as $t) {
860 $this->
addTemplate($tct, $t[
"name"], $t[
"classes"]);
866 if (!$a_import_mode) {
882 $set =
$ilDB->queryF(
883 "SELECT style_id FROM style_char WHERE style_id = %s AND characteristic = %s AND type = %s",
884 array(
"integer",
"text",
"text"),
885 array($this->
getId(), $a_char, $a_style_type)
887 if (
$ilDB->fetchAssoc($set)) {
896 bool $a_hidden =
false,
898 bool $outdated =
false 903 $ilDB->insert(
"style_char", [
904 "style_id" => [
"integer", $this->
getId()],
905 "type" => [
"text", $a_type],
906 "characteristic" => [
"text", $a_char],
907 "hide" => [
"integer", (
int) $a_hidden],
908 "outdated" => [
"integer", (
int) $outdated],
909 "order_nr" => [
"integer", $order_nr]
921 bool $a_no_hidden =
false,
922 bool $a_include_core =
true 929 if (isset($this->chars_by_type[$a_type])) {
930 foreach ($this->chars_by_type[$a_type] as
$c) {
931 if ($a_include_core || !self::isCoreStyle($a_type, $c)) {
938 foreach ($chars as $k => $char) {
939 if ($a_type ==
"" && $this->hidden_chars[$char[
"type"] .
":" . $char[
"class"]]) {
941 } elseif ($this->hidden_chars[$a_type .
":" . $char] ??
false) {
952 $this->chars = $a_chars;
966 "UPDATE style_char SET " .
967 " hide = " .
$ilDB->quote((
int) $a_hide,
"integer") .
968 " WHERE style_id = " .
$ilDB->quote($this->
getId(),
"integer") .
" AND " .
969 " type = " .
$ilDB->quote($a_type,
"text") .
" AND " .
970 " characteristic = " .
$ilDB->quote($a_char,
"text")
984 "SELECT hide FROM style_char " .
985 " WHERE style_id = " .
$ilDB->quote($this->getId(),
"integer") .
" AND " .
986 " type = " .
$ilDB->quote($a_type,
"text") .
" AND " .
987 " characteristic = " .
$ilDB->quote($a_char,
"text")
989 $rec =
$ilDB->fetchAssoc($set);
991 return (
bool) ($rec[
"hide"] ??
false);
1004 $new_obj->setTitle($this->
getTitle() .
" (" .
$lng->
txt(
"sty_acopy") .
")");
1005 $new_obj->setType($this->
getType());
1007 $new_obj->create($this->
getId());
1009 $new_obj->writeStyleSetting(
1010 "disable_auto_margins",
1014 return $new_obj->getId();
1039 bool $a_custom =
false 1044 $tag = explode(
".", $a_tag);
1045 $value = $avail_params[$a_par][0];
1046 $id =
$ilDB->nextId(
"style_parameter");
1047 $q =
"INSERT INTO style_parameter (id,style_id, type, tag, class, parameter, value, mq_id, custom) VALUES " .
1049 $ilDB->quote(
$id,
"integer") .
"," .
1050 $ilDB->quote($this->
getId(),
"integer") .
"," .
1051 $ilDB->quote($a_type,
"text") .
"," .
1052 $ilDB->quote($tag[0],
"text") .
"," .
1053 $ilDB->quote($tag[1],
"text") .
"," .
1054 $ilDB->quote($a_par,
"text") .
"," .
1055 $ilDB->quote($value,
"text") .
"," .
1056 $ilDB->quote($a_mq_id,
"integer") .
"," .
1057 $ilDB->quote($a_custom,
"integer") .
1085 if (!is_dir($sty_data_dir)) {
1088 if (!is_writable($sty_data_dir)) {
1089 $ilErr->raiseError(
"Style data directory (" . $sty_data_dir
1090 .
") not writeable.",
$ilErr->FATAL);
1093 $style_dir = $sty_data_dir .
"/sty_" . $a_style_id;
1094 if (!is_dir($style_dir)) {
1097 if (!is_dir($style_dir)) {
1098 $ilErr->raiseError(
"Creation of style directory failed (" .
1099 $style_dir .
").",
$ilErr->FATAL);
1103 $im_dir = $style_dir .
"/images";
1104 if (!is_dir($im_dir)) {
1107 if (!is_dir($im_dir)) {
1108 $ilErr->raiseError(
"Creation of Import Directory failed (" .
1109 $im_dir .
").",
$ilErr->FATAL);
1113 $thumb_dir = $style_dir .
"/images/thumbnails";
1115 if (!is_dir($thumb_dir)) {
1116 $ilErr->raiseError(
"Creation of Import Directory failed (" .
1117 $thumb_dir .
").",
$ilErr->FATAL);
1145 $q =
"DELETE FROM style_parameter WHERE id = " .
1146 $ilDB->quote($a_id,
"integer");
1166 $q =
"DELETE FROM style_parameter WHERE " .
1167 " style_id = " .
$ilDB->quote($this->
getId(),
"integer") .
" AND " .
1168 " tag = " .
$ilDB->quote($a_tag,
"text") .
" AND " .
1169 " class = " .
$ilDB->quote($a_class,
"text") .
" AND " .
1170 " mq_id = " .
$ilDB->quote($a_mq_id,
"integer") .
" AND " .
1171 " custom = " .
$ilDB->quote(1,
"integer") .
" AND " .
1172 " " .
$ilDB->equals(
"type", $a_type,
"text",
true);
1186 $q =
"DELETE FROM style_parameter WHERE " .
1187 " style_id = " .
$ilDB->quote($this->
getId(),
"integer") .
" AND " .
1188 " class = " .
$ilDB->quote($a_class,
"text") .
" AND " .
1189 " " .
$ilDB->equals(
"type", $a_type,
"text",
true);
1195 public function delete():
bool 1203 $def_style = $this->
ilias->getSetting(
"default_content_style_id");
1204 if ($def_style == $this->
getId()) {
1205 $this->
ilias->deleteSetting(
"default_content_style_id");
1209 $fixed_style = $this->
ilias->getSetting(
"fixed_content_style_id");
1210 if ($fixed_style == $this->
getId()) {
1211 $this->
ilias->deleteSetting(
"fixed_content_style_id");
1215 $q =
"DELETE FROM style_parameter WHERE style_id = " .
1221 if (is_file($css_file_name)) {
1222 unlink($css_file_name);
1227 "DELETE FROM sty_media_query WHERE " .
1228 " style_id = " .
$ilDB->quote($this->getId(),
"integer")
1235 $q =
"DELETE FROM style_data WHERE id = " .
1252 $q =
"SELECT * FROM style_parameter WHERE style_id = " .
1253 $ilDB->quote($this->
getId(),
"integer") .
" ORDER BY tag, class, type, mq_id ";
1254 $style_set =
$ilDB->query(
$q);
1259 $this->style = array();
1263 $this->end_styles = array();
1265 while ($style_rec =
$ilDB->fetchAssoc($style_set)) {
1266 if ($style_rec[
"tag"] != $ctag || $style_rec[
"class"] != $cclass
1267 || $style_rec[
"type"] != $ctype || $style_rec[
"mq_id"] != $cmq_id) {
1269 if (is_array($tag)) {
1270 if (in_array($ctype, array(
"ha_iheada",
"va_iheada"))) {
1271 $this->end_styles[] = $tag;
1273 $this->style[] = $tag;
1278 $ctag = $style_rec[
"tag"];
1279 $cclass = $style_rec[
"class"];
1280 $ctype = $style_rec[
"type"];
1281 $cmq_id = $style_rec[
"mq_id"];
1282 $tag[] = $style_rec;
1284 $this->style_class[$ctype][$cclass][$cmq_id][$style_rec[
"parameter"]] = $style_rec[
"value"];
1286 if (is_array($tag)) {
1287 $this->style[] = $tag;
1289 foreach ($this->end_styles as $s) {
1290 $this->style[] = $s;
1293 $q =
"SELECT * FROM style_data WHERE id = " .
1298 $this->
setScope((
int) $sty[
"category"]);
1301 $this->chars = array();
1302 $this->chars_by_type = array();
1303 $q =
"SELECT * FROM style_char WHERE style_id = " .
1305 " ORDER BY type ASC, characteristic ASC";
1307 while ($par_rec =
$ilDB->fetchAssoc($par_set)) {
1308 $this->chars[] = array(
"type" => $par_rec[
"type"],
"class" => $par_rec[
"characteristic"],
"hide" => $par_rec[
"hide"]);
1309 $this->chars_by_type[$par_rec[
"type"]][] = $par_rec[
"characteristic"];
1310 if ($par_rec[
"hide"]) {
1311 $this->hidden_chars[$par_rec[
"type"] .
":" . $par_rec[
"characteristic"]] =
true;
1321 string $a_target_file =
"",
1322 string $a_image_dir =
"" 1326 $style_manager = $this->domain->style($this->
getId());
1327 $style_manager->writeCss();
1341 if ($a_target_file ==
"") {
1344 $css_file_name = $a_target_file;
1346 $css_file = fopen($css_file_name,
'wb');
1348 $page_background =
"";
1350 $mqs = array(array(
"mquery" =>
"",
"id" => 0));
1356 foreach ($mqs as $mq) {
1357 if ($mq[
"id"] > 0) {
1358 fwrite($css_file,
"@media " . $mq[
"mquery"] .
" {\n");
1361 foreach ($style as $tag) {
1362 if ($tag[0][
"mq_id"] != $mq[
"id"]) {
1365 if (is_int(strpos($tag[0][
"class"],
"before")) && !is_int(strpos($tag[0][
"class"],
"::before"))) {
1366 $tag[0][
"class"] = str_replace(
":before",
"::before", $tag[0][
"class"]);
1368 fwrite($css_file, $tag[0][
"tag"] .
".ilc_" . $tag[0][
"type"] .
"_" . $tag[0][
"class"] .
"\n");
1371 if ($tag[0][
"tag"] ==
"td") {
1372 fwrite($css_file,
",th" .
".ilc_" . $tag[0][
"type"] .
"_" . $tag[0][
"class"] .
"\n");
1374 if (in_array($tag[0][
"tag"], array(
"h1",
"h2",
"h3"))) {
1375 fwrite($css_file,
",div.ilc_text_block_" . $tag[0][
"class"] .
"\n");
1376 fwrite($css_file,
",html.il-no-tiny-bg body#tinymce.ilc_text_block_" . $tag[0][
"class"] .
" > p \n");
1378 if ($tag[0][
"type"] ==
"section") {
1379 fwrite($css_file,
",div a.ilc_" . $tag[0][
"type"] .
"_" . $tag[0][
"class"] .
"\n");
1381 if ($tag[0][
"type"] ==
"strong") {
1382 fwrite($css_file,
",span.ilc_text_inline_" . $tag[0][
"class"] .
"\n");
1384 if ($tag[0][
"type"] ==
"em") {
1385 fwrite($css_file,
",span.ilc_text_inline_" . $tag[0][
"class"] .
"\n");
1387 if ($tag[0][
"type"] ==
"text_block") {
1388 fwrite($css_file,
",html.il-no-tiny-bg body#tinymce.ilc_text_block_" . $tag[0][
"class"] .
" > p, #copg-editor-slate-content p.ilc_text_block_" . $tag[0][
"class"] .
"\n");
1390 if ($tag[0][
"class"] ==
"VAccordCntr") {
1391 fwrite($css_file,
",div.ilc_va_cntr_AccordCntr\n");
1393 if ($tag[0][
"class"] ==
"VAccordICntr") {
1394 fwrite($css_file,
",div.ilc_va_icntr_AccordICntr\n");
1396 if ($tag[0][
"class"] ==
"VAccordICont") {
1397 fwrite($css_file,
",div.ilc_va_icont_AccordICont\n");
1399 if ($tag[0][
"class"] ==
"VAccordIHead") {
1400 fwrite($css_file,
",div.ilc_va_ihead_AccordIHead\n");
1402 if ($tag[0][
"class"] ==
"VAccordIHead:hover") {
1403 fwrite($css_file,
",div.ilc_va_ihead_AccordIHead:hover\n");
1405 if ($tag[0][
"class"] ==
"VAccordIHeadActive") {
1406 fwrite($css_file,
",div.ilc_va_iheada_AccordIHeadActive\n");
1408 if ($tag[0][
"class"] ==
"VAccordIHeadActive:hover") {
1409 fwrite($css_file,
",div.ilc_va_iheada_AccordIHeadActive:hover\n");
1411 fwrite($css_file,
"{\n");
1414 $t_border = array();
1416 foreach ($tag as $par) {
1417 $cur_par = $par[
"parameter"] ??
'';
1418 $cur_val = $par[
"value"] ??
'';
1421 if (is_int(strpos($cur_par,
"color")) && substr(trim($cur_val), 0, 1) ==
"!") {
1425 if ($tag[0][
"type"] ==
"table" && is_int(strpos($par[
"parameter"],
"border"))) {
1426 $t_border[$cur_par] = $cur_val;
1429 if (in_array($cur_par, array(
"background-image",
"list-style-image"))) {
1430 if (is_int(strpos($cur_val,
"/"))) {
1431 $cur_val =
"url(" . $cur_val .
")";
1433 if ($a_image_dir ==
"") {
1434 $cur_val =
"url(../sty/sty_" . $this->
getId() .
"/images/" . $cur_val .
")";
1436 $cur_val =
"url(" . $a_image_dir .
"/" . $cur_val .
")";
1441 if ($cur_par ==
"opacity") {
1442 $cur_val = ((
int) $cur_val) / 100;
1445 fwrite($css_file,
"\t" . $cur_par .
": " . $cur_val .
";\n");
1455 if ($cur_par ==
"opacity") {
1456 fwrite($css_file,
"\t" .
'-ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=' . ($cur_val * 100) .
')"' .
";\n");
1457 fwrite($css_file,
"\t" .
'filter: alpha(opacity=' . ($cur_val * 100) .
')' .
";\n");
1458 fwrite($css_file,
"\t" .
'-moz-opacity: ' . $cur_val .
";\n");
1462 if ($cur_par ==
"transform") {
1463 fwrite($css_file,
"\t" .
'-webkit-transform: ' . $cur_val .
";\n");
1464 fwrite($css_file,
"\t" .
'-moz-transform: ' . $cur_val .
";\n");
1465 fwrite($css_file,
"\t" .
'-ms-transform: ' . $cur_val .
";\n");
1469 if ($cur_par ==
"transform-origin") {
1470 fwrite($css_file,
"\t" .
'-webkit-transform-origin: ' . $cur_val .
";\n");
1471 fwrite($css_file,
"\t" .
'-moz-transform-origin: ' . $cur_val .
";\n");
1472 fwrite($css_file,
"\t" .
'-ms-transform-origin: ' . $cur_val .
";\n");
1476 if ($tag[0][
"tag"] ==
"div" && $tag[0][
"class"] ==
"Page" 1477 && $cur_par ==
"background-color") {
1478 $page_background = $cur_val;
1481 fwrite($css_file,
"}\n");
1482 fwrite($css_file,
"\n");
1502 if ($page_background !=
"") {
1503 fwrite($css_file,
"td.ilc_Page\n");
1504 fwrite($css_file,
"{\n");
1505 fwrite($css_file,
"\t" .
"background-color: " . $page_background .
";\n");
1506 fwrite($css_file,
"}\n");
1508 if ($mq[
"id"] > 0) {
1509 fwrite($css_file,
"}\n");
1532 $fixed_style =
$ilSetting->get(
"fixed_content_style_id");
1533 if ($fixed_style > 0) {
1534 $a_style_id = (
int) $fixed_style;
1538 if ($a_style_id <= 0) {
1539 $a_style_id = (
int)
$ilSetting->get(
"default_content_style_id");
1554 if (is_array($this->style_class[$a_type][$a_class][$a_mq_id])) {
1555 return $this->style_class[$a_type][$a_class][$a_mq_id];
1562 return "content_style/style.css";
1571 bool $add_random =
true,
1572 bool $add_token =
true 1577 $random = new \Random\Randomizer();
1578 $rand = $random->getInt(1, 999999);
1581 $fixed_style =
$ilSetting->get(
"fixed_content_style_id");
1582 if ($fixed_style > 0) {
1583 $a_style_id = (
int) $fixed_style;
1587 if ($a_style_id <= 0) {
1588 $a_style_id = (
int)
$ilSetting->get(
"default_content_style_id");
1595 $style->writeCSSFile();
1598 $style_manager = $DIC->contentStyle()->internal()->domain()->style($a_style_id);
1599 $path = $style_manager->getPath();
1602 return "./components/ILIAS/COPage/css/content.css";
1608 return "./components/ILIAS/COPage/css/print_content.css";
1613 return "./components/ILIAS/COPage/css/syntaxhighlight.css";
1618 return "./components/ILIAS/COPage/css/content_base.css";
1629 $q =
"UPDATE style_data " .
1630 "SET category = " .
$ilDB->quote($this->
getScope(),
"integer") .
1631 " WHERE id = " .
$ilDB->quote($this->
getId(),
"integer");
1646 $q =
"UPDATE style_parameter SET VALUE = " .
1647 $ilDB->quote($a_value,
"text") .
" WHERE id = " .
1648 $ilDB->quote($a_id,
"integer");
1649 $style_set =
$ilDB->manipulate(
$q);
1659 $this->style = $a_style;
1664 return str_replace(
"&",
"&", $a_str);
1673 $xml =
"<StyleSheet>\n";
1680 foreach ($this->chars as $char) {
1682 "\" Type=\"" . $char[
"type"] .
"\" Class=\"" . $char[
"class"] .
"\">\n";
1683 foreach ($this->style as $style) {
1684 if ($style[0][
"type"] == $char[
"type"] && $style[0][
"class"] == $char[
"class"]) {
1685 foreach ($style as $tag) {
1686 $xml .=
"<StyleParameter Name=\"" . $tag[
"parameter"] .
"\" Value=\"" . $tag[
"value"] .
"\" Custom=\"" . $tag[
"custom"] .
"\" />\n";
1690 $xml .=
"</Style>\n";
1694 foreach ($this->
getColors() as $color) {
1695 $xml .=
"<StyleColor Name=\"" . $color[
"name"] .
"\" Code=\"" . $color[
"code"] .
"\"/>\n";
1700 foreach ($tcts as $tct => $v) {
1703 foreach ($ts as $t) {
1704 $xml .=
"<StyleTemplate Type=\"" . $tct .
"\" Name=\"" . $t[
"name"] .
"\">\n";
1705 foreach ($t[
"classes"] as $ct =>
$c) {
1707 $xml .=
"<StyleTemplateClass ClassType=\"" . $ct .
"\" Class=\"" .
$c .
"\"/>\n";
1710 $xml .=
"</StyleTemplate>\n";
1715 $xml .=
"</StyleSheet>";
1724 if (!is_writable($sty_data_dir)) {
1725 $this->
ilias->raiseError(
"Style data directory (" . $sty_data_dir
1726 .
") not writeable.", $this->
ilias->error_obj->FATAL);
1729 $style_dir = $sty_data_dir .
"/sty_" . $this->
getId();
1731 if (!is_dir($style_dir)) {
1732 $this->
ilias->raiseError(
"Creation of style directory failed (" .
1733 $style_dir .
").", $this->
ilias->error_obj->FATAL);
1737 $ex_dir = $style_dir .
"/export";
1739 if (!is_dir($ex_dir)) {
1740 $this->
ilias->raiseError(
"Creation of Import Directory failed (" .
1741 $ex_dir .
").", $this->
ilias->error_obj->FATAL);
1750 $style_dir = $sty_data_dir .
"/sty_" . $this->
getId();
1752 $ex_dir = $style_dir .
"/export";
1754 if (is_dir($ex_dir)) {
1764 if (!is_writable($ex_sub_dir)) {
1765 $this->
ilias->raiseError(
"Style data directory (" . $ex_sub_dir
1766 .
") not writeable.", $this->
ilias->error_obj->FATAL);
1768 $ex_sub_images_dir = $ex_sub_dir .
"/images";
1770 if (!is_writable($ex_sub_images_dir)) {
1771 $this->
ilias->raiseError(
"Style data directory (" . $ex_sub_images_dir
1772 .
") not writeable.", $this->
ilias->error_obj->FATAL);
1781 $this->export_sub_dir = $a_dir;
1789 if ($this->export_sub_dir ==
"") {
1790 return "sty_" . $this->
getId();
1829 $file = $a_dir .
"/style.xml";
1832 if (!($fp = fopen($file,
'wb'))) {
1833 die(
"<strong>Error</strong>: Could not open \"" . $file .
"\" for writing" .
1834 " in <strong>" . __FILE__ .
"</strong> on line <strong>" . __LINE__ .
"</strong><br />");
1841 fwrite($fp, $this->
getXML());
1851 if (!is_writable($sty_data_dir)) {
1852 $this->
ilias->raiseError(
"Style data directory (" . $sty_data_dir
1853 .
") not writeable.", $this->
ilias->error_obj->FATAL);
1856 $style_dir = $sty_data_dir .
"/sty_" . $this->
getId();
1858 if (!is_dir($style_dir)) {
1859 $this->
ilias->raiseError(
"Creation of style directory failed (" .
1860 $style_dir .
").", $this->
ilias->error_obj->FATAL);
1864 $im_dir = $style_dir .
"/import";
1866 if (!is_dir($im_dir)) {
1867 $this->
ilias->raiseError(
"Creation of Import Directory failed (" .
1868 $im_dir .
").", $this->
ilias->error_obj->FATAL);
1881 public function import($a_file):
void 1888 if (is_array($a_file)) {
1890 $a_file[
"tmp_name"],
1892 $im_dir .
"/" . $a_file[
"name"]
1894 $file_name = $a_file[
"name"];
1896 $pi = pathinfo($a_file);
1897 $file_name = $pi[
"basename"];
1898 copy($a_file, $im_dir .
"/" . $file_name);
1900 $file = pathinfo($file_name);
1903 if (strtolower($file[
"extension"]) ==
"zip") {
1904 $this->domain->resources()->zip()->unzipFile($im_dir .
"/" . $file_name);
1905 $subdir = basename($file[
"basename"],
"." . $file[
"extension"]);
1906 if (!is_dir($im_dir .
"/" . $subdir)) {
1909 $xml_file = $im_dir .
"/" . $subdir .
"/style.xml";
1911 $xml_file = $im_dir .
"/" . $file_name;
1929 bool $a_skip_parent_create =
false 1933 $this->is_3_10_skin =
false;
1935 if (!$a_skip_parent_create) {
1939 $importParser->startParsing();
1942 foreach ($this->style as $style) {
1943 foreach ($style as $tag) {
1944 $id =
$ilDB->nextId(
"style_parameter");
1947 if (in_array($tag[
"class"], array(
"PageFrame",
"PageContainer")) &&
1948 $tag[
"tag"] ==
"table") {
1949 $tag[
"tag"] =
"div";
1950 if ($tag[
"parameter"] ==
"width" && $tag[
"value"] ==
"100%") {
1955 if ($tag[
"type"] ===
"text_block" && $tag[
"tag"] ===
"div") {
1959 $q =
"INSERT INTO style_parameter (id,style_id, tag, class, parameter, type, value, custom) VALUES " .
1961 $ilDB->quote(
$id,
"integer") .
"," .
1962 $ilDB->quote($this->
getId(),
"integer") .
"," .
1963 $ilDB->quote($tag[
"tag"],
"text") .
"," .
1964 $ilDB->quote($tag[
"class"],
"text") .
"," .
1965 $ilDB->quote($tag[
"parameter"],
"text") .
"," .
1966 $ilDB->quote($tag[
"type"],
"text") .
"," .
1967 $ilDB->quote($tag[
"value"],
"text") .
"," .
1968 $ilDB->quote((
bool) $tag[
"custom"],
"integer") .
1975 $this->is_3_10_skin =
true;
1976 foreach ($this->chars as $char) {
1977 if ($char[
"type"] !=
"") {
1978 $s = substr($char[
"class"], strlen($char[
"class"]) - 6);
1979 if ($s !=
":hover") {
1983 "style_id" => array(
"integer", $this->
getId()),
1984 "type" => array(
"text", $char[
"type"]),
1985 "characteristic" => array(
"text",
ilStr::subStr($char[
"class"], 0, 30))),
1986 array(
"hide" => array(
"integer", 0))
1988 $this->is_3_10_skin =
false;
1994 $q =
"INSERT INTO style_data (id, uptodate) VALUES " .
1995 "(" .
$ilDB->quote($this->
getId(),
"integer") .
", 0)";
2001 if ($this->is_3_10_skin) {
2014 foreach (self::$parameter as $parameter => $props) {
2022 $input = self::$parameter[$par][
"input"];
2028 $subpar = self::$parameter[$par][
"subpar"];
2036 return self::$parameter;
2039 foreach (self::$parameter as $k => $v) {
2040 if (isset(self::$filtered_groups[$v[
"group"]]) &&
2041 !in_array($a_tag, self::$filtered_groups[$v[
"group"]])) {
2051 return self::$filtered_groups;
2055 bool $a_no_percentage =
false 2057 if ($a_no_percentage) {
2058 return self::$num_unit_no_perc;
2060 return self::$num_unit;
2066 return self::$parameter[$par][
"values"];
2071 return self::$style_super_types;
2076 return in_array($a_type, self::$expandable_types);
2081 return in_array($a_type, self::$hideable_types);
2087 foreach (self::$style_super_types as $s => $t) {
2088 if (in_array($a_type, $t)) {
2091 if ($a_type == $s) {
2100 $c_styles = array();
2101 foreach (self::$core_styles as $cstyle) {
2103 = array(
"type" => $cstyle[
"type"],
2105 "class" => $cstyle[
"class"]);
2114 foreach (self::$core_styles as $s) {
2115 if ($s[
"type"] == $a_type && $s[
"class"] == $a_class) {
2126 string $a_template_type =
"" 2128 if ($a_template_type ==
"") {
2129 return self::$templates;
2131 return self::$templates[$a_template_type];
2136 return self::$pseudo_classes[$tag] ?? [];
2144 return self::$templates[$t][$k];
2149 return self::$assigned_tags[$a_type];
2155 foreach (self::$parameter as $p => $v) {
2156 $pars[$p] = $v[
"values"];
2168 $styles = array(array(
"id" => $a_id));
2177 ?array $a_styles =
null 2181 $ilDB = $DIC->database();
2183 if (is_null($a_styles)) {
2186 $styles = $a_styles;
2192 $core_images = array();
2193 $core_dir = self::$basic_style_image_dir;
2194 if (is_dir($core_dir)) {
2195 $dir = opendir($core_dir);
2196 while ($file = readdir($dir)) {
2197 if (substr($file, 0, 1) !=
"." && is_file($core_dir .
"/" . $file)) {
2198 $core_images[] = $file;
2203 foreach ($styles as $style) {
2206 foreach ($core_styles as $cs) {
2208 $set =
$ilDB->queryF(
2209 "SELECT * FROM style_char WHERE style_id = %s " .
2210 "AND type = %s AND characteristic = %s",
2211 array(
"integer",
"text",
"text"),
2212 array(
$id, $cs[
"type"], $cs[
"class"])
2216 if (!($rec =
$ilDB->fetchAssoc($set))) {
2218 "INSERT INTO style_char (style_id, type, characteristic) " .
2219 " VALUES (%s,%s,%s) ",
2220 array(
"integer",
"text",
"text"),
2221 array(
$id, $cs[
"type"], $cs[
"class"])
2225 $par_nodes = $xpath->query(
"/StyleSheet/Style[@Tag = '" . $cs[
"tag"] .
"' and @Type='" .
2226 $cs[
"type"] .
"' and @Class='" . $cs[
"class"] .
"']/StyleParameter");
2227 foreach ($par_nodes as $par_node) {
2229 $set =
$ilDB->queryF(
2230 "SELECT * FROM style_parameter WHERE style_id = %s " .
2231 "AND type = %s AND class = %s AND tag = %s AND parameter = %s",
2232 array(
"integer",
"text",
"text",
"text",
"text"),
2233 array(
$id, $cs[
"type"], $cs[
"class"],
2234 $cs[
"tag"], $par_node->getAttribute(
"Name"))
2238 if (!(
$ilDB->fetchAssoc($set))) {
2239 $spid =
$ilDB->nextId(
"style_parameter");
2240 $st =
$ilDB->manipulateF(
2241 "INSERT INTO style_parameter (id, style_id, type, class, tag, parameter, value) " .
2242 " VALUES (%s,%s,%s,%s,%s,%s,%s)",
2243 array(
"integer",
"integer",
"text",
"text",
"text",
"text",
"text"),
2244 array($spid,
$id, $cs[
"type"], $cs[
"class"], $cs[
"tag"],
2245 $par_node->getAttribute(
"Name"), $par_node->getAttribute(
"Value"))
2255 foreach ($core_images as $cim) {
2256 if (!is_file($imdir .
"/" . $cim)) {
2257 copy($core_dir .
"/" . $cim, $imdir .
"/" . $cim);
2279 $st =
$ilDB->prepareManip(
"UPDATE style_char SET type = ? WHERE characteristic = ?" .
2280 " AND style_id = ? ", array(
"text",
"text",
"integer"));
2281 $ilDB->execute($st, array(
"media_cont",
"Media", $this->
getId()));
2282 $ilDB->execute($st, array(
"media_caption",
"MediaCaption", $this->
getId()));
2283 $ilDB->execute($st, array(
"page_fn",
"Footnote", $this->
getId()));
2284 $ilDB->execute($st, array(
"page_nav",
"LMNavigation", $this->
getId()));
2285 $ilDB->execute($st, array(
"page_title",
"PageTitle", $this->
getId()));
2286 $ilDB->execute($st, array(
"page_cont",
"Page", $this->
getId()));
2289 $st =
$ilDB->prepareManip(
"UPDATE style_parameter SET type = ? WHERE class = ?" .
2290 " AND style_id = ? ", array(
"text",
"text",
"integer"));
2291 $ilDB->execute($st, array(
"media_cont",
"Media", $this->
getId()));
2292 $ilDB->execute($st, array(
"media_caption",
"MediaCaption", $this->
getId()));
2293 $ilDB->execute($st, array(
"page_fn",
"Footnote", $this->
getId()));
2294 $ilDB->execute($st, array(
"page_nav",
"LMNavigation", $this->
getId()));
2295 $ilDB->execute($st, array(
"page_title",
"PageTitle", $this->
getId()));
2296 $ilDB->execute($st, array(
"table",
"Page", $this->
getId()));
2298 $st =
$ilDB->prepareManip(
"UPDATE style_parameter SET tag = ? WHERE class = ?" .
2299 " AND style_id = ? ", array(
"text",
"text",
"integer"));
2300 $ilDB->execute($st, array(
"div",
"MediaCaption", $this->
getId()));
2303 $st =
$ilDB->prepareManip(
"UPDATE style_char SET characteristic = ? WHERE characteristic = ?" .
2304 " AND style_id = ? ", array(
"text",
"text",
"integer"));
2305 $ilDB->execute($st, array(
"MediaContainer",
"Media", $this->
getId()));
2306 $ilDB->execute($st, array(
"PageContainer",
"Page", $this->
getId()));
2309 $st =
$ilDB->prepareManip(
"UPDATE style_parameter SET class = ? WHERE class = ?" .
2310 " AND style_id = ? ", array(
"text",
"text",
"integer"));
2311 $ilDB->execute($st, array(
"MediaContainer",
"Media", $this->
getId()));
2312 $ilDB->execute($st, array(
"PageContainer",
"Page", $this->
getId()));
2315 $st =
$ilDB->prepareManip(
"DELETE FROM style_char WHERE type = ?" .
2316 " AND style_id = ? ", array(
"text",
"integer"));
2317 $ilDB->execute($st, array(
"page_cont", $this->
getId()));
2318 $st =
$ilDB->prepareManip(
"DELETE FROM style_parameter WHERE type = ?" .
2319 " AND style_id = ? ", array(
"text",
"integer"));
2320 $ilDB->execute($st, array(
"page_cont", $this->
getId()));
2334 $add_str =
" AND style_id = " .
$ilDB->quote($a_id,
"integer");
2337 $set =
$ilDB->query(
$q =
"SELECT DISTINCT style_id, tag, class FROM style_parameter WHERE " .
2338 $ilDB->equals(
"type",
"",
"text",
true) .
" " . $add_str);
2340 while ($rec =
$ilDB->fetchAssoc($set)) {
2343 switch ($rec[
"tag"]) {
2346 if (in_array($rec[
"class"], array(
"Headline3",
"Headline1",
2347 "Headline2",
"TableContent",
"List",
"Standard",
"Remark",
2348 "Additional",
"Mnemonic",
"Citation",
"Example"))) {
2349 $types[] =
"text_block";
2351 if (in_array($rec[
"class"], array(
"Block",
"Remark",
2352 "Additional",
"Mnemonic",
"Example",
"Excursus",
"Special"))) {
2353 $types[] =
"section";
2355 if (in_array($rec[
"class"], array(
"Page",
"Footnote",
"PageTitle",
"LMNavigation"))) {
2361 $types[] =
"table_cell";
2365 if (in_array($rec[
"class"], array(
"ExtLink",
"IntLink",
"FootnoteLink"))) {
2371 $types[] =
"text_inline";
2380 foreach ($types as $t) {
2382 $set4 =
$ilDB->queryF(
2383 "SELECT * FROM style_char " .
2384 " WHERE style_id = %s AND type = %s AND characteristic = %s",
2385 array(
"integer",
"text",
"text"),
2386 array($rec[
"style_id"], $t, $rec[
"class"])
2388 if ($rec4 =
$ilDB->fetchAssoc($set4)) {
2393 "INSERT INTO style_char " .
2394 " (style_id, type, characteristic) VALUES " .
2396 array(
"integer",
"text",
"text"),
2397 array($rec[
"style_id"], $t, $rec[
"class"])
2403 if ($rec[
"type"] ==
"") {
2404 if (count($types) > 0) {
2406 "UPDATE style_parameter SET type = %s " .
2407 " WHERE style_id = %s AND class = %s AND " .
$ilDB->equals(
"type",
"",
"text",
true),
2408 array(
"text",
"integer",
"text"),
2409 array($types[0], $rec[
"style_id"], $rec[
"class"])
2414 if ($types[0] ==
"link") {
2416 "UPDATE style_parameter SET type = %s " .
2417 " WHERE style_id = %s AND (class = %s OR class = %s) AND " .
$ilDB->equals(
"type",
"",
"text",
true),
2418 array(
"text",
"integer",
"text",
"text"),
2419 array($types[0], $rec[
"style_id"], $rec[
"class"] .
":visited",
2420 $rec[
"class"] .
":hover")
2425 if (count($types) == 2) {
2428 $set2 =
$ilDB->queryF(
2429 "SELECT * FROM style_parameter " .
2430 " WHERE style_id = %s AND class = %s AND type = %s",
2431 array(
"integer",
"text",
"text"),
2432 array($rec[
"style_id"], $rec[
"class"], $types[0])
2434 while ($rec2 =
$ilDB->fetchAssoc($set2)) {
2436 $set3 =
$ilDB->queryF(
2437 "SELECT * FROM style_parameter " .
2438 " WHERE style_id = %s AND tag = %s AND class = %s AND type = %s AND parameter = %s",
2439 array(
"integer",
"text",
"text",
"text",
"text"),
2440 array($rec[
"style_id"], $rec[
"tag"], $rec[
"class"], $types[1], $rec[
"parameter"])
2442 if ($rec3 =
$ilDB->fetchAssoc($set3)) {
2445 $nid =
$ilDB->nextId(
"style_parameter");
2447 "INSERT INTO style_parameter " .
2448 " (id, style_id, tag, class, parameter, value, type) VALUES " .
2449 " (%s, %s,%s,%s,%s,%s,%s) ",
2450 array(
"integer",
"integer",
"text",
"text",
"text",
"text",
"text"),
2451 array($nid, $rec2[
"style_id"], $rec2[
"tag"], $rec2[
"class"],
2452 $rec2[
"parameter"], $rec2[
"value"], $types[1])
2468 $classes = array(
"Example",
"Additional",
"Citation",
"Mnemonic",
"Remark");
2469 $pars = array(
"margin-top",
"margin-bottom");
2471 foreach ($classes as $curr_class) {
2472 foreach ($pars as $curr_par) {
2473 $res2 =
$ilDB->queryF(
2474 "SELECT id FROM style_parameter WHERE style_id = %s" .
2475 " AND tag = %s AND class= %s AND parameter = %s",
2476 array(
"integer",
"text",
"text",
"text"),
2477 array($a_id,
"p", $curr_class, $curr_par)
2479 if ($row2 =
$ilDB->fetchAssoc($res2)) {
2481 "UPDATE style_parameter SET value= %s WHERE id = %s",
2482 array(
"text",
"integer"),
2483 array(
"10px", $row2[
"id"])
2486 $nid =
$ilDB->nextId(
"style_parameter");
2488 "INSERT INTO style_parameter " .
2489 "(id, style_id, tag, class, parameter,value) VALUES (%s,%s,%s,%s,%s,%s)",
2490 array(
"integer",
"integer",
"text",
"text",
"text",
"text"),
2491 array($nid, $a_id,
"div", $curr_class, $curr_par,
"10px")
2498 "UPDATE style_parameter SET tag = %s WHERE tag = %s and style_id = %s",
2499 array(
"text",
"text",
"integer"),
2500 array(
"div",
"p", $a_id)
2515 $set =
$ilDB->query(
"SELECT * FROM style_color WHERE " .
2516 "style_id = " .
$ilDB->quote($this->getId(),
"integer") .
" " .
2517 "ORDER BY color_name");
2520 while ($rec =
$ilDB->fetchAssoc($set)) {
2522 "name" => $rec[
"color_name"],
2523 "code" => $rec[
"color_code"]
2537 $ilDB->manipulate(
"DELETE FROM style_color WHERE " .
2538 " style_id = " .
$ilDB->quote($this->getId(),
"integer") .
" AND " .
2539 " color_name = " .
$ilDB->quote($a_name,
"text"));
2546 $pos = strpos($a_name,
"(");
2548 $a_i = substr($a_name, $pos + 1);
2549 $a_i = str_replace(
")",
"", $a_i);
2550 $a_name = substr($a_name, 0, $pos);
2553 $set =
$ilDB->query(
"SELECT color_code FROM style_color WHERE " .
2554 " style_id = " .
$ilDB->quote($this->getId(),
"integer") .
" AND " .
2555 " color_name = " .
$ilDB->quote($a_name,
"text"));
2556 if ($rec =
$ilDB->fetchAssoc($set)) {
2558 return "#" . $rec[
"color_code"];
2580 $hls[
"l"] = $hls[
"l"] + ((255 - $hls[
"l"]) * ($a_i / 100));
2583 $hls[
"l"] = $hls[
"l"] - (($hls[
"l"]) * (-$a_i / 100));
2588 foreach ($rgb as $k => $v) {
2589 $rgb[$k] = str_pad(dechex((
int) $v), 2,
"0", STR_PAD_LEFT);
2592 return $rgb[
"r"] . $rgb[
"g"] . $rgb[
"b"];
2600 bool $as_dec =
false 2602 $r[
"r"] = substr($a_rgb, 0, 2);
2603 $r[
"g"] = substr($a_rgb, 2, 2);
2604 $r[
"b"] = substr($a_rgb, 4, 2);
2606 $r[
"r"] = self::hexdec(
$r[
"r"]);
2607 $r[
"g"] = self::hexdec(
$r[
"g"]);
2608 $r[
"b"] = self::hexdec(
$r[
"b"]);
2616 $hex = preg_replace(
"/[^a-fA-F0-9]+/",
"", $hex);
2620 return (
int)
hexdec($hex);
2628 $r = $a_rgb[
"r"] / 255;
2629 $g = $a_rgb[
"g"] / 255;
2630 $b = $a_rgb[
"b"] / 255;
2634 $max = max(
$r, $g,
$b);
2635 $min = min(
$r, $g,
$b);
2638 $l = ($max + $min) / 2;
2644 $s = ($max - $min) / ($max + $min);
2646 $s = ($max - $min) / (2.0 - $max - $min);
2650 $h = ($g -
$b) / ($max - $min);
2651 } elseif ($g == $max) {
2652 $h = 2.0 + (
$b -
$r) / ($max - $min);
2653 } elseif (
$b == $max) {
2654 $h = 4.0 + (
$r - $g) / ($max - $min);
2658 $hls[
"h"] = round(($h / 6) * 255);
2659 $hls[
"l"] = round($l * 255);
2660 $hls[
"s"] = round($s * 255);
2670 $h = $a_hls[
"h"] / 255;
2671 $l = $a_hls[
"l"] / 255;
2672 $s = $a_hls[
"s"] / 255;
2675 $rgb[
"r"] = $rgb[
"g"] = $rgb[
"b"] = 0;
2679 $rgb[
"r"] = $rgb[
"g"] = $rgb[
"b"] = $l;
2682 $temp2 = $l * (1.0 + $s);
2684 $temp2 = $l + $s - $l * $s;
2687 $temp1 = 2.0 * $l - $temp2;
2690 # For each of R, G, B, compute another temporary value, temp3, as follows: 2691 foreach ($rgb as $k => $v) {
2694 $temp3 = $h + 1.0 / 3.0;
2702 $temp3 = $h - 1.0 / 3.0;
2706 $temp3 = $temp3 + 1.0;
2709 $temp3 = $temp3 - 1.0;
2712 if (6.0 * $temp3 < 1) {
2713 $rgb[$k] = $temp1 + ($temp2 - $temp1) * 6.0 * $temp3;
2714 } elseif (2.0 * $temp3 < 1) {
2716 } elseif (3.0 * $temp3 < 2) {
2717 $rgb[$k] = $temp1 + ($temp2 - $temp1) * ((2.0 / 3.0) - $temp3) * 6.0;
2724 $rgb[
"r"] = round($rgb[
"r"] * 255);
2725 $rgb[
"g"] = round($rgb[
"g"] * 255);
2726 $rgb[
"b"] = round($rgb[
"b"] * 255);
2743 $set =
$ilDB->query(
"SELECT * FROM sty_media_query WHERE " .
2744 "style_id = " .
$ilDB->quote($this->getId(),
"integer") .
" " .
2745 "ORDER BY order_nr");
2748 while ($rec =
$ilDB->fetchAssoc($set)) {
2761 $id =
$ilDB->nextId(
"sty_media_query");
2762 if ($order_nr == 0) {
2766 $ilDB->manipulate(
"INSERT INTO sty_media_query (id, style_id, mquery, order_nr)" .
2768 $ilDB->quote(
$id,
"integer") .
"," .
2769 $ilDB->quote($this->
getId(),
"integer") .
"," .
2770 $ilDB->quote($a_mquery,
"text") .
"," .
2771 $ilDB->quote($order_nr,
"integer") .
2784 $set =
$ilDB->query(
2785 "SELECT max(order_nr) mnr FROM sty_media_query " .
2786 " WHERE style_id = " .
$ilDB->quote($this->getId(),
"integer")
2788 $rec =
$ilDB->fetchAssoc($set);
2790 return (
int) $rec[
"mnr"];
2800 "UPDATE sty_media_query SET " .
2801 " mquery = " .
$ilDB->quote($a_mquery,
"text") .
2802 " WHERE id = " .
$ilDB->quote($a_id,
"integer")
2817 $set =
$ilDB->query(
2818 "SELECT * FROM sty_media_query " .
2819 " WHERE id = " .
$ilDB->quote($a_id,
"integer")
2821 return $ilDB->fetchAssoc($set);
2835 "DELETE FROM sty_media_query WHERE " .
2836 " style_id = " .
$ilDB->quote($this->getId(),
"integer") .
2837 " AND id = " .
$ilDB->quote($a_id,
"integer")
2846 ?array $a_order_nr =
null 2851 if (is_array($a_order_nr)) {
2852 foreach ($mqueries as $k => $mq) {
2853 $mqueries[$k][
"order_nr"] = $a_order_nr[$mq[
"id"]];
2858 foreach ($mqueries as $mq) {
2860 "UPDATE sty_media_query SET " .
2861 " order_nr = " .
$ilDB->quote($cnt,
"integer") .
2862 " WHERE id = " .
$ilDB->quote($mq[
"id"],
"integer")
2881 $set =
$ilDB->query(
"SELECT * FROM style_template WHERE " .
2882 "style_id = " .
$ilDB->quote($this->getId(),
"integer") .
" AND " .
2883 "temp_type = " .
$ilDB->quote($a_type,
"text") .
" " .
2886 $templates = array();
2887 while ($rec =
$ilDB->fetchAssoc($set)) {
2889 $templates[] = $rec;
2902 $set =
$ilDB->query(
"SELECT * FROM style_template_class WHERE " .
2903 "template_id = " .
$ilDB->quote($a_tid,
"integer"));
2906 while ($rec =
$ilDB->fetchAssoc($set)) {
2907 $key = $rec[
"class_type"];
2908 $class[$key] = $rec[
"class"];
2925 $tid =
$ilDB->nextId(
"style_template");
2926 $ilDB->manipulate(
"INSERT INTO style_template " .
2927 "(id, style_id, name, temp_type)" .
2929 $ilDB->quote($tid,
"integer") .
"," .
2930 $ilDB->quote($this->
getId(),
"integer") .
"," .
2931 $ilDB->quote($a_name,
"text") .
"," .
2932 $ilDB->quote($a_type,
"text") .
2935 foreach ($a_classes as $t =>
$c) {
2936 $ilDB->manipulate(
"INSERT INTO style_template_class " .
2937 "(template_id, class_type, class)" .
2939 $ilDB->quote($tid,
"integer") .
"," .
2940 $ilDB->quote($t,
"text") .
"," .
2963 $ilDB->manipulate(
"UPDATE style_template SET " .
2964 "name = " .
$ilDB->quote($a_name,
"text") .
2965 " WHERE id = " .
$ilDB->quote($a_t_id,
"integer"));
2968 "DELETE FROM style_template_class WHERE " .
2969 "template_id = " .
$ilDB->quote($a_t_id,
"integer")
2971 foreach ($a_classes as $t =>
$c) {
2972 $ilDB->manipulate(
"INSERT INTO style_template_class " .
2973 "(template_id, class_type, class)" .
2975 $ilDB->quote($a_t_id,
"integer") .
"," .
2976 $ilDB->quote($t,
"text") .
"," .
2989 $ilDB->manipulate(
"INSERT INTO style_template_class " .
2990 "(template_id, class_type, class)" .
2992 $ilDB->quote($a_t_id,
"integer") .
"," .
2993 $ilDB->quote($a_type,
"text") .
"," .
2994 $ilDB->quote($a_class,
"text") .
3002 string $a_template_name
3006 $set =
$ilDB->query(
"SELECT * FROM style_template WHERE " .
3007 "style_id = " .
$ilDB->quote($this->getId(),
"integer") .
" AND " .
3008 "name = " .
$ilDB->quote($a_template_name,
"text"));
3009 if (
$ilDB->fetchAssoc($set)) {
3022 $set =
$ilDB->query(
"SELECT * FROM style_template WHERE " .
3023 "style_id = " .
$ilDB->quote($this->getId(),
"integer") .
" " .
3024 " AND id = " .
$ilDB->quote($a_t_id,
"integer"));
3026 if ($rec =
$ilDB->fetchAssoc($set)) {
3040 return self::_lookupTemplateName($a_t_id);
3050 $ilDB = $DIC->database();
3052 $set =
$ilDB->query(
"SELECT name FROM style_template WHERE " .
3053 " id = " .
$ilDB->quote($a_t_id,
"integer"));
3055 if ($rec =
$ilDB->fetchAssoc($set)) {
3056 return $rec[
"name"];
3069 $tag =
"<StyleTemplates>";
3071 $ttypes = array(
"table",
"vaccordion",
"haccordion",
"carousel");
3073 foreach ($ttypes as $ttype) {
3076 foreach ($ts as $t) {
3090 $tag .=
'<StyleTemplate Name="' . $t[
"name"] .
'">';
3092 foreach ($atts as
$type => $t2) {
3093 if ((
$c[
$type] ??
"") !=
"") {
3094 $tag .=
'<StyleClass Type="' . $type .
'" Value="' .
$c[
$type] .
'" />';
3098 $tag .=
"</StyleTemplate>";
3102 $tag .=
"</StyleTemplates>";
3113 string $a_preview_html
3116 $a_preview_html = str_replace(
' width=""',
"", $a_preview_html);
3117 $a_preview_html = str_replace(
' valign="top"',
"", $a_preview_html);
3118 $a_preview_html = str_replace(
'<div class="ilc_text_block_TableContent">',
"<div>", $a_preview_html);
3121 if (strlen($a_preview_html) > 4000) {
3123 $a_preview_html =
"";
3125 $ilDB->manipulate(
"UPDATE style_template SET " .
3126 "preview = " .
$ilDB->quote($a_preview_html,
"text") .
3127 " WHERE id = " .
$ilDB->quote($a_t_id,
"integer"));
3137 $set =
$ilDB->query(
"SELECT preview FROM style_template " .
3138 " WHERE id = " .
$ilDB->quote($a_t_id,
"integer"));
3139 if ($rec =
$ilDB->fetchAssoc($set)) {
3140 return $rec[
"preview"] ??
"";
3155 $ilDB = $DIC->database();
3157 $set =
$ilDB->query(
"SELECT id FROM style_template " .
3158 " WHERE style_id = " .
$ilDB->quote($a_style_id,
"integer") .
3159 " AND name = " .
$ilDB->quote($a_name,
"text"));
3160 if ($rec =
$ilDB->fetchAssoc($set)) {
3161 return (
int) $rec[
"id"];
3174 $ilDB->manipulate(
"DELETE FROM style_template WHERE " .
3175 " style_id = " .
$ilDB->quote($this->getId(),
"integer") .
" AND " .
3176 " id = " .
$ilDB->quote($a_t_id,
"integer"));
3179 "DELETE FROM style_template_class WHERE " .
3180 "template_id = " .
$ilDB->quote($a_t_id,
"integer")
3191 "DELETE FROM style_setting WHERE " .
3192 " style_id = " .
$ilDB->quote($this->getId(),
"integer") .
3193 " AND name = " .
$ilDB->quote($a_name,
"text")
3196 $ilDB->manipulate(
"INSERT INTO style_setting " .
3197 "(style_id, name, value) VALUES (" .
3198 $ilDB->quote($this->getId(),
"integer") .
"," .
3199 $ilDB->quote($a_name,
"text") .
"," .
3200 $ilDB->quote($a_value,
"text") .
3211 $set =
$ilDB->query(
3212 "SELECT value FROM style_setting " .
3213 " WHERE style_id = " .
$ilDB->quote($this->getId(),
"integer") .
3214 " AND name = " .
$ilDB->quote($a_name,
"text")
3216 $rec =
$ilDB->fetchAssoc($set);
3218 return $rec[
"value"] ??
'';
3230 $ilDB = $DIC->database();
3235 "obj_id" => array(
"integer", $a_obj_id)),
3237 "style_id" => array(
"integer", $a_style_id))
3249 $ilDB = $DIC->database();
3251 $set =
$ilDB->query(
3252 "SELECT style_id FROM style_usage " .
3253 " WHERE obj_id = " .
$ilDB->quote($a_obj_id,
"integer")
3255 $rec =
$ilDB->fetchAssoc($set);
3256 if (!is_array($rec)) {
3261 return (
int) $rec[
"style_id"];
3276 $ilDB = $DIC->database();
3280 $set =
$ilDB->query(
3281 "SELECT DISTINCT obj_id FROM style_usage " .
3282 " WHERE style_id = " .
$ilDB->quote($a_style_id,
"integer")
3285 while ($rec =
$ilDB->fetchAssoc($set)) {
3286 $obj_ids[] = (
int) $rec[
"obj_id"];
static getWebspaceDir(string $mode="filesystem")
get webspace directory
templateExists(string $a_template_name)
Check whether template exists.
getXML()
get xml representation of style object todo: add mq_id
static getContentPrintStyle()
static getEffectiveContentStyleId(int $a_style_id)
Get effective Style Id.
static _writeActive(int $a_id, bool $a_active)
updateMediaQuery(int $a_id, string $a_mquery)
static string $basic_style_image_dir
static _explodeRGB(string $a_rgb, bool $as_dec=false)
Explode an RGB string into an array.
static _isExpandable(string $a_type)
do_3_10_Migration()
Migrates 3.10 style to 3.11 style.
static _lookupTemplateIdByName(int $a_style_id, string $a_name)
Lookup table template preview.
txt(string $a_topic, string $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
static _getStandardStyles(bool $a_exclude_default_style=false, bool $a_include_deactivated=false, int $a_scope=0)
Get standard styles.
ILIAS Style Content InternalRepoService $repo
static _addMissingStyleClassesToAllStyles(?array $a_styles=null)
Add missing style classes to all styles todo: add mq_id and custom handling.
characteristicExists(string $a_char, string $a_style_type)
Check whether characteristic exists.
getColors()
Get colors of style.
read()
read style properties
static _getImagesDirectory(int $a_style_id)
static _writeScope(int $a_id, int $a_scope)
static _getStyleParameterNumericUnits(bool $a_no_percentage=false)
getMediaQueryForId(int $a_id)
Get media query for id.
exportXML(string $a_dir)
export style xml file to directory
addParameter(string $a_tag, string $a_par, string $a_type, int $a_mq_id=0, bool $a_custom=false)
write style parameter to db
InternalDomainService $domain
static _getAllReferences(int $id)
get all reference ids for object ID
writeStyleSetting(string $a_name, string $a_value)
static array $pseudo_classes
getTemplateClasses(int $a_tid)
Get template classes.
isInTree(?int $a_node_id)
get all information of a node.
static _lookupContObjIdByStyleId(int $a_style_id)
handleXmlString(string $a_str)
static rCopy(string $a_sdir, string $a_tdir, bool $preserveTimeAttributes=false)
Copies content of a directory $a_sdir recursively to a directory $a_tdir.
setCharacteristics(array $a_chars)
static array $expandable_types
lookupTemplateName(int $a_t_id)
Lookup table template name for template ID.
static _getStyleParameterSubPar(string $par)
static _getObjectsDataForType(string $type, bool $omit_trash=false)
get all objects of a certain type
static _getStyleParameters(string $a_tag="")
loadLanguageModule(string $a_module)
Load language module.
static subStr(string $a_str, int $a_start, ?int $a_length=null)
static _getClonableContentStyles()
Get all clonable styles (active standard styles and individual learning module styles with write perm...
static array $style_super_types
static _getTemplatePreview(ilObjStyleSheet $a_style, string $a_type, int $a_t_id, bool $a_small_mode=false)
Get table template preview.
static _RGBToHLS(array $a_rgb)
RGB to HLS (both arrays, 0..255)
static _getPseudoClasses(string $tag)
static _writeStandard(int $a_id, bool $a_std)
Write standard flag.
static makeDirParents(string $a_dir)
Create a new directory and all parent directories.
static DOMDocument $basic_style_dom
addTemplateClass(int $a_t_id, string $a_type, string $a_class)
addTemplate(string $a_type, string $a_name, array $a_classes)
Add table template.
static _getStyleSuperTypes()
createExportSubDirectory()
removeColor(string $a_name)
Remove a color.
static getBasicImageDir()
setExportSubDir(string $a_dir)
Set local directory, that will be included within the zip file.
static isCoreStyle(string $a_type, string $a_class)
static _getStyleSuperTypeForType(string $a_type)
static writeOwner($obj_id, $style_id)
lookupStyleSetting(string $a_name)
Lookup style setting.
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
deleteStyleParOfChar(string $a_type, string $a_class)
Delete style parameters of characteristic.
static _exists(int $id, bool $reference=false, ?string $type=null)
checks if an object exists in object_data
static _getBasicStyleDom()
updateTemplate(int $a_t_id, string $a_name, array $a_classes)
Update table template.
static _lookupTitle(int $obj_id)
static _lookupUpToDate(int $a_id)
static _getFilteredGroups()
getHideStatus(string $a_type, string $a_char)
Get characteristic hidden status.
getTemplateXML()
Get table template xml.
static _writeUpToDate(int $a_id, bool $a_up_to_date)
static delDir(string $a_dir, bool $a_clean_only=false)
removes a dir and all its content (subdirs and files) recursively
static _createImagesDirectory(int $a_style_id)
Create images directory <data_dir>/sty/sty_<id>/images.
getTemplates(string $a_type)
Get table templates of style.
static array $core_styles
static _lookupStandard(int $a_id)
Lookup standard flag.
static getBaseContentStylePath()
Class ilObjForumAdministration.
do_3_9_Migration(int $a_id)
Migrate old 3.9 styles.
deleteParameter(int $a_id)
delete style parameter
static string $basic_style_file
saveHideStatus(string $a_type, string $a_char, bool $a_hide)
Save characteristic hidden status.
writeTemplatePreview(int $a_t_id, string $a_preview_html)
Write table template preview.
static moveUploadedFile(string $a_file, string $a_name, string $a_target, bool $a_raise_errors=true, string $a_mode="move_uploaded")
move uploaded file
saveMediaQueryOrder(?array $a_order_nr=null)
Save media query order.
static _lookupActive(int $a_id)
Lookup active flag.
static getSyntaxStylePath()
static getDataDir()
get data directory (outside webspace)
static _deleteStyleAssignments(int $a_style_id)
delete all style references to style
copyImagesToDir(string $a_target)
Copy images to directory.
static getContentStylePath(int $a_style_id, bool $add_random=true, bool $add_token=true)
get content style path static (to avoid full reading)
getStyleParameterGroups()
Get grouped parameter.
static _getColorFlavor(string $a_rgb, int $a_i)
Get color flavor.
static array $hideable_types
getColorCodeForName(string $a_name)
writeCSSFile(string $a_target_file="", string $a_image_dir="")
write css file to webspace directory
static _lookupTemplateName(int $a_t_id)
Lookup table template name for template ID.
getMaxMQueryOrderNr()
Get maximum media query order nr.
static array $assigned_tags
getCharacteristics(string $a_type="", bool $a_no_hidden=false, bool $a_include_core=true)
Get characteristics.
getPathId(int $a_endnode_id, int $a_startnode_id=0)
get path from a given startnode to a given endnode if startnode is not given the rootnode is startnod...
static array $num_unit_no_perc
static writeStyleUsage(int $a_obj_id, int $a_style_id)
Write style usage.
static _addMissingStyleClassesToStyle(int $a_id)
Add missing style classes to all styles.
__construct(int $a_id=0, bool $a_call_by_reference=false)
getExportSubDir()
The local directory, that will be included within the zip file.
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
__construct(Container $dic, ilPlugin $plugin)
static _getStyleParameterValues(string $par)
static lookupObjectStyle(int $a_obj_id)
Lookup object style.
determineTemplateStyleClassType(string $t, string $k)
static zip(string $a_dir, string $a_file, bool $compress_content=false)
static lookupObjectForStyle(int $a_style_id)
Lookup objects for style.
lookupTemplatePreview(int $a_t_id)
Lookup table template preview.
create(int $a_from_style=0, bool $a_import_mode=false)
Create a new style.
static getExportContentStylePath()
static string $basic_style_zip
static _HLSToRGB(array $a_hls)
HLS to RGB (both arrays, 0..255)
setUpToDate(bool $a_up_to_date=true)
Set style up to date (false + update will trigger css generation next time)
addCharacteristic(string $a_type, string $a_char, bool $a_hidden=false, int $order_nr=0, bool $outdated=false)
static array $filtered_groups
static _isHideable(string $a_type)
static _determineTag(string $a_type)
static _lookupType(int $id, bool $reference=false)
static _getTemplateClassTypes(string $a_template_type="")
Get template class types.
deleteMediaQuery(int $a_id)
Delete media query.
deleteCustomStylePars(string $a_tag, string $a_class, string $a_type, int $a_mq_id=0)
Delete style parameter by tag/class/parameter.
removeTemplate(int $a_t_id)
Remove table template.
static hexdec(string $hex)
do_3_10_CharMigration(int $a_id=0)
This is more or less a copy of Services/Migration/DBUpdate_1385/classes ilStyleMigration->addMissingS...
createImagesDirectory()
Create images directory <data_dir>/sty/sty_<id>/images.
getParametersOfClass(string $a_type, string $a_class, int $a_mq_id=0)
static makeDir(string $a_dir)
creates a new directory and inherits all filesystem permissions of the parent directory You may pass ...
createFromXMLFile(string $a_file, bool $a_skip_parent_create=false)
create style from xml file todo: add mq_id and custom
ilClone()
clone style sheet (note: styles have no ref ids and return an object id)
static getAvailableParameters()
updateStyleParameter(int $a_id, string $a_value)
update style parameter per id
static _getStyleParameterInputType(string $par)
addMediaQuery(string $a_mquery, int $order_nr=0)
static sortArray(array $array, string $a_array_sortby_key, string $a_array_sortorder="asc", bool $a_numeric=false, bool $a_keep_keys=false)