ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
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
43 protected $enable_write = false;
44
49 public function __construct($a_data, $a_id, $a_call_by_reference, $a_prep = true)
50 {
51 global $DIC;
52
53 $this->tpl = $DIC["tpl"];
54 $this->rbacsystem = $DIC->rbac()->system();
55 $this->help = $DIC["ilHelp"];
56 $this->tabs = $DIC->tabs();
57 $this->toolbar = $DIC->toolbar();
58 $this->locator = $DIC["ilLocator"];
59 $this->tree = $DIC->repositoryTree();
60 $this->obj_definition = $DIC["objDefinition"];
61 $ilCtrl = $DIC->ctrl();
62 $lng = $DIC->language();
63 $tpl = $DIC["tpl"];
64
65 $this->ctrl = $ilCtrl;
66 $this->lng = $lng;
67 $this->lng->loadLanguageModule("style");
68 $ilCtrl->saveParameter($this, array("tag", "style_type", "temp_type"));
69 if ($_GET["style_type"] != "") {
70 $this->super_type = ilObjStyleSheet::_getStyleSuperTypeForType($_GET["style_type"]);
71 }
72 $this->type = "sty";
73 parent::__construct($a_data, $a_id, $a_call_by_reference, false);
74 }
75
80 public function enableWrite($a_write)
81 {
82 $this->enable_write = $a_write;
83 }
84
88 public function executeCommand()
89 {
90 $next_class = $this->ctrl->getNextClass($this);
91 $cmd = $this->ctrl->getCmd("edit");
92
93 // #9440/#9489: prepareOutput will fail if not set properly
94 if (!$this->object) {
95 $this->setCreationMode(true);
96 }
97
98 $this->prepareOutput();
99 switch ($next_class) {
100 default:
101 $cmd .= "Object";
102 $ret = $this->$cmd();
103 break;
104 }
105
106 return $ret;
107 }
108
109 public function viewObject()
110 {
111 $this->editObject();
112 }
113
117 public function createObject()
118 {
122 $ilHelp = $this->help;
123
124 $forms = array();
125
126
127 $ilHelp->setScreenIdComponent("sty");
128 $ilHelp->setDefaultScreenId(ilHelpGUI::ID_PART_SCREEN, "create");
129
130 // --- create
131
132 include_once "Services/Form/classes/class.ilPropertyFormGUI.php";
133 $form = new ilPropertyFormGUI();
134 $form->setFormAction($this->ctrl->getFormAction($this));
135 $form->setTitle($this->lng->txt("sty_create_new_stylesheet"));
136
137 // title
138 $ti = new ilTextInputGUI($this->lng->txt("title"), "style_title");
139 $ti->setMaxLength(128);
140 $ti->setSize(40);
141 $ti->setRequired(true);
142 $form->addItem($ti);
143
144 // description
145 $ta = new ilTextAreaInputGUI($this->lng->txt("description"), "style_description");
146 $ta->setCols(40);
147 $ta->setRows(2);
148 $form->addItem($ta);
149
150 $form->addCommandButton("save", $this->lng->txt("save"));
151 $form->addCommandButton("cancel", $this->lng->txt("cancel"));
152
153 $forms[] = $form;
154
155
156 // --- import
157
158 include_once "Services/Form/classes/class.ilPropertyFormGUI.php";
159 $form = new ilPropertyFormGUI();
160 $form->setFormAction($this->ctrl->getFormAction($this));
161 $form->setTitle($this->lng->txt("sty_import_stylesheet"));
162
163 // title
164 $ti = new ilFileInputGUI($this->lng->txt("import_file"), "importfile");
165 $ti->setRequired(true);
166 $form->addItem($ti);
167
168 $form->addCommandButton("importStyle", $this->lng->txt("import"));
169 $form->addCommandButton("cancel", $this->lng->txt("cancel"));
170
171 $forms[] = $form;
172
173
174 // --- clone
175
176 include_once "Services/Form/classes/class.ilPropertyFormGUI.php";
177 $form = new ilPropertyFormGUI();
178 $form->setFormAction($this->ctrl->getFormAction($this));
179 $form->setTitle($this->lng->txt("sty_copy_other_stylesheet"));
180
181 // source
182 $ti = new ilSelectInputGUI($this->lng->txt("sty_source"), "source_style");
183 $ti->setRequired(true);
185 $form->addItem($ti);
186
187 $form->addCommandButton("copyStyle", $this->lng->txt("copy"));
188 $form->addCommandButton("cancel", $this->lng->txt("cancel"));
189
190 $forms[] = $form;
191
192
193 $this->tpl->setContent($this->getCreationFormsHTML($forms));
194 }
195
199 public function includeCSS()
200 {
201 // set style sheet
202 $this->tpl->setCurrentBlock("ContentStyle");
203 $this->tpl->setVariable(
204 "LOCATION_CONTENT_STYLESHEET",
205 ilObjStyleSheet::getContentStylePath($this->object->getId())
206 );
207 $this->tpl->parseCurrentBlock();
208 }
209
210
217 public function checkWrite()
218 {
220
221 return ($this->enable_write || $rbacsystem->checkAccess("write", (int) $_GET["ref_id"])
222 || $rbacsystem->checkAccess("sty_write_content", (int) $_GET["ref_id"]));
223 }
224
225
229 public function editObject()
230 {
233 $ilTabs = $this->tabs;
235 $ilToolbar = $this->toolbar;
237
238 $this->setSubTabs();
239
240 $this->includeCSS();
241
242 $ctpl = new ilTemplate("tpl.sty_classes.html", true, true, "Services/Style/Content");
243
244 // output characteristics
245 $chars = $this->object->getCharacteristics();
246
247 $style_type = ($this->super_type != "")
248 ? $this->super_type
249 : "text_block";
250 $ilCtrl->setParameter($this, "style_type", $style_type);
251 $ilTabs->setSubTabActive("sty_" . $style_type . "_char");
252
253 // workaround to include default rte styles
254 if ($this->super_type == "rte") {
255 $tpl->addCss("Modules/Scorm2004/templates/default/player.css");
256 include_once("./Modules/Scorm2004/classes/ilSCORM13Player.php");
257 $tpl->addInlineCss(ilSCORM13Player::getInlineCss());
258 }
259
260 // add new style?
261 $all_super_types = ilObjStyleSheet::_getStyleSuperTypes();
262 $subtypes = $all_super_types[$style_type];
263 $expandable = false;
264 foreach ($subtypes as $t) {
266 $expandable = true;
267 }
268 }
269 if ($expandable && $this->checkWrite()) {
270 $ilToolbar->addButton(
271 $lng->txt("sty_add_characteristic"),
272 $ilCtrl->getLinkTarget($this, "addCharacteristicForm")
273 );
274 }
275
276 if ($_SESSION["sty_copy"] != "") {
277 $style_cp = explode(":::", $_SESSION["sty_copy"]);
278 if ($style_cp[1] == $style_type) {
279 if ($expandable) {
280 $ilToolbar->addSeparator();
281 }
282 $ilToolbar->addButton(
283 $lng->txt("sty_paste_style_classes"),
284 $ilCtrl->getLinkTarget($this, "pasteCharacteristicsOverview")
285 );
286 }
287 }
288
289 include_once("./Services/Style/Content/classes/class.ilStyleTableGUI.php");
290 $table_gui = new ilStyleTableGUI(
291 $this,
292 "edit",
293 $chars,
294 $style_type,
295 $this->object
296 );
297
298 $ctpl->setCurrentBlock("style_table");
299 $ctpl->setVariable("STYLE_TABLE", $table_gui->getHTML());
300 $ctpl->parseCurrentBlock();
301
302 $this->tpl->setContent($ctpl->get());
303 }
304
308 public function propertiesObject()
309 {
312 $ilToolbar = $this->toolbar;
313
314 // set style sheet
315 $this->tpl->setCurrentBlock("ContentStyle");
316 $this->tpl->setVariable(
317 "LOCATION_CONTENT_STYLESHEET",
318 ilObjStyleSheet::getContentStylePath($this->object->getId())
319 );
320 $this->tpl->parseCurrentBlock();
321
322 // export button
323 $ilToolbar->addButton(
324 $this->lng->txt("export"),
325 $this->ctrl->getLinkTarget($this, "exportStyle")
326 );
327
328 $this->initPropertiesForm();
329 $this->getPropertiesValues();
330 $this->tpl->setContent($this->form->getHTML());
331 }
332
337 public function getPropertiesValues()
338 {
339 $values = array();
340
341 $values["style_title"] = $this->object->getTitle();
342 $values["style_description"] = $this->object->getDescription();
343 $values["disable_auto_margins"] = (int) $this->object->lookupStyleSetting("disable_auto_margins");
344
345 $this->form->setValuesByArray($values);
346 }
347
353 public function initPropertiesForm($a_mode = "edit")
354 {
357
358 include_once("Services/Form/classes/class.ilPropertyFormGUI.php");
359 $this->form = new ilPropertyFormGUI();
360
361 // title
362 $ti = new ilTextInputGUI($this->lng->txt("title"), "style_title");
363 $ti->setMaxLength(128);
364 $ti->setSize(40);
365 $ti->setRequired(true);
366 $this->form->addItem($ti);
367
368 // description
369 $ta = new ilTextAreaInputGUI($this->lng->txt("description"), "style_description");
370 //$ta->setCols();
371 //$ta->setRows();
372 $this->form->addItem($ta);
373
374 // disable automatic margins for left/right alignment
375 $cb = new ilCheckboxInputGUI($this->lng->txt("sty_disable_auto_margins"), "disable_auto_margins");
376 $cb->setInfo($this->lng->txt("sty_disable_auto_margins_info"));
377 $this->form->addItem($cb);
378
379 // save and cancel commands
380
381 if ($a_mode == "create") {
382 $this->form->addCommandButton("save", $lng->txt("save"));
383 $this->form->addCommandButton("cancelSave", $lng->txt("cancel"));
384 } else {
385 if ($this->checkWrite()) {
386 $this->form->addCommandButton("update", $lng->txt("save"));
387 }
388 }
389
390 $this->form->setTitle($lng->txt("edit_stylesheet"));
391 $this->form->setFormAction($this->ctrl->getFormAction($this));
392 }
393
397 public function updateObject()
398 {
402
403 $this->initPropertiesForm("edit");
404 if ($this->form->checkInput()) {
405 $this->object->setTitle($this->form->getInput("style_title"));
406 $this->object->setDescription($this->form->getInput("style_description"));
407 $this->object->writeStyleSetting(
408 "disable_auto_margins",
409 $this->form->getInput("disable_auto_margins")
410 );
411 $this->object->update();
412 ilUtil::sendInfo($lng->txt("msg_obj_modified"), true);
413 $ilCtrl->redirect($this, "properties");
414 } else {
415 $this->form->setValuesByPost();
416 $tpl->setContent($this->form->getHtml());
417 }
418 }
419
423 public function refreshTagStyleObject()
424 {
426
427 $cur = explode(".", $_GET["tag"]);
428 $cur_tag = $cur[0];
429 $cur_class = $cur[1];
430
431 $this->initTagStyleForm("edit", $cur_tag);
432
433 if ($this->form_gui->checkInput()) {
434 $this->saveTagStyle();
435 $ilCtrl->redirect($this, "editTagStyle");
436 } else {
437 $this->form_gui->setValuesByPost();
439 }
440 }
441
445 public function updateTagStyleObject()
446 {
448
449 $cur = explode(".", $_GET["tag"]);
450 $cur_tag = $cur[0];
451 $cur_class = $cur[1];
452
453 $this->initTagStyleForm("edit", $cur_tag);
454 if ($this->form_gui->checkInput()) {
455 $this->saveTagStyle();
456 $ilCtrl->redirect($this, "edit");
457 } else {
458 $this->form_gui->setValuesByPost();
460 }
461 }
462
466 public function saveTagStyle()
467 {
468 $cur = explode(".", $_GET["tag"]);
469 $cur_tag = $cur[0];
470 $cur_class = $cur[1];
471 $avail_pars = ilObjStyleSheet::_getStyleParameters($cur_tag);
472 foreach ($avail_pars as $par => $v) {
473 $var = str_replace("-", "_", $par);
474 $basepar_arr = explode(".", $par);
475 $basepar = $basepar_arr[0];
476 if ($basepar_arr[1] != "" && $basepar_arr[1] != $cur_tag) {
477 continue;
478 }
479
480 switch ($v["input"]) {
481 case "fontsize":
482 case "numeric_no_perc":
483 case "numeric":
484 case "background_image":
485 $in = $this->form_gui->getItemByPostVar($basepar);
486//echo "<br>-".$cur_tag."-".$cur_class."-".$basepar."-".$_GET["style_type"]."-";
487 $this->writeStylePar($cur_tag, $cur_class, $basepar, $in->getValue(), $_GET["style_type"], (int) $_GET["mq_id"]);
488 break;
489
490 case "color":
491 $color = trim($_POST[$basepar]);
492 if ($color != "" && trim(substr($color, 0, 1) != "!")) {
493 $color = "#" . $color;
494 }
495 $this->writeStylePar($cur_tag, $cur_class, $basepar, $color, $_GET["style_type"], (int) $_GET["mq_id"]);
496 break;
497
498 case "trbl_numeric":
499 case "border_width":
500 case "border_style":
501 $in = $this->form_gui->getItemByPostVar($basepar);
502 $this->writeStylePar($cur_tag, $cur_class, $v["subpar"][0], $in->getAllValue(), $_GET["style_type"], (int) $_GET["mq_id"]);
503 $this->writeStylePar($cur_tag, $cur_class, $v["subpar"][1], $in->getTopValue(), $_GET["style_type"], (int) $_GET["mq_id"]);
504 $this->writeStylePar($cur_tag, $cur_class, $v["subpar"][2], $in->getRightValue(), $_GET["style_type"], (int) $_GET["mq_id"]);
505 $this->writeStylePar($cur_tag, $cur_class, $v["subpar"][3], $in->getBottomValue(), $_GET["style_type"], (int) $_GET["mq_id"]);
506 $this->writeStylePar($cur_tag, $cur_class, $v["subpar"][4], $in->getLeftValue(), $_GET["style_type"], (int) $_GET["mq_id"]);
507 break;
508
509 case "trbl_color":
510 $in = $this->form_gui->getItemByPostVar($basepar);
511 $tblr_p = array(0 => "getAllValue", 1 => "getTopValue", 2 => "getRightValue",
512 3 => "getBottomValue", 4 => "getLeftValue");
513 foreach ($tblr_p as $k => $func) {
514 $val = trim($in->$func());
515 $val = (($in->getAcceptNamedColors() && substr($val, 0, 1) == "!")
516 || $val == "")
517 ? $val
518 : "#" . $val;
519 $this->writeStylePar($cur_tag, $cur_class, $v["subpar"][$k], $val, $_GET["style_type"], (int) $_GET["mq_id"]);
520 }
521 break;
522
523 case "background_position":
524 $in = $this->form_gui->getItemByPostVar($basepar);
525 $this->writeStylePar($cur_tag, $cur_class, $basepar, $in->getValue(), $_GET["style_type"], (int) $_GET["mq_id"]);
526 break;
527
528 default:
529 $this->writeStylePar($cur_tag, $cur_class, $basepar, $_POST[$basepar], $_GET["style_type"], (int) $_GET["mq_id"]);
530 break;
531 }
532 }
533
534 // write custom parameter
535 $this->object->deleteCustomStylePars($cur_tag, $cur_class, $_GET["style_type"], (int) $_GET["mq_id"]);
536 if (is_array($_POST["custom_par"])) {
537 foreach ($_POST["custom_par"] as $cpar) {
538 $par_arr = explode(":", $cpar);
539 if (count($par_arr) == 2) {
540 $par = trim($par_arr[0]);
541 $val = trim(str_replace(";", "", $par_arr[1]));
542 $this->writeStylePar($cur_tag, $cur_class, $par, $val, $_GET["style_type"], (int) $_GET["mq_id"], true);
543 }
544 }
545 }
546
547 $this->object->update();
548 }
549
550 public function writeStylePar($cur_tag, $cur_class, $par, $value, $a_type, $a_mq_id, $a_custom = false)
551 {
552 // echo $_GET["mq_id"]."-";
553 // echo $a_mq_id."-"; exit;
554 if ($a_type == "") {
555 return;
556 }
557
558 if ($value != "") {
559 $this->object->replaceStylePar($cur_tag, $cur_class, $par, $value, $a_type, $a_mq_id, $a_custom);
560 } else {
561 $this->object->deleteStylePar($cur_tag, $cur_class, $par, $a_type, $a_mq_id, $a_custom);
562 }
563 }
564
569 public function editTagStyleObject()
570 {
572 $ilToolbar = $this->toolbar;
575
576 // media query selector
577 $mqs = $this->object->getMediaQueries();
578 if (count($mqs) > 0) {
579 //
580 $options = array(
581 "" => $lng->txt("sty_default"),
582 );
583 foreach ($mqs as $mq) {
584 $options[$mq["id"]] = $mq["mquery"];
585 }
586 include_once("./Services/Form/classes/class.ilSelectInputGUI.php");
587 $si = new ilSelectInputGUI("@media", "mq_id");
588 $si->setOptions($options);
589 $si->setValue((int) $_GET["mq_id"]);
590 $ilToolbar->addInputItem($si, true);
591 $ilToolbar->setFormAction($ilCtrl->getFormAction($this));
592 $ilToolbar->addFormButton($lng->txt("sty_switch"), "switchMQuery");
593 }
594
595 // workaround to include default rte styles
596 //if (in_array($_GET["style_type"], array("rte_menu")))
597 if ($this->super_type == "rte") {
598 $tpl->addCss("Modules/Scorm2004/templates/default/player.css");
599 include_once("./Modules/Scorm2004/classes/ilSCORM13Player.php");
600 $tpl->addInlineCss(ilSCORM13Player::getInlineCss());
601 }
602
603 $cur = explode(".", $_GET["tag"]);
604 $cur_tag = $cur[0];
605 $cur_class = $cur[1];
606
607 $this->initTagStyleForm("edit", $cur_tag);
608 $this->getValues();
610 }
611
618 public function switchMQueryObject()
619 {
621
622 $ilCtrl->setParameter($this, "mq_id", (int) $_POST["mq_id"]);
623 $ilCtrl->redirect($this, "editTagStyle");
624 }
625
626
630 public function outputTagStyleEditScreen()
631 {
635
636 // set style sheet
637 $tpl->setCurrentBlock("ContentStyle");
638 $tpl->setVariable(
639 "LOCATION_CONTENT_STYLESHEET",
640 ilObjStyleSheet::getContentStylePath($this->object->getId())
641 );
642
643 $ts_tpl = new ilTemplate("tpl.style_tag_edit.html", true, true, "Services/Style/Content");
644
645 $cur = explode(".", $_GET["tag"]);
646 $cur_tag = $cur[0];
647 $cur_class = $cur[1];
648
649 $ts_tpl->setVariable(
650 "EXAMPLE",
651 ilObjStyleSheetGUI::getStyleExampleHTML($_GET["style_type"], $cur_class)
652 );
653
654 $ts_tpl->setVariable(
655 "FORM",
656 $this->form_gui->getHtml()
657 );
658
659 $tpl->setTitle($cur_class . " (" . $lng->txt("sty_type_" . $_GET["style_type"]) . ")");
660
661 $tpl->setContent($ts_tpl->get());
662 }
663
664
670 public function initTagStyleForm($a_mode, $a_cur_tag)
671 {
674
675 $ilCtrl->saveParameter($this, array("mq_id"));
676
677 include_once("Services/Form/classes/class.ilPropertyFormGUI.php");
678 $this->form_gui = new ilPropertyFormGUI();
679
680 $avail_pars = $this->object->getAvailableParameters();
681 $groups = $this->object->getStyleParameterGroups();
682
683 // output select lists
684 foreach ($groups as $k => $group) {
685 // filter groups of properties that should only be
686 // displayed with matching tag
687 $filtered_groups = ilObjStyleSheet::_getFilteredGroups();
688 if (is_array($filtered_groups[$k]) && !in_array($a_cur_tag, $filtered_groups[$k])) {
689 continue;
690 }
691
692 $sh = new ilFormSectionHeaderGUI();
693 $sh->setTitle($lng->txt("sty_" . $k));
694 $this->form_gui->addItem($sh);
695
696 foreach ($group as $par) {
697 $basepar = explode(".", $par);
698 $basepar = $basepar[0];
699
700 $var = str_replace("-", "_", $basepar);
701 $up_par = strtoupper($var);
702
704 case "select":
705 $sel_input = new ilSelectInputGUI($lng->txt("sty_" . $var), $basepar);
706 $options = array("" => "");
707 foreach ($avail_pars[$par] as $p) {
708 $options[$p] = $p;
709 }
710 $sel_input->setOptions($options);
711 $this->form_gui->addItem($sel_input);
712 break;
713
714 case "text":
715 $text_input = new ilTextInputGUI($lng->txt("sty_" . $var), $basepar);
716 $text_input->setMaxLength(200);
717 $text_input->setSize(20);
718 $this->form_gui->addItem($text_input);
719 break;
720
721 case "fontsize":
722 include_once("./Services/Style/Content/classes/class.ilFontSizeInputGUI.php");
723 $fs_input = new ilFontSizeInputGUI($lng->txt("sty_" . $var), $basepar);
724 $this->form_gui->addItem($fs_input);
725 break;
726
727 case "numeric_no_perc":
728 case "numeric":
729 include_once("./Services/Style/Content/classes/class.ilNumericStyleValueInputGUI.php");
730 $num_input = new ilNumericStyleValueInputGUI($lng->txt("sty_" . $var), $basepar);
731 if (ilObjStyleSheet::_getStyleParameterInputType($par) == "numeric_no_perc") {
732 $num_input->setAllowPercentage(false);
733 }
734 $this->form_gui->addItem($num_input);
735 break;
736
737 case "percentage":
738 $per_input = new ilNumberInputGUI($lng->txt("sty_" . $var), $basepar);
739 $per_input->setMinValue(0);
740 $per_input->setMaxValue(100);
741 $per_input->setMaxLength(3);
742 $per_input->setSize(3);
743 $this->form_gui->addItem($per_input);
744 break;
745
746 case "color":
747 //include_once("./Services/Style/classes/class.ilNumericStyleValueInputGUI.php");
748 $col_input = new ilColorPickerInputGUI($lng->txt("sty_" . $var), $basepar);
749 $col_input->setDefaultColor("");
750 $col_input->setAcceptNamedColors(true);
751 $this->form_gui->addItem($col_input);
752 break;
753
754 case "trbl_numeric":
755 include_once("./Services/Style/Content/classes/class.ilTRBLNumericStyleValueInputGUI.php");
756 $num_input = new ilTRBLNumericStyleValueInputGUI($lng->txt("sty_" . $var), $basepar);
757 if (ilObjStyleSheet::_getStyleParameterInputType($par) == "trbl_numeric_no_perc") {
758 $num_input->setAllowPercentage(false);
759 }
760 $this->form_gui->addItem($num_input);
761 break;
762
763 case "border_width":
764 include_once("./Services/Style/Content/classes/class.ilTRBLBorderWidthInputGUI.php");
765 $bw_input = new ilTRBLBorderWidthInputGUI($lng->txt("sty_" . $var), $basepar);
766 $this->form_gui->addItem($bw_input);
767 break;
768
769 case "border_style":
770 include_once("./Services/Style/Content/classes/class.ilTRBLBorderStyleInputGUI.php");
771 $bw_input = new ilTRBLBorderStyleInputGUI($lng->txt("sty_" . $var), $basepar);
772 $this->form_gui->addItem($bw_input);
773 break;
774
775 case "trbl_color":
776 include_once("./Services/Style/Content/classes/class.ilTRBLColorPickerInputGUI.php");
777 $col_input = new ilTRBLColorPickerInputGUI($lng->txt("sty_" . $var), $basepar);
778 $col_input->setAcceptNamedColors(true);
779 $this->form_gui->addItem($col_input);
780 break;
781
782 case "background_image":
783 include_once("./Services/Style/Content/classes/class.ilBackgroundImageInputGUI.php");
784 $im_input = new ilBackgroundImageInputGUI($lng->txt("sty_" . $var), $basepar);
785 $imgs = array();
786 foreach ($this->object->getImages() as $entry) {
787 $imgs[] = $entry["entry"];
788 }
789 $im_input->setImages($imgs);
790 $this->form_gui->addItem($im_input);
791 break;
792
793 case "background_position":
794 include_once("./Services/Style/Content/classes/class.ilBackgroundPositionInputGUI.php");
795 $im_input = new ilBackgroundPositionInputGUI($lng->txt("sty_" . $var), $basepar);
796 $this->form_gui->addItem($im_input);
797 break;
798 }
799 }
800 }
801
802 // custom parameters
803 $sh = new ilFormSectionHeaderGUI();
804 $sh->setTitle($lng->txt("sty_custom"));
805 $this->form_gui->addItem($sh);
806
807 // custom parameters
808 $ti = new ilTextInputGUI($this->lng->txt("sty_custom_par"), "custom_par");
809 $ti->setMaxLength(300);
810 $ti->setSize(80);
811 $ti->setMulti(true);
812 $ti->setInfo($this->lng->txt("sty_custom_par_info"));
813 $this->form_gui->addItem($ti);
814
815
816 // save and cancel commands
817 $this->form_gui->addCommandButton("updateTagStyle", $lng->txt("save_return"));
818 $this->form_gui->addCommandButton("refreshTagStyle", $lng->txt("save_refresh"));
819
820 // $this->form_gui->setTitle($lng->txt("edit"));
821 $this->form_gui->setFormAction($this->ctrl->getFormAction($this));
822 }
823
828 public function getValues()
829 {
830 $style = $this->object->getStyle();
831 $cur = explode(".", $_GET["tag"]);
832 $cur_tag = $cur[0];
833 $cur_class = $cur[1];
834 $cur_parameters = $this->extractParametersOfTag(
835 $cur_tag,
836 $cur_class,
837 $style,
838 $_GET["style_type"],
839 (int) $_GET["mq_id"],
840 false
841 );
843 foreach ($parameters as $p => $v) {
844 $filtered_groups = ilObjStyleSheet::_getFilteredGroups();
845 if (is_array($filtered_groups[$v["group"]]) && !in_array($cur_tag, $filtered_groups[$v["group"]])) {
846 continue;
847 }
848 $p = explode(".", $p);
849 $p = $p[0];
850 $input = $this->form_gui->getItemByPostVar($p);
851 switch ($v["input"]) {
852 case "":
853 break;
854
855 case "trbl_numeric":
856 case "border_width":
857 case "border_style":
858 case "trbl_color":
859 $input->setAllValue($cur_parameters[$v["subpar"][0]]);
860 $input->setTopValue($cur_parameters[$v["subpar"][1]]);
861 $input->setRightValue($cur_parameters[$v["subpar"][2]]);
862 $input->setBottomValue($cur_parameters[$v["subpar"][3]]);
863 $input->setLeftValue($cur_parameters[$v["subpar"][4]]);
864 break;
865
866 default:
867 $input->setValue($cur_parameters[$p]);
868 break;
869 }
870 }
871
872 $cust_parameters = $this->extractParametersOfTag(
873 $cur_tag,
874 $cur_class,
875 $style,
876 $_GET["style_type"],
877 (int) $_GET["mq_id"],
878 true
879 );
880 $vals = array();
881 foreach ($cust_parameters as $k => $c) {
882 $vals[] = $k . ": " . $c;
883 }
884 $input = $this->form_gui->getItemByPostVar("custom_par");
885 $input->setValue($vals);
886 }
887
891 public function exportStyleObject()
892 {
893 include_once("./Services/Export/classes/class.ilExport.php");
894 $exp = new ilExport();
895 $r = $exp->exportObject($this->object->getType(), $this->object->getId());
896
897 ilUtil::deliverFile($r["directory"] . "/" . $r["file"], $r["file"], '', false, true);
898 }
899
900 public function extractParametersOfTag($a_tag, $a_class, $a_style, $a_type, $a_mq_id = 0, $a_custom = false)
901 {
902 $parameters = array();
903 foreach ($a_style as $tag) {
904 foreach ($tag as $par) {
905 if ($par["tag"] == $a_tag && $par["class"] == $a_class
906 && $par["type"] == $a_type && (int) $a_mq_id == (int) $par["mq_id"]
907 && (int) $a_custom == (int) $par["custom"]) {
908 $parameters[$par["parameter"]] = $par["value"];
909 }
910 }
911 }
912 return $parameters;
913 }
914
918 public function newStyleParameterObject()
919 {
920 $this->object->addParameter($_POST["tag"], $_POST["parameter"]);
921 $this->editObject();
922 }
923
927 public function refreshObject()
928 {
929 $this->object->setTitle($_POST["style_title"]);
930 $this->object->setDescription($_POST["style_description"]);
931
932 foreach ($_POST["styval"] as $id => $value) {
933 $this->object->updateStyleParameter($id, $value);
934 }
935 $this->object->update();
936 $this->editObject();
937 }
938
944 public function deleteObject($a_error = false)
945 {
946 // display confirmation message
947 include_once("./Services/Utilities/classes/class.ilConfirmationGUI.php");
948 $cgui = new ilConfirmationGUI();
949 $cgui->setFormAction($this->ctrl->getFormAction($this));
950 $cgui->setHeaderText($this->lng->txt("info_delete_sure"));
951 $cgui->setCancel($this->lng->txt("cancel"), "cancelDelete");
952 $cgui->setConfirm($this->lng->txt("confirm"), "confirmedDelete");
953
954 $caption = ilUtil::getImageTagByType("sty", $this->tpl->tplPath) .
955 " " . ilObject::_lookupTitle($this->object->getId());
956
957 $cgui->addItem("id[]", "", $caption);
958
959 $this->tpl->setContent($cgui->getHTML());
960 }
961
962
966 public function cancelDeleteObject()
967 {
968 $this->ctrl->returnToParent($this);
969 }
970
974 public function confirmedDeleteObject()
975 {
976 $this->object->delete();
977
978 $this->ctrl->returnToParent($this);
979 }
980
985 {
986 if (is_array($_POST["sty_select"])) {
987 foreach ($_POST["sty_select"] as $id => $dummy) {
988 $this->object->deleteParameter($id);
989 }
990 }
991 $this->object->read();
992 $this->object->writeCSSFile();
993 $this->editObject();
994 }
995
999 public function saveObject()
1000 {
1001 if (!trim($_POST["style_title"])) {
1002 $this->ctrl->redirect($this, "create");
1003 }
1004
1005 // copy from default style or ... see #11330
1006 $default_style = $this->settings->get("default_content_style_id");
1007 if (ilObject::_lookupType($default_style) == "sty") {
1008 $style_obj = ilObjectFactory::getInstanceByObjId($default_style);
1009 $new_id = $style_obj->ilClone();
1010 $newObj = new ilObjStyleSheet($new_id);
1011 } else {
1012 // ... import from basic zip file
1013 $imp = new ilImport();
1014 $style_id = $imp->importObject(
1015 null,
1017 "style.zip",
1018 "sty",
1019 $a_comp = "Services/Style",
1020 true
1021 );
1022
1023 $newObj = new ilObjStyleSheet($style_id);
1024 }
1025
1026 $newObj->setTitle(ilUtil::stripSlashes($_POST["style_title"]));
1027 $newObj->setDescription(ilUtil::stripSlashes($_POST["style_description"]));
1028 $newObj->update();
1029
1031
1032 // assign style to style sheet folder,
1033 // if parent is style sheet folder
1034 if ($_GET["ref_id"] > 0) {
1035 $fold = ilObjectFactory::getInstanceByRefId($_GET["ref_id"]);
1036 if ($fold->getType() == "stys") {
1037 include_once("./Services/Style/Content/classes/class.ilContentStyleSettings.php");
1038 $cont_style_settings = new ilContentStyleSettings();
1039 $cont_style_settings->addStyle($newObj->getId());
1040 $cont_style_settings->update();
1041
1042 ilObjStyleSheet::_writeStandard($newObj->getId(), "1");
1043 $this->ctrl->returnToParent($this);
1044 }
1045 }
1046
1047 return $newObj->getId();
1048 }
1049
1053 public function copyStyleObject()
1054 {
1055 if ($_POST["source_style"] > 0) {
1056 $style_obj = ilObjectFactory::getInstanceByObjId($_POST["source_style"]);
1057 $new_id = $style_obj->ilClone();
1058 }
1059
1060 // assign style to style sheet folder,
1061 // if parent is style sheet folder
1062 if ($_GET["ref_id"] > 0) {
1063 $fold = ilObjectFactory::getInstanceByRefId($_GET["ref_id"]);
1064 if ($fold->getType() == "stys") {
1065 include_once("./Services/Style/Content/classes/class.ilContentStyleSettings.php");
1066 $cont_style_settings = new ilContentStyleSettings();
1067 $cont_style_settings->addStyle($new_id);
1068 $cont_style_settings->update();
1069 ilObjStyleSheet::_writeStandard($new_id, "1");
1070 $this->ctrl->returnToParent($this);
1071 }
1072 }
1073
1074 return $new_id;
1075 }
1076
1080 public function importStyleObject()
1081 {
1082 // check file
1083 $source = $_FILES["importfile"]["tmp_name"];
1084 if (($source == 'none') || (!$source)) {
1085 $this->ilias->raiseError("No file selected!", $this->ilias->error_obj->MESSAGE);
1086 }
1087
1088 // check correct file type
1089 $info = pathinfo($_FILES["importfile"]["name"]);
1090 if (strtolower($info["extension"]) != "zip" && strtolower($info["extension"]) != "xml") {
1091 $this->ilias->raiseError("File must be a zip or xml file!", $this->ilias->error_obj->MESSAGE);
1092 }
1093
1094 // new import
1095 $fname = explode("_", $_FILES["importfile"]["name"]);
1096 if (strtolower($info["extension"]) == "zip" && $fname[4] == "sty") {
1097 include_once("./Services/Export/classes/class.ilImport.php");
1098 $imp = new ilImport();
1099 $new_id = $imp->importObject(
1100 null,
1101 $_FILES["importfile"]["tmp_name"],
1102 $_FILES["importfile"]["name"],
1103 "sty"
1104 );
1105 if ($new_id > 0) {
1106 $newObj = ilObjectFactory::getInstanceByObjId($new_id);
1107 }
1108 } else { // old import
1109 require_once("./Services/Style/Content/classes/class.ilObjStyleSheet.php");
1110 $newObj = new ilObjStyleSheet();
1111 $newObj->import($_FILES["importfile"]);
1112 }
1113
1114 // assign style to style sheet folder,
1115 // if parent is style sheet folder
1116 if ($_GET["ref_id"] > 0) {
1117 $fold = ilObjectFactory::getInstanceByRefId($_GET["ref_id"]);
1118 if ($fold->getType() == "stys") {
1119 include_once("./Services/Style/Content/classes/class.ilContentStyleSettings.php");
1120 $cont_style_settings = new ilContentStyleSettings();
1121 $cont_style_settings->addStyle($newObj->getId());
1122 $cont_style_settings->update();
1123 ilObjStyleSheet::_writeStandard($newObj->getId(), "1");
1124 $this->ctrl->returnToParent($this);
1125 }
1126 }
1127 return $newObj->getId();
1128 }
1129
1136 public function afterImport(ilObject $a_new_obj)
1137 {
1138 }
1139
1140
1144 public function cancelObject()
1145 {
1146 $lng = $this->lng;
1147
1148 ilUtil::sendInfo($lng->txt("msg_cancel"), true);
1149 $this->ctrl->returnToParent($this);
1150 }
1151
1155 public function getAdminTabs()
1156 {
1157 $this->getTabs();
1158 }
1159
1160
1166 public function getTabs()
1167 {
1168 $lng = $this->lng;
1170 $ilTabs = $this->tabs;
1171 $ilHelp = $this->help;
1172
1173 $ilHelp->setScreenIdComponent("sty");
1174
1175 if ($ilCtrl->getCmd() == "editTagStyle") {
1176 // back to upper context
1177 $this->tabs_gui->setBackTarget(
1178 $lng->txt("back"),
1179 $ilCtrl->getLinkTarget($this, "edit")
1180 );
1181
1182 $t = explode(".", $_GET["tag"]);
1183 $t2 = explode(":", $t[1]);
1184 $pc = $this->object->_getPseudoClasses($t[0]);
1185 if (is_array($pc) && count($pc) > 0) {
1186 // style classes
1187 $ilCtrl->setParameter($this, "tag", $t[0] . "." . $t2[0]);
1188 $this->tabs_gui->addTarget(
1189 "sty_tag_normal",
1190 $this->ctrl->getLinkTarget($this, "editTagStyle"),
1191 array("editTagStyle", ""),
1192 get_class($this)
1193 );
1194 if ($t2[1] == "") {
1195 $ilTabs->setTabActive("sty_tag_normal");
1196 }
1197
1198 foreach ($pc as $p) {
1199 // style classes
1200 $ilCtrl->setParameter($this, "tag", $t[0] . "." . $t2[0] . ":" . $p);
1201 $this->tabs_gui->addTarget(
1202 "sty_tag_" . $p,
1203 $this->ctrl->getLinkTarget($this, "editTagStyle"),
1204 array("editTagStyle", ""),
1205 get_class($this)
1206 );
1207 if ($t2[1] == $p) {
1208 $ilTabs->setTabActive("sty_tag_" . $p);
1209 }
1210 }
1211 $ilCtrl->setParameter($this, "tag", $_GET["tag"]);
1212 }
1213 } else {
1214 // back to upper context
1215 $this->tabs_gui->setBackTarget(
1216 $lng->txt("back"),
1217 $this->ctrl->getLinkTarget($this, "returnToUpperContext")
1218 );
1219
1220 // style classes
1221 $this->tabs_gui->addTarget(
1222 "sty_style_chars",
1223 $this->ctrl->getLinkTarget($this, "edit"),
1224 array("edit", ""),
1225 get_class($this)
1226 );
1227
1228 // colors
1229 $this->tabs_gui->addTarget(
1230 "sty_colors",
1231 $this->ctrl->getLinkTarget($this, "listColors"),
1232 "listColors",
1233 get_class($this)
1234 );
1235
1236 // media queries
1237 $this->tabs_gui->addTarget(
1238 "sty_media_queries",
1239 $this->ctrl->getLinkTarget($this, "listMediaQueries"),
1240 "listMediaQueries",
1241 get_class($this)
1242 );
1243
1244 // images
1245 $this->tabs_gui->addTarget(
1246 "sty_images",
1247 $this->ctrl->getLinkTarget($this, "listImages"),
1248 "listImages",
1249 get_class($this)
1250 );
1251
1252 // table templates
1253 $this->tabs_gui->addTarget(
1254 "sty_templates",
1255 $this->ctrl->getLinkTarget($this, "listTemplates"),
1256 "listTemplates",
1257 get_class($this)
1258 );
1259
1260 // settings
1261 $this->tabs_gui->addTarget(
1262 "settings",
1263 $this->ctrl->getLinkTarget($this, "properties"),
1264 "properties",
1265 get_class($this)
1266 );
1267
1268 // accordiontest
1269/*
1270 $this->tabs_gui->addTarget("accordiontest",
1271 $this->ctrl->getLinkTarget($this, "accordiontest"), "accordiontest",
1272 get_class($this));*/
1273 }
1274 }
1275
1281 public function setSubTabs()
1282 {
1283 $lng = $this->lng;
1284 $ilTabs = $this->tabs;
1286
1288
1289 foreach ($types as $super_type => $types) {
1290 // text block characteristics
1291 $ilCtrl->setParameter($this, "style_type", $super_type);
1292 $ilTabs->addSubTabTarget(
1293 "sty_" . $super_type . "_char",
1294 $this->ctrl->getLinkTarget($this, "edit"),
1295 array("edit", ""),
1296 get_class($this)
1297 );
1298 }
1299
1300 $ilCtrl->setParameter($this, "style_type", $_GET["style_type"]);
1301 }
1302
1308 public function setTemplatesSubTabs()
1309 {
1310 $lng = $this->lng;
1311 $ilTabs = $this->tabs;
1313
1315
1316 foreach ($types as $t => $c) {
1317 $ilCtrl->setParameter($this, "temp_type", $t);
1318 $ilTabs->addSubTabTarget(
1319 "sty_" . $t . "_templates",
1320 $this->ctrl->getLinkTarget($this, "listTemplates"),
1321 array("listTemplates", ""),
1322 get_class($this)
1323 );
1324 }
1325
1326 $ilCtrl->setParameter($this, "temp_type", $_GET["temp_type"]);
1327 }
1328
1333 public function addAdminLocatorItems($a_do_not_add_object = false)
1334 {
1335 $ilLocator = $this->locator;
1336
1337 if ($_GET["admin_mode"] == "settings") { // system settings
1338 parent::addAdminLocatorItems(true);
1339
1340 $ilLocator->addItem(
1342 ilObject::_lookupObjId($_GET["ref_id"])
1343 ),
1344 $this->ctrl->getLinkTargetByClass("ilobjstylesettingsgui", "")
1345 );
1346
1347 if ($_GET["obj_id"] > 0) {
1348 $ilLocator->addItem(
1349 $this->object->getTitle(),
1350 $this->ctrl->getLinkTarget($this, "edit")
1351 );
1352 }
1353 } else { // repository administration
1354 //?
1355 }
1356 }
1357
1361 public function listImagesObject()
1362 {
1363 $tpl = $this->tpl;
1364 $ilToolbar = $this->toolbar;
1366 $lng = $this->lng;
1368
1369 if ($this->checkWrite()) {
1370 $ilToolbar->addButton(
1371 $lng->txt("sty_add_image"),
1372 $ilCtrl->getLinkTarget($this, "addImage")
1373 );
1374 }
1375
1376 include_once("./Services/Style/Content/classes/class.ilStyleImageTableGUI.php");
1377 $table_gui = new ilStyleImageTableGUI(
1378 $this,
1379 "listImages",
1380 $this->object
1381 );
1382 $tpl->setContent($table_gui->getHTML());
1383 }
1384
1388 public function addImageObject()
1389 {
1390 $tpl = $this->tpl;
1391
1392 $this->initImageForm();
1393 $tpl->setContent($this->form_gui->getHTML());
1394 }
1395
1399 public function cancelUploadObject()
1400 {
1402
1403 $ilCtrl->redirect($this, "listImages");
1404 }
1405
1409 public function uploadImageObject()
1410 {
1411 $tpl = $this->tpl;
1413
1414 $this->initImageForm();
1415
1416 if ($this->form_gui->checkInput()) {
1417 $this->object->uploadImage($_FILES["image_file"]);
1418 $ilCtrl->redirect($this, "listImages");
1419 } else {
1420 //$this->form_gui->setImageFormValuesByPost();
1421 $tpl->setContent($this->form_gui->getHTML());
1422 }
1423 }
1424
1428 public function initImageForm()
1429 {
1430 $lng = $this->lng;
1432
1433 include_once("Services/Form/classes/class.ilPropertyFormGUI.php");
1434 $this->form_gui = new ilPropertyFormGUI();
1435
1436 $this->form_gui->setTitle($lng->txt("sty_add_image"));
1437
1438 $file_input = new ilImageFileInputGUI($lng->txt("sty_image_file"), "image_file");
1439 $file_input->setSuffixes(["jpg","jpeg","png","gif","svg"]);
1440 $file_input->setRequired(true);
1441 $this->form_gui->addItem($file_input);
1442
1443 $this->form_gui->addCommandButton("uploadImage", $lng->txt("upload"));
1444 $this->form_gui->addCommandButton("cancelUpload", $lng->txt("cancel"));
1445 $this->form_gui->setFormAction($ilCtrl->getFormAction($this));
1446 }
1447
1451 public function deleteImageObject()
1452 {
1454
1455 $images = $this->object->getImages();
1456
1457 foreach ($images as $image) {
1458 if (is_array($_POST["file"]) && in_array($image["entry"], $_POST["file"])) {
1459 $this->object->deleteImage($image["entry"]);
1460 }
1461 }
1462 $ilCtrl->redirect($this, "listImages");
1463 }
1464
1469 {
1471 $tpl = $this->tpl;
1472 $lng = $this->lng;
1473
1474 //var_dump($_POST);
1475
1476 if (!is_array($_POST["char"]) || count($_POST["char"]) == 0) {
1477 ilUtil::sendInfo($lng->txt("no_checkbox"), true);
1478 $ilCtrl->redirect($this, "edit");
1479 } else {
1480 // check whether there are any core style classes included
1481 $core_styles = ilObjStyleSheet::_getCoreStyles();
1482 foreach ($_POST["char"] as $char) {
1483 if (!empty($core_styles[$char])) {
1484 $this->deleteCoreCharMessage();
1485 return;
1486 }
1487 }
1488
1489 include_once("./Services/Utilities/classes/class.ilConfirmationGUI.php");
1490 $cgui = new ilConfirmationGUI();
1491 $cgui->setFormAction($ilCtrl->getFormAction($this));
1492 $cgui->setHeaderText($lng->txt("sty_confirm_char_deletion"));
1493 $cgui->setCancel($lng->txt("cancel"), "cancelCharacteristicDeletion");
1494 $cgui->setConfirm($lng->txt("delete"), "deleteCharacteristic");
1495
1496 foreach ($_POST["char"] as $char) {
1497 $char_comp = explode(".", $char);
1498 $cgui->addItem("char[]", $char, $char_comp[2]);
1499 }
1500
1501 $tpl->setContent($cgui->getHTML());
1502 }
1503 }
1504
1511 public function deleteCoreCharMessage()
1512 {
1514 $tpl = $this->tpl;
1515 $lng = $this->lng;
1516
1517 include_once("./Services/Utilities/classes/class.ilConfirmationGUI.php");
1518 $cgui = new ilConfirmationGUI();
1519 $cgui->setFormAction($ilCtrl->getFormAction($this));
1520
1521
1522 $core_styles = ilObjStyleSheet::_getCoreStyles();
1523 $cnt = 0;
1524 foreach ($_POST["char"] as $char) {
1525 if (!empty($core_styles[$char])) {
1526 $cnt++;
1527 $char_comp = explode(".", $char);
1528 $cgui->addItem("", "", $char_comp[2]);
1529 } else {
1530 $cgui->addHiddenItem("char[]", $char);
1531 }
1532 }
1533 $all_core_styles = ($cnt == count($_POST["char"]))
1534 ? true
1535 : false;
1536
1537 if ($all_core_styles) {
1538 $cgui->setHeaderText($lng->txt("sty_all_styles_obligatory"));
1539 $cgui->setCancel($lng->txt("back"), "cancelCharacteristicDeletion");
1540 } else {
1541 $cgui->setHeaderText($lng->txt("sty_some_styles_obligatory_delete_rest"));
1542 $cgui->setCancel($lng->txt("cancel"), "cancelCharacteristicDeletion");
1543 $cgui->setConfirm($lng->txt("sty_delete_other_selected"), "deleteCharacteristicConfirmation");
1544 }
1545
1546 $tpl->setContent($cgui->getHTML());
1547 }
1548
1553 {
1555 $lng = $this->lng;
1556
1557 ilUtil::sendInfo($lng->txt("action_aborted"), true);
1558 $ilCtrl->redirect($this, "edit");
1559 }
1560
1565 {
1567
1568 if (is_array($_POST["char"])) {
1569 foreach ($_POST["char"] as $char) {
1570 $char_comp = explode(".", $char);
1571 $type = $char_comp[0];
1572 $tag = $char_comp[1];
1573 $class = $char_comp[2];
1574
1575 $this->object->deleteCharacteristic($type, $tag, $class);
1576 }
1577 }
1578
1579 $ilCtrl->redirect($this, "edit");
1580 }
1581
1586 {
1587 $tpl = $this->tpl;
1588
1589 $this->initCharacteristicForm("create");
1590 $tpl->setContent($this->form_gui->getHTML());
1591 }
1592
1597 {
1599 $tpl = $this->tpl;
1600 $lng = $this->lng;
1601
1602 $this->initCharacteristicForm("create");
1603
1604 if ($this->form_gui->checkInput()) {
1605 if ($this->object->characteristicExists($_POST["new_characteristic"], $_GET["style_type"])) {
1606 $char_input = $this->form_gui->getItemByPostVar("new_characteristic");
1607 $char_input->setAlert($lng->txt("sty_characteristic_already_exists"));
1608 } else {
1609 $this->object->addCharacteristic($_POST["type"], $_POST["new_characteristic"]);
1610 ilUtil::sendInfo($lng->txt("sty_added_characteristic"), true);
1611 $ilCtrl->setParameter(
1612 $this,
1613 "tag",
1614 ilObjStyleSheet::_determineTag($_POST["type"]) . "." . $_POST["new_characteristic"]
1615 );
1616 $ilCtrl->setParameter($this, "style_type", $_POST["type"]);
1617 $ilCtrl->redirect($this, "editTagStyle");
1618 }
1619 }
1620 $this->form_gui->setValuesByPost();
1621 $tpl->setContent($this->form_gui->getHTML());
1622 }
1623
1629 public function initCharacteristicForm($a_mode)
1630 {
1631 $lng = $this->lng;
1633
1634 include_once("Services/Form/classes/class.ilPropertyFormGUI.php");
1635 $this->form_gui = new ilPropertyFormGUI();
1636
1637 // title
1638 $txt_input = new ilRegExpInputGUI($lng->txt("title"), "new_characteristic");
1639 $txt_input->setPattern("/^[a-zA-Z]+[a-zA-Z0-9]*$/");
1640 $txt_input->setNoMatchMessage($lng->txt("sty_msg_characteristic_must_only_include") . " A-Z, a-z, 0-9");
1641 $txt_input->setRequired(true);
1642 $this->form_gui->addItem($txt_input);
1643
1644 // type
1645 $all_super_types = ilObjStyleSheet::_getStyleSuperTypes();
1646 $types = $all_super_types[$this->super_type];
1647 $exp_types = array();
1648 foreach ($types as $t) {
1650 $exp_types[$t] = $lng->txt("sty_type_" . $t);
1651 }
1652 }
1653 if (count($exp_types) > 1) {
1654 $type_input = new ilSelectInputGUI($lng->txt("sty_type"), "type");
1655 $type_input->setOptions($exp_types);
1656 $type_input->setValue(key($exp_types));
1657 $this->form_gui->addItem($type_input);
1658 } elseif (count($exp_types) == 1) {
1659 $hid_input = new ilHiddenInputGUI("type");
1660 $hid_input->setValue(key($exp_types));
1661 $this->form_gui->addItem($hid_input);
1662 }
1663
1664 $this->form_gui->setTitle($lng->txt("sty_add_characteristic"));
1665 $this->form_gui->addCommandButton("saveCharacteristic", $lng->txt("save"));
1666 $this->form_gui->addCommandButton("edit", $lng->txt("cancel"));
1667 $this->form_gui->setFormAction($ilCtrl->getFormAction($this));
1668 }
1669
1673 public static function getStyleExampleHTML($a_type, $a_class)
1674 {
1675 global $DIC;
1676
1677 $lng = $DIC->language();
1678
1679 $c = explode(":", $a_class);
1680 $a_class = $c[0];
1681
1682 $ex_tpl = new ilTemplate("tpl.style_example.html", true, true, "Services/Style/Content");
1683
1684 if ($ex_tpl->blockExists("Example_" . $a_type)) {
1685 $ex_tpl->setCurrentBlock("Example_" . $a_type);
1686 } else {
1687 $ex_tpl->setCurrentBlock("Example_default");
1688 }
1689 $ex_tpl->setVariable("EX_CLASS", "ilc_" . $a_type . "_" . $a_class);
1690 $ex_tpl->setVariable("EX_TEXT", "ABC abc 123");
1691 if (in_array($a_type, array("media_cont", "qimg"))) {
1692 //
1693 }
1694 if (in_array($a_type, array("table", "table_caption"))) {
1695 $ex_tpl->setVariable("TXT_CAPTION", $lng->txt("sty_caption"));
1696 }
1697 if (in_array($a_class, array("OrderListItemHorizontal", "OrderListHorizontal"))) {
1698 $ex_tpl->setVariable("HOR", "Horizontal");
1699 }
1700 $ex_tpl->parseCurrentBlock();
1701
1702 return $ex_tpl->get();
1703 }
1704
1708 public function saveHideStatusObject()
1709 {
1711 $lng = $this->lng;
1712
1713 //var_dump($_POST);
1714
1715 foreach ($_POST["all_chars"] as $char) {
1716 $ca = explode(".", $char);
1717 $this->object->saveHideStatus(
1718 $ca[0],
1719 $ca[2],
1720 (is_array($_POST["hide"]) && in_array($char, $_POST["hide"]))
1721 );
1722 }
1723
1724 ilUtil::sendInfo($lng->txt("msg_obj_modified"), true);
1725 $ilCtrl->redirect($this, "edit");
1726 }
1727
1735 {
1737 $lng = $this->lng;
1738
1739 if (!is_array($_POST["char"]) || count($_POST["char"]) == 0) {
1740 ilUtil::sendFailure($lng->txt("no_checkbox"), true);
1741 } else {
1742 $style_cp = implode("::", $_POST["char"]);
1743 $style_cp = $this->object->getId() . ":::" . $_GET["style_type"] . ":::" . $style_cp;
1744 $_SESSION["sty_copy"] = $style_cp;
1745 ilUtil::sendSuccess($lng->txt("sty_copied_please_select_target"), true);
1746 }
1747 $ilCtrl->redirect($this, "edit");
1748 }
1749
1757 {
1758 $tpl = $this->tpl;
1759 $ilTabs = $this->tabs;
1760
1761 $ilTabs->clearTargets();
1762
1763 include_once("./Services/Style/Content/classes/class.ilPasteStyleCharacteristicTableGUI.php");
1764 $table = new ilPasteStyleCharacteristicTableGUI($this, "pasteCharacteristicsOverview");
1765
1766 $tpl->setContent($table->getHTML());
1767 }
1768
1776 {
1778 $lng = $this->lng;
1779
1780 if (is_array($_POST["title"])) {
1781 foreach ($_POST["title"] as $from_char => $to_title) {
1782 $fc = explode(".", $from_char);
1783
1784 if ($_POST["conflict_action"][$from_char] == "overwrite" ||
1785 !$this->object->characteristicExists($to_title, $fc[0])) {
1786 $this->object->copyCharacteristic(
1787 $_POST["from_style_id"],
1788 $fc[0],
1789 $fc[2],
1790 $to_title
1791 );
1792 }
1793 }
1794 ilObjStyleSheet::_writeUpToDate($this->object->getId(), false);
1795 unset($_SESSION["sty_copy"]);
1796 ilUtil::sendSuccess($lng->txt("sty_style_classes_copied"), true);
1797 }
1798
1799 $ilCtrl->redirect($this, "edit");
1800 }
1801
1802 //
1803 // Color management
1804 //
1805
1809 public function listColorsObject()
1810 {
1811 $tpl = $this->tpl;
1813 $ilToolbar = $this->toolbar;
1815
1816 if ($this->checkWrite()) {
1817 $ilToolbar->addButton(
1818 $this->lng->txt("sty_add_color"),
1819 $ilCtrl->getLinkTarget($this, "addColor")
1820 );
1821 }
1822
1823 include_once("./Services/Style/Content/classes/class.ilStyleColorTableGUI.php");
1824 $table_gui = new ilStyleColorTableGUI(
1825 $this,
1826 "listColors",
1827 $this->object
1828 );
1829 $tpl->setContent($table_gui->getHTML());
1830 }
1831
1835 public function addColorObject()
1836 {
1837 $tpl = $this->tpl;
1838
1839 $this->initColorForm();
1840 $tpl->setContent($this->form_gui->getHTML());
1841 }
1842
1846 public function editColorObject()
1847 {
1848 $tpl = $this->tpl;
1850
1851 $ilCtrl->setParameter($this, "c_name", $_GET["c_name"]);
1852 $this->initColorForm("edit");
1853 $this->getColorFormValues();
1854 $tpl->setContent($this->form_gui->getHTML());
1855 }
1856
1857
1861 public function initColorForm($a_mode = "create")
1862 {
1863 $lng = $this->lng;
1865
1866 include_once("Services/Form/classes/class.ilPropertyFormGUI.php");
1867 $this->form_gui = new ilPropertyFormGUI();
1868
1869 $this->form_gui->setTitle($lng->txt("sty_add_color"));
1870
1871 // name
1872 $name_input = new ilRegExpInputGUI($lng->txt("sty_color_name"), "color_name");
1873 $name_input->setPattern("/^[a-zA-Z]+[a-zA-Z0-9]*$/");
1874 $name_input->setNoMatchMessage($lng->txt("sty_msg_color_must_only_include") . " A-Z, a-z, 1-9");
1875 $name_input->setRequired(true);
1876 $name_input->setSize(15);
1877 $name_input->setMaxLength(15);
1878 $this->form_gui->addItem($name_input);
1879
1880 // code
1881 $color_input = new ilColorPickerInputGUI($lng->txt("sty_color_code"), "color_code");
1882 $color_input->setRequired(true);
1883 $color_input->setDefaultColor("");
1884 $this->form_gui->addItem($color_input);
1885
1886 if ($a_mode == "create") {
1887 $this->form_gui->addCommandButton("saveColor", $lng->txt("save"));
1888 $this->form_gui->addCommandButton("cancelColorSaving", $lng->txt("cancel"));
1889 } else {
1890 $this->form_gui->addCommandButton("updateColor", $lng->txt("save"));
1891 $this->form_gui->addCommandButton("cancelColorSaving", $lng->txt("cancel"));
1892 }
1893 $this->form_gui->setFormAction($ilCtrl->getFormAction($this));
1894 }
1895
1899 public function getColorFormValues()
1900 {
1901 if ($_GET["c_name"] != "") {
1902 $values["color_name"] = $_GET["c_name"];
1903 $values["color_code"] = $this->object->getColorCodeForName($_GET["c_name"]);
1904 $this->form_gui->setValuesByArray($values);
1905 }
1906 }
1907
1911 public function cancelColorSavingObject()
1912 {
1914
1915 $ilCtrl->redirect($this, "listColors");
1916 }
1917
1921 public function saveColorObject()
1922 {
1923 $tpl = $this->tpl;
1925 $lng = $this->lng;
1926
1927 $this->initColorForm();
1928
1929 if ($this->form_gui->checkInput()) {
1930 if ($this->object->colorExists($_POST["color_name"])) {
1931 $col_input = $this->form_gui->getItemByPostVar("color_name");
1932 $col_input->setAlert($lng->txt("sty_color_already_exists"));
1933 } else {
1934 $this->object->addColor(
1935 $_POST["color_name"],
1936 $_POST["color_code"]
1937 );
1938 $ilCtrl->redirect($this, "listColors");
1939 }
1940 }
1941 $this->form_gui->setValuesByPost();
1942 $tpl->setContent($this->form_gui->getHTML());
1943 }
1944
1948 public function updateColorObject()
1949 {
1950 $tpl = $this->tpl;
1952 $lng = $this->lng;
1953
1954 $this->initColorForm("edit");
1955
1956 if ($this->form_gui->checkInput()) {
1957 if ($this->object->colorExists($_POST["color_name"]) &&
1958 $_POST["color_name"] != $_GET["c_name"]) {
1959 $col_input = $this->form_gui->getItemByPostVar("color_name");
1960 $col_input->setAlert($lng->txt("sty_color_already_exists"));
1961 } else {
1962 $this->object->updateColor(
1963 $_GET["c_name"],
1964 $_POST["color_name"],
1965 $_POST["color_code"]
1966 );
1967 $ilCtrl->redirect($this, "listColors");
1968 }
1969 }
1970 $ilCtrl->setParameter($this, "c_name", $_GET["c_name"]);
1971 $this->form_gui->setValuesByPost();
1972 $tpl->setContent($this->form_gui->getHTML());
1973 }
1974
1979 {
1981 $tpl = $this->tpl;
1982 $lng = $this->lng;
1983
1984 if (!is_array($_POST["color"]) || count($_POST["color"]) == 0) {
1985 ilUtil::sendInfo($lng->txt("no_checkbox"), true);
1986 $ilCtrl->redirect($this, "listColors");
1987 } else {
1988 include_once("./Services/Utilities/classes/class.ilConfirmationGUI.php");
1989 $cgui = new ilConfirmationGUI();
1990 $cgui->setFormAction($ilCtrl->getFormAction($this));
1991 $cgui->setHeaderText($lng->txt("sty_confirm_color_deletion"));
1992 $cgui->setCancel($lng->txt("cancel"), "cancelColorDeletion");
1993 $cgui->setConfirm($lng->txt("delete"), "deleteColor");
1994
1995 foreach ($_POST["color"] as $c) {
1996 $cgui->addItem("color[]", ilUtil::prepareFormOutput($c), $c);
1997 }
1998
1999 $tpl->setContent($cgui->getHTML());
2000 }
2001 }
2002
2007 {
2009
2010 $ilCtrl->redirect($this, "listColors");
2011 }
2012
2016 public function deleteColorObject()
2017 {
2019
2020 if (is_array($_POST["color"])) {
2021 foreach ($_POST["color"] as $c) {
2022 $this->object->removeColor($c);
2023 }
2024 }
2025
2026 $ilCtrl->redirect($this, "listColors");
2027 }
2028
2029 //
2030 // Media query management
2031 //
2032
2036 public function listMediaQueriesObject()
2037 {
2038 $tpl = $this->tpl;
2040 $ilToolbar = $this->toolbar;
2042
2043 if ($this->checkWrite()) {
2044 $ilToolbar->addButton(
2045 $this->lng->txt("sty_add_media_query"),
2046 $ilCtrl->getLinkTarget($this, "addMediaQuery")
2047 );
2048 }
2049
2050 include_once("./Services/Style/Content/classes/class.ilStyleMediaQueryTableGUI.php");
2051 $table_gui = new ilStyleMediaQueryTableGUI(
2052 $this,
2053 "listMediaQueries",
2054 $this->object
2055 );
2056 $tpl->setContent($table_gui->getHTML());
2057 }
2058
2062 public function addMediaQueryObject()
2063 {
2064 $tpl = $this->tpl;
2065
2066 $this->initMediaQueryForm();
2067 $tpl->setContent($this->form_gui->getHTML());
2068 }
2069
2073 public function editMediaQueryObject()
2074 {
2075 $tpl = $this->tpl;
2077
2078 $ilCtrl->setParameter($this, "mq_id", $_GET["mq_id"]);
2079 $this->initMediaQueryForm("edit");
2080 $this->getMediaQueryFormValues();
2081 $tpl->setContent($this->form_gui->getHTML());
2082 }
2083
2084
2088 public function initMediaQueryForm($a_mode = "create")
2089 {
2090 $lng = $this->lng;
2092
2093 include_once("Services/Form/classes/class.ilPropertyFormGUI.php");
2094 $this->form_gui = new ilPropertyFormGUI();
2095
2096 $this->form_gui->setTitle($lng->txt("sty_add_media_query"));
2097
2098 // media query
2099 $ti = new ilTextInputGUI("@media", "mquery");
2100 $ti->setMaxLength(2000);
2101 $ti->setInfo($lng->txt("sty_add_media_query_info"));
2102 $this->form_gui->addItem($ti);
2103
2104
2105 if ($a_mode == "create") {
2106 $this->form_gui->addCommandButton("saveMediaQuery", $lng->txt("save"));
2107 $this->form_gui->addCommandButton("listMediaQueries", $lng->txt("cancel"));
2108 } else {
2109 $this->form_gui->addCommandButton("updateMediaQuery", $lng->txt("save"));
2110 $this->form_gui->addCommandButton("listMediaQueries", $lng->txt("cancel"));
2111 }
2112 $this->form_gui->setFormAction($ilCtrl->getFormAction($this));
2113 }
2114
2118 public function getMediaQueryFormValues()
2119 {
2120 if ($_GET["mq_id"] != "") {
2121 foreach ($this->object->getMediaQueries() as $mq) {
2122 if ($mq["id"] == (int) $_GET["mq_id"]) {
2123 $values["mquery"] = $mq["mquery"];
2124 }
2125 }
2126 $this->form_gui->setValuesByArray($values);
2127 }
2128 }
2129
2133 public function saveMediaQueryObject()
2134 {
2135 $tpl = $this->tpl;
2137 $lng = $this->lng;
2138
2139 $this->initMediaQueryForm();
2140
2141 if ($this->form_gui->checkInput()) {
2142 $this->object->addMediaQuery($_POST["mquery"]);
2143 $ilCtrl->redirect($this, "listMediaQueries");
2144 }
2145 $this->form_gui->setValuesByPost();
2146 $tpl->setContent($this->form_gui->getHTML());
2147 }
2148
2152 public function updateMediaQueryObject()
2153 {
2154 $tpl = $this->tpl;
2156 $lng = $this->lng;
2157
2158 $this->initMediaQueryForm("edit");
2159
2160 if ($this->form_gui->checkInput()) {
2161 $this->object->updateMediaQuery((int) $_GET["mq_id"], $_POST["mquery"]);
2162 $ilCtrl->redirect($this, "listMediaQueries");
2163 }
2164 $ilCtrl->setParameter($this, "mq_id", $_GET["mq_id"]);
2165 $this->form_gui->setValuesByPost();
2166 $tpl->setContent($this->form_gui->getHTML());
2167 }
2168
2173 {
2175 $tpl = $this->tpl;
2176 $lng = $this->lng;
2177
2178 if (!is_array($_POST["mq_id"]) || count($_POST["mq_id"]) == 0) {
2179 ilUtil::sendInfo($lng->txt("no_checkbox"), true);
2180 $ilCtrl->redirect($this, "listMediaQueries");
2181 } else {
2182 include_once("./Services/Utilities/classes/class.ilConfirmationGUI.php");
2183 $cgui = new ilConfirmationGUI();
2184 $cgui->setFormAction($ilCtrl->getFormAction($this));
2185 $cgui->setHeaderText($lng->txt("sty_sure_del_mqueries"));
2186 $cgui->setCancel($lng->txt("cancel"), "listMediaQueries");
2187 $cgui->setConfirm($lng->txt("delete"), "deleteMediaQueries");
2188
2189 foreach ($_POST["mq_id"] as $i) {
2190 $mq = $this->object->getMediaQueryForId($i);
2191 $cgui->addItem("mq_id[]", $i, $mq["mquery"]);
2192 }
2193
2194 $tpl->setContent($cgui->getHTML());
2195 }
2196 }
2197
2205 {
2208
2209 if ($this->checkWrite() && is_array($_POST["mq_id"])) {
2210 foreach ($_POST["mq_id"] as $id) {
2211 $this->object->deleteMediaQuery($id);
2212 }
2213 }
2214 $ilCtrl->redirect($this, "listMediaQueries");
2215 }
2216
2224 {
2226
2227 if (is_array($_POST["order"])) {
2228 $this->object->saveMediaQueryOrder($_POST["order"]);
2229 }
2230 $ilCtrl->redirect($this, "listMediaQueries");
2231 }
2232
2233
2234 //
2235 // Templates management
2236 //
2237
2241 public function listTemplatesObject()
2242 {
2243 $tpl = $this->tpl;
2244 $ilTabs = $this->tabs;
2246 $ilToolbar = $this->toolbar;
2247
2248 $ctype = $_GET["temp_type"];
2249 if ($ctype == "") {
2250 $ctype = "table";
2251 $ilCtrl->setParameter($this, "temp_type", $ctype);
2252 $_GET["temp_type"] = $ctype;
2253 }
2254
2255 $this->setTemplatesSubTabs();
2256 $ilTabs->setSubTabActive("sty_" . $ctype . "_templates");
2257
2258 // action commands
2259 if ($this->checkWrite()) {
2260 if ($ctype == "table") {
2261 $ilToolbar->addButton(
2262 $this->lng->txt("sty_generate_template"),
2263 $ilCtrl->getLinkTarget($this, "generateTemplate")
2264 );
2265 }
2266 $ilToolbar->addButton(
2267 $this->lng->txt("sty_add_template"),
2268 $ilCtrl->getLinkTarget($this, "addTemplate")
2269 );
2270 }
2271
2272
2273
2274 $this->includeCSS();
2275 include_once("./Services/Style/Content/classes/class.ilTableTemplatesTableGUI.php");
2276 $table_gui = new ilTableTemplatesTableGUI(
2277 $ctype,
2278 $this,
2279 "listTemplates",
2280 $this->object
2281 );
2282 $tpl->setContent($table_gui->getHTML());
2283 }
2284
2288 public function addTemplateObject()
2289 {
2290 $tpl = $this->tpl;
2291
2292 $this->initTemplateForm();
2293 $tpl->setContent($this->form_gui->getHTML());
2294 }
2295
2299 public function editTemplateObject()
2300 {
2301 $tpl = $this->tpl;
2303
2304 $ilCtrl->setParameter($this, "t_id", $_GET["t_id"]);
2305 $this->initTemplateForm("edit");
2306 $this->getTemplateFormValues();
2307
2308 $this->displayTemplateEditForm();
2309 }
2310
2314 public function getTemplatePreview($a_type, $a_t_id, $a_small_mode = false)
2315 {
2316 return $this->_getTemplatePreview(
2317 $this->object,
2318 $a_type,
2319 $a_t_id,
2320 $a_small_mode
2321 );
2322 }
2323
2327 public static function _getTemplatePreview($a_style, $a_type, $a_t_id, $a_small_mode = false)
2328 {
2329 global $DIC;
2330
2331 $lng = $DIC->language();
2332 $tpl = $DIC["tpl"];
2333
2334 $kr = $kc = 7;
2335 if ($a_small_mode) {
2336 $kr = 6;
2337 $kc = 5;
2338 }
2339
2340 $ts = $a_style->getTemplate($a_t_id);
2341 $t = $ts["classes"];
2342
2343 // preview
2344 if ($a_type == "table") {
2345 $p_content = '<PageContent><Table DataTable="y"';
2346 if ($t["row_head"] != "") {
2347 $p_content .= ' HeaderRows="1"';
2348 }
2349 if ($t["row_foot"] != "") {
2350 $p_content .= ' FooterRows="1"';
2351 }
2352 if ($t["col_head"] != "") {
2353 $p_content .= ' HeaderCols="1"';
2354 }
2355 if ($t["col_foot"] != "") {
2356 $p_content .= ' FooterCols="1"';
2357 }
2358 $p_content .= ' Template="' . $a_style->lookupTemplateName($a_t_id) . '">';
2359 if (!$a_small_mode) {
2360 $p_content .= '<Caption>' . $lng->txt("sty_caption") . '</Caption>';
2361 }
2362 for ($i = 1; $i <= $kr; $i++) {
2363 $p_content .= '<TableRow>';
2364 for ($j = 1; $j <= $kc; $j++) {
2365 if ($a_small_mode) {
2366 $cell = '&lt;div style="height:2px;"&gt;&lt;/div&gt;';
2367 } else {
2368 $cell = 'xxx';
2369 }
2370 $p_content .= '<TableData><PageContent><Paragraph Characteristic="TableContent">' . $cell . '</Paragraph></PageContent></TableData>';
2371 }
2372 $p_content .= '</TableRow>';
2373 }
2374 $p_content .= '</Table></PageContent>';
2375 }
2376
2377 if ($a_type == "vaccordion" || $a_type == "haccordion" || $a_type == "carousel") {
2378 include_once("./Services/Accordion/classes/class.ilAccordionGUI.php");
2380
2381 if ($a_small_mode) {
2382 $c = '&amp;nbsp;';
2383 $h = '&amp;nbsp;';
2384 } else {
2385 $c = 'xxx';
2386 $h = 'head';
2387 }
2388 if ($a_type == "vaccordion") {
2389 $p_content = '<PageContent><Tabs HorizontalAlign="Left" Type="VerticalAccordion" ';
2390 if ($a_small_mode) {
2391 $p_content .= ' ContentWidth="70"';
2392 }
2393 } elseif ($a_type == "haccordion") {
2394 $p_content = '<PageContent><Tabs Type="HorizontalAccordion"';
2395 if ($a_small_mode) {
2396 $p_content .= ' ContentHeight="40"';
2397 $p_content .= ' ContentWidth="70"';
2398 $c = '&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;';
2399 } else {
2400 $p_content .= ' ContentHeight="40"';
2401 }
2402 } elseif ($a_type == "carousel") {
2403 $p_content = '<PageContent><Tabs HorizontalAlign="Left" Type="Carousel" ';
2404 if ($a_small_mode) {
2405 $p_content .= ' ContentWidth="70"';
2406 }
2407 }
2408
2409
2410 $p_content .= ' Template="' . $a_style->lookupTemplateName($a_t_id) . '">';
2411 $p_content .= '<Tab><PageContent><Paragraph>' . $c . '</Paragraph></PageContent>';
2412 $p_content .= '<TabCaption>' . $h . '</TabCaption>';
2413 $p_content .= '</Tab>';
2414 $p_content .= '</Tabs></PageContent>';
2415 }
2416 //echo htmlentities($p_content);
2417 $txml = $a_style->getTemplateXML();
2418 //echo htmlentities($txml); exit;
2419 $p_content .= $txml;
2420 include_once("./Services/COPage/classes/class.ilPCTableGUI.php");
2421 $r_content = ilPCTableGUI::_renderTable($p_content, "");
2422
2423 // fix carousel template visibility
2424 if ($a_type == "carousel") {
2425 $r_content .= "<style>.owl-carousel{ display:block !important; }</style>";
2426 }
2427
2428 //echo htmlentities($r_content); exit;
2429 return $r_content;
2430 }
2431
2435 public function initTemplateForm($a_mode = "create")
2436 {
2437 $lng = $this->lng;
2439
2440 include_once("Services/Form/classes/class.ilPropertyFormGUI.php");
2441 $this->form_gui = new ilPropertyFormGUI();
2442
2443 if ($a_mode == "create") {
2444 $this->form_gui->setTitle($lng->txt("sty_add_template"));
2445 } else {
2446 $this->form_gui->setTitle($lng->txt("sty_edit_template"));
2447 }
2448
2449 // name
2450 $name_input = new ilRegExpInputGUI($lng->txt("sty_template_name"), "name");
2451 $name_input->setPattern("/^[a-zA-Z]+[a-zA-Z0-9]*$/");
2452 $name_input->setNoMatchMessage($lng->txt("sty_msg_color_must_only_include") . " A-Z, a-z, 1-9");
2453 $name_input->setRequired(true);
2454 $name_input->setSize(30);
2455 $name_input->setMaxLength(30);
2456 $this->form_gui->addItem($name_input);
2457
2458 // template style classes
2460 foreach ($scs as $sc => $st) {
2461 $sc_input = new ilSelectInputGUI($lng->txt("sty_" . $sc . "_class"), $sc . "_class");
2462 $chars = $this->object->getCharacteristics($st);
2463 $options = array("" => "");
2464 foreach ($chars as $char) {
2465 $options[$char] = $char;
2466 }
2467 $sc_input->setOptions($options);
2468 $this->form_gui->addItem($sc_input);
2469 }
2470
2471 if ($a_mode == "create") {
2472 $this->form_gui->addCommandButton("saveTemplate", $lng->txt("save"));
2473 $this->form_gui->addCommandButton("cancelTemplateSaving", $lng->txt("cancel"));
2474 } else {
2475 $this->form_gui->addCommandButton("refreshTemplate", $lng->txt("save_refresh"));
2476 $this->form_gui->addCommandButton("updateTemplate", $lng->txt("save_return"));
2477 $this->form_gui->addCommandButton("cancelTemplateSaving", $lng->txt("cancel"));
2478 }
2479 $this->form_gui->setFormAction($ilCtrl->getFormAction($this));
2480 }
2481
2486 {
2488
2489 $ilCtrl->redirect($this, "listTemplates");
2490 }
2491
2492
2496 public function saveTemplateObject()
2497 {
2498 $tpl = $this->tpl;
2500 $lng = $this->lng;
2501
2502 $this->initTemplateForm();
2503
2504 if ($this->form_gui->checkInput()) {
2505 if ($this->object->templateExists($_POST["name"])) {
2506 $name_input = $this->form_gui->getItemByPostVar("name");
2507 $name_input->setAlert($lng->txt("sty_table_template_already_exists"));
2508 } else {
2509 $classes = array();
2510 foreach (ilObjStyleSheet::_getTemplateClassTypes($_GET["temp_type"]) as $tct => $ct) {
2511 $classes[$tct] = $_POST[$tct . "_class"];
2512 }
2513 $t_id = $this->object->addTemplate($_GET["temp_type"], $_POST["name"], $classes);
2514 $this->object->writeTemplatePreview(
2515 $t_id,
2516 $this->getTemplatePreview($_GET["temp_type"], $t_id, true)
2517 );
2518 $ilCtrl->redirect($this, "listTemplates");
2519 }
2520 }
2521 $this->form_gui->setValuesByPost();
2522 $tpl->setContent($this->form_gui->getHTML());
2523 }
2524
2528 public function updateTemplateObject($a_refresh = false)
2529 {
2530 $tpl = $this->tpl;
2532 $lng = $this->lng;
2533
2534 $ilCtrl->setParameter($this, "t_id", $_GET["t_id"]);
2535 $this->initTemplateForm("edit");
2536
2537 if ($this->form_gui->checkInput()) {
2538 if ($this->object->templateExists($_POST["name"]) &&
2540 $name_input = $this->form_gui->getItemByPostVar("name");
2541 $name_input->setAlert($lng->txt("sty_template_already_exists"));
2542 } else {
2543 $classes = array();
2544 foreach (ilObjStyleSheet::_getTemplateClassTypes($_GET["temp_type"]) as $tct => $ct) {
2545 $classes[$tct] = $_POST[$tct . "_class"];
2546 }
2547
2548 $this->object->updateTemplate(
2549 $_GET["t_id"],
2550 $_POST["name"],
2551 $classes
2552 );
2553 $this->object->writeTemplatePreview(
2554 $_GET["t_id"],
2555 $this->getTemplatePreview($_GET["temp_type"], $_GET["t_id"], true)
2556 );
2557 if (!$a_refresh) {
2558 $ilCtrl->redirect($this, "listTemplates");
2559 }
2560 }
2561 }
2562
2563 $this->form_gui->setValuesByPost();
2564 $this->displayTemplateEditForm();
2565 }
2566
2570 public function displayTemplateEditForm()
2571 {
2572 $tpl = $this->tpl;
2573
2574 $a_tpl = new ilTemplate(
2575 "tpl.template_edit.html",
2576 true,
2577 true,
2578 "Services/Style/Content"
2579 );
2580 $this->includeCSS();
2581 $a_tpl->setVariable("FORM", $this->form_gui->getHTML());
2582 $a_tpl->setVariable("PREVIEW", $this->getTemplatePreview($_GET["temp_type"], $_GET["t_id"]));
2583 $tpl->setContent($a_tpl->get());
2584 }
2585
2589 public function refreshTemplateObject()
2590 {
2591 $this->updateTemplateObject(true);
2592 }
2593
2597 public function getTemplateFormValues()
2598 {
2599 if ($_GET["t_id"] > 0) {
2600 $t = $this->object->getTemplate($_GET["t_id"]);
2601
2602 $values["name"] = $t["name"];
2604 foreach ($scs as $k => $type) {
2605 $values[$k . "_class"] = $t["classes"][$k];
2606 }
2607 $this->form_gui->setValuesByArray($values);
2608 }
2609 }
2610
2615 {
2617 $tpl = $this->tpl;
2618 $lng = $this->lng;
2619
2620 if (!is_array($_POST["tid"]) || count($_POST["tid"]) == 0) {
2621 ilUtil::sendInfo($lng->txt("no_checkbox"), true);
2622 $ilCtrl->redirect($this, "listTemplates");
2623 } else {
2624 include_once("./Services/Utilities/classes/class.ilConfirmationGUI.php");
2625 $cgui = new ilConfirmationGUI();
2626 $cgui->setFormAction($ilCtrl->getFormAction($this));
2627 $cgui->setHeaderText($lng->txt("sty_confirm_template_deletion"));
2628 $cgui->setCancel($lng->txt("cancel"), "cancelTemplateDeletion");
2629 $cgui->setConfirm($lng->txt("sty_del_template"), "deleteTemplate");
2630
2631 foreach ($_POST["tid"] as $tid) {
2632 $classes = $this->object->getTemplateClasses($tid);
2633 $cl_str = "";
2634 $listed = array();
2635 foreach ($classes as $cl) {
2636 if ($cl != "" && !$listed[$cl]) {
2637 $cl_str .= '<div>- ' .
2638 $cl . "</div>";
2639 $listed[$cl] = true;
2640 }
2641 }
2642 if ($cl_str != "") {
2643 $cl_str = '<div style="padding-left:30px;" class="small">' .
2644 "<div><i>" . $lng->txt("sty_style_class") . "</i></div>" . $cl_str . "</div>";
2645 }
2646 $cgui->addItem("tid[]", $tid, $this->object->lookupTemplateName($tid) . $cl_str);
2647 }
2648
2649 $cgui->addButton($lng->txt("sty_del_template_keep_classes"), "deleteTemplateKeepClasses");
2650
2651 $tpl->setContent($cgui->getHTML());
2652 }
2653 }
2654
2659 {
2661
2662 $ilCtrl->redirect($this, "listTemplates");
2663 }
2664
2669 {
2671
2672 if (is_array($_POST["tid"])) {
2673 foreach ($_POST["tid"] as $tid) {
2674 $this->object->removeTemplate($tid);
2675 }
2676 }
2677
2678 $ilCtrl->redirect($this, "listTemplates");
2679 }
2680
2684 public function deleteTemplateObject()
2685 {
2687
2688 if (is_array($_POST["tid"])) {
2689 foreach ($_POST["tid"] as $tid) {
2690 $cls = $this->object->getTemplateClasses($tid);
2691 foreach ($cls as $k => $cls) {
2692 $ty = $this->object->determineTemplateStyleClassType($_GET["temp_type"], $k);
2694 $this->object->deleteCharacteristic($ty, $ta, $cls);
2695 }
2696 $this->object->removeTemplate($tid);
2697 }
2698 }
2699
2700 $ilCtrl->redirect($this, "listTemplates");
2701 }
2702
2706 public function generateTemplateObject()
2707 {
2708 $tpl = $this->tpl;
2709
2711 $tpl->setContent($this->form_gui->getHTML());
2712 }
2713
2718 {
2719 $lng = $this->lng;
2721
2722 include_once("Services/Form/classes/class.ilPropertyFormGUI.php");
2723 $this->form_gui = new ilPropertyFormGUI();
2724
2725 $this->form_gui->setTitle($lng->txt("sty_generate_template"));
2726
2727 // name
2728 $name_input = new ilRegExpInputGUI($lng->txt("sty_template_name"), "name");
2729 $name_input->setPattern("/^[a-zA-Z]+[a-zA-Z0-9]*$/");
2730 $name_input->setNoMatchMessage($lng->txt("sty_msg_color_must_only_include") . " A-Z, a-z, 1-9");
2731 $name_input->setRequired(true);
2732 $name_input->setSize(30);
2733 $name_input->setMaxLength(30);
2734 $this->form_gui->addItem($name_input);
2735
2736 // basic layout
2737 $bl_input = new ilSelectInputGUI($lng->txt("sty_template_layout"), "layout");
2738 $options = array(
2739 "coloredZebra" => $lng->txt("sty_table_template_colored_zebra"),
2740 "bwZebra" => $lng->txt("sty_table_template_bw_zebra"),
2741 "noZebra" => $lng->txt("sty_table_template_no_zebra")
2742 );
2743 $bl_input->setOptions($options);
2744 $this->form_gui->addItem($bl_input);
2745
2746 // top bottom padding
2747 include_once("./Services/Style/Content/classes/class.ilNumericStyleValueInputGUI.php");
2748 $num_input = new ilNumericStyleValueInputGUI($lng->txt("sty_top_bottom_padding"), "tb_padding");
2749 $num_input->setAllowPercentage(false);
2750 $num_input->setValue("3px");
2751 $this->form_gui->addItem($num_input);
2752
2753 // left right padding
2754 $num_input = new ilNumericStyleValueInputGUI($lng->txt("sty_left_right_padding"), "lr_padding");
2755 $num_input->setAllowPercentage(false);
2756 $num_input->setValue("10px");
2757 $this->form_gui->addItem($num_input);
2758
2759 // base color
2760 $bc_input = new ilSelectInputGUI($lng->txt("sty_base_color"), "base_color");
2761 $cs = $this->object->getColors();
2762 $options = array();
2763 foreach ($cs as $c) {
2764 $options[$c["name"]] = $c["name"];
2765 }
2766 $bc_input->setOptions($options);
2767 $this->form_gui->addItem($bc_input);
2768
2769 // Lightness Settings
2770 $lss = array("border" => 90, "header_text" => 70, "header_bg" => 0,
2771 "cell1_text" => -60, "cell1_bg" => 90, "cell2_text" => -60, "cell2_bg" => 75);
2772 foreach ($lss as $ls => $v) {
2773 $l_input = new ilNumberInputGUI($lng->txt("sty_lightness_" . $ls), "lightness_" . $ls);
2774 $l_input->setMaxValue(100);
2775 $l_input->setMinValue(-100);
2776 $l_input->setValue($v);
2777 $l_input->setSize(4);
2778 $l_input->setMaxLength(4);
2779 $this->form_gui->addItem($l_input);
2780 }
2781
2782 $this->form_gui->addCommandButton("templateGeneration", $lng->txt("generate"));
2783 $this->form_gui->addCommandButton("cancelTemplateSaving", $lng->txt("cancel"));
2784 $this->form_gui->setFormAction($ilCtrl->getFormAction($this));
2785 }
2786
2791 {
2792 $tpl = $this->tpl;
2794 $lng = $this->lng;
2795
2797
2798 if ($this->form_gui->checkInput()) {
2799 if ($this->object->templateExists($_POST["name"])) {
2800 $name_input = $this->form_gui->getItemByPostVar("name");
2801 $name_input->setAlert($lng->txt("sty_table_template_already_exists"));
2802 } else {
2803 // -> move to application class!
2804
2805 // cell classes
2806 $cells = array("H" => "header", "C1" => "cell1", "C2" => "cell2");
2807 $tb_p = $this->form_gui->getItemByPostVar("tb_padding");
2808 $tb_padding = $tb_p->getValue();
2809 $lr_p = $this->form_gui->getItemByPostVar("lr_padding");
2810 $lr_padding = $lr_p->getValue();
2811 $cell_color = $_POST["base_color"];
2812
2813 // use mid gray as cell color for bw zebra
2814 if ($_POST["layout"] == "bwZebra") {
2815 $cell_color = "MidGray";
2816 if (!$this->object->colorExists($cell_color)) {
2817 $this->object->addColor($cell_color, "7F7F7F");
2818 }
2819 $this->object->updateColor($cell_color, $cell_color, "7F7F7F");
2820 }
2821
2822 foreach ($cells as $k => $cell) {
2823 $cell_class[$k] = $_POST["name"] . $k;
2824 if (!$this->object->characteristicExists($cell_class[$k], "table_cell")) {
2825 $this->object->addCharacteristic("table_cell", $cell_class[$k], true);
2826 }
2827 if ($_POST["layout"] == "bwZebra" && $k == "H") {
2828 $this->object->replaceStylePar(
2829 "td",
2830 $cell_class[$k],
2831 "color",
2832 "!" . $_POST["base_color"] . "(" . $_POST["lightness_" . $cell . "_text"] . ")",
2833 "table_cell"
2834 );
2835 $this->object->replaceStylePar(
2836 "td",
2837 $cell_class[$k],
2838 "background-color",
2839 "!" . $_POST["base_color"] . "(" . $_POST["lightness_" . $cell . "_bg"] . ")",
2840 "table_cell"
2841 );
2842 } else {
2843 $this->object->replaceStylePar(
2844 "td",
2845 $cell_class[$k],
2846 "color",
2847 "!" . $cell_color . "(" . $_POST["lightness_" . $cell . "_text"] . ")",
2848 "table_cell"
2849 );
2850 $this->object->replaceStylePar(
2851 "td",
2852 $cell_class[$k],
2853 "background-color",
2854 "!" . $cell_color . "(" . $_POST["lightness_" . $cell . "_bg"] . ")",
2855 "table_cell"
2856 );
2857 }
2858 $this->object->replaceStylePar(
2859 "td",
2860 $cell_class[$k],
2861 "padding-top",
2862 $tb_padding,
2863 "table_cell"
2864 );
2865 $this->object->replaceStylePar(
2866 "td",
2867 $cell_class[$k],
2868 "padding-bottom",
2869 $tb_padding,
2870 "table_cell"
2871 );
2872 $this->object->replaceStylePar(
2873 "td",
2874 $cell_class[$k],
2875 "padding-left",
2876 $lr_padding,
2877 "table_cell"
2878 );
2879 $this->object->replaceStylePar(
2880 "td",
2881 $cell_class[$k],
2882 "padding-right",
2883 $lr_padding,
2884 "table_cell"
2885 );
2886 $this->object->replaceStylePar(
2887 "td",
2888 $cell_class[$k],
2889 "border-width",
2890 "1px",
2891 "table_cell"
2892 );
2893 $this->object->replaceStylePar(
2894 "td",
2895 $cell_class[$k],
2896 "border-style",
2897 "solid",
2898 "table_cell"
2899 );
2900 $this->object->replaceStylePar(
2901 "td",
2902 $cell_class[$k],
2903 "border-color",
2904 "!" . $cell_color . "(" . $_POST["lightness_border"] . ")",
2905 "table_cell"
2906 );
2907 $this->object->replaceStylePar(
2908 "td",
2909 $cell_class[$k],
2910 "font-weight",
2911 "normal",
2912 "table_cell"
2913 );
2914 }
2915
2916 // table class
2917 $classes["table"] = $_POST["name"] . "T";
2918 if (!$this->object->characteristicExists($classes["table"], "table")) {
2919 $this->object->addCharacteristic("table", $classes["table"], true);
2920 }
2921 $this->object->replaceStylePar(
2922 "table",
2923 $classes["table"],
2924 "caption-side",
2925 "bottom",
2926 "table"
2927 );
2928 $this->object->replaceStylePar(
2929 "table",
2930 $classes["table"],
2931 "border-collapse",
2932 "collapse",
2933 "table"
2934 );
2935 $this->object->replaceStylePar(
2936 "table",
2937 $classes["table"],
2938 "margin-top",
2939 "5px",
2940 "table"
2941 );
2942 $this->object->replaceStylePar(
2943 "table",
2944 $classes["table"],
2945 "margin-bottom",
2946 "5px",
2947 "table"
2948 );
2949 if ($_POST["layout"] == "bwZebra") {
2950 $this->object->replaceStylePar(
2951 "table",
2952 $classes["table"],
2953 "border-bottom-color",
2954 "!" . $_POST["base_color"],
2955 "table"
2956 );
2957 $this->object->replaceStylePar(
2958 "table",
2959 $classes["table"],
2960 "border-bottom-style",
2961 "solid",
2962 "table"
2963 );
2964 $this->object->replaceStylePar(
2965 "table",
2966 $classes["table"],
2967 "border-bottom-width",
2968 "3px",
2969 "table"
2970 );
2971 $sb = array("left", "right", "top");
2972 foreach ($sb as $b) {
2973 $this->object->replaceStylePar(
2974 "table",
2975 $classes["table"],
2976 "border-" . $b . "-width",
2977 "0px",
2978 "table"
2979 );
2980 }
2981 }
2982
2983 switch ($_POST["layout"]) {
2984 case "coloredZebra":
2985 $classes["row_head"] = $cell_class["H"];
2986 $classes["odd_row"] = $cell_class["C1"];
2987 $classes["even_row"] = $cell_class["C2"];
2988 break;
2989
2990 case "bwZebra":
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 "noZebra":
2997 $classes["row_head"] = $cell_class["H"];
2998 $classes["odd_row"] = $cell_class["C1"];
2999 $classes["even_row"] = $cell_class["C1"];
3000 $classes["col_head"] = $cell_class["C2"];
3001 break;
3002 }
3003
3004
3005 $t_id = $this->object->addTemplate(
3006 $_GET["temp_type"],
3007 $_POST["name"],
3008 $classes
3009 );
3010 $this->object->writeTemplatePreview(
3011 $t_id,
3012 $this->getTemplatePreview($_GET["temp_type"], $t_id, true)
3013 );
3014 $ilCtrl->redirect($this, "listTemplates");
3015 }
3016 }
3017 $this->form_gui->setValuesByPost();
3018 $tpl->setContent($this->form_gui->getHTML());
3019 }
3020
3021 public function accordiontestObject()
3022 {
3023 $tpl = $this->tpl;
3024
3025 include_once("./Services/Accordion/classes/class.ilAccordionGUI.php");
3026
3027 $acc = new ilAccordionGUI();
3028 $acc->addItem("Header 1", str_repeat("bla bla bla bla bla bla", 30));
3029 $acc->addItem("Header 2", str_repeat("xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx xx x xx x xx", 30));
3030 $acc->setOrientation(ilAccordionGUI::HORIZONTAL);
3031
3032 $ac2 = new ilAccordionGUI();
3033 $ac2->addItem("Header 1", str_repeat("bla bla bla bla bla bla", 30));
3034 $ac2->addItem("Header 2", $acc->getHTML());
3035 $ac2->setOrientation(ilAccordionGUI::VERTICAL);
3036
3037 $tpl->setContent($ac2->getHTML());
3038 }
3039
3044 {
3046
3047 /*if ($_GET["baseClass"] == "ilAdministrationGUI")
3048 {
3049 $ilCtrl->redirectByClass("ilcontentstylesettingsgui", "edit");
3050 }*/
3051 $ilCtrl->returnToParent($this);
3052 }
3053}
if(php_sapi_name() !='cli') $in
Definition: Utf8Test.php:37
$_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()
viewObject container presentation for "administration -> repository, trash, permissions"
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
enableWrite($a_write)
Enable writing.
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 getContentStylePath($a_style_id, $add_random=true, $add_token=true)
get content style path
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 _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, $page_object=null)
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
help()
Definition: help.php:2
global $ilCtrl
Definition: ilias.php:18
$i
Definition: metadata.php:24
$source
Definition: metadata.php:76
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
redirection script todo: (a better solution should control the processing via a xml file)
$ret
Definition: parser.php:6
$type
settings()
Definition: settings.php:2
$a_type
Definition: workflow.php:92
$DIC
Definition: xapitoken.php:46