ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
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 //echo "HH"; exit;
998 $class_name = "ilObjStyleSheet";
999 require_once("./Services/Style/Content/classes/class.ilObjStyleSheet.php");
1000 $newObj = new ilObjStyleSheet();
1001 $newObj->setTitle("-");
1002 $newObj->create();
1003 $newObj->setTitle(ilUtil::stripSlashes($_POST["style_title"]));
1004 $newObj->setDescription(ilUtil::stripSlashes($_POST["style_description"]));
1005 $newObj->update();
1006
1007 // assign style to style sheet folder,
1008 // if parent is style sheet folder
1009 if ($_GET["ref_id"] > 0) {
1010 $fold = ilObjectFactory::getInstanceByRefId($_GET["ref_id"]);
1011 if ($fold->getType() == "stys") {
1012 include_once("./Services/Style/Content/classes/class.ilContentStyleSettings.php");
1013 $cont_style_settings = new ilContentStyleSettings();
1014 $cont_style_settings->addStyle($newObj->getId());
1015 $cont_style_settings->update();
1016
1017 ilObjStyleSheet::_writeStandard($newObj->getId(), "1");
1018 $this->ctrl->returnToParent($this);
1019 }
1020 }
1021
1022 return $newObj->getId();
1023 }
1024
1028 public function copyStyleObject()
1029 {
1030 if ($_POST["source_style"] > 0) {
1031 $style_obj = ilObjectFactory::getInstanceByObjId($_POST["source_style"]);
1032 $new_id = $style_obj->ilClone();
1033 }
1034
1035 // assign style to style sheet folder,
1036 // if parent is style sheet folder
1037 if ($_GET["ref_id"] > 0) {
1038 $fold = ilObjectFactory::getInstanceByRefId($_GET["ref_id"]);
1039 if ($fold->getType() == "stys") {
1040 include_once("./Services/Style/Content/classes/class.ilContentStyleSettings.php");
1041 $cont_style_settings = new ilContentStyleSettings();
1042 $cont_style_settings->addStyle($new_id);
1043 $cont_style_settings->update();
1044 ilObjStyleSheet::_writeStandard($new_id, "1");
1045 $this->ctrl->returnToParent($this);
1046 }
1047 }
1048
1049 return $new_id;
1050 }
1051
1055 public function importStyleObject()
1056 {
1057 // check file
1058 $source = $_FILES["importfile"]["tmp_name"];
1059 if (($source == 'none') || (!$source)) {
1060 $this->ilias->raiseError("No file selected!", $this->ilias->error_obj->MESSAGE);
1061 }
1062
1063 // check correct file type
1064 $info = pathinfo($_FILES["importfile"]["name"]);
1065 if (strtolower($info["extension"]) != "zip" && strtolower($info["extension"]) != "xml") {
1066 $this->ilias->raiseError("File must be a zip or xml file!", $this->ilias->error_obj->MESSAGE);
1067 }
1068
1069 // new import
1070 $fname = explode("_", $_FILES["importfile"]["name"]);
1071 if (strtolower($info["extension"]) == "zip" && $fname[4] == "sty") {
1072 include_once("./Services/Export/classes/class.ilImport.php");
1073 $imp = new ilImport();
1074 $new_id = $imp->importObject(
1075 null,
1076 $_FILES["importfile"]["tmp_name"],
1077 $_FILES["importfile"]["name"],
1078 "sty"
1079 );
1080 if ($new_id > 0) {
1081 $newObj = ilObjectFactory::getInstanceByObjId($new_id);
1082 }
1083 } else { // old import
1084 require_once("./Services/Style/Content/classes/class.ilObjStyleSheet.php");
1085 $newObj = new ilObjStyleSheet();
1086 $newObj->import($_FILES["importfile"]);
1087 }
1088
1089 // assign style to style sheet folder,
1090 // if parent is style sheet folder
1091 if ($_GET["ref_id"] > 0) {
1092 $fold = ilObjectFactory::getInstanceByRefId($_GET["ref_id"]);
1093 if ($fold->getType() == "stys") {
1094 include_once("./Services/Style/Content/classes/class.ilContentStyleSettings.php");
1095 $cont_style_settings = new ilContentStyleSettings();
1096 $cont_style_settings->addStyle($newObj->getId());
1097 $cont_style_settings->update();
1098 ilObjStyleSheet::_writeStandard($newObj->getId(), "1");
1099 $this->ctrl->returnToParent($this);
1100 }
1101 }
1102 return $newObj->getId();
1103 }
1104
1111 public function afterImport(ilObject $a_new_obj)
1112 {
1113 }
1114
1115
1119 public function cancelObject()
1120 {
1121 $lng = $this->lng;
1122
1123 ilUtil::sendInfo($lng->txt("msg_cancel"), true);
1124 $this->ctrl->returnToParent($this);
1125 }
1126
1130 public function getAdminTabs()
1131 {
1132 $this->getTabs();
1133 }
1134
1138 public function setTabs()
1139 {
1140 $lng = $this->lng;
1141
1142 $this->getTabs($this->tabs_gui);
1143
1144 if (strtolower(get_class($this->object)) == "ilobjstylesheet") {
1145 $this->tpl->setVariable("HEADER", $this->object->getTitle());
1146 } else {
1147 $this->tpl->setVariable("HEADER", $lng->txt("create_stylesheet"));
1148 }
1149 }
1150
1156 public function getTabs()
1157 {
1158 $lng = $this->lng;
1160 $ilTabs = $this->tabs;
1161 $ilHelp = $this->help;
1162
1163 $ilHelp->setScreenIdComponent("sty");
1164
1165 if ($ilCtrl->getCmd() == "editTagStyle") {
1166 // back to upper context
1167 $this->tabs_gui->setBackTarget(
1168 $lng->txt("back"),
1169 $ilCtrl->getLinkTarget($this, "edit")
1170 );
1171
1172 $t = explode(".", $_GET["tag"]);
1173 $t2 = explode(":", $t[1]);
1174 $pc = $this->object->_getPseudoClasses($t[0]);
1175 if (is_array($pc) && count($pc) > 0) {
1176 // style classes
1177 $ilCtrl->setParameter($this, "tag", $t[0] . "." . $t2[0]);
1178 $this->tabs_gui->addTarget(
1179 "sty_tag_normal",
1180 $this->ctrl->getLinkTarget($this, "editTagStyle"),
1181 array("editTagStyle", ""),
1182 get_class($this)
1183 );
1184 if ($t2[1] == "") {
1185 $ilTabs->setTabActive("sty_tag_normal");
1186 }
1187
1188 foreach ($pc as $p) {
1189 // style classes
1190 $ilCtrl->setParameter($this, "tag", $t[0] . "." . $t2[0] . ":" . $p);
1191 $this->tabs_gui->addTarget(
1192 "sty_tag_" . $p,
1193 $this->ctrl->getLinkTarget($this, "editTagStyle"),
1194 array("editTagStyle", ""),
1195 get_class($this)
1196 );
1197 if ($t2[1] == $p) {
1198 $ilTabs->setTabActive("sty_tag_" . $p);
1199 }
1200 }
1201 $ilCtrl->setParameter($this, "tag", $_GET["tag"]);
1202 }
1203 } else {
1204 // back to upper context
1205 $this->tabs_gui->setBackTarget(
1206 $lng->txt("back"),
1207 $this->ctrl->getLinkTarget($this, "returnToUpperContext")
1208 );
1209
1210 // style classes
1211 $this->tabs_gui->addTarget(
1212 "sty_style_chars",
1213 $this->ctrl->getLinkTarget($this, "edit"),
1214 array("edit", ""),
1215 get_class($this)
1216 );
1217
1218 // colors
1219 $this->tabs_gui->addTarget(
1220 "sty_colors",
1221 $this->ctrl->getLinkTarget($this, "listColors"),
1222 "listColors",
1223 get_class($this)
1224 );
1225
1226 // media queries
1227 $this->tabs_gui->addTarget(
1228 "sty_media_queries",
1229 $this->ctrl->getLinkTarget($this, "listMediaQueries"),
1230 "listMediaQueries",
1231 get_class($this)
1232 );
1233
1234 // images
1235 $this->tabs_gui->addTarget(
1236 "sty_images",
1237 $this->ctrl->getLinkTarget($this, "listImages"),
1238 "listImages",
1239 get_class($this)
1240 );
1241
1242 // table templates
1243 $this->tabs_gui->addTarget(
1244 "sty_templates",
1245 $this->ctrl->getLinkTarget($this, "listTemplates"),
1246 "listTemplates",
1247 get_class($this)
1248 );
1249
1250 // settings
1251 $this->tabs_gui->addTarget(
1252 "settings",
1253 $this->ctrl->getLinkTarget($this, "properties"),
1254 "properties",
1255 get_class($this)
1256 );
1257
1258 // accordiontest
1259/*
1260 $this->tabs_gui->addTarget("accordiontest",
1261 $this->ctrl->getLinkTarget($this, "accordiontest"), "accordiontest",
1262 get_class($this));*/
1263 }
1264 }
1265
1271 public function setSubTabs()
1272 {
1273 $lng = $this->lng;
1274 $ilTabs = $this->tabs;
1276
1278
1279 foreach ($types as $super_type => $types) {
1280 // text block characteristics
1281 $ilCtrl->setParameter($this, "style_type", $super_type);
1282 $ilTabs->addSubTabTarget(
1283 "sty_" . $super_type . "_char",
1284 $this->ctrl->getLinkTarget($this, "edit"),
1285 array("edit", ""),
1286 get_class($this)
1287 );
1288 }
1289
1290 $ilCtrl->setParameter($this, "style_type", $_GET["style_type"]);
1291 }
1292
1298 public function setTemplatesSubTabs()
1299 {
1300 $lng = $this->lng;
1301 $ilTabs = $this->tabs;
1303
1305
1306 foreach ($types as $t => $c) {
1307 $ilCtrl->setParameter($this, "temp_type", $t);
1308 $ilTabs->addSubTabTarget(
1309 "sty_" . $t . "_templates",
1310 $this->ctrl->getLinkTarget($this, "listTemplates"),
1311 array("listTemplates", ""),
1312 get_class($this)
1313 );
1314 }
1315
1316 $ilCtrl->setParameter($this, "temp_type", $_GET["temp_type"]);
1317 }
1318
1323 public function addAdminLocatorItems($a_do_not_add_object = false)
1324 {
1325 $ilLocator = $this->locator;
1326
1327 if ($_GET["admin_mode"] == "settings") { // system settings
1328 parent::addAdminLocatorItems(true);
1329
1330 $ilLocator->addItem(
1332 ilObject::_lookupObjId($_GET["ref_id"])
1333 ),
1334 $this->ctrl->getLinkTargetByClass("ilobjstylesettingsgui", "")
1335 );
1336
1337 if ($_GET["obj_id"] > 0) {
1338 $ilLocator->addItem(
1339 $this->object->getTitle(),
1340 $this->ctrl->getLinkTarget($this, "edit")
1341 );
1342 }
1343 } else { // repository administration
1344 //?
1345 }
1346 }
1347
1348 public function showUpperIcon()
1349 {
1351 $tpl = $this->tpl;
1353
1354 if (strtolower($_GET["baseClass"]) == "iladministrationgui") {
1355 $tpl->setUpperIcon(
1356 $this->ctrl->getLinkTargetByClass(
1357 "ilcontentstylesettings",
1358 "edit"
1359 )
1360 );
1361 } else {
1362 // ?
1363 }
1364 }
1365
1369 public function listImagesObject()
1370 {
1371 $tpl = $this->tpl;
1372 $ilToolbar = $this->toolbar;
1374 $lng = $this->lng;
1376
1377 if ($this->checkWrite()) {
1378 $ilToolbar->addButton(
1379 $lng->txt("sty_add_image"),
1380 $ilCtrl->getLinkTarget($this, "addImage")
1381 );
1382 }
1383
1384 include_once("./Services/Style/Content/classes/class.ilStyleImageTableGUI.php");
1385 $table_gui = new ilStyleImageTableGUI(
1386 $this,
1387 "listImages",
1388 $this->object
1389 );
1390 $tpl->setContent($table_gui->getHTML());
1391 }
1392
1396 public function addImageObject()
1397 {
1398 $tpl = $this->tpl;
1399
1400 $this->initImageForm();
1401 $tpl->setContent($this->form_gui->getHTML());
1402 }
1403
1407 public function cancelUploadObject()
1408 {
1410
1411 $ilCtrl->redirect($this, "listImages");
1412 }
1413
1417 public function uploadImageObject()
1418 {
1419 $tpl = $this->tpl;
1421
1422 $this->initImageForm();
1423
1424 if ($this->form_gui->checkInput()) {
1425 $this->object->uploadImage($_FILES["image_file"]);
1426 $ilCtrl->redirect($this, "listImages");
1427 } else {
1428 //$this->form_gui->setImageFormValuesByPost();
1429 $tpl->setContent($this->form_gui->getHTML());
1430 }
1431 }
1432
1436 public function initImageForm()
1437 {
1438 $lng = $this->lng;
1440
1441 include_once("Services/Form/classes/class.ilPropertyFormGUI.php");
1442 $this->form_gui = new ilPropertyFormGUI();
1443
1444 $this->form_gui->setTitle($lng->txt("sty_add_image"));
1445
1446 $file_input = new ilImageFileInputGUI($lng->txt("sty_image_file"), "image_file");
1447 $file_input->setRequired(true);
1448 $this->form_gui->addItem($file_input);
1449
1450 $this->form_gui->addCommandButton("uploadImage", $lng->txt("upload"));
1451 $this->form_gui->addCommandButton("cancelUpload", $lng->txt("cancel"));
1452 $this->form_gui->setFormAction($ilCtrl->getFormAction($this));
1453 }
1454
1458 public function deleteImageObject()
1459 {
1461
1462 $images = $this->object->getImages();
1463
1464 foreach ($images as $image) {
1465 if (is_array($_POST["file"]) && in_array($image["entry"], $_POST["file"])) {
1466 $this->object->deleteImage($image["entry"]);
1467 }
1468 }
1469 $ilCtrl->redirect($this, "listImages");
1470 }
1471
1476 {
1478 $tpl = $this->tpl;
1479 $lng = $this->lng;
1480
1481 //var_dump($_POST);
1482
1483 if (!is_array($_POST["char"]) || count($_POST["char"]) == 0) {
1484 ilUtil::sendInfo($lng->txt("no_checkbox"), true);
1485 $ilCtrl->redirect($this, "edit");
1486 } else {
1487 // check whether there are any core style classes included
1488 $core_styles = ilObjStyleSheet::_getCoreStyles();
1489 foreach ($_POST["char"] as $char) {
1490 if (!empty($core_styles[$char])) {
1491 $this->deleteCoreCharMessage();
1492 return;
1493 }
1494 }
1495
1496 include_once("./Services/Utilities/classes/class.ilConfirmationGUI.php");
1497 $cgui = new ilConfirmationGUI();
1498 $cgui->setFormAction($ilCtrl->getFormAction($this));
1499 $cgui->setHeaderText($lng->txt("sty_confirm_char_deletion"));
1500 $cgui->setCancel($lng->txt("cancel"), "cancelCharacteristicDeletion");
1501 $cgui->setConfirm($lng->txt("delete"), "deleteCharacteristic");
1502
1503 foreach ($_POST["char"] as $char) {
1504 $char_comp = explode(".", $char);
1505 $cgui->addItem("char[]", $char, $char_comp[2]);
1506 }
1507
1508 $tpl->setContent($cgui->getHTML());
1509 }
1510 }
1511
1518 public function deleteCoreCharMessage()
1519 {
1521 $tpl = $this->tpl;
1522 $lng = $this->lng;
1523
1524 include_once("./Services/Utilities/classes/class.ilConfirmationGUI.php");
1525 $cgui = new ilConfirmationGUI();
1526 $cgui->setFormAction($ilCtrl->getFormAction($this));
1527
1528
1529 $core_styles = ilObjStyleSheet::_getCoreStyles();
1530 $cnt = 0;
1531 foreach ($_POST["char"] as $char) {
1532 if (!empty($core_styles[$char])) {
1533 $cnt++;
1534 $char_comp = explode(".", $char);
1535 $cgui->addItem("", "", $char_comp[2]);
1536 } else {
1537 $cgui->addHiddenItem("char[]", $char);
1538 }
1539 }
1540 $all_core_styles = ($cnt == count($_POST["char"]))
1541 ? true
1542 : false;
1543
1544 if ($all_core_styles) {
1545 $cgui->setHeaderText($lng->txt("sty_all_styles_obligatory"));
1546 $cgui->setCancel($lng->txt("back"), "cancelCharacteristicDeletion");
1547 } else {
1548 $cgui->setHeaderText($lng->txt("sty_some_styles_obligatory_delete_rest"));
1549 $cgui->setCancel($lng->txt("cancel"), "cancelCharacteristicDeletion");
1550 $cgui->setConfirm($lng->txt("sty_delete_other_selected"), "deleteCharacteristicConfirmation");
1551 }
1552
1553 $tpl->setContent($cgui->getHTML());
1554 }
1555
1560 {
1562 $lng = $this->lng;
1563
1564 ilUtil::sendInfo($lng->txt("action_aborted"), true);
1565 $ilCtrl->redirect($this, "edit");
1566 }
1567
1572 {
1574
1575 if (is_array($_POST["char"])) {
1576 foreach ($_POST["char"] as $char) {
1577 $char_comp = explode(".", $char);
1578 $type = $char_comp[0];
1579 $tag = $char_comp[1];
1580 $class = $char_comp[2];
1581
1582 $this->object->deleteCharacteristic($type, $tag, $class);
1583 }
1584 }
1585
1586 $ilCtrl->redirect($this, "edit");
1587 }
1588
1593 {
1594 $tpl = $this->tpl;
1595
1596 $this->initCharacteristicForm("create");
1597 $tpl->setContent($this->form_gui->getHTML());
1598 }
1599
1604 {
1606 $tpl = $this->tpl;
1607 $lng = $this->lng;
1608
1609 $this->initCharacteristicForm("create");
1610
1611 if ($this->form_gui->checkInput()) {
1612 if ($this->object->characteristicExists($_POST["new_characteristic"], $_GET["style_type"])) {
1613 $char_input = $this->form_gui->getItemByPostVar("new_characteristic");
1614 $char_input->setAlert($lng->txt("sty_characteristic_already_exists"));
1615 } else {
1616 $this->object->addCharacteristic($_POST["type"], $_POST["new_characteristic"]);
1617 ilUtil::sendInfo($lng->txt("sty_added_characteristic"), true);
1618 $ilCtrl->setParameter(
1619 $this,
1620 "tag",
1621 ilObjStyleSheet::_determineTag($_POST["type"]) . "." . $_POST["new_characteristic"]
1622 );
1623 $ilCtrl->setParameter($this, "style_type", $_POST["type"]);
1624 $ilCtrl->redirect($this, "editTagStyle");
1625 }
1626 }
1627 $this->form_gui->setValuesByPost();
1628 $tpl->setContent($this->form_gui->getHTML());
1629 }
1630
1636 public function initCharacteristicForm($a_mode)
1637 {
1638 $lng = $this->lng;
1640
1641 include_once("Services/Form/classes/class.ilPropertyFormGUI.php");
1642 $this->form_gui = new ilPropertyFormGUI();
1643
1644 // title
1645 $txt_input = new ilRegExpInputGUI($lng->txt("title"), "new_characteristic");
1646 $txt_input->setPattern("/^[a-zA-Z]+[a-zA-Z0-9]*$/");
1647 $txt_input->setNoMatchMessage($lng->txt("sty_msg_characteristic_must_only_include") . " A-Z, a-z, 0-9");
1648 $txt_input->setRequired(true);
1649 $this->form_gui->addItem($txt_input);
1650
1651 // type
1652 $all_super_types = ilObjStyleSheet::_getStyleSuperTypes();
1653 $types = $all_super_types[$this->super_type];
1654 $exp_types = array();
1655 foreach ($types as $t) {
1657 $exp_types[$t] = $lng->txt("sty_type_" . $t);
1658 }
1659 }
1660 if (count($exp_types) > 1) {
1661 $type_input = new ilSelectInputGUI($lng->txt("sty_type"), "type");
1662 $type_input->setOptions($exp_types);
1663 $type_input->setValue(key($exp_types));
1664 $this->form_gui->addItem($type_input);
1665 } elseif (count($exp_types) == 1) {
1666 $hid_input = new ilHiddenInputGUI("type");
1667 $hid_input->setValue(key($exp_types));
1668 $this->form_gui->addItem($hid_input);
1669 }
1670
1671 $this->form_gui->setTitle($lng->txt("sty_add_characteristic"));
1672 $this->form_gui->addCommandButton("saveCharacteristic", $lng->txt("save"));
1673 $this->form_gui->addCommandButton("edit", $lng->txt("cancel"));
1674 $this->form_gui->setFormAction($ilCtrl->getFormAction($this));
1675 }
1676
1680 public static function getStyleExampleHTML($a_type, $a_class)
1681 {
1682 global $DIC;
1683
1684 $lng = $DIC->language();
1685
1686 $c = explode(":", $a_class);
1687 $a_class = $c[0];
1688
1689 $ex_tpl = new ilTemplate("tpl.style_example.html", true, true, "Services/Style/Content");
1690
1691 if ($ex_tpl->blockExists("Example_" . $a_type)) {
1692 $ex_tpl->setCurrentBlock("Example_" . $a_type);
1693 } else {
1694 $ex_tpl->setCurrentBlock("Example_default");
1695 }
1696 $ex_tpl->setVariable("EX_CLASS", "ilc_" . $a_type . "_" . $a_class);
1697 $ex_tpl->setVariable("EX_TEXT", "ABC abc 123");
1698 if (in_array($a_type, array("media_cont", "qimg"))) {
1699 //
1700 }
1701 if (in_array($a_type, array("table", "table_caption"))) {
1702 $ex_tpl->setVariable("TXT_CAPTION", $lng->txt("sty_caption"));
1703 }
1704 if (in_array($a_class, array("OrderListItemHorizontal", "OrderListHorizontal"))) {
1705 $ex_tpl->setVariable("HOR", "Horizontal");
1706 }
1707 $ex_tpl->parseCurrentBlock();
1708
1709 return $ex_tpl->get();
1710 }
1711
1715 public function saveHideStatusObject()
1716 {
1718 $lng = $this->lng;
1719
1720 //var_dump($_POST);
1721
1722 foreach ($_POST["all_chars"] as $char) {
1723 $ca = explode(".", $char);
1724 $this->object->saveHideStatus(
1725 $ca[0],
1726 $ca[2],
1727 (is_array($_POST["hide"]) && in_array($char, $_POST["hide"]))
1728 );
1729 }
1730
1731 ilUtil::sendInfo($lng->txt("msg_obj_modified"), true);
1732 $ilCtrl->redirect($this, "edit");
1733 }
1734
1742 {
1744 $lng = $this->lng;
1745
1746 if (!is_array($_POST["char"]) || count($_POST["char"]) == 0) {
1747 ilUtil::sendFailure($lng->txt("no_checkbox"), true);
1748 } else {
1749 $style_cp = implode("::", $_POST["char"]);
1750 $style_cp = $this->object->getId() . ":::" . $_GET["style_type"] . ":::" . $style_cp;
1751 $_SESSION["sty_copy"] = $style_cp;
1752 ilUtil::sendSuccess($lng->txt("sty_copied_please_select_target"), true);
1753 }
1754 $ilCtrl->redirect($this, "edit");
1755 }
1756
1764 {
1765 $tpl = $this->tpl;
1766 $ilTabs = $this->tabs;
1767
1768 $ilTabs->clearTargets();
1769
1770 include_once("./Services/Style/Content/classes/class.ilPasteStyleCharacteristicTableGUI.php");
1771 $table = new ilPasteStyleCharacteristicTableGUI($this, "pasteCharacteristicsOverview");
1772
1773 $tpl->setContent($table->getHTML());
1774 }
1775
1783 {
1785 $lng = $this->lng;
1786
1787 if (is_array($_POST["title"])) {
1788 foreach ($_POST["title"] as $from_char => $to_title) {
1789 $fc = explode(".", $from_char);
1790
1791 if ($_POST["conflict_action"][$from_char] == "overwrite" ||
1792 !$this->object->characteristicExists($to_title, $fc[0])) {
1793 $this->object->copyCharacteristic(
1794 $_POST["from_style_id"],
1795 $fc[0],
1796 $fc[2],
1797 $to_title
1798 );
1799 }
1800 }
1801 ilObjStyleSheet::_writeUpToDate($this->object->getId(), false);
1802 unset($_SESSION["sty_copy"]);
1803 ilUtil::sendSuccess($lng->txt("sty_style_classes_copied"), true);
1804 }
1805
1806 $ilCtrl->redirect($this, "edit");
1807 }
1808
1809 //
1810 // Color management
1811 //
1812
1816 public function listColorsObject()
1817 {
1818 $tpl = $this->tpl;
1820 $ilToolbar = $this->toolbar;
1822
1823 if ($this->checkWrite()) {
1824 $ilToolbar->addButton(
1825 $this->lng->txt("sty_add_color"),
1826 $ilCtrl->getLinkTarget($this, "addColor")
1827 );
1828 }
1829
1830 include_once("./Services/Style/Content/classes/class.ilStyleColorTableGUI.php");
1831 $table_gui = new ilStyleColorTableGUI(
1832 $this,
1833 "listColors",
1834 $this->object
1835 );
1836 $tpl->setContent($table_gui->getHTML());
1837 }
1838
1842 public function addColorObject()
1843 {
1844 $tpl = $this->tpl;
1845
1846 $this->initColorForm();
1847 $tpl->setContent($this->form_gui->getHTML());
1848 }
1849
1853 public function editColorObject()
1854 {
1855 $tpl = $this->tpl;
1857
1858 $ilCtrl->setParameter($this, "c_name", $_GET["c_name"]);
1859 $this->initColorForm("edit");
1860 $this->getColorFormValues();
1861 $tpl->setContent($this->form_gui->getHTML());
1862 }
1863
1864
1868 public function initColorForm($a_mode = "create")
1869 {
1870 $lng = $this->lng;
1872
1873 include_once("Services/Form/classes/class.ilPropertyFormGUI.php");
1874 $this->form_gui = new ilPropertyFormGUI();
1875
1876 $this->form_gui->setTitle($lng->txt("sty_add_color"));
1877
1878 // name
1879 $name_input = new ilRegExpInputGUI($lng->txt("sty_color_name"), "color_name");
1880 $name_input->setPattern("/^[a-zA-Z]+[a-zA-Z0-9]*$/");
1881 $name_input->setNoMatchMessage($lng->txt("sty_msg_color_must_only_include") . " A-Z, a-z, 1-9");
1882 $name_input->setRequired(true);
1883 $name_input->setSize(15);
1884 $name_input->setMaxLength(15);
1885 $this->form_gui->addItem($name_input);
1886
1887 // code
1888 $color_input = new ilColorPickerInputGUI($lng->txt("sty_color_code"), "color_code");
1889 $color_input->setRequired(true);
1890 $color_input->setDefaultColor("");
1891 $this->form_gui->addItem($color_input);
1892
1893 if ($a_mode == "create") {
1894 $this->form_gui->addCommandButton("saveColor", $lng->txt("save"));
1895 $this->form_gui->addCommandButton("cancelColorSaving", $lng->txt("cancel"));
1896 } else {
1897 $this->form_gui->addCommandButton("updateColor", $lng->txt("save"));
1898 $this->form_gui->addCommandButton("cancelColorSaving", $lng->txt("cancel"));
1899 }
1900 $this->form_gui->setFormAction($ilCtrl->getFormAction($this));
1901 }
1902
1906 public function getColorFormValues()
1907 {
1908 if ($_GET["c_name"] != "") {
1909 $values["color_name"] = $_GET["c_name"];
1910 $values["color_code"] = $this->object->getColorCodeForName($_GET["c_name"]);
1911 $this->form_gui->setValuesByArray($values);
1912 }
1913 }
1914
1918 public function cancelColorSavingObject()
1919 {
1921
1922 $ilCtrl->redirect($this, "listColors");
1923 }
1924
1928 public function saveColorObject()
1929 {
1930 $tpl = $this->tpl;
1932 $lng = $this->lng;
1933
1934 $this->initColorForm();
1935
1936 if ($this->form_gui->checkInput()) {
1937 if ($this->object->colorExists($_POST["color_name"])) {
1938 $col_input = $this->form_gui->getItemByPostVar("color_name");
1939 $col_input->setAlert($lng->txt("sty_color_already_exists"));
1940 } else {
1941 $this->object->addColor(
1942 $_POST["color_name"],
1943 $_POST["color_code"]
1944 );
1945 $ilCtrl->redirect($this, "listColors");
1946 }
1947 }
1948 $this->form_gui->setValuesByPost();
1949 $tpl->setContent($this->form_gui->getHTML());
1950 }
1951
1955 public function updateColorObject()
1956 {
1957 $tpl = $this->tpl;
1959 $lng = $this->lng;
1960
1961 $this->initColorForm("edit");
1962
1963 if ($this->form_gui->checkInput()) {
1964 if ($this->object->colorExists($_POST["color_name"]) &&
1965 $_POST["color_name"] != $_GET["c_name"]) {
1966 $col_input = $this->form_gui->getItemByPostVar("color_name");
1967 $col_input->setAlert($lng->txt("sty_color_already_exists"));
1968 } else {
1969 $this->object->updateColor(
1970 $_GET["c_name"],
1971 $_POST["color_name"],
1972 $_POST["color_code"]
1973 );
1974 $ilCtrl->redirect($this, "listColors");
1975 }
1976 }
1977 $ilCtrl->setParameter($this, "c_name", $_GET["c_name"]);
1978 $this->form_gui->setValuesByPost();
1979 $tpl->setContent($this->form_gui->getHTML());
1980 }
1981
1986 {
1988 $tpl = $this->tpl;
1989 $lng = $this->lng;
1990
1991 if (!is_array($_POST["color"]) || count($_POST["color"]) == 0) {
1992 ilUtil::sendInfo($lng->txt("no_checkbox"), true);
1993 $ilCtrl->redirect($this, "listColors");
1994 } else {
1995 include_once("./Services/Utilities/classes/class.ilConfirmationGUI.php");
1996 $cgui = new ilConfirmationGUI();
1997 $cgui->setFormAction($ilCtrl->getFormAction($this));
1998 $cgui->setHeaderText($lng->txt("sty_confirm_color_deletion"));
1999 $cgui->setCancel($lng->txt("cancel"), "cancelColorDeletion");
2000 $cgui->setConfirm($lng->txt("delete"), "deleteColor");
2001
2002 foreach ($_POST["color"] as $c) {
2003 $cgui->addItem("color[]", ilUtil::prepareFormOutput($c), $c);
2004 }
2005
2006 $tpl->setContent($cgui->getHTML());
2007 }
2008 }
2009
2014 {
2016
2017 $ilCtrl->redirect($this, "listColors");
2018 }
2019
2023 public function deleteColorObject()
2024 {
2026
2027 if (is_array($_POST["color"])) {
2028 foreach ($_POST["color"] as $c) {
2029 $this->object->removeColor($c);
2030 }
2031 }
2032
2033 $ilCtrl->redirect($this, "listColors");
2034 }
2035
2036 //
2037 // Media query management
2038 //
2039
2043 public function listMediaQueriesObject()
2044 {
2045 $tpl = $this->tpl;
2047 $ilToolbar = $this->toolbar;
2049
2050 if ($this->checkWrite()) {
2051 $ilToolbar->addButton(
2052 $this->lng->txt("sty_add_media_query"),
2053 $ilCtrl->getLinkTarget($this, "addMediaQuery")
2054 );
2055 }
2056
2057 include_once("./Services/Style/Content/classes/class.ilStyleMediaQueryTableGUI.php");
2058 $table_gui = new ilStyleMediaQueryTableGUI(
2059 $this,
2060 "listMediaQueries",
2061 $this->object
2062 );
2063 $tpl->setContent($table_gui->getHTML());
2064 }
2065
2069 public function addMediaQueryObject()
2070 {
2071 $tpl = $this->tpl;
2072
2073 $this->initMediaQueryForm();
2074 $tpl->setContent($this->form_gui->getHTML());
2075 }
2076
2080 public function editMediaQueryObject()
2081 {
2082 $tpl = $this->tpl;
2084
2085 $ilCtrl->setParameter($this, "mq_id", $_GET["mq_id"]);
2086 $this->initMediaQueryForm("edit");
2087 $this->getMediaQueryFormValues();
2088 $tpl->setContent($this->form_gui->getHTML());
2089 }
2090
2091
2095 public function initMediaQueryForm($a_mode = "create")
2096 {
2097 $lng = $this->lng;
2099
2100 include_once("Services/Form/classes/class.ilPropertyFormGUI.php");
2101 $this->form_gui = new ilPropertyFormGUI();
2102
2103 $this->form_gui->setTitle($lng->txt("sty_add_media_query"));
2104
2105 // media query
2106 $ti = new ilTextInputGUI("@media", "mquery");
2107 $ti->setMaxLength(2000);
2108 $this->form_gui->addItem($ti);
2109
2110
2111 if ($a_mode == "create") {
2112 $this->form_gui->addCommandButton("saveMediaQuery", $lng->txt("save"));
2113 $this->form_gui->addCommandButton("listMediaQueries", $lng->txt("cancel"));
2114 } else {
2115 $this->form_gui->addCommandButton("updateMediaQuery", $lng->txt("save"));
2116 $this->form_gui->addCommandButton("listMediaQueries", $lng->txt("cancel"));
2117 }
2118 $this->form_gui->setFormAction($ilCtrl->getFormAction($this));
2119 }
2120
2124 public function getMediaQueryFormValues()
2125 {
2126 if ($_GET["mq_id"] != "") {
2127 foreach ($this->object->getMediaQueries() as $mq) {
2128 if ($mq["id"] == (int) $_GET["mq_id"]) {
2129 $values["mquery"] = $mq["mquery"];
2130 }
2131 }
2132 $this->form_gui->setValuesByArray($values);
2133 }
2134 }
2135
2139 public function saveMediaQueryObject()
2140 {
2141 $tpl = $this->tpl;
2143 $lng = $this->lng;
2144
2145 $this->initMediaQueryForm();
2146
2147 if ($this->form_gui->checkInput()) {
2148 $this->object->addMediaQuery($_POST["mquery"]);
2149 $ilCtrl->redirect($this, "listMediaQueries");
2150 }
2151 $this->form_gui->setValuesByPost();
2152 $tpl->setContent($this->form_gui->getHTML());
2153 }
2154
2158 public function updateMediaQueryObject()
2159 {
2160 $tpl = $this->tpl;
2162 $lng = $this->lng;
2163
2164 $this->initMediaQueryForm("edit");
2165
2166 if ($this->form_gui->checkInput()) {
2167 $this->object->updateMediaQuery((int) $_GET["mq_id"], $_POST["mquery"]);
2168 $ilCtrl->redirect($this, "listMediaQueries");
2169 }
2170 $ilCtrl->setParameter($this, "mq_id", $_GET["mq_id"]);
2171 $this->form_gui->setValuesByPost();
2172 $tpl->setContent($this->form_gui->getHTML());
2173 }
2174
2179 {
2181 $tpl = $this->tpl;
2182 $lng = $this->lng;
2183
2184 if (!is_array($_POST["mq_id"]) || count($_POST["mq_id"]) == 0) {
2185 ilUtil::sendInfo($lng->txt("no_checkbox"), true);
2186 $ilCtrl->redirect($this, "listMediaQueries");
2187 } else {
2188 include_once("./Services/Utilities/classes/class.ilConfirmationGUI.php");
2189 $cgui = new ilConfirmationGUI();
2190 $cgui->setFormAction($ilCtrl->getFormAction($this));
2191 $cgui->setHeaderText($lng->txt("sty_sure_del_mqueries"));
2192 $cgui->setCancel($lng->txt("cancel"), "listMediaQueries");
2193 $cgui->setConfirm($lng->txt("delete"), "deleteMediaQueries");
2194
2195 foreach ($_POST["mq_id"] as $i) {
2196 $mq = $this->object->getMediaQueryForId($i);
2197 $cgui->addItem("mq_id[]", $i, $mq["mquery"]);
2198 }
2199
2200 $tpl->setContent($cgui->getHTML());
2201 }
2202 }
2203
2211 {
2214
2215 if ($this->checkWrite() && is_array($_POST["mq_id"])) {
2216 foreach ($_POST["mq_id"] as $id) {
2217 $this->object->deleteMediaQuery($id);
2218 }
2219 }
2220 $ilCtrl->redirect($this, "listMediaQueries");
2221 }
2222
2230 {
2232
2233 if (is_array($_POST["order"])) {
2234 $this->object->saveMediaQueryOrder($_POST["order"]);
2235 }
2236 $ilCtrl->redirect($this, "listMediaQueries");
2237 }
2238
2239
2240 //
2241 // Templates management
2242 //
2243
2247 public function listTemplatesObject()
2248 {
2249 $tpl = $this->tpl;
2250 $ilTabs = $this->tabs;
2252 $ilToolbar = $this->toolbar;
2253
2254 $ctype = $_GET["temp_type"];
2255 if ($ctype == "") {
2256 $ctype = "table";
2257 $ilCtrl->setParameter($this, "temp_type", $ctype);
2258 $_GET["temp_type"] = $ctype;
2259 }
2260
2261 $this->setTemplatesSubTabs();
2262 $ilTabs->setSubTabActive("sty_" . $ctype . "_templates");
2263
2264 // action commands
2265 if ($this->checkWrite()) {
2266 if ($ctype == "table") {
2267 $ilToolbar->addButton(
2268 $this->lng->txt("sty_generate_template"),
2269 $ilCtrl->getLinkTarget($this, "generateTemplate")
2270 );
2271 }
2272 $ilToolbar->addButton(
2273 $this->lng->txt("sty_add_template"),
2274 $ilCtrl->getLinkTarget($this, "addTemplate")
2275 );
2276 }
2277
2278
2279
2280 $this->includeCSS();
2281 include_once("./Services/Style/Content/classes/class.ilTableTemplatesTableGUI.php");
2282 $table_gui = new ilTableTemplatesTableGUI(
2283 $ctype,
2284 $this,
2285 "listTemplates",
2286 $this->object
2287 );
2288 $tpl->setContent($table_gui->getHTML());
2289 }
2290
2294 public function addTemplateObject()
2295 {
2296 $tpl = $this->tpl;
2297
2298 $this->initTemplateForm();
2299 $tpl->setContent($this->form_gui->getHTML());
2300 }
2301
2305 public function editTemplateObject()
2306 {
2307 $tpl = $this->tpl;
2309
2310 $ilCtrl->setParameter($this, "t_id", $_GET["t_id"]);
2311 $this->initTemplateForm("edit");
2312 $this->getTemplateFormValues();
2313
2314 $this->displayTemplateEditForm();
2315 }
2316
2320 public function getTemplatePreview($a_type, $a_t_id, $a_small_mode = false)
2321 {
2322 return $this->_getTemplatePreview(
2323 $this->object,
2324 $a_type,
2325 $a_t_id,
2326 $a_small_mode
2327 );
2328 }
2329
2333 public static function _getTemplatePreview($a_style, $a_type, $a_t_id, $a_small_mode = false)
2334 {
2335 global $DIC;
2336
2337 $lng = $DIC->language();
2338 $tpl = $DIC["tpl"];
2339
2340 $kr = $kc = 7;
2341 if ($a_small_mode) {
2342 $kr = 6;
2343 $kc = 5;
2344 }
2345
2346 $ts = $a_style->getTemplate($a_t_id);
2347 $t = $ts["classes"];
2348
2349 // preview
2350 if ($a_type == "table") {
2351 $p_content = '<PageContent><Table DataTable="y"';
2352 if ($t["row_head"] != "") {
2353 $p_content.= ' HeaderRows="1"';
2354 }
2355 if ($t["row_foot"] != "") {
2356 $p_content.= ' FooterRows="1"';
2357 }
2358 if ($t["col_head"] != "") {
2359 $p_content.= ' HeaderCols="1"';
2360 }
2361 if ($t["col_foot"] != "") {
2362 $p_content.= ' FooterCols="1"';
2363 }
2364 $p_content.= ' Template="' . $a_style->lookupTemplateName($a_t_id) . '">';
2365 if (!$a_small_mode) {
2366 $p_content.= '<Caption>' . $lng->txt("sty_caption") . '</Caption>';
2367 }
2368 for ($i = 1; $i<=$kr; $i++) {
2369 $p_content.= '<TableRow>';
2370 for ($j = 1; $j<=$kc; $j++) {
2371 if ($a_small_mode) {
2372 $cell = '&lt;div style="height:2px;"&gt;&lt;/div&gt;';
2373 } else {
2374 $cell = 'xxx';
2375 }
2376 $p_content.= '<TableData><PageContent><Paragraph Characteristic="TableContent">' . $cell . '</Paragraph></PageContent></TableData>';
2377 }
2378 $p_content.= '</TableRow>';
2379 }
2380 $p_content.= '</Table></PageContent>';
2381 }
2382
2383 if ($a_type == "vaccordion" || $a_type == "haccordion" || $a_type == "carousel") {
2384 include_once("./Services/Accordion/classes/class.ilAccordionGUI.php");
2386
2387 if ($a_small_mode) {
2388 $c = '&amp;nbsp;';
2389 $h = '&amp;nbsp;';
2390 } else {
2391 $c = 'xxx';
2392 $h = 'head';
2393 }
2394 if ($a_type == "vaccordion") {
2395 $p_content = '<PageContent><Tabs HorizontalAlign="Left" Type="VerticalAccordion" ';
2396 if ($a_small_mode) {
2397 $p_content.= ' ContentWidth="70"';
2398 }
2399 } elseif ($a_type == "haccordion") {
2400 $p_content = '<PageContent><Tabs Type="HorizontalAccordion"';
2401 if ($a_small_mode) {
2402 $p_content.= ' ContentHeight="40"';
2403 $p_content.= ' ContentWidth="70"';
2404 $c = '&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;';
2405 } else {
2406 $p_content.= ' ContentHeight="40"';
2407 }
2408 } elseif ($a_type == "carousel") {
2409 $p_content = '<PageContent><Tabs HorizontalAlign="Left" Type="Carousel" ';
2410 if ($a_small_mode) {
2411 $p_content.= ' ContentWidth="70"';
2412 }
2413 }
2414
2415
2416 $p_content.= ' Template="' . $a_style->lookupTemplateName($a_t_id) . '">';
2417 $p_content.= '<Tab><PageContent><Paragraph>' . $c . '</Paragraph></PageContent>';
2418 $p_content.= '<TabCaption>' . $h . '</TabCaption>';
2419 $p_content.= '</Tab>';
2420 $p_content.= '</Tabs></PageContent>';
2421 }
2422 //echo htmlentities($p_content);
2423 $txml = $a_style->getTemplateXML();
2424 //echo htmlentities($txml); exit;
2425 $p_content.= $txml;
2426 include_once("./Services/COPage/classes/class.ilPCTableGUI.php");
2427 $r_content = ilPCTableGUI::_renderTable($p_content, "");
2428
2429 // fix carousel template visibility
2430 if ($a_type == "carousel") {
2431 $r_content.= "<style>.owl-carousel{ display:block !important; }</style>";
2432 }
2433
2434 //echo htmlentities($r_content); exit;
2435 return $r_content;
2436 }
2437
2441 public function initTemplateForm($a_mode = "create")
2442 {
2443 $lng = $this->lng;
2445
2446 include_once("Services/Form/classes/class.ilPropertyFormGUI.php");
2447 $this->form_gui = new ilPropertyFormGUI();
2448
2449 if ($a_mode == "create") {
2450 $this->form_gui->setTitle($lng->txt("sty_add_template"));
2451 } else {
2452 $this->form_gui->setTitle($lng->txt("sty_edit_template"));
2453 }
2454
2455 // name
2456 $name_input = new ilRegExpInputGUI($lng->txt("sty_template_name"), "name");
2457 $name_input->setPattern("/^[a-zA-Z]+[a-zA-Z0-9]*$/");
2458 $name_input->setNoMatchMessage($lng->txt("sty_msg_color_must_only_include") . " A-Z, a-z, 1-9");
2459 $name_input->setRequired(true);
2460 $name_input->setSize(30);
2461 $name_input->setMaxLength(30);
2462 $this->form_gui->addItem($name_input);
2463
2464 // template style classes
2466 foreach ($scs as $sc => $st) {
2467 $sc_input = new ilSelectInputGUI($lng->txt("sty_" . $sc . "_class"), $sc . "_class");
2468 $chars = $this->object->getCharacteristics($st);
2469 $options = array("" => "");
2470 foreach ($chars as $char) {
2471 $options[$char] = $char;
2472 }
2473 $sc_input->setOptions($options);
2474 $this->form_gui->addItem($sc_input);
2475 }
2476
2477 if ($a_mode == "create") {
2478 $this->form_gui->addCommandButton("saveTemplate", $lng->txt("save"));
2479 $this->form_gui->addCommandButton("cancelTemplateSaving", $lng->txt("cancel"));
2480 } else {
2481 $this->form_gui->addCommandButton("refreshTemplate", $lng->txt("save_refresh"));
2482 $this->form_gui->addCommandButton("updateTemplate", $lng->txt("save_return"));
2483 $this->form_gui->addCommandButton("cancelTemplateSaving", $lng->txt("cancel"));
2484 }
2485 $this->form_gui->setFormAction($ilCtrl->getFormAction($this));
2486 }
2487
2492 {
2494
2495 $ilCtrl->redirect($this, "listTemplates");
2496 }
2497
2498
2502 public function saveTemplateObject()
2503 {
2504 $tpl = $this->tpl;
2506 $lng = $this->lng;
2507
2508 $this->initTemplateForm();
2509
2510 if ($this->form_gui->checkInput()) {
2511 if ($this->object->templateExists($_POST["name"])) {
2512 $name_input = $this->form_gui->getItemByPostVar("name");
2513 $name_input->setAlert($lng->txt("sty_table_template_already_exists"));
2514 } else {
2515 $classes = array();
2516 foreach (ilObjStyleSheet::_getTemplateClassTypes($_GET["temp_type"]) as $tct => $ct) {
2517 $classes[$tct] = $_POST[$tct . "_class"];
2518 }
2519 $t_id = $this->object->addTemplate($_GET["temp_type"], $_POST["name"], $classes);
2520 $this->object->writeTemplatePreview(
2521 $t_id,
2522 $this->getTemplatePreview($_GET["temp_type"], $t_id, true)
2523 );
2524 $ilCtrl->redirect($this, "listTemplates");
2525 }
2526 }
2527 $this->form_gui->setValuesByPost();
2528 $tpl->setContent($this->form_gui->getHTML());
2529 }
2530
2534 public function updateTemplateObject($a_refresh = false)
2535 {
2536 $tpl = $this->tpl;
2538 $lng = $this->lng;
2539
2540 $ilCtrl->setParameter($this, "t_id", $_GET["t_id"]);
2541 $this->initTemplateForm("edit");
2542
2543 if ($this->form_gui->checkInput()) {
2544 if ($this->object->templateExists($_POST["name"]) &&
2546 $name_input = $this->form_gui->getItemByPostVar("name");
2547 $name_input->setAlert($lng->txt("sty_template_already_exists"));
2548 } else {
2549 $classes = array();
2550 foreach (ilObjStyleSheet::_getTemplateClassTypes($_GET["temp_type"]) as $tct => $ct) {
2551 $classes[$tct] = $_POST[$tct . "_class"];
2552 }
2553
2554 $this->object->updateTemplate(
2555 $_GET["t_id"],
2556 $_POST["name"],
2557 $classes
2558 );
2559 $this->object->writeTemplatePreview(
2560 $_GET["t_id"],
2561 $this->getTemplatePreview($_GET["temp_type"], $_GET["t_id"], true)
2562 );
2563 if (!$a_refresh) {
2564 $ilCtrl->redirect($this, "listTemplates");
2565 }
2566 }
2567 }
2568
2569 $this->form_gui->setValuesByPost();
2570 $this->displayTemplateEditForm();
2571 }
2572
2576 public function displayTemplateEditForm()
2577 {
2578 $tpl = $this->tpl;
2579
2580 $a_tpl = new ilTemplate(
2581 "tpl.template_edit.html",
2582 true,
2583 true,
2584 "Services/Style/Content"
2585 );
2586 $this->includeCSS();
2587 $a_tpl->setVariable("FORM", $this->form_gui->getHTML());
2588 $a_tpl->setVariable("PREVIEW", $this->getTemplatePreview($_GET["temp_type"], $_GET["t_id"]));
2589 $tpl->setContent($a_tpl->get());
2590 }
2591
2595 public function refreshTemplateObject()
2596 {
2597 $this->updateTemplateObject(true);
2598 }
2599
2603 public function getTemplateFormValues()
2604 {
2605 if ($_GET["t_id"] > 0) {
2606 $t = $this->object->getTemplate($_GET["t_id"]);
2607
2608 $values["name"] = $t["name"];
2610 foreach ($scs as $k => $type) {
2611 $values[$k . "_class"] = $t["classes"][$k];
2612 }
2613 $this->form_gui->setValuesByArray($values);
2614 }
2615 }
2616
2621 {
2623 $tpl = $this->tpl;
2624 $lng = $this->lng;
2625
2626 if (!is_array($_POST["tid"]) || count($_POST["tid"]) == 0) {
2627 ilUtil::sendInfo($lng->txt("no_checkbox"), true);
2628 $ilCtrl->redirect($this, "listTemplates");
2629 } else {
2630 include_once("./Services/Utilities/classes/class.ilConfirmationGUI.php");
2631 $cgui = new ilConfirmationGUI();
2632 $cgui->setFormAction($ilCtrl->getFormAction($this));
2633 $cgui->setHeaderText($lng->txt("sty_confirm_template_deletion"));
2634 $cgui->setCancel($lng->txt("cancel"), "cancelTemplateDeletion");
2635 $cgui->setConfirm($lng->txt("sty_del_template"), "deleteTemplate");
2636
2637 foreach ($_POST["tid"] as $tid) {
2638 $classes = $this->object->getTemplateClasses($tid);
2639 $cl_str = "";
2640 $listed = array();
2641 foreach ($classes as $cl) {
2642 if ($cl != "" && !$listed[$cl]) {
2643 $cl_str.= '<div>- ' .
2644 $cl . "</div>";
2645 $listed[$cl] = true;
2646 }
2647 }
2648 if ($cl_str != "") {
2649 $cl_str = '<div style="padding-left:30px;" class="small">' .
2650 "<div><i>" . $lng->txt("sty_style_class") . "</i></div>" . $cl_str . "</div>";
2651 }
2652 $cgui->addItem("tid[]", $tid, $this->object->lookupTemplateName($tid) . $cl_str);
2653 }
2654
2655 $cgui->addButton($lng->txt("sty_del_template_keep_classes"), "deleteTemplateKeepClasses");
2656
2657 $tpl->setContent($cgui->getHTML());
2658 }
2659 }
2660
2665 {
2667
2668 $ilCtrl->redirect($this, "listTemplates");
2669 }
2670
2675 {
2677
2678 if (is_array($_POST["tid"])) {
2679 foreach ($_POST["tid"] as $tid) {
2680 $this->object->removeTemplate($tid);
2681 }
2682 }
2683
2684 $ilCtrl->redirect($this, "listTemplates");
2685 }
2686
2690 public function deleteTemplateObject()
2691 {
2693
2694 if (is_array($_POST["tid"])) {
2695 foreach ($_POST["tid"] as $tid) {
2696 $cls = $this->object->getTemplateClasses($tid);
2697 foreach ($cls as $k => $cls) {
2698 $ty = $this->object->determineTemplateStyleClassType($_GET["temp_type"], $k);
2700 $this->object->deleteCharacteristic($ty, $ta, $cls);
2701 }
2702 $this->object->removeTemplate($tid);
2703 }
2704 }
2705
2706 $ilCtrl->redirect($this, "listTemplates");
2707 }
2708
2712 public function generateTemplateObject()
2713 {
2714 $tpl = $this->tpl;
2715
2717 $tpl->setContent($this->form_gui->getHTML());
2718 }
2719
2724 {
2725 $lng = $this->lng;
2727
2728 include_once("Services/Form/classes/class.ilPropertyFormGUI.php");
2729 $this->form_gui = new ilPropertyFormGUI();
2730
2731 $this->form_gui->setTitle($lng->txt("sty_generate_template"));
2732
2733 // name
2734 $name_input = new ilRegExpInputGUI($lng->txt("sty_template_name"), "name");
2735 $name_input->setPattern("/^[a-zA-Z]+[a-zA-Z0-9]*$/");
2736 $name_input->setNoMatchMessage($lng->txt("sty_msg_color_must_only_include") . " A-Z, a-z, 1-9");
2737 $name_input->setRequired(true);
2738 $name_input->setSize(30);
2739 $name_input->setMaxLength(30);
2740 $this->form_gui->addItem($name_input);
2741
2742 // basic layout
2743 $bl_input = new ilSelectInputGUI($lng->txt("sty_template_layout"), "layout");
2744 $options = array(
2745 "coloredZebra" => $lng->txt("sty_table_template_colored_zebra"),
2746 "bwZebra" => $lng->txt("sty_table_template_bw_zebra"),
2747 "noZebra" => $lng->txt("sty_table_template_no_zebra")
2748 );
2749 $bl_input->setOptions($options);
2750 $this->form_gui->addItem($bl_input);
2751
2752 // top bottom padding
2753 include_once("./Services/Style/Content/classes/class.ilNumericStyleValueInputGUI.php");
2754 $num_input = new ilNumericStyleValueInputGUI($lng->txt("sty_top_bottom_padding"), "tb_padding");
2755 $num_input->setAllowPercentage(false);
2756 $num_input->setValue("3px");
2757 $this->form_gui->addItem($num_input);
2758
2759 // left right padding
2760 $num_input = new ilNumericStyleValueInputGUI($lng->txt("sty_left_right_padding"), "lr_padding");
2761 $num_input->setAllowPercentage(false);
2762 $num_input->setValue("10px");
2763 $this->form_gui->addItem($num_input);
2764
2765 // base color
2766 $bc_input = new ilSelectInputGUI($lng->txt("sty_base_color"), "base_color");
2767 $cs = $this->object->getColors();
2768 $options = array();
2769 foreach ($cs as $c) {
2770 $options[$c["name"]] = $c["name"];
2771 }
2772 $bc_input->setOptions($options);
2773 $this->form_gui->addItem($bc_input);
2774
2775 // Lightness Settings
2776 $lss = array("border" => 90, "header_text" => 70, "header_bg" => 0,
2777 "cell1_text" => -60, "cell1_bg" => 90, "cell2_text" => -60, "cell2_bg" => 75);
2778 foreach ($lss as $ls => $v) {
2779 $l_input = new ilNumberInputGUI($lng->txt("sty_lightness_" . $ls), "lightness_" . $ls);
2780 $l_input->setMaxValue(100);
2781 $l_input->setMinValue(-100);
2782 $l_input->setValue($v);
2783 $l_input->setSize(4);
2784 $l_input->setMaxLength(4);
2785 $this->form_gui->addItem($l_input);
2786 }
2787
2788 $this->form_gui->addCommandButton("templateGeneration", $lng->txt("generate"));
2789 $this->form_gui->addCommandButton("cancelTemplateSaving", $lng->txt("cancel"));
2790 $this->form_gui->setFormAction($ilCtrl->getFormAction($this));
2791 }
2792
2797 {
2798 $tpl = $this->tpl;
2800 $lng = $this->lng;
2801
2803
2804 if ($this->form_gui->checkInput()) {
2805 if ($this->object->templateExists($_POST["name"])) {
2806 $name_input = $this->form_gui->getItemByPostVar("name");
2807 $name_input->setAlert($lng->txt("sty_table_template_already_exists"));
2808 } else {
2809 // -> move to application class!
2810
2811 // cell classes
2812 $cells = array("H" => "header", "C1" => "cell1", "C2" => "cell2");
2813 $tb_p = $this->form_gui->getItemByPostVar("tb_padding");
2814 $tb_padding = $tb_p->getValue();
2815 $lr_p = $this->form_gui->getItemByPostVar("lr_padding");
2816 $lr_padding = $lr_p->getValue();
2817 $cell_color = $_POST["base_color"];
2818
2819 // use mid gray as cell color for bw zebra
2820 if ($_POST["layout"] == "bwZebra") {
2821 $cell_color = "MidGray";
2822 if (!$this->object->colorExists($cell_color)) {
2823 $this->object->addColor($cell_color, "7F7F7F");
2824 }
2825 $this->object->updateColor($cell_color, $cell_color, "7F7F7F");
2826 }
2827
2828 foreach ($cells as $k => $cell) {
2829 $cell_class[$k] = $_POST["name"] . $k;
2830 if (!$this->object->characteristicExists($cell_class[$k], "table_cell")) {
2831 $this->object->addCharacteristic("table_cell", $cell_class[$k], true);
2832 }
2833 if ($_POST["layout"] == "bwZebra" && $k == "H") {
2834 $this->object->replaceStylePar(
2835 "td",
2836 $cell_class[$k],
2837 "color",
2838 "!" . $_POST["base_color"] . "(" . $_POST["lightness_" . $cell . "_text"] . ")",
2839 "table_cell"
2840 );
2841 $this->object->replaceStylePar(
2842 "td",
2843 $cell_class[$k],
2844 "background-color",
2845 "!" . $_POST["base_color"] . "(" . $_POST["lightness_" . $cell . "_bg"] . ")",
2846 "table_cell"
2847 );
2848 } else {
2849 $this->object->replaceStylePar(
2850 "td",
2851 $cell_class[$k],
2852 "color",
2853 "!" . $cell_color . "(" . $_POST["lightness_" . $cell . "_text"] . ")",
2854 "table_cell"
2855 );
2856 $this->object->replaceStylePar(
2857 "td",
2858 $cell_class[$k],
2859 "background-color",
2860 "!" . $cell_color . "(" . $_POST["lightness_" . $cell . "_bg"] . ")",
2861 "table_cell"
2862 );
2863 }
2864 $this->object->replaceStylePar(
2865 "td",
2866 $cell_class[$k],
2867 "padding-top",
2868 $tb_padding,
2869 "table_cell"
2870 );
2871 $this->object->replaceStylePar(
2872 "td",
2873 $cell_class[$k],
2874 "padding-bottom",
2875 $tb_padding,
2876 "table_cell"
2877 );
2878 $this->object->replaceStylePar(
2879 "td",
2880 $cell_class[$k],
2881 "padding-left",
2882 $lr_padding,
2883 "table_cell"
2884 );
2885 $this->object->replaceStylePar(
2886 "td",
2887 $cell_class[$k],
2888 "padding-right",
2889 $lr_padding,
2890 "table_cell"
2891 );
2892 $this->object->replaceStylePar(
2893 "td",
2894 $cell_class[$k],
2895 "border-width",
2896 "1px",
2897 "table_cell"
2898 );
2899 $this->object->replaceStylePar(
2900 "td",
2901 $cell_class[$k],
2902 "border-style",
2903 "solid",
2904 "table_cell"
2905 );
2906 $this->object->replaceStylePar(
2907 "td",
2908 $cell_class[$k],
2909 "border-color",
2910 "!" . $cell_color . "(" . $_POST["lightness_border"] . ")",
2911 "table_cell"
2912 );
2913 $this->object->replaceStylePar(
2914 "td",
2915 $cell_class[$k],
2916 "font-weight",
2917 "normal",
2918 "table_cell"
2919 );
2920 }
2921
2922 // table class
2923 $classes["table"] = $_POST["name"] . "T";
2924 if (!$this->object->characteristicExists($classes["table"], "table")) {
2925 $this->object->addCharacteristic("table", $classes["table"], true);
2926 }
2927 $this->object->replaceStylePar(
2928 "table",
2929 $classes["table"],
2930 "caption-side",
2931 "bottom",
2932 "table"
2933 );
2934 $this->object->replaceStylePar(
2935 "table",
2936 $classes["table"],
2937 "border-collapse",
2938 "collapse",
2939 "table"
2940 );
2941 $this->object->replaceStylePar(
2942 "table",
2943 $classes["table"],
2944 "margin-top",
2945 "5px",
2946 "table"
2947 );
2948 $this->object->replaceStylePar(
2949 "table",
2950 $classes["table"],
2951 "margin-bottom",
2952 "5px",
2953 "table"
2954 );
2955 if ($_POST["layout"] == "bwZebra") {
2956 $this->object->replaceStylePar(
2957 "table",
2958 $classes["table"],
2959 "border-bottom-color",
2960 "!" . $_POST["base_color"],
2961 "table"
2962 );
2963 $this->object->replaceStylePar(
2964 "table",
2965 $classes["table"],
2966 "border-bottom-style",
2967 "solid",
2968 "table"
2969 );
2970 $this->object->replaceStylePar(
2971 "table",
2972 $classes["table"],
2973 "border-bottom-width",
2974 "3px",
2975 "table"
2976 );
2977 $sb = array("left", "right", "top");
2978 foreach ($sb as $b) {
2979 $this->object->replaceStylePar(
2980 "table",
2981 $classes["table"],
2982 "border-" . $b . "-width",
2983 "0px",
2984 "table"
2985 );
2986 }
2987 }
2988
2989 switch ($_POST["layout"]) {
2990 case "coloredZebra":
2991 $classes["row_head"] = $cell_class["H"];
2992 $classes["odd_row"] = $cell_class["C1"];
2993 $classes["even_row"] = $cell_class["C2"];
2994 break;
2995
2996 case "bwZebra":
2997 $classes["row_head"] = $cell_class["H"];
2998 $classes["odd_row"] = $cell_class["C1"];
2999 $classes["even_row"] = $cell_class["C2"];
3000 break;
3001
3002 case "noZebra":
3003 $classes["row_head"] = $cell_class["H"];
3004 $classes["odd_row"] = $cell_class["C1"];
3005 $classes["even_row"] = $cell_class["C1"];
3006 $classes["col_head"] = $cell_class["C2"];
3007 break;
3008 }
3009
3010
3011 $t_id = $this->object->addTemplate(
3012 $_GET["temp_type"],
3013 $_POST["name"],
3014 $classes
3015 );
3016 $this->object->writeTemplatePreview(
3017 $t_id,
3018 $this->getTemplatePreview($_GET["temp_type"], $t_id, true)
3019 );
3020 $ilCtrl->redirect($this, "listTemplates");
3021 }
3022 }
3023 $this->form_gui->setValuesByPost();
3024 $tpl->setContent($this->form_gui->getHTML());
3025 }
3026
3027 public function accordiontestObject()
3028 {
3029 $tpl = $this->tpl;
3030
3031 include_once("./Services/Accordion/classes/class.ilAccordionGUI.php");
3032
3033 $acc = new ilAccordionGUI();
3034 $acc->addItem("Header 1", str_repeat("bla bla bla bla bla bla", 30));
3035 $acc->addItem("Header 2", str_repeat("xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx xx x xx x xx", 30));
3036 $acc->setOrientation(ilAccordionGUI::HORIZONTAL);
3037
3038 $ac2 = new ilAccordionGUI();
3039 $ac2->addItem("Header 1", str_repeat("bla bla bla bla bla bla", 30));
3040 $ac2->addItem("Header 2", $acc->getHTML());
3041 $ac2->setOrientation(ilAccordionGUI::VERTICAL);
3042
3043 $tpl->setContent($ac2->getHTML());
3044 }
3045
3050 {
3052
3053 /*if ($_GET["baseClass"] == "ilAdministrationGUI")
3054 {
3055 $ilCtrl->redirectByClass("ilcontentstylesettingsgui", "edit");
3056 }*/
3057 $ilCtrl->returnToParent($this);
3058 }
3059}
if(php_sapi_name() !='cli') $in
Definition: Utf8Test.php:37
if(!isset( $_REQUEST[ 'ReturnTo'])) if(!isset($_REQUEST['AuthId'])) $options
Definition: as_login.php:20
$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 _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 _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 _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 sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
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
$a_type
Definition: workflow.php:92