ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
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 
4 require_once "./Services/Object/classes/class.ilObjectGUI.php";
5 require_once "./Services/Style/Content/classes/class.ilObjStyleSheet.php";
6 
17 {
22 
27  function __construct($a_data,$a_id,$a_call_by_reference, $a_prep = true)
28  {
29  global $ilCtrl, $lng, $tpl;
30 
31  $this->ctrl = $ilCtrl;
32  $this->lng = $lng;
33  $this->lng->loadLanguageModule("style");
34  $ilCtrl->saveParameter($this, array("tag", "style_type", "temp_type"));
35  if ($_GET["style_type"] != "")
36  {
37  $this->super_type = ilObjStyleSheet::_getStyleSuperTypeForType($_GET["style_type"]);
38  }
39 
40  $this->type = "sty";
41  parent::__construct($a_data,$a_id,$a_call_by_reference, false);
42  }
43 
47  function executeCommand()
48  {
49  $next_class = $this->ctrl->getNextClass($this);
50  $cmd = $this->ctrl->getCmd("edit");
51 
52  // #9440/#9489: prepareOutput will fail if not set properly
53  if(!$this->object)
54  {
55  $this->setCreationMode(true);
56  }
57 
58  $this->prepareOutput();
59  switch($next_class)
60  {
61  default:
62  $cmd.= "Object";
63  $ret = $this->$cmd();
64  break;
65  }
66 
67  return $ret;
68  }
69 
70  function viewObject()
71  {
72  $this->editObject();
73  }
74 
78  function createObject()
79  {
80  global $rbacsystem, $lng, $tpl, $ilHelp;
81 
82  $forms = array();
83 
84 
85  $ilHelp->setScreenIdComponent("sty");
86  $ilHelp->setDefaultScreenId(ilHelpGUI::ID_PART_SCREEN, "create");
87 
88  // --- create
89 
90  include_once "Services/Form/classes/class.ilPropertyFormGUI.php";
91  $form = new ilPropertyFormGUI();
92  $form->setFormAction($this->ctrl->getFormAction($this));
93  $form->setTitle($this->lng->txt("sty_create_new_stylesheet"));
94 
95  // title
96  $ti = new ilTextInputGUI($this->lng->txt("title"), "style_title");
97  $ti->setMaxLength(128);
98  $ti->setSize(40);
99  $ti->setRequired(true);
100  $form->addItem($ti);
101 
102  // description
103  $ta = new ilTextAreaInputGUI($this->lng->txt("description"), "style_description");
104  $ta->setCols(40);
105  $ta->setRows(2);
106  $form->addItem($ta);
107 
108  $form->addCommandButton("save", $this->lng->txt("save"));
109  $form->addCommandButton("cancel", $this->lng->txt("cancel"));
110 
111  $forms[] = $form;
112 
113 
114  // --- import
115 
116  include_once "Services/Form/classes/class.ilPropertyFormGUI.php";
117  $form = new ilPropertyFormGUI();
118  $form->setFormAction($this->ctrl->getFormAction($this));
119  $form->setTitle($this->lng->txt("sty_import_stylesheet"));
120 
121  // title
122  $ti = new ilFileInputGUI($this->lng->txt("import_file"), "importfile");
123  $ti->setRequired(true);
124  $form->addItem($ti);
125 
126  $form->addCommandButton("importStyle", $this->lng->txt("import"));
127  $form->addCommandButton("cancel", $this->lng->txt("cancel"));
128 
129  $forms[] = $form;
130 
131 
132  // --- clone
133 
134  include_once "Services/Form/classes/class.ilPropertyFormGUI.php";
135  $form = new ilPropertyFormGUI();
136  $form->setFormAction($this->ctrl->getFormAction($this));
137  $form->setTitle($this->lng->txt("sty_copy_other_stylesheet"));
138 
139  // source
140  $ti = new ilSelectInputGUI($this->lng->txt("sty_source"), "source_style");
141  $ti->setRequired(true);
143  $form->addItem($ti);
144 
145  $form->addCommandButton("copyStyle", $this->lng->txt("copy"));
146  $form->addCommandButton("cancel", $this->lng->txt("cancel"));
147 
148  $forms[] = $form;
149 
150 
151  $this->tpl->setContent($this->getCreationFormsHTML($forms));
152  }
153 
157  function includeCSS()
158  {
159  // set style sheet
160  $this->tpl->setCurrentBlock("ContentStyle");
161  $this->tpl->setVariable("LOCATION_CONTENT_STYLESHEET",
163  $this->tpl->parseCurrentBlock();
164  }
165 
166 
173  public function checkWrite()
174  {
175  global $rbacsystem;
176 
177  return ($rbacsystem->checkAccess("write", (int) $_GET["ref_id"])
178  || $rbacsystem->checkAccess("sty_write_content", (int) $_GET["ref_id"]));
179  }
180 
181 
185  function editObject()
186  {
187  global $rbacsystem, $lng, $ilTabs, $ilCtrl, $ilToolbar, $tpl;
188 
189  $this->setSubTabs();
190 
191  $this->includeCSS();
192 
193  $ctpl = new ilTemplate("tpl.sty_classes.html", true, true, "Services/Style/Content");
194 
195  // output characteristics
196  $chars = $this->object->getCharacteristics();
197 
198  $style_type = ($this->super_type != "")
199  ? $this->super_type
200  : "text_block";
201  $ilCtrl->setParameter($this, "style_type", $style_type);
202  $ilTabs->setSubTabActive("sty_".$style_type."_char");
203 
204  // workaround to include default rte styles
205  if ($this->super_type == "rte")
206  {
207  $tpl->addCss("Modules/Scorm2004/templates/default/player.css");
208  include_once("./Modules/Scorm2004/classes/ilSCORM13Player.php");
209  $tpl->addInlineCss(ilSCORM13Player::getInlineCss());
210  }
211 
212  // add new style?
213  $all_super_types = ilObjStyleSheet::_getStyleSuperTypes();
214  $subtypes = $all_super_types[$style_type];
215  $expandable = false;
216  foreach ($subtypes as $t)
217  {
219  {
220  $expandable = true;
221  }
222  }
223  if ($expandable && $this->checkWrite())
224  {
225  $ilToolbar->addButton($lng->txt("sty_add_characteristic"),
226  $ilCtrl->getLinkTarget($this, "addCharacteristicForm"));
227  }
228 
229  if ($_SESSION["sty_copy"] != "")
230  {
231  $style_cp = explode(":::", $_SESSION["sty_copy"]);
232  if ($style_cp[1] == $style_type)
233  {
234  if ($expandable)
235  {
236  $ilToolbar->addSeparator();
237  }
238  $ilToolbar->addButton($lng->txt("sty_paste_style_classes"),
239  $ilCtrl->getLinkTarget($this, "pasteCharacteristicsOverview"));
240  }
241  }
242 
243  include_once("./Services/Style/Content/classes/class.ilStyleTableGUI.php");
244  $table_gui = new ilStyleTableGUI($this, "edit", $chars, $style_type,
245  $this->object);
246 
247  $ctpl->setCurrentBlock("style_table");
248  $ctpl->setVariable("STYLE_TABLE", $table_gui->getHTML());
249  $ctpl->parseCurrentBlock();
250 
251  $this->tpl->setContent($ctpl->get());
252  }
253 
257  function propertiesObject()
258  {
259  global $rbacsystem, $lng, $ilToolbar;
260 
261  // set style sheet
262  $this->tpl->setCurrentBlock("ContentStyle");
263  $this->tpl->setVariable("LOCATION_CONTENT_STYLESHEET",
265  $this->tpl->parseCurrentBlock();
266 
267  // export button
268  $ilToolbar->addButton($this->lng->txt("export"),
269  $this->ctrl->getLinkTarget($this, "exportStyle"));
270 
271  $this->initPropertiesForm();
272  $this->getPropertiesValues();
273  $this->tpl->setContent($this->form->getHTML());
274  }
275 
280  public function getPropertiesValues()
281  {
282  $values = array();
283 
284  $values["style_title"] = $this->object->getTitle();
285  $values["style_description"] = $this->object->getDescription();
286  $values["disable_auto_margins"] = (int) $this->object->lookupStyleSetting("disable_auto_margins");
287 
288  $this->form->setValuesByArray($values);
289  }
290 
296  public function initPropertiesForm($a_mode = "edit")
297  {
298  global $lng, $rbacsystem;
299 
300  include_once("Services/Form/classes/class.ilPropertyFormGUI.php");
301  $this->form = new ilPropertyFormGUI();
302 
303  // title
304  $ti = new ilTextInputGUI($this->lng->txt("title"), "style_title");
305  $ti->setMaxLength(128);
306  $ti->setSize(40);
307  $ti->setRequired(true);
308  $this->form->addItem($ti);
309 
310  // description
311  $ta = new ilTextAreaInputGUI($this->lng->txt("description"), "style_description");
312  //$ta->setCols();
313  //$ta->setRows();
314  $this->form->addItem($ta);
315 
316  // disable automatic margins for left/right alignment
317  $cb = new ilCheckboxInputGUI($this->lng->txt("sty_disable_auto_margins"), "disable_auto_margins");
318  $cb->setInfo($this->lng->txt("sty_disable_auto_margins_info"));
319  $this->form->addItem($cb);
320 
321  // save and cancel commands
322 
323  if ($a_mode == "create")
324  {
325  $this->form->addCommandButton("save", $lng->txt("save"));
326  $this->form->addCommandButton("cancelSave", $lng->txt("cancel"));
327  }
328  else
329  {
330  if ($this->checkWrite())
331  {
332  $this->form->addCommandButton("update", $lng->txt("save"));
333  }
334  }
335 
336  $this->form->setTitle($lng->txt("edit_stylesheet"));
337  $this->form->setFormAction($this->ctrl->getFormAction($this));
338 
339  }
340 
344  function updateObject()
345  {
346  global $lng, $ilCtrl, $tpl;
347 
348  $this->initPropertiesForm("edit");
349  if ($this->form->checkInput())
350  {
351  $this->object->setTitle($this->form->getInput("style_title"));
352  $this->object->setDescription($this->form->getInput("style_description"));
353  $this->object->writeStyleSetting("disable_auto_margins",
354  $this->form->getInput("disable_auto_margins"));
355  $this->object->update();
356  ilUtil::sendInfo($lng->txt("msg_obj_modified"), true);
357  $ilCtrl->redirect($this, "properties");
358  }
359  else
360  {
361  $this->form->setValuesByPost();
362  $tpl->setContent($this->form->getHtml());
363  }
364  }
365 
370  {
371  global $ilCtrl;
372 
373  $cur = explode(".",$_GET["tag"]);
374  $cur_tag = $cur[0];
375  $cur_class = $cur[1];
376 
377  $this->initTagStyleForm("edit", $cur_tag);
378 
379  if ($this->form_gui->checkInput())
380  {
381  $this->saveTagStyle();
382  $ilCtrl->redirect($this, "editTagStyle");
383  }
384  else
385  {
386  $this->form_gui->setValuesByPost();
387  $this->outputTagStyleEditScreen();
388  }
389  }
390 
395  {
396  global $ilCtrl;
397 
398  $cur = explode(".",$_GET["tag"]);
399  $cur_tag = $cur[0];
400  $cur_class = $cur[1];
401 
402  $this->initTagStyleForm("edit", $cur_tag);
403  if ($this->form_gui->checkInput())
404  {
405  $this->saveTagStyle();
406  $ilCtrl->redirect($this, "edit");
407  }
408  else
409  {
410  $this->form_gui->setValuesByPost();
411  $this->outputTagStyleEditScreen();
412  }
413  }
414 
418  function saveTagStyle()
419  {
420  $cur = explode(".", $_GET["tag"]);
421  $cur_tag = $cur[0];
422  $cur_class = $cur[1];
423  $avail_pars = ilObjStyleSheet::_getStyleParameters($cur_tag);
424  foreach ($avail_pars as $par => $v)
425  {
426  $var = str_replace("-", "_", $par);
427  $basepar_arr = explode(".", $par);
428  $basepar = $basepar_arr[0];
429  if ($basepar_arr[1] != "" && $basepar_arr[1] != $cur_tag)
430  {
431  continue;
432  }
433 
434  switch ($v["input"])
435  {
436  case "fontsize":
437  case "numeric_no_perc":
438  case "numeric":
439  case "background_image":
440  $in = $this->form_gui->getItemByPostVar($basepar);
441 //echo "<br>-".$cur_tag."-".$cur_class."-".$basepar."-".$_GET["style_type"]."-";
442  $this->writeStylePar($cur_tag, $cur_class, $basepar, $in->getValue(), $_GET["style_type"], (int) $_GET["mq_id"]);
443  break;
444 
445  case "color":
446  $color = trim($_POST[$basepar]);
447  if ($color != "" && trim(substr($color,0,1) != "!"))
448  {
449  $color = "#".$color;
450  }
451  $this->writeStylePar($cur_tag, $cur_class, $basepar, $color, $_GET["style_type"], (int) $_GET["mq_id"]);
452  break;
453 
454  case "trbl_numeric":
455  case "border_width":
456  case "border_style":
457  $in = $this->form_gui->getItemByPostVar($basepar);
458  $this->writeStylePar($cur_tag, $cur_class, $v["subpar"][0], $in->getAllValue(), $_GET["style_type"], (int) $_GET["mq_id"]);
459  $this->writeStylePar($cur_tag, $cur_class, $v["subpar"][1], $in->getTopValue(), $_GET["style_type"], (int) $_GET["mq_id"]);
460  $this->writeStylePar($cur_tag, $cur_class, $v["subpar"][2], $in->getRightValue(), $_GET["style_type"], (int) $_GET["mq_id"]);
461  $this->writeStylePar($cur_tag, $cur_class, $v["subpar"][3], $in->getBottomValue(), $_GET["style_type"], (int) $_GET["mq_id"]);
462  $this->writeStylePar($cur_tag, $cur_class, $v["subpar"][4], $in->getLeftValue(), $_GET["style_type"], (int) $_GET["mq_id"]);
463  break;
464 
465  case "trbl_color":
466  $in = $this->form_gui->getItemByPostVar($basepar);
467  $tblr_p = array (0 => "getAllValue", 1 => "getTopValue", 2 => "getRightValue",
468  3 => "getBottomValue", 4 => "getLeftValue");
469  foreach ($tblr_p as $k => $func)
470  {
471  $val = trim($in->$func());
472  $val = (($in->getAcceptNamedColors() && substr($val, 0, 1) == "!")
473  || $val == "")
474  ? $val
475  : "#".$val;
476  $this->writeStylePar($cur_tag, $cur_class, $v["subpar"][$k], $val, $_GET["style_type"], (int) $_GET["mq_id"]);
477  }
478  break;
479 
480  case "background_position":
481  $in = $this->form_gui->getItemByPostVar($basepar);
482  $this->writeStylePar($cur_tag, $cur_class, $basepar, $in->getValue(), $_GET["style_type"], (int) $_GET["mq_id"]);
483  break;
484 
485  default:
486  $this->writeStylePar($cur_tag, $cur_class, $basepar, $_POST[$basepar], $_GET["style_type"], (int) $_GET["mq_id"]);
487  break;
488  }
489  }
490 
491  // write custom parameter
492  $this->object->deleteCustomStylePars($cur_tag, $cur_class, $_GET["style_type"], (int) $_GET["mq_id"]);
493  if (is_array($_POST["custom_par"]))
494  {
495  foreach ($_POST["custom_par"] as $cpar)
496  {
497  $par_arr = explode(":", $cpar);
498  if (count($par_arr) == 2)
499  {
500  $par = trim($par_arr[0]);
501  $val = trim(str_replace(";", "", $par_arr[1]));
502  $this->writeStylePar($cur_tag, $cur_class, $par, $val, $_GET["style_type"], (int) $_GET["mq_id"], true);
503  }
504  }
505  }
506 
507  $this->object->update();
508  }
509 
510  function writeStylePar($cur_tag, $cur_class, $par, $value, $a_type, $a_mq_id, $a_custom = false)
511  {
512 // echo $_GET["mq_id"]."-";
513 // echo $a_mq_id."-"; exit;
514  if ($a_type == "")
515  {
516  return;
517  }
518 
519  if ($value != "")
520  {
521  $this->object->replaceStylePar($cur_tag, $cur_class, $par, $value, $a_type, $a_mq_id, $a_custom);
522  }
523  else
524  {
525  $this->object->deleteStylePar($cur_tag, $cur_class, $par, $a_type, $a_mq_id, $a_custom);
526  }
527  }
528 
534  {
535  global $tpl, $ilToolbar, $lng, $ilCtrl;
536 
537  // media query selector
538  $mqs = $this->object->getMediaQueries();
539  if (count($mqs) > 0)
540  {
541  //
542  $options = array(
543  "" => $lng->txt("sty_default"),
544  );
545  foreach ($mqs as $mq)
546  {
547  $options[$mq["id"]] = $mq["mquery"];
548  }
549  include_once("./Services/Form/classes/class.ilSelectInputGUI.php");
550  $si = new ilSelectInputGUI("@media", "mq_id");
551  $si->setOptions($options);
552  $si->setValue((int) $_GET["mq_id"]);
553  $ilToolbar->addInputItem($si, true);
554  $ilToolbar->setFormAction($ilCtrl->getFormAction($this));
555  $ilToolbar->addFormButton($lng->txt("sty_switch"), "switchMQuery");
556  }
557 
558  // workaround to include default rte styles
559  //if (in_array($_GET["style_type"], array("rte_menu")))
560  if ($this->super_type == "rte")
561  {
562  $tpl->addCss("Modules/Scorm2004/templates/default/player.css");
563  include_once("./Modules/Scorm2004/classes/ilSCORM13Player.php");
564  $tpl->addInlineCss(ilSCORM13Player::getInlineCss());
565  }
566 
567  $cur = explode(".",$_GET["tag"]);
568  $cur_tag = $cur[0];
569  $cur_class = $cur[1];
570 
571  $this->initTagStyleForm("edit", $cur_tag);
572  $this->getValues();
573  $this->outputTagStyleEditScreen();
574  }
575 
583  {
584  global $ilCtrl;
585 
586  $ilCtrl->setParameter($this, "mq_id", (int) $_POST["mq_id"]);
587  $ilCtrl->redirect($this, "editTagStyle");
588  }
589 
590 
595  {
596  global $tpl, $ilCtrl, $lng;
597 
598  // set style sheet
599  $tpl->setCurrentBlock("ContentStyle");
600  $tpl->setVariable("LOCATION_CONTENT_STYLESHEET",
602 
603  $ts_tpl = new ilTemplate("tpl.style_tag_edit.html", true, true, "Services/Style/Content");
604 
605  $cur = explode(".",$_GET["tag"]);
606  $cur_tag = $cur[0];
607  $cur_class = $cur[1];
608 
609  $ts_tpl->setVariable("EXAMPLE",
610  ilObjStyleSheetGUI::getStyleExampleHTML($_GET["style_type"], $cur_class));
611 
612  $ts_tpl->setVariable("FORM",
613  $this->form_gui->getHtml());
614 
615  $tpl->setTitle($cur_class." (".$lng->txt("sty_type_".$_GET["style_type"]).")");
616 
617  $tpl->setContent($ts_tpl->get());
618  }
619 
620 
626  public function initTagStyleForm($a_mode, $a_cur_tag)
627  {
628  global $lng, $ilCtrl;
629 
630  $ilCtrl->saveParameter($this, array("mq_id"));
631 
632  include_once("Services/Form/classes/class.ilPropertyFormGUI.php");
633  $this->form_gui = new ilPropertyFormGUI();
634 
635  $avail_pars = $this->object->getAvailableParameters();
636  $groups = $this->object->getStyleParameterGroups();
637 
638  // output select lists
639  foreach ($groups as $k => $group)
640  {
641  // filter groups of properties that should only be
642  // displayed with matching tag
643  $filtered_groups = ilObjStyleSheet::_getFilteredGroups();
644  if (is_array($filtered_groups[$k]) && !in_array($a_cur_tag, $filtered_groups[$k]))
645  {
646  continue;
647  }
648 
649  $sh = new ilFormSectionHeaderGUI();
650  $sh->setTitle($lng->txt("sty_".$k));
651  $this->form_gui->addItem($sh);
652 
653  foreach ($group as $par)
654  {
655  $basepar = explode(".", $par);
656  $basepar = $basepar[0];
657 
658  $var = str_replace("-", "_", $basepar);
659  $up_par = strtoupper($var);
660 
662  {
663  case "select":
664  $sel_input = new ilSelectInputGUI($lng->txt("sty_".$var), $basepar);
665  $options = array("" => "");
666  foreach ($avail_pars[$par] as $p)
667  {
668  $options[$p] = $p;
669  }
670  $sel_input->setOptions($options);
671  $this->form_gui->addItem($sel_input);
672  break;
673 
674  case "text":
675  $text_input = new ilTextInputGUI($lng->txt("sty_".$var), $basepar);
676  $text_input->setMaxLength(200);
677  $text_input->setSize(20);
678  $this->form_gui->addItem($text_input);
679  break;
680 
681  case "fontsize":
682  include_once("./Services/Style/Content/classes/class.ilFontSizeInputGUI.php");
683  $fs_input = new ilFontSizeInputGUI($lng->txt("sty_".$var), $basepar);
684  $this->form_gui->addItem($fs_input);
685  break;
686 
687  case "numeric_no_perc":
688  case "numeric":
689  include_once("./Services/Style/Content/classes/class.ilNumericStyleValueInputGUI.php");
690  $num_input = new ilNumericStyleValueInputGUI($lng->txt("sty_".$var), $basepar);
691  if (ilObjStyleSheet::_getStyleParameterInputType($par) == "numeric_no_perc")
692  {
693  $num_input->setAllowPercentage(false);
694  }
695  $this->form_gui->addItem($num_input);
696  break;
697 
698  case "percentage":
699  $per_input = new ilNumberInputGUI($lng->txt("sty_".$var), $basepar);
700  $per_input->setMinValue(0);
701  $per_input->setMaxValue(100);
702  $per_input->setMaxLength(3);
703  $per_input->setSize(3);
704  $this->form_gui->addItem($per_input);
705  break;
706 
707  case "color":
708  //include_once("./Services/Style/classes/class.ilNumericStyleValueInputGUI.php");
709  $col_input = new ilColorPickerInputGUI($lng->txt("sty_".$var), $basepar);
710  $col_input->setDefaultColor("");
711  $col_input->setAcceptNamedColors(true);
712  $this->form_gui->addItem($col_input);
713  break;
714 
715  case "trbl_numeric":
716  include_once("./Services/Style/Content/classes/class.ilTRBLNumericStyleValueInputGUI.php");
717  $num_input = new ilTRBLNumericStyleValueInputGUI($lng->txt("sty_".$var), $basepar);
718  if (ilObjStyleSheet::_getStyleParameterInputType($par) == "trbl_numeric_no_perc")
719  {
720  $num_input->setAllowPercentage(false);
721  }
722  $this->form_gui->addItem($num_input);
723  break;
724 
725  case "border_width":
726  include_once("./Services/Style/Content/classes/class.ilTRBLBorderWidthInputGUI.php");
727  $bw_input = new ilTRBLBorderWidthInputGUI($lng->txt("sty_".$var), $basepar);
728  $this->form_gui->addItem($bw_input);
729  break;
730 
731  case "border_style":
732  include_once("./Services/Style/Content/classes/class.ilTRBLBorderStyleInputGUI.php");
733  $bw_input = new ilTRBLBorderStyleInputGUI($lng->txt("sty_".$var), $basepar);
734  $this->form_gui->addItem($bw_input);
735  break;
736 
737  case "trbl_color":
738  include_once("./Services/Style/Content/classes/class.ilTRBLColorPickerInputGUI.php");
739  $col_input = new ilTRBLColorPickerInputGUI($lng->txt("sty_".$var), $basepar);
740  $col_input->setAcceptNamedColors(true);
741  $this->form_gui->addItem($col_input);
742  break;
743 
744  case "background_image":
745  include_once("./Services/Style/Content/classes/class.ilBackgroundImageInputGUI.php");
746  $im_input = new ilBackgroundImageInputGUI($lng->txt("sty_".$var), $basepar);
747  $imgs = array();
748  foreach ($this->object->getImages() as $entry)
749  {
750  $imgs[] = $entry["entry"];
751  }
752  $im_input->setImages($imgs);
753  $this->form_gui->addItem($im_input);
754  break;
755 
756  case "background_position":
757  include_once("./Services/Style/Content/classes/class.ilBackgroundPositionInputGUI.php");
758  $im_input = new ilBackgroundPositionInputGUI($lng->txt("sty_".$var), $basepar);
759  $this->form_gui->addItem($im_input);
760  break;
761  }
762  }
763  }
764 
765  // custom parameters
766  $sh = new ilFormSectionHeaderGUI();
767  $sh->setTitle($lng->txt("sty_custom"));
768  $this->form_gui->addItem($sh);
769 
770  // custom parameters
771  $ti = new ilTextInputGUI($this->lng->txt("sty_custom_par"), "custom_par");
772  $ti->setMaxLength(300);
773  $ti->setSize(80);
774  $ti->setMulti(true);
775  $ti->setInfo($this->lng->txt("sty_custom_par_info"));
776  $this->form_gui->addItem($ti);
777 
778 
779  // save and cancel commands
780  $this->form_gui->addCommandButton("updateTagStyle", $lng->txt("save_return"));
781  $this->form_gui->addCommandButton("refreshTagStyle", $lng->txt("save_refresh"));
782 
783 // $this->form_gui->setTitle($lng->txt("edit"));
784  $this->form_gui->setFormAction($this->ctrl->getFormAction($this));
785  }
786 
791  public function getValues()
792  {
793  $style = $this->object->getStyle();
794  $cur = explode(".",$_GET["tag"]);
795  $cur_tag = $cur[0];
796  $cur_class = $cur[1];
797  $cur_parameters = $this->extractParametersOfTag($cur_tag, $cur_class, $style, $_GET["style_type"],
798  (int) $_GET["mq_id"], false);
799  $parameters = ilObjStyleSheet::_getStyleParameters();
800  foreach($parameters as $p => $v)
801  {
802  $filtered_groups = ilObjStyleSheet::_getFilteredGroups();
803  if (is_array($filtered_groups[$v["group"]]) && !in_array($cur_tag, $filtered_groups[$v["group"]]))
804  {
805  continue;
806  }
807  $p = explode(".", $p);
808  $p = $p[0];
809  $input = $this->form_gui->getItemByPostVar($p);
810  switch ($v["input"])
811  {
812  case "":
813  break;
814 
815  case "trbl_numeric":
816  case "border_width":
817  case "border_style":
818  case "trbl_color":
819  $input->setAllValue($cur_parameters[$v["subpar"][0]]);
820  $input->setTopValue($cur_parameters[$v["subpar"][1]]);
821  $input->setRightValue($cur_parameters[$v["subpar"][2]]);
822  $input->setBottomValue($cur_parameters[$v["subpar"][3]]);
823  $input->setLeftValue($cur_parameters[$v["subpar"][4]]);
824  break;
825 
826  default:
827  $input->setValue($cur_parameters[$p]);
828  break;
829  }
830  }
831 
832  $cust_parameters = $this->extractParametersOfTag($cur_tag, $cur_class, $style, $_GET["style_type"],
833  (int) $_GET["mq_id"], true);
834  $vals = array();
835  foreach ($cust_parameters as $k => $c)
836  {
837  $vals[] = $k.": ".$c;
838  }
839  $input = $this->form_gui->getItemByPostVar("custom_par");
840  $input->setValue($vals);
841  }
842 
846  function exportStyleObject()
847  {
848  include_once("./Services/Export/classes/class.ilExport.php");
849  $exp = new ilExport();
850  $r = $exp->exportObject($this->object->getType(),$this->object->getId());
851 
852  ilUtil::deliverFile($r["directory"]."/".$r["file"], $r["file"], '', false, true);
853  }
854 
855  function extractParametersOfTag($a_tag, $a_class, $a_style, $a_type, $a_mq_id = 0, $a_custom = false)
856  {
857  $parameters = array();
858  foreach($a_style as $tag)
859  {
860  foreach($tag as $par)
861  {
862  if ($par["tag"] == $a_tag && $par["class"] == $a_class
863  && $par["type"] == $a_type && (int) $a_mq_id == (int) $par["mq_id"]
864  && (int) $a_custom == (int) $par["custom"])
865  {
866  $parameters[$par["parameter"]] = $par["value"];
867  }
868  }
869  }
870  return $parameters;
871  }
872 
877  {
878  $this->object->addParameter($_POST["tag"], $_POST["parameter"]);
879  $this->editObject();
880  }
881 
885  function refreshObject()
886  {
887  $this->object->setTitle($_POST["style_title"]);
888  $this->object->setDescription($_POST["style_description"]);
889 
890  foreach($_POST["styval"] as $id => $value)
891  {
892  $this->object->updateStyleParameter($id, $value);
893  }
894  $this->object->update();
895  $this->editObject();
896  }
897 
903  function deleteObject($a_error = false)
904  {
905  //$this->setTabs();
906 
907  // display confirmation message
908  include_once("./Services/Utilities/classes/class.ilConfirmationGUI.php");
909  $cgui = new ilConfirmationGUI();
910  $cgui->setFormAction($this->ctrl->getFormAction($this));
911  $cgui->setHeaderText($this->lng->txt("info_delete_sure"));
912  $cgui->setCancel($this->lng->txt("cancel"), "cancelDelete");
913  $cgui->setConfirm($this->lng->txt("confirm"), "confirmedDelete");
914 
915  $caption = ilUtil::getImageTagByType("sty", $this->tpl->tplPath).
916  " ".ilObject::_lookupTitle($this->object->getId());
917 
918  $cgui->addItem("id[]", "", $caption);
919 
920  $this->tpl->setContent($cgui->getHTML());
921  }
922 
923 
928  {
929  $this->ctrl->returnToParent($this);
930  }
931 
936  {
937  global $ilias;
938 
939  $this->object->delete();
940 
941  $this->ctrl->returnToParent($this);
942  }
943 
948  {
949  if (is_array($_POST["sty_select"]))
950  {
951  foreach($_POST["sty_select"] as $id => $dummy)
952  {
953  $this->object->deleteParameter($id);
954  }
955  }
956  $this->object->read();
957  $this->object->writeCSSFile();
958  $this->editObject();
959  }
960 
964  function saveObject()
965  {
966  if(!trim($_POST["style_title"]))
967  {
968  $this->ctrl->redirect($this, "create");
969  }
970 
971 //echo "HH"; exit;
972  $class_name = "ilObjStyleSheet";
973  require_once("./Services/Style/Content/classes/class.ilObjStyleSheet.php");
974  $newObj = new ilObjStyleSheet();
975  $newObj->setTitle("-");
976  $newObj->create();
977  $newObj->setTitle(ilUtil::stripSlashes($_POST["style_title"]));
978  $newObj->setDescription(ilUtil::stripSlashes($_POST["style_description"]));
979  $newObj->update();
980 
981  // assign style to style sheet folder,
982  // if parent is style sheet folder
983  if ($_GET["ref_id"] > 0)
984  {
985 
986  $fold = ilObjectFactory::getInstanceByRefId($_GET["ref_id"]);
987  if ($fold->getType() == "stys")
988  {
989  include_once("./Services/Style/Content/classes/class.ilContentStyleSettings.php");
990  $cont_style_settings = new ilContentStyleSettings();
991  $cont_style_settings->addStyle($newObj->getId());
992  $cont_style_settings->update();
993 
994  ilObjStyleSheet::_writeStandard($newObj->getId(), "1");
995  $this->ctrl->returnToParent($this);
996  }
997  }
998 
999  return $newObj->getId();
1000  }
1001 
1005  function copyStyleObject()
1006  {
1007  global $ilias;
1008 
1009  if ($_POST["source_style"] > 0)
1010  $style_obj = $ilias->obj_factory->getInstanceByObjId($_POST["source_style"]);
1011  $new_id = $style_obj->ilClone();
1012 
1013  // assign style to style sheet folder,
1014  // if parent is style sheet folder
1015  if ($_GET["ref_id"] > 0)
1016  {
1017 
1018  $fold = ilObjectFactory::getInstanceByRefId($_GET["ref_id"]);
1019  if ($fold->getType() == "stys")
1020  {
1021  include_once("./Services/Style/Content/classes/class.ilContentStyleSettings.php");
1022  $cont_style_settings = new ilContentStyleSettings();
1023  $cont_style_settings->addStyle($new_id);
1024  $cont_style_settings->update();
1025  ilObjStyleSheet::_writeStandard($new_id, "1");
1026  $this->ctrl->returnToParent($this);
1027  }
1028  }
1029 
1030  return $new_id;
1031  }
1032 
1037  {
1038  // check file
1039  $source = $_FILES["importfile"]["tmp_name"];
1040  if (($source == 'none') || (!$source))
1041  {
1042  $this->ilias->raiseError("No file selected!",$this->ilias->error_obj->MESSAGE);
1043  }
1044 
1045  // check correct file type
1046  $info = pathinfo($_FILES["importfile"]["name"]);
1047  if (strtolower($info["extension"]) != "zip" && strtolower($info["extension"]) != "xml")
1048  {
1049  $this->ilias->raiseError("File must be a zip or xml file!",$this->ilias->error_obj->MESSAGE);
1050  }
1051 
1052  // new import
1053  $fname = explode("_", $_FILES["importfile"]["name"]);
1054  if (strtolower($info["extension"]) == "zip" && $fname[4] == "sty")
1055  {
1056  include_once("./Services/Export/classes/class.ilImport.php");
1057  $imp = new ilImport();
1058  $new_id = $imp->importObject(null, $_FILES["importfile"]["tmp_name"],
1059  $_FILES["importfile"]["name"], "sty");
1060  if ($new_id > 0)
1061  {
1062  $newObj = ilObjectFactory::getInstanceByObjId($new_id);
1063  }
1064  }
1065  else // old import
1066  {
1067  require_once("./Services/Style/Content/classes/class.ilObjStyleSheet.php");
1068  $newObj = new ilObjStyleSheet();
1069  $newObj->import($_FILES["importfile"]);
1070  }
1071 
1072  // assign style to style sheet folder,
1073  // if parent is style sheet folder
1074  if ($_GET["ref_id"] > 0)
1075  {
1076  $fold = ilObjectFactory::getInstanceByRefId($_GET["ref_id"]);
1077  if ($fold->getType() == "stys")
1078  {
1079  include_once("./Services/Style/Content/classes/class.ilContentStyleSettings.php");
1080  $cont_style_settings = new ilContentStyleSettings();
1081  $cont_style_settings->addStyle($newObj->getId());
1082  $cont_style_settings->update();
1083  ilObjStyleSheet::_writeStandard($newObj->getId(), "1");
1084  $this->ctrl->returnToParent($this);
1085  }
1086  }
1087  return $newObj->getId();
1088  }
1089 
1096  function afterImport(ilObject $a_new_obj)
1097  {
1098 
1099  }
1100 
1101 
1105  function cancelObject()
1106  {
1107  global $lng;
1108 
1109  ilUtil::sendInfo($lng->txt("msg_cancel"), true);
1110  $this->ctrl->returnToParent($this);
1111  }
1112 
1116  function getAdminTabs()
1117  {
1118  $this->getTabs();
1119  }
1120 
1124  function setTabs()
1125  {
1126  global $lng;
1127 
1128  $this->getTabs($this->tabs_gui);
1129 
1130  if (strtolower(get_class($this->object)) == "ilobjstylesheet")
1131  {
1132  $this->tpl->setVariable("HEADER", $this->object->getTitle());
1133  }
1134  else
1135  {
1136  $this->tpl->setVariable("HEADER", $lng->txt("create_stylesheet"));
1137  }
1138  }
1139 
1145  function getTabs()
1146  {
1147  global $lng, $ilCtrl, $ilTabs, $ilHelp;
1148 
1149  $ilHelp->setScreenIdComponent("sty");
1150 
1151  if ($ilCtrl->getCmd() == "editTagStyle")
1152  {
1153  // back to upper context
1154  $this->tabs_gui->setBackTarget($lng->txt("back"),
1155  $ilCtrl->getLinkTarget($this, "edit"));
1156 
1157  $t = explode(".", $_GET["tag"]);
1158  $t2 = explode(":", $t[1]);
1159  $pc = $this->object->_getPseudoClasses($t[0]);
1160  if (is_array($pc) && count($pc) > 0)
1161  {
1162  // style classes
1163  $ilCtrl->setParameter($this, "tag", $t[0].".".$t2[0]);
1164  $this->tabs_gui->addTarget("sty_tag_normal",
1165  $this->ctrl->getLinkTarget($this, "editTagStyle"), array("editTagStyle", ""),
1166  get_class($this));
1167  if ($t2[1] == "")
1168  {
1169  $ilTabs->setTabActive("sty_tag_normal");
1170  }
1171 
1172  foreach ($pc as $p)
1173  {
1174  // style classes
1175  $ilCtrl->setParameter($this, "tag", $t[0].".".$t2[0].":".$p);
1176  $this->tabs_gui->addTarget("sty_tag_".$p,
1177  $this->ctrl->getLinkTarget($this, "editTagStyle"), array("editTagStyle", ""),
1178  get_class($this));
1179  if ($t2[1] == $p)
1180  {
1181  $ilTabs->setTabActive("sty_tag_".$p);
1182  }
1183  }
1184  $ilCtrl->setParameter($this, "tag", $_GET["tag"]);
1185  }
1186  }
1187  else
1188  {
1189  // back to upper context
1190  $this->tabs_gui->setBackTarget($lng->txt("back"),
1191  $this->ctrl->getLinkTarget($this, "returnToUpperContext"));
1192 
1193  // style classes
1194  $this->tabs_gui->addTarget("sty_style_chars",
1195  $this->ctrl->getLinkTarget($this, "edit"), array("edit", ""),
1196  get_class($this));
1197 
1198  // colors
1199  $this->tabs_gui->addTarget("sty_colors",
1200  $this->ctrl->getLinkTarget($this, "listColors"), "listColors",
1201  get_class($this));
1202 
1203  // media queries
1204  $this->tabs_gui->addTarget("sty_media_queries",
1205  $this->ctrl->getLinkTarget($this, "listMediaQueries"), "listMediaQueries",
1206  get_class($this));
1207 
1208  // images
1209  $this->tabs_gui->addTarget("sty_images",
1210  $this->ctrl->getLinkTarget($this, "listImages"), "listImages",
1211  get_class($this));
1212 
1213  // table templates
1214  $this->tabs_gui->addTarget("sty_templates",
1215  $this->ctrl->getLinkTarget($this, "listTemplates"), "listTemplates",
1216  get_class($this));
1217 
1218  // settings
1219  $this->tabs_gui->addTarget("settings",
1220  $this->ctrl->getLinkTarget($this, "properties"), "properties",
1221  get_class($this));
1222 
1223  // accordiontest
1224 /*
1225  $this->tabs_gui->addTarget("accordiontest",
1226  $this->ctrl->getLinkTarget($this, "accordiontest"), "accordiontest",
1227  get_class($this));*/
1228  }
1229 
1230  }
1231 
1237  function setSubTabs()
1238  {
1239  global $lng, $ilTabs, $ilCtrl;
1240 
1242 
1243  foreach ($types as $super_type => $types)
1244  {
1245  // text block characteristics
1246  $ilCtrl->setParameter($this, "style_type", $super_type);
1247  $ilTabs->addSubTabTarget("sty_".$super_type."_char",
1248  $this->ctrl->getLinkTarget($this, "edit"), array("edit", ""),
1249  get_class($this));
1250  }
1251 
1252  $ilCtrl->setParameter($this, "style_type", $_GET["style_type"]);
1253  }
1254 
1261  {
1262  global $lng, $ilTabs, $ilCtrl;
1263 
1265 
1266  foreach ($types as $t => $c)
1267  {
1268  $ilCtrl->setParameter($this, "temp_type", $t);
1269  $ilTabs->addSubTabTarget("sty_".$t."_templates",
1270  $this->ctrl->getLinkTarget($this, "listTemplates"), array("listTemplates", ""),
1271  get_class($this));
1272  }
1273 
1274  $ilCtrl->setParameter($this, "temp_type", $_GET["temp_type"]);
1275  }
1276 
1281  function addAdminLocatorItems($a_do_not_add_object = false)
1282  {
1283  global $ilLocator;
1284 
1285  if ($_GET["admin_mode"] == "settings") // system settings
1286  {
1287  parent::addAdminLocatorItems(true);
1288 
1289  $ilLocator->addItem(ilObject::_lookupTitle(
1290  ilObject::_lookupObjId($_GET["ref_id"])),
1291  $this->ctrl->getLinkTargetByClass("ilobjstylesettingsgui", ""));
1292 
1293  if ($_GET["obj_id"] > 0)
1294  {
1295  $ilLocator->addItem($this->object->getTitle(),
1296  $this->ctrl->getLinkTarget($this, "edit"));
1297  }
1298  }
1299  else // repository administration
1300  {
1301  //?
1302  }
1303 
1304  }
1305 
1306  function showUpperIcon()
1307  {
1308  global $tree, $tpl, $objDefinition;
1309 
1310  if (strtolower($_GET["baseClass"]) == "iladministrationgui")
1311  {
1312  $tpl->setUpperIcon(
1313  $this->ctrl->getLinkTargetByClass("ilcontentstylesettings",
1314  "edit"));
1315  }
1316  else
1317  {
1318  // ?
1319  }
1320  }
1321 
1325  function listImagesObject()
1326  {
1327  global $tpl, $ilToolbar, $ilCtrl, $lng, $rbacsystem;
1328 
1329  if ($this->checkWrite())
1330  {
1331  $ilToolbar->addButton($lng->txt("sty_add_image"),
1332  $ilCtrl->getLinkTarget($this, "addImage"));
1333  }
1334 
1335  include_once("./Services/Style/Content/classes/class.ilStyleImageTableGUI.php");
1336  $table_gui = new ilStyleImageTableGUI($this, "listImages",
1337  $this->object);
1338  $tpl->setContent($table_gui->getHTML());
1339 
1340  }
1341 
1345  function addImageObject()
1346  {
1347  global $tpl;
1348 
1349  $this->initImageForm();
1350  $tpl->setContent($this->form_gui->getHTML());
1351  }
1352 
1357  {
1358  global $ilCtrl;
1359 
1360  $ilCtrl->redirect($this, "listImages");
1361  }
1362 
1367  {
1368  global $tpl, $ilCtrl;
1369 
1370  $this->initImageForm();
1371 
1372  if ($this->form_gui->checkInput())
1373  {
1374  $this->object->uploadImage($_FILES["image_file"]);
1375  $ilCtrl->redirect($this, "listImages");
1376  }
1377  else
1378  {
1379  //$this->form_gui->setImageFormValuesByPost();
1380  $tpl->setContent($this->form_gui->getHTML());
1381  }
1382 
1383  }
1384 
1388  function initImageForm()
1389  {
1390  global $lng, $ilCtrl;
1391 
1392  include_once("Services/Form/classes/class.ilPropertyFormGUI.php");
1393  $this->form_gui = new ilPropertyFormGUI();
1394 
1395  $this->form_gui->setTitle($lng->txt("sty_add_image"));
1396 
1397  $file_input = new ilImageFileInputGUI($lng->txt("sty_image_file"), "image_file");
1398  $file_input->setRequired(true);
1399  $this->form_gui->addItem($file_input);
1400 
1401  $this->form_gui->addCommandButton("uploadImage", $lng->txt("upload"));
1402  $this->form_gui->addCommandButton("cancelUpload", $lng->txt("cancel"));
1403  $this->form_gui->setFormAction($ilCtrl->getFormAction($this));
1404  }
1405 
1410  {
1411  global $ilCtrl;
1412 
1413  $images = $this->object->getImages();
1414 
1415  foreach ($images as $image)
1416  {
1417  if (is_array($_POST["file"]) && in_array($image["entry"], $_POST["file"]))
1418  {
1419  $this->object->deleteImage($image["entry"]);
1420  }
1421  }
1422  $ilCtrl->redirect($this, "listImages");
1423  }
1424 
1429  {
1430  global $ilCtrl, $tpl, $lng;
1431 
1432 //var_dump($_POST);
1433 
1434  if (!is_array($_POST["char"]) || count($_POST["char"]) == 0)
1435  {
1436  ilUtil::sendInfo($lng->txt("no_checkbox"), true);
1437  $ilCtrl->redirect($this, "edit");
1438  }
1439  else
1440  {
1441  // check whether there are any core style classes included
1442  $core_styles = ilObjStyleSheet::_getCoreStyles();
1443  foreach ($_POST["char"] as $char)
1444  {
1445  if (!empty($core_styles[$char]))
1446  {
1447  $this->deleteCoreCharMessage();
1448  return;
1449  }
1450  }
1451 
1452  include_once("./Services/Utilities/classes/class.ilConfirmationGUI.php");
1453  $cgui = new ilConfirmationGUI();
1454  $cgui->setFormAction($ilCtrl->getFormAction($this));
1455  $cgui->setHeaderText($lng->txt("sty_confirm_char_deletion"));
1456  $cgui->setCancel($lng->txt("cancel"), "cancelCharacteristicDeletion");
1457  $cgui->setConfirm($lng->txt("delete"), "deleteCharacteristic");
1458 
1459  foreach ($_POST["char"] as $char)
1460  {
1461  $char_comp = explode(".", $char);
1462  $cgui->addItem("char[]", $char, $char_comp[2]);
1463  }
1464 
1465  $tpl->setContent($cgui->getHTML());
1466  }
1467  }
1468 
1476  {
1477  global $ilCtrl, $tpl, $lng;
1478 
1479  include_once("./Services/Utilities/classes/class.ilConfirmationGUI.php");
1480  $cgui = new ilConfirmationGUI();
1481  $cgui->setFormAction($ilCtrl->getFormAction($this));
1482 
1483 
1484  $core_styles = ilObjStyleSheet::_getCoreStyles();
1485  $cnt = 0;
1486  foreach ($_POST["char"] as $char)
1487  {
1488  if (!empty($core_styles[$char]))
1489  {
1490  $cnt++;
1491  $char_comp = explode(".", $char);
1492  $cgui->addItem("", "", $char_comp[2]);
1493  }
1494  else
1495  {
1496  $cgui->addHiddenItem("char[]", $char);
1497  }
1498  }
1499  $all_core_styles = ($cnt == count($_POST["char"]))
1500  ? true
1501  : false;
1502 
1503  if ($all_core_styles)
1504  {
1505  $cgui->setHeaderText($lng->txt("sty_all_styles_obligatory"));
1506  $cgui->setCancel($lng->txt("back"), "cancelCharacteristicDeletion");
1507  }
1508  else
1509  {
1510  $cgui->setHeaderText($lng->txt("sty_some_styles_obligatory_delete_rest"));
1511  $cgui->setCancel($lng->txt("cancel"), "cancelCharacteristicDeletion");
1512  $cgui->setConfirm($lng->txt("sty_delete_other_selected"), "deleteCharacteristicConfirmation");
1513  }
1514 
1515  $tpl->setContent($cgui->getHTML());
1516  }
1517 
1522  {
1523  global $ilCtrl, $lng;
1524 
1525  ilUtil::sendInfo($lng->txt("action_aborted"), true);
1526  $ilCtrl->redirect($this, "edit");
1527  }
1528 
1533  {
1534  global $ilCtrl;
1535 
1536  if (is_array($_POST["char"]))
1537  {
1538  foreach($_POST["char"] as $char)
1539  {
1540  $char_comp = explode(".", $char);
1541  $type = $char_comp[0];
1542  $tag = $char_comp[1];
1543  $class = $char_comp[2];
1544 
1545  $this->object->deleteCharacteristic($type, $tag, $class);
1546  }
1547  }
1548 
1549  $ilCtrl->redirect($this, "edit");
1550  }
1551 
1556  {
1557  global $tpl;
1558 
1559  $this->initCharacteristicForm("create");
1560  $tpl->setContent($this->form_gui->getHTML());
1561  }
1562 
1567  {
1568  global $ilCtrl, $tpl, $lng;
1569 
1570  $this->initCharacteristicForm("create");
1571 
1572  if ($this->form_gui->checkInput())
1573  {
1574  if ($this->object->characteristicExists($_POST["new_characteristic"], $_GET["style_type"]))
1575  {
1576  $char_input = $this->form_gui->getItemByPostVar("new_characteristic");
1577  $char_input->setAlert($lng->txt("sty_characteristic_already_exists"));
1578  }
1579  else
1580  {
1581  $this->object->addCharacteristic($_POST["type"], $_POST["new_characteristic"]);
1582  ilUtil::sendInfo($lng->txt("sty_added_characteristic"), true);
1583  $ilCtrl->setParameter($this, "tag",
1584  ilObjStyleSheet::_determineTag($_POST["type"]).".".$_POST["new_characteristic"]);
1585  $ilCtrl->setParameter($this, "style_type", $_POST["type"]);
1586  $ilCtrl->redirect($this, "editTagStyle");
1587  }
1588  }
1589  $this->form_gui->setValuesByPost();
1590  $tpl->setContent($this->form_gui->getHTML());
1591  }
1592 
1598  public function initCharacteristicForm($a_mode)
1599  {
1600  global $lng, $ilCtrl;
1601 
1602  include_once("Services/Form/classes/class.ilPropertyFormGUI.php");
1603  $this->form_gui = new ilPropertyFormGUI();
1604 
1605  // title
1606  $txt_input = new ilRegExpInputGUI($lng->txt("title"), "new_characteristic");
1607  $txt_input->setPattern("/^[a-zA-Z]+[a-zA-Z0-9]*$/");
1608  $txt_input->setNoMatchMessage($lng->txt("sty_msg_characteristic_must_only_include")." A-Z, a-z, 1-9");
1609  $txt_input->setRequired(true);
1610  $this->form_gui->addItem($txt_input);
1611 
1612  // type
1613  $all_super_types = ilObjStyleSheet::_getStyleSuperTypes();
1614  $types = $all_super_types[$this->super_type];
1615  $exp_types = array();
1616  foreach($types as $t)
1617  {
1619  {
1620  $exp_types[$t] = $lng->txt("sty_type_".$t);
1621  }
1622  }
1623  if (count($exp_types) > 1)
1624  {
1625  $type_input = new ilSelectInputGUI($lng->txt("sty_type"), "type");
1626  $type_input->setOptions($exp_types);
1627  $type_input->setValue(key($exp_types));
1628  $this->form_gui->addItem($type_input);
1629  }
1630  else if (count($exp_types) == 1)
1631  {
1632  $hid_input = new ilHiddenInputGUI("type");
1633  $hid_input->setValue(key($exp_types));
1634  $this->form_gui->addItem($hid_input);
1635  }
1636 
1637  $this->form_gui->setTitle($lng->txt("sty_add_characteristic"));
1638  $this->form_gui->addCommandButton("saveCharacteristic", $lng->txt("save"));
1639  $this->form_gui->addCommandButton("edit", $lng->txt("cancel"));
1640  $this->form_gui->setFormAction($ilCtrl->getFormAction($this));
1641  }
1642 
1646  static function getStyleExampleHTML($a_type, $a_class)
1647  {
1648  global $lng;
1649 
1650  $c = explode(":", $a_class);
1651  $a_class = $c[0];
1652 
1653  $ex_tpl = new ilTemplate("tpl.style_example.html", true, true, "Services/Style/Content");
1654 
1655  if ($ex_tpl->blockExists("Example_".$a_type))
1656  {
1657  $ex_tpl->setCurrentBlock("Example_".$a_type);
1658  }
1659  else
1660  {
1661  $ex_tpl->setCurrentBlock("Example_default");
1662  }
1663  $ex_tpl->setVariable("EX_CLASS", "ilc_".$a_type."_".$a_class);
1664  $ex_tpl->setVariable("EX_TEXT", "ABC abc 123");
1665  if (in_array($a_type, array("media_cont", "qimg")))
1666  {
1667  //
1668  }
1669  if (in_array($a_type, array("table", "table_caption")))
1670  {
1671  $ex_tpl->setVariable("TXT_CAPTION", $lng->txt("sty_caption"));
1672  }
1673  if (in_array($a_class, array("OrderListItemHorizontal", "OrderListHorizontal")))
1674  {
1675  $ex_tpl->setVariable("HOR", "Horizontal");
1676  }
1677  $ex_tpl->parseCurrentBlock();
1678 
1679  return $ex_tpl->get();
1680  }
1681 
1686  {
1687  global $ilCtrl, $lng;
1688 
1689  //var_dump($_POST);
1690 
1691  foreach ($_POST["all_chars"] as $char)
1692  {
1693  $ca = explode(".", $char);
1694  $this->object->saveHideStatus($ca[0], $ca[2],
1695  (is_array($_POST["hide"]) && in_array($char, $_POST["hide"])));
1696  }
1697 
1698  ilUtil::sendInfo($lng->txt("msg_obj_modified"), true);
1699  $ilCtrl->redirect($this, "edit");
1700  }
1701 
1709  {
1710  global $ilCtrl, $lng;
1711 
1712  if (!is_array($_POST["char"]) || count($_POST["char"]) == 0)
1713  {
1714  ilUtil::sendFailure($lng->txt("no_checkbox"), true);
1715  }
1716  else
1717  {
1718  $style_cp = implode("::", $_POST["char"]);
1719  $style_cp = $this->object->getId().":::".$_GET["style_type"].":::".$style_cp;
1720  $_SESSION["sty_copy"] = $style_cp;
1721  ilUtil::sendSuccess($lng->txt("sty_copied_please_select_target"), true);
1722  }
1723  $ilCtrl->redirect($this, "edit");
1724  }
1725 
1733  {
1734  global $tpl, $ilTabs;
1735 
1736  $ilTabs->clearTargets();
1737 
1738  include_once("./Services/Style/Content/classes/class.ilPasteStyleCharacteristicTableGUI.php");
1739  $table = new ilPasteStyleCharacteristicTableGUI($this, "pasteCharacteristicsOverview");
1740 
1741  $tpl->setContent($table->getHTML());
1742  }
1743 
1751  {
1752  global $ilCtrl, $lng;
1753 
1754  if (is_array($_POST["title"]))
1755  {
1756  foreach ($_POST["title"] as $from_char => $to_title)
1757  {
1758  $fc = explode(".", $from_char);
1759 
1760  if ($_POST["conflict_action"][$from_char] == "overwrite" ||
1761  !$this->object->characteristicExists($to_title, $fc[0]))
1762  {
1763  $this->object->copyCharacteristic($_POST["from_style_id"],
1764  $fc[0], $fc[2], $to_title);
1765  }
1766  }
1767  ilObjStyleSheet::_writeUpToDate($this->object->getId(), false);
1768  unset($_SESSION["sty_copy"]);
1769  ilUtil::sendSuccess($lng->txt("sty_style_classes_copied"), true);
1770  }
1771 
1772  $ilCtrl->redirect($this, "edit");
1773  }
1774 
1775  //
1776  // Color management
1777  //
1778 
1782  function listColorsObject()
1783  {
1784  global $tpl, $rbacsystem, $ilToolbar, $ilCtrl;
1785 
1786  if ($this->checkWrite())
1787  {
1788  $ilToolbar->addButton($this->lng->txt("sty_add_color"),
1789  $ilCtrl->getLinkTarget($this, "addColor"));
1790  }
1791 
1792  include_once("./Services/Style/Content/classes/class.ilStyleColorTableGUI.php");
1793  $table_gui = new ilStyleColorTableGUI($this, "listColors",
1794  $this->object);
1795  $tpl->setContent($table_gui->getHTML());
1796 
1797  }
1798 
1802  function addColorObject()
1803  {
1804  global $tpl;
1805 
1806  $this->initColorForm();
1807  $tpl->setContent($this->form_gui->getHTML());
1808  }
1809 
1813  function editColorObject()
1814  {
1815  global $tpl, $ilCtrl;
1816 
1817  $ilCtrl->setParameter($this, "c_name", $_GET["c_name"]);
1818  $this->initColorForm("edit");
1819  $this->getColorFormValues();
1820  $tpl->setContent($this->form_gui->getHTML());
1821  }
1822 
1823 
1827  function initColorForm($a_mode = "create")
1828  {
1829  global $lng, $ilCtrl;
1830 
1831  include_once("Services/Form/classes/class.ilPropertyFormGUI.php");
1832  $this->form_gui = new ilPropertyFormGUI();
1833 
1834  $this->form_gui->setTitle($lng->txt("sty_add_color"));
1835 
1836  // name
1837  $name_input = new ilRegExpInputGUI($lng->txt("sty_color_name"), "color_name");
1838  $name_input->setPattern("/^[a-zA-Z]+[a-zA-Z0-9]*$/");
1839  $name_input->setNoMatchMessage($lng->txt("sty_msg_color_must_only_include")." A-Z, a-z, 1-9");
1840  $name_input->setRequired(true);
1841  $name_input->setSize(15);
1842  $name_input->setMaxLength(15);
1843  $this->form_gui->addItem($name_input);
1844 
1845  // code
1846  $color_input = new ilColorPickerInputGUI($lng->txt("sty_color_code"), "color_code");
1847  $color_input->setRequired(true);
1848  $color_input->setDefaultColor("");
1849  $this->form_gui->addItem($color_input);
1850 
1851  if ($a_mode == "create")
1852  {
1853  $this->form_gui->addCommandButton("saveColor", $lng->txt("save"));
1854  $this->form_gui->addCommandButton("cancelColorSaving", $lng->txt("cancel"));
1855  }
1856  else
1857  {
1858  $this->form_gui->addCommandButton("updateColor", $lng->txt("save"));
1859  $this->form_gui->addCommandButton("cancelColorSaving", $lng->txt("cancel"));
1860  }
1861  $this->form_gui->setFormAction($ilCtrl->getFormAction($this));
1862  }
1863 
1868  {
1869  if ($_GET["c_name"] != "")
1870  {
1871  $values["color_name"] = $_GET["c_name"];
1872  $values["color_code"] = $this->object->getColorCodeForName($_GET["c_name"]);
1873  $this->form_gui->setValuesByArray($values);
1874  }
1875  }
1876 
1881  {
1882  global $ilCtrl;
1883 
1884  $ilCtrl->redirect($this, "listColors");
1885  }
1886 
1890  function saveColorObject()
1891  {
1892  global $tpl, $ilCtrl, $lng;
1893 
1894  $this->initColorForm();
1895 
1896  if ($this->form_gui->checkInput())
1897  {
1898  if ($this->object->colorExists($_POST["color_name"]))
1899  {
1900  $col_input = $this->form_gui->getItemByPostVar("color_name");
1901  $col_input->setAlert($lng->txt("sty_color_already_exists"));
1902  }
1903  else
1904  {
1905  $this->object->addColor($_POST["color_name"],
1906  $_POST["color_code"]);
1907  $ilCtrl->redirect($this, "listColors");
1908  }
1909  }
1910  $this->form_gui->setValuesByPost();
1911  $tpl->setContent($this->form_gui->getHTML());
1912  }
1913 
1918  {
1919  global $tpl, $ilCtrl, $lng;
1920 
1921  $this->initColorForm("edit");
1922 
1923  if ($this->form_gui->checkInput())
1924  {
1925  if ($this->object->colorExists($_POST["color_name"]) &&
1926  $_POST["color_name"] != $_GET["c_name"])
1927  {
1928  $col_input = $this->form_gui->getItemByPostVar("color_name");
1929  $col_input->setAlert($lng->txt("sty_color_already_exists"));
1930  }
1931  else
1932  {
1933  $this->object->updateColor($_GET["c_name"], $_POST["color_name"],
1934  $_POST["color_code"]);
1935  $ilCtrl->redirect($this, "listColors");
1936  }
1937  }
1938  $ilCtrl->setParameter($this, "c_name", $_GET["c_name"]);
1939  $this->form_gui->setValuesByPost();
1940  $tpl->setContent($this->form_gui->getHTML());
1941  }
1942 
1947  {
1948  global $ilCtrl, $tpl, $lng;
1949 
1950  if (!is_array($_POST["color"]) || count($_POST["color"]) == 0)
1951  {
1952  ilUtil::sendInfo($lng->txt("no_checkbox"), true);
1953  $ilCtrl->redirect($this, "listColors");
1954  }
1955  else
1956  {
1957  include_once("./Services/Utilities/classes/class.ilConfirmationGUI.php");
1958  $cgui = new ilConfirmationGUI();
1959  $cgui->setFormAction($ilCtrl->getFormAction($this));
1960  $cgui->setHeaderText($lng->txt("sty_confirm_color_deletion"));
1961  $cgui->setCancel($lng->txt("cancel"), "cancelColorDeletion");
1962  $cgui->setConfirm($lng->txt("delete"), "deleteColor");
1963 
1964  foreach ($_POST["color"] as $c)
1965  {
1966  $cgui->addItem("color[]", ilUtil::prepareFormOutput($c), $c);
1967  }
1968 
1969  $tpl->setContent($cgui->getHTML());
1970  }
1971  }
1972 
1977  {
1978  global $ilCtrl;
1979 
1980  $ilCtrl->redirect($this, "listColors");
1981  }
1982 
1987  {
1988  global $ilCtrl;
1989 
1990  if (is_array($_POST["color"]))
1991  {
1992  foreach ($_POST["color"] as $c)
1993  {
1994  $this->object->removeColor($c);
1995  }
1996  }
1997 
1998  $ilCtrl->redirect($this, "listColors");
1999  }
2000 
2001  //
2002  // Media query management
2003  //
2004 
2009  {
2010  global $tpl, $rbacsystem, $ilToolbar, $ilCtrl;
2011 
2012  if ($this->checkWrite())
2013  {
2014  $ilToolbar->addButton($this->lng->txt("sty_add_media_query"),
2015  $ilCtrl->getLinkTarget($this, "addMediaQuery"));
2016  }
2017 
2018  include_once("./Services/Style/Content/classes/class.ilStyleMediaQueryTableGUI.php");
2019  $table_gui = new ilStyleMediaQueryTableGUI($this, "listMediaQueries",
2020  $this->object);
2021  $tpl->setContent($table_gui->getHTML());
2022  }
2023 
2028  {
2029  global $tpl;
2030 
2031  $this->initMediaQueryForm();
2032  $tpl->setContent($this->form_gui->getHTML());
2033  }
2034 
2039  {
2040  global $tpl, $ilCtrl;
2041 
2042  $ilCtrl->setParameter($this, "mq_id", $_GET["mq_id"]);
2043  $this->initMediaQueryForm("edit");
2044  $this->getMediaQueryFormValues();
2045  $tpl->setContent($this->form_gui->getHTML());
2046  }
2047 
2048 
2052  function initMediaQueryForm($a_mode = "create")
2053  {
2054  global $lng, $ilCtrl;
2055 
2056  include_once("Services/Form/classes/class.ilPropertyFormGUI.php");
2057  $this->form_gui = new ilPropertyFormGUI();
2058 
2059  $this->form_gui->setTitle($lng->txt("sty_add_media_query"));
2060 
2061  // media query
2062  $ti = new ilTextInputGUI("@media", "mquery");
2063  $ti->setMaxLength(2000);
2064  $this->form_gui->addItem($ti);
2065 
2066 
2067  if ($a_mode == "create")
2068  {
2069  $this->form_gui->addCommandButton("saveMediaQuery", $lng->txt("save"));
2070  $this->form_gui->addCommandButton("listMediaQueries", $lng->txt("cancel"));
2071  }
2072  else
2073  {
2074  $this->form_gui->addCommandButton("updateMediaQuery", $lng->txt("save"));
2075  $this->form_gui->addCommandButton("listMediaQueries", $lng->txt("cancel"));
2076  }
2077  $this->form_gui->setFormAction($ilCtrl->getFormAction($this));
2078  }
2079 
2084  {
2085  if ($_GET["mq_id"] != "")
2086  {
2087  foreach ($this->object->getMediaQueries() as $mq)
2088  {
2089  if ($mq["id"] == (int) $_GET["mq_id"])
2090  {
2091  $values["mquery"] = $mq["mquery"];
2092  }
2093  }
2094  $this->form_gui->setValuesByArray($values);
2095  }
2096  }
2097 
2102  {
2103  global $tpl, $ilCtrl, $lng;
2104 
2105  $this->initMediaQueryForm();
2106 
2107  if ($this->form_gui->checkInput())
2108  {
2109  $this->object->addMediaQuery($_POST["mquery"]);
2110  $ilCtrl->redirect($this, "listMediaQueries");
2111  }
2112  $this->form_gui->setValuesByPost();
2113  $tpl->setContent($this->form_gui->getHTML());
2114  }
2115 
2120  {
2121  global $tpl, $ilCtrl, $lng;
2122 
2123  $this->initMediaQueryForm("edit");
2124 
2125  if ($this->form_gui->checkInput())
2126  {
2127  $this->object->updateMediaQuery((int) $_GET["mq_id"], $_POST["mquery"]);
2128  $ilCtrl->redirect($this, "listMediaQueries");
2129  }
2130  $ilCtrl->setParameter($this, "mq_id", $_GET["mq_id"]);
2131  $this->form_gui->setValuesByPost();
2132  $tpl->setContent($this->form_gui->getHTML());
2133  }
2134 
2139  {
2140  global $ilCtrl, $tpl, $lng;
2141 
2142  if (!is_array($_POST["mq_id"]) || count($_POST["mq_id"]) == 0)
2143  {
2144  ilUtil::sendInfo($lng->txt("no_checkbox"), true);
2145  $ilCtrl->redirect($this, "listMediaQueries");
2146  }
2147  else
2148  {
2149  include_once("./Services/Utilities/classes/class.ilConfirmationGUI.php");
2150  $cgui = new ilConfirmationGUI();
2151  $cgui->setFormAction($ilCtrl->getFormAction($this));
2152  $cgui->setHeaderText($lng->txt("sty_sure_del_mqueries"));
2153  $cgui->setCancel($lng->txt("cancel"), "listMediaQueries");
2154  $cgui->setConfirm($lng->txt("delete"), "deleteMediaQueries");
2155 
2156  foreach ($_POST["mq_id"] as $i)
2157  {
2158  $mq = $this->object->getMediaQueryForId($i);
2159  $cgui->addItem("mq_id[]", $i, $mq["mquery"]);
2160  }
2161 
2162  $tpl->setContent($cgui->getHTML());
2163  }
2164  }
2165 
2173  {
2174  global $ilCtrl, $rbacsystem;
2175 
2176  if ($this->checkWrite() && is_array($_POST["mq_id"]))
2177  {
2178  foreach ($_POST["mq_id"] as $id)
2179  {
2180  $this->object->deleteMediaQuery($id);
2181  }
2182  }
2183  $ilCtrl->redirect($this, "listMediaQueries");
2184  }
2185 
2193  {
2194  global $ilCtrl;
2195 
2196  if (is_array($_POST["order"]))
2197  {
2198  $this->object->saveMediaQueryOrder($_POST["order"]);
2199  }
2200  $ilCtrl->redirect($this, "listMediaQueries");
2201  }
2202 
2203 
2204  //
2205  // Templates management
2206  //
2207 
2212  {
2213  global $tpl, $ilTabs, $ilCtrl;
2214 
2215  $ctype = $_GET["temp_type"];
2216  if ($ctype == "")
2217  {
2218  $ctype = "table";
2219  $ilCtrl->setParameter($this, "temp_type", $ctype);
2220  $_GET["temp_type"] = $ctype;
2221  }
2222 
2223  $this->setTemplatesSubTabs();
2224  $ilTabs->setSubTabActive("sty_".$ctype."_templates");
2225 
2226  $this->includeCSS();
2227  include_once("./Services/Style/Content/classes/class.ilTableTemplatesTableGUI.php");
2228  $table_gui = new ilTableTemplatesTableGUI($ctype, $this, "listTemplates",
2229  $this->object);
2230  $tpl->setContent($table_gui->getHTML());
2231 
2232  }
2233 
2238  {
2239  global $tpl;
2240 
2241  $this->initTemplateForm();
2242  $tpl->setContent($this->form_gui->getHTML());
2243  }
2244 
2249  {
2250  global $tpl, $ilCtrl;
2251 
2252  $ilCtrl->setParameter($this, "t_id", $_GET["t_id"]);
2253  $this->initTemplateForm("edit");
2254  $this->getTemplateFormValues();
2255 
2256  $this->displayTemplateEditForm();
2257  }
2258 
2262  function getTemplatePreview($a_type, $a_t_id, $a_small_mode = false)
2263  {
2264  return $this->_getTemplatePreview(
2265  $this->object, $a_type, $a_t_id, $a_small_mode);
2266  }
2267 
2271  static function _getTemplatePreview($a_style, $a_type, $a_t_id, $a_small_mode = false)
2272  {
2273  global $lng, $tpl;
2274 
2275  $kr = $kc = 7;
2276  if ($a_small_mode)
2277  {
2278  $kr = 6;
2279  $kc = 5;
2280  }
2281 
2282  $ts = $a_style->getTemplate($a_t_id);
2283  $t = $ts["classes"];
2284 
2285  // preview
2286  if ($a_type == "table")
2287  {
2288  $p_content = '<PageContent><Table DataTable="y"';
2289  if ($t["row_head"] != "")
2290  {
2291  $p_content.= ' HeaderRows="1"';
2292  }
2293  if ($t["row_foot"] != "")
2294  {
2295  $p_content.= ' FooterRows="1"';
2296  }
2297  if ($t["col_head"] != "")
2298  {
2299  $p_content.= ' HeaderCols="1"';
2300  }
2301  if ($t["col_foot"] != "")
2302  {
2303  $p_content.= ' FooterCols="1"';
2304  }
2305  $p_content.= ' Template="'.$a_style->lookupTemplateName($a_t_id).'">';
2306  if (!$a_small_mode)
2307  {
2308  $p_content.= '<Caption>'.$lng->txt("sty_caption").'</Caption>';
2309  }
2310  for($i = 1; $i<=$kr; $i++)
2311  {
2312  $p_content.= '<TableRow>';
2313  for($j = 1; $j<=$kc; $j++)
2314  {
2315  if ($a_small_mode)
2316  {
2317  $cell = '&lt;div style="height:2px;"&gt;&lt;/div&gt;';
2318  }
2319  else
2320  {
2321  $cell = 'xxx';
2322  }
2323  $p_content.= '<TableData><PageContent><Paragraph Characteristic="TableContent">'.$cell.'</Paragraph></PageContent></TableData>';
2324  }
2325  $p_content.= '</TableRow>';
2326  }
2327  $p_content.= '</Table></PageContent>';
2328  }
2329 
2330  if ($a_type == "vaccordion" || $a_type == "haccordion" || $a_type == "carousel")
2331  {
2332  include_once("./Services/Accordion/classes/class.ilAccordionGUI.php");
2334 
2335  if ($a_small_mode)
2336  {
2337  $c = '&amp;nbsp;';
2338  $h = '&amp;nbsp;';
2339  }
2340  else
2341  {
2342  $c = 'xxx';
2343  $h = 'head';
2344  }
2345  if ($a_type == "vaccordion")
2346  {
2347  $p_content = '<PageContent><Tabs HorizontalAlign="Left" Type="VerticalAccordion" ';
2348  if ($a_small_mode)
2349  {
2350  $p_content.= ' ContentWidth="70"';
2351  }
2352  }
2353  else if ($a_type == "haccordion")
2354  {
2355  $p_content = '<PageContent><Tabs Type="HorizontalAccordion"';
2356  if ($a_small_mode)
2357  {
2358  $p_content.= ' ContentHeight="40"';
2359  $p_content.= ' ContentWidth="70"';
2360  $c = '&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;';
2361  }
2362  else
2363  {
2364  $p_content.= ' ContentHeight="40"';
2365  }
2366  }
2367  else if ($a_type == "carousel")
2368  {
2369  $p_content = '<PageContent><Tabs HorizontalAlign="Left" Type="Carousel" ';
2370  if ($a_small_mode)
2371  {
2372  $p_content.= ' ContentWidth="70"';
2373  }
2374  }
2375 
2376 
2377  $p_content.= ' Template="'.$a_style->lookupTemplateName($a_t_id).'">';
2378  $p_content.= '<Tab><PageContent><Paragraph>'.$c.'</Paragraph></PageContent>';
2379  $p_content.= '<TabCaption>'.$h.'</TabCaption>';
2380  $p_content.= '</Tab>';
2381  $p_content.= '</Tabs></PageContent>';
2382  }
2383 //echo htmlentities($p_content);
2384  $txml = $a_style->getTemplateXML();
2385 //echo htmlentities($txml); exit;
2386  $p_content.= $txml;
2387  include_once("./Services/COPage/classes/class.ilPCTableGUI.php");
2388  $r_content = ilPCTableGUI::_renderTable($p_content, "");
2389 
2390  // fix carousel template visibility
2391  if($a_type == "carousel")
2392  {
2393  $r_content.= "<style>.owl-carousel{ display:block !important; }</style>";
2394  }
2395 
2396 //echo htmlentities($r_content); exit;
2397  return $r_content;
2398  }
2399 
2403  function initTemplateForm($a_mode = "create")
2404  {
2405  global $lng, $ilCtrl;
2406 
2407  include_once("Services/Form/classes/class.ilPropertyFormGUI.php");
2408  $this->form_gui = new ilPropertyFormGUI();
2409 
2410  if ($a_mode == "create")
2411  {
2412  $this->form_gui->setTitle($lng->txt("sty_add_template"));
2413  }
2414  else
2415  {
2416  $this->form_gui->setTitle($lng->txt("sty_edit_template"));
2417  }
2418 
2419  // name
2420  $name_input = new ilRegExpInputGUI($lng->txt("sty_template_name"), "name");
2421  $name_input->setPattern("/^[a-zA-Z]+[a-zA-Z0-9]*$/");
2422  $name_input->setNoMatchMessage($lng->txt("sty_msg_color_must_only_include")." A-Z, a-z, 1-9");
2423  $name_input->setRequired(true);
2424  $name_input->setSize(30);
2425  $name_input->setMaxLength(30);
2426  $this->form_gui->addItem($name_input);
2427 
2428  // template style classes
2429  $scs = ilObjStyleSheet::_getTemplateClassTypes($_GET["temp_type"]);
2430  foreach ($scs as $sc => $st)
2431  {
2432  $sc_input = new ilSelectInputGUI($lng->txt("sty_".$sc."_class"), $sc."_class");
2433  $chars = $this->object->getCharacteristics($st);
2434  $options = array("" => "");
2435  foreach($chars as $char)
2436  {
2437  $options[$char] = $char;
2438  }
2439  $sc_input->setOptions($options);
2440  $this->form_gui->addItem($sc_input);
2441  }
2442 
2443  if ($a_mode == "create")
2444  {
2445  $this->form_gui->addCommandButton("saveTemplate", $lng->txt("save"));
2446  $this->form_gui->addCommandButton("cancelTemplateSaving", $lng->txt("cancel"));
2447  }
2448  else
2449  {
2450  $this->form_gui->addCommandButton("refreshTemplate", $lng->txt("save_refresh"));
2451  $this->form_gui->addCommandButton("updateTemplate", $lng->txt("save_return"));
2452  $this->form_gui->addCommandButton("cancelTemplateSaving", $lng->txt("cancel"));
2453  }
2454  $this->form_gui->setFormAction($ilCtrl->getFormAction($this));
2455  }
2456 
2461  {
2462  global $ilCtrl;
2463 
2464  $ilCtrl->redirect($this, "listTemplates");
2465  }
2466 
2467 
2472  {
2473  global $tpl, $ilCtrl, $lng;
2474 
2475  $this->initTemplateForm();
2476 
2477  if ($this->form_gui->checkInput())
2478  {
2479  if ($this->object->templateExists($_POST["name"]))
2480  {
2481  $name_input = $this->form_gui->getItemByPostVar("name");
2482  $name_input->setAlert($lng->txt("sty_table_template_already_exists"));
2483  }
2484  else
2485  {
2486  $classes = array();
2487  foreach (ilObjStyleSheet::_getTemplateClassTypes($_GET["temp_type"]) as $tct => $ct)
2488  {
2489  $classes[$tct] = $_POST[$tct."_class"];
2490  }
2491  $t_id = $this->object->addTemplate($_GET["temp_type"], $_POST["name"], $classes);
2492  $this->object->writeTemplatePreview($t_id,
2493  $this->getTemplatePreview($_GET["temp_type"], $t_id, true));
2494  $ilCtrl->redirect($this, "listTemplates");
2495  }
2496  }
2497  $this->form_gui->setValuesByPost();
2498  $tpl->setContent($this->form_gui->getHTML());
2499  }
2500 
2504  function updateTemplateObject($a_refresh = false)
2505  {
2506  global $tpl, $ilCtrl, $lng;
2507 
2508  $ilCtrl->setParameter($this, "t_id", $_GET["t_id"]);
2509  $this->initTemplateForm("edit");
2510 
2511  if ($this->form_gui->checkInput())
2512  {
2513  if ($this->object->templateExists($_POST["name"]) &&
2515  {
2516  $name_input = $this->form_gui->getItemByPostVar("name");
2517  $name_input->setAlert($lng->txt("sty_template_already_exists"));
2518  }
2519  else
2520  {
2521  $classes = array();
2522  foreach (ilObjStyleSheet::_getTemplateClassTypes($_GET["temp_type"]) as $tct => $ct)
2523  {
2524  $classes[$tct] = $_POST[$tct."_class"];
2525  }
2526 
2527  $this->object->updateTemplate($_GET["t_id"],
2528  $_POST["name"], $classes);
2529  $this->object->writeTemplatePreview($_GET["t_id"],
2530  $this->getTemplatePreview($_GET["temp_type"], $_GET["t_id"], true));
2531  if(!$a_refresh)
2532  {
2533  $ilCtrl->redirect($this, "listTemplates");
2534  }
2535  }
2536  }
2537 
2538  $this->form_gui->setValuesByPost();
2539  $this->displayTemplateEditForm();
2540  }
2541 
2546  {
2547  global $tpl;
2548 
2549  $a_tpl = new ilTemplate("tpl.template_edit.html", true, true,
2550  "Services/Style/Content");
2551  $this->includeCSS();
2552  $a_tpl->setVariable("FORM", $this->form_gui->getHTML());
2553  $a_tpl->setVariable("PREVIEW", $this->getTemplatePreview($_GET["temp_type"], $_GET["t_id"]));
2554  $tpl->setContent($a_tpl->get());
2555  }
2556 
2561  {
2562  $this->updateTemplateObject(true);
2563  }
2564 
2569  {
2570  if ($_GET["t_id"] > 0)
2571  {
2572  $t = $this->object->getTemplate($_GET["t_id"]);
2573 
2574  $values["name"] = $t["name"];
2575  $scs = ilObjStyleSheet::_getTemplateClassTypes($_GET["temp_type"]);
2576  foreach ($scs as $k => $type)
2577  {
2578  $values[$k."_class"] = $t["classes"][$k];
2579  }
2580  $this->form_gui->setValuesByArray($values);
2581  }
2582  }
2583 
2588  {
2589  global $ilCtrl, $tpl, $lng;
2590 
2591  if (!is_array($_POST["tid"]) || count($_POST["tid"]) == 0)
2592  {
2593  ilUtil::sendInfo($lng->txt("no_checkbox"), true);
2594  $ilCtrl->redirect($this, "listTemplates");
2595  }
2596  else
2597  {
2598  include_once("./Services/Utilities/classes/class.ilConfirmationGUI.php");
2599  $cgui = new ilConfirmationGUI();
2600  $cgui->setFormAction($ilCtrl->getFormAction($this));
2601  $cgui->setHeaderText($lng->txt("sty_confirm_template_deletion"));
2602  $cgui->setCancel($lng->txt("cancel"), "cancelTemplateDeletion");
2603  $cgui->setConfirm($lng->txt("sty_del_template"), "deleteTemplate");
2604 
2605  foreach ($_POST["tid"] as $tid)
2606  {
2607  $classes = $this->object->getTemplateClasses($tid);
2608  $cl_str = "";
2609  $listed = array();
2610  foreach ($classes as $cl)
2611  {
2612  if ($cl != "" && !$listed[$cl])
2613  {
2614  $cl_str.= '<div>- '.
2615  $cl."</div>";
2616  $listed[$cl] = true;
2617  }
2618  }
2619  if ($cl_str != "")
2620  {
2621  $cl_str = '<div style="padding-left:30px;" class="small">'.
2622  "<div><i>".$lng->txt("sty_style_class")."</i></div>".$cl_str."</div>";
2623  }
2624  $cgui->addItem("tid[]", $tid, $this->object->lookupTemplateName($tid).$cl_str);
2625  }
2626 
2627  $cgui->addButton($lng->txt("sty_del_template_keep_classes"), "deleteTemplateKeepClasses");
2628 
2629  $tpl->setContent($cgui->getHTML());
2630  }
2631  }
2632 
2637  {
2638  global $ilCtrl;
2639 
2640  $ilCtrl->redirect($this, "listTemplates");
2641  }
2642 
2647  {
2648  global $ilCtrl;
2649 
2650  if (is_array($_POST["tid"]))
2651  {
2652  foreach ($_POST["tid"] as $tid)
2653  {
2654  $this->object->removeTemplate($tid);
2655  }
2656  }
2657 
2658  $ilCtrl->redirect($this, "listTemplates");
2659  }
2660 
2665  {
2666  global $ilCtrl;
2667 
2668  if (is_array($_POST["tid"]))
2669  {
2670  foreach ($_POST["tid"] as $tid)
2671  {
2672  $cls = $this->object->getTemplateClasses($tid);
2673  foreach ($cls as $k => $cls)
2674  {
2675  $ty = $this->object->determineTemplateStyleClassType($_GET["temp_type"], $k);
2676  $ta = ilObjStyleSheet::_determineTag($ty);
2677  $this->object->deleteCharacteristic($ty, $ta, $cls);
2678  }
2679  $this->object->removeTemplate($tid);
2680  }
2681  }
2682 
2683  $ilCtrl->redirect($this, "listTemplates");
2684  }
2685 
2690  {
2691  global $tpl;
2692 
2693  $this->initTemplateGenerationForm();
2694  $tpl->setContent($this->form_gui->getHTML());
2695  }
2696 
2701  {
2702  global $lng, $ilCtrl;
2703 
2704  include_once("Services/Form/classes/class.ilPropertyFormGUI.php");
2705  $this->form_gui = new ilPropertyFormGUI();
2706 
2707  $this->form_gui->setTitle($lng->txt("sty_generate_template"));
2708 
2709  // name
2710  $name_input = new ilRegExpInputGUI($lng->txt("sty_template_name"), "name");
2711  $name_input->setPattern("/^[a-zA-Z]+[a-zA-Z0-9]*$/");
2712  $name_input->setNoMatchMessage($lng->txt("sty_msg_color_must_only_include")." A-Z, a-z, 1-9");
2713  $name_input->setRequired(true);
2714  $name_input->setSize(30);
2715  $name_input->setMaxLength(30);
2716  $this->form_gui->addItem($name_input);
2717 
2718  // basic layout
2719  $bl_input = new ilSelectInputGUI($lng->txt("sty_template_layout"), "layout");
2720  $options = array(
2721  "coloredZebra" => $lng->txt("sty_table_template_colored_zebra"),
2722  "bwZebra" => $lng->txt("sty_table_template_bw_zebra"),
2723  "noZebra" => $lng->txt("sty_table_template_no_zebra")
2724  );
2725  $bl_input->setOptions($options);
2726  $this->form_gui->addItem($bl_input);
2727 
2728  // top bottom padding
2729  include_once("./Services/Style/Content/classes/class.ilNumericStyleValueInputGUI.php");
2730  $num_input = new ilNumericStyleValueInputGUI($lng->txt("sty_top_bottom_padding"), "tb_padding");
2731  $num_input->setAllowPercentage(false);
2732  $num_input->setValue("3px");
2733  $this->form_gui->addItem($num_input);
2734 
2735  // left right padding
2736  $num_input = new ilNumericStyleValueInputGUI($lng->txt("sty_left_right_padding"), "lr_padding");
2737  $num_input->setAllowPercentage(false);
2738  $num_input->setValue("10px");
2739  $this->form_gui->addItem($num_input);
2740 
2741  // base color
2742  $bc_input = new ilSelectInputGUI($lng->txt("sty_base_color"), "base_color");
2743  $cs = $this->object->getColors();
2744  $options = array();
2745  foreach ($cs as $c)
2746  {
2747  $options[$c["name"]] = $c["name"];
2748  }
2749  $bc_input->setOptions($options);
2750  $this->form_gui->addItem($bc_input);
2751 
2752  // Lightness Settings
2753  $lss = array("border" => 90, "header_text" => 70, "header_bg" => 0,
2754  "cell1_text" => -60, "cell1_bg" => 90, "cell2_text" => -60, "cell2_bg" => 75);
2755  foreach ($lss as $ls => $v)
2756  {
2757  $l_input = new ilNumberInputGUI($lng->txt("sty_lightness_".$ls), "lightness_".$ls);
2758  $l_input->setMaxValue(100);
2759  $l_input->setMinValue(-100);
2760  $l_input->setValue($v);
2761  $l_input->setSize(4);
2762  $l_input->setMaxLength(4);
2763  $this->form_gui->addItem($l_input);
2764  }
2765 
2766  $this->form_gui->addCommandButton("templateGeneration", $lng->txt("generate"));
2767  $this->form_gui->addCommandButton("cancelTemplateSaving", $lng->txt("cancel"));
2768  $this->form_gui->setFormAction($ilCtrl->getFormAction($this));
2769  }
2770 
2775  {
2776  global $tpl, $ilCtrl, $lng;
2777 
2778  $this->initTemplateGenerationForm();
2779 
2780  if ($this->form_gui->checkInput())
2781  {
2782  if ($this->object->templateExists($_POST["name"]))
2783  {
2784  $name_input = $this->form_gui->getItemByPostVar("name");
2785  $name_input->setAlert($lng->txt("sty_table_template_already_exists"));
2786  }
2787  else
2788  {
2789  // -> move to application class!
2790 
2791  // cell classes
2792  $cells = array("H" => "header", "C1" => "cell1", "C2" => "cell2");
2793  $tb_p = $this->form_gui->getItemByPostVar("tb_padding");
2794  $tb_padding = $tb_p->getValue();
2795  $lr_p = $this->form_gui->getItemByPostVar("lr_padding");
2796  $lr_padding = $lr_p->getValue();
2797  $cell_color = $_POST["base_color"];
2798 
2799  // use mid gray as cell color for bw zebra
2800  if ($_POST["layout"] == "bwZebra")
2801  {
2802  $cell_color = "MidGray";
2803  if (!$this->object->colorExists($cell_color))
2804  {
2805  $this->object->addColor($cell_color, "7F7F7F");
2806  }
2807  $this->object->updateColor($cell_color, $cell_color, "7F7F7F");
2808  }
2809 
2810  foreach ($cells as $k => $cell)
2811  {
2812  $cell_class[$k] = $_POST["name"].$k;
2813  if (!$this->object->characteristicExists($cell_class[$k], "table_cell"))
2814  {
2815  $this->object->addCharacteristic("table_cell", $cell_class[$k], true);
2816  }
2817  if ($_POST["layout"] == "bwZebra" && $k == "H")
2818  {
2819  $this->object->replaceStylePar("td", $cell_class[$k], "color",
2820  "!".$_POST["base_color"]."(".$_POST["lightness_".$cell."_text"].")", "table_cell");
2821  $this->object->replaceStylePar("td", $cell_class[$k], "background-color",
2822  "!".$_POST["base_color"]."(".$_POST["lightness_".$cell."_bg"].")", "table_cell");
2823  }
2824  else
2825  {
2826  $this->object->replaceStylePar("td", $cell_class[$k], "color",
2827  "!".$cell_color."(".$_POST["lightness_".$cell."_text"].")", "table_cell");
2828  $this->object->replaceStylePar("td", $cell_class[$k], "background-color",
2829  "!".$cell_color."(".$_POST["lightness_".$cell."_bg"].")", "table_cell");
2830  }
2831  $this->object->replaceStylePar("td", $cell_class[$k], "padding-top",
2832  $tb_padding, "table_cell");
2833  $this->object->replaceStylePar("td", $cell_class[$k], "padding-bottom",
2834  $tb_padding, "table_cell");
2835  $this->object->replaceStylePar("td", $cell_class[$k], "padding-left",
2836  $lr_padding, "table_cell");
2837  $this->object->replaceStylePar("td", $cell_class[$k], "padding-right",
2838  $lr_padding, "table_cell");
2839  $this->object->replaceStylePar("td", $cell_class[$k], "border-width",
2840  "1px", "table_cell");
2841  $this->object->replaceStylePar("td", $cell_class[$k], "border-style",
2842  "solid", "table_cell");
2843  $this->object->replaceStylePar("td", $cell_class[$k], "border-color",
2844  "!".$cell_color."(".$_POST["lightness_border"].")", "table_cell");
2845  $this->object->replaceStylePar("td", $cell_class[$k], "font-weight",
2846  "normal", "table_cell");
2847  }
2848 
2849  // table class
2850  $classes["table"] = $_POST["name"]."T";
2851  if (!$this->object->characteristicExists($classes["table"], "table"))
2852  {
2853  $this->object->addCharacteristic("table", $classes["table"], true);
2854  }
2855  $this->object->replaceStylePar("table", $classes["table"], "caption-side",
2856  "bottom", "table");
2857  $this->object->replaceStylePar("table", $classes["table"], "border-collapse",
2858  "collapse", "table");
2859  $this->object->replaceStylePar("table", $classes["table"], "margin-top",
2860  "5px", "table");
2861  $this->object->replaceStylePar("table", $classes["table"], "margin-bottom",
2862  "5px", "table");
2863  if ($_POST["layout"] == "bwZebra")
2864  {
2865  $this->object->replaceStylePar("table", $classes["table"], "border-bottom-color",
2866  "!".$_POST["base_color"], "table");
2867  $this->object->replaceStylePar("table", $classes["table"], "border-bottom-style",
2868  "solid", "table");
2869  $this->object->replaceStylePar("table", $classes["table"], "border-bottom-width",
2870  "3px", "table");
2871  $sb = array("left", "right", "top");
2872  foreach ($sb as $b)
2873  {
2874  $this->object->replaceStylePar("table", $classes["table"], "border-".$b."-width",
2875  "0px", "table");
2876  }
2877  }
2878 
2879  switch ($_POST["layout"])
2880  {
2881  case "coloredZebra":
2882  $classes["row_head"] = $cell_class["H"];
2883  $classes["odd_row"] = $cell_class["C1"];
2884  $classes["even_row"] = $cell_class["C2"];
2885  break;
2886 
2887  case "bwZebra":
2888  $classes["row_head"] = $cell_class["H"];
2889  $classes["odd_row"] = $cell_class["C1"];
2890  $classes["even_row"] = $cell_class["C2"];
2891  break;
2892 
2893  case "noZebra":
2894  $classes["row_head"] = $cell_class["H"];
2895  $classes["odd_row"] = $cell_class["C1"];
2896  $classes["even_row"] = $cell_class["C1"];
2897  $classes["col_head"] = $cell_class["C2"];
2898  break;
2899  }
2900 
2901 
2902  $t_id = $this->object->addTemplate($_GET["temp_type"],
2903  $_POST["name"], $classes);
2904  $this->object->writeTemplatePreview($t_id,
2905  $this->getTemplatePreview($_GET["temp_type"], $t_id, true));
2906  $ilCtrl->redirect($this, "listTemplates");
2907  }
2908  }
2909  $this->form_gui->setValuesByPost();
2910  $tpl->setContent($this->form_gui->getHTML());
2911  }
2912 
2914  {
2915  global $tpl;
2916 
2917  include_once("./Services/Accordion/classes/class.ilAccordionGUI.php");
2918 
2919  $acc = new ilAccordionGUI();
2920  $acc->addItem("Header 1", str_repeat("bla bla bla bla bla bla", 30));
2921  $acc->addItem("Header 2", str_repeat("xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx xx x xx x xx", 30));
2922  $acc->setOrientation(ilAccordionGUI::HORIZONTAL);
2923 
2924  $ac2 = new ilAccordionGUI();
2925  $ac2->addItem("Header 1", str_repeat("bla bla bla bla bla bla", 30));
2926  $ac2->addItem("Header 2", $acc->getHTML());
2927  $ac2->setOrientation(ilAccordionGUI::VERTICAL);
2928 
2929  $tpl->setContent($ac2->getHTML());
2930  }
2931 
2936  {
2937  global $ilCtrl;
2938 
2939  /*if ($_GET["baseClass"] == "ilAdministrationGUI")
2940  {
2941  $ilCtrl->redirectByClass("ilcontentstylesettingsgui", "edit");
2942  }*/
2943  $ilCtrl->returnToParent($this);
2944  }
2945 
2946 
2947 }
2948 ?>
getTemplatePreview($a_type, $a_t_id, $a_small_mode=false)
Get table template preview.
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
setSubTabs()
adds tabs to tab gui object
static prepareFormOutput($a_str, $a_strip=false)
prepares string output for html forms public
deleteTemplateKeepClassesObject()
Delete table template.
static _getTemplateClassTypes($a_template_type="")
Get template class types.
$style
Definition: example_012.php:70
cancelColorDeletionObject()
Cancel color deletion.
deleteMediaQueriesObject()
Delete Media Queries.
static _lookupTemplateName($a_t_id)
Lookup table template name for template ID.
$_SESSION["AccountId"]
This class represents a selection list property in a property form.
static _getTemplatePreview($a_style, $a_type, $a_t_id, $a_small_mode=false)
Get table template preview.
deleteCharacteristicObject()
Delete one or multiple style characteristic.
This class represents a property form user interface.
deleteMediaQueryConfirmationObject()
Confirm media query deletion.
listColorsObject()
List colors of style.
refreshTemplateObject()
Refresh table template.
saveObject()
save style sheet
static _determineTag($a_type)
saveTagStyle()
Save tag style.
$_GET["client_id"]
$h
This class represents a section header in a property form.
This class represents a file 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...
outputTagStyleEditScreen()
Output tag style edit screen.
Class ilObject Basic functions for all objects.
getAdminTabs()
admin and normal tabs are equal for roles
afterImport(ilObject $a_new_obj)
After import.
getPropertiesValues()
Get current values for properties from.
confirmedDeleteObject()
delete selected style objects
Color picker form for selecting color hexcodes using yui library.
extractParametersOfTag($a_tag, $a_class, $a_style, $a_type, $a_mq_id=0, $a_custom=false)
cancelTemplateDeletionObject()
Cancel table template deletion.
$cmd
Definition: sahs_server.php:35
initCharacteristicForm($a_mode)
Init tag style editing form.
TableGUI class for style editor (image list)
listImagesObject()
List images of style.
setAllowPercentage($a_allowpercentage)
Set Allow Percentage.
getValues()
FORM: Get current values from persistent object.
Import class.
static _getStyleSuperTypeForType($a_type)
This class represents a checkbox property in a property form.
static _lookupTitle($a_id)
lookup object title
getTabs()
adds tabs to tab gui object
addCharacteristicFormObject()
Add characteristic.
setCreationMode($a_mode=true)
if true, a creation screen is displayed the current $_GET[ref_id] don&#39;t belong to the current class! ...
deleteTemplateConfirmationObject()
Delete table template confirmation.
writeStylePar($cur_tag, $cur_class, $par, $value, $a_type, $a_mq_id, $a_custom=false)
deleteCoreCharMessage()
Message that appears, when user tries to delete core characteristics.
static _getClonableContentStyles()
Get all clonable styles (active standard styles and individual learning module styles with write perm...
deleteColorConfirmationObject()
Delete color confirmation.
deleteCharacteristicConfirmationObject()
Characteristic deletion confirmation screen.
initMediaQueryForm($a_mode="create")
Init media query form.
setTemplatesSubTabs()
adds tabs to tab gui object
generateTemplateObject()
Generate table template.
saveHideStatusObject()
Save hide status for characteristics.
Color picker form for selecting color hexcodes using yui library (all/top/right/bottom/left) ...
setAllowPercentage($a_allowpercentage)
Set Allow Percentage.
This class represents a numeric style property in a property form.
pasteCharacteristicsOverviewObject()
Paste characteristics overview.
global $ilCtrl
Definition: ilias.php:18
editTagStyleObject()
Edit tag style.
cancelColorSavingObject()
Cancel color saving.
initImageForm()
Init image form.
initPropertiesForm($a_mode="edit")
FORM: Init properties form.
setInfo($a_info)
Set Information Text.
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
$a_type
Definition: workflow.php:93
This class represents a border style with all/top/right/bottom/left in a property form...
setPattern($pattern)
set pattern
This class represents a hidden form property in a property form.
$info
Definition: example_052.php:80
prepareOutput($a_show_subobjects=true)
prepare output
getCreationFormsHTML(array $a_forms)
Get HTML for creation forms (accordion)
$r
Definition: example_031.php:79
cancelCharacteristicDeletionObject()
Cancel characteristic deletion.
saveCharacteristicObject()
Save Characteristic.
static addCss()
Add required css.
setMinValue($a_minvalue, $a_display_always=false)
Set Minimum Value.
if(!is_array($argv)) $options
importStyleObject()
import style sheet
static _isExpandable($a_type)
getMediaQueryFormValues()
Set values for media query editing.
saveMediaQueryOrderObject()
Save media query order.
This class represents a number property in a property form.
static _getCoreStyles()
Get core styles.
Class ilObjectGUI Basic methods of all Output classes.
static _lookupObjId($a_id)
deleteTemplateObject()
Delete table template.
special template class to simplify handling of ITX/PEAR
This class represents a border width with all/top/right/bottom/left in a property form...
copyStyleObject()
save style sheet
deleteStyleParameterObject()
delete style parameters
This class represents a regular expression input property in a property form.
This class represents a text property in a property form.
returnToUpperContextObject()
return to upper context
setDefaultColor($a_defaultcolor)
Set Default Color.
redirection script todo: (a better solution should control the processing via a xml file) ...
updateTagStyleObject()
save and refresh tag editing
setMaxLength($a_maxlength)
Set Max Length.
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
saveTemplateObject()
Save table template.
listMediaQueriesObject()
List media queries of style.
editObject()
edit style sheet
static deliverFile($a_file, $a_filename, $a_mime='', $isInline=false, $removeAfterDelivery=false, $a_exit_after=true)
deliver file for download via browser.
setOptions($a_options)
Set Options.
TableGUI class for style editor.
templateGenerationObject()
Table template generation.
initTemplateForm($a_mode="create")
Init table template form.
static getInstanceByObjId($a_obj_id, $stop_on_error=true)
get an instance of an Ilias object by object id
getColorFormValues()
Set values for color editing.
Create styles array
The data for the language used.
setMaxValue($a_maxvalue, $a_display_always=false)
Set Maximum Value.
includeCSS()
Include CSS in output.
TableGUI class for style editor (image list)
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
pasteCharacteristicsObject()
Paste characteristics.
if(php_sapi_name() !='cli') $in
Definition: Utf8Test.php:37
refreshTagStyleObject()
save and refresh tag editing
static getContentStylePath($a_style_id)
get content style path
switchMQueryObject()
Switch media query.
updateTemplateObject($a_refresh=false)
Update table template.
This class represents an image file property in a property form.
This class represents a fint size property in a property form.
refreshObject()
refresh style sheet
deleteImageObject()
Delete images.
cancelObject()
update style sheet
static _writeStandard($a_id, $a_std)
Write standard flag.
cancelDeleteObject()
cancel oobject deletion
addMediaQueryObject()
Add a media query.
Create new PHPExcel object
obj_idprivate
Class ilObjStyleSheetGUI.
saveMediaQueryObject()
Save media query.
initColorForm($a_mode="create")
Init color form.
static _renderTable($content, $a_mode="table_edit", $a_submode="", $a_table_obj=null)
Static render table function.
This class represents a text area property in a property form.
initTagStyleForm($a_mode, $a_cur_tag)
Init tag style editing form.
Class ilObjStyleSheet.
$ret
Definition: parser.php:6
static _getStyleParameters($a_tag="")
__construct($a_data, $a_id, $a_call_by_reference, $a_prep=true)
Constructor public.
deleteObject($a_error=false)
display deletion confirmation screen
cancelUploadObject()
Cancel Upload.
copyCharacteristicsObject()
Copy style classes.
listTemplatesObject()
List templates.
static getInstanceByRefId($a_ref_id, $stop_on_error=true)
get an instance of an Ilias object by reference id
This class represents a numeric style property with all/top/right/bottom/left in a property form...
executeCommand()
execute command
cancelTemplateSavingObject()
Cancel color saving.
setAcceptNamedColors($a_acceptnamedcolors)
Set Accept Named Colors (Leading &#39;!&#39;).
This class represents a background image property in a property form.
editTemplateObject()
Edit table template.
This class represents a background position in a property form.
updateObject()
Update properties.
static _getStyleParameterInputType($par)
initTemplateGenerationForm()
Init table template generation form.
deleteColorObject()
Delete colors.
Accordion user interface class.
displayTemplateEditForm()
Display table tempalte edit form.
addAdminLocatorItems($a_do_not_add_object=false)
should be overwritten to add object specific items (repository items are preloaded) ...
editMediaQueryObject()
Edit media query.
const ID_PART_SCREEN
$_POST["username"]
static getStyleExampleHTML($a_type, $a_class)
Get style example HTML.
setRequired($a_required)
Set Required.
TableGUI class for style editor (image list)
updateMediaQueryObject()
Update media query.
newStyleParameterObject()
add style parameter
getTemplateFormValues()
Set values for table template editing.
static _writeUpToDate($a_id, $a_up_to_date)
Write up to date.
Confirmation screen class.