4require_once
"./Services/Object/classes/class.ilObjectGUI.php";
5require_once
"./Services/Style/Content/classes/class.ilObjStyleSheet.php";
49 public function __construct($a_data, $a_id, $a_call_by_reference, $a_prep =
true)
53 $this->tpl =
$DIC[
"tpl"];
54 $this->rbacsystem =
$DIC->rbac()->system();
55 $this->
help = $DIC[
"ilHelp"];
56 $this->tabs =
$DIC->tabs();
57 $this->toolbar =
$DIC->toolbar();
58 $this->locator =
$DIC[
"ilLocator"];
59 $this->tree =
$DIC->repositoryTree();
60 $this->obj_definition =
$DIC[
"objDefinition"];
61 $ilCtrl =
$DIC->ctrl();
65 $this->ctrl = $ilCtrl;
67 $this->lng->loadLanguageModule(
"style");
68 $ilCtrl->saveParameter($this, array(
"tag",
"style_type",
"temp_type"));
69 if (
$_GET[
"style_type"] !=
"") {
82 $this->enable_write = $a_write;
90 $next_class = $this->ctrl->getNextClass($this);
91 $cmd = $this->ctrl->getCmd(
"edit");
99 switch ($next_class) {
102 $ret = $this->$cmd();
127 $ilHelp->setScreenIdComponent(
"sty");
132 include_once
"Services/Form/classes/class.ilPropertyFormGUI.php";
134 $form->setFormAction($this->ctrl->getFormAction($this));
135 $form->setTitle($this->lng->txt(
"sty_create_new_stylesheet"));
138 $ti =
new ilTextInputGUI($this->lng->txt(
"title"),
"style_title");
139 $ti->setMaxLength(128);
141 $ti->setRequired(
true);
150 $form->addCommandButton(
"save", $this->lng->txt(
"save"));
151 $form->addCommandButton(
"cancel", $this->lng->txt(
"cancel"));
158 include_once
"Services/Form/classes/class.ilPropertyFormGUI.php";
160 $form->setFormAction($this->ctrl->getFormAction($this));
161 $form->setTitle($this->lng->txt(
"sty_import_stylesheet"));
164 $ti =
new ilFileInputGUI($this->lng->txt(
"import_file"),
"importfile");
165 $ti->setRequired(
true);
168 $form->addCommandButton(
"importStyle", $this->lng->txt(
"import"));
169 $form->addCommandButton(
"cancel", $this->lng->txt(
"cancel"));
176 include_once
"Services/Form/classes/class.ilPropertyFormGUI.php";
178 $form->setFormAction($this->ctrl->getFormAction($this));
179 $form->setTitle($this->lng->txt(
"sty_copy_other_stylesheet"));
183 $ti->setRequired(
true);
187 $form->addCommandButton(
"copyStyle", $this->lng->txt(
"copy"));
188 $form->addCommandButton(
"cancel", $this->lng->txt(
"cancel"));
202 $this->tpl->setCurrentBlock(
"ContentStyle");
203 $this->tpl->setVariable(
204 "LOCATION_CONTENT_STYLESHEET",
207 $this->tpl->parseCurrentBlock();
221 return ($this->enable_write ||
$rbacsystem->checkAccess(
"write", (
int)
$_GET[
"ref_id"])
242 $ctpl =
new ilTemplate(
"tpl.sty_classes.html",
true,
true,
"Services/Style/Content");
245 $chars = $this->
object->getCharacteristics();
247 $style_type = ($this->super_type !=
"")
250 $ilCtrl->setParameter($this,
"style_type", $style_type);
251 $ilTabs->setSubTabActive(
"sty_" . $style_type .
"_char");
254 if ($this->super_type ==
"rte") {
255 $tpl->addCss(
"Modules/Scorm2004/templates/default/player.css");
256 $tpl->addInlineCss(ilSCORM13PlayerGUI::getInlineCss());
261 $subtypes = $all_super_types[$style_type];
263 foreach ($subtypes as $t) {
269 $ilToolbar->addButton(
270 $lng->txt(
"sty_add_characteristic"),
271 $ilCtrl->getLinkTarget($this,
"addCharacteristicForm")
276 $style_cp = explode(
":::",
$_SESSION[
"sty_copy"]);
277 if ($style_cp[1] == $style_type) {
279 $ilToolbar->addSeparator();
281 $ilToolbar->addButton(
282 $lng->txt(
"sty_paste_style_classes"),
283 $ilCtrl->getLinkTarget($this,
"pasteCharacteristicsOverview")
288 include_once(
"./Services/Style/Content/classes/class.ilStyleTableGUI.php");
297 $ctpl->setCurrentBlock(
"style_table");
298 $ctpl->setVariable(
"STYLE_TABLE", $table_gui->getHTML());
299 $ctpl->parseCurrentBlock();
301 $this->tpl->setContent($ctpl->get());
314 $this->tpl->setCurrentBlock(
"ContentStyle");
315 $this->tpl->setVariable(
316 "LOCATION_CONTENT_STYLESHEET",
319 $this->tpl->parseCurrentBlock();
322 $ilToolbar->addButton(
323 $this->lng->txt(
"export"),
324 $this->ctrl->getLinkTarget($this,
"exportStyle")
329 $this->tpl->setContent($this->form->getHTML());
340 $values[
"style_title"] = $this->
object->getTitle();
341 $values[
"style_description"] = $this->
object->getDescription();
342 $values[
"disable_auto_margins"] = (int) $this->object->lookupStyleSetting(
"disable_auto_margins");
344 $this->form->setValuesByArray($values);
357 include_once(
"Services/Form/classes/class.ilPropertyFormGUI.php");
361 $ti =
new ilTextInputGUI($this->lng->txt(
"title"),
"style_title");
362 $ti->setMaxLength(128);
364 $ti->setRequired(
true);
365 $this->form->addItem($ti);
371 $this->form->addItem($ta);
374 $cb =
new ilCheckboxInputGUI($this->lng->txt(
"sty_disable_auto_margins"),
"disable_auto_margins");
375 $cb->setInfo($this->lng->txt(
"sty_disable_auto_margins_info"));
376 $this->form->addItem($cb);
380 if ($a_mode ==
"create") {
381 $this->form->addCommandButton(
"save",
$lng->txt(
"save"));
382 $this->form->addCommandButton(
"cancelSave",
$lng->txt(
"cancel"));
385 $this->form->addCommandButton(
"update",
$lng->txt(
"save"));
389 $this->form->setTitle(
$lng->txt(
"edit_stylesheet"));
390 $this->form->setFormAction($this->ctrl->getFormAction($this));
403 if ($this->form->checkInput()) {
404 $this->
object->setTitle($this->form->getInput(
"style_title"));
405 $this->
object->setDescription($this->form->getInput(
"style_description"));
406 $this->
object->writeStyleSetting(
407 "disable_auto_margins",
408 $this->form->getInput(
"disable_auto_margins")
410 $this->
object->update();
412 $ilCtrl->redirect($this,
"properties");
414 $this->form->setValuesByPost();
415 $tpl->setContent($this->form->getHtml());
426 $cur = explode(
".",
$_GET[
"tag"]);
428 $cur_class = $cur[1];
432 if ($this->form_gui->checkInput()) {
434 $ilCtrl->redirect($this,
"editTagStyle");
436 $this->form_gui->setValuesByPost();
448 $cur = explode(
".",
$_GET[
"tag"]);
450 $cur_class = $cur[1];
453 if ($this->form_gui->checkInput()) {
455 $ilCtrl->redirect($this,
"edit");
457 $this->form_gui->setValuesByPost();
467 $cur = explode(
".",
$_GET[
"tag"]);
469 $cur_class = $cur[1];
471 foreach ($avail_pars as $par => $v) {
472 $var = str_replace(
"-",
"_", $par);
473 $basepar_arr = explode(
".", $par);
474 $basepar = $basepar_arr[0];
475 if ($basepar_arr[1] !=
"" && $basepar_arr[1] != $cur_tag) {
479 switch ($v[
"input"]) {
481 case "numeric_no_perc":
483 case "background_image":
484 $in = $this->form_gui->getItemByPostVar($basepar);
490 $color = trim(
$_POST[$basepar]);
491 if ($color !=
"" && trim(substr($color, 0, 1) !=
"!")) {
492 $color =
"#" . $color;
500 $in = $this->form_gui->getItemByPostVar($basepar);
504 $this->
writeStylePar($cur_tag, $cur_class, $v[
"subpar"][3],
$in->getBottomValue(),
$_GET[
"style_type"], (
int)
$_GET[
"mq_id"]);
509 $in = $this->form_gui->getItemByPostVar($basepar);
510 $tblr_p = array(0 =>
"getAllValue", 1 =>
"getTopValue", 2 =>
"getRightValue",
511 3 =>
"getBottomValue", 4 =>
"getLeftValue");
512 foreach ($tblr_p as $k => $func) {
513 $val = trim(
$in->$func());
514 $val = ((
$in->getAcceptNamedColors() && substr($val, 0, 1) ==
"!")
522 case "background_position":
523 $in = $this->form_gui->getItemByPostVar($basepar);
534 $this->
object->deleteCustomStylePars($cur_tag, $cur_class,
$_GET[
"style_type"], (
int)
$_GET[
"mq_id"]);
535 if (is_array(
$_POST[
"custom_par"])) {
536 foreach (
$_POST[
"custom_par"] as $cpar) {
537 $par_arr = explode(
":", $cpar);
538 if (count($par_arr) == 2) {
539 $par = trim($par_arr[0]);
540 $val = trim(str_replace(
";",
"", $par_arr[1]));
546 $this->
object->update();
549 public function writeStylePar($cur_tag, $cur_class, $par, $value, $a_type, $a_mq_id, $a_custom =
false)
558 $this->
object->replaceStylePar($cur_tag, $cur_class, $par, $value, $a_type, $a_mq_id, $a_custom);
560 $this->
object->deleteStylePar($cur_tag, $cur_class, $par, $a_type, $a_mq_id, $a_custom);
576 $mqs = $this->
object->getMediaQueries();
577 if (count($mqs) > 0) {
580 "" =>
$lng->txt(
"sty_default"),
582 foreach ($mqs as $mq) {
583 $options[$mq[
"id"]] = $mq[
"mquery"];
585 include_once(
"./Services/Form/classes/class.ilSelectInputGUI.php");
587 $si->setOptions($options);
588 $si->setValue((
int)
$_GET[
"mq_id"]);
589 $ilToolbar->addInputItem(
$si,
true);
590 $ilToolbar->setFormAction($ilCtrl->getFormAction($this));
591 $ilToolbar->addFormButton(
$lng->txt(
"sty_switch"),
"switchMQuery");
596 if ($this->super_type ==
"rte") {
597 $tpl->addCss(
"Modules/Scorm2004/templates/default/player.css");
598 $tpl->addInlineCss(ilSCORM13PlayerGUI::getInlineCss());
601 $cur = explode(
".",
$_GET[
"tag"]);
603 $cur_class = $cur[1];
620 $ilCtrl->setParameter($this,
"mq_id", (
int)
$_POST[
"mq_id"]);
621 $ilCtrl->redirect($this,
"editTagStyle");
635 $tpl->setCurrentBlock(
"ContentStyle");
637 "LOCATION_CONTENT_STYLESHEET",
641 $ts_tpl =
new ilTemplate(
"tpl.style_tag_edit.html",
true,
true,
"Services/Style/Content");
643 $cur = explode(
".",
$_GET[
"tag"]);
645 $cur_class = $cur[1];
647 $ts_tpl->setVariable(
652 $ts_tpl->setVariable(
654 $this->form_gui->getHtml()
657 $tpl->setTitle($cur_class .
" (" .
$lng->txt(
"sty_type_" .
$_GET[
"style_type"]) .
")");
659 $tpl->setContent($ts_tpl->get());
673 $ilCtrl->saveParameter($this, array(
"mq_id"));
675 include_once(
"Services/Form/classes/class.ilPropertyFormGUI.php");
678 $avail_pars = $this->
object->getAvailableParameters();
679 $groups = $this->
object->getStyleParameterGroups();
682 foreach ($groups as $k => $group) {
686 if (is_array($filtered_groups[$k]) && !in_array($a_cur_tag, $filtered_groups[$k])) {
691 $sh->setTitle(
$lng->txt(
"sty_" . $k));
692 $this->form_gui->addItem($sh);
694 foreach ($group as $par) {
695 $basepar = explode(
".", $par);
696 $basepar = $basepar[0];
698 $var = str_replace(
"-",
"_", $basepar);
699 $up_par = strtoupper($var);
704 $options = array(
"" =>
"");
705 foreach ($avail_pars[$par] as $p) {
708 $sel_input->setOptions($options);
709 $this->form_gui->addItem($sel_input);
714 $text_input->setMaxLength(200);
715 $text_input->setSize(20);
716 $this->form_gui->addItem($text_input);
720 include_once(
"./Services/Style/Content/classes/class.ilFontSizeInputGUI.php");
722 $this->form_gui->addItem($fs_input);
725 case "numeric_no_perc":
727 include_once(
"./Services/Style/Content/classes/class.ilNumericStyleValueInputGUI.php");
730 $num_input->setAllowPercentage(
false);
732 $this->form_gui->addItem($num_input);
737 $per_input->setMinValue(0);
738 $per_input->setMaxValue(100);
739 $per_input->setMaxLength(3);
740 $per_input->setSize(3);
741 $this->form_gui->addItem($per_input);
747 $col_input->setDefaultColor(
"");
748 $col_input->setAcceptNamedColors(
true);
749 $this->form_gui->addItem($col_input);
753 include_once(
"./Services/Style/Content/classes/class.ilTRBLNumericStyleValueInputGUI.php");
756 $num_input->setAllowPercentage(
false);
758 $this->form_gui->addItem($num_input);
762 include_once(
"./Services/Style/Content/classes/class.ilTRBLBorderWidthInputGUI.php");
764 $this->form_gui->addItem($bw_input);
768 include_once(
"./Services/Style/Content/classes/class.ilTRBLBorderStyleInputGUI.php");
770 $this->form_gui->addItem($bw_input);
774 include_once(
"./Services/Style/Content/classes/class.ilTRBLColorPickerInputGUI.php");
776 $col_input->setAcceptNamedColors(
true);
777 $this->form_gui->addItem($col_input);
780 case "background_image":
781 include_once(
"./Services/Style/Content/classes/class.ilBackgroundImageInputGUI.php");
784 foreach ($this->object->getImages() as $entry) {
785 $imgs[] = $entry[
"entry"];
787 $im_input->setImages($imgs);
788 $this->form_gui->addItem($im_input);
791 case "background_position":
792 include_once(
"./Services/Style/Content/classes/class.ilBackgroundPositionInputGUI.php");
794 $this->form_gui->addItem($im_input);
802 $sh->setTitle(
$lng->txt(
"sty_custom"));
803 $this->form_gui->addItem($sh);
806 $ti =
new ilTextInputGUI($this->lng->txt(
"sty_custom_par"),
"custom_par");
807 $ti->setMaxLength(300);
810 $ti->setInfo($this->lng->txt(
"sty_custom_par_info"));
811 $this->form_gui->addItem($ti);
815 $this->form_gui->addCommandButton(
"updateTagStyle",
$lng->txt(
"save_return"));
816 $this->form_gui->addCommandButton(
"refreshTagStyle",
$lng->txt(
"save_refresh"));
819 $this->form_gui->setFormAction($this->ctrl->getFormAction($this));
828 $style = $this->
object->getStyle();
829 $cur = explode(
".",
$_GET[
"tag"]);
831 $cur_class = $cur[1];
837 (
int)
$_GET[
"mq_id"],
841 foreach ($parameters as $p => $v) {
843 if (is_array($filtered_groups[$v[
"group"]]) && !in_array($cur_tag, $filtered_groups[$v[
"group"]])) {
846 $p = explode(
".", $p);
848 $input = $this->form_gui->getItemByPostVar($p);
849 switch ($v[
"input"]) {
857 $input->setAllValue($cur_parameters[$v[
"subpar"][0]]);
858 $input->setTopValue($cur_parameters[$v[
"subpar"][1]]);
859 $input->setRightValue($cur_parameters[$v[
"subpar"][2]]);
860 $input->setBottomValue($cur_parameters[$v[
"subpar"][3]]);
861 $input->setLeftValue($cur_parameters[$v[
"subpar"][4]]);
865 $input->setValue($cur_parameters[$p]);
875 (
int)
$_GET[
"mq_id"],
879 foreach ($cust_parameters as $k =>
$c) {
880 $vals[] = $k .
": " .
$c;
882 $input = $this->form_gui->getItemByPostVar(
"custom_par");
883 $input->setValue($vals);
891 include_once(
"./Services/Export/classes/class.ilExport.php");
893 $r = $exp->exportObject($this->object->getType(), $this->object->getId());
900 $parameters = array();
901 foreach ($a_style as $tag) {
902 foreach ($tag as $par) {
903 if ($par[
"tag"] == $a_tag && $par[
"class"] == $a_class
904 && $par[
"type"] == $a_type && (
int) $a_mq_id == (
int) $par[
"mq_id"]
905 && (
int) $a_custom == (
int) $par[
"custom"]) {
906 $parameters[$par[
"parameter"]] = $par[
"value"];
918 $this->
object->addParameter(
$_POST[
"tag"],
$_POST[
"parameter"]);
927 $this->
object->setTitle(
$_POST[
"style_title"]);
928 $this->
object->setDescription(
$_POST[
"style_description"]);
930 foreach (
$_POST[
"styval"] as $id => $value) {
931 $this->
object->updateStyleParameter($id, $value);
933 $this->
object->update();
945 include_once(
"./Services/Utilities/classes/class.ilConfirmationGUI.php");
947 $cgui->setFormAction($this->ctrl->getFormAction($this));
948 $cgui->setHeaderText($this->lng->txt(
"info_delete_sure"));
949 $cgui->setCancel($this->lng->txt(
"cancel"),
"cancelDelete");
950 $cgui->setConfirm($this->lng->txt(
"confirm"),
"confirmedDelete");
955 $cgui->addItem(
"id[]",
"", $caption);
957 $this->tpl->setContent($cgui->getHTML());
966 $this->ctrl->returnToParent($this);
974 $this->
object->delete();
976 $this->ctrl->returnToParent($this);
984 if (is_array(
$_POST[
"sty_select"])) {
985 foreach (
$_POST[
"sty_select"] as $id => $dummy) {
986 $this->
object->deleteParameter($id);
989 $this->
object->read();
990 $this->
object->writeCSSFile();
999 if (!trim(
$_POST[
"style_title"])) {
1000 $this->ctrl->redirect($this,
"create");
1004 $default_style = $this->
settings->get(
"default_content_style_id");
1007 $new_id = $style_obj->ilClone();
1012 $style_id = $imp->importObject(
1017 $a_comp =
"Services/Style",
1032 if (
$_GET[
"ref_id"] > 0) {
1034 if ($fold->getType() ==
"stys") {
1035 include_once(
"./Services/Style/Content/classes/class.ilContentStyleSettings.php");
1037 $cont_style_settings->addStyle($newObj->getId());
1038 $cont_style_settings->update();
1041 $this->ctrl->returnToParent($this);
1045 return $newObj->getId();
1053 if (
$_POST[
"source_style"] > 0) {
1055 $new_id = $style_obj->ilClone();
1060 if (
$_GET[
"ref_id"] > 0) {
1062 if ($fold->getType() ==
"stys") {
1063 include_once(
"./Services/Style/Content/classes/class.ilContentStyleSettings.php");
1065 $cont_style_settings->addStyle($new_id);
1066 $cont_style_settings->update();
1068 $this->ctrl->returnToParent($this);
1081 $source = $_FILES[
"importfile"][
"tmp_name"];
1083 $this->
ilias->raiseError(
"No file selected!", $this->
ilias->error_obj->MESSAGE);
1087 $info = pathinfo($_FILES[
"importfile"][
"name"]);
1088 if (strtolower($info[
"extension"]) !=
"zip" && strtolower($info[
"extension"]) !=
"xml") {
1089 $this->
ilias->raiseError(
"File must be a zip or xml file!", $this->
ilias->error_obj->MESSAGE);
1093 $fname = explode(
"_", $_FILES[
"importfile"][
"name"]);
1094 if (strtolower($info[
"extension"]) ==
"zip" && $fname[4] ==
"sty") {
1095 include_once(
"./Services/Export/classes/class.ilImport.php");
1097 $new_id = $imp->importObject(
1099 $_FILES[
"importfile"][
"tmp_name"],
1100 $_FILES[
"importfile"][
"name"],
1107 require_once(
"./Services/Style/Content/classes/class.ilObjStyleSheet.php");
1109 $newObj->import($_FILES[
"importfile"]);
1114 if (
$_GET[
"ref_id"] > 0) {
1116 if ($fold->getType() ==
"stys") {
1117 include_once(
"./Services/Style/Content/classes/class.ilContentStyleSettings.php");
1119 $cont_style_settings->addStyle($newObj->getId());
1120 $cont_style_settings->update();
1122 $this->ctrl->returnToParent($this);
1125 return $newObj->getId();
1147 $this->ctrl->returnToParent($this);
1171 $ilHelp->setScreenIdComponent(
"sty");
1173 if ($ilCtrl->getCmd() ==
"editTagStyle") {
1175 $this->tabs_gui->setBackTarget(
1177 $ilCtrl->getLinkTarget($this,
"edit")
1180 $t = explode(
".",
$_GET[
"tag"]);
1181 $t2 = explode(
":", $t[1]);
1182 $pc = $this->
object->_getPseudoClasses($t[0]);
1183 if (is_array($pc) && count($pc) > 0) {
1185 $ilCtrl->setParameter($this,
"tag", $t[0] .
"." . $t2[0]);
1186 $this->tabs_gui->addTarget(
1188 $this->ctrl->getLinkTarget($this,
"editTagStyle"),
1189 array(
"editTagStyle",
""),
1193 $ilTabs->setTabActive(
"sty_tag_normal");
1196 foreach ($pc as $p) {
1198 $ilCtrl->setParameter($this,
"tag", $t[0] .
"." . $t2[0] .
":" . $p);
1199 $this->tabs_gui->addTarget(
1201 $this->ctrl->getLinkTarget($this,
"editTagStyle"),
1202 array(
"editTagStyle",
""),
1206 $ilTabs->setTabActive(
"sty_tag_" . $p);
1209 $ilCtrl->setParameter($this,
"tag",
$_GET[
"tag"]);
1213 $this->tabs_gui->setBackTarget(
1215 $this->ctrl->getLinkTarget($this,
"returnToUpperContext")
1219 $this->tabs_gui->addTarget(
1221 $this->ctrl->getLinkTarget($this,
"edit"),
1227 $this->tabs_gui->addTarget(
1229 $this->ctrl->getLinkTarget($this,
"listColors"),
1235 $this->tabs_gui->addTarget(
1236 "sty_media_queries",
1237 $this->ctrl->getLinkTarget($this,
"listMediaQueries"),
1243 $this->tabs_gui->addTarget(
1245 $this->ctrl->getLinkTarget($this,
"listImages"),
1251 $this->tabs_gui->addTarget(
1253 $this->ctrl->getLinkTarget($this,
"listTemplates"),
1259 $this->tabs_gui->addTarget(
1261 $this->ctrl->getLinkTarget($this,
"properties"),
1287 foreach ($types as $super_type => $types) {
1289 $ilCtrl->setParameter($this,
"style_type", $super_type);
1290 $ilTabs->addSubTabTarget(
1291 "sty_" . $super_type .
"_char",
1292 $this->ctrl->getLinkTarget($this,
"edit"),
1298 $ilCtrl->setParameter($this,
"style_type",
$_GET[
"style_type"]);
1314 foreach ($types as $t =>
$c) {
1315 $ilCtrl->setParameter($this,
"temp_type", $t);
1316 $ilTabs->addSubTabTarget(
1317 "sty_" . $t .
"_templates",
1318 $this->ctrl->getLinkTarget($this,
"listTemplates"),
1319 array(
"listTemplates",
""),
1324 $ilCtrl->setParameter($this,
"temp_type",
$_GET[
"temp_type"]);
1335 if (
$_GET[
"admin_mode"] ==
"settings") {
1336 parent::addAdminLocatorItems(
true);
1338 $ilLocator->addItem(
1342 $this->ctrl->getLinkTargetByClass(
"ilobjstylesettingsgui",
"")
1345 if (
$_GET[
"obj_id"] > 0) {
1346 $ilLocator->addItem(
1347 $this->object->getTitle(),
1348 $this->ctrl->getLinkTarget($this,
"edit")
1368 $ilToolbar->addButton(
1369 $lng->txt(
"sty_add_image"),
1370 $ilCtrl->getLinkTarget($this,
"addImage")
1374 include_once(
"./Services/Style/Content/classes/class.ilStyleImageTableGUI.php");
1380 $tpl->setContent($table_gui->getHTML());
1391 $tpl->setContent($this->form_gui->getHTML());
1401 $ilCtrl->redirect($this,
"listImages");
1414 if ($this->form_gui->checkInput()) {
1415 $this->
object->uploadImage($_FILES[
"image_file"]);
1416 $ilCtrl->redirect($this,
"listImages");
1419 $tpl->setContent($this->form_gui->getHTML());
1431 include_once(
"Services/Form/classes/class.ilPropertyFormGUI.php");
1434 $this->form_gui->setTitle(
$lng->txt(
"sty_add_image"));
1437 $file_input->setSuffixes([
"jpg",
"jpeg",
"png",
"gif",
"svg"]);
1438 $file_input->setRequired(
true);
1439 $this->form_gui->addItem($file_input);
1441 $this->form_gui->addCommandButton(
"uploadImage",
$lng->txt(
"upload"));
1442 $this->form_gui->addCommandButton(
"cancelUpload",
$lng->txt(
"cancel"));
1443 $this->form_gui->setFormAction($ilCtrl->getFormAction($this));
1453 $images = $this->
object->getImages();
1455 foreach ($images as $image) {
1456 if (is_array(
$_POST[
"file"]) && in_array($image[
"entry"],
$_POST[
"file"])) {
1457 $this->
object->deleteImage($image[
"entry"]);
1460 $ilCtrl->redirect($this,
"listImages");
1474 if (!is_array(
$_POST[
"char"]) || count(
$_POST[
"char"]) == 0) {
1476 $ilCtrl->redirect($this,
"edit");
1480 foreach (
$_POST[
"char"] as $char) {
1481 if (!empty($core_styles[$char])) {
1487 include_once(
"./Services/Utilities/classes/class.ilConfirmationGUI.php");
1489 $cgui->setFormAction($ilCtrl->getFormAction($this));
1490 $cgui->setHeaderText(
$lng->txt(
"sty_confirm_char_deletion"));
1491 $cgui->setCancel(
$lng->txt(
"cancel"),
"cancelCharacteristicDeletion");
1492 $cgui->setConfirm(
$lng->txt(
"delete"),
"deleteCharacteristic");
1494 foreach (
$_POST[
"char"] as $char) {
1495 $char_comp = explode(
".", $char);
1496 $cgui->addItem(
"char[]", $char, $char_comp[2]);
1499 $tpl->setContent($cgui->getHTML());
1515 include_once(
"./Services/Utilities/classes/class.ilConfirmationGUI.php");
1517 $cgui->setFormAction($ilCtrl->getFormAction($this));
1522 foreach (
$_POST[
"char"] as $char) {
1523 if (!empty($core_styles[$char])) {
1525 $char_comp = explode(
".", $char);
1526 $cgui->addItem(
"",
"", $char_comp[2]);
1528 $cgui->addHiddenItem(
"char[]", $char);
1531 $all_core_styles = ($cnt == count(
$_POST[
"char"]))
1535 if ($all_core_styles) {
1536 $cgui->setHeaderText(
$lng->txt(
"sty_all_styles_obligatory"));
1537 $cgui->setCancel(
$lng->txt(
"back"),
"cancelCharacteristicDeletion");
1539 $cgui->setHeaderText(
$lng->txt(
"sty_some_styles_obligatory_delete_rest"));
1540 $cgui->setCancel(
$lng->txt(
"cancel"),
"cancelCharacteristicDeletion");
1541 $cgui->setConfirm(
$lng->txt(
"sty_delete_other_selected"),
"deleteCharacteristicConfirmation");
1544 $tpl->setContent($cgui->getHTML());
1556 $ilCtrl->redirect($this,
"edit");
1566 if (is_array(
$_POST[
"char"])) {
1567 foreach (
$_POST[
"char"] as $char) {
1568 $char_comp = explode(
".", $char);
1569 $type = $char_comp[0];
1570 $tag = $char_comp[1];
1571 $class = $char_comp[2];
1573 $this->
object->deleteCharacteristic(
$type, $tag, $class);
1577 $ilCtrl->redirect($this,
"edit");
1588 $tpl->setContent($this->form_gui->getHTML());
1602 if ($this->form_gui->checkInput()) {
1603 if ($this->object->characteristicExists(
$_POST[
"new_characteristic"],
$_GET[
"style_type"])) {
1604 $char_input = $this->form_gui->getItemByPostVar(
"new_characteristic");
1605 $char_input->setAlert(
$lng->txt(
"sty_characteristic_already_exists"));
1607 $this->
object->addCharacteristic(
$_POST[
"type"],
$_POST[
"new_characteristic"]);
1609 $ilCtrl->setParameter(
1614 $ilCtrl->setParameter($this,
"style_type",
$_POST[
"type"]);
1615 $ilCtrl->redirect($this,
"editTagStyle");
1618 $this->form_gui->setValuesByPost();
1619 $tpl->setContent($this->form_gui->getHTML());
1632 include_once(
"Services/Form/classes/class.ilPropertyFormGUI.php");
1637 $txt_input->setPattern(
"/^[a-zA-Z]+[a-zA-Z0-9]*$/");
1638 $txt_input->setNoMatchMessage(
$lng->txt(
"sty_msg_characteristic_must_only_include") .
" A-Z, a-z, 0-9");
1639 $txt_input->setRequired(
true);
1640 $this->form_gui->addItem($txt_input);
1644 $types = $all_super_types[$this->super_type];
1645 $exp_types = array();
1646 foreach ($types as $t) {
1648 $exp_types[$t] =
$lng->txt(
"sty_type_" . $t);
1651 if (count($exp_types) > 1) {
1653 $type_input->setOptions($exp_types);
1654 $type_input->setValue(key($exp_types));
1655 $this->form_gui->addItem($type_input);
1656 } elseif (count($exp_types) == 1) {
1658 $hid_input->setValue(key($exp_types));
1659 $this->form_gui->addItem($hid_input);
1662 $this->form_gui->setTitle(
$lng->txt(
"sty_add_characteristic"));
1663 $this->form_gui->addCommandButton(
"saveCharacteristic",
$lng->txt(
"save"));
1664 $this->form_gui->addCommandButton(
"edit",
$lng->txt(
"cancel"));
1665 $this->form_gui->setFormAction($ilCtrl->getFormAction($this));
1677 $c = explode(
":", $a_class);
1680 $ex_tpl =
new ilTemplate(
"tpl.style_example.html",
true,
true,
"Services/Style/Content");
1682 if ($ex_tpl->blockExists(
"Example_" . $a_type)) {
1683 $ex_tpl->setCurrentBlock(
"Example_" . $a_type);
1685 $ex_tpl->setCurrentBlock(
"Example_default");
1687 $ex_tpl->setVariable(
"EX_CLASS",
"ilc_" . $a_type .
"_" . $a_class);
1688 $ex_tpl->setVariable(
"EX_TEXT",
"ABC abc 123");
1689 if (in_array($a_type, array(
"media_cont",
"qimg"))) {
1692 if (in_array($a_type, array(
"table",
"table_caption"))) {
1693 $ex_tpl->setVariable(
"TXT_CAPTION",
$lng->txt(
"sty_caption"));
1695 if (in_array($a_class, array(
"OrderListItemHorizontal",
"OrderListHorizontal"))) {
1696 $ex_tpl->setVariable(
"HOR",
"Horizontal");
1698 $ex_tpl->parseCurrentBlock();
1700 return $ex_tpl->get();
1713 foreach (
$_POST[
"all_chars"] as $char) {
1714 $ca = explode(
".", $char);
1715 $this->
object->saveHideStatus(
1718 (is_array(
$_POST[
"hide"]) && in_array($char,
$_POST[
"hide"]))
1723 $ilCtrl->redirect($this,
"edit");
1737 if (!is_array(
$_POST[
"char"]) || count(
$_POST[
"char"]) == 0) {
1740 $style_cp = implode(
"::",
$_POST[
"char"]);
1741 $style_cp = $this->
object->getId() .
":::" .
$_GET[
"style_type"] .
":::" . $style_cp;
1743 ilUtil::sendSuccess(
$lng->txt(
"sty_copied_please_select_target"),
true);
1745 $ilCtrl->redirect($this,
"edit");
1759 $ilTabs->clearTargets();
1761 include_once(
"./Services/Style/Content/classes/class.ilPasteStyleCharacteristicTableGUI.php");
1764 $tpl->setContent($table->getHTML());
1778 if (is_array(
$_POST[
"title"])) {
1779 foreach (
$_POST[
"title"] as $from_char => $to_title) {
1780 $fc = explode(
".", $from_char);
1782 if (
$_POST[
"conflict_action"][$from_char] ==
"overwrite" ||
1783 !$this->object->characteristicExists($to_title, $fc[0])) {
1784 $this->
object->copyCharacteristic(
1794 ilUtil::sendSuccess(
$lng->txt(
"sty_style_classes_copied"),
true);
1797 $ilCtrl->redirect($this,
"edit");
1815 $ilToolbar->addButton(
1816 $this->lng->txt(
"sty_add_color"),
1817 $ilCtrl->getLinkTarget($this,
"addColor")
1821 include_once(
"./Services/Style/Content/classes/class.ilStyleColorTableGUI.php");
1827 $tpl->setContent($table_gui->getHTML());
1838 $tpl->setContent($this->form_gui->getHTML());
1849 $ilCtrl->setParameter($this,
"c_name",
$_GET[
"c_name"]);
1852 $tpl->setContent($this->form_gui->getHTML());
1864 include_once(
"Services/Form/classes/class.ilPropertyFormGUI.php");
1867 $this->form_gui->setTitle(
$lng->txt(
"sty_add_color"));
1871 $name_input->setPattern(
"/^[a-zA-Z]+[a-zA-Z0-9]*$/");
1872 $name_input->setNoMatchMessage(
$lng->txt(
"sty_msg_color_must_only_include") .
" A-Z, a-z, 1-9");
1873 $name_input->setRequired(
true);
1874 $name_input->setSize(15);
1875 $name_input->setMaxLength(15);
1876 $this->form_gui->addItem($name_input);
1880 $color_input->setRequired(
true);
1881 $color_input->setDefaultColor(
"");
1882 $this->form_gui->addItem($color_input);
1884 if ($a_mode ==
"create") {
1885 $this->form_gui->addCommandButton(
"saveColor",
$lng->txt(
"save"));
1886 $this->form_gui->addCommandButton(
"cancelColorSaving",
$lng->txt(
"cancel"));
1888 $this->form_gui->addCommandButton(
"updateColor",
$lng->txt(
"save"));
1889 $this->form_gui->addCommandButton(
"cancelColorSaving",
$lng->txt(
"cancel"));
1891 $this->form_gui->setFormAction($ilCtrl->getFormAction($this));
1899 if (
$_GET[
"c_name"] !=
"") {
1900 $values[
"color_name"] =
$_GET[
"c_name"];
1901 $values[
"color_code"] = $this->
object->getColorCodeForName(
$_GET[
"c_name"]);
1902 $this->form_gui->setValuesByArray($values);
1913 $ilCtrl->redirect($this,
"listColors");
1927 if ($this->form_gui->checkInput()) {
1928 if ($this->object->colorExists(
$_POST[
"color_name"])) {
1929 $col_input = $this->form_gui->getItemByPostVar(
"color_name");
1930 $col_input->setAlert(
$lng->txt(
"sty_color_already_exists"));
1932 $this->
object->addColor(
1936 $ilCtrl->redirect($this,
"listColors");
1939 $this->form_gui->setValuesByPost();
1940 $tpl->setContent($this->form_gui->getHTML());
1954 if ($this->form_gui->checkInput()) {
1955 if ($this->object->colorExists(
$_POST[
"color_name"]) &&
1957 $col_input = $this->form_gui->getItemByPostVar(
"color_name");
1958 $col_input->setAlert(
$lng->txt(
"sty_color_already_exists"));
1960 $this->
object->updateColor(
1965 $ilCtrl->redirect($this,
"listColors");
1968 $ilCtrl->setParameter($this,
"c_name",
$_GET[
"c_name"]);
1969 $this->form_gui->setValuesByPost();
1970 $tpl->setContent($this->form_gui->getHTML());
1982 if (!is_array(
$_POST[
"color"]) || count(
$_POST[
"color"]) == 0) {
1984 $ilCtrl->redirect($this,
"listColors");
1986 include_once(
"./Services/Utilities/classes/class.ilConfirmationGUI.php");
1988 $cgui->setFormAction($ilCtrl->getFormAction($this));
1989 $cgui->setHeaderText(
$lng->txt(
"sty_confirm_color_deletion"));
1990 $cgui->setCancel(
$lng->txt(
"cancel"),
"cancelColorDeletion");
1991 $cgui->setConfirm(
$lng->txt(
"delete"),
"deleteColor");
1997 $tpl->setContent($cgui->getHTML());
2008 $ilCtrl->redirect($this,
"listColors");
2018 if (is_array(
$_POST[
"color"])) {
2020 $this->
object->removeColor($c);
2024 $ilCtrl->redirect($this,
"listColors");
2042 $ilToolbar->addButton(
2043 $this->lng->txt(
"sty_add_media_query"),
2044 $ilCtrl->getLinkTarget($this,
"addMediaQuery")
2048 include_once(
"./Services/Style/Content/classes/class.ilStyleMediaQueryTableGUI.php");
2054 $tpl->setContent($table_gui->getHTML());
2065 $tpl->setContent($this->form_gui->getHTML());
2076 $ilCtrl->setParameter($this,
"mq_id",
$_GET[
"mq_id"]);
2079 $tpl->setContent($this->form_gui->getHTML());
2091 include_once(
"Services/Form/classes/class.ilPropertyFormGUI.php");
2094 $this->form_gui->setTitle(
$lng->txt(
"sty_add_media_query"));
2098 $ti->setMaxLength(2000);
2099 $ti->setInfo(
$lng->txt(
"sty_add_media_query_info"));
2100 $this->form_gui->addItem($ti);
2103 if ($a_mode ==
"create") {
2104 $this->form_gui->addCommandButton(
"saveMediaQuery",
$lng->txt(
"save"));
2105 $this->form_gui->addCommandButton(
"listMediaQueries",
$lng->txt(
"cancel"));
2107 $this->form_gui->addCommandButton(
"updateMediaQuery",
$lng->txt(
"save"));
2108 $this->form_gui->addCommandButton(
"listMediaQueries",
$lng->txt(
"cancel"));
2110 $this->form_gui->setFormAction($ilCtrl->getFormAction($this));
2118 if (
$_GET[
"mq_id"] !=
"") {
2119 foreach ($this->object->getMediaQueries() as $mq) {
2120 if ($mq[
"id"] == (
int)
$_GET[
"mq_id"]) {
2121 $values[
"mquery"] = $mq[
"mquery"];
2124 $this->form_gui->setValuesByArray($values);
2139 if ($this->form_gui->checkInput()) {
2140 $this->
object->addMediaQuery(
$_POST[
"mquery"]);
2141 $ilCtrl->redirect($this,
"listMediaQueries");
2143 $this->form_gui->setValuesByPost();
2144 $tpl->setContent($this->form_gui->getHTML());
2158 if ($this->form_gui->checkInput()) {
2159 $this->
object->updateMediaQuery((
int)
$_GET[
"mq_id"],
$_POST[
"mquery"]);
2160 $ilCtrl->redirect($this,
"listMediaQueries");
2162 $ilCtrl->setParameter($this,
"mq_id",
$_GET[
"mq_id"]);
2163 $this->form_gui->setValuesByPost();
2164 $tpl->setContent($this->form_gui->getHTML());
2176 if (!is_array(
$_POST[
"mq_id"]) || count(
$_POST[
"mq_id"]) == 0) {
2178 $ilCtrl->redirect($this,
"listMediaQueries");
2180 include_once(
"./Services/Utilities/classes/class.ilConfirmationGUI.php");
2182 $cgui->setFormAction($ilCtrl->getFormAction($this));
2183 $cgui->setHeaderText(
$lng->txt(
"sty_sure_del_mqueries"));
2184 $cgui->setCancel(
$lng->txt(
"cancel"),
"listMediaQueries");
2185 $cgui->setConfirm(
$lng->txt(
"delete"),
"deleteMediaQueries");
2188 $mq = $this->
object->getMediaQueryForId($i);
2189 $cgui->addItem(
"mq_id[]",
$i, $mq[
"mquery"]);
2192 $tpl->setContent($cgui->getHTML());
2208 foreach (
$_POST[
"mq_id"] as $id) {
2209 $this->
object->deleteMediaQuery($id);
2212 $ilCtrl->redirect($this,
"listMediaQueries");
2225 if (is_array(
$_POST[
"order"])) {
2226 $this->
object->saveMediaQueryOrder(
$_POST[
"order"]);
2228 $ilCtrl->redirect($this,
"listMediaQueries");
2246 $ctype =
$_GET[
"temp_type"];
2249 $ilCtrl->setParameter($this,
"temp_type", $ctype);
2250 $_GET[
"temp_type"] = $ctype;
2254 $ilTabs->setSubTabActive(
"sty_" . $ctype .
"_templates");
2258 if ($ctype ==
"table") {
2259 $ilToolbar->addButton(
2260 $this->lng->txt(
"sty_generate_template"),
2261 $ilCtrl->getLinkTarget($this,
"generateTemplate")
2264 $ilToolbar->addButton(
2265 $this->lng->txt(
"sty_add_template"),
2266 $ilCtrl->getLinkTarget($this,
"addTemplate")
2273 include_once(
"./Services/Style/Content/classes/class.ilTableTemplatesTableGUI.php");
2280 $tpl->setContent($table_gui->getHTML());
2291 $tpl->setContent($this->form_gui->getHTML());
2302 $ilCtrl->setParameter($this,
"t_id",
$_GET[
"t_id"]);
2333 if ($a_small_mode) {
2338 $ts = $a_style->getTemplate($a_t_id);
2339 $t = $ts[
"classes"];
2342 if ($a_type ==
"table") {
2343 $p_content =
'<PageContent><Table DataTable="y"';
2344 if ($t[
"row_head"] !=
"") {
2345 $p_content .=
' HeaderRows="1"';
2347 if ($t[
"row_foot"] !=
"") {
2348 $p_content .=
' FooterRows="1"';
2350 if ($t[
"col_head"] !=
"") {
2351 $p_content .=
' HeaderCols="1"';
2353 if ($t[
"col_foot"] !=
"") {
2354 $p_content .=
' FooterCols="1"';
2356 $p_content .=
' Template="' . $a_style->lookupTemplateName($a_t_id) .
'">';
2357 if (!$a_small_mode) {
2358 $p_content .=
'<Caption>' .
$lng->txt(
"sty_caption") .
'</Caption>';
2360 for (
$i = 1;
$i <= $kr;
$i++) {
2361 $p_content .=
'<TableRow>';
2362 for ($j = 1; $j <= $kc; $j++) {
2363 if ($a_small_mode) {
2364 $cell =
'<div style="height:2px;"></div>';
2368 $p_content .=
'<TableData><PageContent><Paragraph Characteristic="TableContent">' . $cell .
'</Paragraph></PageContent></TableData>';
2370 $p_content .=
'</TableRow>';
2372 $p_content .=
'</Table></PageContent>';
2375 if ($a_type ==
"vaccordion" || $a_type ==
"haccordion" || $a_type ==
"carousel") {
2376 include_once(
"./Services/Accordion/classes/class.ilAccordionGUI.php");
2379 if ($a_small_mode) {
2386 if ($a_type ==
"vaccordion") {
2387 $p_content =
'<PageContent><Tabs HorizontalAlign="Left" Type="VerticalAccordion" ';
2388 if ($a_small_mode) {
2389 $p_content .=
' ContentWidth="70"';
2391 } elseif ($a_type ==
"haccordion") {
2392 $p_content =
'<PageContent><Tabs Type="HorizontalAccordion"';
2393 if ($a_small_mode) {
2394 $p_content .=
' ContentHeight="40"';
2395 $p_content .=
' ContentWidth="70"';
2396 $c =
'&nbsp;&nbsp;&nbsp;&nbsp;';
2398 $p_content .=
' ContentHeight="40"';
2400 } elseif ($a_type ==
"carousel") {
2401 $p_content =
'<PageContent><Tabs HorizontalAlign="Left" Type="Carousel" ';
2402 if ($a_small_mode) {
2403 $p_content .=
' ContentWidth="70"';
2408 $p_content .=
' Template="' . $a_style->lookupTemplateName($a_t_id) .
'">';
2409 $p_content .=
'<Tab><PageContent><Paragraph>' .
$c .
'</Paragraph></PageContent>';
2410 $p_content .=
'<TabCaption>' . $h .
'</TabCaption>';
2411 $p_content .=
'</Tab>';
2412 $p_content .=
'</Tabs></PageContent>';
2415 $txml = $a_style->getTemplateXML();
2417 $p_content .= $txml;
2418 include_once(
"./Services/COPage/classes/class.ilPCTableGUI.php");
2422 if ($a_type ==
"carousel") {
2423 $r_content .=
"<style>.owl-carousel{ display:block !important; }</style>";
2438 include_once(
"Services/Form/classes/class.ilPropertyFormGUI.php");
2441 if ($a_mode ==
"create") {
2442 $this->form_gui->setTitle(
$lng->txt(
"sty_add_template"));
2444 $this->form_gui->setTitle(
$lng->txt(
"sty_edit_template"));
2449 $name_input->setPattern(
"/^[a-zA-Z]+[a-zA-Z0-9]*$/");
2450 $name_input->setNoMatchMessage(
$lng->txt(
"sty_msg_color_must_only_include") .
" A-Z, a-z, 1-9");
2451 $name_input->setRequired(
true);
2452 $name_input->setSize(30);
2453 $name_input->setMaxLength(30);
2454 $this->form_gui->addItem($name_input);
2458 foreach ($scs as $sc => $st) {
2460 $chars = $this->
object->getCharacteristics($st);
2461 $options = array(
"" =>
"");
2462 foreach ($chars as $char) {
2463 $options[$char] = $char;
2465 $sc_input->setOptions($options);
2466 $this->form_gui->addItem($sc_input);
2469 if ($a_mode ==
"create") {
2470 $this->form_gui->addCommandButton(
"saveTemplate",
$lng->txt(
"save"));
2471 $this->form_gui->addCommandButton(
"cancelTemplateSaving",
$lng->txt(
"cancel"));
2473 $this->form_gui->addCommandButton(
"refreshTemplate",
$lng->txt(
"save_refresh"));
2474 $this->form_gui->addCommandButton(
"updateTemplate",
$lng->txt(
"save_return"));
2475 $this->form_gui->addCommandButton(
"cancelTemplateSaving",
$lng->txt(
"cancel"));
2477 $this->form_gui->setFormAction($ilCtrl->getFormAction($this));
2487 $ilCtrl->redirect($this,
"listTemplates");
2502 if ($this->form_gui->checkInput()) {
2503 if ($this->object->templateExists(
$_POST[
"name"])) {
2504 $name_input = $this->form_gui->getItemByPostVar(
"name");
2505 $name_input->setAlert(
$lng->txt(
"sty_table_template_already_exists"));
2509 $classes[$tct] =
$_POST[$tct .
"_class"];
2511 $t_id = $this->
object->addTemplate(
$_GET[
"temp_type"],
$_POST[
"name"], $classes);
2512 $this->
object->writeTemplatePreview(
2516 $ilCtrl->redirect($this,
"listTemplates");
2519 $this->form_gui->setValuesByPost();
2520 $tpl->setContent($this->form_gui->getHTML());
2532 $ilCtrl->setParameter($this,
"t_id",
$_GET[
"t_id"]);
2535 if ($this->form_gui->checkInput()) {
2536 if ($this->object->templateExists(
$_POST[
"name"]) &&
2538 $name_input = $this->form_gui->getItemByPostVar(
"name");
2539 $name_input->setAlert(
$lng->txt(
"sty_template_already_exists"));
2543 $classes[$tct] =
$_POST[$tct .
"_class"];
2546 $this->
object->updateTemplate(
2551 $this->
object->writeTemplatePreview(
2556 $ilCtrl->redirect($this,
"listTemplates");
2561 $this->form_gui->setValuesByPost();
2573 "tpl.template_edit.html",
2576 "Services/Style/Content"
2579 $a_tpl->setVariable(
"FORM", $this->form_gui->getHTML());
2581 $tpl->setContent($a_tpl->get());
2597 if (
$_GET[
"t_id"] > 0) {
2598 $t = $this->
object->getTemplate(
$_GET[
"t_id"]);
2600 $values[
"name"] = $t[
"name"];
2602 foreach ($scs as $k =>
$type) {
2603 $values[$k .
"_class"] = $t[
"classes"][$k];
2605 $this->form_gui->setValuesByArray($values);
2618 if (!is_array(
$_POST[
"tid"]) || count(
$_POST[
"tid"]) == 0) {
2620 $ilCtrl->redirect($this,
"listTemplates");
2622 include_once(
"./Services/Utilities/classes/class.ilConfirmationGUI.php");
2624 $cgui->setFormAction($ilCtrl->getFormAction($this));
2625 $cgui->setHeaderText(
$lng->txt(
"sty_confirm_template_deletion"));
2626 $cgui->setCancel(
$lng->txt(
"cancel"),
"cancelTemplateDeletion");
2627 $cgui->setConfirm(
$lng->txt(
"sty_del_template"),
"deleteTemplate");
2629 foreach (
$_POST[
"tid"] as $tid) {
2630 $classes = $this->
object->getTemplateClasses($tid);
2633 foreach ($classes as $cl) {
2634 if ($cl !=
"" && !$listed[$cl]) {
2635 $cl_str .=
'<div>- ' .
2637 $listed[$cl] =
true;
2640 if ($cl_str !=
"") {
2641 $cl_str =
'<div style="padding-left:30px;" class="small">' .
2642 "<div><i>" .
$lng->txt(
"sty_style_class") .
"</i></div>" . $cl_str .
"</div>";
2644 $cgui->addItem(
"tid[]", $tid, $this->object->lookupTemplateName($tid) . $cl_str);
2647 $cgui->addButton(
$lng->txt(
"sty_del_template_keep_classes"),
"deleteTemplateKeepClasses");
2649 $tpl->setContent($cgui->getHTML());
2660 $ilCtrl->redirect($this,
"listTemplates");
2670 if (is_array(
$_POST[
"tid"])) {
2671 foreach (
$_POST[
"tid"] as $tid) {
2672 $this->
object->removeTemplate($tid);
2676 $ilCtrl->redirect($this,
"listTemplates");
2686 if (is_array(
$_POST[
"tid"])) {
2687 foreach (
$_POST[
"tid"] as $tid) {
2688 $cls = $this->
object->getTemplateClasses($tid);
2689 foreach ($cls as $k => $cls) {
2690 $ty = $this->
object->determineTemplateStyleClassType(
$_GET[
"temp_type"], $k);
2692 $this->
object->deleteCharacteristic($ty, $ta, $cls);
2694 $this->
object->removeTemplate($tid);
2698 $ilCtrl->redirect($this,
"listTemplates");
2709 $tpl->setContent($this->form_gui->getHTML());
2720 include_once(
"Services/Form/classes/class.ilPropertyFormGUI.php");
2723 $this->form_gui->setTitle(
$lng->txt(
"sty_generate_template"));
2727 $name_input->setPattern(
"/^[a-zA-Z]+[a-zA-Z0-9]*$/");
2728 $name_input->setNoMatchMessage(
$lng->txt(
"sty_msg_color_must_only_include") .
" A-Z, a-z, 1-9");
2729 $name_input->setRequired(
true);
2730 $name_input->setSize(30);
2731 $name_input->setMaxLength(30);
2732 $this->form_gui->addItem($name_input);
2737 "coloredZebra" =>
$lng->txt(
"sty_table_template_colored_zebra"),
2738 "bwZebra" =>
$lng->txt(
"sty_table_template_bw_zebra"),
2739 "noZebra" =>
$lng->txt(
"sty_table_template_no_zebra")
2741 $bl_input->setOptions($options);
2742 $this->form_gui->addItem($bl_input);
2745 include_once(
"./Services/Style/Content/classes/class.ilNumericStyleValueInputGUI.php");
2747 $num_input->setAllowPercentage(
false);
2748 $num_input->setValue(
"3px");
2749 $this->form_gui->addItem($num_input);
2753 $num_input->setAllowPercentage(
false);
2754 $num_input->setValue(
"10px");
2755 $this->form_gui->addItem($num_input);
2759 $cs = $this->
object->getColors();
2761 foreach ($cs as
$c) {
2762 $options[
$c[
"name"]] =
$c[
"name"];
2764 $bc_input->setOptions($options);
2765 $this->form_gui->addItem($bc_input);
2768 $lss = array(
"border" => 90,
"header_text" => 70,
"header_bg" => 0,
2769 "cell1_text" => -60,
"cell1_bg" => 90,
"cell2_text" => -60,
"cell2_bg" => 75);
2770 foreach ($lss as $ls => $v) {
2772 $l_input->setMaxValue(100);
2773 $l_input->setMinValue(-100);
2774 $l_input->setValue($v);
2775 $l_input->setSize(4);
2776 $l_input->setMaxLength(4);
2777 $this->form_gui->addItem($l_input);
2780 $this->form_gui->addCommandButton(
"templateGeneration",
$lng->txt(
"generate"));
2781 $this->form_gui->addCommandButton(
"cancelTemplateSaving",
$lng->txt(
"cancel"));
2782 $this->form_gui->setFormAction($ilCtrl->getFormAction($this));
2796 if ($this->form_gui->checkInput()) {
2797 if ($this->object->templateExists(
$_POST[
"name"])) {
2798 $name_input = $this->form_gui->getItemByPostVar(
"name");
2799 $name_input->setAlert(
$lng->txt(
"sty_table_template_already_exists"));
2804 $cells = array(
"H" =>
"header",
"C1" =>
"cell1",
"C2" =>
"cell2");
2805 $tb_p = $this->form_gui->getItemByPostVar(
"tb_padding");
2806 $tb_padding = $tb_p->getValue();
2807 $lr_p = $this->form_gui->getItemByPostVar(
"lr_padding");
2808 $lr_padding = $lr_p->getValue();
2809 $cell_color =
$_POST[
"base_color"];
2812 if (
$_POST[
"layout"] ==
"bwZebra") {
2813 $cell_color =
"MidGray";
2814 if (!$this->object->colorExists($cell_color)) {
2815 $this->
object->addColor($cell_color,
"7F7F7F");
2817 $this->
object->updateColor($cell_color, $cell_color,
"7F7F7F");
2820 foreach ($cells as $k => $cell) {
2821 $cell_class[$k] =
$_POST[
"name"] . $k;
2822 if (!$this->object->characteristicExists($cell_class[$k],
"table_cell")) {
2823 $this->
object->addCharacteristic(
"table_cell", $cell_class[$k],
true);
2825 if (
$_POST[
"layout"] ==
"bwZebra" && $k ==
"H") {
2826 $this->
object->replaceStylePar(
2830 "!" .
$_POST[
"base_color"] .
"(" .
$_POST[
"lightness_" . $cell .
"_text"] .
")",
2833 $this->
object->replaceStylePar(
2837 "!" .
$_POST[
"base_color"] .
"(" .
$_POST[
"lightness_" . $cell .
"_bg"] .
")",
2841 $this->
object->replaceStylePar(
2845 "!" . $cell_color .
"(" .
$_POST[
"lightness_" . $cell .
"_text"] .
")",
2848 $this->
object->replaceStylePar(
2852 "!" . $cell_color .
"(" .
$_POST[
"lightness_" . $cell .
"_bg"] .
")",
2856 $this->
object->replaceStylePar(
2863 $this->
object->replaceStylePar(
2870 $this->
object->replaceStylePar(
2877 $this->
object->replaceStylePar(
2884 $this->
object->replaceStylePar(
2891 $this->
object->replaceStylePar(
2898 $this->
object->replaceStylePar(
2902 "!" . $cell_color .
"(" .
$_POST[
"lightness_border"] .
")",
2905 $this->
object->replaceStylePar(
2915 $classes[
"table"] =
$_POST[
"name"] .
"T";
2916 if (!$this->object->characteristicExists($classes[
"table"],
"table")) {
2917 $this->
object->addCharacteristic(
"table", $classes[
"table"],
true);
2919 $this->
object->replaceStylePar(
2926 $this->
object->replaceStylePar(
2933 $this->
object->replaceStylePar(
2940 $this->
object->replaceStylePar(
2947 if (
$_POST[
"layout"] ==
"bwZebra") {
2948 $this->
object->replaceStylePar(
2951 "border-bottom-color",
2952 "!" .
$_POST[
"base_color"],
2955 $this->
object->replaceStylePar(
2958 "border-bottom-style",
2962 $this->
object->replaceStylePar(
2965 "border-bottom-width",
2969 $sb = array(
"left",
"right",
"top");
2970 foreach ($sb as
$b) {
2971 $this->
object->replaceStylePar(
2974 "border-" .
$b .
"-width",
2981 switch (
$_POST[
"layout"]) {
2982 case "coloredZebra":
2983 $classes[
"row_head"] = $cell_class[
"H"];
2984 $classes[
"odd_row"] = $cell_class[
"C1"];
2985 $classes[
"even_row"] = $cell_class[
"C2"];
2989 $classes[
"row_head"] = $cell_class[
"H"];
2990 $classes[
"odd_row"] = $cell_class[
"C1"];
2991 $classes[
"even_row"] = $cell_class[
"C2"];
2995 $classes[
"row_head"] = $cell_class[
"H"];
2996 $classes[
"odd_row"] = $cell_class[
"C1"];
2997 $classes[
"even_row"] = $cell_class[
"C1"];
2998 $classes[
"col_head"] = $cell_class[
"C2"];
3003 $t_id = $this->
object->addTemplate(
3008 $this->
object->writeTemplatePreview(
3012 $ilCtrl->redirect($this,
"listTemplates");
3015 $this->form_gui->setValuesByPost();
3016 $tpl->setContent($this->form_gui->getHTML());
3023 include_once(
"./Services/Accordion/classes/class.ilAccordionGUI.php");
3026 $acc->addItem(
"Header 1", str_repeat(
"bla bla bla bla bla bla", 30));
3027 $acc->addItem(
"Header 2", str_repeat(
"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx xx x xx x xx", 30));
3031 $ac2->addItem(
"Header 1", str_repeat(
"bla bla bla bla bla bla", 30));
3032 $ac2->addItem(
"Header 2", $acc->getHTML());
3035 $tpl->setContent($ac2->getHTML());
3049 $ilCtrl->returnToParent($this);
if(php_sapi_name() !='cli') $in
An exception for terminatinating execution or to throw for unit testing.
Accordion user interface class.
static addCss()
Add required css.
Confirmation screen class.
Class ilObjStyleSheetGUI.
editTemplateObject()
Edit table template.
listImagesObject()
List images of style.
updateMediaQueryObject()
Update media query.
saveMediaQueryOrderObject()
Save media query order.
__construct($a_data, $a_id, $a_call_by_reference, $a_prep=true)
Constructor @access public.
cancelCharacteristicDeletionObject()
Cancel characteristic deletion.
generateTemplateObject()
Generate table template.
initTagStyleForm($a_mode, $a_cur_tag)
Init tag style editing form.
getAdminTabs()
admin and normal tabs are equal for roles
templateGenerationObject()
Table template generation.
getValues()
FORM: Get current values from persistent object.
refreshObject()
refresh style sheet
cancelUploadObject()
Cancel Upload.
cancelObject()
update style sheet
deleteImageObject()
Delete images.
exportStyleObject()
export style
deleteMediaQueryConfirmationObject()
Confirm media query deletion.
listMediaQueriesObject()
List media queries of style.
deleteCharacteristicConfirmationObject()
Characteristic deletion confirmation screen.
cancelTemplateDeletionObject()
Cancel table template deletion.
deleteColorObject()
Delete colors.
getPropertiesValues()
Get current values for properties from.
getTemplatePreview($a_type, $a_t_id, $a_small_mode=false)
Get table template preview.
newStyleParameterObject()
add style parameter
afterImport(ilObject $a_new_obj)
After import.
addCharacteristicFormObject()
Add characteristic.
pasteCharacteristicsObject()
Paste characteristics.
editObject()
edit style sheet
deleteObject($a_error=false)
display deletion confirmation screen
refreshTemplateObject()
Refresh table template.
deleteTemplateObject()
Delete table template.
deleteColorConfirmationObject()
Delete color confirmation.
cancelColorDeletionObject()
Cancel color deletion.
deleteTemplateKeepClassesObject()
Delete table template.
getColorFormValues()
Set values for color editing.
getTemplateFormValues()
Set values for table template editing.
updateTagStyleObject()
save and refresh tag editing
initTemplateGenerationForm()
Init table template generation form.
deleteTemplateConfirmationObject()
Delete table template confirmation.
pasteCharacteristicsOverviewObject()
Paste characteristics overview.
saveHideStatusObject()
Save hide status for characteristics.
writeStylePar($cur_tag, $cur_class, $par, $value, $a_type, $a_mq_id, $a_custom=false)
initColorForm($a_mode="create")
Init color form.
cancelColorSavingObject()
Cancel color saving.
copyStyleObject()
save style sheet
outputTagStyleEditScreen()
Output tag style edit screen.
switchMQueryObject()
Switch media query.
addMediaQueryObject()
Add a media query.
updateObject()
Update properties.
addColorObject()
Add a color.
initTemplateForm($a_mode="create")
Init table template form.
deleteStyleParameterObject()
delete style parameters
displayTemplateEditForm()
Display table tempalte edit form.
updateTemplateObject($a_refresh=false)
Update table template.
static _getTemplatePreview($a_style, $a_type, $a_t_id, $a_small_mode=false)
Get table template preview.
addTemplateObject()
Add template.
importStyleObject()
import style sheet
deleteMediaQueriesObject()
Delete Media Queries.
initMediaQueryForm($a_mode="create")
Init media query form.
saveCharacteristicObject()
Save Characteristic.
copyCharacteristicsObject()
Copy style classes.
cancelDeleteObject()
cancel oobject deletion
refreshTagStyleObject()
save and refresh tag editing
saveTagStyle()
Save tag style.
editMediaQueryObject()
Edit media query.
executeCommand()
execute command
initImageForm()
Init image form.
editTagStyleObject()
Edit tag style.
confirmedDeleteObject()
delete selected style objects
saveObject()
save style sheet
saveColorObject()
Save color.
initPropertiesForm($a_mode="edit")
FORM: Init properties form.
listColorsObject()
List colors of style.
setTemplatesSubTabs()
adds tabs to tab gui object
saveTemplateObject()
Save table template.
updateColorObject()
Update color.
getMediaQueryFormValues()
Set values for media query editing.
static getStyleExampleHTML($a_type, $a_class)
Get style example HTML.
viewObject()
viewObject container presentation for "administration -> repository, trash, permissions"
deleteCoreCharMessage()
Message that appears, when user tries to delete core characteristics.
addAdminLocatorItems($a_do_not_add_object=false)
should be overwritten to add object specific items (repository items are preloaded)
uploadImageObject()
Upload image.
includeCSS()
Include CSS in output.
returnToUpperContextObject()
return to upper context
initCharacteristicForm($a_mode)
Init tag style editing form.
extractParametersOfTag($a_tag, $a_class, $a_style, $a_type, $a_mq_id=0, $a_custom=false)
propertiesObject()
Properties.
getTabs()
adds tabs to tab gui object
setSubTabs()
adds tabs to tab gui object
enableWrite($a_write)
Enable writing.
saveMediaQueryObject()
Save media query.
addImageObject()
Add an image.
listTemplatesObject()
List templates.
editColorObject()
Edit color.
cancelTemplateSavingObject()
Cancel color saving.
deleteCharacteristicObject()
Delete one or multiple style characteristic.
static getBasicZipPath()
Get basic zip path.
static _getStyleParameterInputType($par)
static _getTemplateClassTypes($a_template_type="")
Get template class types.
static _getClonableContentStyles()
Get all clonable styles (active standard styles and individual learning module styles with write perm...
static _getFilteredGroups()
static _getStyleParameters($a_tag="")
static _writeStandard($a_id, $a_std)
Write standard flag.
static _isExpandable($a_type)
static _addMissingStyleClassesToStyle($a_id)
Add missing style classes to all styles.
static _determineTag($a_type)
static _getStyleSuperTypeForType($a_type)
static getContentStylePath($a_style_id, $add_random=true, $add_token=true)
get content style path
static _lookupTemplateName($a_t_id)
Lookup table template name for template ID.
static _writeUpToDate($a_id, $a_up_to_date)
Write up to date.
static _getStyleSuperTypes()
static _getCoreStyles()
Get core styles.
static getInstanceByObjId($a_obj_id, $stop_on_error=true)
get an instance of an Ilias object by object id
static getInstanceByRefId($a_ref_id, $stop_on_error=true)
get an instance of an Ilias object by reference id
Class ilObjectGUI Basic methods of all Output classes.
prepareOutput($a_show_subobjects=true)
prepare output
getCreationFormsHTML(array $a_forms)
Get HTML for creation forms (accordion)
setCreationMode($a_mode=true)
if true, a creation screen is displayed the current $_GET[ref_id] don't belong to the current class!...
Class ilObject Basic functions for all objects.
static _lookupObjId($a_id)
static _lookupTitle($a_id)
lookup object title
static _lookupType($a_id, $a_reference=false)
lookup object type
static _renderTable( $content, $a_mode="table_edit", $a_submode="", $a_table_obj=null, $unmask=true, $page_object=null)
Static render table function.
Paste style overview table.
TableGUI class for style editor (image list)
TableGUI class for style editor (image list)
TableGUI class for style editor.
special template class to simplify handling of ITX/PEAR
This class represents a text area property in a property form.
This class represents a text property in a property form.
static getImageTagByType($a_type, $a_path, $a_big=false)
Builds an html image tag TODO: function still in use, but in future use getImagePath and move HTML-Co...
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
static deliverFile( $a_file, $a_filename, $a_mime='', $isInline=false, $removeAfterDelivery=false, $a_exit_after=true)
deliver file for download via browser.
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
static prepareFormOutput($a_str, $a_strip=false)
prepares string output for html forms @access public
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
redirection script todo: (a better solution should control the processing via a xml file)