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