4 require_once
"./Services/Object/classes/class.ilObjectGUI.php";
5 require_once
"./Services/Style/classes/class.ilObjStyleSheet.php";
33 $this->lng->loadLanguageModule(
"style");
34 $ilCtrl->saveParameter($this, array(
"tag",
"style_type",
"temp_type"));
35 if (
$_GET[
"style_type"] !=
"")
41 $this->
ilObjectGUI($a_data,$a_id,$a_call_by_reference,
false);
49 $next_class = $this->ctrl->getNextClass($this);
50 $cmd = $this->ctrl->getCmd(
"edit");
80 global $rbacsystem,
$lng,
$tpl, $ilHelp;
85 $ilHelp->setScreenIdComponent(
"sty");
90 include_once
"Services/Form/classes/class.ilPropertyFormGUI.php";
92 $form->setFormAction($this->ctrl->getFormAction($this));
93 $form->setTitle($this->lng->txt(
"sty_create_new_stylesheet"));
99 $ti->setRequired(
true);
108 $form->addCommandButton(
"save", $this->lng->txt(
"save"));
109 $form->addCommandButton(
"cancel", $this->lng->txt(
"cancel"));
116 include_once
"Services/Form/classes/class.ilPropertyFormGUI.php";
118 $form->setFormAction($this->ctrl->getFormAction($this));
119 $form->setTitle($this->lng->txt(
"sty_import_stylesheet"));
122 $ti =
new ilFileInputGUI($this->lng->txt(
"import_file"),
"importfile");
126 $form->addCommandButton(
"importStyle", $this->lng->txt(
"import"));
127 $form->addCommandButton(
"cancel", $this->lng->txt(
"cancel"));
134 include_once
"Services/Form/classes/class.ilPropertyFormGUI.php";
136 $form->setFormAction($this->ctrl->getFormAction($this));
137 $form->setTitle($this->lng->txt(
"sty_copy_other_stylesheet"));
145 $form->addCommandButton(
"copyStyle", $this->lng->txt(
"copy"));
146 $form->addCommandButton(
"cancel", $this->lng->txt(
"cancel"));
160 $this->tpl->setCurrentBlock(
"ContentStyle");
161 $this->tpl->setVariable(
"LOCATION_CONTENT_STYLESHEET",
162 $this->object->getContentStylePath($this->object->getId()));
163 $this->tpl->parseCurrentBlock();
177 $ctpl =
new ilTemplate(
"tpl.sty_classes.html",
true,
true,
"Services/Style");
180 $chars = $this->
object->getCharacteristics();
182 $style_type = ($this->super_type !=
"")
185 $ilCtrl->setParameter($this,
"style_type", $style_type);
186 $ilTabs->setSubTabActive(
"sty_".$style_type.
"_char");
189 if ($this->super_type ==
"rte")
191 $tpl->addCss(
"Modules/Scorm2004/templates/default/player.css");
192 include_once(
"./Modules/Scorm2004/classes/ilSCORM13Player.php");
193 $tpl->addInlineCss(ilSCORM13Player::getInlineCss());
198 $subtypes = $all_super_types[$style_type];
200 foreach ($subtypes as
$t)
207 if ($expandable && $rbacsystem->checkAccess(
"write", (
int)
$_GET[
"ref_id"]))
209 $ilToolbar->addButton($lng->txt(
"sty_add_characteristic"),
210 $ilCtrl->getLinkTarget($this,
"addCharacteristicForm"));
216 $style_cp = explode(
":::",
$_SESSION[
"sty_copy"]);
217 if ($style_cp[1] == $style_type)
222 $ilToolbar->addSeparator();
224 $ilToolbar->addButton($lng->txt(
"sty_paste_style_classes"),
225 $ilCtrl->getLinkTarget($this,
"pasteCharacteristicsOverview"));
229 include_once(
"./Services/Style/classes/class.ilStyleTableGUI.php");
233 $ctpl->setCurrentBlock(
"style_table");
234 $ctpl->setVariable(
"STYLE_TABLE", $table_gui->getHTML());
235 $ctpl->parseCurrentBlock();
237 $this->tpl->setContent($ctpl->get());
245 global $rbacsystem,
$lng, $ilToolbar;
248 $this->tpl->setCurrentBlock(
"ContentStyle");
249 $this->tpl->setVariable(
"LOCATION_CONTENT_STYLESHEET",
250 $this->object->getContentStylePath($this->object->getId()));
251 $this->tpl->parseCurrentBlock();
254 $ilToolbar->addButton($this->lng->txt(
"export"),
255 $this->ctrl->getLinkTarget($this,
"exportStyle"));
259 $this->tpl->setContent($this->form->getHTML());
270 $values[
"style_title"] = $this->
object->getTitle();
271 $values[
"style_description"] = $this->
object->getDescription();
272 $values[
"disable_auto_margins"] = (int) $this->object->lookupStyleSetting(
"disable_auto_margins");
274 $this->form->setValuesByArray($values);
284 global
$lng, $rbacsystem;
286 include_once(
"Services/Form/classes/class.ilPropertyFormGUI.php");
290 $ti =
new ilTextInputGUI($this->lng->txt(
"title"),
"style_title");
293 $ti->setRequired(
true);
294 $this->form->addItem($ti);
300 $this->form->addItem($ta);
303 $cb =
new ilCheckboxInputGUI($this->lng->txt(
"sty_disable_auto_margins"),
"disable_auto_margins");
304 $cb->
setInfo($this->lng->txt(
"sty_disable_auto_margins_info"));
305 $this->form->addItem($cb);
309 if ($a_mode ==
"create")
311 $this->form->addCommandButton(
"save", $lng->txt(
"save"));
312 $this->form->addCommandButton(
"cancelSave", $lng->txt(
"cancel"));
316 if ($rbacsystem->checkAccess(
"write", (
int)
$_GET[
"ref_id"]))
318 $this->form->addCommandButton(
"update", $lng->txt(
"save"));
322 $this->form->setTitle($lng->txt(
"edit_stylesheet"));
323 $this->form->setFormAction($this->ctrl->getFormAction($this));
335 if ($this->form->checkInput())
337 $this->
object->setTitle($this->form->getInput(
"style_title"));
338 $this->
object->setDescription($this->form->getInput(
"style_description"));
339 $this->
object->writeStyleSetting(
"disable_auto_margins",
340 $this->form->getInput(
"disable_auto_margins"));
341 $this->
object->update();
343 $ilCtrl->redirect($this,
"properties");
347 $this->form->setValuesByPost();
348 $tpl->setContent($this->form->getHtml());
359 $cur = explode(
".",
$_GET[
"tag"]);
361 $cur_class = $cur[1];
365 if ($this->form_gui->checkInput())
368 $ilCtrl->redirect($this,
"editTagStyle");
372 $this->form_gui->setValuesByPost();
384 $cur = explode(
".",
$_GET[
"tag"]);
386 $cur_class = $cur[1];
389 if ($this->form_gui->checkInput())
392 $ilCtrl->redirect($this,
"edit");
396 $this->form_gui->setValuesByPost();
406 $cur = explode(
".",
$_GET[
"tag"]);
408 $cur_class = $cur[1];
410 foreach ($avail_pars as $par => $v)
412 $var = str_replace(
"-",
"_", $par);
413 $basepar_arr = explode(
".", $par);
414 $basepar = $basepar_arr[0];
415 if ($basepar_arr[1] !=
"" && $basepar_arr[1] != $cur_tag)
423 case "numeric_no_perc":
425 case "background_image":
426 $in = $this->form_gui->getItemByPostVar($basepar);
432 $color = trim(
$_POST[$basepar]);
433 if ($color !=
"" && trim(substr($color,0,1) !=
"!"))
443 $in = $this->form_gui->getItemByPostVar($basepar);
444 $this->
writeStylePar($cur_tag, $cur_class, $v[
"subpar"][0],
$in->getAllValue(), $_GET[
"style_type"], (int) $_GET[
"mq_id"]);
445 $this->
writeStylePar($cur_tag, $cur_class, $v[
"subpar"][1],
$in->getTopValue(), $_GET[
"style_type"], (int) $_GET[
"mq_id"]);
446 $this->
writeStylePar($cur_tag, $cur_class, $v[
"subpar"][2],
$in->getRightValue(), $_GET[
"style_type"], (int) $_GET[
"mq_id"]);
447 $this->
writeStylePar($cur_tag, $cur_class, $v[
"subpar"][3],
$in->getBottomValue(), $_GET[
"style_type"], (int) $_GET[
"mq_id"]);
448 $this->
writeStylePar($cur_tag, $cur_class, $v[
"subpar"][4],
$in->getLeftValue(), $_GET[
"style_type"], (int) $_GET[
"mq_id"]);
452 $in = $this->form_gui->getItemByPostVar($basepar);
453 $tblr_p = array (0 =>
"getAllValue", 1 =>
"getTopValue", 2 =>
"getRightValue",
454 3 =>
"getBottomValue", 4 =>
"getLeftValue");
455 foreach ($tblr_p as $k => $func)
457 $val = trim(
$in->$func());
458 $val = ((
$in->getAcceptNamedColors() && substr($val, 0, 1) ==
"!")
462 $this->
writeStylePar($cur_tag, $cur_class, $v[
"subpar"][$k], $val, $_GET[
"style_type"], (
int) $_GET[
"mq_id"]);
466 case "background_position":
467 $in = $this->form_gui->getItemByPostVar($basepar);
468 $this->
writeStylePar($cur_tag, $cur_class, $basepar,
$in->getValue(), $_GET[
"style_type"], (int) $_GET[
"mq_id"]);
472 $this->
writeStylePar($cur_tag, $cur_class, $basepar,
$_POST[$basepar], $_GET[
"style_type"], (
int) $_GET[
"mq_id"]);
478 $this->
object->deleteCustomStylePars($cur_tag, $cur_class,
$_GET[
"style_type"], (
int)
$_GET[
"mq_id"]);
479 if (is_array(
$_POST[
"custom_par"]))
481 foreach (
$_POST[
"custom_par"] as $cpar)
483 $par_arr = explode(
":", $cpar);
484 if (count($par_arr) == 2)
486 $par = trim($par_arr[0]);
487 $val = trim(str_replace(
";",
"", $par_arr[1]));
488 $this->
writeStylePar($cur_tag, $cur_class, $par, $val, $_GET[
"style_type"], (
int) $_GET[
"mq_id"],
true);
493 $this->
object->update();
496 function writeStylePar($cur_tag, $cur_class, $par, $value, $a_type, $a_mq_id, $a_custom =
false)
507 $this->
object->replaceStylePar($cur_tag, $cur_class, $par, $value, $a_type, $a_mq_id, $a_custom);
511 $this->
object->deleteStylePar($cur_tag, $cur_class, $par, $a_type, $a_mq_id, $a_custom);
524 $mqs = $this->
object->getMediaQueries();
529 "" => $lng->txt(
"sty_default"),
531 foreach ($mqs as $mq)
533 $options[$mq[
"id"]] = $mq[
"mquery"];
535 include_once(
"./Services/Form/classes/class.ilSelectInputGUI.php");
538 $si->setValue((
int)
$_GET[
"mq_id"]);
539 $ilToolbar->addInputItem(
$si,
true);
540 $ilToolbar->setFormAction($ilCtrl->getFormAction($this));
541 $ilToolbar->addFormButton($lng->txt(
"sty_switch"),
"switchMQuery");
546 if ($this->super_type ==
"rte")
548 $tpl->addCss(
"Modules/Scorm2004/templates/default/player.css");
549 include_once(
"./Modules/Scorm2004/classes/ilSCORM13Player.php");
550 $tpl->addInlineCss(ilSCORM13Player::getInlineCss());
553 $cur = explode(
".",
$_GET[
"tag"]);
555 $cur_class = $cur[1];
572 $ilCtrl->setParameter($this,
"mq_id", (
int)
$_POST[
"mq_id"]);
573 $ilCtrl->redirect($this,
"editTagStyle");
585 $tpl->setCurrentBlock(
"ContentStyle");
586 $tpl->setVariable(
"LOCATION_CONTENT_STYLESHEET",
587 $this->object->getContentStylePath($this->object->getId()));
589 $ts_tpl =
new ilTemplate(
"tpl.style_tag_edit.html",
true,
true,
"Services/Style");
591 $cur = explode(
".",
$_GET[
"tag"]);
593 $cur_class = $cur[1];
595 $ts_tpl->setVariable(
"EXAMPLE",
598 $ts_tpl->setVariable(
"FORM",
599 $this->form_gui->getHtml());
601 $tpl->setTitle($cur_class.
" (".$lng->txt(
"sty_type_".$_GET[
"style_type"]).
")");
603 $tpl->setContent($ts_tpl->get());
616 $ilCtrl->saveParameter($this, array(
"mq_id"));
618 include_once(
"Services/Form/classes/class.ilPropertyFormGUI.php");
621 $avail_pars = $this->
object->getAvailableParameters();
622 $groups = $this->
object->getStyleParameterGroups();
625 foreach ($groups as $k => $group)
630 if (is_array($filtered_groups[$k]) && !in_array($a_cur_tag, $filtered_groups[$k]))
636 $sh->setTitle($lng->txt(
"sty_".$k));
637 $this->form_gui->addItem($sh);
639 foreach ($group as $par)
641 $basepar = explode(
".", $par);
642 $basepar = $basepar[0];
644 $var = str_replace(
"-",
"_", $basepar);
645 $up_par = strtoupper($var);
652 foreach ($avail_pars[$par] as $p)
657 $this->form_gui->addItem($sel_input);
661 $text_input =
new ilTextInputGUI($lng->txt(
"sty_".$var), $basepar);
663 $text_input->setSize(20);
664 $this->form_gui->addItem($text_input);
668 include_once(
"./Services/Style/classes/class.ilFontSizeInputGUI.php");
670 $this->form_gui->addItem($fs_input);
673 case "numeric_no_perc":
675 include_once(
"./Services/Style/classes/class.ilNumericStyleValueInputGUI.php");
681 $this->form_gui->addItem($num_input);
687 $per_input->setMaxValue(100);
688 $per_input->setMaxLength(3);
689 $per_input->setSize(3);
690 $this->form_gui->addItem($per_input);
697 $col_input->setAcceptNamedColors(
true);
698 $this->form_gui->addItem($col_input);
702 include_once(
"./Services/Style/classes/class.ilTRBLNumericStyleValueInputGUI.php");
708 $this->form_gui->addItem($num_input);
712 include_once(
"./Services/Style/classes/class.ilTRBLBorderWidthInputGUI.php");
714 $this->form_gui->addItem($bw_input);
718 include_once(
"./Services/Style/classes/class.ilTRBLBorderStyleInputGUI.php");
720 $this->form_gui->addItem($bw_input);
724 include_once(
"./Services/Style/classes/class.ilTRBLColorPickerInputGUI.php");
727 $this->form_gui->addItem($col_input);
730 case "background_image":
731 include_once(
"./Services/Style/classes/class.ilBackgroundImageInputGUI.php");
734 foreach ($this->object->getImages() as $entry)
736 $imgs[] = $entry[
"entry"];
739 $this->form_gui->addItem($im_input);
742 case "background_position":
743 include_once(
"./Services/Style/classes/class.ilBackgroundPositionInputGUI.php");
745 $this->form_gui->addItem($im_input);
753 $sh->setTitle($lng->txt(
"sty_custom"));
754 $this->form_gui->addItem($sh);
757 $ti =
new ilTextInputGUI($this->lng->txt(
"sty_custom_par"),
"custom_par");
761 $ti->setInfo($this->lng->txt(
"sty_custom_par_info"));
762 $this->form_gui->addItem($ti);
766 $this->form_gui->addCommandButton(
"updateTagStyle", $lng->txt(
"save_return"));
767 $this->form_gui->addCommandButton(
"refreshTagStyle", $lng->txt(
"save_refresh"));
770 $this->form_gui->setFormAction($this->ctrl->getFormAction($this));
779 $style = $this->
object->getStyle();
780 $cur = explode(
".",
$_GET[
"tag"]);
782 $cur_class = $cur[1];
784 (
int)
$_GET[
"mq_id"],
false);
786 foreach($parameters as $p => $v)
789 if (is_array($filtered_groups[$v[
"group"]]) && !in_array($cur_tag, $filtered_groups[$v[
"group"]]))
793 $p = explode(
".", $p);
795 $input = $this->form_gui->getItemByPostVar($p);
805 $input->setAllValue($cur_parameters[$v[
"subpar"][0]]);
806 $input->setTopValue($cur_parameters[$v[
"subpar"][1]]);
807 $input->setRightValue($cur_parameters[$v[
"subpar"][2]]);
808 $input->setBottomValue($cur_parameters[$v[
"subpar"][3]]);
809 $input->setLeftValue($cur_parameters[$v[
"subpar"][4]]);
813 $input->setValue($cur_parameters[$p]);
819 (
int) $_GET[
"mq_id"],
true);
821 foreach ($cust_parameters as $k => $c)
823 $vals[] = $k.
": ".$c;
825 $input = $this->form_gui->getItemByPostVar(
"custom_par");
826 $input->setValue($vals);
834 include_once(
"./Services/Export/classes/class.ilExport.php");
836 $r = $exp->exportObject($this->object->getType(),$this->
object->getId());
843 $parameters = array();
844 foreach($a_style as $tag)
846 foreach($tag as $par)
848 if ($par[
"tag"] == $a_tag && $par[
"class"] == $a_class
849 && $par[
"type"] == $a_type && (
int) $a_mq_id == (
int) $par[
"mq_id"]
850 && (
int) $a_custom == (
int) $par[
"custom"])
852 $parameters[$par[
"parameter"]] = $par[
"value"];
864 $this->
object->addParameter(
$_POST[
"tag"],
$_POST[
"parameter"]);
873 $this->
object->setTitle(
$_POST[
"style_title"]);
874 $this->
object->setDescription(
$_POST[
"style_description"]);
876 foreach(
$_POST[
"styval"] as $id => $value)
878 $this->
object->updateStyleParameter($id, $value);
880 $this->
object->update();
894 include_once(
"./Services/Utilities/classes/class.ilConfirmationGUI.php");
896 $cgui->setFormAction($this->ctrl->getFormAction($this));
897 $cgui->setHeaderText($this->lng->txt(
"info_delete_sure"));
898 $cgui->setCancel($this->lng->txt(
"cancel"),
"cancelDelete");
899 $cgui->setConfirm($this->lng->txt(
"confirm"),
"confirmedDelete");
902 " ".ilObject::_lookupTitle($this->object->getId());
904 $cgui->addItem(
"id[]",
"", $caption);
906 $this->tpl->setContent($cgui->getHTML());
915 $this->ctrl->returnToParent($this);
925 $this->
object->delete();
927 $this->ctrl->returnToParent($this);
935 if (is_array(
$_POST[
"sty_select"]))
937 foreach(
$_POST[
"sty_select"] as $id => $dummy)
939 $this->
object->deleteParameter($id);
942 $this->
object->read();
943 $this->
object->writeCSSFile();
952 if(!trim(
$_POST[
"style_title"]))
954 $this->ctrl->redirect($this,
"create");
958 $class_name =
"ilObjStyleSheet";
959 require_once(
"./Services/Style/classes/class.ilObjStyleSheet.php");
961 $newObj->setTitle(
"-");
969 if (
$_GET[
"ref_id"] > 0)
973 if ($fold->getType() ==
"stys")
975 $fold->addStyle($newObj->getId());
978 $this->ctrl->redirectByClass(
"ilobjstylesettingsgui",
"editContentStyles");
982 return $newObj->getId();
992 if (
$_POST[
"source_style"] > 0)
993 $style_obj =& $ilias->obj_factory->getInstanceByObjId(
$_POST[
"source_style"]);
994 $new_id = $style_obj->ilClone();
998 if (
$_GET[
"ref_id"] > 0)
1002 if ($fold->getType() ==
"stys")
1004 $fold->addStyle($new_id);
1007 $this->ctrl->redirectByClass(
"ilobjstylesettingsgui",
"editContentStyles");
1020 $source = $_FILES[
"importfile"][
"tmp_name"];
1021 if (($source ==
'none') || (!$source))
1023 $this->
ilias->raiseError(
"No file selected!",$this->
ilias->error_obj->MESSAGE);
1027 $info = pathinfo($_FILES[
"importfile"][
"name"]);
1028 if (strtolower(
$info[
"extension"]) !=
"zip" && strtolower(
$info[
"extension"]) !=
"xml")
1030 $this->
ilias->raiseError(
"File must be a zip or xml file!",$this->
ilias->error_obj->MESSAGE);
1034 $fname = explode(
"_", $_FILES[
"importfile"][
"name"]);
1035 if (strtolower(
$info[
"extension"]) ==
"zip" && $fname[4] ==
"sty")
1037 include_once(
"./Services/Export/classes/class.ilImport.php");
1039 $new_id = $imp->importObject(null, $_FILES[
"importfile"][
"tmp_name"],
1040 $_FILES[
"importfile"][
"name"],
"sty");
1048 require_once(
"./Services/Style/classes/class.ilObjStyleSheet.php");
1050 $newObj->import($_FILES[
"importfile"]);
1055 if (
$_GET[
"ref_id"] > 0)
1058 if ($fold->getType() ==
"stys")
1060 $fold->addStyle($newObj->getId());
1063 $this->ctrl->redirectByClass(
"ilobjstylesettingsgui",
"editContentStyles");
1066 return $newObj->getId();
1089 $this->ctrl->returnToParent($this);
1107 $this->
getTabs($this->tabs_gui);
1109 if (strtolower(get_class($this->
object)) ==
"ilobjstylesheet")
1111 $this->tpl->setVariable(
"HEADER", $this->object->getTitle());
1115 $this->tpl->setVariable(
"HEADER", $lng->txt(
"create_stylesheet"));
1128 $ilHelp->setScreenIdComponent(
"sty");
1130 if ($ilCtrl->getCmd() ==
"editTagStyle")
1133 $tabs_gui->setBackTarget($lng->txt(
"back"),
1134 $ilCtrl->getLinkTarget($this,
"edit"));
1136 $t = explode(
".",
$_GET[
"tag"]);
1137 $t2 = explode(
":",
$t[1]);
1138 $pc = $this->
object->_getPseudoClasses(
$t[0]);
1139 if (is_array($pc) && count($pc) > 0)
1142 $ilCtrl->setParameter($this,
"tag",
$t[0].
".".$t2[0]);
1143 $tabs_gui->addTarget(
"sty_tag_normal",
1144 $this->ctrl->getLinkTarget($this,
"editTagStyle"), array(
"editTagStyle",
""),
1148 $ilTabs->setTabActive(
"sty_tag_normal");
1154 $ilCtrl->setParameter($this,
"tag",
$t[0].
".".$t2[0].
":".$p);
1155 $tabs_gui->addTarget(
"sty_tag_".$p,
1156 $this->ctrl->getLinkTarget($this,
"editTagStyle"), array(
"editTagStyle",
""),
1160 $ilTabs->setTabActive(
"sty_tag_".$p);
1163 $ilCtrl->setParameter($this,
"tag",
$_GET[
"tag"]);
1169 $tabs_gui->setBackTarget($lng->txt(
"back"),
1170 $this->ctrl->getLinkTarget($this,
"returnToUpperContext"));
1173 $tabs_gui->addTarget(
"sty_style_chars",
1174 $this->ctrl->getLinkTarget($this,
"edit"), array(
"edit",
""),
1178 $tabs_gui->addTarget(
"sty_colors",
1179 $this->ctrl->getLinkTarget($this,
"listColors"),
"listColors",
1183 $tabs_gui->addTarget(
"sty_media_queries",
1184 $this->ctrl->getLinkTarget($this,
"listMediaQueries"),
"listMediaQueries",
1188 $tabs_gui->addTarget(
"sty_images",
1189 $this->ctrl->getLinkTarget($this,
"listImages"),
"listImages",
1193 $tabs_gui->addTarget(
"sty_templates",
1194 $this->ctrl->getLinkTarget($this,
"listTemplates"),
"listTemplates",
1198 $tabs_gui->addTarget(
"settings",
1199 $this->ctrl->getLinkTarget($this,
"properties"),
"properties",
1222 foreach ($types as $super_type => $types)
1225 $ilCtrl->setParameter($this,
"style_type", $super_type);
1226 $ilTabs->addSubTabTarget(
"sty_".$super_type.
"_char",
1227 $this->ctrl->getLinkTarget($this,
"edit"), array(
"edit",
""),
1231 $ilCtrl->setParameter($this,
"style_type",
$_GET[
"style_type"]);
1245 foreach ($types as
$t => $c)
1247 $ilCtrl->setParameter($this,
"temp_type",
$t);
1248 $ilTabs->addSubTabTarget(
"sty_".
$t.
"_templates",
1249 $this->ctrl->getLinkTarget($this,
"listTemplates"), array(
"listTemplates",
""),
1253 $ilCtrl->setParameter($this,
"temp_type",
$_GET[
"temp_type"]);
1264 if (
$_GET[
"admin_mode"] ==
"settings")
1266 parent::addAdminLocatorItems(
true);
1270 $this->ctrl->getLinkTargetByClass(
"ilobjstylesettingsgui",
"view"));
1272 if (
$_GET[
"obj_id"] > 0)
1274 $ilLocator->addItem($this->object->getTitle(),
1275 $this->ctrl->getLinkTarget($this,
"edit"));
1289 if (strtolower(
$_GET[
"baseClass"]) ==
"iladministrationgui")
1292 $this->ctrl->getLinkTargetByClass(
"ilobjstylesettingsgui",
1293 "editContentStyles"));
1308 if ($rbacsystem->checkAccess(
"write", (
int)
$_GET[
"ref_id"]))
1310 $ilToolbar->addButton($lng->txt(
"sty_add_image"),
1311 $ilCtrl->getLinkTarget($this,
"addImage"));
1314 include_once(
"./Services/Style/classes/class.ilStyleImageTableGUI.php");
1317 $tpl->setContent($table_gui->getHTML());
1329 $tpl->setContent($this->form_gui->getHTML());
1339 $ilCtrl->redirect($this,
"listImages");
1351 if ($this->form_gui->checkInput())
1353 $this->
object->uploadImage($_FILES[
"image_file"]);
1354 $ilCtrl->redirect($this,
"listImages");
1359 $tpl->setContent($this->form_gui->getHTML());
1371 include_once(
"Services/Form/classes/class.ilPropertyFormGUI.php");
1374 $this->form_gui->setTitle($lng->txt(
"sty_add_image"));
1378 $this->form_gui->addItem($file_input);
1380 $this->form_gui->addCommandButton(
"uploadImage", $lng->txt(
"upload"));
1381 $this->form_gui->addCommandButton(
"cancelUpload", $lng->txt(
"cancel"));
1382 $this->form_gui->setFormAction($ilCtrl->getFormAction($this));
1392 $images = $this->
object->getImages();
1394 foreach ($images as $image)
1396 if (is_array(
$_POST[
"file"]) && in_array($image[
"entry"],
$_POST[
"file"]))
1398 $this->
object->deleteImage($image[
"entry"]);
1401 $ilCtrl->redirect($this,
"listImages");
1413 if (!is_array(
$_POST[
"char"]) || count(
$_POST[
"char"]) == 0)
1416 $ilCtrl->redirect($this,
"edit");
1422 foreach (
$_POST[
"char"] as $char)
1424 if (!empty($core_styles[$char]))
1431 include_once(
"./Services/Utilities/classes/class.ilConfirmationGUI.php");
1433 $cgui->setFormAction($ilCtrl->getFormAction($this));
1434 $cgui->setHeaderText($lng->txt(
"sty_confirm_char_deletion"));
1435 $cgui->setCancel($lng->txt(
"cancel"),
"cancelCharacteristicDeletion");
1436 $cgui->setConfirm($lng->txt(
"delete"),
"deleteCharacteristic");
1438 foreach (
$_POST[
"char"] as $char)
1440 $char_comp = explode(
".", $char);
1441 $cgui->addItem(
"char[]", $char, $char_comp[2]);
1444 $tpl->setContent($cgui->getHTML());
1458 include_once(
"./Services/Utilities/classes/class.ilConfirmationGUI.php");
1460 $cgui->setFormAction($ilCtrl->getFormAction($this));
1465 foreach (
$_POST[
"char"] as $char)
1467 if (!empty($core_styles[$char]))
1470 $char_comp = explode(
".", $char);
1471 $cgui->addItem(
"",
"", $char_comp[2]);
1475 $cgui->addHiddenItem(
"char[]", $char);
1478 $all_core_styles = ($cnt == count(
$_POST[
"char"]))
1482 if ($all_core_styles)
1484 $cgui->setHeaderText($lng->txt(
"sty_all_styles_obligatory"));
1485 $cgui->setCancel($lng->txt(
"back"),
"cancelCharacteristicDeletion");
1489 $cgui->setHeaderText($lng->txt(
"sty_some_styles_obligatory_delete_rest"));
1490 $cgui->setCancel($lng->txt(
"cancel"),
"cancelCharacteristicDeletion");
1491 $cgui->setConfirm($lng->txt(
"sty_delete_other_selected"),
"deleteCharacteristicConfirmation");
1494 $tpl->setContent($cgui->getHTML());
1505 $ilCtrl->redirect($this,
"edit");
1515 if (is_array(
$_POST[
"char"]))
1517 foreach(
$_POST[
"char"] as $char)
1519 $char_comp = explode(
".", $char);
1520 $type = $char_comp[0];
1521 $tag = $char_comp[1];
1522 $class = $char_comp[2];
1524 $this->
object->deleteCharacteristic($type, $tag, $class);
1528 $ilCtrl->redirect($this,
"edit");
1539 $tpl->setContent($this->form_gui->getHTML());
1551 if ($this->form_gui->checkInput())
1553 if ($this->object->characteristicExists(
$_POST[
"new_characteristic"],
$_GET[
"style_type"]))
1555 $char_input = $this->form_gui->getItemByPostVar(
"new_characteristic");
1556 $char_input->setAlert($lng->txt(
"sty_characteristic_already_exists"));
1560 $this->
object->addCharacteristic(
$_POST[
"type"],
$_POST[
"new_characteristic"]);
1562 $ilCtrl->setParameter($this,
"tag",
1564 $ilCtrl->setParameter($this,
"style_type", $_POST[
"type"]);
1565 $ilCtrl->redirect($this,
"editTagStyle");
1568 $this->form_gui->setValuesByPost();
1569 $tpl->setContent($this->form_gui->getHTML());
1581 include_once(
"Services/Form/classes/class.ilPropertyFormGUI.php");
1585 $txt_input =
new ilRegExpInputGUI($lng->txt(
"title"),
"new_characteristic");
1586 $txt_input->
setPattern(
"/^[a-zA-Z]+[a-zA-Z0-9]*$/");
1587 $txt_input->setNoMatchMessage($lng->txt(
"sty_msg_characteristic_must_only_include").
" A-Z, a-z, 1-9");
1588 $txt_input->setRequired(
true);
1589 $this->form_gui->addItem($txt_input);
1593 $types = $all_super_types[$this->super_type];
1594 $exp_types = array();
1595 foreach($types as
$t)
1599 $exp_types[
$t] = $lng->txt(
"sty_type_".$t);
1602 if (count($exp_types) > 1)
1606 $type_input->setValue(key($exp_types));
1607 $this->form_gui->addItem($type_input);
1609 else if (count($exp_types) == 1)
1612 $hid_input->setValue(key($exp_types));
1613 $this->form_gui->addItem($hid_input);
1616 $this->form_gui->setTitle($lng->txt(
"sty_add_characteristic"));
1617 $this->form_gui->addCommandButton(
"saveCharacteristic", $lng->txt(
"save"));
1618 $this->form_gui->addCommandButton(
"edit", $lng->txt(
"cancel"));
1619 $this->form_gui->setFormAction($ilCtrl->getFormAction($this));
1629 $c = explode(
":", $a_class);
1632 $ex_tpl =
new ilTemplate(
"tpl.style_example.html",
true,
true,
"Services/Style");
1634 if ($ex_tpl->blockExists(
"Example_".$a_type))
1636 $ex_tpl->setCurrentBlock(
"Example_".$a_type);
1640 $ex_tpl->setCurrentBlock(
"Example_default");
1642 $ex_tpl->setVariable(
"EX_CLASS",
"ilc_".$a_type.
"_".$a_class);
1643 $ex_tpl->setVariable(
"EX_TEXT",
"ABC abc 123");
1644 if (in_array($a_type, array(
"media_cont",
"qimg")))
1648 if (in_array($a_type, array(
"table",
"table_caption")))
1650 $ex_tpl->setVariable(
"TXT_CAPTION", $lng->txt(
"sty_caption"));
1652 if (in_array($a_class, array(
"OrderListItemHorizontal",
"OrderListHorizontal")))
1654 $ex_tpl->setVariable(
"HOR",
"Horizontal");
1656 $ex_tpl->parseCurrentBlock();
1658 return $ex_tpl->get();
1670 foreach (
$_POST[
"all_chars"] as $char)
1672 $ca = explode(
".", $char);
1673 $this->
object->saveHideStatus($ca[0], $ca[2],
1674 (is_array(
$_POST[
"hide"]) && in_array($char,
$_POST[
"hide"])));
1678 $ilCtrl->redirect($this,
"edit");
1691 if (!is_array(
$_POST[
"char"]) || count(
$_POST[
"char"]) == 0)
1697 $style_cp = implode(
"::",
$_POST[
"char"]);
1698 $style_cp = $this->
object->getId().
":::".
$_GET[
"style_type"].
":::".$style_cp;
1702 $ilCtrl->redirect($this,
"edit");
1713 global
$tpl, $ilTabs;
1715 $ilTabs->clearTargets();
1717 include_once(
"./Services/Style/classes/class.ilPasteStyleCharacteristicTableGUI.php");
1720 $tpl->setContent($table->getHTML());
1733 if (is_array(
$_POST[
"title"]))
1735 foreach (
$_POST[
"title"] as $from_char => $to_title)
1737 $fc = explode(
".", $from_char);
1739 if (
$_POST[
"conflict_action"][$from_char] ==
"overwrite" ||
1740 !$this->object->characteristicExists($to_title, $fc[0]))
1742 $this->
object->copyCharacteristic(
$_POST[
"from_style_id"],
1743 $fc[0], $fc[2], $to_title);
1751 $ilCtrl->redirect($this,
"edit");
1765 if ($rbacsystem->checkAccess(
"write", (
int)
$_GET[
"ref_id"]))
1767 $ilToolbar->addButton($this->lng->txt(
"sty_add_color"),
1768 $ilCtrl->getLinkTarget($this,
"addColor"));
1771 include_once(
"./Services/Style/classes/class.ilStyleColorTableGUI.php");
1774 $tpl->setContent($table_gui->getHTML());
1786 $tpl->setContent($this->form_gui->getHTML());
1796 $ilCtrl->setParameter($this,
"c_name",
$_GET[
"c_name"]);
1799 $tpl->setContent($this->form_gui->getHTML());
1810 include_once(
"Services/Form/classes/class.ilPropertyFormGUI.php");
1813 $this->form_gui->setTitle($lng->txt(
"sty_add_color"));
1816 $name_input =
new ilRegExpInputGUI($lng->txt(
"sty_color_name"),
"color_name");
1817 $name_input->
setPattern(
"/^[a-zA-Z]+[a-zA-Z0-9]*$/");
1818 $name_input->setNoMatchMessage($lng->txt(
"sty_msg_color_must_only_include").
" A-Z, a-z, 1-9");
1819 $name_input->setRequired(
true);
1820 $name_input->setSize(15);
1821 $name_input->setMaxLength(15);
1822 $this->form_gui->addItem($name_input);
1827 $color_input->setDefaultColor(
"");
1828 $this->form_gui->addItem($color_input);
1830 if ($a_mode ==
"create")
1832 $this->form_gui->addCommandButton(
"saveColor", $lng->txt(
"save"));
1833 $this->form_gui->addCommandButton(
"cancelColorSaving", $lng->txt(
"cancel"));
1837 $this->form_gui->addCommandButton(
"updateColor", $lng->txt(
"save"));
1838 $this->form_gui->addCommandButton(
"cancelColorSaving", $lng->txt(
"cancel"));
1840 $this->form_gui->setFormAction($ilCtrl->getFormAction($this));
1848 if (
$_GET[
"c_name"] !=
"")
1850 $values[
"color_name"] =
$_GET[
"c_name"];
1851 $values[
"color_code"] = $this->
object->getColorCodeForName(
$_GET[
"c_name"]);
1852 $this->form_gui->setValuesByArray($values);
1863 $ilCtrl->redirect($this,
"listColors");
1875 if ($this->form_gui->checkInput())
1877 if ($this->object->colorExists(
$_POST[
"color_name"]))
1879 $col_input = $this->form_gui->getItemByPostVar(
"color_name");
1880 $col_input->setAlert($lng->txt(
"sty_color_already_exists"));
1884 $this->
object->addColor(
$_POST[
"color_name"],
1886 $ilCtrl->redirect($this,
"listColors");
1889 $this->form_gui->setValuesByPost();
1890 $tpl->setContent($this->form_gui->getHTML());
1902 if ($this->form_gui->checkInput())
1904 if ($this->object->colorExists(
$_POST[
"color_name"]) &&
1907 $col_input = $this->form_gui->getItemByPostVar(
"color_name");
1908 $col_input->setAlert($lng->txt(
"sty_color_already_exists"));
1912 $this->
object->updateColor(
$_GET[
"c_name"],
$_POST[
"color_name"],
1914 $ilCtrl->redirect($this,
"listColors");
1917 $ilCtrl->setParameter($this,
"c_name",
$_GET[
"c_name"]);
1918 $this->form_gui->setValuesByPost();
1919 $tpl->setContent($this->form_gui->getHTML());
1929 if (!is_array(
$_POST[
"color"]) || count(
$_POST[
"color"]) == 0)
1932 $ilCtrl->redirect($this,
"listColors");
1936 include_once(
"./Services/Utilities/classes/class.ilConfirmationGUI.php");
1938 $cgui->setFormAction($ilCtrl->getFormAction($this));
1939 $cgui->setHeaderText($lng->txt(
"sty_confirm_color_deletion"));
1940 $cgui->setCancel($lng->txt(
"cancel"),
"cancelColorDeletion");
1941 $cgui->setConfirm($lng->txt(
"delete"),
"deleteColor");
1943 foreach (
$_POST[
"color"] as $c)
1948 $tpl->setContent($cgui->getHTML());
1959 $ilCtrl->redirect($this,
"listColors");
1969 if (is_array(
$_POST[
"color"]))
1971 foreach (
$_POST[
"color"] as $c)
1973 $this->
object->removeColor($c);
1977 $ilCtrl->redirect($this,
"listColors");
1991 if ($rbacsystem->checkAccess(
"write", (
int)
$_GET[
"ref_id"]))
1993 $ilToolbar->addButton($this->lng->txt(
"sty_add_media_query"),
1994 $ilCtrl->getLinkTarget($this,
"addMediaQuery"));
1997 include_once(
"./Services/Style/classes/class.ilStyleMediaQueryTableGUI.php");
2000 $tpl->setContent($table_gui->getHTML());
2011 $tpl->setContent($this->form_gui->getHTML());
2021 $ilCtrl->setParameter($this,
"mq_id",
$_GET[
"mq_id"]);
2024 $tpl->setContent($this->form_gui->getHTML());
2035 include_once(
"Services/Form/classes/class.ilPropertyFormGUI.php");
2038 $this->form_gui->setTitle($lng->txt(
"sty_add_media_query"));
2042 $ti->setMaxLength(2000);
2043 $this->form_gui->addItem($ti);
2046 if ($a_mode ==
"create")
2048 $this->form_gui->addCommandButton(
"saveMediaQuery", $lng->txt(
"save"));
2049 $this->form_gui->addCommandButton(
"listMediaQueries", $lng->txt(
"cancel"));
2053 $this->form_gui->addCommandButton(
"updateMediaQuery", $lng->txt(
"save"));
2054 $this->form_gui->addCommandButton(
"listMediaQueries", $lng->txt(
"cancel"));
2056 $this->form_gui->setFormAction($ilCtrl->getFormAction($this));
2064 if (
$_GET[
"mq_id"] !=
"")
2066 foreach ($this->object->getMediaQueries() as $mq)
2068 if ($mq[
"id"] == (
int)
$_GET[
"mq_id"])
2070 $values[
"mquery"] = $mq[
"mquery"];
2073 $this->form_gui->setValuesByArray($values);
2086 if ($this->form_gui->checkInput())
2088 $this->
object->addMediaQuery(
$_POST[
"mquery"]);
2089 $ilCtrl->redirect($this,
"listMediaQueries");
2091 $this->form_gui->setValuesByPost();
2092 $tpl->setContent($this->form_gui->getHTML());
2104 if ($this->form_gui->checkInput())
2106 $this->
object->updateMediaQuery((
int)
$_GET[
"mq_id"],
$_POST[
"mquery"]);
2107 $ilCtrl->redirect($this,
"listMediaQueries");
2109 $ilCtrl->setParameter($this,
"mq_id",
$_GET[
"mq_id"]);
2110 $this->form_gui->setValuesByPost();
2111 $tpl->setContent($this->form_gui->getHTML());
2121 if (!is_array(
$_POST[
"mq_id"]) || count(
$_POST[
"mq_id"]) == 0)
2124 $ilCtrl->redirect($this,
"listMediaQueries");
2128 include_once(
"./Services/Utilities/classes/class.ilConfirmationGUI.php");
2130 $cgui->setFormAction($ilCtrl->getFormAction($this));
2131 $cgui->setHeaderText($lng->txt(
"sty_sure_del_mqueries"));
2132 $cgui->setCancel($lng->txt(
"cancel"),
"listMediaQueries");
2133 $cgui->setConfirm($lng->txt(
"delete"),
"deleteMediaQueries");
2135 foreach (
$_POST[
"mq_id"] as $i)
2137 $mq = $this->
object->getMediaQueryForId($i);
2138 $cgui->addItem(
"mq_id[]", $i, $mq[
"mquery"]);
2141 $tpl->setContent($cgui->getHTML());
2155 if ($rbacsystem->checkAccess(
"write", (
int)
$_GET[
"ref_id"]) && is_array(
$_POST[
"mq_id"]))
2157 foreach (
$_POST[
"mq_id"] as $id)
2159 $this->
object->deleteMediaQuery($id);
2162 $ilCtrl->redirect($this,
"listMediaQueries");
2175 if (is_array(
$_POST[
"order"]))
2177 $this->
object->saveMediaQueryOrder(
$_POST[
"order"]);
2179 $ilCtrl->redirect($this,
"listMediaQueries");
2194 $ctype =
$_GET[
"temp_type"];
2198 $ilCtrl->setParameter($this,
"temp_type", $ctype);
2199 $_GET[
"temp_type"] = $ctype;
2203 $ilTabs->setSubTabActive(
"sty_".$ctype.
"_templates");
2206 include_once(
"./Services/Style/classes/class.ilTableTemplatesTableGUI.php");
2209 $tpl->setContent($table_gui->getHTML());
2221 $tpl->setContent($this->form_gui->getHTML());
2231 $ilCtrl->setParameter($this,
"t_id",
$_GET[
"t_id"]);
2244 $this->
object, $a_type, $a_t_id, $a_small_mode);
2261 $ts = $a_style->getTemplate($a_t_id);
2262 $t = $ts[
"classes"];
2265 if ($a_type ==
"table")
2267 $p_content =
'<PageContent><Table DataTable="y"';
2268 if (
$t[
"row_head"] !=
"")
2270 $p_content.=
' HeaderRows="1"';
2272 if (
$t[
"row_foot"] !=
"")
2274 $p_content.=
' FooterRows="1"';
2276 if (
$t[
"col_head"] !=
"")
2278 $p_content.=
' HeaderCols="1"';
2280 if (
$t[
"col_foot"] !=
"")
2282 $p_content.=
' FooterCols="1"';
2284 $p_content.=
' Template="'.$a_style->lookupTemplateName($a_t_id).
'">';
2287 $p_content.=
'<Caption>'.$lng->txt(
"sty_caption").
'</Caption>';
2289 for($i = 1; $i<=$kr; $i++)
2291 $p_content.=
'<TableRow>';
2292 for($j = 1; $j<=$kc; $j++)
2296 $cell =
'<div style="height:2px;"></div>';
2302 $p_content.=
'<TableData><PageContent><Paragraph Characteristic="TableContent">'.$cell.
'</Paragraph></PageContent></TableData>';
2304 $p_content.=
'</TableRow>';
2306 $p_content.=
'</Table></PageContent>';
2309 if ($a_type ==
"vaccordion" || $a_type ==
"haccordion" || $a_type ==
"carousel")
2311 include_once(
"./Services/Accordion/classes/class.ilAccordionGUI.php");
2324 if ($a_type ==
"vaccordion")
2326 $p_content =
'<PageContent><Tabs HorizontalAlign="Left" Type="VerticalAccordion" ';
2329 $p_content.=
' ContentWidth="70"';
2332 else if ($a_type ==
"haccordion")
2334 $p_content =
'<PageContent><Tabs Type="HorizontalAccordion"';
2337 $p_content.=
' ContentHeight="40"';
2338 $p_content.=
' ContentWidth="70"';
2339 $c =
'&nbsp;&nbsp;&nbsp;&nbsp;';
2343 $p_content.=
' ContentHeight="40"';
2346 else if ($a_type ==
"carousel")
2348 $p_content =
'<PageContent><Tabs HorizontalAlign="Left" Type="Carousel" ';
2351 $p_content.=
' ContentWidth="70"';
2356 $p_content.=
' Template="'.$a_style->lookupTemplateName($a_t_id).
'">';
2357 $p_content.=
'<Tab><PageContent><Paragraph>'.$c.
'</Paragraph></PageContent>';
2358 $p_content.=
'<TabCaption>'.$h.
'</TabCaption>';
2359 $p_content.=
'</Tab>';
2360 $p_content.=
'</Tabs></PageContent>';
2363 $txml = $a_style->getTemplateXML();
2366 include_once(
"./Services/COPage/classes/class.ilPCTableGUI.php");
2370 if($a_type ==
"carousel")
2372 $r_content.=
"<style>.owl-carousel{ display:block !important; }</style>";
2386 include_once(
"Services/Form/classes/class.ilPropertyFormGUI.php");
2389 if ($a_mode ==
"create")
2391 $this->form_gui->setTitle($lng->txt(
"sty_add_template"));
2395 $this->form_gui->setTitle($lng->txt(
"sty_edit_template"));
2399 $name_input =
new ilRegExpInputGUI($lng->txt(
"sty_template_name"),
"name");
2400 $name_input->
setPattern(
"/^[a-zA-Z]+[a-zA-Z0-9]*$/");
2401 $name_input->setNoMatchMessage($lng->txt(
"sty_msg_color_must_only_include").
" A-Z, a-z, 1-9");
2402 $name_input->setRequired(
true);
2403 $name_input->setSize(30);
2404 $name_input->setMaxLength(30);
2405 $this->form_gui->addItem($name_input);
2409 foreach ($scs as $sc => $st)
2411 $sc_input =
new ilSelectInputGUI($lng->txt(
"sty_".$sc.
"_class"), $sc.
"_class");
2412 $chars = $this->
object->getCharacteristics($st);
2414 foreach($chars as $char)
2419 $this->form_gui->addItem($sc_input);
2422 if ($a_mode ==
"create")
2424 $this->form_gui->addCommandButton(
"saveTemplate", $lng->txt(
"save"));
2425 $this->form_gui->addCommandButton(
"cancelTemplateSaving", $lng->txt(
"cancel"));
2429 $this->form_gui->addCommandButton(
"refreshTemplate", $lng->txt(
"save_refresh"));
2430 $this->form_gui->addCommandButton(
"updateTemplate", $lng->txt(
"save_return"));
2431 $this->form_gui->addCommandButton(
"cancelTemplateSaving", $lng->txt(
"cancel"));
2433 $this->form_gui->setFormAction($ilCtrl->getFormAction($this));
2443 $ilCtrl->redirect($this,
"listTemplates");
2456 if ($this->form_gui->checkInput())
2458 if ($this->object->templateExists(
$_POST[
"name"]))
2460 $name_input = $this->form_gui->getItemByPostVar(
"name");
2461 $name_input->setAlert($lng->txt(
"sty_table_template_already_exists"));
2468 $classes[$tct] =
$_POST[$tct.
"_class"];
2470 $t_id = $this->
object->addTemplate(
$_GET[
"temp_type"],
$_POST[
"name"], $classes);
2471 $this->
object->writeTemplatePreview($t_id,
2473 $ilCtrl->redirect($this,
"listTemplates");
2476 $this->form_gui->setValuesByPost();
2477 $tpl->setContent($this->form_gui->getHTML());
2487 $ilCtrl->setParameter($this,
"t_id",
$_GET[
"t_id"]);
2490 if ($this->form_gui->checkInput())
2492 if ($this->object->templateExists(
$_POST[
"name"]) &&
2495 $name_input = $this->form_gui->getItemByPostVar(
"name");
2496 $name_input->setAlert($lng->txt(
"sty_template_already_exists"));
2503 $classes[$tct] =
$_POST[$tct.
"_class"];
2506 $this->
object->updateTemplate(
$_GET[
"t_id"],
2507 $_POST[
"name"], $classes);
2508 $this->
object->writeTemplatePreview(
$_GET[
"t_id"],
2512 $ilCtrl->redirect($this,
"listTemplates");
2517 $this->form_gui->setValuesByPost();
2528 $a_tpl =
new ilTemplate(
"tpl.template_edit.html",
true,
true,
2531 $a_tpl->setVariable(
"FORM", $this->form_gui->getHTML());
2533 $tpl->setContent($a_tpl->get());
2549 if (
$_GET[
"t_id"] > 0)
2551 $t = $this->
object->getTemplate(
$_GET[
"t_id"]);
2553 $values[
"name"] =
$t[
"name"];
2555 foreach ($scs as $k => $type)
2557 $values[$k.
"_class"] =
$t[
"classes"][$k];
2559 $this->form_gui->setValuesByArray($values);
2570 if (!is_array(
$_POST[
"tid"]) || count(
$_POST[
"tid"]) == 0)
2573 $ilCtrl->redirect($this,
"listTemplates");
2577 include_once(
"./Services/Utilities/classes/class.ilConfirmationGUI.php");
2579 $cgui->setFormAction($ilCtrl->getFormAction($this));
2580 $cgui->setHeaderText($lng->txt(
"sty_confirm_template_deletion"));
2581 $cgui->setCancel($lng->txt(
"cancel"),
"cancelTemplateDeletion");
2582 $cgui->setConfirm($lng->txt(
"sty_del_template"),
"deleteTemplate");
2584 foreach (
$_POST[
"tid"] as $tid)
2586 $classes = $this->
object->getTemplateClasses($tid);
2589 foreach ($classes as $cl)
2591 if ($cl !=
"" && !$listed[$cl])
2593 $cl_str.=
'<div>- '.
2595 $listed[$cl] =
true;
2600 $cl_str =
'<div style="padding-left:30px;" class="small">'.
2601 "<div><i>".$lng->txt(
"sty_style_class").
"</i></div>".$cl_str.
"</div>";
2603 $cgui->addItem(
"tid[]", $tid, $this->object->lookupTemplateName($tid).$cl_str);
2606 $cgui->addButton($lng->txt(
"sty_del_template_keep_classes"),
"deleteTemplateKeepClasses");
2608 $tpl->setContent($cgui->getHTML());
2619 $ilCtrl->redirect($this,
"listTemplates");
2629 if (is_array(
$_POST[
"tid"]))
2631 foreach (
$_POST[
"tid"] as $tid)
2633 $this->
object->removeTemplate($tid);
2637 $ilCtrl->redirect($this,
"listTemplates");
2647 if (is_array(
$_POST[
"tid"]))
2649 foreach (
$_POST[
"tid"] as $tid)
2651 $cls = $this->
object->getTemplateClasses($tid);
2652 foreach ($cls as $k => $cls)
2654 $ty = $this->
object->determineTemplateStyleClassType(
$_GET[
"temp_type"], $k);
2656 $this->
object->deleteCharacteristic($ty, $ta, $cls);
2658 $this->
object->removeTemplate($tid);
2662 $ilCtrl->redirect($this,
"listTemplates");
2673 $tpl->setContent($this->form_gui->getHTML());
2683 include_once(
"Services/Form/classes/class.ilPropertyFormGUI.php");
2686 $this->form_gui->setTitle($lng->txt(
"sty_generate_template"));
2689 $name_input =
new ilRegExpInputGUI($lng->txt(
"sty_template_name"),
"name");
2690 $name_input->
setPattern(
"/^[a-zA-Z]+[a-zA-Z0-9]*$/");
2691 $name_input->setNoMatchMessage($lng->txt(
"sty_msg_color_must_only_include").
" A-Z, a-z, 1-9");
2692 $name_input->setRequired(
true);
2693 $name_input->setSize(30);
2694 $name_input->setMaxLength(30);
2695 $this->form_gui->addItem($name_input);
2698 $bl_input =
new ilSelectInputGUI($lng->txt(
"sty_template_layout"),
"layout");
2700 "coloredZebra" => $lng->txt(
"sty_table_template_colored_zebra"),
2701 "bwZebra" => $lng->txt(
"sty_table_template_bw_zebra"),
2702 "noZebra" => $lng->txt(
"sty_table_template_no_zebra")
2704 $bl_input->setOptions($options);
2705 $this->form_gui->addItem($bl_input);
2708 include_once(
"./Services/Style/classes/class.ilNumericStyleValueInputGUI.php");
2711 $num_input->setValue(
"3px");
2712 $this->form_gui->addItem($num_input);
2717 $num_input->setValue(
"10px");
2718 $this->form_gui->addItem($num_input);
2721 $bc_input =
new ilSelectInputGUI($lng->txt(
"sty_base_color"),
"base_color");
2722 $cs = $this->
object->getColors();
2726 $options[$c[
"name"]] = $c[
"name"];
2729 $this->form_gui->addItem($bc_input);
2732 $lss = array(
"border" => 90,
"header_text" => 70,
"header_bg" => 0,
2733 "cell1_text" => -60,
"cell1_bg" => 90,
"cell2_text" => -60,
"cell2_bg" => 75);
2734 foreach ($lss as $ls => $v)
2736 $l_input =
new ilNumberInputGUI($lng->txt(
"sty_lightness_".$ls),
"lightness_".$ls);
2738 $l_input->setMinValue(-100);
2739 $l_input->setValue($v);
2740 $l_input->setSize(4);
2741 $l_input->setMaxLength(4);
2742 $this->form_gui->addItem($l_input);
2745 $this->form_gui->addCommandButton(
"templateGeneration", $lng->txt(
"generate"));
2746 $this->form_gui->addCommandButton(
"cancelTemplateSaving", $lng->txt(
"cancel"));
2747 $this->form_gui->setFormAction($ilCtrl->getFormAction($this));
2759 if ($this->form_gui->checkInput())
2761 if ($this->object->templateExists(
$_POST[
"name"]))
2763 $name_input = $this->form_gui->getItemByPostVar(
"name");
2764 $name_input->setAlert($lng->txt(
"sty_table_template_already_exists"));
2771 $cells = array(
"H" =>
"header",
"C1" =>
"cell1",
"C2" =>
"cell2");
2772 $tb_p = $this->form_gui->getItemByPostVar(
"tb_padding");
2773 $tb_padding = $tb_p->getValue();
2774 $lr_p = $this->form_gui->getItemByPostVar(
"lr_padding");
2775 $lr_padding = $lr_p->getValue();
2776 $cell_color =
$_POST[
"base_color"];
2779 if (
$_POST[
"layout"] ==
"bwZebra")
2781 $cell_color =
"MidGray";
2782 if (!$this->object->colorExists($cell_color))
2784 $this->
object->addColor($cell_color,
"7F7F7F");
2786 $this->
object->updateColor($cell_color, $cell_color,
"7F7F7F");
2789 foreach ($cells as $k => $cell)
2791 $cell_class[$k] =
$_POST[
"name"].$k;
2792 if (!$this->object->characteristicExists($cell_class[$k],
"table_cell"))
2794 $this->
object->addCharacteristic(
"table_cell", $cell_class[$k],
true);
2796 if (
$_POST[
"layout"] ==
"bwZebra" && $k ==
"H")
2798 $this->
object->replaceStylePar(
"td", $cell_class[$k],
"color",
2799 "!".
$_POST[
"base_color"].
"(".
$_POST[
"lightness_".$cell.
"_text"].
")",
"table_cell");
2800 $this->
object->replaceStylePar(
"td", $cell_class[$k],
"background-color",
2801 "!".$_POST[
"base_color"].
"(".$_POST[
"lightness_".$cell.
"_bg"].
")",
"table_cell");
2805 $this->
object->replaceStylePar(
"td", $cell_class[$k],
"color",
2806 "!".$cell_color.
"(".
$_POST[
"lightness_".$cell.
"_text"].
")",
"table_cell");
2807 $this->
object->replaceStylePar(
"td", $cell_class[$k],
"background-color",
2808 "!".$cell_color.
"(".
$_POST[
"lightness_".$cell.
"_bg"].
")",
"table_cell");
2810 $this->
object->replaceStylePar(
"td", $cell_class[$k],
"padding-top",
2811 $tb_padding,
"table_cell");
2812 $this->
object->replaceStylePar(
"td", $cell_class[$k],
"padding-bottom",
2813 $tb_padding,
"table_cell");
2814 $this->
object->replaceStylePar(
"td", $cell_class[$k],
"padding-left",
2815 $lr_padding,
"table_cell");
2816 $this->
object->replaceStylePar(
"td", $cell_class[$k],
"padding-right",
2817 $lr_padding,
"table_cell");
2818 $this->
object->replaceStylePar(
"td", $cell_class[$k],
"border-width",
2819 "1px",
"table_cell");
2820 $this->
object->replaceStylePar(
"td", $cell_class[$k],
"border-style",
2821 "solid",
"table_cell");
2822 $this->
object->replaceStylePar(
"td", $cell_class[$k],
"border-color",
2823 "!".$cell_color.
"(".
$_POST[
"lightness_border"].
")",
"table_cell");
2824 $this->
object->replaceStylePar(
"td", $cell_class[$k],
"font-weight",
2825 "normal",
"table_cell");
2829 $classes[
"table"] =
$_POST[
"name"].
"T";
2830 if (!$this->object->characteristicExists($classes[
"table"],
"table"))
2832 $this->
object->addCharacteristic(
"table", $classes[
"table"],
true);
2834 $this->
object->replaceStylePar(
"table", $classes[
"table"],
"caption-side",
2836 $this->
object->replaceStylePar(
"table", $classes[
"table"],
"border-collapse",
2837 "collapse",
"table");
2838 $this->
object->replaceStylePar(
"table", $classes[
"table"],
"margin-top",
2840 $this->
object->replaceStylePar(
"table", $classes[
"table"],
"margin-bottom",
2842 if (
$_POST[
"layout"] ==
"bwZebra")
2844 $this->
object->replaceStylePar(
"table", $classes[
"table"],
"border-bottom-color",
2845 "!".
$_POST[
"base_color"],
"table");
2846 $this->
object->replaceStylePar(
"table", $classes[
"table"],
"border-bottom-style",
2848 $this->
object->replaceStylePar(
"table", $classes[
"table"],
"border-bottom-width",
2850 $sb = array(
"left",
"right",
"top");
2853 $this->
object->replaceStylePar(
"table", $classes[
"table"],
"border-".$b.
"-width",
2858 switch (
$_POST[
"layout"])
2860 case "coloredZebra":
2861 $classes[
"row_head"] = $cell_class[
"H"];
2862 $classes[
"odd_row"] = $cell_class[
"C1"];
2863 $classes[
"even_row"] = $cell_class[
"C2"];
2867 $classes[
"row_head"] = $cell_class[
"H"];
2868 $classes[
"odd_row"] = $cell_class[
"C1"];
2869 $classes[
"even_row"] = $cell_class[
"C2"];
2873 $classes[
"row_head"] = $cell_class[
"H"];
2874 $classes[
"odd_row"] = $cell_class[
"C1"];
2875 $classes[
"even_row"] = $cell_class[
"C1"];
2876 $classes[
"col_head"] = $cell_class[
"C2"];
2881 $t_id = $this->
object->addTemplate(
$_GET[
"temp_type"],
2882 $_POST[
"name"], $classes);
2883 $this->
object->writeTemplatePreview($t_id,
2885 $ilCtrl->redirect($this,
"listTemplates");
2888 $this->form_gui->setValuesByPost();
2889 $tpl->setContent($this->form_gui->getHTML());
2896 include_once(
"./Services/Accordion/classes/class.ilAccordionGUI.php");
2899 $acc->addItem(
"Header 1", str_repeat(
"bla bla bla bla bla bla", 30));
2900 $acc->addItem(
"Header 2", str_repeat(
"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx xx x xx x xx", 30));
2904 $ac2->addItem(
"Header 1", str_repeat(
"bla bla bla bla bla bla", 30));
2905 $ac2->addItem(
"Header 2", $acc->getHTML());
2908 $tpl->setContent($ac2->getHTML());
2918 if (
$_GET[
"baseClass"] ==
"ilAdministrationGUI")
2920 $ilCtrl->redirectByClass(
"ilobjstylesettingsgui",
"editContentStyles");
2922 $ilCtrl->returnToParent($this);
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
_getTemplatePreview($a_style, $a_type, $a_t_id, $a_small_mode=false)
Get table template preview.
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.
cancelColorDeletionObject()
Cancel color deletion.
deleteMediaQueriesObject()
Delete Media Queries.
Paste style overview table.
getInstanceByRefId($a_ref_id, $stop_on_error=true)
get an instance of an Ilias object by reference id
exportStyleObject()
export style
deleteCharacteristicObject()
Delete one or multiple style characteristic.
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.
_writeStandard($a_id, $a_std)
Write standard flag.
ilObjStyleSheetGUI($a_data, $a_id, $a_call_by_reference, $a_prep=true)
Constructor public.
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.
getTabs(&$tabs_gui)
adds tabs to tab gui object
propertiesObject()
Properties.
getPropertiesValues()
Get current values for properties from.
confirmedDeleteObject()
delete selected style objects
extractParametersOfTag($a_tag, $a_class, $a_style, $a_type, $a_mq_id=0, $a_custom=false)
cancelTemplateDeletionObject()
Cancel table template deletion.
initCharacteristicForm($a_mode)
Init tag style editing form.
updateColorObject()
Update color.
listImagesObject()
List images of style.
getValues()
FORM: Get current values from persistent object.
static _getStyleSuperTypeForType($a_type)
ilObjectGUI($a_data, $a_id=0, $a_call_by_reference=true, $a_prepare_output=true)
Constructor public.
static _lookupTitle($a_id)
lookup object title
addCharacteristicFormObject()
Add characteristic.
setCreationMode($a_mode=true)
if true, a creation screen is displayed the current $_GET[ref_id] don'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.
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.
static _getStyleSuperTypes()
addColorObject()
Add a color.
addImageObject()
Add an image.
lookupTemplateName($a_t_id)
Lookup table template name for template ID.
pasteCharacteristicsOverviewObject()
Paste characteristics overview.
editTagStyleObject()
Edit tag style.
cancelColorSavingObject()
Cancel color saving.
initImageForm()
Init image form.
initPropertiesForm($a_mode="edit")
FORM: Init properties form.
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
getCreationFormsHTML(array $a_forms)
Get HTML for creation forms (accordion)
_getClonableContentStyles()
Get all clonable styles (active standard styles and individual learning module styles with write perm...
cancelCharacteristicDeletionObject()
Cancel characteristic deletion.
saveCharacteristicObject()
Save Characteristic.
static addCss()
Add required css.
if(!is_array($argv)) $options
uploadImageObject()
Upload image.
importStyleObject()
import style sheet
static _isExpandable($a_type)
getMediaQueryFormValues()
Set values for media query editing.
saveMediaQueryOrderObject()
Save media query order.
static _getFilteredGroups()
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
copyStyleObject()
save style sheet
deleteStyleParameterObject()
delete style parameters
This class represents a text property in a property form.
setCols($a_cols)
Set Cols.
returnToUpperContextObject()
return to upper context
redirection script todo: (a better solution should control the processing via a xml file) ...
updateTagStyleObject()
save and refresh tag editing
editColorObject()
Edit color.
setMaxLength($a_maxlength)
Set Max Length.
getInstanceByObjId($a_obj_id, $stop_on_error=true)
get an instance of an Ilias object by object id
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.
TableGUI class for style editor.
templateGenerationObject()
Table template generation.
initTemplateForm($a_mode="create")
Init table template form.
getColorFormValues()
Set values for color editing.
saveColorObject()
Save color.
prepareOutput()
prepare output
includeCSS()
Include CSS in output.
TableGUI class for style editor (image list)
afterImport($a_new_obj)
After import.
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
pasteCharacteristicsObject()
Paste characteristics.
refreshTagStyleObject()
save and refresh tag editing
_writeUpToDate($a_id, $a_up_to_date)
Write up to date.
switchMQueryObject()
Switch media query.
updateTemplateObject($a_refresh=false)
Update table template.
refreshObject()
refresh style sheet
deleteImageObject()
Delete images.
cancelObject()
update style sheet
addTemplateObject()
Add template.
cancelDeleteObject()
cancel oobject deletion
addMediaQueryObject()
Add a media query.
Class ilObjStyleSheetGUI.
saveMediaQueryObject()
Save media query.
initColorForm($a_mode="create")
Init color form.
addAdminLocatorItems()
should be overwritten to add object specific items (repository items are preloaded) ...
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.
static _getStyleParameters($a_tag="")
deleteObject($a_error=false)
display deletion confirmation screen
cancelUploadObject()
Cancel Upload.
copyCharacteristicsObject()
Copy style classes.
listTemplatesObject()
List templates.
cancelTemplateSavingObject()
Cancel color saving.
editTemplateObject()
Edit table template.
getAdminTabs(&$tabs_gui)
admin and normal tabs are equal for roles
updateObject()
Update properties.
static _getStyleParameterInputType($par)
& executeCommand()
execute command
initTemplateGenerationForm()
Init table template generation form.
deleteColorObject()
Delete colors.
Accordion user interface class.
displayTemplateEditForm()
Display table tempalte edit form.
editMediaQueryObject()
Edit media query.
static getStyleExampleHTML($a_type, $a_class)
Get style example HTML.
TableGUI class for style editor (image list)
updateMediaQueryObject()
Update media query.
newStyleParameterObject()
add style parameter
getTemplateFormValues()
Set values for table template editing.
Confirmation screen class.