19declare(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"],
377 "input" => [
"hover"],
382 array(
"type" =>
"text_block",
"class" =>
"Standard"),
383 array(
"type" =>
"text_block",
"class" =>
"List"),
384 array(
"type" =>
"text_block",
"class" =>
"TableContent"),
385 array(
"type" =>
"code_block",
"class" =>
"Code"),
386 array(
"type" =>
"heading1",
"class" =>
"Headline1"),
387 array(
"type" =>
"heading2",
"class" =>
"Headline2"),
388 array(
"type" =>
"heading3",
"class" =>
"Headline3"),
389 array(
"type" =>
"text_inline",
"class" =>
"Comment"),
390 array(
"type" =>
"em",
"class" =>
"Emph"),
391 array(
"type" =>
"text_inline",
"class" =>
"Quotation"),
392 array(
"type" =>
"strong",
"class" =>
"Strong"),
393 array(
"type" =>
"text_inline",
"class" =>
"Accent"),
394 array(
"type" =>
"text_inline",
"class" =>
"Important"),
395 array(
"type" =>
"code_inline",
"class" =>
"CodeInline"),
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_cont",
"class" =>
"PageContainer"),
411 array(
"type" =>
"page",
"class" =>
"Page"),
412 array(
"type" =>
"page_fn",
"class" =>
"Footnote"),
413 array(
"type" =>
"page_title",
"class" =>
"PageTitle"),
414 array(
"type" =>
"list_o",
"class" =>
"NumberedList"),
415 array(
"type" =>
"list_u",
"class" =>
"BulletedList"),
416 array(
"type" =>
"list_item",
"class" =>
"StandardListItem"),
417 array(
"type" =>
"question",
"class" =>
"Standard"),
418 array(
"type" =>
"question",
"class" =>
"SingleChoice"),
419 array(
"type" =>
"question",
"class" =>
"MultipleChoice"),
420 array(
"type" =>
"question",
"class" =>
"TextQuestion"),
421 array(
"type" =>
"question",
"class" =>
"OrderingQuestion"),
422 array(
"type" =>
"question",
"class" =>
"MatchingQuestion"),
423 array(
"type" =>
"question",
"class" =>
"ImagemapQuestion"),
424 array(
"type" =>
"question",
"class" =>
"ErrorText"),
425 array(
"type" =>
"question",
"class" =>
"TextSubset"),
426 array(
"type" =>
"question",
"class" =>
"ClozeTest"),
427 array(
"type" =>
"qtitle",
"class" =>
"Title"),
428 array(
"type" =>
"qanswer",
"class" =>
"Answer"),
429 array(
"type" =>
"qimg",
"class" =>
"QuestionImage"),
430 array(
"type" =>
"qimgd",
"class" =>
"ImageDetailsLink"),
431 array(
"type" =>
"qordul",
"class" =>
"OrderList"),
432 array(
"type" =>
"qordli",
"class" =>
"OrderListItem"),
433 array(
"type" =>
"qordul",
"class" =>
"OrderListHorizontal"),
434 array(
"type" =>
"qordli",
"class" =>
"OrderListItemHorizontal"),
435 array(
"type" =>
"qetitem",
"class" =>
"ErrorTextItem"),
436 array(
"type" =>
"qetitem",
"class" =>
"ErrorTextSelected"),
437 array(
"type" =>
"qetcorr",
"class" =>
"ErrorTextCorrected"),
438 array(
"type" =>
"qinput",
"class" =>
"TextInput"),
439 array(
"type" =>
"qlinput",
"class" =>
"LongTextInput"),
440 array(
"type" =>
"qsubmit",
"class" =>
"Submit"),
441 array(
"type" =>
"qfeedr",
"class" =>
"FeedbackRight"),
442 array(
"type" =>
"qfeedw",
"class" =>
"FeedbackWrong"),
443 array(
"type" =>
"qover",
"class" =>
"Correct"),
444 array(
"type" =>
"qover",
"class" =>
"Inorrect"),
445 array(
"type" =>
"qover",
"class" =>
"StatusMessage"),
446 array(
"type" =>
"qover",
"class" =>
"WrongAnswersMessage"),
447 array(
"type" =>
"flist_cont",
"class" =>
"FileListContainer"),
448 array(
"type" =>
"flist_head",
"class" =>
"FileListHeading"),
449 array(
"type" =>
"flist",
"class" =>
"FileList"),
450 array(
"type" =>
"flist_li",
"class" =>
"FileListItem"),
451 array(
"type" =>
"flist_a",
"class" =>
"FileListItemLink")
457 "caption" =>
"table_caption",
458 "row_head" =>
"table_cell",
459 "row_foot" =>
"table_cell",
460 "col_head" =>
"table_cell",
461 "col_foot" =>
"table_cell",
462 "odd_row" =>
"table_cell",
463 "even_row" =>
"table_cell",
464 "odd_col" =>
"table_cell",
465 "even_col" =>
"table_cell"),
466 "vaccordion" => array(
467 "va_cntr" =>
"va_cntr",
468 "va_icntr" =>
"va_icntr",
469 "va_ihead" =>
"va_ihead",
470 "va_iheada" =>
"va_iheada",
471 "va_ihcap" =>
"va_ihcap",
472 "va_icont" =>
"va_icont"
474 "haccordion" => array(
475 "ha_cntr" =>
"ha_cntr",
476 "ha_icntr" =>
"ha_icntr",
477 "ha_ihead" =>
"ha_ihead",
478 "ha_iheada" =>
"ha_iheada",
479 "ha_ihcap" =>
"ha_ihcap",
480 "ha_icont" =>
"ha_icont"
483 "ca_cntr" =>
"ca_cntr",
484 "ca_icntr" =>
"ca_icntr",
485 "ca_ihead" =>
"ca_ihead",
486 "ca_icont" =>
"ca_icont"
498 bool $a_call_by_reference =
false
502 $this->db =
$DIC->database();
503 $this->
lng = $DIC->language();
505 $this->style = array();
506 $this->
ilias = $DIC[
"ilias"];
507 $this->domain =
$DIC->contentStyle()->internal()->domain();
509 if ($a_call_by_reference) {
510 $this->
ilias->raiseError(
"Can't instantiate style object via reference id.", $this->
ilias->error_obj->FATAL);
513 $this->repo =
$DIC->contentStyle()->internal()->repo();
526 $this->up_to_date = $a_up_to_date;
536 $this->scope = $a_scope;
552 $q =
"UPDATE style_data SET uptodate = " .
553 $ilDB->quote((
int) $a_up_to_date,
"integer") .
554 " WHERE id = " .
$ilDB->quote($a_id,
"integer");
563 $q =
"UPDATE style_data SET owner_obj = " .
564 $ilDB->quote((
int) $obj_id,
"integer") .
565 " WHERE id = " .
$ilDB->quote($style_id,
"integer");
575 $q =
"SELECT uptodate FROM style_data " .
576 " WHERE id = " .
$ilDB->quote($a_id,
"integer");
580 return (
bool) $sty[
"uptodate"];
594 $q =
"UPDATE style_data SET standard = " .
595 $ilDB->quote((
int) $a_std,
"integer") .
596 " WHERE id = " .
$ilDB->quote($a_id,
"integer");
606 $q =
"UPDATE style_data SET category = " .
607 $ilDB->quote($a_scope,
"integer") .
608 " WHERE id = " .
$ilDB->quote($a_id,
"integer");
621 $q =
"SELECT * FROM style_data " .
622 " WHERE id = " .
$ilDB->quote($a_id,
"integer");
626 return (
bool) ($sty[
"standard"] ??
false);
635 $q =
"UPDATE style_data SET active = " .
636 $ilDB->quote((
int) $a_active,
"integer") .
637 " WHERE id = " .
$ilDB->quote($a_id,
"integer");
650 $q =
"SELECT * FROM style_data " .
651 " WHERE id = " .
$ilDB->quote($a_id,
"integer");
655 return (
bool) $sty[
"active"];
663 bool $a_exclude_default_style =
false,
664 bool $a_include_deactivated =
false,
671 $tree =
$DIC->repositoryTree();
673 $default_style =
$ilSetting->get(
"default_content_style_id");
676 if (!$a_include_deactivated) {
677 $and_str =
" AND active = 1";
680 $q =
"SELECT * FROM style_data " .
681 " WHERE standard = 1" . $and_str;
685 if (!$a_exclude_default_style || $default_style != $sty[
"id"]) {
687 if ($a_scope > 0 && $sty[
"category"] > 0) {
688 if ($tree->isInTree((
int) $sty[
"category"]) &&
689 $tree->isInTree($a_scope)) {
690 $path = $tree->getPathId($a_scope);
691 if (!in_array((
int) $sty[
"category"],
$path)) {
713 $ilAccess =
$DIC->access();
716 $clonable_styles = array();
718 $q =
"SELECT * FROM style_data";
720 while ($style_rec =
$ilDB->fetchAssoc($style_set)) {
722 if ($style_rec[
"standard"] == 1) {
723 if ($style_rec[
"active"] == 1) {
728 if (count($obj_ids) == 0) {
729 $obj_ids = self::lookupObjectForStyle((
int) $style_rec[
"id"]);
731 foreach ($obj_ids as
$id) {
734 if ($ilAccess->checkAccess(
"write",
"",
$ref_id)) {
741 $clonable_styles[(
int) $style_rec[
"id"]] =
746 asort($clonable_styles);
748 return $clonable_styles;
753 if (!is_object(self::$basic_style_dom)) {
754 self::$basic_style_dom =
new DOMDocument();
755 self::$basic_style_dom->load(self::$basic_style_file);
758 return self::$basic_style_dom;
763 return self::$basic_style_image_dir;
771 int $a_from_style = 0,
772 bool $a_import_mode =
false
778 $id = parent::create();
782 $access_manager =
$service->domain()->access(
784 $DIC->user()->getId()
786 $access_manager->enableWrite(
true);
787 $color_manager =
$service->domain()->color($this->
getId(), $access_manager);
789 if ($a_from_style == 0) {
790 if (!$a_import_mode) {
791 throw new Exception(
"Can't create style without a from style in non-import mode.");
794 $q =
"INSERT INTO style_data (id, uptodate, category) VALUES " .
795 "(" .
$ilDB->quote($this->
getId(),
"integer") .
", 0," .
796 $ilDB->quote($this->getScope(),
"integer") .
")";
803 $q =
"SELECT * FROM style_parameter WHERE style_id = " .
804 $ilDB->quote($a_from_style,
"integer");
806 while ($par_rec =
$ilDB->fetchAssoc($par_set)) {
807 $def[] = array(
"tag" => $par_rec[
"tag"],
"class" => $par_rec[
"class"],
808 "parameter" => $par_rec[
"parameter"],
"value" => $par_rec[
"value"],
809 "type" => $par_rec[
"type"],
"mq_id" => $par_rec[
"mq_id"],
"custom" => $par_rec[
"custom"]);
812 $char_repo = $this->repo->characteristic();
813 $char_repo->cloneAllFromStyle($a_from_style, $this->
getId());
818 $mqs = $from_style->getMediaQueries();
819 $mq_mapping = array();
820 foreach ($mqs as $mq) {
821 $nid = $this->addMediaQuery($mq[
"mquery"]);
822 $mq_mapping[$mq[
"id"]] = $nid;
826 foreach ($def as $sty) {
827 $id =
$ilDB->nextId(
"style_parameter");
828 $q =
"INSERT INTO style_parameter (id, style_id, tag, class, parameter, value, type, mq_id, custom) VALUES " .
830 $ilDB->quote(
$id,
"integer") .
"," .
831 $ilDB->quote($this->
getId(),
"integer") .
"," .
832 $ilDB->quote($sty[
"tag"],
"text") .
"," .
833 $ilDB->quote($sty[
"class"],
"text") .
"," .
834 $ilDB->quote($sty[
"parameter"],
"text") .
"," .
835 $ilDB->quote($sty[
"value"],
"text") .
"," .
836 $ilDB->quote($sty[
"type"],
"text") .
"," .
837 $ilDB->quote((
int) ($mq_mapping[$sty[
"mq_id"]] ?? 0),
"integer") .
"," .
838 $ilDB->quote($sty[
"custom"],
"integer") .
844 $q =
"INSERT INTO style_data (id, uptodate, category) VALUES " .
845 "(" .
$ilDB->quote($this->
getId(),
"integer") .
", 0," .
846 $ilDB->quote($this->getScope(),
"integer") .
")";
851 $this->domain->style($this->
getId())->cloneResourceContainer($from_style->getId());
853 $colors = $from_style->getColors();
854 foreach ($colors as
$c) {
855 $color_manager->addColor(
$c[
"name"],
$c[
"code"]);
860 foreach ($tcts as $tct => $v) {
861 $templates = $from_style->getTemplates($tct);
862 foreach ($templates as $t) {
863 $this->addTemplate($tct, $t[
"name"], $t[
"classes"]);
869 if (!$a_import_mode) {
870 $this->writeCSSFile();
885 $set =
$ilDB->queryF(
886 "SELECT style_id FROM style_char WHERE style_id = %s AND characteristic = %s AND type = %s",
887 array(
"integer",
"text",
"text"),
888 array($this->
getId(), $a_char, $a_style_type)
890 if (
$ilDB->fetchAssoc($set)) {
899 bool $a_hidden =
false,
901 bool $outdated =
false
906 $ilDB->insert(
"style_char", [
907 "style_id" => [
"integer", $this->
getId()],
908 "type" => [
"text", $a_type],
909 "characteristic" => [
"text", $a_char],
910 "hide" => [
"integer", (
int) $a_hidden],
911 "outdated" => [
"integer", (
int) $outdated],
912 "order_nr" => [
"integer", $order_nr]
915 $this->setUpToDate(
false);
916 $this->_writeUpToDate($this->
getId(),
false);
924 bool $a_no_hidden =
false,
925 bool $a_include_core =
true
930 $chars = $this->chars;
932 if (isset($this->chars_by_type[$a_type])) {
933 foreach ($this->chars_by_type[$a_type] as
$c) {
934 if ($a_include_core || !self::isCoreStyle($a_type,
$c)) {
941 foreach ($chars as $k => $char) {
942 if ($a_type ==
"" && $this->hidden_chars[$char[
"type"] .
":" . $char[
"class"]]) {
944 } elseif ($this->hidden_chars[$a_type .
":" . $char] ??
false) {
955 $chars = $this->getCharacteristics($type);
956 return in_array($char, $chars);
961 $this->chars = $a_chars;
975 "UPDATE style_char SET " .
976 " hide = " .
$ilDB->quote((
int) $a_hide,
"integer") .
977 " WHERE style_id = " .
$ilDB->quote($this->getId(),
"integer") .
" AND " .
978 " type = " .
$ilDB->quote($a_type,
"text") .
" AND " .
979 " characteristic = " .
$ilDB->quote($a_char,
"text")
993 "SELECT hide FROM style_char " .
994 " WHERE style_id = " .
$ilDB->quote($this->getId(),
"integer") .
" AND " .
995 " type = " .
$ilDB->quote($a_type,
"text") .
" AND " .
996 " characteristic = " .
$ilDB->quote($a_char,
"text")
998 $rec =
$ilDB->fetchAssoc($set);
1000 return (
bool) ($rec[
"hide"] ??
false);
1010 $lng->loadLanguageModule(
"style");
1013 $new_obj->setTitle($this->
getTitle() .
" (" .
$lng->txt(
"sty_acopy") .
")");
1014 $new_obj->setType($this->getType());
1015 $new_obj->setDescription($this->getDescription());
1016 $new_obj->create($this->
getId());
1018 $new_obj->writeStyleSetting(
1019 "disable_auto_margins",
1020 $this->lookupStyleSetting(
"disable_auto_margins")
1023 return $new_obj->getId();
1048 bool $a_custom =
false
1052 $avail_params = $this->getAvailableParameters();
1053 $tag = explode(
".", $a_tag);
1054 $value = $avail_params[$a_par][0];
1055 $id =
$ilDB->nextId(
"style_parameter");
1056 $q =
"INSERT INTO style_parameter (id,style_id, type, tag, class, parameter, value, mq_id, custom) VALUES " .
1058 $ilDB->quote(
$id,
"integer") .
"," .
1059 $ilDB->quote($this->
getId(),
"integer") .
"," .
1060 $ilDB->quote($a_type,
"text") .
"," .
1061 $ilDB->quote($tag[0],
"text") .
"," .
1062 $ilDB->quote($tag[1],
"text") .
"," .
1063 $ilDB->quote($a_par,
"text") .
"," .
1064 $ilDB->quote($value,
"text") .
"," .
1065 $ilDB->quote($a_mq_id,
"integer") .
"," .
1066 $ilDB->quote($a_custom,
"integer") .
1070 $this->writeCSSFile();
1094 if (!is_dir($sty_data_dir)) {
1097 if (!is_writable($sty_data_dir)) {
1098 $ilErr->raiseError(
"Style data directory (" . $sty_data_dir
1099 .
") not writeable.",
$ilErr->FATAL);
1102 $style_dir = $sty_data_dir .
"/sty_" . $a_style_id;
1103 if (!is_dir($style_dir)) {
1106 if (!is_dir($style_dir)) {
1107 $ilErr->raiseError(
"Creation of style directory failed (" .
1108 $style_dir .
").",
$ilErr->FATAL);
1112 $im_dir = $style_dir .
"/images";
1113 if (!is_dir($im_dir)) {
1116 if (!is_dir($im_dir)) {
1117 $ilErr->raiseError(
"Creation of Import Directory failed (" .
1118 $im_dir .
").",
$ilErr->FATAL);
1122 $thumb_dir = $style_dir .
"/images/thumbnails";
1124 if (!is_dir($thumb_dir)) {
1125 $ilErr->raiseError(
"Creation of Import Directory failed (" .
1126 $thumb_dir .
").",
$ilErr->FATAL);
1143 return $this->getImagesDirectory() .
1154 $q =
"DELETE FROM style_parameter WHERE id = " .
1155 $ilDB->quote($a_id,
"integer");
1175 $q =
"DELETE FROM style_parameter WHERE " .
1176 " style_id = " .
$ilDB->quote($this->
getId(),
"integer") .
" AND " .
1177 " tag = " .
$ilDB->quote($a_tag,
"text") .
" AND " .
1178 " class = " .
$ilDB->quote($a_class,
"text") .
" AND " .
1179 " mq_id = " .
$ilDB->quote($a_mq_id,
"integer") .
" AND " .
1180 " custom = " .
$ilDB->quote(1,
"integer") .
" AND " .
1181 " " .
$ilDB->equals(
"type", $a_type,
"text",
true);
1195 $q =
"DELETE FROM style_parameter WHERE " .
1196 " style_id = " .
$ilDB->quote($this->
getId(),
"integer") .
" AND " .
1197 " class = " .
$ilDB->quote($a_class,
"text") .
" AND " .
1198 " " .
$ilDB->equals(
"type", $a_type,
"text",
true);
1204 public function delete():
bool
1212 $def_style = $this->
ilias->getSetting(
"default_content_style_id");
1213 if ($def_style == $this->
getId()) {
1214 $this->
ilias->deleteSetting(
"default_content_style_id");
1218 $fixed_style = $this->
ilias->getSetting(
"fixed_content_style_id");
1219 if ($fixed_style == $this->
getId()) {
1220 $this->
ilias->deleteSetting(
"fixed_content_style_id");
1224 $q =
"DELETE FROM style_parameter WHERE style_id = " .
1230 if (is_file($css_file_name)) {
1231 unlink($css_file_name);
1236 "DELETE FROM sty_media_query WHERE " .
1237 " style_id = " .
$ilDB->quote($this->getId(),
"integer")
1244 $q =
"DELETE FROM style_data WHERE id = " .
1261 $q =
"SELECT * FROM style_parameter WHERE style_id = " .
1262 $ilDB->quote($this->
getId(),
"integer") .
" ORDER BY tag, class, type, mq_id ";
1263 $style_set =
$ilDB->query(
$q);
1268 $this->style = array();
1272 $this->end_styles = array();
1274 while ($style_rec =
$ilDB->fetchAssoc($style_set)) {
1275 if ($style_rec[
"tag"] != $ctag || $style_rec[
"class"] != $cclass
1276 || $style_rec[
"type"] != $ctype || $style_rec[
"mq_id"] != $cmq_id) {
1278 if (is_array($tag)) {
1279 if (in_array($ctype, array(
"ha_iheada",
"va_iheada"))) {
1280 $this->end_styles[] = $tag;
1282 $this->style[] = $tag;
1287 $ctag = $style_rec[
"tag"];
1288 $cclass = $style_rec[
"class"];
1289 $ctype = $style_rec[
"type"];
1290 $cmq_id = $style_rec[
"mq_id"];
1291 $tag[] = $style_rec;
1293 $this->style_class[$ctype][$cclass][$cmq_id][$style_rec[
"parameter"]] = $style_rec[
"value"];
1295 if (is_array($tag)) {
1296 $this->style[] = $tag;
1298 foreach ($this->end_styles as $s) {
1299 $this->style[] = $s;
1302 $q =
"SELECT * FROM style_data WHERE id = " .
1306 $this->setUpToDate((
bool) $sty[
"uptodate"]);
1307 $this->setScope((
int) $sty[
"category"]);
1310 $this->chars = array();
1311 $this->chars_by_type = array();
1312 $q =
"SELECT * FROM style_char WHERE style_id = " .
1314 " ORDER BY type ASC, characteristic ASC";
1316 while ($par_rec =
$ilDB->fetchAssoc($par_set)) {
1317 $this->chars[] = array(
"type" => $par_rec[
"type"],
"class" => $par_rec[
"characteristic"],
"hide" => $par_rec[
"hide"]);
1318 $this->chars_by_type[$par_rec[
"type"]][] = $par_rec[
"characteristic"];
1319 if ($par_rec[
"hide"]) {
1320 $this->hidden_chars[$par_rec[
"type"] .
":" . $par_rec[
"characteristic"]] =
true;
1330 string $a_target_file =
"",
1331 string $a_image_dir =
""
1333 $style_manager = $this->domain->style($this->
getId());
1334 if ($style_manager->writeCss()) {
1335 $this->setUpToDate();
1353 $fixed_style =
$ilSetting->get(
"fixed_content_style_id");
1354 if ($fixed_style > 0) {
1355 $a_style_id = (
int) $fixed_style;
1359 if ($a_style_id <= 0) {
1360 $a_style_id = (
int)
$ilSetting->get(
"default_content_style_id");
1375 if (is_array($this->style_class[$a_type][$a_class][$a_mq_id])) {
1376 return $this->style_class[$a_type][$a_class][$a_mq_id];
1383 return "assets/content_style/style.css";
1392 bool $add_random =
true,
1393 bool $add_token =
true
1398 $random = new \Random\Randomizer();
1399 $rand = $random->getInt(1, 999999);
1402 $fixed_style =
$ilSetting->get(
"fixed_content_style_id");
1403 if ($fixed_style > 0) {
1404 $a_style_id = (
int) $fixed_style;
1408 if ($a_style_id <= 0) {
1409 $a_style_id = (
int)
$ilSetting->get(
"default_content_style_id");
1415 $style->writeCSSFile();
1418 $style_manager =
$DIC->contentStyle()->internal()->domain()->style($a_style_id);
1419 $path = $style_manager->getPath();
1422 return "./components/ILIAS/COPage/css/content.css";
1428 return "./components/ILIAS/COPage/css/print_content.css";
1433 return "./components/ILIAS/COPage/css/syntaxhighlight.css";
1438 return "./components/ILIAS/COPage/css/content_base.css";
1447 $this->writeCSSFile();
1449 $q =
"UPDATE style_data " .
1450 "SET category = " .
$ilDB->quote($this->getScope(),
"integer") .
1451 " WHERE id = " .
$ilDB->quote($this->
getId(),
"integer");
1466 $q =
"UPDATE style_parameter SET VALUE = " .
1467 $ilDB->quote($a_value,
"text") .
" WHERE id = " .
1468 $ilDB->quote($a_id,
"integer");
1469 $style_set =
$ilDB->manipulate(
$q);
1474 return $this->style;
1479 $this->style = $a_style;
1484 return str_replace(
"&",
"&", $a_str);
1493 $xml =
"<StyleSheet>\n";
1496 $xml .=
"<Title>" . $this->handleXmlString($this->
getTitle()) .
"</Title>";
1497 $xml .=
"<Description>" . $this->handleXmlString($this->getDescription()) .
"</Description>\n";
1500 foreach ($this->chars as $char) {
1502 "\" Type=\"" . $char[
"type"] .
"\" Class=\"" . $char[
"class"] .
"\">\n";
1503 foreach ($this->style as $style) {
1504 if ($style[0][
"type"] == $char[
"type"] && $style[0][
"class"] == $char[
"class"]) {
1505 foreach ($style as $tag) {
1506 $xml .=
"<StyleParameter Name=\"" . $tag[
"parameter"] .
"\" Value=\"" . $tag[
"value"] .
"\" Custom=\"" . $tag[
"custom"] .
"\" />\n";
1510 $xml .=
"</Style>\n";
1514 foreach ($this->getColors() as $color) {
1515 $xml .=
"<StyleColor Name=\"" . $color[
"name"] .
"\" Code=\"" . $color[
"code"] .
"\"/>\n";
1520 foreach ($tcts as $tct => $v) {
1521 $ts = $this->getTemplates($tct);
1523 foreach ($ts as $t) {
1524 $xml .=
"<StyleTemplate Type=\"" . $tct .
"\" Name=\"" . $t[
"name"] .
"\">\n";
1525 foreach ($t[
"classes"] as $ct =>
$c) {
1527 $xml .=
"<StyleTemplateClass ClassType=\"" . $ct .
"\" Class=\"" .
$c .
"\"/>\n";
1530 $xml .=
"</StyleTemplate>\n";
1535 $xml .=
"</StyleSheet>";
1544 if (!is_writable($sty_data_dir)) {
1545 $this->
ilias->raiseError(
"Style data directory (" . $sty_data_dir
1546 .
") not writeable.", $this->
ilias->error_obj->FATAL);
1549 $style_dir = $sty_data_dir .
"/sty_" . $this->
getId();
1551 if (!is_dir($style_dir)) {
1552 $this->
ilias->raiseError(
"Creation of style directory failed (" .
1553 $style_dir .
").", $this->
ilias->error_obj->FATAL);
1557 $ex_dir = $style_dir .
"/export";
1559 if (!is_dir($ex_dir)) {
1560 $this->
ilias->raiseError(
"Creation of Import Directory failed (" .
1561 $ex_dir .
").", $this->
ilias->error_obj->FATAL);
1570 $style_dir = $sty_data_dir .
"/sty_" . $this->
getId();
1572 $ex_dir = $style_dir .
"/export";
1574 if (is_dir($ex_dir)) {
1581 $ex_dir = $this->createExportDirectory();
1582 $ex_sub_dir = $ex_dir .
"/" . $this->getExportSubDir();
1584 if (!is_writable($ex_sub_dir)) {
1585 $this->
ilias->raiseError(
"Style data directory (" . $ex_sub_dir
1586 .
") not writeable.", $this->
ilias->error_obj->FATAL);
1588 $ex_sub_images_dir = $ex_sub_dir .
"/images";
1590 if (!is_writable($ex_sub_images_dir)) {
1591 $this->
ilias->raiseError(
"Style data directory (" . $ex_sub_images_dir
1592 .
") not writeable.", $this->
ilias->error_obj->FATAL);
1601 $this->export_sub_dir = $a_dir;
1609 if ($this->export_sub_dir ==
"") {
1610 return "sty_" . $this->
getId();
1612 return $this->export_sub_dir;
1624 $this->cleanExportDirectory();
1625 $ex_dir = $this->createExportDirectory();
1626 $this->createExportSubDirectory();
1627 $this->exportXML($ex_dir .
"/" . $this->getExportSubDir());
1630 $this->getImagesDirectory(),
1631 $ex_dir .
"/" . $this->getExportSubDir() .
"/images"
1633 if (is_file($ex_dir .
"/" . $this->getExportSubDir() .
".zip")) {
1634 unlink($ex_dir .
"/" . $this->getExportSubDir() .
".zip");
1637 $ex_dir .
"/" . $this->getExportSubDir(),
1638 $ex_dir .
"/" . $this->getExportSubDir() .
".zip"
1641 return $ex_dir .
"/" . $this->getExportSubDir() .
".zip";
1649 $file = $a_dir .
"/style.xml";
1652 if (!($fp = fopen($file,
'wb'))) {
1653 die(
"<strong>Error</strong>: Could not open \"" . $file .
"\" for writing" .
1654 " in <strong>" . __FILE__ .
"</strong> on line <strong>" . __LINE__ .
"</strong><br />");
1661 fwrite($fp, $this->getXML());
1671 if (!is_writable($sty_data_dir)) {
1672 $this->
ilias->raiseError(
"Style data directory (" . $sty_data_dir
1673 .
") not writeable.", $this->
ilias->error_obj->FATAL);
1676 $style_dir = $sty_data_dir .
"/sty_" . $this->
getId();
1678 if (!is_dir($style_dir)) {
1679 $this->
ilias->raiseError(
"Creation of style directory failed (" .
1680 $style_dir .
").", $this->
ilias->error_obj->FATAL);
1684 $im_dir = $style_dir .
"/import";
1686 if (!is_dir($im_dir)) {
1687 $this->
ilias->raiseError(
"Creation of Import Directory failed (" .
1688 $im_dir .
").", $this->
ilias->error_obj->FATAL);
1701 public function import($a_file):
void
1705 $im_dir = $this->createImportDirectory();
1708 if (is_array($a_file)) {
1710 $a_file[
"tmp_name"],
1712 $im_dir .
"/" . $a_file[
"name"]
1714 $file_name = $a_file[
"name"];
1716 $pi = pathinfo($a_file);
1717 $file_name = $pi[
"basename"];
1718 copy($a_file, $im_dir .
"/" . $file_name);
1720 $file = pathinfo($file_name);
1723 if (strtolower($file[
"extension"]) ==
"zip") {
1724 $this->domain->resources()->zip()->unzipFile($im_dir .
"/" . $file_name);
1725 $subdir = basename($file[
"basename"],
"." . $file[
"extension"]);
1726 if (!is_dir($im_dir .
"/" . $subdir)) {
1729 $xml_file = $im_dir .
"/" . $subdir .
"/style.xml";
1731 $xml_file = $im_dir .
"/" . $file_name;
1736 $this->createFromXMLFile($xml_file,
true);
1740 $this->writeCSSFile();
1749 bool $a_skip_parent_create =
false
1753 $this->is_3_10_skin =
false;
1755 if (!$a_skip_parent_create) {
1759 $importParser->startParsing();
1762 foreach ($this->style as $style) {
1763 foreach ($style as $tag) {
1764 $id =
$ilDB->nextId(
"style_parameter");
1767 if (in_array($tag[
"class"], array(
"PageFrame",
"PageContainer")) &&
1768 $tag[
"tag"] ==
"table") {
1769 $tag[
"tag"] =
"div";
1770 if ($tag[
"parameter"] ==
"width" && $tag[
"value"] ==
"100%") {
1775 if ($tag[
"type"] ===
"text_block" && $tag[
"tag"] ===
"div") {
1779 $q =
"INSERT INTO style_parameter (id,style_id, tag, class, parameter, type, value, custom) VALUES " .
1781 $ilDB->quote(
$id,
"integer") .
"," .
1782 $ilDB->quote($this->
getId(),
"integer") .
"," .
1783 $ilDB->quote($tag[
"tag"],
"text") .
"," .
1784 $ilDB->quote($tag[
"class"],
"text") .
"," .
1785 $ilDB->quote($tag[
"parameter"],
"text") .
"," .
1786 $ilDB->quote($tag[
"type"],
"text") .
"," .
1787 $ilDB->quote($tag[
"value"],
"text") .
"," .
1788 $ilDB->quote((
bool) $tag[
"custom"],
"integer") .
1795 $this->is_3_10_skin =
true;
1796 foreach ($this->chars as $char) {
1797 if ($char[
"type"] !=
"") {
1798 $s = substr($char[
"class"], strlen($char[
"class"]) - 6);
1799 if ($s !=
":hover") {
1803 "style_id" => array(
"integer", $this->
getId()),
1804 "type" => array(
"text", $char[
"type"]),
1805 "characteristic" => array(
"text",
ilStr::subStr($char[
"class"], 0, 30))),
1806 array(
"hide" => array(
"integer", 0))
1808 $this->is_3_10_skin =
false;
1814 $q =
"INSERT INTO style_data (id, uptodate) VALUES " .
1815 "(" .
$ilDB->quote($this->
getId(),
"integer") .
", 0)";
1817 $this->domain->style($this->
getId())->createRid();
1822 if ($this->is_3_10_skin) {
1823 $this->do_3_10_Migration();
1835 foreach (self::$parameter as $parameter => $props) {
1836 $groups[$props[
"group"]][] = $parameter;
1843 $input = self::$parameter[$par][
"input"];
1849 $subpar = self::$parameter[$par][
"subpar"];
1857 return self::$parameter;
1860 foreach (self::$parameter as $k => $v) {
1861 if (isset(self::$filtered_groups[$v[
"group"]]) &&
1862 !in_array($a_tag, self::$filtered_groups[$v[
"group"]])) {
1872 return self::$filtered_groups;
1876 bool $a_no_percentage =
false
1878 if ($a_no_percentage) {
1879 return self::$num_unit_no_perc;
1881 return self::$num_unit;
1887 return self::$parameter[$par][
"values"];
1892 return self::$style_super_types;
1897 return in_array($a_type, self::$expandable_types);
1902 return in_array($a_type, self::$hideable_types);
1908 foreach (self::$style_super_types as $s => $t) {
1909 if (in_array($a_type, $t)) {
1912 if ($a_type == $s) {
1921 $c_styles = array();
1922 foreach (self::$core_styles as $cstyle) {
1924 = array(
"type" => $cstyle[
"type"],
1926 "class" => $cstyle[
"class"]);
1935 foreach (self::$core_styles as $s) {
1936 if ($s[
"type"] == $a_type && $s[
"class"] == $a_class) {
1947 string $a_template_type =
""
1949 if ($a_template_type ==
"") {
1950 return self::$templates;
1952 return self::$templates[$a_template_type];
1957 return self::$pseudo_classes[$tag] ?? [];
1965 return self::$templates[$t][$k];
1970 return self::$assigned_tags[$a_type];
1976 foreach (self::$parameter as $p => $v) {
1977 $pars[$p] = $v[
"values"];
1989 $styles = array(array(
"id" => $a_id));
1998 ?array $a_styles =
null
2004 if (is_null($a_styles)) {
2007 $styles = $a_styles;
2013 $core_images = array();
2014 $core_dir = self::$basic_style_image_dir;
2015 if (is_dir($core_dir)) {
2016 $dir = opendir($core_dir);
2017 while ($file = readdir($dir)) {
2018 if (substr($file, 0, 1) !=
"." && is_file($core_dir .
"/" . $file)) {
2019 $core_images[] = $file;
2024 foreach ($styles as $style) {
2027 foreach ($core_styles as $cs) {
2029 $set =
$ilDB->queryF(
2030 "SELECT * FROM style_char WHERE style_id = %s " .
2031 "AND type = %s AND characteristic = %s",
2032 array(
"integer",
"text",
"text"),
2033 array(
$id, $cs[
"type"], $cs[
"class"])
2037 if (!($rec =
$ilDB->fetchAssoc($set))) {
2039 "INSERT INTO style_char (style_id, type, characteristic) " .
2040 " VALUES (%s,%s,%s) ",
2041 array(
"integer",
"text",
"text"),
2042 array(
$id, $cs[
"type"], $cs[
"class"])
2045 $xpath =
new DOMXPath($bdom);
2046 $par_nodes = $xpath->query(
"/StyleSheet/Style[@Tag = '" . $cs[
"tag"] .
"' and @Type='" .
2047 $cs[
"type"] .
"' and @Class='" . $cs[
"class"] .
"']/StyleParameter");
2048 foreach ($par_nodes as $par_node) {
2050 $set =
$ilDB->queryF(
2051 "SELECT * FROM style_parameter WHERE style_id = %s " .
2052 "AND type = %s AND class = %s AND tag = %s AND parameter = %s",
2053 array(
"integer",
"text",
"text",
"text",
"text"),
2054 array(
$id, $cs[
"type"], $cs[
"class"],
2055 $cs[
"tag"], $par_node->getAttribute(
"Name"))
2059 if (!(
$ilDB->fetchAssoc($set))) {
2060 $spid =
$ilDB->nextId(
"style_parameter");
2061 $st =
$ilDB->manipulateF(
2062 "INSERT INTO style_parameter (id, style_id, type, class, tag, parameter, value) " .
2063 " VALUES (%s,%s,%s,%s,%s,%s,%s)",
2064 array(
"integer",
"integer",
"text",
"text",
"text",
"text",
"text"),
2065 array($spid,
$id, $cs[
"type"], $cs[
"class"], $cs[
"tag"],
2066 $par_node->getAttribute(
"Name"), $par_node->getAttribute(
"Value"))
2076 foreach ($core_images as $cim) {
2077 if (!is_file($imdir .
"/" . $cim)) {
2078 copy($core_dir .
"/" . $cim, $imdir .
"/" . $cim);
2095 $this->do_3_9_Migration($this->
getId());
2097 $this->do_3_10_CharMigration($this->
getId());
2100 $st =
$ilDB->prepareManip(
"UPDATE style_char SET type = ? WHERE characteristic = ?" .
2101 " AND style_id = ? ", array(
"text",
"text",
"integer"));
2102 $ilDB->execute($st, array(
"media_cont",
"Media", $this->
getId()));
2103 $ilDB->execute($st, array(
"media_caption",
"MediaCaption", $this->
getId()));
2104 $ilDB->execute($st, array(
"page_fn",
"Footnote", $this->
getId()));
2105 $ilDB->execute($st, array(
"page_nav",
"LMNavigation", $this->
getId()));
2106 $ilDB->execute($st, array(
"page_title",
"PageTitle", $this->
getId()));
2107 $ilDB->execute($st, array(
"page_cont",
"Page", $this->
getId()));
2110 $st =
$ilDB->prepareManip(
"UPDATE style_parameter SET type = ? WHERE class = ?" .
2111 " AND style_id = ? ", array(
"text",
"text",
"integer"));
2112 $ilDB->execute($st, array(
"media_cont",
"Media", $this->
getId()));
2113 $ilDB->execute($st, array(
"media_caption",
"MediaCaption", $this->
getId()));
2114 $ilDB->execute($st, array(
"page_fn",
"Footnote", $this->
getId()));
2115 $ilDB->execute($st, array(
"page_nav",
"LMNavigation", $this->
getId()));
2116 $ilDB->execute($st, array(
"page_title",
"PageTitle", $this->
getId()));
2117 $ilDB->execute($st, array(
"table",
"Page", $this->
getId()));
2119 $st =
$ilDB->prepareManip(
"UPDATE style_parameter SET tag = ? WHERE class = ?" .
2120 " AND style_id = ? ", array(
"text",
"text",
"integer"));
2121 $ilDB->execute($st, array(
"div",
"MediaCaption", $this->
getId()));
2124 $st =
$ilDB->prepareManip(
"UPDATE style_char SET characteristic = ? WHERE characteristic = ?" .
2125 " AND style_id = ? ", array(
"text",
"text",
"integer"));
2126 $ilDB->execute($st, array(
"MediaContainer",
"Media", $this->
getId()));
2127 $ilDB->execute($st, array(
"PageContainer",
"Page", $this->
getId()));
2130 $st =
$ilDB->prepareManip(
"UPDATE style_parameter SET class = ? WHERE class = ?" .
2131 " AND style_id = ? ", array(
"text",
"text",
"integer"));
2132 $ilDB->execute($st, array(
"MediaContainer",
"Media", $this->
getId()));
2133 $ilDB->execute($st, array(
"PageContainer",
"Page", $this->
getId()));
2136 $st =
$ilDB->prepareManip(
"DELETE FROM style_char WHERE type = ?" .
2137 " AND style_id = ? ", array(
"text",
"integer"));
2138 $ilDB->execute($st, array(
"page_cont", $this->
getId()));
2139 $st =
$ilDB->prepareManip(
"DELETE FROM style_parameter WHERE type = ?" .
2140 " AND style_id = ? ", array(
"text",
"integer"));
2141 $ilDB->execute($st, array(
"page_cont", $this->
getId()));
2155 $add_str =
" AND style_id = " .
$ilDB->quote($a_id,
"integer");
2158 $set =
$ilDB->query(
$q =
"SELECT DISTINCT style_id, tag, class FROM style_parameter WHERE " .
2159 $ilDB->equals(
"type",
"",
"text",
true) .
" " . $add_str);
2161 while ($rec =
$ilDB->fetchAssoc($set)) {
2164 switch ($rec[
"tag"]) {
2167 if (in_array($rec[
"class"], array(
"Headline3",
"Headline1",
2168 "Headline2",
"TableContent",
"List",
"Standard",
"Remark",
2169 "Additional",
"Mnemonic",
"Citation",
"Example"))) {
2170 $types[] =
"text_block";
2172 if (in_array($rec[
"class"], array(
"Block",
"Remark",
2173 "Additional",
"Mnemonic",
"Example",
"Excursus",
"Special"))) {
2174 $types[] =
"section";
2176 if (in_array($rec[
"class"], array(
"Page",
"Footnote",
"PageTitle",
"LMNavigation"))) {
2182 $types[] =
"table_cell";
2186 if (in_array($rec[
"class"], array(
"ExtLink",
"IntLink",
"FootnoteLink"))) {
2192 $types[] =
"text_inline";
2201 foreach ($types as $t) {
2203 $set4 =
$ilDB->queryF(
2204 "SELECT * FROM style_char " .
2205 " WHERE style_id = %s AND type = %s AND characteristic = %s",
2206 array(
"integer",
"text",
"text"),
2207 array($rec[
"style_id"], $t, $rec[
"class"])
2209 if ($rec4 =
$ilDB->fetchAssoc($set4)) {
2214 "INSERT INTO style_char " .
2215 " (style_id, type, characteristic) VALUES " .
2217 array(
"integer",
"text",
"text"),
2218 array($rec[
"style_id"], $t, $rec[
"class"])
2224 if ($rec[
"type"] ==
"") {
2225 if (count($types) > 0) {
2227 "UPDATE style_parameter SET type = %s " .
2228 " WHERE style_id = %s AND class = %s AND " .
$ilDB->equals(
"type",
"",
"text",
true),
2229 array(
"text",
"integer",
"text"),
2230 array($types[0], $rec[
"style_id"], $rec[
"class"])
2235 if ($types[0] ==
"link") {
2237 "UPDATE style_parameter SET type = %s " .
2238 " WHERE style_id = %s AND (class = %s OR class = %s) AND " .
$ilDB->equals(
"type",
"",
"text",
true),
2239 array(
"text",
"integer",
"text",
"text"),
2240 array($types[0], $rec[
"style_id"], $rec[
"class"] .
":visited",
2241 $rec[
"class"] .
":hover")
2246 if (count($types) == 2) {
2249 $set2 =
$ilDB->queryF(
2250 "SELECT * FROM style_parameter " .
2251 " WHERE style_id = %s AND class = %s AND type = %s",
2252 array(
"integer",
"text",
"text"),
2253 array($rec[
"style_id"], $rec[
"class"], $types[0])
2255 while ($rec2 =
$ilDB->fetchAssoc($set2)) {
2257 $set3 =
$ilDB->queryF(
2258 "SELECT * FROM style_parameter " .
2259 " WHERE style_id = %s AND tag = %s AND class = %s AND type = %s AND parameter = %s",
2260 array(
"integer",
"text",
"text",
"text",
"text"),
2261 array($rec[
"style_id"], $rec[
"tag"], $rec[
"class"], $types[1], $rec[
"parameter"])
2263 if ($rec3 =
$ilDB->fetchAssoc($set3)) {
2266 $nid =
$ilDB->nextId(
"style_parameter");
2268 "INSERT INTO style_parameter " .
2269 " (id, style_id, tag, class, parameter, value, type) VALUES " .
2270 " (%s, %s,%s,%s,%s,%s,%s) ",
2271 array(
"integer",
"integer",
"text",
"text",
"text",
"text",
"text"),
2272 array($nid, $rec2[
"style_id"], $rec2[
"tag"], $rec2[
"class"],
2273 $rec2[
"parameter"], $rec2[
"value"], $types[1])
2289 $classes = array(
"Example",
"Additional",
"Citation",
"Mnemonic",
"Remark");
2290 $pars = array(
"margin-top",
"margin-bottom");
2292 foreach ($classes as $curr_class) {
2293 foreach ($pars as $curr_par) {
2294 $res2 =
$ilDB->queryF(
2295 "SELECT id FROM style_parameter WHERE style_id = %s" .
2296 " AND tag = %s AND class= %s AND parameter = %s",
2297 array(
"integer",
"text",
"text",
"text"),
2298 array($a_id,
"p", $curr_class, $curr_par)
2300 if ($row2 =
$ilDB->fetchAssoc($res2)) {
2302 "UPDATE style_parameter SET value= %s WHERE id = %s",
2303 array(
"text",
"integer"),
2304 array(
"10px", $row2[
"id"])
2307 $nid =
$ilDB->nextId(
"style_parameter");
2309 "INSERT INTO style_parameter " .
2310 "(id, style_id, tag, class, parameter,value) VALUES (%s,%s,%s,%s,%s,%s)",
2311 array(
"integer",
"integer",
"text",
"text",
"text",
"text"),
2312 array($nid, $a_id,
"div", $curr_class, $curr_par,
"10px")
2319 "UPDATE style_parameter SET tag = %s WHERE tag = %s and style_id = %s",
2320 array(
"text",
"text",
"integer"),
2321 array(
"div",
"p", $a_id)
2336 $set =
$ilDB->query(
"SELECT * FROM style_color WHERE " .
2337 "style_id = " .
$ilDB->quote($this->getId(),
"integer") .
" " .
2338 "ORDER BY color_name");
2341 while ($rec =
$ilDB->fetchAssoc($set)) {
2343 "name" => $rec[
"color_name"],
2344 "code" => $rec[
"color_code"]
2358 $ilDB->manipulate(
"DELETE FROM style_color WHERE " .
2359 " style_id = " .
$ilDB->quote($this->getId(),
"integer") .
" AND " .
2360 " color_name = " .
$ilDB->quote($a_name,
"text"));
2367 $pos = strpos($a_name,
"(");
2369 $a_i = substr($a_name, $pos + 1);
2370 $a_i = str_replace(
")",
"", $a_i);
2371 $a_name = substr($a_name, 0, $pos);
2374 $set =
$ilDB->query(
"SELECT color_code FROM style_color WHERE " .
2375 " style_id = " .
$ilDB->quote($this->getId(),
"integer") .
" AND " .
2376 " color_name = " .
$ilDB->quote($a_name,
"text"));
2377 if ($rec =
$ilDB->fetchAssoc($set)) {
2379 return "#" . $rec[
"color_code"];
2401 $hls[
"l"] = $hls[
"l"] + ((255 - $hls[
"l"]) * ($a_i / 100));
2404 $hls[
"l"] = $hls[
"l"] - (($hls[
"l"]) * (-$a_i / 100));
2409 foreach ($rgb as $k => $v) {
2410 $rgb[$k] = str_pad(dechex((
int) $v), 2,
"0", STR_PAD_LEFT);
2413 return $rgb[
"r"] . $rgb[
"g"] . $rgb[
"b"];
2421 bool $as_dec =
false
2423 $r[
"r"] = substr($a_rgb, 0, 2);
2424 $r[
"g"] = substr($a_rgb, 2, 2);
2425 $r[
"b"] = substr($a_rgb, 4, 2);
2427 $r[
"r"] = self::hexdec($r[
"r"]);
2428 $r[
"g"] = self::hexdec($r[
"g"]);
2429 $r[
"b"] = self::hexdec($r[
"b"]);
2437 $hex = preg_replace(
"/[^a-fA-F0-9]+/",
"", $hex);
2441 return (
int) hexdec($hex);
2449 $r = $a_rgb[
"r"] / 255;
2450 $g = $a_rgb[
"g"] / 255;
2451 $b = $a_rgb[
"b"] / 255;
2455 $max = max($r, $g,
$b);
2456 $min = min($r, $g,
$b);
2459 $l = ($max + $min) / 2;
2465 $s = ($max - $min) / ($max + $min);
2467 $s = ($max - $min) / (2.0 - $max - $min);
2471 $h = ($g -
$b) / ($max - $min);
2472 } elseif ($g == $max) {
2473 $h = 2.0 + (
$b - $r) / ($max - $min);
2474 } elseif (
$b == $max) {
2475 $h = 4.0 + ($r - $g) / ($max - $min);
2479 $hls[
"h"] = round(($h / 6) * 255);
2480 $hls[
"l"] = round($l * 255);
2481 $hls[
"s"] = round($s * 255);
2491 $h = $a_hls[
"h"] / 255;
2492 $l = $a_hls[
"l"] / 255;
2493 $s = $a_hls[
"s"] / 255;
2496 $rgb[
"r"] = $rgb[
"g"] = $rgb[
"b"] = 0;
2500 $rgb[
"r"] = $rgb[
"g"] = $rgb[
"b"] = $l;
2503 $temp2 = $l * (1.0 + $s);
2505 $temp2 = $l + $s - $l * $s;
2508 $temp1 = 2.0 * $l - $temp2;
2511 # For each of R, G, B, compute another temporary value, temp3, as follows:
2512 foreach ($rgb as $k => $v) {
2515 $temp3 = $h + 1.0 / 3.0;
2523 $temp3 = $h - 1.0 / 3.0;
2527 $temp3 = $temp3 + 1.0;
2530 $temp3 = $temp3 - 1.0;
2533 if (6.0 * $temp3 < 1) {
2534 $rgb[$k] = $temp1 + ($temp2 - $temp1) * 6.0 * $temp3;
2535 } elseif (2.0 * $temp3 < 1) {
2537 } elseif (3.0 * $temp3 < 2) {
2538 $rgb[$k] = $temp1 + ($temp2 - $temp1) * ((2.0 / 3.0) - $temp3) * 6.0;
2545 $rgb[
"r"] = round($rgb[
"r"] * 255);
2546 $rgb[
"g"] = round($rgb[
"g"] * 255);
2547 $rgb[
"b"] = round($rgb[
"b"] * 255);
2564 $set =
$ilDB->query(
"SELECT * FROM sty_media_query WHERE " .
2565 "style_id = " .
$ilDB->quote($this->getId(),
"integer") .
" " .
2566 "ORDER BY order_nr");
2569 while ($rec =
$ilDB->fetchAssoc($set)) {
2582 $id =
$ilDB->nextId(
"sty_media_query");
2583 if ($order_nr == 0) {
2584 $order_nr = $this->getMaxMQueryOrderNr() + 10;
2587 $ilDB->manipulate(
"INSERT INTO sty_media_query (id, style_id, mquery, order_nr)" .
2589 $ilDB->quote(
$id,
"integer") .
"," .
2590 $ilDB->quote($this->getId(),
"integer") .
"," .
2591 $ilDB->quote($a_mquery,
"text") .
"," .
2592 $ilDB->quote($order_nr,
"integer") .
2605 $set =
$ilDB->query(
2606 "SELECT max(order_nr) mnr FROM sty_media_query " .
2607 " WHERE style_id = " .
$ilDB->quote($this->getId(),
"integer")
2609 $rec =
$ilDB->fetchAssoc($set);
2611 return (
int) $rec[
"mnr"];
2621 "UPDATE sty_media_query SET " .
2622 " mquery = " .
$ilDB->quote($a_mquery,
"text") .
2623 " WHERE id = " .
$ilDB->quote($a_id,
"integer")
2638 $set =
$ilDB->query(
2639 "SELECT * FROM sty_media_query " .
2640 " WHERE id = " .
$ilDB->quote($a_id,
"integer")
2642 return $ilDB->fetchAssoc($set);
2656 "DELETE FROM sty_media_query WHERE " .
2657 " style_id = " .
$ilDB->quote($this->getId(),
"integer") .
2658 " AND id = " .
$ilDB->quote($a_id,
"integer")
2660 $this->saveMediaQueryOrder();
2667 ?array $a_order_nr =
null
2671 $mqueries = $this->getMediaQueries();
2672 if (is_array($a_order_nr)) {
2673 foreach ($mqueries as $k => $mq) {
2674 $mqueries[$k][
"order_nr"] = $a_order_nr[$mq[
"id"]];
2679 foreach ($mqueries as $mq) {
2681 "UPDATE sty_media_query SET " .
2682 " order_nr = " .
$ilDB->quote($cnt,
"integer") .
2683 " WHERE id = " .
$ilDB->quote($mq[
"id"],
"integer")
2702 $set =
$ilDB->query(
"SELECT * FROM style_template WHERE " .
2703 "style_id = " .
$ilDB->quote($this->getId(),
"integer") .
" AND " .
2704 "temp_type = " .
$ilDB->quote($a_type,
"text") .
" " .
2707 $templates = array();
2708 while ($rec =
$ilDB->fetchAssoc($set)) {
2709 $rec[
"classes"] = $this->getTemplateClasses((
int) $rec[
"id"]);
2710 $templates[] = $rec;
2723 $set =
$ilDB->query(
"SELECT * FROM style_template_class WHERE " .
2724 "template_id = " .
$ilDB->quote($a_tid,
"integer"));
2727 while ($rec =
$ilDB->fetchAssoc($set)) {
2728 $key = $rec[
"class_type"];
2729 $class[$key] = $rec[
"class"];
2746 $tid =
$ilDB->nextId(
"style_template");
2747 $ilDB->manipulate(
"INSERT INTO style_template " .
2748 "(id, style_id, name, temp_type)" .
2750 $ilDB->quote($tid,
"integer") .
"," .
2751 $ilDB->quote($this->getId(),
"integer") .
"," .
2752 $ilDB->quote($a_name,
"text") .
"," .
2753 $ilDB->quote($a_type,
"text") .
2756 foreach ($a_classes as $t =>
$c) {
2757 $ilDB->manipulate(
"INSERT INTO style_template_class " .
2758 "(template_id, class_type, class)" .
2760 $ilDB->quote($tid,
"integer") .
"," .
2761 $ilDB->quote($t,
"text") .
"," .
2766 $this->writeTemplatePreview(
2784 $ilDB->manipulate(
"UPDATE style_template SET " .
2785 "name = " .
$ilDB->quote($a_name,
"text") .
2786 " WHERE id = " .
$ilDB->quote($a_t_id,
"integer"));
2789 "DELETE FROM style_template_class WHERE " .
2790 "template_id = " .
$ilDB->quote($a_t_id,
"integer")
2792 foreach ($a_classes as $t =>
$c) {
2793 $ilDB->manipulate(
"INSERT INTO style_template_class " .
2794 "(template_id, class_type, class)" .
2796 $ilDB->quote($a_t_id,
"integer") .
"," .
2797 $ilDB->quote($t,
"text") .
"," .
2810 $ilDB->manipulate(
"INSERT INTO style_template_class " .
2811 "(template_id, class_type, class)" .
2813 $ilDB->quote($a_t_id,
"integer") .
"," .
2814 $ilDB->quote($a_type,
"text") .
"," .
2815 $ilDB->quote($a_class,
"text") .
2823 string $a_template_name
2827 $set =
$ilDB->query(
"SELECT * FROM style_template WHERE " .
2828 "style_id = " .
$ilDB->quote($this->getId(),
"integer") .
" AND " .
2829 "name = " .
$ilDB->quote($a_template_name,
"text"));
2830 if (
$ilDB->fetchAssoc($set)) {
2843 $set =
$ilDB->query(
"SELECT * FROM style_template WHERE " .
2844 "style_id = " .
$ilDB->quote($this->getId(),
"integer") .
" " .
2845 " AND id = " .
$ilDB->quote($a_t_id,
"integer"));
2847 if ($rec =
$ilDB->fetchAssoc($set)) {
2848 $rec[
"classes"] = $this->getTemplateClasses((
int) $rec[
"id"]);
2861 return self::_lookupTemplateName($a_t_id);
2873 $set =
$ilDB->query(
"SELECT name FROM style_template WHERE " .
2874 " id = " .
$ilDB->quote($a_t_id,
"integer"));
2876 if ($rec =
$ilDB->fetchAssoc($set)) {
2877 return $rec[
"name"];
2890 $tag =
"<StyleTemplates>";
2892 $ttypes = array(
"table",
"vaccordion",
"haccordion",
"carousel");
2894 foreach ($ttypes as $ttype) {
2895 $ts = $this->getTemplates($ttype);
2897 foreach ($ts as $t) {
2911 $tag .=
'<StyleTemplate Name="' . $t[
"name"] .
'">';
2913 foreach ($atts as $type => $t2) {
2914 if ((
$c[$type] ??
"") !=
"") {
2915 $tag .=
'<StyleClass Type="' . $type .
'" Value="' .
$c[$type] .
'" />';
2919 $tag .=
"</StyleTemplate>";
2923 $tag .=
"</StyleTemplates>";
2934 string $a_preview_html
2937 $a_preview_html = str_replace(
' width=""',
"", $a_preview_html);
2938 $a_preview_html = str_replace(
' valign="top"',
"", $a_preview_html);
2939 $a_preview_html = str_replace(
'<div class="ilc_text_block_TableContent">',
"<div>", $a_preview_html);
2942 if (strlen($a_preview_html) > 4000) {
2944 $a_preview_html =
"";
2946 $ilDB->manipulate(
"UPDATE style_template SET " .
2947 "preview = " .
$ilDB->quote($a_preview_html,
"text") .
2948 " WHERE id = " .
$ilDB->quote($a_t_id,
"integer"));
2958 $set =
$ilDB->query(
"SELECT preview FROM style_template " .
2959 " WHERE id = " .
$ilDB->quote($a_t_id,
"integer"));
2960 if ($rec =
$ilDB->fetchAssoc($set)) {
2961 return $rec[
"preview"] ??
"";
2978 $set =
$ilDB->query(
"SELECT id FROM style_template " .
2979 " WHERE style_id = " .
$ilDB->quote($a_style_id,
"integer") .
2980 " AND name = " .
$ilDB->quote($a_name,
"text"));
2981 if ($rec =
$ilDB->fetchAssoc($set)) {
2982 return (
int) $rec[
"id"];
2995 $ilDB->manipulate(
"DELETE FROM style_template WHERE " .
2996 " style_id = " .
$ilDB->quote($this->getId(),
"integer") .
" AND " .
2997 " id = " .
$ilDB->quote($a_t_id,
"integer"));
3000 "DELETE FROM style_template_class WHERE " .
3001 "template_id = " .
$ilDB->quote($a_t_id,
"integer")
3012 "DELETE FROM style_setting WHERE " .
3013 " style_id = " .
$ilDB->quote($this->getId(),
"integer") .
3014 " AND name = " .
$ilDB->quote($a_name,
"text")
3017 $ilDB->manipulate(
"INSERT INTO style_setting " .
3018 "(style_id, name, value) VALUES (" .
3019 $ilDB->quote($this->getId(),
"integer") .
"," .
3020 $ilDB->quote($a_name,
"text") .
"," .
3021 $ilDB->quote($a_value,
"text") .
3032 $set =
$ilDB->query(
3033 "SELECT value FROM style_setting " .
3034 " WHERE style_id = " .
$ilDB->quote($this->getId(),
"integer") .
3035 " AND name = " .
$ilDB->quote($a_name,
"text")
3037 $rec =
$ilDB->fetchAssoc($set);
3039 return $rec[
"value"] ??
'';
3056 "obj_id" => array(
"integer", $a_obj_id)),
3058 "style_id" => array(
"integer", $a_style_id))
3072 $set =
$ilDB->query(
3073 "SELECT style_id FROM style_usage " .
3074 " WHERE obj_id = " .
$ilDB->quote($a_obj_id,
"integer")
3076 $rec =
$ilDB->fetchAssoc($set);
3077 if (!is_array($rec)) {
3082 return (
int) $rec[
"style_id"];
3101 $set =
$ilDB->query(
3102 "SELECT DISTINCT obj_id FROM style_usage " .
3103 " WHERE style_id = " .
$ilDB->quote($a_style_id,
"integer")
3106 while ($rec =
$ilDB->fetchAssoc($set)) {
3107 $obj_ids[] = (
int) $rec[
"obj_id"];
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
static sortArray(array $array, string $a_array_sortby_key, string $a_array_sortorder="asc", bool $a_numeric=false, bool $a_keep_keys=false)
static getWebspaceDir(string $mode="filesystem")
get webspace directory
static zip(string $a_dir, string $a_file, bool $compress_content=false)
static makeDir(string $a_dir)
creates a new directory and inherits all filesystem permissions of the parent directory You may pass ...
static delDir(string $a_dir, bool $a_clean_only=false)
removes a dir and all its content (subdirs and files) recursively
static getDataDir()
get data directory (outside webspace)
static moveUploadedFile(string $a_file, string $a_name, string $a_target, bool $a_raise_errors=true, string $a_mode="move_uploaded")
move uploaded file
static rCopy(string $a_sdir, string $a_tdir, bool $preserveTimeAttributes=false)
Copies content of a directory $a_sdir recursively to a directory $a_tdir.
static _deleteStyleAssignments(int $a_style_id)
delete all style references to style
static _lookupContObjIdByStyleId(int $a_style_id)
static _getTemplatePreview(ilObjStyleSheet $a_style, string $a_type, int $a_t_id, bool $a_small_mode=false)
Get table template preview.
handleXmlString(string $a_str)
getMediaQueryForId(int $a_id)
Get media query for id.
getHideStatus(string $a_type, string $a_char)
Get characteristic hidden status.
getMaxMQueryOrderNr()
Get maximum media query order nr.
static _explodeRGB(string $a_rgb, bool $as_dec=false)
Explode an RGB string into an array.
static _addMissingStyleClassesToAllStyles(?array $a_styles=null)
Add missing style classes to all styles todo: add mq_id and custom handling.
do_3_10_CharMigration(int $a_id=0)
This is more or less a copy of Services/Migration/DBUpdate_1385/classes ilStyleMigration->addMissingS...
static _lookupStandard(int $a_id)
Lookup standard flag.
static array $filtered_groups
static getBasicImageDir()
static _writeActive(int $a_id, bool $a_active)
static _lookupTemplateIdByName(int $a_style_id, string $a_name)
Lookup table template preview.
static getContentPrintStyle()
addTemplateClass(int $a_t_id, string $a_type, string $a_class)
read()
read style properties
updateStyleParameter(int $a_id, string $a_value)
update style parameter per id
saveMediaQueryOrder(?array $a_order_nr=null)
Save media query order.
static _getClonableContentStyles()
Get all clonable styles (active standard styles and individual learning module styles with write perm...
updateMediaQuery(int $a_id, string $a_mquery)
static _lookupActive(int $a_id)
Lookup active flag.
static string $basic_style_file
setUpToDate(bool $a_up_to_date=true)
Set style up to date (false + update will trigger css generation next time)
static _getFilteredGroups()
setExportSubDir(string $a_dir)
Set local directory, that will be included within the zip file.
writeCSSFile(string $a_target_file="", string $a_image_dir="")
write css file to webspace directory
static array $pseudo_classes
getColorCodeForName(string $a_name)
static array $expandable_types
setCharacteristics(array $a_chars)
static getContentStylePath(int $a_style_id, bool $add_random=true, bool $add_token=true)
get content style path static (to avoid full reading)
create(int $a_from_style=0, bool $a_import_mode=false)
Create a new style.
createFromXMLFile(string $a_file, bool $a_skip_parent_create=false)
create style from xml file todo: add mq_id and custom
getCharacteristics(string $a_type="", bool $a_no_hidden=false, bool $a_include_core=true)
Get characteristics.
static getBaseContentStylePath()
static _getPseudoClasses(string $tag)
static _writeScope(int $a_id, int $a_scope)
__construct(int $a_id=0, bool $a_call_by_reference=false)
characteristicExists(string $a_char, string $a_style_type)
Check whether characteristic exists.
static getAvailableParameters()
static string $basic_style_zip
ilClone()
clone style sheet (note: styles have no ref ids and return an object id)
static _createImagesDirectory(int $a_style_id)
Create images directory <data_dir>/sty/sty_<id>/images.
static hexdec(string $hex)
addTemplate(string $a_type, string $a_name, array $a_classes)
Add table template.
static _getStandardStyles(bool $a_exclude_default_style=false, bool $a_include_deactivated=false, int $a_scope=0)
Get standard styles.
static writeStyleUsage(int $a_obj_id, int $a_style_id)
Write style usage.
copyImagesToDir(string $a_target)
Copy images to directory.
static _getStyleParameterNumericUnits(bool $a_no_percentage=false)
static _getStyleParameterSubPar(string $par)
static _lookupUpToDate(int $a_id)
static isCoreStyle(string $a_type, string $a_class)
InternalDomainService $domain
static _getImagesDirectory(int $a_style_id)
getTemplateXML()
Get table template xml.
static _getStyleParameterInputType(string $par)
static _HLSToRGB(array $a_hls)
HLS to RGB (both arrays, 0..255)
static array $assigned_tags
writeTemplatePreview(int $a_t_id, string $a_preview_html)
Write table template preview.
addMediaQuery(string $a_mquery, int $order_nr=0)
static array $core_styles
exportXML(string $a_dir)
export style xml file to directory
getStyleParameterGroups()
Get grouped parameter.
lookupTemplateName(int $a_t_id)
Lookup table template name for template ID.
static getEffectiveContentStyleId(int $a_style_id)
Get effective Style Id.
hasCharacteristic(string $type, string $char)
updateTemplate(int $a_t_id, string $a_name, array $a_classes)
Update table template.
getTemplateClasses(int $a_tid)
Get template classes.
getTemplates(string $a_type)
Get table templates of style.
deleteCustomStylePars(string $a_tag, string $a_class, string $a_type, int $a_mq_id=0)
Delete style parameter by tag/class/parameter.
static getSyntaxStylePath()
lookupStyleSetting(string $a_name)
Lookup style setting.
static lookupObjectForStyle(int $a_style_id)
Lookup objects for style.
getExportSubDir()
The local directory, that will be included within the zip file.
ILIAS Style Content InternalRepoService $repo
removeTemplate(int $a_t_id)
Remove table template.
addCharacteristic(string $a_type, string $a_char, bool $a_hidden=false, int $order_nr=0, bool $outdated=false)
static _addMissingStyleClassesToStyle(int $a_id)
Add missing style classes to all styles.
saveHideStatus(string $a_type, string $a_char, bool $a_hide)
Save characteristic hidden status.
static _getColorFlavor(string $a_rgb, int $a_i)
Get color flavor.
static _RGBToHLS(array $a_rgb)
RGB to HLS (both arrays, 0..255)
deleteStyleParOfChar(string $a_type, string $a_class)
Delete style parameters of characteristic.
static _writeStandard(int $a_id, bool $a_std)
Write standard flag.
getParametersOfClass(string $a_type, string $a_class, int $a_mq_id=0)
static getExportContentStylePath()
static array $num_unit_no_perc
static writeOwner($obj_id, $style_id)
static DOMDocument $basic_style_dom
do_3_10_Migration()
Migrates 3.10 style to 3.11 style.
static _determineTag(string $a_type)
templateExists(string $a_template_name)
Check whether template exists.
static string $basic_style_image_dir
deleteMediaQuery(int $a_id)
Delete media query.
deleteParameter(int $a_id)
delete style parameter
getColors()
Get colors of style.
static _isHideable(string $a_type)
createImagesDirectory()
Create images directory <data_dir>/sty/sty_<id>/images.
static _writeUpToDate(int $a_id, bool $a_up_to_date)
static array $hideable_types
static _getStyleSuperTypes()
removeColor(string $a_name)
Remove a color.
lookupTemplatePreview(int $a_t_id)
Lookup table template preview.
writeStyleSetting(string $a_name, string $a_value)
static lookupObjectStyle(int $a_obj_id)
Lookup object style.
addParameter(string $a_tag, string $a_par, string $a_type, int $a_mq_id=0, bool $a_custom=false)
write style parameter to db
static _getTemplateClassTypes(string $a_template_type="")
Get template class types.
static array $style_super_types
createExportSubDirectory()
determineTemplateStyleClassType(string $t, string $k)
static _getStyleSuperTypeForType(string $a_type)
getXML()
get xml representation of style object todo: add mq_id
static _getBasicStyleDom()
static _getStyleParameters(string $a_tag="")
static _isExpandable(string $a_type)
static _lookupTemplateName(int $a_t_id)
Lookup table template name for template ID.
do_3_9_Migration(int $a_id)
Migrate old 3.9 styles.
static _getStyleParameterValues(string $par)
Class ilObject Basic functions for all objects.
static _lookupType(int $id, bool $reference=false)
static _getAllReferences(int $id)
get all reference ids for object ID
static _exists(int $id, bool $reference=false, ?string $type=null)
checks if an object exists in object_data
static _getObjectsDataForType(string $type, bool $omit_trash=false)
get all objects of a certain type
static _lookupTitle(int $obj_id)
static subStr(string $a_str, int $a_start, ?int $a_length=null)
return['delivery_method'=> 'php',]
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
Class ilObjForumAdministration.
if(!file_exists('../ilias.ini.php'))