16 require_once
"./Services/Object/classes/class.ilObjectGUI.php";
17 require_once
"./Services/Style/classes/class.ilObjStyleSheet.php";
36 $this->lng->loadLanguageModule(
"style");
37 $ilCtrl->saveParameter($this, array(
"tag",
"style_type",
"temp_type"));
38 if (
$_GET[
"style_type"] !=
"")
44 $this->
ilObjectGUI($a_data,$a_id,$a_call_by_reference,
false);
52 $next_class = $this->ctrl->getNextClass($this);
53 $cmd = $this->ctrl->getCmd(
"edit");
83 global $rbacsystem,
$lng,
$tpl, $ilHelp;
88 $ilHelp->setScreenIdComponent(
"sty");
93 include_once
"Services/Form/classes/class.ilPropertyFormGUI.php";
95 $form->setFormAction($this->ctrl->getFormAction($this));
96 $form->setTitle($this->lng->txt(
"sty_create_new_stylesheet"));
102 $ti->setRequired(
true);
111 $form->addCommandButton(
"save", $this->lng->txt(
"save"));
112 $form->addCommandButton(
"cancel", $this->lng->txt(
"cancel"));
119 include_once
"Services/Form/classes/class.ilPropertyFormGUI.php";
121 $form->setFormAction($this->ctrl->getFormAction($this));
122 $form->setTitle($this->lng->txt(
"sty_import_stylesheet"));
125 $ti =
new ilFileInputGUI($this->lng->txt(
"import_file"),
"stylefile");
129 $form->addCommandButton(
"importStyle", $this->lng->txt(
"import"));
130 $form->addCommandButton(
"cancel", $this->lng->txt(
"cancel"));
137 include_once
"Services/Form/classes/class.ilPropertyFormGUI.php";
139 $form->setFormAction($this->ctrl->getFormAction($this));
140 $form->setTitle($this->lng->txt(
"sty_copy_other_stylesheet"));
148 $form->addCommandButton(
"copyStyle", $this->lng->txt(
"copy"));
149 $form->addCommandButton(
"cancel", $this->lng->txt(
"cancel"));
163 $this->tpl->setCurrentBlock(
"ContentStyle");
164 $this->tpl->setVariable(
"LOCATION_CONTENT_STYLESHEET",
165 $this->object->getContentStylePath($this->object->getId()));
166 $this->tpl->parseCurrentBlock();
180 $ctpl =
new ilTemplate(
"tpl.sty_classes.html",
true,
true,
"Services/Style");
183 $chars = $this->
object->getCharacteristics();
185 $style_type = ($this->super_type !=
"")
188 $ilCtrl->setParameter($this,
"style_type", $style_type);
189 $ilTabs->setSubTabActive(
"sty_".$style_type.
"_char");
192 if ($this->super_type ==
"rte")
194 $tpl->addCss(
"Modules/Scorm2004/templates/default/player.css");
195 include_once(
"./Modules/Scorm2004/classes/ilSCORM13Player.php");
196 $tpl->addInlineCss(ilSCORM13Player::getInlineCss());
201 $subtypes = $all_super_types[$style_type];
203 foreach ($subtypes as
$t)
210 if ($expandable && $rbacsystem->checkAccess(
"write", (
int)
$_GET[
"ref_id"]))
212 $ilToolbar->addButton($lng->txt(
"sty_add_characteristic"),
213 $ilCtrl->getLinkTarget($this,
"addCharacteristicForm"));
218 $style_cp = explode(
":::",
$_SESSION[
"sty_copy"]);
219 if ($style_cp[1] == $_GET[
"style_type"])
223 $ilToolbar->addSeparator();
225 $ilToolbar->addButton($lng->txt(
"sty_paste_style_classes"),
226 $ilCtrl->getLinkTarget($this,
"pasteCharacteristicsOverview"));
230 include_once(
"./Services/Style/classes/class.ilStyleTableGUI.php");
234 $ctpl->setCurrentBlock(
"style_table");
235 $ctpl->setVariable(
"STYLE_TABLE", $table_gui->getHTML());
236 $ctpl->parseCurrentBlock();
238 $this->tpl->setContent($ctpl->get());
246 global $rbacsystem,
$lng, $ilToolbar;
249 $this->tpl->setCurrentBlock(
"ContentStyle");
250 $this->tpl->setVariable(
"LOCATION_CONTENT_STYLESHEET",
251 $this->object->getContentStylePath($this->object->getId()));
252 $this->tpl->parseCurrentBlock();
255 $ilToolbar->addButton($this->lng->txt(
"export"),
256 $this->ctrl->getLinkTarget($this,
"exportStyle"));
260 $this->tpl->setContent($this->form->getHTML());
271 $values[
"style_title"] = $this->
object->getTitle();
272 $values[
"style_description"] = $this->
object->getDescription();
273 $values[
"disable_auto_margins"] = (int) $this->object->lookupStyleSetting(
"disable_auto_margins");
275 $this->form->setValuesByArray($values);
285 global
$lng, $rbacsystem;
287 include_once(
"Services/Form/classes/class.ilPropertyFormGUI.php");
291 $ti =
new ilTextInputGUI($this->lng->txt(
"title"),
"style_title");
294 $ti->setRequired(
true);
295 $this->form->addItem($ti);
301 $this->form->addItem($ta);
304 $cb =
new ilCheckboxInputGUI($this->lng->txt(
"sty_disable_auto_margins"),
"disable_auto_margins");
305 $cb->
setInfo($this->lng->txt(
"sty_disable_auto_margins_info"));
306 $this->form->addItem($cb);
310 if ($a_mode ==
"create")
312 $this->form->addCommandButton(
"save", $lng->txt(
"save"));
313 $this->form->addCommandButton(
"cancelSave", $lng->txt(
"cancel"));
317 if ($rbacsystem->checkAccess(
"write", (
int)
$_GET[
"ref_id"]))
319 $this->form->addCommandButton(
"update", $lng->txt(
"save"));
323 $this->form->setTitle($lng->txt(
"edit_stylesheet"));
324 $this->form->setFormAction($this->ctrl->getFormAction($this));
336 if ($this->form->checkInput())
338 $this->
object->setTitle($this->form->getInput(
"style_title"));
339 $this->
object->setDescription($this->form->getInput(
"style_description"));
340 $this->
object->writeStyleSetting(
"disable_auto_margins",
341 $this->form->getInput(
"disable_auto_margins"));
342 $this->
object->update();
344 $ilCtrl->redirect($this,
"properties");
348 $this->form->setValuesByPost();
349 $tpl->setContent($this->form->getHtml());
360 $cur = explode(
".",
$_GET[
"tag"]);
362 $cur_class = $cur[1];
366 if ($this->form_gui->checkInput())
369 $ilCtrl->redirect($this,
"editTagStyle");
373 $this->form_gui->setValuesByPost();
385 $cur = explode(
".",
$_GET[
"tag"]);
387 $cur_class = $cur[1];
390 if ($this->form_gui->checkInput())
393 $ilCtrl->redirect($this,
"edit");
397 $this->form_gui->setValuesByPost();
407 $cur = explode(
".",
$_GET[
"tag"]);
409 $cur_class = $cur[1];
411 foreach ($avail_pars as $par => $v)
413 $var = str_replace(
"-",
"_", $par);
414 $basepar_arr = explode(
".", $par);
415 $basepar = $basepar_arr[0];
416 if ($basepar_arr[1] !=
"" && $basepar_arr[1] != $cur_tag)
424 case "numeric_no_perc":
426 case "background_image":
427 $in = $this->form_gui->getItemByPostVar($basepar);
433 $color = trim(
$_POST[$basepar]);
434 if ($color !=
"" && trim(substr($color,0,1) !=
"!"))
444 $in = $this->form_gui->getItemByPostVar($basepar);
445 $this->
writeStylePar($cur_tag, $cur_class, $v[
"subpar"][0],
$in->getAllValue(), $_GET[
"style_type"], (int) $_GET[
"mq_id"]);
446 $this->
writeStylePar($cur_tag, $cur_class, $v[
"subpar"][1],
$in->getTopValue(), $_GET[
"style_type"], (int) $_GET[
"mq_id"]);
447 $this->
writeStylePar($cur_tag, $cur_class, $v[
"subpar"][2],
$in->getRightValue(), $_GET[
"style_type"], (int) $_GET[
"mq_id"]);
448 $this->
writeStylePar($cur_tag, $cur_class, $v[
"subpar"][3],
$in->getBottomValue(), $_GET[
"style_type"], (int) $_GET[
"mq_id"]);
449 $this->
writeStylePar($cur_tag, $cur_class, $v[
"subpar"][4],
$in->getLeftValue(), $_GET[
"style_type"], (int) $_GET[
"mq_id"]);
453 $in = $this->form_gui->getItemByPostVar($basepar);
454 $tblr_p = array (0 =>
"getAllValue", 1 =>
"getTopValue", 2 =>
"getRightValue",
455 3 =>
"getBottomValue", 4 =>
"getLeftValue");
456 foreach ($tblr_p as $k => $func)
458 $val = trim(
$in->$func());
459 $val = ((
$in->getAcceptNamedColors() && substr($val, 0, 1) ==
"!")
463 $this->
writeStylePar($cur_tag, $cur_class, $v[
"subpar"][$k], $val, $_GET[
"style_type"], (
int) $_GET[
"mq_id"]);
467 case "background_position":
468 $in = $this->form_gui->getItemByPostVar($basepar);
469 $this->
writeStylePar($cur_tag, $cur_class, $basepar,
$in->getValue(), $_GET[
"style_type"], (int) $_GET[
"mq_id"]);
473 $this->
writeStylePar($cur_tag, $cur_class, $basepar,
$_POST[$basepar], $_GET[
"style_type"], (
int) $_GET[
"mq_id"]);
479 $this->
object->deleteCustomStylePars($cur_tag, $cur_class,
$_GET[
"style_type"], (
int)
$_GET[
"mq_id"]);
480 if (is_array(
$_POST[
"custom_par"]))
482 foreach (
$_POST[
"custom_par"] as $cpar)
484 $par_arr = explode(
":", $cpar);
485 if (count($par_arr) == 2)
487 $par = trim($par_arr[0]);
488 $val = trim(str_replace(
";",
"", $par_arr[1]));
489 $this->
writeStylePar($cur_tag, $cur_class, $par, $val, $_GET[
"style_type"], (
int) $_GET[
"mq_id"],
true);
494 $this->
object->update();
497 function writeStylePar($cur_tag, $cur_class, $par, $value, $a_type, $a_mq_id, $a_custom =
false)
508 $this->
object->replaceStylePar($cur_tag, $cur_class, $par, $value, $a_type, $a_mq_id, $a_custom);
512 $this->
object->deleteStylePar($cur_tag, $cur_class, $par, $a_type, $a_mq_id, $a_custom);
525 $mqs = $this->
object->getMediaQueries();
530 "" => $lng->txt(
"sty_default"),
532 foreach ($mqs as $mq)
534 $options[$mq[
"id"]] = $mq[
"mquery"];
536 include_once(
"./Services/Form/classes/class.ilSelectInputGUI.php");
539 $si->setValue((
int)
$_GET[
"mq_id"]);
540 $ilToolbar->addInputItem(
$si,
true);
541 $ilToolbar->setFormAction($ilCtrl->getFormAction($this));
542 $ilToolbar->addFormButton($lng->txt(
"sty_switch"),
"switchMQuery");
547 if ($this->super_type ==
"rte")
549 $tpl->addCss(
"Modules/Scorm2004/templates/default/player.css");
550 include_once(
"./Modules/Scorm2004/classes/ilSCORM13Player.php");
551 $tpl->addInlineCss(ilSCORM13Player::getInlineCss());
554 $cur = explode(
".",
$_GET[
"tag"]);
556 $cur_class = $cur[1];
573 $ilCtrl->setParameter($this,
"mq_id", (
int)
$_POST[
"mq_id"]);
574 $ilCtrl->redirect($this,
"editTagStyle");
586 $tpl->setCurrentBlock(
"ContentStyle");
587 $tpl->setVariable(
"LOCATION_CONTENT_STYLESHEET",
588 $this->object->getContentStylePath($this->object->getId()));
590 $ts_tpl =
new ilTemplate(
"tpl.style_tag_edit.html",
true,
true,
"Services/Style");
592 $cur = explode(
".",
$_GET[
"tag"]);
594 $cur_class = $cur[1];
596 $ts_tpl->setVariable(
"EXAMPLE",
599 $ts_tpl->setVariable(
"FORM",
600 $this->form_gui->getHtml());
602 $tpl->setTitle($cur_class.
" (".$lng->txt(
"sty_type_".$_GET[
"style_type"]).
")");
604 $tpl->setContent($ts_tpl->get());
617 $ilCtrl->saveParameter($this, array(
"mq_id"));
619 include_once(
"Services/Form/classes/class.ilPropertyFormGUI.php");
622 $avail_pars = $this->
object->getAvailableParameters();
623 $groups = $this->
object->getStyleParameterGroups();
626 foreach ($groups as $k => $group)
631 if (is_array($filtered_groups[$k]) && !in_array($a_cur_tag, $filtered_groups[$k]))
637 $sh->setTitle($lng->txt(
"sty_".$k));
638 $this->form_gui->addItem($sh);
640 foreach ($group as $par)
642 $basepar = explode(
".", $par);
643 $basepar = $basepar[0];
645 $var = str_replace(
"-",
"_", $basepar);
646 $up_par = strtoupper($var);
653 foreach ($avail_pars[$par] as $p)
658 $this->form_gui->addItem($sel_input);
662 $text_input =
new ilTextInputGUI($lng->txt(
"sty_".$var), $basepar);
664 $text_input->setSize(20);
665 $this->form_gui->addItem($text_input);
669 include_once(
"./Services/Style/classes/class.ilFontSizeInputGUI.php");
671 $this->form_gui->addItem($fs_input);
674 case "numeric_no_perc":
676 include_once(
"./Services/Style/classes/class.ilNumericStyleValueInputGUI.php");
682 $this->form_gui->addItem($num_input);
688 $per_input->setMaxValue(100);
689 $per_input->setMaxLength(3);
690 $per_input->setSize(3);
691 $this->form_gui->addItem($per_input);
698 $col_input->setAcceptNamedColors(
true);
699 $this->form_gui->addItem($col_input);
703 include_once(
"./Services/Style/classes/class.ilTRBLNumericStyleValueInputGUI.php");
709 $this->form_gui->addItem($num_input);
713 include_once(
"./Services/Style/classes/class.ilTRBLBorderWidthInputGUI.php");
715 $this->form_gui->addItem($bw_input);
719 include_once(
"./Services/Style/classes/class.ilTRBLBorderStyleInputGUI.php");
721 $this->form_gui->addItem($bw_input);
725 include_once(
"./Services/Style/classes/class.ilTRBLColorPickerInputGUI.php");
728 $this->form_gui->addItem($col_input);
731 case "background_image":
732 include_once(
"./Services/Style/classes/class.ilBackgroundImageInputGUI.php");
735 foreach ($this->object->getImages() as $entry)
737 $imgs[] = $entry[
"entry"];
740 $this->form_gui->addItem($im_input);
743 case "background_position":
744 include_once(
"./Services/Style/classes/class.ilBackgroundPositionInputGUI.php");
746 $this->form_gui->addItem($im_input);
754 $sh->setTitle($lng->txt(
"sty_custom"));
755 $this->form_gui->addItem($sh);
758 $ti =
new ilTextInputGUI($this->lng->txt(
"sty_custom_par"),
"custom_par");
762 $ti->setInfo($this->lng->txt(
"sty_custom_par_info"));
763 $this->form_gui->addItem($ti);
767 $this->form_gui->addCommandButton(
"updateTagStyle", $lng->txt(
"save_return"));
768 $this->form_gui->addCommandButton(
"refreshTagStyle", $lng->txt(
"save_refresh"));
771 $this->form_gui->setFormAction($this->ctrl->getFormAction($this));
780 $style = $this->
object->getStyle();
781 $cur = explode(
".",
$_GET[
"tag"]);
783 $cur_class = $cur[1];
785 (
int)
$_GET[
"mq_id"],
false);
787 foreach($parameters as $p => $v)
790 if (is_array($filtered_groups[$v[
"group"]]) && !in_array($cur_tag, $filtered_groups[$v[
"group"]]))
794 $p = explode(
".", $p);
796 $input = $this->form_gui->getItemByPostVar($p);
806 $input->setAllValue($cur_parameters[$v[
"subpar"][0]]);
807 $input->setTopValue($cur_parameters[$v[
"subpar"][1]]);
808 $input->setRightValue($cur_parameters[$v[
"subpar"][2]]);
809 $input->setBottomValue($cur_parameters[$v[
"subpar"][3]]);
810 $input->setLeftValue($cur_parameters[$v[
"subpar"][4]]);
814 $input->setValue($cur_parameters[$p]);
820 (
int) $_GET[
"mq_id"],
true);
822 foreach ($cust_parameters as $k => $c)
824 $vals[] = $k.
": ".$c;
826 $input = $this->form_gui->getItemByPostVar(
"custom_par");
827 $input->setValue($vals);
835 $file = $this->
object->export();
842 $parameters = array();
843 foreach($a_style as $tag)
845 foreach($tag as $par)
847 if ($par[
"tag"] == $a_tag && $par[
"class"] == $a_class
848 && $par[
"type"] == $a_type && (
int) $a_mq_id == (
int) $par[
"mq_id"]
849 && (
int) $a_custom == (
int) $par[
"custom"])
851 $parameters[$par[
"parameter"]] = $par[
"value"];
863 $this->
object->addParameter(
$_POST[
"tag"],
$_POST[
"parameter"]);
872 $this->
object->setTitle(
$_POST[
"style_title"]);
873 $this->
object->setDescription(
$_POST[
"style_description"]);
875 foreach(
$_POST[
"styval"] as $id => $value)
877 $this->
object->updateStyleParameter($id, $value);
879 $this->
object->update();
893 include_once(
"./Services/Utilities/classes/class.ilConfirmationGUI.php");
895 $cgui->setFormAction($this->ctrl->getFormAction($this));
896 $cgui->setHeaderText($this->lng->txt(
"info_delete_sure"));
897 $cgui->setCancel($this->lng->txt(
"cancel"),
"cancelDelete");
898 $cgui->setConfirm($this->lng->txt(
"confirm"),
"confirmedDelete");
901 " ".ilObject::_lookupTitle($this->object->getId());
903 $cgui->addItem(
"id[]",
"", $caption);
905 $this->tpl->setContent($cgui->getHTML());
914 $this->ctrl->returnToParent($this);
924 $this->
object->delete();
926 $this->ctrl->returnToParent($this);
934 if (is_array(
$_POST[
"sty_select"]))
936 foreach(
$_POST[
"sty_select"] as $id => $dummy)
938 $this->
object->deleteParameter($id);
941 $this->
object->read();
942 $this->
object->writeCSSFile();
951 if(!trim(
$_POST[
"style_title"]))
953 $this->ctrl->redirect($this,
"create");
957 $class_name =
"ilObjStyleSheet";
958 require_once(
"./Services/Style/classes/class.ilObjStyleSheet.php");
960 $newObj->setTitle(
"-");
968 if (
$_GET[
"ref_id"] > 0)
972 if ($fold->getType() ==
"stys")
974 $fold->addStyle($newObj->getId());
977 $this->ctrl->redirectByClass(
"ilobjstylesettingsgui",
"editContentStyles");
981 return $newObj->getId();
991 if (
$_POST[
"source_style"] > 0)
992 $style_obj =& $ilias->obj_factory->getInstanceByObjId(
$_POST[
"source_style"]);
993 $new_id = $style_obj->ilClone();
997 if (
$_GET[
"ref_id"] > 0)
1001 if ($fold->getType() ==
"stys")
1003 $fold->addStyle($new_id);
1006 $this->ctrl->redirectByClass(
"ilobjstylesettingsgui",
"editContentStyles");
1019 $source = $_FILES[
"stylefile"][
"tmp_name"];
1020 if (($source ==
'none') || (!$source))
1022 $this->ilias->raiseError(
"No file selected!",$this->ilias->error_obj->MESSAGE);
1026 $info = pathinfo($_FILES[
"stylefile"][
"name"]);
1027 if (strtolower($info[
"extension"]) !=
"zip" && strtolower($info[
"extension"]) !=
"xml")
1029 $this->ilias->raiseError(
"File must be a zip or xml file!",$this->ilias->error_obj->MESSAGE);
1032 $class_name =
"ilObjStyleSheet";
1033 require_once(
"./Services/Style/classes/class.ilObjStyleSheet.php");
1037 $newObj->import($_FILES[
"stylefile"]);
1042 if (
$_GET[
"ref_id"] > 0)
1046 if ($fold->getType() ==
"stys")
1048 $fold->addStyle($newObj->getId());
1051 $this->ctrl->redirectByClass(
"ilobjstylesettingsgui",
"editContentStyles");
1055 return $newObj->getId();
1066 $this->ctrl->returnToParent($this);
1084 $this->
getTabs($this->tabs_gui);
1086 if (strtolower(get_class($this->
object)) ==
"ilobjstylesheet")
1088 $this->tpl->setVariable(
"HEADER", $this->object->getTitle());
1092 $this->tpl->setVariable(
"HEADER", $lng->txt(
"create_stylesheet"));
1105 $ilHelp->setScreenIdComponent(
"sty");
1107 if ($ilCtrl->getCmd() ==
"editTagStyle")
1110 $tabs_gui->setBackTarget($lng->txt(
"back"),
1111 $ilCtrl->getLinkTarget($this,
"edit"));
1113 $t = explode(
".",
$_GET[
"tag"]);
1114 $t2 = explode(
":",
$t[1]);
1115 $pc = $this->
object->_getPseudoClasses(
$t[0]);
1116 if (is_array($pc) && count($pc) > 0)
1119 $ilCtrl->setParameter($this,
"tag",
$t[0].
".".$t2[0]);
1120 $tabs_gui->addTarget(
"sty_tag_normal",
1121 $this->ctrl->getLinkTarget($this,
"editTagStyle"), array(
"editTagStyle",
""),
1125 $ilTabs->setTabActive(
"sty_tag_normal");
1131 $ilCtrl->setParameter($this,
"tag",
$t[0].
".".$t2[0].
":".$p);
1132 $tabs_gui->addTarget(
"sty_tag_".$p,
1133 $this->ctrl->getLinkTarget($this,
"editTagStyle"), array(
"editTagStyle",
""),
1137 $ilTabs->setTabActive(
"sty_tag_".$p);
1140 $ilCtrl->setParameter($this,
"tag",
$_GET[
"tag"]);
1146 $tabs_gui->setBackTarget($lng->txt(
"back"),
1147 $this->ctrl->getLinkTarget($this,
"returnToUpperContext"));
1150 $tabs_gui->addTarget(
"sty_style_chars",
1151 $this->ctrl->getLinkTarget($this,
"edit"), array(
"edit",
""),
1155 $tabs_gui->addTarget(
"sty_colors",
1156 $this->ctrl->getLinkTarget($this,
"listColors"),
"listColors",
1160 $tabs_gui->addTarget(
"sty_media_queries",
1161 $this->ctrl->getLinkTarget($this,
"listMediaQueries"),
"listMediaQueries",
1165 $tabs_gui->addTarget(
"sty_images",
1166 $this->ctrl->getLinkTarget($this,
"listImages"),
"listImages",
1170 $tabs_gui->addTarget(
"sty_templates",
1171 $this->ctrl->getLinkTarget($this,
"listTemplates"),
"listTemplates",
1175 $tabs_gui->addTarget(
"settings",
1176 $this->ctrl->getLinkTarget($this,
"properties"),
"properties",
1199 foreach ($types as $super_type => $types)
1202 $ilCtrl->setParameter($this,
"style_type", $super_type);
1203 $ilTabs->addSubTabTarget(
"sty_".$super_type.
"_char",
1204 $this->ctrl->getLinkTarget($this,
"edit"), array(
"edit",
""),
1208 $ilCtrl->setParameter($this,
"style_type",
$_GET[
"style_type"]);
1222 foreach ($types as
$t => $c)
1224 $ilCtrl->setParameter($this,
"temp_type",
$t);
1225 $ilTabs->addSubTabTarget(
"sty_".
$t.
"_templates",
1226 $this->ctrl->getLinkTarget($this,
"listTemplates"), array(
"listTemplates",
""),
1230 $ilCtrl->setParameter($this,
"temp_type",
$_GET[
"temp_type"]);
1241 if (
$_GET[
"admin_mode"] ==
"settings")
1247 $this->ctrl->getLinkTargetByClass(
"ilobjstylesettingsgui",
"view"));
1249 if (
$_GET[
"obj_id"] > 0)
1251 $ilLocator->addItem($this->object->getTitle(),
1252 $this->ctrl->getLinkTarget($this,
"edit"));
1266 if (strtolower(
$_GET[
"baseClass"]) ==
"iladministrationgui")
1269 $this->ctrl->getLinkTargetByClass(
"ilobjstylesettingsgui",
1270 "editContentStyles"));
1285 if ($rbacsystem->checkAccess(
"write", (
int)
$_GET[
"ref_id"]))
1287 $ilToolbar->addButton($lng->txt(
"sty_add_image"),
1288 $ilCtrl->getLinkTarget($this,
"addImage"));
1291 include_once(
"./Services/Style/classes/class.ilStyleImageTableGUI.php");
1294 $tpl->setContent($table_gui->getHTML());
1306 $tpl->setContent($this->form_gui->getHTML());
1316 $ilCtrl->redirect($this,
"listImages");
1328 if ($this->form_gui->checkInput())
1330 $this->
object->uploadImage($_FILES[
"image_file"]);
1331 $ilCtrl->redirect($this,
"listImages");
1336 $tpl->setContent($this->form_gui->getHTML());
1348 include_once(
"Services/Form/classes/class.ilPropertyFormGUI.php");
1351 $this->form_gui->setTitle($lng->txt(
"sty_add_image"));
1355 $this->form_gui->addItem($file_input);
1357 $this->form_gui->addCommandButton(
"uploadImage", $lng->txt(
"upload"));
1358 $this->form_gui->addCommandButton(
"cancelUpload", $lng->txt(
"cancel"));
1359 $this->form_gui->setFormAction($ilCtrl->getFormAction($this));
1369 $images = $this->
object->getImages();
1371 foreach ($images as $image)
1373 if (is_array(
$_POST[
"file"]) && in_array($image[
"entry"],
$_POST[
"file"]))
1375 $this->
object->deleteImage($image[
"entry"]);
1378 $ilCtrl->redirect($this,
"listImages");
1390 if (!is_array(
$_POST[
"char"]) || count(
$_POST[
"char"]) == 0)
1393 $ilCtrl->redirect($this,
"edit");
1399 foreach (
$_POST[
"char"] as $char)
1401 if (!empty($core_styles[$char]))
1408 include_once(
"./Services/Utilities/classes/class.ilConfirmationGUI.php");
1410 $cgui->setFormAction($ilCtrl->getFormAction($this));
1411 $cgui->setHeaderText($lng->txt(
"sty_confirm_char_deletion"));
1412 $cgui->setCancel($lng->txt(
"cancel"),
"cancelCharacteristicDeletion");
1413 $cgui->setConfirm($lng->txt(
"delete"),
"deleteCharacteristic");
1415 foreach (
$_POST[
"char"] as $char)
1417 $char_comp = explode(
".", $char);
1418 $cgui->addItem(
"char[]", $char, $char_comp[2]);
1421 $tpl->setContent($cgui->getHTML());
1435 include_once(
"./Services/Utilities/classes/class.ilConfirmationGUI.php");
1437 $cgui->setFormAction($ilCtrl->getFormAction($this));
1442 foreach (
$_POST[
"char"] as $char)
1444 if (!empty($core_styles[$char]))
1447 $char_comp = explode(
".", $char);
1448 $cgui->addItem(
"",
"", $char_comp[2]);
1452 $cgui->addHiddenItem(
"char[]", $char);
1455 $all_core_styles = ($cnt == count(
$_POST[
"char"]))
1459 if ($all_core_styles)
1461 $cgui->setHeaderText($lng->txt(
"sty_all_styles_obligatory"));
1462 $cgui->setCancel($lng->txt(
"back"),
"cancelCharacteristicDeletion");
1466 $cgui->setHeaderText($lng->txt(
"sty_some_styles_obligatory_delete_rest"));
1467 $cgui->setCancel($lng->txt(
"cancel"),
"cancelCharacteristicDeletion");
1468 $cgui->setConfirm($lng->txt(
"sty_delete_other_selected"),
"deleteCharacteristicConfirmation");
1471 $tpl->setContent($cgui->getHTML());
1482 $ilCtrl->redirect($this,
"edit");
1492 if (is_array(
$_POST[
"char"]))
1494 foreach(
$_POST[
"char"] as $char)
1496 $char_comp = explode(
".", $char);
1497 $type = $char_comp[0];
1498 $tag = $char_comp[1];
1499 $class = $char_comp[2];
1501 $this->
object->deleteCharacteristic($type, $tag, $class);
1505 $ilCtrl->redirect($this,
"edit");
1516 $tpl->setContent($this->form_gui->getHTML());
1528 if ($this->form_gui->checkInput())
1530 if ($this->object->characteristicExists(
$_POST[
"new_characteristic"],
$_GET[
"style_type"]))
1532 $char_input = $this->form_gui->getItemByPostVar(
"new_characteristic");
1533 $char_input->setAlert($lng->txt(
"sty_characteristic_already_exists"));
1537 $this->
object->addCharacteristic(
$_POST[
"type"],
$_POST[
"new_characteristic"]);
1539 $ilCtrl->setParameter($this,
"tag",
1541 $ilCtrl->setParameter($this,
"style_type", $_POST[
"type"]);
1542 $ilCtrl->redirect($this,
"editTagStyle");
1545 $this->form_gui->setValuesByPost();
1546 $tpl->setContent($this->form_gui->getHTML());
1558 include_once(
"Services/Form/classes/class.ilPropertyFormGUI.php");
1562 $txt_input =
new ilRegExpInputGUI($lng->txt(
"title"),
"new_characteristic");
1563 $txt_input->
setPattern(
"/^[a-zA-Z]+[a-zA-Z0-9]*$/");
1564 $txt_input->setNoMatchMessage($lng->txt(
"sty_msg_characteristic_must_only_include").
" A-Z, a-z, 1-9");
1565 $txt_input->setRequired(
true);
1566 $this->form_gui->addItem($txt_input);
1570 $types = $all_super_types[$this->super_type];
1571 $exp_types = array();
1572 foreach($types as
$t)
1576 $exp_types[
$t] = $lng->txt(
"sty_type_".$t);
1579 if (count($exp_types) > 1)
1583 $type_input->setValue(key($exp_types));
1584 $this->form_gui->addItem($type_input);
1586 else if (count($exp_types) == 1)
1589 $hid_input->setValue(key($exp_types));
1590 $this->form_gui->addItem($hid_input);
1593 $this->form_gui->setTitle($lng->txt(
"sty_add_characteristic"));
1594 $this->form_gui->addCommandButton(
"saveCharacteristic", $lng->txt(
"save"));
1595 $this->form_gui->addCommandButton(
"edit", $lng->txt(
"cancel"));
1596 $this->form_gui->setFormAction($ilCtrl->getFormAction($this));
1606 $c = explode(
":", $a_class);
1609 $ex_tpl =
new ilTemplate(
"tpl.style_example.html",
true,
true,
"Services/Style");
1611 $ex_tpl->setCurrentBlock(
"Example_".$a_type);
1612 $ex_tpl->setVariable(
"EX_CLASS",
"ilc_".$a_type.
"_".$a_class);
1613 $ex_tpl->setVariable(
"EX_TEXT",
"ABC abc 123");
1614 if (in_array($a_type, array(
"media_cont",
"qimg")))
1618 if (in_array($a_type, array(
"table",
"table_caption")))
1620 $ex_tpl->setVariable(
"TXT_CAPTION", $lng->txt(
"sty_caption"));
1622 if (in_array($a_class, array(
"OrderListItemHorizontal",
"OrderListHorizontal")))
1624 $ex_tpl->setVariable(
"HOR",
"Horizontal");
1626 $ex_tpl->parseCurrentBlock();
1628 return $ex_tpl->get();
1640 foreach (
$_POST[
"all_chars"] as $char)
1642 $ca = explode(
".", $char);
1643 $this->
object->saveHideStatus($ca[0], $ca[2],
1644 (is_array(
$_POST[
"hide"]) && in_array($char,
$_POST[
"hide"])));
1648 $ilCtrl->redirect($this,
"edit");
1661 if (!is_array(
$_POST[
"char"]) || count(
$_POST[
"char"]) == 0)
1667 $style_cp = implode(
"::",
$_POST[
"char"]);
1668 $style_cp = $this->
object->getId().
":::".
$_GET[
"style_type"].
":::".$style_cp;
1672 $ilCtrl->redirect($this,
"edit");
1683 global
$tpl, $ilTabs;
1685 $ilTabs->clearTargets();
1687 include_once(
"./Services/Style/classes/class.ilPasteStyleCharacteristicTableGUI.php");
1690 $tpl->setContent($table->getHTML());
1703 if (is_array(
$_POST[
"title"]))
1705 foreach (
$_POST[
"title"] as $from_char => $to_title)
1707 $fc = explode(
".", $from_char);
1709 if (
$_POST[
"conflict_action"][$from_char] ==
"overwrite" ||
1710 !$this->object->characteristicExists($to_title, $fc[0]))
1712 $this->
object->copyCharacteristic(
$_POST[
"from_style_id"],
1713 $fc[0], $fc[2], $to_title);
1721 $ilCtrl->redirect($this,
"edit");
1735 if ($rbacsystem->checkAccess(
"write", (
int)
$_GET[
"ref_id"]))
1737 $ilToolbar->addButton($this->lng->txt(
"sty_add_color"),
1738 $ilCtrl->getLinkTarget($this,
"addColor"));
1741 include_once(
"./Services/Style/classes/class.ilStyleColorTableGUI.php");
1744 $tpl->setContent($table_gui->getHTML());
1756 $tpl->setContent($this->form_gui->getHTML());
1766 $ilCtrl->setParameter($this,
"c_name",
$_GET[
"c_name"]);
1769 $tpl->setContent($this->form_gui->getHTML());
1780 include_once(
"Services/Form/classes/class.ilPropertyFormGUI.php");
1783 $this->form_gui->setTitle($lng->txt(
"sty_add_color"));
1786 $name_input =
new ilRegExpInputGUI($lng->txt(
"sty_color_name"),
"color_name");
1787 $name_input->
setPattern(
"/^[a-zA-Z]+[a-zA-Z0-9]*$/");
1788 $name_input->setNoMatchMessage($lng->txt(
"sty_msg_color_must_only_include").
" A-Z, a-z, 1-9");
1789 $name_input->setRequired(
true);
1790 $name_input->setSize(15);
1791 $name_input->setMaxLength(15);
1792 $this->form_gui->addItem($name_input);
1797 $color_input->setDefaultColor(
"");
1798 $this->form_gui->addItem($color_input);
1800 if ($a_mode ==
"create")
1802 $this->form_gui->addCommandButton(
"saveColor", $lng->txt(
"save"));
1803 $this->form_gui->addCommandButton(
"cancelColorSaving", $lng->txt(
"cancel"));
1807 $this->form_gui->addCommandButton(
"updateColor", $lng->txt(
"save"));
1808 $this->form_gui->addCommandButton(
"cancelColorSaving", $lng->txt(
"cancel"));
1810 $this->form_gui->setFormAction($ilCtrl->getFormAction($this));
1818 if (
$_GET[
"c_name"] !=
"")
1820 $values[
"color_name"] =
$_GET[
"c_name"];
1821 $values[
"color_code"] = $this->
object->getColorCodeForName(
$_GET[
"c_name"]);
1822 $this->form_gui->setValuesByArray($values);
1833 $ilCtrl->redirect($this,
"listColors");
1845 if ($this->form_gui->checkInput())
1847 if ($this->object->colorExists(
$_POST[
"color_name"]))
1849 $col_input = $this->form_gui->getItemByPostVar(
"color_name");
1850 $col_input->setAlert($lng->txt(
"sty_color_already_exists"));
1854 $this->
object->addColor(
$_POST[
"color_name"],
1856 $ilCtrl->redirect($this,
"listColors");
1859 $this->form_gui->setValuesByPost();
1860 $tpl->setContent($this->form_gui->getHTML());
1872 if ($this->form_gui->checkInput())
1874 if ($this->object->colorExists(
$_POST[
"color_name"]) &&
1877 $col_input = $this->form_gui->getItemByPostVar(
"color_name");
1878 $col_input->setAlert($lng->txt(
"sty_color_already_exists"));
1882 $this->
object->updateColor(
$_GET[
"c_name"],
$_POST[
"color_name"],
1884 $ilCtrl->redirect($this,
"listColors");
1887 $ilCtrl->setParameter($this,
"c_name",
$_GET[
"c_name"]);
1888 $this->form_gui->setValuesByPost();
1889 $tpl->setContent($this->form_gui->getHTML());
1899 if (!is_array(
$_POST[
"color"]) || count(
$_POST[
"color"]) == 0)
1902 $ilCtrl->redirect($this,
"listColors");
1906 include_once(
"./Services/Utilities/classes/class.ilConfirmationGUI.php");
1908 $cgui->setFormAction($ilCtrl->getFormAction($this));
1909 $cgui->setHeaderText($lng->txt(
"sty_confirm_color_deletion"));
1910 $cgui->setCancel($lng->txt(
"cancel"),
"cancelColorDeletion");
1911 $cgui->setConfirm($lng->txt(
"delete"),
"deleteColor");
1913 foreach (
$_POST[
"color"] as $c)
1918 $tpl->setContent($cgui->getHTML());
1929 $ilCtrl->redirect($this,
"listColors");
1939 if (is_array(
$_POST[
"color"]))
1941 foreach (
$_POST[
"color"] as $c)
1943 $this->
object->removeColor($c);
1947 $ilCtrl->redirect($this,
"listColors");
1961 if ($rbacsystem->checkAccess(
"write", (
int)
$_GET[
"ref_id"]))
1963 $ilToolbar->addButton($this->lng->txt(
"sty_add_media_query"),
1964 $ilCtrl->getLinkTarget($this,
"addMediaQuery"));
1967 include_once(
"./Services/Style/classes/class.ilStyleMediaQueryTableGUI.php");
1970 $tpl->setContent($table_gui->getHTML());
1981 $tpl->setContent($this->form_gui->getHTML());
1991 $ilCtrl->setParameter($this,
"mq_id",
$_GET[
"mq_id"]);
1994 $tpl->setContent($this->form_gui->getHTML());
2005 include_once(
"Services/Form/classes/class.ilPropertyFormGUI.php");
2008 $this->form_gui->setTitle($lng->txt(
"sty_add_media_query"));
2012 $ti->setMaxLength(2000);
2013 $this->form_gui->addItem($ti);
2016 if ($a_mode ==
"create")
2018 $this->form_gui->addCommandButton(
"saveMediaQuery", $lng->txt(
"save"));
2019 $this->form_gui->addCommandButton(
"listMediaQueries", $lng->txt(
"cancel"));
2023 $this->form_gui->addCommandButton(
"updateMediaQuery", $lng->txt(
"save"));
2024 $this->form_gui->addCommandButton(
"listMediaQueries", $lng->txt(
"cancel"));
2026 $this->form_gui->setFormAction($ilCtrl->getFormAction($this));
2034 if (
$_GET[
"mq_id"] !=
"")
2036 foreach ($this->object->getMediaQueries() as $mq)
2038 if ($mq[
"id"] == (
int)
$_GET[
"mq_id"])
2040 $values[
"mquery"] = $mq[
"mquery"];
2043 $this->form_gui->setValuesByArray($values);
2056 if ($this->form_gui->checkInput())
2058 $this->
object->addMediaQuery(
$_POST[
"mquery"]);
2059 $ilCtrl->redirect($this,
"listMediaQueries");
2061 $this->form_gui->setValuesByPost();
2062 $tpl->setContent($this->form_gui->getHTML());
2074 if ($this->form_gui->checkInput())
2076 $this->
object->updateMediaQuery((
int)
$_GET[
"mq_id"],
$_POST[
"mquery"]);
2077 $ilCtrl->redirect($this,
"listMediaQueries");
2079 $ilCtrl->setParameter($this,
"mq_id",
$_GET[
"mq_id"]);
2080 $this->form_gui->setValuesByPost();
2081 $tpl->setContent($this->form_gui->getHTML());
2091 if (!is_array(
$_POST[
"mq_id"]) || count(
$_POST[
"mq_id"]) == 0)
2094 $ilCtrl->redirect($this,
"listMediaQueries");
2098 include_once(
"./Services/Utilities/classes/class.ilConfirmationGUI.php");
2100 $cgui->setFormAction($ilCtrl->getFormAction($this));
2101 $cgui->setHeaderText($lng->txt(
"sty_sure_del_mqueries"));
2102 $cgui->setCancel($lng->txt(
"cancel"),
"listMediaQueries");
2103 $cgui->setConfirm($lng->txt(
"delete"),
"deleteMediaQueries");
2105 foreach (
$_POST[
"mq_id"] as $i)
2107 $mq = $this->
object->getMediaQueryForId($i);
2108 $cgui->addItem(
"mq_id[]", $i, $mq[
"mquery"]);
2111 $tpl->setContent($cgui->getHTML());
2125 if ($rbacsystem->checkAccess(
"write", (
int)
$_GET[
"ref_id"]) && is_array(
$_POST[
"mq_id"]))
2127 foreach (
$_POST[
"mq_id"] as $id)
2129 $this->
object->deleteMediaQuery($id);
2132 $ilCtrl->redirect($this,
"listMediaQueries");
2145 if (is_array(
$_POST[
"order"]))
2147 $this->
object->saveMediaQueryOrder(
$_POST[
"order"]);
2149 $ilCtrl->redirect($this,
"listMediaQueries");
2164 $ctype =
$_GET[
"temp_type"];
2168 $ilCtrl->setParameter($this,
"temp_type", $ctype);
2169 $_GET[
"temp_type"] = $ctype;
2173 $ilTabs->setSubTabActive(
"sty_".$ctype.
"_templates");
2176 include_once(
"./Services/Style/classes/class.ilTableTemplatesTableGUI.php");
2179 $tpl->setContent($table_gui->getHTML());
2191 $tpl->setContent($this->form_gui->getHTML());
2201 $ilCtrl->setParameter($this,
"t_id",
$_GET[
"t_id"]);
2214 $this->
object, $a_type, $a_t_id, $a_small_mode);
2231 $ts = $a_style->getTemplate($a_t_id);
2232 $t = $ts[
"classes"];
2235 if ($a_type ==
"table")
2237 $p_content =
'<PageContent><Table DataTable="y"';
2238 if (
$t[
"row_head"] !=
"")
2240 $p_content.=
' HeaderRows="1"';
2242 if (
$t[
"row_foot"] !=
"")
2244 $p_content.=
' FooterRows="1"';
2246 if (
$t[
"col_head"] !=
"")
2248 $p_content.=
' HeaderCols="1"';
2250 if (
$t[
"col_foot"] !=
"")
2252 $p_content.=
' FooterCols="1"';
2254 $p_content.=
' Template="'.$a_style->lookupTemplateName($a_t_id).
'">';
2257 $p_content.=
'<Caption>'.$lng->txt(
"sty_caption").
'</Caption>';
2259 for($i = 1; $i<=$kr; $i++)
2261 $p_content.=
'<TableRow>';
2262 for($j = 1; $j<=$kc; $j++)
2266 $cell =
'<div style="height:2px;"></div>';
2272 $p_content.=
'<TableData><PageContent><Paragraph Characteristic="TableContent">'.$cell.
'</Paragraph></PageContent></TableData>';
2274 $p_content.=
'</TableRow>';
2276 $p_content.=
'</Table></PageContent>';
2279 if ($a_type ==
"vaccordion" || $a_type ==
"haccordion")
2281 include_once(
"./Services/Accordion/classes/class.ilAccordionGUI.php");
2294 if ($a_type ==
"vaccordion")
2296 $p_content =
'<PageContent><Tabs HorizontalAlign="Left" Type="VerticalAccordion" ';
2299 $p_content.=
' ContentWidth="70"';
2304 $p_content =
'<PageContent><Tabs Type="HorizontalAccordion"';
2307 $p_content.=
' ContentHeight="40"';
2308 $p_content.=
' ContentWidth="70"';
2309 $c =
'&nbsp;&nbsp;&nbsp;&nbsp;';
2313 $p_content.=
' ContentHeight="40"';
2316 $p_content.=
' Template="'.$a_style->lookupTemplateName($a_t_id).
'">';
2317 $p_content.=
'<Tab><PageContent><Paragraph>'.$c.
'</Paragraph></PageContent>';
2318 $p_content.=
'<TabCaption>'.$h.
'</TabCaption>';
2319 $p_content.=
'</Tab>';
2320 $p_content.=
'</Tabs></PageContent>';
2323 $txml = $a_style->getTemplateXML();
2326 include_once(
"./Services/COPage/classes/class.ilPCTableGUI.php");
2339 include_once(
"Services/Form/classes/class.ilPropertyFormGUI.php");
2342 if ($a_mode ==
"create")
2344 $this->form_gui->setTitle($lng->txt(
"sty_add_template"));
2348 $this->form_gui->setTitle($lng->txt(
"sty_edit_template"));
2352 $name_input =
new ilRegExpInputGUI($lng->txt(
"sty_template_name"),
"name");
2353 $name_input->
setPattern(
"/^[a-zA-Z]+[a-zA-Z0-9]*$/");
2354 $name_input->setNoMatchMessage($lng->txt(
"sty_msg_color_must_only_include").
" A-Z, a-z, 1-9");
2355 $name_input->setRequired(
true);
2356 $name_input->setSize(30);
2357 $name_input->setMaxLength(30);
2358 $this->form_gui->addItem($name_input);
2362 foreach ($scs as $sc => $st)
2364 $sc_input =
new ilSelectInputGUI($lng->txt(
"sty_".$sc.
"_class"), $sc.
"_class");
2365 $chars = $this->
object->getCharacteristics($st);
2367 foreach($chars as $char)
2372 $this->form_gui->addItem($sc_input);
2375 if ($a_mode ==
"create")
2377 $this->form_gui->addCommandButton(
"saveTemplate", $lng->txt(
"save"));
2378 $this->form_gui->addCommandButton(
"cancelTemplateSaving", $lng->txt(
"cancel"));
2382 $this->form_gui->addCommandButton(
"refreshTemplate", $lng->txt(
"save_refresh"));
2383 $this->form_gui->addCommandButton(
"updateTemplate", $lng->txt(
"save_return"));
2384 $this->form_gui->addCommandButton(
"cancelTemplateSaving", $lng->txt(
"cancel"));
2386 $this->form_gui->setFormAction($ilCtrl->getFormAction($this));
2396 $ilCtrl->redirect($this,
"listTemplates");
2409 if ($this->form_gui->checkInput())
2411 if ($this->object->templateExists(
$_POST[
"name"]))
2413 $name_input = $this->form_gui->getItemByPostVar(
"name");
2414 $name_input->setAlert($lng->txt(
"sty_table_template_already_exists"));
2421 $classes[$tct] =
$_POST[$tct.
"_class"];
2423 $t_id = $this->
object->addTemplate(
$_GET[
"temp_type"],
$_POST[
"name"], $classes);
2424 $this->
object->writeTemplatePreview($t_id,
2426 $ilCtrl->redirect($this,
"listTemplates");
2429 $this->form_gui->setValuesByPost();
2430 $tpl->setContent($this->form_gui->getHTML());
2440 $ilCtrl->setParameter($this,
"t_id",
$_GET[
"t_id"]);
2443 if ($this->form_gui->checkInput())
2445 if ($this->object->templateExists(
$_POST[
"name"]) &&
2448 $name_input = $this->form_gui->getItemByPostVar(
"name");
2449 $name_input->setAlert($lng->txt(
"sty_template_already_exists"));
2456 $classes[$tct] =
$_POST[$tct.
"_class"];
2459 $this->
object->updateTemplate(
$_GET[
"t_id"],
2460 $_POST[
"name"], $classes);
2461 $this->
object->writeTemplatePreview(
$_GET[
"t_id"],
2465 $ilCtrl->redirect($this,
"listTemplates");
2470 $this->form_gui->setValuesByPost();
2481 $a_tpl =
new ilTemplate(
"tpl.template_edit.html",
true,
true,
2484 $a_tpl->setVariable(
"FORM", $this->form_gui->getHTML());
2486 $tpl->setContent($a_tpl->get());
2502 if (
$_GET[
"t_id"] > 0)
2504 $t = $this->
object->getTemplate(
$_GET[
"t_id"]);
2506 $values[
"name"] =
$t[
"name"];
2508 foreach ($scs as $k => $type)
2510 $values[$k.
"_class"] =
$t[
"classes"][$k];
2512 $this->form_gui->setValuesByArray($values);
2523 if (!is_array(
$_POST[
"tid"]) || count(
$_POST[
"tid"]) == 0)
2526 $ilCtrl->redirect($this,
"listTemplates");
2530 include_once(
"./Services/Utilities/classes/class.ilConfirmationGUI.php");
2532 $cgui->setFormAction($ilCtrl->getFormAction($this));
2533 $cgui->setHeaderText($lng->txt(
"sty_confirm_template_deletion"));
2534 $cgui->setCancel($lng->txt(
"cancel"),
"cancelTemplateDeletion");
2535 $cgui->setConfirm($lng->txt(
"sty_del_template"),
"deleteTemplate");
2537 foreach (
$_POST[
"tid"] as $tid)
2539 $classes = $this->
object->getTemplateClasses($tid);
2542 foreach ($classes as $cl)
2544 if ($cl !=
"" && !$listed[$cl])
2546 $cl_str.=
'<div>- '.
2548 $listed[$cl] =
true;
2553 $cl_str =
'<div style="padding-left:30px;" class="small">'.
2554 "<div><i>".$lng->txt(
"sty_style_class").
"</i></div>".$cl_str.
"</div>";
2556 $cgui->addItem(
"tid[]", $tid, $this->object->lookupTemplateName($tid).$cl_str);
2559 $cgui->addButton($lng->txt(
"sty_del_template_keep_classes"),
"deleteTemplateKeepClasses");
2561 $tpl->setContent($cgui->getHTML());
2572 $ilCtrl->redirect($this,
"listTemplates");
2582 if (is_array(
$_POST[
"tid"]))
2584 foreach (
$_POST[
"tid"] as $tid)
2586 $this->
object->removeTemplate($tid);
2590 $ilCtrl->redirect($this,
"listTemplates");
2600 if (is_array(
$_POST[
"tid"]))
2602 foreach (
$_POST[
"tid"] as $tid)
2604 $cls = $this->
object->getTemplateClasses($tid);
2605 foreach ($cls as $k => $cls)
2607 $ty = $this->
object->determineTemplateStyleClassType(
$_GET[
"temp_type"], $k);
2609 $this->
object->deleteCharacteristic($ty, $ta, $cls);
2611 $this->
object->removeTemplate($tid);
2615 $ilCtrl->redirect($this,
"listTemplates");
2626 $tpl->setContent($this->form_gui->getHTML());
2636 include_once(
"Services/Form/classes/class.ilPropertyFormGUI.php");
2639 $this->form_gui->setTitle($lng->txt(
"sty_generate_template"));
2642 $name_input =
new ilRegExpInputGUI($lng->txt(
"sty_template_name"),
"name");
2643 $name_input->
setPattern(
"/^[a-zA-Z]+[a-zA-Z0-9]*$/");
2644 $name_input->setNoMatchMessage($lng->txt(
"sty_msg_color_must_only_include").
" A-Z, a-z, 1-9");
2645 $name_input->setRequired(
true);
2646 $name_input->setSize(30);
2647 $name_input->setMaxLength(30);
2648 $this->form_gui->addItem($name_input);
2651 $bl_input =
new ilSelectInputGUI($lng->txt(
"sty_template_layout"),
"layout");
2653 "coloredZebra" => $lng->txt(
"sty_table_template_colored_zebra"),
2654 "bwZebra" => $lng->txt(
"sty_table_template_bw_zebra"),
2655 "noZebra" => $lng->txt(
"sty_table_template_no_zebra")
2657 $bl_input->setOptions($options);
2658 $this->form_gui->addItem($bl_input);
2661 include_once(
"./Services/Style/classes/class.ilNumericStyleValueInputGUI.php");
2664 $num_input->setValue(
"3px");
2665 $this->form_gui->addItem($num_input);
2670 $num_input->setValue(
"10px");
2671 $this->form_gui->addItem($num_input);
2674 $bc_input =
new ilSelectInputGUI($lng->txt(
"sty_base_color"),
"base_color");
2675 $cs = $this->
object->getColors();
2679 $options[$c[
"name"]] = $c[
"name"];
2682 $this->form_gui->addItem($bc_input);
2685 $lss = array(
"border" => 90,
"header_text" => 70,
"header_bg" => 0,
2686 "cell1_text" => -60,
"cell1_bg" => 90,
"cell2_text" => -60,
"cell2_bg" => 75);
2687 foreach ($lss as $ls => $v)
2689 $l_input =
new ilNumberInputGUI($lng->txt(
"sty_lightness_".$ls),
"lightness_".$ls);
2691 $l_input->setMinValue(-100);
2692 $l_input->setValue($v);
2693 $l_input->setSize(4);
2694 $l_input->setMaxLength(4);
2695 $this->form_gui->addItem($l_input);
2698 $this->form_gui->addCommandButton(
"templateGeneration", $lng->txt(
"generate"));
2699 $this->form_gui->addCommandButton(
"cancelTemplateSaving", $lng->txt(
"cancel"));
2700 $this->form_gui->setFormAction($ilCtrl->getFormAction($this));
2712 if ($this->form_gui->checkInput())
2714 if ($this->object->templateExists(
$_POST[
"name"]))
2716 $name_input = $this->form_gui->getItemByPostVar(
"name");
2717 $name_input->setAlert($lng->txt(
"sty_table_template_already_exists"));
2724 $cells = array(
"H" =>
"header",
"C1" =>
"cell1",
"C2" =>
"cell2");
2725 $tb_p = $this->form_gui->getItemByPostVar(
"tb_padding");
2726 $tb_padding = $tb_p->getValue();
2727 $lr_p = $this->form_gui->getItemByPostVar(
"lr_padding");
2728 $lr_padding = $lr_p->getValue();
2729 $cell_color =
$_POST[
"base_color"];
2732 if (
$_POST[
"layout"] ==
"bwZebra")
2734 $cell_color =
"MidGray";
2735 if (!$this->object->colorExists($cell_color))
2737 $this->
object->addColor($cell_color,
"7F7F7F");
2739 $this->
object->updateColor($cell_color, $cell_color,
"7F7F7F");
2742 foreach ($cells as $k => $cell)
2744 $cell_class[$k] =
$_POST[
"name"].$k;
2745 if (!$this->object->characteristicExists($cell_class[$k],
"table_cell"))
2747 $this->
object->addCharacteristic(
"table_cell", $cell_class[$k],
true);
2749 if (
$_POST[
"layout"] ==
"bwZebra" && $k ==
"H")
2751 $this->
object->replaceStylePar(
"td", $cell_class[$k],
"color",
2752 "!".
$_POST[
"base_color"].
"(".
$_POST[
"lightness_".$cell.
"_text"].
")",
"table_cell");
2753 $this->
object->replaceStylePar(
"td", $cell_class[$k],
"background-color",
2754 "!".$_POST[
"base_color"].
"(".$_POST[
"lightness_".$cell.
"_bg"].
")",
"table_cell");
2758 $this->
object->replaceStylePar(
"td", $cell_class[$k],
"color",
2759 "!".$cell_color.
"(".
$_POST[
"lightness_".$cell.
"_text"].
")",
"table_cell");
2760 $this->
object->replaceStylePar(
"td", $cell_class[$k],
"background-color",
2761 "!".$cell_color.
"(".
$_POST[
"lightness_".$cell.
"_bg"].
")",
"table_cell");
2763 $this->
object->replaceStylePar(
"td", $cell_class[$k],
"padding-top",
2764 $tb_padding,
"table_cell");
2765 $this->
object->replaceStylePar(
"td", $cell_class[$k],
"padding-bottom",
2766 $tb_padding,
"table_cell");
2767 $this->
object->replaceStylePar(
"td", $cell_class[$k],
"padding-left",
2768 $lr_padding,
"table_cell");
2769 $this->
object->replaceStylePar(
"td", $cell_class[$k],
"padding-right",
2770 $lr_padding,
"table_cell");
2771 $this->
object->replaceStylePar(
"td", $cell_class[$k],
"border-width",
2772 "1px",
"table_cell");
2773 $this->
object->replaceStylePar(
"td", $cell_class[$k],
"border-style",
2774 "solid",
"table_cell");
2775 $this->
object->replaceStylePar(
"td", $cell_class[$k],
"border-color",
2776 "!".$cell_color.
"(".
$_POST[
"lightness_border"].
")",
"table_cell");
2777 $this->
object->replaceStylePar(
"td", $cell_class[$k],
"font-weight",
2778 "normal",
"table_cell");
2782 $classes[
"table"] =
$_POST[
"name"].
"T";
2783 if (!$this->object->characteristicExists($classes[
"table"],
"table"))
2785 $this->
object->addCharacteristic(
"table", $classes[
"table"],
true);
2787 $this->
object->replaceStylePar(
"table", $classes[
"table"],
"caption-side",
2789 $this->
object->replaceStylePar(
"table", $classes[
"table"],
"border-collapse",
2790 "collapse",
"table");
2791 $this->
object->replaceStylePar(
"table", $classes[
"table"],
"margin-top",
2793 $this->
object->replaceStylePar(
"table", $classes[
"table"],
"margin-bottom",
2795 if (
$_POST[
"layout"] ==
"bwZebra")
2797 $this->
object->replaceStylePar(
"table", $classes[
"table"],
"border-bottom-color",
2798 "!".
$_POST[
"base_color"],
"table");
2799 $this->
object->replaceStylePar(
"table", $classes[
"table"],
"border-bottom-style",
2801 $this->
object->replaceStylePar(
"table", $classes[
"table"],
"border-bottom-width",
2803 $sb = array(
"left",
"right",
"top");
2806 $this->
object->replaceStylePar(
"table", $classes[
"table"],
"border-".$b.
"-width",
2811 switch (
$_POST[
"layout"])
2813 case "coloredZebra":
2814 $classes[
"row_head"] = $cell_class[
"H"];
2815 $classes[
"odd_row"] = $cell_class[
"C1"];
2816 $classes[
"even_row"] = $cell_class[
"C2"];
2820 $classes[
"row_head"] = $cell_class[
"H"];
2821 $classes[
"odd_row"] = $cell_class[
"C1"];
2822 $classes[
"even_row"] = $cell_class[
"C2"];
2826 $classes[
"row_head"] = $cell_class[
"H"];
2827 $classes[
"odd_row"] = $cell_class[
"C1"];
2828 $classes[
"even_row"] = $cell_class[
"C1"];
2829 $classes[
"col_head"] = $cell_class[
"C2"];
2834 $t_id = $this->
object->addTemplate(
$_GET[
"temp_type"],
2835 $_POST[
"name"], $classes);
2836 $this->
object->writeTemplatePreview($t_id,
2838 $ilCtrl->redirect($this,
"listTemplates");
2841 $this->form_gui->setValuesByPost();
2842 $tpl->setContent($this->form_gui->getHTML());
2849 include_once(
"./Services/Accordion/classes/class.ilAccordionGUI.php");
2852 $acc->addItem(
"Header 1", str_repeat(
"bla bla bla bla bla bla", 30));
2853 $acc->addItem(
"Header 2", str_repeat(
"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx xx x xx x xx", 30));
2857 $ac2->addItem(
"Header 1", str_repeat(
"bla bla bla bla bla bla", 30));
2858 $ac2->addItem(
"Header 2", $acc->getHTML());
2861 $tpl->setContent($ac2->getHTML());
2871 if (
$_GET[
"baseClass"] ==
"ilAdministrationGUI")
2873 $ilCtrl->redirectByClass(
"ilobjstylesettingsgui",
"editContentStyles");
2875 $ilCtrl->returnToParent($this);