ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
class.ilObjStyleSheetGUI.php
Go to the documentation of this file.
1<?php
2/* Copyright (c) 1998-2009 ILIAS open source, Extended GPL, see docs/LICENSE */
3
4require_once "./Services/Object/classes/class.ilObjectGUI.php";
5require_once "./Services/Style/Content/classes/class.ilObjStyleSheet.php";
6
17{
21 protected $rbacsystem;
22
26 protected $help;
27
31 protected $tabs;
32
36 protected $obj_definition;
37
42
47 public function __construct($a_data, $a_id, $a_call_by_reference, $a_prep = true)
48 {
49 global $DIC;
50
51 $this->tpl = $DIC["tpl"];
52 $this->rbacsystem = $DIC->rbac()->system();
53 $this->help = $DIC["ilHelp"];
54 $this->tabs = $DIC->tabs();
55 $this->toolbar = $DIC->toolbar();
56 $this->locator = $DIC["ilLocator"];
57 $this->tree = $DIC->repositoryTree();
58 $this->obj_definition = $DIC["objDefinition"];
59 $ilCtrl = $DIC->ctrl();
60 $lng = $DIC->language();
61 $tpl = $DIC["tpl"];
62
63 $this->ctrl = $ilCtrl;
64 $this->lng = $lng;
65 $this->lng->loadLanguageModule("style");
66 $ilCtrl->saveParameter($this, array("tag", "style_type", "temp_type"));
67 if ($_GET["style_type"] != "") {
68 $this->super_type = ilObjStyleSheet::_getStyleSuperTypeForType($_GET["style_type"]);
69 }
70
71 $this->type = "sty";
72 parent::__construct($a_data, $a_id, $a_call_by_reference, false);
73 }
74
78 public function executeCommand()
79 {
80 $next_class = $this->ctrl->getNextClass($this);
81 $cmd = $this->ctrl->getCmd("edit");
82
83 // #9440/#9489: prepareOutput will fail if not set properly
84 if (!$this->object) {
85 $this->setCreationMode(true);
86 }
87
88 $this->prepareOutput();
89 switch ($next_class) {
90 default:
91 $cmd .= "Object";
92 $ret = $this->$cmd();
93 break;
94 }
95
96 return $ret;
97 }
98
99 public function viewObject()
100 {
101 $this->editObject();
102 }
103
107 public function createObject()
108 {
112 $ilHelp = $this->help;
113
114 $forms = array();
115
116
117 $ilHelp->setScreenIdComponent("sty");
118 $ilHelp->setDefaultScreenId(ilHelpGUI::ID_PART_SCREEN, "create");
119
120 // --- create
121
122 include_once "Services/Form/classes/class.ilPropertyFormGUI.php";
123 $form = new ilPropertyFormGUI();
124 $form->setFormAction($this->ctrl->getFormAction($this));
125 $form->setTitle($this->lng->txt("sty_create_new_stylesheet"));
126
127 // title
128 $ti = new ilTextInputGUI($this->lng->txt("title"), "style_title");
129 $ti->setMaxLength(128);
130 $ti->setSize(40);
131 $ti->setRequired(true);
132 $form->addItem($ti);
133
134 // description
135 $ta = new ilTextAreaInputGUI($this->lng->txt("description"), "style_description");
136 $ta->setCols(40);
137 $ta->setRows(2);
138 $form->addItem($ta);
139
140 $form->addCommandButton("save", $this->lng->txt("save"));
141 $form->addCommandButton("cancel", $this->lng->txt("cancel"));
142
143 $forms[] = $form;
144
145
146 // --- import
147
148 include_once "Services/Form/classes/class.ilPropertyFormGUI.php";
149 $form = new ilPropertyFormGUI();
150 $form->setFormAction($this->ctrl->getFormAction($this));
151 $form->setTitle($this->lng->txt("sty_import_stylesheet"));
152
153 // title
154 $ti = new ilFileInputGUI($this->lng->txt("import_file"), "importfile");
155 $ti->setRequired(true);
156 $form->addItem($ti);
157
158 $form->addCommandButton("importStyle", $this->lng->txt("import"));
159 $form->addCommandButton("cancel", $this->lng->txt("cancel"));
160
161 $forms[] = $form;
162
163
164 // --- clone
165
166 include_once "Services/Form/classes/class.ilPropertyFormGUI.php";
167 $form = new ilPropertyFormGUI();
168 $form->setFormAction($this->ctrl->getFormAction($this));
169 $form->setTitle($this->lng->txt("sty_copy_other_stylesheet"));
170
171 // source
172 $ti = new ilSelectInputGUI($this->lng->txt("sty_source"), "source_style");
173 $ti->setRequired(true);
175 $form->addItem($ti);
176
177 $form->addCommandButton("copyStyle", $this->lng->txt("copy"));
178 $form->addCommandButton("cancel", $this->lng->txt("cancel"));
179
180 $forms[] = $form;
181
182
183 $this->tpl->setContent($this->getCreationFormsHTML($forms));
184 }
185
189 public function includeCSS()
190 {
191 // set style sheet
192 $this->tpl->setCurrentBlock("ContentStyle");
193 $this->tpl->setVariable(
194 "LOCATION_CONTENT_STYLESHEET",
195 ilObjStyleSheet::getContentStylePath($this->object->getId())
196 );
197 $this->tpl->parseCurrentBlock();
198 }
199
200
207 public function checkWrite()
208 {
210
211 return ($rbacsystem->checkAccess("write", (int) $_GET["ref_id"])
212 || $rbacsystem->checkAccess("sty_write_content", (int) $_GET["ref_id"]));
213 }
214
215
219 public function editObject()
220 {
223 $ilTabs = $this->tabs;
225 $ilToolbar = $this->toolbar;
227
228 $this->setSubTabs();
229
230 $this->includeCSS();
231
232 $ctpl = new ilTemplate("tpl.sty_classes.html", true, true, "Services/Style/Content");
233
234 // output characteristics
235 $chars = $this->object->getCharacteristics();
236
237 $style_type = ($this->super_type != "")
238 ? $this->super_type
239 : "text_block";
240 $ilCtrl->setParameter($this, "style_type", $style_type);
241 $ilTabs->setSubTabActive("sty_" . $style_type . "_char");
242
243 // workaround to include default rte styles
244 if ($this->super_type == "rte") {
245 $tpl->addCss("Modules/Scorm2004/templates/default/player.css");
246 include_once("./Modules/Scorm2004/classes/ilSCORM13Player.php");
247 $tpl->addInlineCss(ilSCORM13Player::getInlineCss());
248 }
249
250 // add new style?
251 $all_super_types = ilObjStyleSheet::_getStyleSuperTypes();
252 $subtypes = $all_super_types[$style_type];
253 $expandable = false;
254 foreach ($subtypes as $t) {
256 $expandable = true;
257 }
258 }
259 if ($expandable && $this->checkWrite()) {
260 $ilToolbar->addButton(
261 $lng->txt("sty_add_characteristic"),
262 $ilCtrl->getLinkTarget($this, "addCharacteristicForm")
263 );
264 }
265
266 if ($_SESSION["sty_copy"] != "") {
267 $style_cp = explode(":::", $_SESSION["sty_copy"]);
268 if ($style_cp[1] == $style_type) {
269 if ($expandable) {
270 $ilToolbar->addSeparator();
271 }
272 $ilToolbar->addButton(
273 $lng->txt("sty_paste_style_classes"),
274 $ilCtrl->getLinkTarget($this, "pasteCharacteristicsOverview")
275 );
276 }
277 }
278
279 include_once("./Services/Style/Content/classes/class.ilStyleTableGUI.php");
280 $table_gui = new ilStyleTableGUI(
281 $this,
282 "edit",
283 $chars,
284 $style_type,
285 $this->object
286 );
287
288 $ctpl->setCurrentBlock("style_table");
289 $ctpl->setVariable("STYLE_TABLE", $table_gui->getHTML());
290 $ctpl->parseCurrentBlock();
291
292 $this->tpl->setContent($ctpl->get());
293 }
294
298 public function propertiesObject()
299 {
302 $ilToolbar = $this->toolbar;
303
304 // set style sheet
305 $this->tpl->setCurrentBlock("ContentStyle");
306 $this->tpl->setVariable(
307 "LOCATION_CONTENT_STYLESHEET",
308 ilObjStyleSheet::getContentStylePath($this->object->getId())
309 );
310 $this->tpl->parseCurrentBlock();
311
312 // export button
313 $ilToolbar->addButton(
314 $this->lng->txt("export"),
315 $this->ctrl->getLinkTarget($this, "exportStyle")
316 );
317
318 $this->initPropertiesForm();
319 $this->getPropertiesValues();
320 $this->tpl->setContent($this->form->getHTML());
321 }
322
327 public function getPropertiesValues()
328 {
329 $values = array();
330
331 $values["style_title"] = $this->object->getTitle();
332 $values["style_description"] = $this->object->getDescription();
333 $values["disable_auto_margins"] = (int) $this->object->lookupStyleSetting("disable_auto_margins");
334
335 $this->form->setValuesByArray($values);
336 }
337
343 public function initPropertiesForm($a_mode = "edit")
344 {
347
348 include_once("Services/Form/classes/class.ilPropertyFormGUI.php");
349 $this->form = new ilPropertyFormGUI();
350
351 // title
352 $ti = new ilTextInputGUI($this->lng->txt("title"), "style_title");
353 $ti->setMaxLength(128);
354 $ti->setSize(40);
355 $ti->setRequired(true);
356 $this->form->addItem($ti);
357
358 // description
359 $ta = new ilTextAreaInputGUI($this->lng->txt("description"), "style_description");
360 //$ta->setCols();
361 //$ta->setRows();
362 $this->form->addItem($ta);
363
364 // disable automatic margins for left/right alignment
365 $cb = new ilCheckboxInputGUI($this->lng->txt("sty_disable_auto_margins"), "disable_auto_margins");
366 $cb->setInfo($this->lng->txt("sty_disable_auto_margins_info"));
367 $this->form->addItem($cb);
368
369 // save and cancel commands
370
371 if ($a_mode == "create") {
372 $this->form->addCommandButton("save", $lng->txt("save"));
373 $this->form->addCommandButton("cancelSave", $lng->txt("cancel"));
374 } else {
375 if ($this->checkWrite()) {
376 $this->form->addCommandButton("update", $lng->txt("save"));
377 }
378 }
379
380 $this->form->setTitle($lng->txt("edit_stylesheet"));
381 $this->form->setFormAction($this->ctrl->getFormAction($this));
382 }
383
387 public function updateObject()
388 {
392
393 $this->initPropertiesForm("edit");
394 if ($this->form->checkInput()) {
395 $this->object->setTitle($this->form->getInput("style_title"));
396 $this->object->setDescription($this->form->getInput("style_description"));
397 $this->object->writeStyleSetting(
398 "disable_auto_margins",
399 $this->form->getInput("disable_auto_margins")
400 );
401 $this->object->update();
402 ilUtil::sendInfo($lng->txt("msg_obj_modified"), true);
403 $ilCtrl->redirect($this, "properties");
404 } else {
405 $this->form->setValuesByPost();
406 $tpl->setContent($this->form->getHtml());
407 }
408 }
409
413 public function refreshTagStyleObject()
414 {
416
417 $cur = explode(".", $_GET["tag"]);
418 $cur_tag = $cur[0];
419 $cur_class = $cur[1];
420
421 $this->initTagStyleForm("edit", $cur_tag);
422
423 if ($this->form_gui->checkInput()) {
424 $this->saveTagStyle();
425 $ilCtrl->redirect($this, "editTagStyle");
426 } else {
427 $this->form_gui->setValuesByPost();
429 }
430 }
431
435 public function updateTagStyleObject()
436 {
438
439 $cur = explode(".", $_GET["tag"]);
440 $cur_tag = $cur[0];
441 $cur_class = $cur[1];
442
443 $this->initTagStyleForm("edit", $cur_tag);
444 if ($this->form_gui->checkInput()) {
445 $this->saveTagStyle();
446 $ilCtrl->redirect($this, "edit");
447 } else {
448 $this->form_gui->setValuesByPost();
450 }
451 }
452
456 public function saveTagStyle()
457 {
458 $cur = explode(".", $_GET["tag"]);
459 $cur_tag = $cur[0];
460 $cur_class = $cur[1];
461 $avail_pars = ilObjStyleSheet::_getStyleParameters($cur_tag);
462 foreach ($avail_pars as $par => $v) {
463 $var = str_replace("-", "_", $par);
464 $basepar_arr = explode(".", $par);
465 $basepar = $basepar_arr[0];
466 if ($basepar_arr[1] != "" && $basepar_arr[1] != $cur_tag) {
467 continue;
468 }
469
470 switch ($v["input"]) {
471 case "fontsize":
472 case "numeric_no_perc":
473 case "numeric":
474 case "background_image":
475 $in = $this->form_gui->getItemByPostVar($basepar);
476//echo "<br>-".$cur_tag."-".$cur_class."-".$basepar."-".$_GET["style_type"]."-";
477 $this->writeStylePar($cur_tag, $cur_class, $basepar, $in->getValue(), $_GET["style_type"], (int) $_GET["mq_id"]);
478 break;
479
480 case "color":
481 $color = trim($_POST[$basepar]);
482 if ($color != "" && trim(substr($color, 0, 1) != "!")) {
483 $color = "#" . $color;
484 }
485 $this->writeStylePar($cur_tag, $cur_class, $basepar, $color, $_GET["style_type"], (int) $_GET["mq_id"]);
486 break;
487
488 case "trbl_numeric":
489 case "border_width":
490 case "border_style":
491 $in = $this->form_gui->getItemByPostVar($basepar);
492 $this->writeStylePar($cur_tag, $cur_class, $v["subpar"][0], $in->getAllValue(), $_GET["style_type"], (int) $_GET["mq_id"]);
493 $this->writeStylePar($cur_tag, $cur_class, $v["subpar"][1], $in->getTopValue(), $_GET["style_type"], (int) $_GET["mq_id"]);
494 $this->writeStylePar($cur_tag, $cur_class, $v["subpar"][2], $in->getRightValue(), $_GET["style_type"], (int) $_GET["mq_id"]);
495 $this->writeStylePar($cur_tag, $cur_class, $v["subpar"][3], $in->getBottomValue(), $_GET["style_type"], (int) $_GET["mq_id"]);
496 $this->writeStylePar($cur_tag, $cur_class, $v["subpar"][4], $in->getLeftValue(), $_GET["style_type"], (int) $_GET["mq_id"]);
497 break;
498
499 case "trbl_color":
500 $in = $this->form_gui->getItemByPostVar($basepar);
501 $tblr_p = array(0 => "getAllValue", 1 => "getTopValue", 2 => "getRightValue",
502 3 => "getBottomValue", 4 => "getLeftValue");
503 foreach ($tblr_p as $k => $func) {
504 $val = trim($in->$func());
505 $val = (($in->getAcceptNamedColors() && substr($val, 0, 1) == "!")
506 || $val == "")
507 ? $val
508 : "#" . $val;
509 $this->writeStylePar($cur_tag, $cur_class, $v["subpar"][$k], $val, $_GET["style_type"], (int) $_GET["mq_id"]);
510 }
511 break;
512
513 case "background_position":
514 $in = $this->form_gui->getItemByPostVar($basepar);
515 $this->writeStylePar($cur_tag, $cur_class, $basepar, $in->getValue(), $_GET["style_type"], (int) $_GET["mq_id"]);
516 break;
517
518 default:
519 $this->writeStylePar($cur_tag, $cur_class, $basepar, $_POST[$basepar], $_GET["style_type"], (int) $_GET["mq_id"]);
520 break;
521 }
522 }
523
524 // write custom parameter
525 $this->object->deleteCustomStylePars($cur_tag, $cur_class, $_GET["style_type"], (int) $_GET["mq_id"]);
526 if (is_array($_POST["custom_par"])) {
527 foreach ($_POST["custom_par"] as $cpar) {
528 $par_arr = explode(":", $cpar);
529 if (count($par_arr) == 2) {
530 $par = trim($par_arr[0]);
531 $val = trim(str_replace(";", "", $par_arr[1]));
532 $this->writeStylePar($cur_tag, $cur_class, $par, $val, $_GET["style_type"], (int) $_GET["mq_id"], true);
533 }
534 }
535 }
536
537 $this->object->update();
538 }
539
540 public function writeStylePar($cur_tag, $cur_class, $par, $value, $a_type, $a_mq_id, $a_custom = false)
541 {
542 // echo $_GET["mq_id"]."-";
543 // echo $a_mq_id."-"; exit;
544 if ($a_type == "") {
545 return;
546 }
547
548 if ($value != "") {
549 $this->object->replaceStylePar($cur_tag, $cur_class, $par, $value, $a_type, $a_mq_id, $a_custom);
550 } else {
551 $this->object->deleteStylePar($cur_tag, $cur_class, $par, $a_type, $a_mq_id, $a_custom);
552 }
553 }
554
559 public function editTagStyleObject()
560 {
562 $ilToolbar = $this->toolbar;
565
566 // media query selector
567 $mqs = $this->object->getMediaQueries();
568 if (count($mqs) > 0) {
569 //
570 $options = array(
571 "" => $lng->txt("sty_default"),
572 );
573 foreach ($mqs as $mq) {
574 $options[$mq["id"]] = $mq["mquery"];
575 }
576 include_once("./Services/Form/classes/class.ilSelectInputGUI.php");
577 $si = new ilSelectInputGUI("@media", "mq_id");
578 $si->setOptions($options);
579 $si->setValue((int) $_GET["mq_id"]);
580 $ilToolbar->addInputItem($si, true);
581 $ilToolbar->setFormAction($ilCtrl->getFormAction($this));
582 $ilToolbar->addFormButton($lng->txt("sty_switch"), "switchMQuery");
583 }
584
585 // workaround to include default rte styles
586 //if (in_array($_GET["style_type"], array("rte_menu")))
587 if ($this->super_type == "rte") {
588 $tpl->addCss("Modules/Scorm2004/templates/default/player.css");
589 include_once("./Modules/Scorm2004/classes/ilSCORM13Player.php");
590 $tpl->addInlineCss(ilSCORM13Player::getInlineCss());
591 }
592
593 $cur = explode(".", $_GET["tag"]);
594 $cur_tag = $cur[0];
595 $cur_class = $cur[1];
596
597 $this->initTagStyleForm("edit", $cur_tag);
598 $this->getValues();
600 }
601
608 public function switchMQueryObject()
609 {
611
612 $ilCtrl->setParameter($this, "mq_id", (int) $_POST["mq_id"]);
613 $ilCtrl->redirect($this, "editTagStyle");
614 }
615
616
620 public function outputTagStyleEditScreen()
621 {
625
626 // set style sheet
627 $tpl->setCurrentBlock("ContentStyle");
628 $tpl->setVariable(
629 "LOCATION_CONTENT_STYLESHEET",
630 ilObjStyleSheet::getContentStylePath($this->object->getId())
631 );
632
633 $ts_tpl = new ilTemplate("tpl.style_tag_edit.html", true, true, "Services/Style/Content");
634
635 $cur = explode(".", $_GET["tag"]);
636 $cur_tag = $cur[0];
637 $cur_class = $cur[1];
638
639 $ts_tpl->setVariable(
640 "EXAMPLE",
641 ilObjStyleSheetGUI::getStyleExampleHTML($_GET["style_type"], $cur_class)
642 );
643
644 $ts_tpl->setVariable(
645 "FORM",
646 $this->form_gui->getHtml()
647 );
648
649 $tpl->setTitle($cur_class . " (" . $lng->txt("sty_type_" . $_GET["style_type"]) . ")");
650
651 $tpl->setContent($ts_tpl->get());
652 }
653
654
660 public function initTagStyleForm($a_mode, $a_cur_tag)
661 {
664
665 $ilCtrl->saveParameter($this, array("mq_id"));
666
667 include_once("Services/Form/classes/class.ilPropertyFormGUI.php");
668 $this->form_gui = new ilPropertyFormGUI();
669
670 $avail_pars = $this->object->getAvailableParameters();
671 $groups = $this->object->getStyleParameterGroups();
672
673 // output select lists
674 foreach ($groups as $k => $group) {
675 // filter groups of properties that should only be
676 // displayed with matching tag
677 $filtered_groups = ilObjStyleSheet::_getFilteredGroups();
678 if (is_array($filtered_groups[$k]) && !in_array($a_cur_tag, $filtered_groups[$k])) {
679 continue;
680 }
681
682 $sh = new ilFormSectionHeaderGUI();
683 $sh->setTitle($lng->txt("sty_" . $k));
684 $this->form_gui->addItem($sh);
685
686 foreach ($group as $par) {
687 $basepar = explode(".", $par);
688 $basepar = $basepar[0];
689
690 $var = str_replace("-", "_", $basepar);
691 $up_par = strtoupper($var);
692
694 case "select":
695 $sel_input = new ilSelectInputGUI($lng->txt("sty_" . $var), $basepar);
696 $options = array("" => "");
697 foreach ($avail_pars[$par] as $p) {
698 $options[$p] = $p;
699 }
700 $sel_input->setOptions($options);
701 $this->form_gui->addItem($sel_input);
702 break;
703
704 case "text":
705 $text_input = new ilTextInputGUI($lng->txt("sty_" . $var), $basepar);
706 $text_input->setMaxLength(200);
707 $text_input->setSize(20);
708 $this->form_gui->addItem($text_input);
709 break;
710
711 case "fontsize":
712 include_once("./Services/Style/Content/classes/class.ilFontSizeInputGUI.php");
713 $fs_input = new ilFontSizeInputGUI($lng->txt("sty_" . $var), $basepar);
714 $this->form_gui->addItem($fs_input);
715 break;
716
717 case "numeric_no_perc":
718 case "numeric":
719 include_once("./Services/Style/Content/classes/class.ilNumericStyleValueInputGUI.php");
720 $num_input = new ilNumericStyleValueInputGUI($lng->txt("sty_" . $var), $basepar);
721 if (ilObjStyleSheet::_getStyleParameterInputType($par) == "numeric_no_perc") {
722 $num_input->setAllowPercentage(false);
723 }
724 $this->form_gui->addItem($num_input);
725 break;
726
727 case "percentage":
728 $per_input = new ilNumberInputGUI($lng->txt("sty_" . $var), $basepar);
729 $per_input->setMinValue(0);
730 $per_input->setMaxValue(100);
731 $per_input->setMaxLength(3);
732 $per_input->setSize(3);
733 $this->form_gui->addItem($per_input);
734 break;
735
736 case "color":
737 //include_once("./Services/Style/classes/class.ilNumericStyleValueInputGUI.php");
738 $col_input = new ilColorPickerInputGUI($lng->txt("sty_" . $var), $basepar);
739 $col_input->setDefaultColor("");
740 $col_input->setAcceptNamedColors(true);
741 $this->form_gui->addItem($col_input);
742 break;
743
744 case "trbl_numeric":
745 include_once("./Services/Style/Content/classes/class.ilTRBLNumericStyleValueInputGUI.php");
746 $num_input = new ilTRBLNumericStyleValueInputGUI($lng->txt("sty_" . $var), $basepar);
747 if (ilObjStyleSheet::_getStyleParameterInputType($par) == "trbl_numeric_no_perc") {
748 $num_input->setAllowPercentage(false);
749 }
750 $this->form_gui->addItem($num_input);
751 break;
752
753 case "border_width":
754 include_once("./Services/Style/Content/classes/class.ilTRBLBorderWidthInputGUI.php");
755 $bw_input = new ilTRBLBorderWidthInputGUI($lng->txt("sty_" . $var), $basepar);
756 $this->form_gui->addItem($bw_input);
757 break;
758
759 case "border_style":
760 include_once("./Services/Style/Content/classes/class.ilTRBLBorderStyleInputGUI.php");
761 $bw_input = new ilTRBLBorderStyleInputGUI($lng->txt("sty_" . $var), $basepar);
762 $this->form_gui->addItem($bw_input);
763 break;
764
765 case "trbl_color":
766 include_once("./Services/Style/Content/classes/class.ilTRBLColorPickerInputGUI.php");
767 $col_input = new ilTRBLColorPickerInputGUI($lng->txt("sty_" . $var), $basepar);
768 $col_input->setAcceptNamedColors(true);
769 $this->form_gui->addItem($col_input);
770 break;
771
772 case "background_image":
773 include_once("./Services/Style/Content/classes/class.ilBackgroundImageInputGUI.php");
774 $im_input = new ilBackgroundImageInputGUI($lng->txt("sty_" . $var), $basepar);
775 $imgs = array();
776 foreach ($this->object->getImages() as $entry) {
777 $imgs[] = $entry["entry"];
778 }
779 $im_input->setImages($imgs);
780 $this->form_gui->addItem($im_input);
781 break;
782
783 case "background_position":
784 include_once("./Services/Style/Content/classes/class.ilBackgroundPositionInputGUI.php");
785 $im_input = new ilBackgroundPositionInputGUI($lng->txt("sty_" . $var), $basepar);
786 $this->form_gui->addItem($im_input);
787 break;
788 }
789 }
790 }
791
792 // custom parameters
793 $sh = new ilFormSectionHeaderGUI();
794 $sh->setTitle($lng->txt("sty_custom"));
795 $this->form_gui->addItem($sh);
796
797 // custom parameters
798 $ti = new ilTextInputGUI($this->lng->txt("sty_custom_par"), "custom_par");
799 $ti->setMaxLength(300);
800 $ti->setSize(80);
801 $ti->setMulti(true);
802 $ti->setInfo($this->lng->txt("sty_custom_par_info"));
803 $this->form_gui->addItem($ti);
804
805
806 // save and cancel commands
807 $this->form_gui->addCommandButton("updateTagStyle", $lng->txt("save_return"));
808 $this->form_gui->addCommandButton("refreshTagStyle", $lng->txt("save_refresh"));
809
810 // $this->form_gui->setTitle($lng->txt("edit"));
811 $this->form_gui->setFormAction($this->ctrl->getFormAction($this));
812 }
813
818 public function getValues()
819 {
820 $style = $this->object->getStyle();
821 $cur = explode(".", $_GET["tag"]);
822 $cur_tag = $cur[0];
823 $cur_class = $cur[1];
824 $cur_parameters = $this->extractParametersOfTag(
825 $cur_tag,
826 $cur_class,
827 $style,
828 $_GET["style_type"],
829 (int) $_GET["mq_id"],
830 false
831 );
833 foreach ($parameters as $p => $v) {
834 $filtered_groups = ilObjStyleSheet::_getFilteredGroups();
835 if (is_array($filtered_groups[$v["group"]]) && !in_array($cur_tag, $filtered_groups[$v["group"]])) {
836 continue;
837 }
838 $p = explode(".", $p);
839 $p = $p[0];
840 $input = $this->form_gui->getItemByPostVar($p);
841 switch ($v["input"]) {
842 case "":
843 break;
844
845 case "trbl_numeric":
846 case "border_width":
847 case "border_style":
848 case "trbl_color":
849 $input->setAllValue($cur_parameters[$v["subpar"][0]]);
850 $input->setTopValue($cur_parameters[$v["subpar"][1]]);
851 $input->setRightValue($cur_parameters[$v["subpar"][2]]);
852 $input->setBottomValue($cur_parameters[$v["subpar"][3]]);
853 $input->setLeftValue($cur_parameters[$v["subpar"][4]]);
854 break;
855
856 default:
857 $input->setValue($cur_parameters[$p]);
858 break;
859 }
860 }
861
862 $cust_parameters = $this->extractParametersOfTag(
863 $cur_tag,
864 $cur_class,
865 $style,
866 $_GET["style_type"],
867 (int) $_GET["mq_id"],
868 true
869 );
870 $vals = array();
871 foreach ($cust_parameters as $k => $c) {
872 $vals[] = $k . ": " . $c;
873 }
874 $input = $this->form_gui->getItemByPostVar("custom_par");
875 $input->setValue($vals);
876 }
877
881 public function exportStyleObject()
882 {
883 include_once("./Services/Export/classes/class.ilExport.php");
884 $exp = new ilExport();
885 $r = $exp->exportObject($this->object->getType(), $this->object->getId());
886
887 ilUtil::deliverFile($r["directory"] . "/" . $r["file"], $r["file"], '', false, true);
888 }
889
890 public function extractParametersOfTag($a_tag, $a_class, $a_style, $a_type, $a_mq_id = 0, $a_custom = false)
891 {
892 $parameters = array();
893 foreach ($a_style as $tag) {
894 foreach ($tag as $par) {
895 if ($par["tag"] == $a_tag && $par["class"] == $a_class
896 && $par["type"] == $a_type && (int) $a_mq_id == (int) $par["mq_id"]
897 && (int) $a_custom == (int) $par["custom"]) {
898 $parameters[$par["parameter"]] = $par["value"];
899 }
900 }
901 }
902 return $parameters;
903 }
904
908 public function newStyleParameterObject()
909 {
910 $this->object->addParameter($_POST["tag"], $_POST["parameter"]);
911 $this->editObject();
912 }
913
917 public function refreshObject()
918 {
919 $this->object->setTitle($_POST["style_title"]);
920 $this->object->setDescription($_POST["style_description"]);
921
922 foreach ($_POST["styval"] as $id => $value) {
923 $this->object->updateStyleParameter($id, $value);
924 }
925 $this->object->update();
926 $this->editObject();
927 }
928
934 public function deleteObject($a_error = false)
935 {
936 //$this->setTabs();
937
938 // display confirmation message
939 include_once("./Services/Utilities/classes/class.ilConfirmationGUI.php");
940 $cgui = new ilConfirmationGUI();
941 $cgui->setFormAction($this->ctrl->getFormAction($this));
942 $cgui->setHeaderText($this->lng->txt("info_delete_sure"));
943 $cgui->setCancel($this->lng->txt("cancel"), "cancelDelete");
944 $cgui->setConfirm($this->lng->txt("confirm"), "confirmedDelete");
945
946 $caption = ilUtil::getImageTagByType("sty", $this->tpl->tplPath) .
947 " " . ilObject::_lookupTitle($this->object->getId());
948
949 $cgui->addItem("id[]", "", $caption);
950
951 $this->tpl->setContent($cgui->getHTML());
952 }
953
954
958 public function cancelDeleteObject()
959 {
960 $this->ctrl->returnToParent($this);
961 }
962
966 public function confirmedDeleteObject()
967 {
968 $this->object->delete();
969
970 $this->ctrl->returnToParent($this);
971 }
972
977 {
978 if (is_array($_POST["sty_select"])) {
979 foreach ($_POST["sty_select"] as $id => $dummy) {
980 $this->object->deleteParameter($id);
981 }
982 }
983 $this->object->read();
984 $this->object->writeCSSFile();
985 $this->editObject();
986 }
987
991 public function saveObject()
992 {
993 if (!trim($_POST["style_title"])) {
994 $this->ctrl->redirect($this, "create");
995 }
996
997 // copy from default style or ... see #11330
998 $default_style = $this->settings->get("default_content_style_id");
999 if (ilObject::_lookupType($default_style) == "sty") {
1000 $style_obj = ilObjectFactory::getInstanceByObjId($default_style);
1001 $new_id = $style_obj->ilClone();
1002 $newObj = new ilObjStyleSheet($new_id);
1003 } else {
1004 // ... import from basic zip file
1005 $imp = new ilImport();
1006 $style_id = $imp->importObject(
1007 null,
1009 "style.zip",
1010 "sty",
1011 $a_comp = "Services/Style",
1012 true
1013 );
1014
1015 $newObj = new ilObjStyleSheet($style_id);
1016 }
1017
1018 $newObj->setTitle(ilUtil::stripSlashes($_POST["style_title"]));
1019 $newObj->setDescription(ilUtil::stripSlashes($_POST["style_description"]));
1020 $newObj->update();
1021
1023
1024 // assign style to style sheet folder,
1025 // if parent is style sheet folder
1026 if ($_GET["ref_id"] > 0) {
1027 $fold = ilObjectFactory::getInstanceByRefId($_GET["ref_id"]);
1028 if ($fold->getType() == "stys") {
1029 include_once("./Services/Style/Content/classes/class.ilContentStyleSettings.php");
1030 $cont_style_settings = new ilContentStyleSettings();
1031 $cont_style_settings->addStyle($newObj->getId());
1032 $cont_style_settings->update();
1033
1034 ilObjStyleSheet::_writeStandard($newObj->getId(), "1");
1035 $this->ctrl->returnToParent($this);
1036 }
1037 }
1038
1039 return $newObj->getId();
1040 }
1041
1045 public function copyStyleObject()
1046 {
1047 if ($_POST["source_style"] > 0) {
1048 $style_obj = ilObjectFactory::getInstanceByObjId($_POST["source_style"]);
1049 $new_id = $style_obj->ilClone();
1050 }
1051
1052 // assign style to style sheet folder,
1053 // if parent is style sheet folder
1054 if ($_GET["ref_id"] > 0) {
1055 $fold = ilObjectFactory::getInstanceByRefId($_GET["ref_id"]);
1056 if ($fold->getType() == "stys") {
1057 include_once("./Services/Style/Content/classes/class.ilContentStyleSettings.php");
1058 $cont_style_settings = new ilContentStyleSettings();
1059 $cont_style_settings->addStyle($new_id);
1060 $cont_style_settings->update();
1061 ilObjStyleSheet::_writeStandard($new_id, "1");
1062 $this->ctrl->returnToParent($this);
1063 }
1064 }
1065
1066 return $new_id;
1067 }
1068
1072 public function importStyleObject()
1073 {
1074 // check file
1075 $source = $_FILES["importfile"]["tmp_name"];
1076 if (($source == 'none') || (!$source)) {
1077 $this->ilias->raiseError("No file selected!", $this->ilias->error_obj->MESSAGE);
1078 }
1079
1080 // check correct file type
1081 $info = pathinfo($_FILES["importfile"]["name"]);
1082 if (strtolower($info["extension"]) != "zip" && strtolower($info["extension"]) != "xml") {
1083 $this->ilias->raiseError("File must be a zip or xml file!", $this->ilias->error_obj->MESSAGE);
1084 }
1085
1086 // new import
1087 $fname = explode("_", $_FILES["importfile"]["name"]);
1088 if (strtolower($info["extension"]) == "zip" && $fname[4] == "sty") {
1089 include_once("./Services/Export/classes/class.ilImport.php");
1090 $imp = new ilImport();
1091 $new_id = $imp->importObject(
1092 null,
1093 $_FILES["importfile"]["tmp_name"],
1094 $_FILES["importfile"]["name"],
1095 "sty"
1096 );
1097 if ($new_id > 0) {
1098 $newObj = ilObjectFactory::getInstanceByObjId($new_id);
1099 }
1100 } else { // old import
1101 require_once("./Services/Style/Content/classes/class.ilObjStyleSheet.php");
1102 $newObj = new ilObjStyleSheet();
1103 $newObj->import($_FILES["importfile"]);
1104 }
1105
1106 // assign style to style sheet folder,
1107 // if parent is style sheet folder
1108 if ($_GET["ref_id"] > 0) {
1109 $fold = ilObjectFactory::getInstanceByRefId($_GET["ref_id"]);
1110 if ($fold->getType() == "stys") {
1111 include_once("./Services/Style/Content/classes/class.ilContentStyleSettings.php");
1112 $cont_style_settings = new ilContentStyleSettings();
1113 $cont_style_settings->addStyle($newObj->getId());
1114 $cont_style_settings->update();
1115 ilObjStyleSheet::_writeStandard($newObj->getId(), "1");
1116 $this->ctrl->returnToParent($this);
1117 }
1118 }
1119 return $newObj->getId();
1120 }
1121
1128 public function afterImport(ilObject $a_new_obj)
1129 {
1130 }
1131
1132
1136 public function cancelObject()
1137 {
1138 $lng = $this->lng;
1139
1140 ilUtil::sendInfo($lng->txt("msg_cancel"), true);
1141 $this->ctrl->returnToParent($this);
1142 }
1143
1147 public function getAdminTabs()
1148 {
1149 $this->getTabs();
1150 }
1151
1155 public function setTabs()
1156 {
1157 $lng = $this->lng;
1158
1159 $this->getTabs($this->tabs_gui);
1160
1161 if (strtolower(get_class($this->object)) == "ilobjstylesheet") {
1162 $this->tpl->setVariable("HEADER", $this->object->getTitle());
1163 } else {
1164 $this->tpl->setVariable("HEADER", $lng->txt("create_stylesheet"));
1165 }
1166 }
1167
1173 public function getTabs()
1174 {
1175 $lng = $this->lng;
1177 $ilTabs = $this->tabs;
1178 $ilHelp = $this->help;
1179
1180 $ilHelp->setScreenIdComponent("sty");
1181
1182 if ($ilCtrl->getCmd() == "editTagStyle") {
1183 // back to upper context
1184 $this->tabs_gui->setBackTarget(
1185 $lng->txt("back"),
1186 $ilCtrl->getLinkTarget($this, "edit")
1187 );
1188
1189 $t = explode(".", $_GET["tag"]);
1190 $t2 = explode(":", $t[1]);
1191 $pc = $this->object->_getPseudoClasses($t[0]);
1192 if (is_array($pc) && count($pc) > 0) {
1193 // style classes
1194 $ilCtrl->setParameter($this, "tag", $t[0] . "." . $t2[0]);
1195 $this->tabs_gui->addTarget(
1196 "sty_tag_normal",
1197 $this->ctrl->getLinkTarget($this, "editTagStyle"),
1198 array("editTagStyle", ""),
1199 get_class($this)
1200 );
1201 if ($t2[1] == "") {
1202 $ilTabs->setTabActive("sty_tag_normal");
1203 }
1204
1205 foreach ($pc as $p) {
1206 // style classes
1207 $ilCtrl->setParameter($this, "tag", $t[0] . "." . $t2[0] . ":" . $p);
1208 $this->tabs_gui->addTarget(
1209 "sty_tag_" . $p,
1210 $this->ctrl->getLinkTarget($this, "editTagStyle"),
1211 array("editTagStyle", ""),
1212 get_class($this)
1213 );
1214 if ($t2[1] == $p) {
1215 $ilTabs->setTabActive("sty_tag_" . $p);
1216 }
1217 }
1218 $ilCtrl->setParameter($this, "tag", $_GET["tag"]);
1219 }
1220 } else {
1221 // back to upper context
1222 $this->tabs_gui->setBackTarget(
1223 $lng->txt("back"),
1224 $this->ctrl->getLinkTarget($this, "returnToUpperContext")
1225 );
1226
1227 // style classes
1228 $this->tabs_gui->addTarget(
1229 "sty_style_chars",
1230 $this->ctrl->getLinkTarget($this, "edit"),
1231 array("edit", ""),
1232 get_class($this)
1233 );
1234
1235 // colors
1236 $this->tabs_gui->addTarget(
1237 "sty_colors",
1238 $this->ctrl->getLinkTarget($this, "listColors"),
1239 "listColors",
1240 get_class($this)
1241 );
1242
1243 // media queries
1244 $this->tabs_gui->addTarget(
1245 "sty_media_queries",
1246 $this->ctrl->getLinkTarget($this, "listMediaQueries"),
1247 "listMediaQueries",
1248 get_class($this)
1249 );
1250
1251 // images
1252 $this->tabs_gui->addTarget(
1253 "sty_images",
1254 $this->ctrl->getLinkTarget($this, "listImages"),
1255 "listImages",
1256 get_class($this)
1257 );
1258
1259 // table templates
1260 $this->tabs_gui->addTarget(
1261 "sty_templates",
1262 $this->ctrl->getLinkTarget($this, "listTemplates"),
1263 "listTemplates",
1264 get_class($this)
1265 );
1266
1267 // settings
1268 $this->tabs_gui->addTarget(
1269 "settings",
1270 $this->ctrl->getLinkTarget($this, "properties"),
1271 "properties",
1272 get_class($this)
1273 );
1274
1275 // accordiontest
1276/*
1277 $this->tabs_gui->addTarget("accordiontest",
1278 $this->ctrl->getLinkTarget($this, "accordiontest"), "accordiontest",
1279 get_class($this));*/
1280 }
1281 }
1282
1288 public function setSubTabs()
1289 {
1290 $lng = $this->lng;
1291 $ilTabs = $this->tabs;
1293
1295
1296 foreach ($types as $super_type => $types) {
1297 // text block characteristics
1298 $ilCtrl->setParameter($this, "style_type", $super_type);
1299 $ilTabs->addSubTabTarget(
1300 "sty_" . $super_type . "_char",
1301 $this->ctrl->getLinkTarget($this, "edit"),
1302 array("edit", ""),
1303 get_class($this)
1304 );
1305 }
1306
1307 $ilCtrl->setParameter($this, "style_type", $_GET["style_type"]);
1308 }
1309
1315 public function setTemplatesSubTabs()
1316 {
1317 $lng = $this->lng;
1318 $ilTabs = $this->tabs;
1320
1322
1323 foreach ($types as $t => $c) {
1324 $ilCtrl->setParameter($this, "temp_type", $t);
1325 $ilTabs->addSubTabTarget(
1326 "sty_" . $t . "_templates",
1327 $this->ctrl->getLinkTarget($this, "listTemplates"),
1328 array("listTemplates", ""),
1329 get_class($this)
1330 );
1331 }
1332
1333 $ilCtrl->setParameter($this, "temp_type", $_GET["temp_type"]);
1334 }
1335
1340 public function addAdminLocatorItems($a_do_not_add_object = false)
1341 {
1342 $ilLocator = $this->locator;
1343
1344 if ($_GET["admin_mode"] == "settings") { // system settings
1345 parent::addAdminLocatorItems(true);
1346
1347 $ilLocator->addItem(
1349 ilObject::_lookupObjId($_GET["ref_id"])
1350 ),
1351 $this->ctrl->getLinkTargetByClass("ilobjstylesettingsgui", "")
1352 );
1353
1354 if ($_GET["obj_id"] > 0) {
1355 $ilLocator->addItem(
1356 $this->object->getTitle(),
1357 $this->ctrl->getLinkTarget($this, "edit")
1358 );
1359 }
1360 } else { // repository administration
1361 //?
1362 }
1363 }
1364
1365 public function showUpperIcon()
1366 {
1368 $tpl = $this->tpl;
1370
1371 if (strtolower($_GET["baseClass"]) == "iladministrationgui") {
1372 $tpl->setUpperIcon(
1373 $this->ctrl->getLinkTargetByClass(
1374 "ilcontentstylesettings",
1375 "edit"
1376 )
1377 );
1378 } else {
1379 // ?
1380 }
1381 }
1382
1386 public function listImagesObject()
1387 {
1388 $tpl = $this->tpl;
1389 $ilToolbar = $this->toolbar;
1391 $lng = $this->lng;
1393
1394 if ($this->checkWrite()) {
1395 $ilToolbar->addButton(
1396 $lng->txt("sty_add_image"),
1397 $ilCtrl->getLinkTarget($this, "addImage")
1398 );
1399 }
1400
1401 include_once("./Services/Style/Content/classes/class.ilStyleImageTableGUI.php");
1402 $table_gui = new ilStyleImageTableGUI(
1403 $this,
1404 "listImages",
1405 $this->object
1406 );
1407 $tpl->setContent($table_gui->getHTML());
1408 }
1409
1413 public function addImageObject()
1414 {
1415 $tpl = $this->tpl;
1416
1417 $this->initImageForm();
1418 $tpl->setContent($this->form_gui->getHTML());
1419 }
1420
1424 public function cancelUploadObject()
1425 {
1427
1428 $ilCtrl->redirect($this, "listImages");
1429 }
1430
1434 public function uploadImageObject()
1435 {
1436 $tpl = $this->tpl;
1438
1439 $this->initImageForm();
1440
1441 if ($this->form_gui->checkInput()) {
1442 $this->object->uploadImage($_FILES["image_file"]);
1443 $ilCtrl->redirect($this, "listImages");
1444 } else {
1445 //$this->form_gui->setImageFormValuesByPost();
1446 $tpl->setContent($this->form_gui->getHTML());
1447 }
1448 }
1449
1453 public function initImageForm()
1454 {
1455 $lng = $this->lng;
1457
1458 include_once("Services/Form/classes/class.ilPropertyFormGUI.php");
1459 $this->form_gui = new ilPropertyFormGUI();
1460
1461 $this->form_gui->setTitle($lng->txt("sty_add_image"));
1462
1463 $file_input = new ilImageFileInputGUI($lng->txt("sty_image_file"), "image_file");
1464 $file_input->setRequired(true);
1465 $this->form_gui->addItem($file_input);
1466
1467 $this->form_gui->addCommandButton("uploadImage", $lng->txt("upload"));
1468 $this->form_gui->addCommandButton("cancelUpload", $lng->txt("cancel"));
1469 $this->form_gui->setFormAction($ilCtrl->getFormAction($this));
1470 }
1471
1475 public function deleteImageObject()
1476 {
1478
1479 $images = $this->object->getImages();
1480
1481 foreach ($images as $image) {
1482 if (is_array($_POST["file"]) && in_array($image["entry"], $_POST["file"])) {
1483 $this->object->deleteImage($image["entry"]);
1484 }
1485 }
1486 $ilCtrl->redirect($this, "listImages");
1487 }
1488
1493 {
1495 $tpl = $this->tpl;
1496 $lng = $this->lng;
1497
1498 //var_dump($_POST);
1499
1500 if (!is_array($_POST["char"]) || count($_POST["char"]) == 0) {
1501 ilUtil::sendInfo($lng->txt("no_checkbox"), true);
1502 $ilCtrl->redirect($this, "edit");
1503 } else {
1504 // check whether there are any core style classes included
1505 $core_styles = ilObjStyleSheet::_getCoreStyles();
1506 foreach ($_POST["char"] as $char) {
1507 if (!empty($core_styles[$char])) {
1508 $this->deleteCoreCharMessage();
1509 return;
1510 }
1511 }
1512
1513 include_once("./Services/Utilities/classes/class.ilConfirmationGUI.php");
1514 $cgui = new ilConfirmationGUI();
1515 $cgui->setFormAction($ilCtrl->getFormAction($this));
1516 $cgui->setHeaderText($lng->txt("sty_confirm_char_deletion"));
1517 $cgui->setCancel($lng->txt("cancel"), "cancelCharacteristicDeletion");
1518 $cgui->setConfirm($lng->txt("delete"), "deleteCharacteristic");
1519
1520 foreach ($_POST["char"] as $char) {
1521 $char_comp = explode(".", $char);
1522 $cgui->addItem("char[]", $char, $char_comp[2]);
1523 }
1524
1525 $tpl->setContent($cgui->getHTML());
1526 }
1527 }
1528
1535 public function deleteCoreCharMessage()
1536 {
1538 $tpl = $this->tpl;
1539 $lng = $this->lng;
1540
1541 include_once("./Services/Utilities/classes/class.ilConfirmationGUI.php");
1542 $cgui = new ilConfirmationGUI();
1543 $cgui->setFormAction($ilCtrl->getFormAction($this));
1544
1545
1546 $core_styles = ilObjStyleSheet::_getCoreStyles();
1547 $cnt = 0;
1548 foreach ($_POST["char"] as $char) {
1549 if (!empty($core_styles[$char])) {
1550 $cnt++;
1551 $char_comp = explode(".", $char);
1552 $cgui->addItem("", "", $char_comp[2]);
1553 } else {
1554 $cgui->addHiddenItem("char[]", $char);
1555 }
1556 }
1557 $all_core_styles = ($cnt == count($_POST["char"]))
1558 ? true
1559 : false;
1560
1561 if ($all_core_styles) {
1562 $cgui->setHeaderText($lng->txt("sty_all_styles_obligatory"));
1563 $cgui->setCancel($lng->txt("back"), "cancelCharacteristicDeletion");
1564 } else {
1565 $cgui->setHeaderText($lng->txt("sty_some_styles_obligatory_delete_rest"));
1566 $cgui->setCancel($lng->txt("cancel"), "cancelCharacteristicDeletion");
1567 $cgui->setConfirm($lng->txt("sty_delete_other_selected"), "deleteCharacteristicConfirmation");
1568 }
1569
1570 $tpl->setContent($cgui->getHTML());
1571 }
1572
1577 {
1579 $lng = $this->lng;
1580
1581 ilUtil::sendInfo($lng->txt("action_aborted"), true);
1582 $ilCtrl->redirect($this, "edit");
1583 }
1584
1589 {
1591
1592 if (is_array($_POST["char"])) {
1593 foreach ($_POST["char"] as $char) {
1594 $char_comp = explode(".", $char);
1595 $type = $char_comp[0];
1596 $tag = $char_comp[1];
1597 $class = $char_comp[2];
1598
1599 $this->object->deleteCharacteristic($type, $tag, $class);
1600 }
1601 }
1602
1603 $ilCtrl->redirect($this, "edit");
1604 }
1605
1610 {
1611 $tpl = $this->tpl;
1612
1613 $this->initCharacteristicForm("create");
1614 $tpl->setContent($this->form_gui->getHTML());
1615 }
1616
1621 {
1623 $tpl = $this->tpl;
1624 $lng = $this->lng;
1625
1626 $this->initCharacteristicForm("create");
1627
1628 if ($this->form_gui->checkInput()) {
1629 if ($this->object->characteristicExists($_POST["new_characteristic"], $_GET["style_type"])) {
1630 $char_input = $this->form_gui->getItemByPostVar("new_characteristic");
1631 $char_input->setAlert($lng->txt("sty_characteristic_already_exists"));
1632 } else {
1633 $this->object->addCharacteristic($_POST["type"], $_POST["new_characteristic"]);
1634 ilUtil::sendInfo($lng->txt("sty_added_characteristic"), true);
1635 $ilCtrl->setParameter(
1636 $this,
1637 "tag",
1638 ilObjStyleSheet::_determineTag($_POST["type"]) . "." . $_POST["new_characteristic"]
1639 );
1640 $ilCtrl->setParameter($this, "style_type", $_POST["type"]);
1641 $ilCtrl->redirect($this, "editTagStyle");
1642 }
1643 }
1644 $this->form_gui->setValuesByPost();
1645 $tpl->setContent($this->form_gui->getHTML());
1646 }
1647
1653 public function initCharacteristicForm($a_mode)
1654 {
1655 $lng = $this->lng;
1657
1658 include_once("Services/Form/classes/class.ilPropertyFormGUI.php");
1659 $this->form_gui = new ilPropertyFormGUI();
1660
1661 // title
1662 $txt_input = new ilRegExpInputGUI($lng->txt("title"), "new_characteristic");
1663 $txt_input->setPattern("/^[a-zA-Z]+[a-zA-Z0-9]*$/");
1664 $txt_input->setNoMatchMessage($lng->txt("sty_msg_characteristic_must_only_include") . " A-Z, a-z, 0-9");
1665 $txt_input->setRequired(true);
1666 $this->form_gui->addItem($txt_input);
1667
1668 // type
1669 $all_super_types = ilObjStyleSheet::_getStyleSuperTypes();
1670 $types = $all_super_types[$this->super_type];
1671 $exp_types = array();
1672 foreach ($types as $t) {
1674 $exp_types[$t] = $lng->txt("sty_type_" . $t);
1675 }
1676 }
1677 if (count($exp_types) > 1) {
1678 $type_input = new ilSelectInputGUI($lng->txt("sty_type"), "type");
1679 $type_input->setOptions($exp_types);
1680 $type_input->setValue(key($exp_types));
1681 $this->form_gui->addItem($type_input);
1682 } elseif (count($exp_types) == 1) {
1683 $hid_input = new ilHiddenInputGUI("type");
1684 $hid_input->setValue(key($exp_types));
1685 $this->form_gui->addItem($hid_input);
1686 }
1687
1688 $this->form_gui->setTitle($lng->txt("sty_add_characteristic"));
1689 $this->form_gui->addCommandButton("saveCharacteristic", $lng->txt("save"));
1690 $this->form_gui->addCommandButton("edit", $lng->txt("cancel"));
1691 $this->form_gui->setFormAction($ilCtrl->getFormAction($this));
1692 }
1693
1697 public static function getStyleExampleHTML($a_type, $a_class)
1698 {
1699 global $DIC;
1700
1701 $lng = $DIC->language();
1702
1703 $c = explode(":", $a_class);
1704 $a_class = $c[0];
1705
1706 $ex_tpl = new ilTemplate("tpl.style_example.html", true, true, "Services/Style/Content");
1707
1708 if ($ex_tpl->blockExists("Example_" . $a_type)) {
1709 $ex_tpl->setCurrentBlock("Example_" . $a_type);
1710 } else {
1711 $ex_tpl->setCurrentBlock("Example_default");
1712 }
1713 $ex_tpl->setVariable("EX_CLASS", "ilc_" . $a_type . "_" . $a_class);
1714 $ex_tpl->setVariable("EX_TEXT", "ABC abc 123");
1715 if (in_array($a_type, array("media_cont", "qimg"))) {
1716 //
1717 }
1718 if (in_array($a_type, array("table", "table_caption"))) {
1719 $ex_tpl->setVariable("TXT_CAPTION", $lng->txt("sty_caption"));
1720 }
1721 if (in_array($a_class, array("OrderListItemHorizontal", "OrderListHorizontal"))) {
1722 $ex_tpl->setVariable("HOR", "Horizontal");
1723 }
1724 $ex_tpl->parseCurrentBlock();
1725
1726 return $ex_tpl->get();
1727 }
1728
1732 public function saveHideStatusObject()
1733 {
1735 $lng = $this->lng;
1736
1737 //var_dump($_POST);
1738
1739 foreach ($_POST["all_chars"] as $char) {
1740 $ca = explode(".", $char);
1741 $this->object->saveHideStatus(
1742 $ca[0],
1743 $ca[2],
1744 (is_array($_POST["hide"]) && in_array($char, $_POST["hide"]))
1745 );
1746 }
1747
1748 ilUtil::sendInfo($lng->txt("msg_obj_modified"), true);
1749 $ilCtrl->redirect($this, "edit");
1750 }
1751
1759 {
1761 $lng = $this->lng;
1762
1763 if (!is_array($_POST["char"]) || count($_POST["char"]) == 0) {
1764 ilUtil::sendFailure($lng->txt("no_checkbox"), true);
1765 } else {
1766 $style_cp = implode("::", $_POST["char"]);
1767 $style_cp = $this->object->getId() . ":::" . $_GET["style_type"] . ":::" . $style_cp;
1768 $_SESSION["sty_copy"] = $style_cp;
1769 ilUtil::sendSuccess($lng->txt("sty_copied_please_select_target"), true);
1770 }
1771 $ilCtrl->redirect($this, "edit");
1772 }
1773
1781 {
1782 $tpl = $this->tpl;
1783 $ilTabs = $this->tabs;
1784
1785 $ilTabs->clearTargets();
1786
1787 include_once("./Services/Style/Content/classes/class.ilPasteStyleCharacteristicTableGUI.php");
1788 $table = new ilPasteStyleCharacteristicTableGUI($this, "pasteCharacteristicsOverview");
1789
1790 $tpl->setContent($table->getHTML());
1791 }
1792
1800 {
1802 $lng = $this->lng;
1803
1804 if (is_array($_POST["title"])) {
1805 foreach ($_POST["title"] as $from_char => $to_title) {
1806 $fc = explode(".", $from_char);
1807
1808 if ($_POST["conflict_action"][$from_char] == "overwrite" ||
1809 !$this->object->characteristicExists($to_title, $fc[0])) {
1810 $this->object->copyCharacteristic(
1811 $_POST["from_style_id"],
1812 $fc[0],
1813 $fc[2],
1814 $to_title
1815 );
1816 }
1817 }
1818 ilObjStyleSheet::_writeUpToDate($this->object->getId(), false);
1819 unset($_SESSION["sty_copy"]);
1820 ilUtil::sendSuccess($lng->txt("sty_style_classes_copied"), true);
1821 }
1822
1823 $ilCtrl->redirect($this, "edit");
1824 }
1825
1826 //
1827 // Color management
1828 //
1829
1833 public function listColorsObject()
1834 {
1835 $tpl = $this->tpl;
1837 $ilToolbar = $this->toolbar;
1839
1840 if ($this->checkWrite()) {
1841 $ilToolbar->addButton(
1842 $this->lng->txt("sty_add_color"),
1843 $ilCtrl->getLinkTarget($this, "addColor")
1844 );
1845 }
1846
1847 include_once("./Services/Style/Content/classes/class.ilStyleColorTableGUI.php");
1848 $table_gui = new ilStyleColorTableGUI(
1849 $this,
1850 "listColors",
1851 $this->object
1852 );
1853 $tpl->setContent($table_gui->getHTML());
1854 }
1855
1859 public function addColorObject()
1860 {
1861 $tpl = $this->tpl;
1862
1863 $this->initColorForm();
1864 $tpl->setContent($this->form_gui->getHTML());
1865 }
1866
1870 public function editColorObject()
1871 {
1872 $tpl = $this->tpl;
1874
1875 $ilCtrl->setParameter($this, "c_name", $_GET["c_name"]);
1876 $this->initColorForm("edit");
1877 $this->getColorFormValues();
1878 $tpl->setContent($this->form_gui->getHTML());
1879 }
1880
1881
1885 public function initColorForm($a_mode = "create")
1886 {
1887 $lng = $this->lng;
1889
1890 include_once("Services/Form/classes/class.ilPropertyFormGUI.php");
1891 $this->form_gui = new ilPropertyFormGUI();
1892
1893 $this->form_gui->setTitle($lng->txt("sty_add_color"));
1894
1895 // name
1896 $name_input = new ilRegExpInputGUI($lng->txt("sty_color_name"), "color_name");
1897 $name_input->setPattern("/^[a-zA-Z]+[a-zA-Z0-9]*$/");
1898 $name_input->setNoMatchMessage($lng->txt("sty_msg_color_must_only_include") . " A-Z, a-z, 1-9");
1899 $name_input->setRequired(true);
1900 $name_input->setSize(15);
1901 $name_input->setMaxLength(15);
1902 $this->form_gui->addItem($name_input);
1903
1904 // code
1905 $color_input = new ilColorPickerInputGUI($lng->txt("sty_color_code"), "color_code");
1906 $color_input->setRequired(true);
1907 $color_input->setDefaultColor("");
1908 $this->form_gui->addItem($color_input);
1909
1910 if ($a_mode == "create") {
1911 $this->form_gui->addCommandButton("saveColor", $lng->txt("save"));
1912 $this->form_gui->addCommandButton("cancelColorSaving", $lng->txt("cancel"));
1913 } else {
1914 $this->form_gui->addCommandButton("updateColor", $lng->txt("save"));
1915 $this->form_gui->addCommandButton("cancelColorSaving", $lng->txt("cancel"));
1916 }
1917 $this->form_gui->setFormAction($ilCtrl->getFormAction($this));
1918 }
1919
1923 public function getColorFormValues()
1924 {
1925 if ($_GET["c_name"] != "") {
1926 $values["color_name"] = $_GET["c_name"];
1927 $values["color_code"] = $this->object->getColorCodeForName($_GET["c_name"]);
1928 $this->form_gui->setValuesByArray($values);
1929 }
1930 }
1931
1935 public function cancelColorSavingObject()
1936 {
1938
1939 $ilCtrl->redirect($this, "listColors");
1940 }
1941
1945 public function saveColorObject()
1946 {
1947 $tpl = $this->tpl;
1949 $lng = $this->lng;
1950
1951 $this->initColorForm();
1952
1953 if ($this->form_gui->checkInput()) {
1954 if ($this->object->colorExists($_POST["color_name"])) {
1955 $col_input = $this->form_gui->getItemByPostVar("color_name");
1956 $col_input->setAlert($lng->txt("sty_color_already_exists"));
1957 } else {
1958 $this->object->addColor(
1959 $_POST["color_name"],
1960 $_POST["color_code"]
1961 );
1962 $ilCtrl->redirect($this, "listColors");
1963 }
1964 }
1965 $this->form_gui->setValuesByPost();
1966 $tpl->setContent($this->form_gui->getHTML());
1967 }
1968
1972 public function updateColorObject()
1973 {
1974 $tpl = $this->tpl;
1976 $lng = $this->lng;
1977
1978 $this->initColorForm("edit");
1979
1980 if ($this->form_gui->checkInput()) {
1981 if ($this->object->colorExists($_POST["color_name"]) &&
1982 $_POST["color_name"] != $_GET["c_name"]) {
1983 $col_input = $this->form_gui->getItemByPostVar("color_name");
1984 $col_input->setAlert($lng->txt("sty_color_already_exists"));
1985 } else {
1986 $this->object->updateColor(
1987 $_GET["c_name"],
1988 $_POST["color_name"],
1989 $_POST["color_code"]
1990 );
1991 $ilCtrl->redirect($this, "listColors");
1992 }
1993 }
1994 $ilCtrl->setParameter($this, "c_name", $_GET["c_name"]);
1995 $this->form_gui->setValuesByPost();
1996 $tpl->setContent($this->form_gui->getHTML());
1997 }
1998
2003 {
2005 $tpl = $this->tpl;
2006 $lng = $this->lng;
2007
2008 if (!is_array($_POST["color"]) || count($_POST["color"]) == 0) {
2009 ilUtil::sendInfo($lng->txt("no_checkbox"), true);
2010 $ilCtrl->redirect($this, "listColors");
2011 } else {
2012 include_once("./Services/Utilities/classes/class.ilConfirmationGUI.php");
2013 $cgui = new ilConfirmationGUI();
2014 $cgui->setFormAction($ilCtrl->getFormAction($this));
2015 $cgui->setHeaderText($lng->txt("sty_confirm_color_deletion"));
2016 $cgui->setCancel($lng->txt("cancel"), "cancelColorDeletion");
2017 $cgui->setConfirm($lng->txt("delete"), "deleteColor");
2018
2019 foreach ($_POST["color"] as $c) {
2020 $cgui->addItem("color[]", ilUtil::prepareFormOutput($c), $c);
2021 }
2022
2023 $tpl->setContent($cgui->getHTML());
2024 }
2025 }
2026
2031 {
2033
2034 $ilCtrl->redirect($this, "listColors");
2035 }
2036
2040 public function deleteColorObject()
2041 {
2043
2044 if (is_array($_POST["color"])) {
2045 foreach ($_POST["color"] as $c) {
2046 $this->object->removeColor($c);
2047 }
2048 }
2049
2050 $ilCtrl->redirect($this, "listColors");
2051 }
2052
2053 //
2054 // Media query management
2055 //
2056
2060 public function listMediaQueriesObject()
2061 {
2062 $tpl = $this->tpl;
2064 $ilToolbar = $this->toolbar;
2066
2067 if ($this->checkWrite()) {
2068 $ilToolbar->addButton(
2069 $this->lng->txt("sty_add_media_query"),
2070 $ilCtrl->getLinkTarget($this, "addMediaQuery")
2071 );
2072 }
2073
2074 include_once("./Services/Style/Content/classes/class.ilStyleMediaQueryTableGUI.php");
2075 $table_gui = new ilStyleMediaQueryTableGUI(
2076 $this,
2077 "listMediaQueries",
2078 $this->object
2079 );
2080 $tpl->setContent($table_gui->getHTML());
2081 }
2082
2086 public function addMediaQueryObject()
2087 {
2088 $tpl = $this->tpl;
2089
2090 $this->initMediaQueryForm();
2091 $tpl->setContent($this->form_gui->getHTML());
2092 }
2093
2097 public function editMediaQueryObject()
2098 {
2099 $tpl = $this->tpl;
2101
2102 $ilCtrl->setParameter($this, "mq_id", $_GET["mq_id"]);
2103 $this->initMediaQueryForm("edit");
2104 $this->getMediaQueryFormValues();
2105 $tpl->setContent($this->form_gui->getHTML());
2106 }
2107
2108
2112 public function initMediaQueryForm($a_mode = "create")
2113 {
2114 $lng = $this->lng;
2116
2117 include_once("Services/Form/classes/class.ilPropertyFormGUI.php");
2118 $this->form_gui = new ilPropertyFormGUI();
2119
2120 $this->form_gui->setTitle($lng->txt("sty_add_media_query"));
2121
2122 // media query
2123 $ti = new ilTextInputGUI("@media", "mquery");
2124 $ti->setMaxLength(2000);
2125 $ti->setInfo($lng->txt("sty_add_media_query_info"));
2126 $this->form_gui->addItem($ti);
2127
2128
2129 if ($a_mode == "create") {
2130 $this->form_gui->addCommandButton("saveMediaQuery", $lng->txt("save"));
2131 $this->form_gui->addCommandButton("listMediaQueries", $lng->txt("cancel"));
2132 } else {
2133 $this->form_gui->addCommandButton("updateMediaQuery", $lng->txt("save"));
2134 $this->form_gui->addCommandButton("listMediaQueries", $lng->txt("cancel"));
2135 }
2136 $this->form_gui->setFormAction($ilCtrl->getFormAction($this));
2137 }
2138
2142 public function getMediaQueryFormValues()
2143 {
2144 if ($_GET["mq_id"] != "") {
2145 foreach ($this->object->getMediaQueries() as $mq) {
2146 if ($mq["id"] == (int) $_GET["mq_id"]) {
2147 $values["mquery"] = $mq["mquery"];
2148 }
2149 }
2150 $this->form_gui->setValuesByArray($values);
2151 }
2152 }
2153
2157 public function saveMediaQueryObject()
2158 {
2159 $tpl = $this->tpl;
2161 $lng = $this->lng;
2162
2163 $this->initMediaQueryForm();
2164
2165 if ($this->form_gui->checkInput()) {
2166 $this->object->addMediaQuery($_POST["mquery"]);
2167 $ilCtrl->redirect($this, "listMediaQueries");
2168 }
2169 $this->form_gui->setValuesByPost();
2170 $tpl->setContent($this->form_gui->getHTML());
2171 }
2172
2176 public function updateMediaQueryObject()
2177 {
2178 $tpl = $this->tpl;
2180 $lng = $this->lng;
2181
2182 $this->initMediaQueryForm("edit");
2183
2184 if ($this->form_gui->checkInput()) {
2185 $this->object->updateMediaQuery((int) $_GET["mq_id"], $_POST["mquery"]);
2186 $ilCtrl->redirect($this, "listMediaQueries");
2187 }
2188 $ilCtrl->setParameter($this, "mq_id", $_GET["mq_id"]);
2189 $this->form_gui->setValuesByPost();
2190 $tpl->setContent($this->form_gui->getHTML());
2191 }
2192
2197 {
2199 $tpl = $this->tpl;
2200 $lng = $this->lng;
2201
2202 if (!is_array($_POST["mq_id"]) || count($_POST["mq_id"]) == 0) {
2203 ilUtil::sendInfo($lng->txt("no_checkbox"), true);
2204 $ilCtrl->redirect($this, "listMediaQueries");
2205 } else {
2206 include_once("./Services/Utilities/classes/class.ilConfirmationGUI.php");
2207 $cgui = new ilConfirmationGUI();
2208 $cgui->setFormAction($ilCtrl->getFormAction($this));
2209 $cgui->setHeaderText($lng->txt("sty_sure_del_mqueries"));
2210 $cgui->setCancel($lng->txt("cancel"), "listMediaQueries");
2211 $cgui->setConfirm($lng->txt("delete"), "deleteMediaQueries");
2212
2213 foreach ($_POST["mq_id"] as $i) {
2214 $mq = $this->object->getMediaQueryForId($i);
2215 $cgui->addItem("mq_id[]", $i, $mq["mquery"]);
2216 }
2217
2218 $tpl->setContent($cgui->getHTML());
2219 }
2220 }
2221
2229 {
2232
2233 if ($this->checkWrite() && is_array($_POST["mq_id"])) {
2234 foreach ($_POST["mq_id"] as $id) {
2235 $this->object->deleteMediaQuery($id);
2236 }
2237 }
2238 $ilCtrl->redirect($this, "listMediaQueries");
2239 }
2240
2248 {
2250
2251 if (is_array($_POST["order"])) {
2252 $this->object->saveMediaQueryOrder($_POST["order"]);
2253 }
2254 $ilCtrl->redirect($this, "listMediaQueries");
2255 }
2256
2257
2258 //
2259 // Templates management
2260 //
2261
2265 public function listTemplatesObject()
2266 {
2267 $tpl = $this->tpl;
2268 $ilTabs = $this->tabs;
2270 $ilToolbar = $this->toolbar;
2271
2272 $ctype = $_GET["temp_type"];
2273 if ($ctype == "") {
2274 $ctype = "table";
2275 $ilCtrl->setParameter($this, "temp_type", $ctype);
2276 $_GET["temp_type"] = $ctype;
2277 }
2278
2279 $this->setTemplatesSubTabs();
2280 $ilTabs->setSubTabActive("sty_" . $ctype . "_templates");
2281
2282 // action commands
2283 if ($this->checkWrite()) {
2284 if ($ctype == "table") {
2285 $ilToolbar->addButton(
2286 $this->lng->txt("sty_generate_template"),
2287 $ilCtrl->getLinkTarget($this, "generateTemplate")
2288 );
2289 }
2290 $ilToolbar->addButton(
2291 $this->lng->txt("sty_add_template"),
2292 $ilCtrl->getLinkTarget($this, "addTemplate")
2293 );
2294 }
2295
2296
2297
2298 $this->includeCSS();
2299 include_once("./Services/Style/Content/classes/class.ilTableTemplatesTableGUI.php");
2300 $table_gui = new ilTableTemplatesTableGUI(
2301 $ctype,
2302 $this,
2303 "listTemplates",
2304 $this->object
2305 );
2306 $tpl->setContent($table_gui->getHTML());
2307 }
2308
2312 public function addTemplateObject()
2313 {
2314 $tpl = $this->tpl;
2315
2316 $this->initTemplateForm();
2317 $tpl->setContent($this->form_gui->getHTML());
2318 }
2319
2323 public function editTemplateObject()
2324 {
2325 $tpl = $this->tpl;
2327
2328 $ilCtrl->setParameter($this, "t_id", $_GET["t_id"]);
2329 $this->initTemplateForm("edit");
2330 $this->getTemplateFormValues();
2331
2332 $this->displayTemplateEditForm();
2333 }
2334
2338 public function getTemplatePreview($a_type, $a_t_id, $a_small_mode = false)
2339 {
2340 return $this->_getTemplatePreview(
2341 $this->object,
2342 $a_type,
2343 $a_t_id,
2344 $a_small_mode
2345 );
2346 }
2347
2351 public static function _getTemplatePreview($a_style, $a_type, $a_t_id, $a_small_mode = false)
2352 {
2353 global $DIC;
2354
2355 $lng = $DIC->language();
2356 $tpl = $DIC["tpl"];
2357
2358 $kr = $kc = 7;
2359 if ($a_small_mode) {
2360 $kr = 6;
2361 $kc = 5;
2362 }
2363
2364 $ts = $a_style->getTemplate($a_t_id);
2365 $t = $ts["classes"];
2366
2367 // preview
2368 if ($a_type == "table") {
2369 $p_content = '<PageContent><Table DataTable="y"';
2370 if ($t["row_head"] != "") {
2371 $p_content .= ' HeaderRows="1"';
2372 }
2373 if ($t["row_foot"] != "") {
2374 $p_content .= ' FooterRows="1"';
2375 }
2376 if ($t["col_head"] != "") {
2377 $p_content .= ' HeaderCols="1"';
2378 }
2379 if ($t["col_foot"] != "") {
2380 $p_content .= ' FooterCols="1"';
2381 }
2382 $p_content .= ' Template="' . $a_style->lookupTemplateName($a_t_id) . '">';
2383 if (!$a_small_mode) {
2384 $p_content .= '<Caption>' . $lng->txt("sty_caption") . '</Caption>';
2385 }
2386 for ($i = 1; $i <= $kr; $i++) {
2387 $p_content .= '<TableRow>';
2388 for ($j = 1; $j <= $kc; $j++) {
2389 if ($a_small_mode) {
2390 $cell = '&lt;div style="height:2px;"&gt;&lt;/div&gt;';
2391 } else {
2392 $cell = 'xxx';
2393 }
2394 $p_content .= '<TableData><PageContent><Paragraph Characteristic="TableContent">' . $cell . '</Paragraph></PageContent></TableData>';
2395 }
2396 $p_content .= '</TableRow>';
2397 }
2398 $p_content .= '</Table></PageContent>';
2399 }
2400
2401 if ($a_type == "vaccordion" || $a_type == "haccordion" || $a_type == "carousel") {
2402 include_once("./Services/Accordion/classes/class.ilAccordionGUI.php");
2404
2405 if ($a_small_mode) {
2406 $c = '&amp;nbsp;';
2407 $h = '&amp;nbsp;';
2408 } else {
2409 $c = 'xxx';
2410 $h = 'head';
2411 }
2412 if ($a_type == "vaccordion") {
2413 $p_content = '<PageContent><Tabs HorizontalAlign="Left" Type="VerticalAccordion" ';
2414 if ($a_small_mode) {
2415 $p_content .= ' ContentWidth="70"';
2416 }
2417 } elseif ($a_type == "haccordion") {
2418 $p_content = '<PageContent><Tabs Type="HorizontalAccordion"';
2419 if ($a_small_mode) {
2420 $p_content .= ' ContentHeight="40"';
2421 $p_content .= ' ContentWidth="70"';
2422 $c = '&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;';
2423 } else {
2424 $p_content .= ' ContentHeight="40"';
2425 }
2426 } elseif ($a_type == "carousel") {
2427 $p_content = '<PageContent><Tabs HorizontalAlign="Left" Type="Carousel" ';
2428 if ($a_small_mode) {
2429 $p_content .= ' ContentWidth="70"';
2430 }
2431 }
2432
2433
2434 $p_content .= ' Template="' . $a_style->lookupTemplateName($a_t_id) . '">';
2435 $p_content .= '<Tab><PageContent><Paragraph>' . $c . '</Paragraph></PageContent>';
2436 $p_content .= '<TabCaption>' . $h . '</TabCaption>';
2437 $p_content .= '</Tab>';
2438 $p_content .= '</Tabs></PageContent>';
2439 }
2440 //echo htmlentities($p_content);
2441 $txml = $a_style->getTemplateXML();
2442 //echo htmlentities($txml); exit;
2443 $p_content .= $txml;
2444 include_once("./Services/COPage/classes/class.ilPCTableGUI.php");
2445 $r_content = ilPCTableGUI::_renderTable($p_content, "");
2446
2447 // fix carousel template visibility
2448 if ($a_type == "carousel") {
2449 $r_content .= "<style>.owl-carousel{ display:block !important; }</style>";
2450 }
2451
2452 //echo htmlentities($r_content); exit;
2453 return $r_content;
2454 }
2455
2459 public function initTemplateForm($a_mode = "create")
2460 {
2461 $lng = $this->lng;
2463
2464 include_once("Services/Form/classes/class.ilPropertyFormGUI.php");
2465 $this->form_gui = new ilPropertyFormGUI();
2466
2467 if ($a_mode == "create") {
2468 $this->form_gui->setTitle($lng->txt("sty_add_template"));
2469 } else {
2470 $this->form_gui->setTitle($lng->txt("sty_edit_template"));
2471 }
2472
2473 // name
2474 $name_input = new ilRegExpInputGUI($lng->txt("sty_template_name"), "name");
2475 $name_input->setPattern("/^[a-zA-Z]+[a-zA-Z0-9]*$/");
2476 $name_input->setNoMatchMessage($lng->txt("sty_msg_color_must_only_include") . " A-Z, a-z, 1-9");
2477 $name_input->setRequired(true);
2478 $name_input->setSize(30);
2479 $name_input->setMaxLength(30);
2480 $this->form_gui->addItem($name_input);
2481
2482 // template style classes
2484 foreach ($scs as $sc => $st) {
2485 $sc_input = new ilSelectInputGUI($lng->txt("sty_" . $sc . "_class"), $sc . "_class");
2486 $chars = $this->object->getCharacteristics($st);
2487 $options = array("" => "");
2488 foreach ($chars as $char) {
2489 $options[$char] = $char;
2490 }
2491 $sc_input->setOptions($options);
2492 $this->form_gui->addItem($sc_input);
2493 }
2494
2495 if ($a_mode == "create") {
2496 $this->form_gui->addCommandButton("saveTemplate", $lng->txt("save"));
2497 $this->form_gui->addCommandButton("cancelTemplateSaving", $lng->txt("cancel"));
2498 } else {
2499 $this->form_gui->addCommandButton("refreshTemplate", $lng->txt("save_refresh"));
2500 $this->form_gui->addCommandButton("updateTemplate", $lng->txt("save_return"));
2501 $this->form_gui->addCommandButton("cancelTemplateSaving", $lng->txt("cancel"));
2502 }
2503 $this->form_gui->setFormAction($ilCtrl->getFormAction($this));
2504 }
2505
2510 {
2512
2513 $ilCtrl->redirect($this, "listTemplates");
2514 }
2515
2516
2520 public function saveTemplateObject()
2521 {
2522 $tpl = $this->tpl;
2524 $lng = $this->lng;
2525
2526 $this->initTemplateForm();
2527
2528 if ($this->form_gui->checkInput()) {
2529 if ($this->object->templateExists($_POST["name"])) {
2530 $name_input = $this->form_gui->getItemByPostVar("name");
2531 $name_input->setAlert($lng->txt("sty_table_template_already_exists"));
2532 } else {
2533 $classes = array();
2534 foreach (ilObjStyleSheet::_getTemplateClassTypes($_GET["temp_type"]) as $tct => $ct) {
2535 $classes[$tct] = $_POST[$tct . "_class"];
2536 }
2537 $t_id = $this->object->addTemplate($_GET["temp_type"], $_POST["name"], $classes);
2538 $this->object->writeTemplatePreview(
2539 $t_id,
2540 $this->getTemplatePreview($_GET["temp_type"], $t_id, true)
2541 );
2542 $ilCtrl->redirect($this, "listTemplates");
2543 }
2544 }
2545 $this->form_gui->setValuesByPost();
2546 $tpl->setContent($this->form_gui->getHTML());
2547 }
2548
2552 public function updateTemplateObject($a_refresh = false)
2553 {
2554 $tpl = $this->tpl;
2556 $lng = $this->lng;
2557
2558 $ilCtrl->setParameter($this, "t_id", $_GET["t_id"]);
2559 $this->initTemplateForm("edit");
2560
2561 if ($this->form_gui->checkInput()) {
2562 if ($this->object->templateExists($_POST["name"]) &&
2564 $name_input = $this->form_gui->getItemByPostVar("name");
2565 $name_input->setAlert($lng->txt("sty_template_already_exists"));
2566 } else {
2567 $classes = array();
2568 foreach (ilObjStyleSheet::_getTemplateClassTypes($_GET["temp_type"]) as $tct => $ct) {
2569 $classes[$tct] = $_POST[$tct . "_class"];
2570 }
2571
2572 $this->object->updateTemplate(
2573 $_GET["t_id"],
2574 $_POST["name"],
2575 $classes
2576 );
2577 $this->object->writeTemplatePreview(
2578 $_GET["t_id"],
2579 $this->getTemplatePreview($_GET["temp_type"], $_GET["t_id"], true)
2580 );
2581 if (!$a_refresh) {
2582 $ilCtrl->redirect($this, "listTemplates");
2583 }
2584 }
2585 }
2586
2587 $this->form_gui->setValuesByPost();
2588 $this->displayTemplateEditForm();
2589 }
2590
2594 public function displayTemplateEditForm()
2595 {
2596 $tpl = $this->tpl;
2597
2598 $a_tpl = new ilTemplate(
2599 "tpl.template_edit.html",
2600 true,
2601 true,
2602 "Services/Style/Content"
2603 );
2604 $this->includeCSS();
2605 $a_tpl->setVariable("FORM", $this->form_gui->getHTML());
2606 $a_tpl->setVariable("PREVIEW", $this->getTemplatePreview($_GET["temp_type"], $_GET["t_id"]));
2607 $tpl->setContent($a_tpl->get());
2608 }
2609
2613 public function refreshTemplateObject()
2614 {
2615 $this->updateTemplateObject(true);
2616 }
2617
2621 public function getTemplateFormValues()
2622 {
2623 if ($_GET["t_id"] > 0) {
2624 $t = $this->object->getTemplate($_GET["t_id"]);
2625
2626 $values["name"] = $t["name"];
2628 foreach ($scs as $k => $type) {
2629 $values[$k . "_class"] = $t["classes"][$k];
2630 }
2631 $this->form_gui->setValuesByArray($values);
2632 }
2633 }
2634
2639 {
2641 $tpl = $this->tpl;
2642 $lng = $this->lng;
2643
2644 if (!is_array($_POST["tid"]) || count($_POST["tid"]) == 0) {
2645 ilUtil::sendInfo($lng->txt("no_checkbox"), true);
2646 $ilCtrl->redirect($this, "listTemplates");
2647 } else {
2648 include_once("./Services/Utilities/classes/class.ilConfirmationGUI.php");
2649 $cgui = new ilConfirmationGUI();
2650 $cgui->setFormAction($ilCtrl->getFormAction($this));
2651 $cgui->setHeaderText($lng->txt("sty_confirm_template_deletion"));
2652 $cgui->setCancel($lng->txt("cancel"), "cancelTemplateDeletion");
2653 $cgui->setConfirm($lng->txt("sty_del_template"), "deleteTemplate");
2654
2655 foreach ($_POST["tid"] as $tid) {
2656 $classes = $this->object->getTemplateClasses($tid);
2657 $cl_str = "";
2658 $listed = array();
2659 foreach ($classes as $cl) {
2660 if ($cl != "" && !$listed[$cl]) {
2661 $cl_str .= '<div>- ' .
2662 $cl . "</div>";
2663 $listed[$cl] = true;
2664 }
2665 }
2666 if ($cl_str != "") {
2667 $cl_str = '<div style="padding-left:30px;" class="small">' .
2668 "<div><i>" . $lng->txt("sty_style_class") . "</i></div>" . $cl_str . "</div>";
2669 }
2670 $cgui->addItem("tid[]", $tid, $this->object->lookupTemplateName($tid) . $cl_str);
2671 }
2672
2673 $cgui->addButton($lng->txt("sty_del_template_keep_classes"), "deleteTemplateKeepClasses");
2674
2675 $tpl->setContent($cgui->getHTML());
2676 }
2677 }
2678
2683 {
2685
2686 $ilCtrl->redirect($this, "listTemplates");
2687 }
2688
2693 {
2695
2696 if (is_array($_POST["tid"])) {
2697 foreach ($_POST["tid"] as $tid) {
2698 $this->object->removeTemplate($tid);
2699 }
2700 }
2701
2702 $ilCtrl->redirect($this, "listTemplates");
2703 }
2704
2708 public function deleteTemplateObject()
2709 {
2711
2712 if (is_array($_POST["tid"])) {
2713 foreach ($_POST["tid"] as $tid) {
2714 $cls = $this->object->getTemplateClasses($tid);
2715 foreach ($cls as $k => $cls) {
2716 $ty = $this->object->determineTemplateStyleClassType($_GET["temp_type"], $k);
2718 $this->object->deleteCharacteristic($ty, $ta, $cls);
2719 }
2720 $this->object->removeTemplate($tid);
2721 }
2722 }
2723
2724 $ilCtrl->redirect($this, "listTemplates");
2725 }
2726
2730 public function generateTemplateObject()
2731 {
2732 $tpl = $this->tpl;
2733
2735 $tpl->setContent($this->form_gui->getHTML());
2736 }
2737
2742 {
2743 $lng = $this->lng;
2745
2746 include_once("Services/Form/classes/class.ilPropertyFormGUI.php");
2747 $this->form_gui = new ilPropertyFormGUI();
2748
2749 $this->form_gui->setTitle($lng->txt("sty_generate_template"));
2750
2751 // name
2752 $name_input = new ilRegExpInputGUI($lng->txt("sty_template_name"), "name");
2753 $name_input->setPattern("/^[a-zA-Z]+[a-zA-Z0-9]*$/");
2754 $name_input->setNoMatchMessage($lng->txt("sty_msg_color_must_only_include") . " A-Z, a-z, 1-9");
2755 $name_input->setRequired(true);
2756 $name_input->setSize(30);
2757 $name_input->setMaxLength(30);
2758 $this->form_gui->addItem($name_input);
2759
2760 // basic layout
2761 $bl_input = new ilSelectInputGUI($lng->txt("sty_template_layout"), "layout");
2762 $options = array(
2763 "coloredZebra" => $lng->txt("sty_table_template_colored_zebra"),
2764 "bwZebra" => $lng->txt("sty_table_template_bw_zebra"),
2765 "noZebra" => $lng->txt("sty_table_template_no_zebra")
2766 );
2767 $bl_input->setOptions($options);
2768 $this->form_gui->addItem($bl_input);
2769
2770 // top bottom padding
2771 include_once("./Services/Style/Content/classes/class.ilNumericStyleValueInputGUI.php");
2772 $num_input = new ilNumericStyleValueInputGUI($lng->txt("sty_top_bottom_padding"), "tb_padding");
2773 $num_input->setAllowPercentage(false);
2774 $num_input->setValue("3px");
2775 $this->form_gui->addItem($num_input);
2776
2777 // left right padding
2778 $num_input = new ilNumericStyleValueInputGUI($lng->txt("sty_left_right_padding"), "lr_padding");
2779 $num_input->setAllowPercentage(false);
2780 $num_input->setValue("10px");
2781 $this->form_gui->addItem($num_input);
2782
2783 // base color
2784 $bc_input = new ilSelectInputGUI($lng->txt("sty_base_color"), "base_color");
2785 $cs = $this->object->getColors();
2786 $options = array();
2787 foreach ($cs as $c) {
2788 $options[$c["name"]] = $c["name"];
2789 }
2790 $bc_input->setOptions($options);
2791 $this->form_gui->addItem($bc_input);
2792
2793 // Lightness Settings
2794 $lss = array("border" => 90, "header_text" => 70, "header_bg" => 0,
2795 "cell1_text" => -60, "cell1_bg" => 90, "cell2_text" => -60, "cell2_bg" => 75);
2796 foreach ($lss as $ls => $v) {
2797 $l_input = new ilNumberInputGUI($lng->txt("sty_lightness_" . $ls), "lightness_" . $ls);
2798 $l_input->setMaxValue(100);
2799 $l_input->setMinValue(-100);
2800 $l_input->setValue($v);
2801 $l_input->setSize(4);
2802 $l_input->setMaxLength(4);
2803 $this->form_gui->addItem($l_input);
2804 }
2805
2806 $this->form_gui->addCommandButton("templateGeneration", $lng->txt("generate"));
2807 $this->form_gui->addCommandButton("cancelTemplateSaving", $lng->txt("cancel"));
2808 $this->form_gui->setFormAction($ilCtrl->getFormAction($this));
2809 }
2810
2815 {
2816 $tpl = $this->tpl;
2818 $lng = $this->lng;
2819
2821
2822 if ($this->form_gui->checkInput()) {
2823 if ($this->object->templateExists($_POST["name"])) {
2824 $name_input = $this->form_gui->getItemByPostVar("name");
2825 $name_input->setAlert($lng->txt("sty_table_template_already_exists"));
2826 } else {
2827 // -> move to application class!
2828
2829 // cell classes
2830 $cells = array("H" => "header", "C1" => "cell1", "C2" => "cell2");
2831 $tb_p = $this->form_gui->getItemByPostVar("tb_padding");
2832 $tb_padding = $tb_p->getValue();
2833 $lr_p = $this->form_gui->getItemByPostVar("lr_padding");
2834 $lr_padding = $lr_p->getValue();
2835 $cell_color = $_POST["base_color"];
2836
2837 // use mid gray as cell color for bw zebra
2838 if ($_POST["layout"] == "bwZebra") {
2839 $cell_color = "MidGray";
2840 if (!$this->object->colorExists($cell_color)) {
2841 $this->object->addColor($cell_color, "7F7F7F");
2842 }
2843 $this->object->updateColor($cell_color, $cell_color, "7F7F7F");
2844 }
2845
2846 foreach ($cells as $k => $cell) {
2847 $cell_class[$k] = $_POST["name"] . $k;
2848 if (!$this->object->characteristicExists($cell_class[$k], "table_cell")) {
2849 $this->object->addCharacteristic("table_cell", $cell_class[$k], true);
2850 }
2851 if ($_POST["layout"] == "bwZebra" && $k == "H") {
2852 $this->object->replaceStylePar(
2853 "td",
2854 $cell_class[$k],
2855 "color",
2856 "!" . $_POST["base_color"] . "(" . $_POST["lightness_" . $cell . "_text"] . ")",
2857 "table_cell"
2858 );
2859 $this->object->replaceStylePar(
2860 "td",
2861 $cell_class[$k],
2862 "background-color",
2863 "!" . $_POST["base_color"] . "(" . $_POST["lightness_" . $cell . "_bg"] . ")",
2864 "table_cell"
2865 );
2866 } else {
2867 $this->object->replaceStylePar(
2868 "td",
2869 $cell_class[$k],
2870 "color",
2871 "!" . $cell_color . "(" . $_POST["lightness_" . $cell . "_text"] . ")",
2872 "table_cell"
2873 );
2874 $this->object->replaceStylePar(
2875 "td",
2876 $cell_class[$k],
2877 "background-color",
2878 "!" . $cell_color . "(" . $_POST["lightness_" . $cell . "_bg"] . ")",
2879 "table_cell"
2880 );
2881 }
2882 $this->object->replaceStylePar(
2883 "td",
2884 $cell_class[$k],
2885 "padding-top",
2886 $tb_padding,
2887 "table_cell"
2888 );
2889 $this->object->replaceStylePar(
2890 "td",
2891 $cell_class[$k],
2892 "padding-bottom",
2893 $tb_padding,
2894 "table_cell"
2895 );
2896 $this->object->replaceStylePar(
2897 "td",
2898 $cell_class[$k],
2899 "padding-left",
2900 $lr_padding,
2901 "table_cell"
2902 );
2903 $this->object->replaceStylePar(
2904 "td",
2905 $cell_class[$k],
2906 "padding-right",
2907 $lr_padding,
2908 "table_cell"
2909 );
2910 $this->object->replaceStylePar(
2911 "td",
2912 $cell_class[$k],
2913 "border-width",
2914 "1px",
2915 "table_cell"
2916 );
2917 $this->object->replaceStylePar(
2918 "td",
2919 $cell_class[$k],
2920 "border-style",
2921 "solid",
2922 "table_cell"
2923 );
2924 $this->object->replaceStylePar(
2925 "td",
2926 $cell_class[$k],
2927 "border-color",
2928 "!" . $cell_color . "(" . $_POST["lightness_border"] . ")",
2929 "table_cell"
2930 );
2931 $this->object->replaceStylePar(
2932 "td",
2933 $cell_class[$k],
2934 "font-weight",
2935 "normal",
2936 "table_cell"
2937 );
2938 }
2939
2940 // table class
2941 $classes["table"] = $_POST["name"] . "T";
2942 if (!$this->object->characteristicExists($classes["table"], "table")) {
2943 $this->object->addCharacteristic("table", $classes["table"], true);
2944 }
2945 $this->object->replaceStylePar(
2946 "table",
2947 $classes["table"],
2948 "caption-side",
2949 "bottom",
2950 "table"
2951 );
2952 $this->object->replaceStylePar(
2953 "table",
2954 $classes["table"],
2955 "border-collapse",
2956 "collapse",
2957 "table"
2958 );
2959 $this->object->replaceStylePar(
2960 "table",
2961 $classes["table"],
2962 "margin-top",
2963 "5px",
2964 "table"
2965 );
2966 $this->object->replaceStylePar(
2967 "table",
2968 $classes["table"],
2969 "margin-bottom",
2970 "5px",
2971 "table"
2972 );
2973 if ($_POST["layout"] == "bwZebra") {
2974 $this->object->replaceStylePar(
2975 "table",
2976 $classes["table"],
2977 "border-bottom-color",
2978 "!" . $_POST["base_color"],
2979 "table"
2980 );
2981 $this->object->replaceStylePar(
2982 "table",
2983 $classes["table"],
2984 "border-bottom-style",
2985 "solid",
2986 "table"
2987 );
2988 $this->object->replaceStylePar(
2989 "table",
2990 $classes["table"],
2991 "border-bottom-width",
2992 "3px",
2993 "table"
2994 );
2995 $sb = array("left", "right", "top");
2996 foreach ($sb as $b) {
2997 $this->object->replaceStylePar(
2998 "table",
2999 $classes["table"],
3000 "border-" . $b . "-width",
3001 "0px",
3002 "table"
3003 );
3004 }
3005 }
3006
3007 switch ($_POST["layout"]) {
3008 case "coloredZebra":
3009 $classes["row_head"] = $cell_class["H"];
3010 $classes["odd_row"] = $cell_class["C1"];
3011 $classes["even_row"] = $cell_class["C2"];
3012 break;
3013
3014 case "bwZebra":
3015 $classes["row_head"] = $cell_class["H"];
3016 $classes["odd_row"] = $cell_class["C1"];
3017 $classes["even_row"] = $cell_class["C2"];
3018 break;
3019
3020 case "noZebra":
3021 $classes["row_head"] = $cell_class["H"];
3022 $classes["odd_row"] = $cell_class["C1"];
3023 $classes["even_row"] = $cell_class["C1"];
3024 $classes["col_head"] = $cell_class["C2"];
3025 break;
3026 }
3027
3028
3029 $t_id = $this->object->addTemplate(
3030 $_GET["temp_type"],
3031 $_POST["name"],
3032 $classes
3033 );
3034 $this->object->writeTemplatePreview(
3035 $t_id,
3036 $this->getTemplatePreview($_GET["temp_type"], $t_id, true)
3037 );
3038 $ilCtrl->redirect($this, "listTemplates");
3039 }
3040 }
3041 $this->form_gui->setValuesByPost();
3042 $tpl->setContent($this->form_gui->getHTML());
3043 }
3044
3045 public function accordiontestObject()
3046 {
3047 $tpl = $this->tpl;
3048
3049 include_once("./Services/Accordion/classes/class.ilAccordionGUI.php");
3050
3051 $acc = new ilAccordionGUI();
3052 $acc->addItem("Header 1", str_repeat("bla bla bla bla bla bla", 30));
3053 $acc->addItem("Header 2", str_repeat("xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx xx x xx x xx", 30));
3054 $acc->setOrientation(ilAccordionGUI::HORIZONTAL);
3055
3056 $ac2 = new ilAccordionGUI();
3057 $ac2->addItem("Header 1", str_repeat("bla bla bla bla bla bla", 30));
3058 $ac2->addItem("Header 2", $acc->getHTML());
3059 $ac2->setOrientation(ilAccordionGUI::VERTICAL);
3060
3061 $tpl->setContent($ac2->getHTML());
3062 }
3063
3068 {
3070
3071 /*if ($_GET["baseClass"] == "ilAdministrationGUI")
3072 {
3073 $ilCtrl->redirectByClass("ilcontentstylesettingsgui", "edit");
3074 }*/
3075 $ilCtrl->returnToParent($this);
3076 }
3077}
if(php_sapi_name() !='cli') $in
Definition: Utf8Test.php:37
$source
Definition: linkback.php:22
$_GET["client_id"]
$_POST["username"]
$_SESSION["AccountId"]
An exception for terminatinating execution or to throw for unit testing.
Accordion user interface class.
static addCss()
Add required css.
This class represents a background image property in a property form.
This class represents a background position in a property form.
This class represents a checkbox property in a property form.
Color picker form for selecting color hexcodes using yui library.
Confirmation screen class.
This class represents a file property in a property form.
This class represents a fint size property in a property form.
This class represents a section header in a property form.
const ID_PART_SCREEN
This class represents a hidden form property in a property form.
This class represents an image file property in a property form.
Import class.
This class represents a number property in a property form.
This class represents a numeric style property in a property form.
Class ilObjStyleSheetGUI.
editTemplateObject()
Edit table template.
listImagesObject()
List images of style.
updateMediaQueryObject()
Update media query.
saveMediaQueryOrderObject()
Save media query order.
__construct($a_data, $a_id, $a_call_by_reference, $a_prep=true)
Constructor @access public.
cancelCharacteristicDeletionObject()
Cancel characteristic deletion.
generateTemplateObject()
Generate table template.
initTagStyleForm($a_mode, $a_cur_tag)
Init tag style editing form.
getAdminTabs()
admin and normal tabs are equal for roles
templateGenerationObject()
Table template generation.
getValues()
FORM: Get current values from persistent object.
refreshObject()
refresh style sheet
cancelObject()
update style sheet
deleteMediaQueryConfirmationObject()
Confirm media query deletion.
listMediaQueriesObject()
List media queries of style.
deleteCharacteristicConfirmationObject()
Characteristic deletion confirmation screen.
cancelTemplateDeletionObject()
Cancel table template deletion.
getPropertiesValues()
Get current values for properties from.
getTemplatePreview($a_type, $a_t_id, $a_small_mode=false)
Get table template preview.
newStyleParameterObject()
add style parameter
afterImport(ilObject $a_new_obj)
After import.
addCharacteristicFormObject()
Add characteristic.
pasteCharacteristicsObject()
Paste characteristics.
deleteObject($a_error=false)
display deletion confirmation screen
refreshTemplateObject()
Refresh table template.
deleteTemplateObject()
Delete table template.
deleteColorConfirmationObject()
Delete color confirmation.
cancelColorDeletionObject()
Cancel color deletion.
deleteTemplateKeepClassesObject()
Delete table template.
getColorFormValues()
Set values for color editing.
getTemplateFormValues()
Set values for table template editing.
updateTagStyleObject()
save and refresh tag editing
initTemplateGenerationForm()
Init table template generation form.
deleteTemplateConfirmationObject()
Delete table template confirmation.
pasteCharacteristicsOverviewObject()
Paste characteristics overview.
saveHideStatusObject()
Save hide status for characteristics.
writeStylePar($cur_tag, $cur_class, $par, $value, $a_type, $a_mq_id, $a_custom=false)
initColorForm($a_mode="create")
Init color form.
cancelColorSavingObject()
Cancel color saving.
copyStyleObject()
save style sheet
outputTagStyleEditScreen()
Output tag style edit screen.
switchMQueryObject()
Switch media query.
addMediaQueryObject()
Add a media query.
updateObject()
Update properties.
initTemplateForm($a_mode="create")
Init table template form.
deleteStyleParameterObject()
delete style parameters
displayTemplateEditForm()
Display table tempalte edit form.
updateTemplateObject($a_refresh=false)
Update table template.
static _getTemplatePreview($a_style, $a_type, $a_t_id, $a_small_mode=false)
Get table template preview.
importStyleObject()
import style sheet
deleteMediaQueriesObject()
Delete Media Queries.
initMediaQueryForm($a_mode="create")
Init media query form.
saveCharacteristicObject()
Save Characteristic.
copyCharacteristicsObject()
Copy style classes.
cancelDeleteObject()
cancel oobject deletion
refreshTagStyleObject()
save and refresh tag editing
editMediaQueryObject()
Edit media query.
executeCommand()
execute command
editTagStyleObject()
Edit tag style.
confirmedDeleteObject()
delete selected style objects
initPropertiesForm($a_mode="edit")
FORM: Init properties form.
listColorsObject()
List colors of style.
setTemplatesSubTabs()
adds tabs to tab gui object
saveTemplateObject()
Save table template.
getMediaQueryFormValues()
Set values for media query editing.
static getStyleExampleHTML($a_type, $a_class)
Get style example HTML.
viewObject()
list childs of current object
deleteCoreCharMessage()
Message that appears, when user tries to delete core characteristics.
addAdminLocatorItems($a_do_not_add_object=false)
should be overwritten to add object specific items (repository items are preloaded)
includeCSS()
Include CSS in output.
returnToUpperContextObject()
return to upper context
initCharacteristicForm($a_mode)
Init tag style editing form.
extractParametersOfTag($a_tag, $a_class, $a_style, $a_type, $a_mq_id=0, $a_custom=false)
getTabs()
adds tabs to tab gui object
setSubTabs()
adds tabs to tab gui object
saveMediaQueryObject()
Save media query.
listTemplatesObject()
List templates.
cancelTemplateSavingObject()
Cancel color saving.
deleteCharacteristicObject()
Delete one or multiple style characteristic.
Class ilObjStyleSheet.
static getBasicZipPath()
Get basic zip path.
static _getStyleParameterInputType($par)
static _getTemplateClassTypes($a_template_type="")
Get template class types.
static _getClonableContentStyles()
Get all clonable styles (active standard styles and individual learning module styles with write perm...
static _getStyleParameters($a_tag="")
static _writeStandard($a_id, $a_std)
Write standard flag.
static _isExpandable($a_type)
static _addMissingStyleClassesToStyle($a_id)
Add missing style classes to all styles.
static _determineTag($a_type)
static _getStyleSuperTypeForType($a_type)
static _lookupTemplateName($a_t_id)
Lookup table template name for template ID.
static _writeUpToDate($a_id, $a_up_to_date)
Write up to date.
static getContentStylePath($a_style_id, $add_random=true)
get content style path
static _getCoreStyles()
Get core styles.
static getInstanceByObjId($a_obj_id, $stop_on_error=true)
get an instance of an Ilias object by object id
static getInstanceByRefId($a_ref_id, $stop_on_error=true)
get an instance of an Ilias object by reference id
Class ilObjectGUI Basic methods of all Output classes.
prepareOutput($a_show_subobjects=true)
prepare output
getCreationFormsHTML(array $a_forms)
Get HTML for creation forms (accordion)
setCreationMode($a_mode=true)
if true, a creation screen is displayed the current $_GET[ref_id] don't belong to the current class!...
Class ilObject Basic functions for all objects.
static _lookupObjId($a_id)
static _lookupTitle($a_id)
lookup object title
static _lookupType($a_id, $a_reference=false)
lookup object type
static _renderTable( $content, $a_mode="table_edit", $a_submode="", $a_table_obj=null, $unmask=true)
Static render table function.
This class represents a property form user interface.
This class represents a regular expression input property in a property form.
This class represents a selection list property in a property form.
TableGUI class for style editor (image list)
TableGUI class for style editor (image list)
TableGUI class for style editor (image list)
TableGUI class for style editor.
This class represents a border style with all/top/right/bottom/left in a property form.
This class represents a border width with all/top/right/bottom/left in a property form.
Color picker form for selecting color hexcodes using yui library (all/top/right/bottom/left)
This class represents a numeric style property with all/top/right/bottom/left in a property form.
special template class to simplify handling of ITX/PEAR
This class represents a text area property in a property form.
This class represents a text property in a property form.
static getImageTagByType($a_type, $a_path, $a_big=false)
Builds an html image tag TODO: function still in use, but in future use getImagePath and move HTML-Co...
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
static deliverFile( $a_file, $a_filename, $a_mime='', $isInline=false, $removeAfterDelivery=false, $a_exit_after=true)
deliver file for download via browser.
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
static prepareFormOutput($a_str, $a_strip=false)
prepares string output for html forms @access public
$i
Definition: disco.tpl.php:19
$h
$style
Definition: example_012.php:70
$r
Definition: example_031.php:79
if(!array_key_exists('StateId', $_REQUEST)) $id
global $ilCtrl
Definition: ilias.php:18
if(function_exists( 'posix_getuid') &&posix_getuid()===0) if(!array_key_exists('t', $options)) $tag
Definition: cron.php:35
$info
Definition: index.php:5
redirection script todo: (a better solution should control the processing via a xml file)
$ret
Definition: parser.php:6
$type
if(empty($password)) $table
Definition: pwgen.php:24
if(isset($_POST['submit'])) $form
global $DIC
Definition: saml.php:7
settings()
Definition: settings.php:2
$values
$a_type
Definition: workflow.php:92