4 require_once
"./Services/Object/classes/class.ilObjectGUI.php";
5 require_once
"./Services/Style/Content/classes/class.ilObjStyleSheet.php";
27 function __construct($a_data,$a_id,$a_call_by_reference, $a_prep =
true)
33 $this->lng->loadLanguageModule(
"style");
34 $ilCtrl->saveParameter($this,
array(
"tag",
"style_type",
"temp_type"));
35 if (
$_GET[
"style_type"] !=
"")
41 parent::__construct($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",
163 $this->tpl->parseCurrentBlock();
177 return ($rbacsystem->checkAccess(
"write", (
int)
$_GET[
"ref_id"])
178 || $rbacsystem->checkAccess(
"sty_write_content", (
int) $_GET[
"ref_id"]));
193 $ctpl =
new ilTemplate(
"tpl.sty_classes.html",
true,
true,
"Services/Style/Content");
196 $chars = $this->
object->getCharacteristics();
198 $style_type = ($this->super_type !=
"")
201 $ilCtrl->setParameter($this,
"style_type", $style_type);
202 $ilTabs->setSubTabActive(
"sty_".$style_type.
"_char");
205 if ($this->super_type ==
"rte")
207 $tpl->addCss(
"Modules/Scorm2004/templates/default/player.css");
208 include_once(
"./Modules/Scorm2004/classes/ilSCORM13Player.php");
209 $tpl->addInlineCss(ilSCORM13Player::getInlineCss());
214 $subtypes = $all_super_types[$style_type];
216 foreach ($subtypes as
$t)
225 $ilToolbar->addButton($lng->txt(
"sty_add_characteristic"),
226 $ilCtrl->getLinkTarget($this,
"addCharacteristicForm"));
231 $style_cp = explode(
":::",
$_SESSION[
"sty_copy"]);
232 if ($style_cp[1] == $style_type)
236 $ilToolbar->addSeparator();
238 $ilToolbar->addButton($lng->txt(
"sty_paste_style_classes"),
239 $ilCtrl->getLinkTarget($this,
"pasteCharacteristicsOverview"));
243 include_once(
"./Services/Style/Content/classes/class.ilStyleTableGUI.php");
247 $ctpl->setCurrentBlock(
"style_table");
248 $ctpl->setVariable(
"STYLE_TABLE", $table_gui->getHTML());
249 $ctpl->parseCurrentBlock();
251 $this->tpl->setContent($ctpl->get());
259 global $rbacsystem,
$lng, $ilToolbar;
262 $this->tpl->setCurrentBlock(
"ContentStyle");
263 $this->tpl->setVariable(
"LOCATION_CONTENT_STYLESHEET",
265 $this->tpl->parseCurrentBlock();
268 $ilToolbar->addButton($this->lng->txt(
"export"),
269 $this->ctrl->getLinkTarget($this,
"exportStyle"));
273 $this->tpl->setContent($this->form->getHTML());
284 $values[
"style_title"] = $this->
object->getTitle();
285 $values[
"style_description"] = $this->
object->getDescription();
286 $values[
"disable_auto_margins"] = (int) $this->
object->lookupStyleSetting(
"disable_auto_margins");
288 $this->form->setValuesByArray($values);
298 global
$lng, $rbacsystem;
300 include_once(
"Services/Form/classes/class.ilPropertyFormGUI.php");
304 $ti =
new ilTextInputGUI($this->lng->txt(
"title"),
"style_title");
307 $ti->setRequired(
true);
308 $this->form->addItem($ti);
314 $this->form->addItem($ta);
317 $cb =
new ilCheckboxInputGUI($this->lng->txt(
"sty_disable_auto_margins"),
"disable_auto_margins");
318 $cb->
setInfo($this->lng->txt(
"sty_disable_auto_margins_info"));
319 $this->form->addItem($cb);
323 if ($a_mode ==
"create")
325 $this->form->addCommandButton(
"save", $lng->txt(
"save"));
326 $this->form->addCommandButton(
"cancelSave", $lng->txt(
"cancel"));
332 $this->form->addCommandButton(
"update", $lng->txt(
"save"));
336 $this->form->setTitle($lng->txt(
"edit_stylesheet"));
337 $this->form->setFormAction($this->ctrl->getFormAction($this));
349 if ($this->form->checkInput())
351 $this->
object->setTitle($this->form->getInput(
"style_title"));
352 $this->
object->setDescription($this->form->getInput(
"style_description"));
353 $this->
object->writeStyleSetting(
"disable_auto_margins",
354 $this->form->getInput(
"disable_auto_margins"));
355 $this->
object->update();
357 $ilCtrl->redirect($this,
"properties");
361 $this->form->setValuesByPost();
362 $tpl->setContent($this->form->getHtml());
373 $cur = explode(
".",
$_GET[
"tag"]);
375 $cur_class = $cur[1];
379 if ($this->form_gui->checkInput())
382 $ilCtrl->redirect($this,
"editTagStyle");
386 $this->form_gui->setValuesByPost();
398 $cur = explode(
".",
$_GET[
"tag"]);
400 $cur_class = $cur[1];
403 if ($this->form_gui->checkInput())
406 $ilCtrl->redirect($this,
"edit");
410 $this->form_gui->setValuesByPost();
420 $cur = explode(
".",
$_GET[
"tag"]);
422 $cur_class = $cur[1];
424 foreach ($avail_pars as $par => $v)
426 $var = str_replace(
"-",
"_", $par);
427 $basepar_arr = explode(
".", $par);
428 $basepar = $basepar_arr[0];
429 if ($basepar_arr[1] !=
"" && $basepar_arr[1] != $cur_tag)
437 case "numeric_no_perc":
439 case "background_image":
440 $in = $this->form_gui->getItemByPostVar($basepar);
446 $color = trim(
$_POST[$basepar]);
447 if ($color !=
"" && trim(substr($color,0,1) !=
"!"))
457 $in = $this->form_gui->getItemByPostVar($basepar);
458 $this->
writeStylePar($cur_tag, $cur_class, $v[
"subpar"][0],
$in->getAllValue(), $_GET[
"style_type"], (int) $_GET[
"mq_id"]);
459 $this->
writeStylePar($cur_tag, $cur_class, $v[
"subpar"][1],
$in->getTopValue(), $_GET[
"style_type"], (int) $_GET[
"mq_id"]);
460 $this->
writeStylePar($cur_tag, $cur_class, $v[
"subpar"][2],
$in->getRightValue(), $_GET[
"style_type"], (int) $_GET[
"mq_id"]);
461 $this->
writeStylePar($cur_tag, $cur_class, $v[
"subpar"][3],
$in->getBottomValue(), $_GET[
"style_type"], (int) $_GET[
"mq_id"]);
462 $this->
writeStylePar($cur_tag, $cur_class, $v[
"subpar"][4],
$in->getLeftValue(), $_GET[
"style_type"], (int) $_GET[
"mq_id"]);
466 $in = $this->form_gui->getItemByPostVar($basepar);
467 $tblr_p =
array (0 =>
"getAllValue", 1 =>
"getTopValue", 2 =>
"getRightValue",
468 3 =>
"getBottomValue", 4 =>
"getLeftValue");
469 foreach ($tblr_p as $k => $func)
471 $val = trim(
$in->$func());
472 $val = ((
$in->getAcceptNamedColors() && substr($val, 0, 1) ==
"!")
476 $this->
writeStylePar($cur_tag, $cur_class, $v[
"subpar"][$k], $val, $_GET[
"style_type"], (
int) $_GET[
"mq_id"]);
480 case "background_position":
481 $in = $this->form_gui->getItemByPostVar($basepar);
482 $this->
writeStylePar($cur_tag, $cur_class, $basepar,
$in->getValue(), $_GET[
"style_type"], (int) $_GET[
"mq_id"]);
486 $this->
writeStylePar($cur_tag, $cur_class, $basepar,
$_POST[$basepar], $_GET[
"style_type"], (
int) $_GET[
"mq_id"]);
492 $this->
object->deleteCustomStylePars($cur_tag, $cur_class,
$_GET[
"style_type"], (
int)
$_GET[
"mq_id"]);
493 if (is_array(
$_POST[
"custom_par"]))
495 foreach (
$_POST[
"custom_par"] as $cpar)
497 $par_arr = explode(
":", $cpar);
498 if (count($par_arr) == 2)
500 $par = trim($par_arr[0]);
501 $val = trim(str_replace(
";",
"", $par_arr[1]));
502 $this->
writeStylePar($cur_tag, $cur_class, $par, $val, $_GET[
"style_type"], (
int) $_GET[
"mq_id"],
true);
507 $this->
object->update();
521 $this->
object->replaceStylePar($cur_tag, $cur_class, $par, $value,
$a_type, $a_mq_id, $a_custom);
525 $this->
object->deleteStylePar($cur_tag, $cur_class, $par,
$a_type, $a_mq_id, $a_custom);
538 $mqs = $this->
object->getMediaQueries();
543 "" => $lng->txt(
"sty_default"),
545 foreach ($mqs as $mq)
547 $options[$mq[
"id"]] = $mq[
"mquery"];
549 include_once(
"./Services/Form/classes/class.ilSelectInputGUI.php");
552 $si->setValue((
int)
$_GET[
"mq_id"]);
553 $ilToolbar->addInputItem(
$si,
true);
554 $ilToolbar->setFormAction($ilCtrl->getFormAction($this));
555 $ilToolbar->addFormButton($lng->txt(
"sty_switch"),
"switchMQuery");
560 if ($this->super_type ==
"rte")
562 $tpl->addCss(
"Modules/Scorm2004/templates/default/player.css");
563 include_once(
"./Modules/Scorm2004/classes/ilSCORM13Player.php");
564 $tpl->addInlineCss(ilSCORM13Player::getInlineCss());
567 $cur = explode(
".",
$_GET[
"tag"]);
569 $cur_class = $cur[1];
586 $ilCtrl->setParameter($this,
"mq_id", (
int)
$_POST[
"mq_id"]);
587 $ilCtrl->redirect($this,
"editTagStyle");
599 $tpl->setCurrentBlock(
"ContentStyle");
600 $tpl->setVariable(
"LOCATION_CONTENT_STYLESHEET",
603 $ts_tpl =
new ilTemplate(
"tpl.style_tag_edit.html",
true,
true,
"Services/Style/Content");
605 $cur = explode(
".",
$_GET[
"tag"]);
607 $cur_class = $cur[1];
609 $ts_tpl->setVariable(
"EXAMPLE",
612 $ts_tpl->setVariable(
"FORM",
613 $this->form_gui->getHtml());
615 $tpl->setTitle($cur_class.
" (".$lng->txt(
"sty_type_".$_GET[
"style_type"]).
")");
617 $tpl->setContent($ts_tpl->get());
630 $ilCtrl->saveParameter($this,
array(
"mq_id"));
632 include_once(
"Services/Form/classes/class.ilPropertyFormGUI.php");
635 $avail_pars = $this->
object->getAvailableParameters();
636 $groups = $this->
object->getStyleParameterGroups();
639 foreach ($groups as $k => $group)
644 if (is_array($filtered_groups[$k]) && !in_array($a_cur_tag, $filtered_groups[$k]))
650 $sh->setTitle($lng->txt(
"sty_".$k));
651 $this->form_gui->addItem($sh);
653 foreach ($group as $par)
655 $basepar = explode(
".", $par);
656 $basepar = $basepar[0];
658 $var = str_replace(
"-",
"_", $basepar);
659 $up_par = strtoupper($var);
666 foreach ($avail_pars[$par] as $p)
671 $this->form_gui->addItem($sel_input);
675 $text_input =
new ilTextInputGUI($lng->txt(
"sty_".$var), $basepar);
677 $text_input->setSize(20);
678 $this->form_gui->addItem($text_input);
682 include_once(
"./Services/Style/Content/classes/class.ilFontSizeInputGUI.php");
684 $this->form_gui->addItem($fs_input);
687 case "numeric_no_perc":
689 include_once(
"./Services/Style/Content/classes/class.ilNumericStyleValueInputGUI.php");
695 $this->form_gui->addItem($num_input);
701 $per_input->setMaxValue(100);
702 $per_input->setMaxLength(3);
703 $per_input->setSize(3);
704 $this->form_gui->addItem($per_input);
711 $col_input->setAcceptNamedColors(
true);
712 $this->form_gui->addItem($col_input);
716 include_once(
"./Services/Style/Content/classes/class.ilTRBLNumericStyleValueInputGUI.php");
722 $this->form_gui->addItem($num_input);
726 include_once(
"./Services/Style/Content/classes/class.ilTRBLBorderWidthInputGUI.php");
728 $this->form_gui->addItem($bw_input);
732 include_once(
"./Services/Style/Content/classes/class.ilTRBLBorderStyleInputGUI.php");
734 $this->form_gui->addItem($bw_input);
738 include_once(
"./Services/Style/Content/classes/class.ilTRBLColorPickerInputGUI.php");
741 $this->form_gui->addItem($col_input);
744 case "background_image":
745 include_once(
"./Services/Style/Content/classes/class.ilBackgroundImageInputGUI.php");
748 foreach ($this->
object->getImages() as $entry)
750 $imgs[] = $entry[
"entry"];
753 $this->form_gui->addItem($im_input);
756 case "background_position":
757 include_once(
"./Services/Style/Content/classes/class.ilBackgroundPositionInputGUI.php");
759 $this->form_gui->addItem($im_input);
767 $sh->setTitle($lng->txt(
"sty_custom"));
768 $this->form_gui->addItem($sh);
771 $ti =
new ilTextInputGUI($this->lng->txt(
"sty_custom_par"),
"custom_par");
775 $ti->setInfo($this->lng->txt(
"sty_custom_par_info"));
776 $this->form_gui->addItem($ti);
780 $this->form_gui->addCommandButton(
"updateTagStyle", $lng->txt(
"save_return"));
781 $this->form_gui->addCommandButton(
"refreshTagStyle", $lng->txt(
"save_refresh"));
784 $this->form_gui->setFormAction($this->ctrl->getFormAction($this));
793 $style = $this->
object->getStyle();
794 $cur = explode(
".",
$_GET[
"tag"]);
796 $cur_class = $cur[1];
798 (
int)
$_GET[
"mq_id"],
false);
800 foreach($parameters as $p => $v)
803 if (is_array($filtered_groups[$v[
"group"]]) && !in_array($cur_tag, $filtered_groups[$v[
"group"]]))
807 $p = explode(
".", $p);
809 $input = $this->form_gui->getItemByPostVar($p);
819 $input->setAllValue($cur_parameters[$v[
"subpar"][0]]);
820 $input->setTopValue($cur_parameters[$v[
"subpar"][1]]);
821 $input->setRightValue($cur_parameters[$v[
"subpar"][2]]);
822 $input->setBottomValue($cur_parameters[$v[
"subpar"][3]]);
823 $input->setLeftValue($cur_parameters[$v[
"subpar"][4]]);
827 $input->setValue($cur_parameters[$p]);
833 (
int) $_GET[
"mq_id"],
true);
835 foreach ($cust_parameters as $k => $c)
837 $vals[] = $k.
": ".$c;
839 $input = $this->form_gui->getItemByPostVar(
"custom_par");
840 $input->setValue($vals);
848 include_once(
"./Services/Export/classes/class.ilExport.php");
850 $r = $exp->exportObject($this->
object->getType(),$this->
object->getId());
857 $parameters =
array();
858 foreach($a_style as $tag)
860 foreach($tag as $par)
862 if ($par[
"tag"] == $a_tag && $par[
"class"] == $a_class
863 && $par[
"type"] ==
$a_type && (
int) $a_mq_id == (
int) $par[
"mq_id"]
864 && (
int) $a_custom == (
int) $par[
"custom"])
866 $parameters[$par[
"parameter"]] = $par[
"value"];
878 $this->
object->addParameter(
$_POST[
"tag"],
$_POST[
"parameter"]);
887 $this->
object->setTitle(
$_POST[
"style_title"]);
888 $this->
object->setDescription(
$_POST[
"style_description"]);
890 foreach(
$_POST[
"styval"] as $id => $value)
892 $this->
object->updateStyleParameter($id, $value);
894 $this->
object->update();
908 include_once(
"./Services/Utilities/classes/class.ilConfirmationGUI.php");
910 $cgui->setFormAction($this->ctrl->getFormAction($this));
911 $cgui->setHeaderText($this->lng->txt(
"info_delete_sure"));
912 $cgui->setCancel($this->lng->txt(
"cancel"),
"cancelDelete");
913 $cgui->setConfirm($this->lng->txt(
"confirm"),
"confirmedDelete");
916 " ".ilObject::_lookupTitle($this->
object->getId());
918 $cgui->addItem(
"id[]",
"", $caption);
920 $this->tpl->setContent($cgui->getHTML());
929 $this->ctrl->returnToParent($this);
939 $this->
object->delete();
941 $this->ctrl->returnToParent($this);
949 if (is_array(
$_POST[
"sty_select"]))
951 foreach(
$_POST[
"sty_select"] as $id => $dummy)
953 $this->
object->deleteParameter($id);
956 $this->
object->read();
957 $this->
object->writeCSSFile();
966 if(!trim(
$_POST[
"style_title"]))
968 $this->ctrl->redirect($this,
"create");
972 $class_name =
"ilObjStyleSheet";
973 require_once(
"./Services/Style/Content/classes/class.ilObjStyleSheet.php");
975 $newObj->setTitle(
"-");
983 if (
$_GET[
"ref_id"] > 0)
987 if ($fold->getType() ==
"stys")
989 include_once(
"./Services/Style/Content/classes/class.ilContentStyleSettings.php");
991 $cont_style_settings->addStyle($newObj->getId());
992 $cont_style_settings->update();
995 $this->ctrl->returnToParent($this);
999 return $newObj->getId();
1009 if (
$_POST[
"source_style"] > 0)
1010 $style_obj = $ilias->obj_factory->getInstanceByObjId(
$_POST[
"source_style"]);
1011 $new_id = $style_obj->ilClone();
1015 if (
$_GET[
"ref_id"] > 0)
1019 if ($fold->getType() ==
"stys")
1021 include_once(
"./Services/Style/Content/classes/class.ilContentStyleSettings.php");
1023 $cont_style_settings->addStyle($new_id);
1024 $cont_style_settings->update();
1026 $this->ctrl->returnToParent($this);
1039 $source = $_FILES[
"importfile"][
"tmp_name"];
1040 if (($source ==
'none') || (!$source))
1042 $this->
ilias->raiseError(
"No file selected!",$this->
ilias->error_obj->MESSAGE);
1046 $info = pathinfo($_FILES[
"importfile"][
"name"]);
1047 if (strtolower(
$info[
"extension"]) !=
"zip" && strtolower(
$info[
"extension"]) !=
"xml")
1049 $this->
ilias->raiseError(
"File must be a zip or xml file!",$this->
ilias->error_obj->MESSAGE);
1053 $fname = explode(
"_", $_FILES[
"importfile"][
"name"]);
1054 if (strtolower(
$info[
"extension"]) ==
"zip" && $fname[4] ==
"sty")
1056 include_once(
"./Services/Export/classes/class.ilImport.php");
1058 $new_id = $imp->importObject(null, $_FILES[
"importfile"][
"tmp_name"],
1059 $_FILES[
"importfile"][
"name"],
"sty");
1067 require_once(
"./Services/Style/Content/classes/class.ilObjStyleSheet.php");
1069 $newObj->import($_FILES[
"importfile"]);
1074 if (
$_GET[
"ref_id"] > 0)
1077 if ($fold->getType() ==
"stys")
1079 include_once(
"./Services/Style/Content/classes/class.ilContentStyleSettings.php");
1081 $cont_style_settings->addStyle($newObj->getId());
1082 $cont_style_settings->update();
1084 $this->ctrl->returnToParent($this);
1087 return $newObj->getId();
1110 $this->ctrl->returnToParent($this);
1128 $this->
getTabs($this->tabs_gui);
1130 if (strtolower(get_class($this->
object)) ==
"ilobjstylesheet")
1132 $this->tpl->setVariable(
"HEADER", $this->
object->getTitle());
1136 $this->tpl->setVariable(
"HEADER", $lng->txt(
"create_stylesheet"));
1149 $ilHelp->setScreenIdComponent(
"sty");
1151 if ($ilCtrl->getCmd() ==
"editTagStyle")
1154 $this->tabs_gui->setBackTarget($lng->txt(
"back"),
1155 $ilCtrl->getLinkTarget($this,
"edit"));
1157 $t = explode(
".",
$_GET[
"tag"]);
1158 $t2 = explode(
":",
$t[1]);
1159 $pc = $this->
object->_getPseudoClasses(
$t[0]);
1160 if (is_array($pc) && count($pc) > 0)
1163 $ilCtrl->setParameter($this,
"tag",
$t[0].
".".$t2[0]);
1164 $this->tabs_gui->addTarget(
"sty_tag_normal",
1165 $this->ctrl->getLinkTarget($this,
"editTagStyle"),
array(
"editTagStyle",
""),
1169 $ilTabs->setTabActive(
"sty_tag_normal");
1175 $ilCtrl->setParameter($this,
"tag",
$t[0].
".".$t2[0].
":".$p);
1176 $this->tabs_gui->addTarget(
"sty_tag_".$p,
1177 $this->ctrl->getLinkTarget($this,
"editTagStyle"),
array(
"editTagStyle",
""),
1181 $ilTabs->setTabActive(
"sty_tag_".$p);
1184 $ilCtrl->setParameter($this,
"tag",
$_GET[
"tag"]);
1190 $this->tabs_gui->setBackTarget($lng->txt(
"back"),
1191 $this->ctrl->getLinkTarget($this,
"returnToUpperContext"));
1194 $this->tabs_gui->addTarget(
"sty_style_chars",
1195 $this->ctrl->getLinkTarget($this,
"edit"),
array(
"edit",
""),
1199 $this->tabs_gui->addTarget(
"sty_colors",
1200 $this->ctrl->getLinkTarget($this,
"listColors"),
"listColors",
1204 $this->tabs_gui->addTarget(
"sty_media_queries",
1205 $this->ctrl->getLinkTarget($this,
"listMediaQueries"),
"listMediaQueries",
1209 $this->tabs_gui->addTarget(
"sty_images",
1210 $this->ctrl->getLinkTarget($this,
"listImages"),
"listImages",
1214 $this->tabs_gui->addTarget(
"sty_templates",
1215 $this->ctrl->getLinkTarget($this,
"listTemplates"),
"listTemplates",
1219 $this->tabs_gui->addTarget(
"settings",
1220 $this->ctrl->getLinkTarget($this,
"properties"),
"properties",
1243 foreach ($types as $super_type => $types)
1246 $ilCtrl->setParameter($this,
"style_type", $super_type);
1247 $ilTabs->addSubTabTarget(
"sty_".$super_type.
"_char",
1248 $this->ctrl->getLinkTarget($this,
"edit"),
array(
"edit",
""),
1252 $ilCtrl->setParameter($this,
"style_type",
$_GET[
"style_type"]);
1266 foreach ($types as
$t => $c)
1268 $ilCtrl->setParameter($this,
"temp_type",
$t);
1269 $ilTabs->addSubTabTarget(
"sty_".
$t.
"_templates",
1270 $this->ctrl->getLinkTarget($this,
"listTemplates"),
array(
"listTemplates",
""),
1274 $ilCtrl->setParameter($this,
"temp_type",
$_GET[
"temp_type"]);
1285 if (
$_GET[
"admin_mode"] ==
"settings")
1287 parent::addAdminLocatorItems(
true);
1291 $this->ctrl->getLinkTargetByClass(
"ilobjstylesettingsgui",
""));
1293 if (
$_GET[
"obj_id"] > 0)
1295 $ilLocator->addItem($this->
object->getTitle(),
1296 $this->ctrl->getLinkTarget($this,
"edit"));
1310 if (strtolower(
$_GET[
"baseClass"]) ==
"iladministrationgui")
1313 $this->ctrl->getLinkTargetByClass(
"ilcontentstylesettings",
1331 $ilToolbar->addButton($lng->txt(
"sty_add_image"),
1332 $ilCtrl->getLinkTarget($this,
"addImage"));
1335 include_once(
"./Services/Style/Content/classes/class.ilStyleImageTableGUI.php");
1338 $tpl->setContent($table_gui->getHTML());
1350 $tpl->setContent($this->form_gui->getHTML());
1360 $ilCtrl->redirect($this,
"listImages");
1372 if ($this->form_gui->checkInput())
1374 $this->
object->uploadImage($_FILES[
"image_file"]);
1375 $ilCtrl->redirect($this,
"listImages");
1380 $tpl->setContent($this->form_gui->getHTML());
1392 include_once(
"Services/Form/classes/class.ilPropertyFormGUI.php");
1395 $this->form_gui->setTitle($lng->txt(
"sty_add_image"));
1399 $this->form_gui->addItem($file_input);
1401 $this->form_gui->addCommandButton(
"uploadImage", $lng->txt(
"upload"));
1402 $this->form_gui->addCommandButton(
"cancelUpload", $lng->txt(
"cancel"));
1403 $this->form_gui->setFormAction($ilCtrl->getFormAction($this));
1413 $images = $this->
object->getImages();
1415 foreach ($images as $image)
1417 if (is_array(
$_POST[
"file"]) && in_array($image[
"entry"],
$_POST[
"file"]))
1419 $this->
object->deleteImage($image[
"entry"]);
1422 $ilCtrl->redirect($this,
"listImages");
1434 if (!is_array(
$_POST[
"char"]) || count(
$_POST[
"char"]) == 0)
1437 $ilCtrl->redirect($this,
"edit");
1443 foreach (
$_POST[
"char"] as $char)
1445 if (!empty($core_styles[$char]))
1452 include_once(
"./Services/Utilities/classes/class.ilConfirmationGUI.php");
1454 $cgui->setFormAction($ilCtrl->getFormAction($this));
1455 $cgui->setHeaderText($lng->txt(
"sty_confirm_char_deletion"));
1456 $cgui->setCancel($lng->txt(
"cancel"),
"cancelCharacteristicDeletion");
1457 $cgui->setConfirm($lng->txt(
"delete"),
"deleteCharacteristic");
1459 foreach (
$_POST[
"char"] as $char)
1461 $char_comp = explode(
".", $char);
1462 $cgui->addItem(
"char[]", $char, $char_comp[2]);
1465 $tpl->setContent($cgui->getHTML());
1479 include_once(
"./Services/Utilities/classes/class.ilConfirmationGUI.php");
1481 $cgui->setFormAction($ilCtrl->getFormAction($this));
1486 foreach (
$_POST[
"char"] as $char)
1488 if (!empty($core_styles[$char]))
1491 $char_comp = explode(
".", $char);
1492 $cgui->addItem(
"",
"", $char_comp[2]);
1496 $cgui->addHiddenItem(
"char[]", $char);
1499 $all_core_styles = ($cnt == count(
$_POST[
"char"]))
1503 if ($all_core_styles)
1505 $cgui->setHeaderText($lng->txt(
"sty_all_styles_obligatory"));
1506 $cgui->setCancel($lng->txt(
"back"),
"cancelCharacteristicDeletion");
1510 $cgui->setHeaderText($lng->txt(
"sty_some_styles_obligatory_delete_rest"));
1511 $cgui->setCancel($lng->txt(
"cancel"),
"cancelCharacteristicDeletion");
1512 $cgui->setConfirm($lng->txt(
"sty_delete_other_selected"),
"deleteCharacteristicConfirmation");
1515 $tpl->setContent($cgui->getHTML());
1526 $ilCtrl->redirect($this,
"edit");
1536 if (is_array(
$_POST[
"char"]))
1538 foreach(
$_POST[
"char"] as $char)
1540 $char_comp = explode(
".", $char);
1541 $type = $char_comp[0];
1542 $tag = $char_comp[1];
1543 $class = $char_comp[2];
1545 $this->
object->deleteCharacteristic($type, $tag, $class);
1549 $ilCtrl->redirect($this,
"edit");
1560 $tpl->setContent($this->form_gui->getHTML());
1572 if ($this->form_gui->checkInput())
1574 if ($this->
object->characteristicExists(
$_POST[
"new_characteristic"],
$_GET[
"style_type"]))
1576 $char_input = $this->form_gui->getItemByPostVar(
"new_characteristic");
1577 $char_input->setAlert($lng->txt(
"sty_characteristic_already_exists"));
1581 $this->
object->addCharacteristic(
$_POST[
"type"],
$_POST[
"new_characteristic"]);
1583 $ilCtrl->setParameter($this,
"tag",
1585 $ilCtrl->setParameter($this,
"style_type", $_POST[
"type"]);
1586 $ilCtrl->redirect($this,
"editTagStyle");
1589 $this->form_gui->setValuesByPost();
1590 $tpl->setContent($this->form_gui->getHTML());
1602 include_once(
"Services/Form/classes/class.ilPropertyFormGUI.php");
1606 $txt_input =
new ilRegExpInputGUI($lng->txt(
"title"),
"new_characteristic");
1607 $txt_input->
setPattern(
"/^[a-zA-Z]+[a-zA-Z0-9]*$/");
1608 $txt_input->setNoMatchMessage($lng->txt(
"sty_msg_characteristic_must_only_include").
" A-Z, a-z, 1-9");
1609 $txt_input->setRequired(
true);
1610 $this->form_gui->addItem($txt_input);
1614 $types = $all_super_types[$this->super_type];
1615 $exp_types =
array();
1616 foreach($types as
$t)
1620 $exp_types[
$t] = $lng->txt(
"sty_type_".$t);
1623 if (count($exp_types) > 1)
1627 $type_input->setValue(key($exp_types));
1628 $this->form_gui->addItem($type_input);
1630 else if (count($exp_types) == 1)
1633 $hid_input->setValue(key($exp_types));
1634 $this->form_gui->addItem($hid_input);
1637 $this->form_gui->setTitle($lng->txt(
"sty_add_characteristic"));
1638 $this->form_gui->addCommandButton(
"saveCharacteristic", $lng->txt(
"save"));
1639 $this->form_gui->addCommandButton(
"edit", $lng->txt(
"cancel"));
1640 $this->form_gui->setFormAction($ilCtrl->getFormAction($this));
1650 $c = explode(
":", $a_class);
1653 $ex_tpl =
new ilTemplate(
"tpl.style_example.html",
true,
true,
"Services/Style/Content");
1655 if ($ex_tpl->blockExists(
"Example_".$a_type))
1657 $ex_tpl->setCurrentBlock(
"Example_".
$a_type);
1661 $ex_tpl->setCurrentBlock(
"Example_default");
1663 $ex_tpl->setVariable(
"EX_CLASS",
"ilc_".
$a_type.
"_".$a_class);
1664 $ex_tpl->setVariable(
"EX_TEXT",
"ABC abc 123");
1669 if (in_array(
$a_type,
array(
"table",
"table_caption")))
1671 $ex_tpl->setVariable(
"TXT_CAPTION", $lng->txt(
"sty_caption"));
1673 if (in_array($a_class,
array(
"OrderListItemHorizontal",
"OrderListHorizontal")))
1675 $ex_tpl->setVariable(
"HOR",
"Horizontal");
1677 $ex_tpl->parseCurrentBlock();
1679 return $ex_tpl->get();
1691 foreach (
$_POST[
"all_chars"] as $char)
1693 $ca = explode(
".", $char);
1694 $this->
object->saveHideStatus($ca[0], $ca[2],
1695 (is_array(
$_POST[
"hide"]) && in_array($char,
$_POST[
"hide"])));
1699 $ilCtrl->redirect($this,
"edit");
1712 if (!is_array(
$_POST[
"char"]) || count(
$_POST[
"char"]) == 0)
1718 $style_cp = implode(
"::",
$_POST[
"char"]);
1719 $style_cp = $this->
object->getId().
":::".
$_GET[
"style_type"].
":::".$style_cp;
1723 $ilCtrl->redirect($this,
"edit");
1734 global
$tpl, $ilTabs;
1736 $ilTabs->clearTargets();
1738 include_once(
"./Services/Style/Content/classes/class.ilPasteStyleCharacteristicTableGUI.php");
1741 $tpl->setContent($table->getHTML());
1754 if (is_array(
$_POST[
"title"]))
1756 foreach (
$_POST[
"title"] as $from_char => $to_title)
1758 $fc = explode(
".", $from_char);
1760 if (
$_POST[
"conflict_action"][$from_char] ==
"overwrite" ||
1761 !$this->
object->characteristicExists($to_title, $fc[0]))
1763 $this->
object->copyCharacteristic(
$_POST[
"from_style_id"],
1764 $fc[0], $fc[2], $to_title);
1772 $ilCtrl->redirect($this,
"edit");
1788 $ilToolbar->addButton($this->lng->txt(
"sty_add_color"),
1789 $ilCtrl->getLinkTarget($this,
"addColor"));
1792 include_once(
"./Services/Style/Content/classes/class.ilStyleColorTableGUI.php");
1795 $tpl->setContent($table_gui->getHTML());
1807 $tpl->setContent($this->form_gui->getHTML());
1817 $ilCtrl->setParameter($this,
"c_name",
$_GET[
"c_name"]);
1820 $tpl->setContent($this->form_gui->getHTML());
1831 include_once(
"Services/Form/classes/class.ilPropertyFormGUI.php");
1834 $this->form_gui->setTitle($lng->txt(
"sty_add_color"));
1837 $name_input =
new ilRegExpInputGUI($lng->txt(
"sty_color_name"),
"color_name");
1838 $name_input->
setPattern(
"/^[a-zA-Z]+[a-zA-Z0-9]*$/");
1839 $name_input->setNoMatchMessage($lng->txt(
"sty_msg_color_must_only_include").
" A-Z, a-z, 1-9");
1840 $name_input->setRequired(
true);
1841 $name_input->setSize(15);
1842 $name_input->setMaxLength(15);
1843 $this->form_gui->addItem($name_input);
1848 $color_input->setDefaultColor(
"");
1849 $this->form_gui->addItem($color_input);
1851 if ($a_mode ==
"create")
1853 $this->form_gui->addCommandButton(
"saveColor", $lng->txt(
"save"));
1854 $this->form_gui->addCommandButton(
"cancelColorSaving", $lng->txt(
"cancel"));
1858 $this->form_gui->addCommandButton(
"updateColor", $lng->txt(
"save"));
1859 $this->form_gui->addCommandButton(
"cancelColorSaving", $lng->txt(
"cancel"));
1861 $this->form_gui->setFormAction($ilCtrl->getFormAction($this));
1869 if (
$_GET[
"c_name"] !=
"")
1871 $values[
"color_name"] =
$_GET[
"c_name"];
1872 $values[
"color_code"] = $this->
object->getColorCodeForName(
$_GET[
"c_name"]);
1873 $this->form_gui->setValuesByArray($values);
1884 $ilCtrl->redirect($this,
"listColors");
1896 if ($this->form_gui->checkInput())
1900 $col_input = $this->form_gui->getItemByPostVar(
"color_name");
1901 $col_input->setAlert($lng->txt(
"sty_color_already_exists"));
1905 $this->
object->addColor(
$_POST[
"color_name"],
1907 $ilCtrl->redirect($this,
"listColors");
1910 $this->form_gui->setValuesByPost();
1911 $tpl->setContent($this->form_gui->getHTML());
1923 if ($this->form_gui->checkInput())
1925 if ($this->
object->colorExists(
$_POST[
"color_name"]) &&
1928 $col_input = $this->form_gui->getItemByPostVar(
"color_name");
1929 $col_input->setAlert($lng->txt(
"sty_color_already_exists"));
1933 $this->
object->updateColor(
$_GET[
"c_name"],
$_POST[
"color_name"],
1935 $ilCtrl->redirect($this,
"listColors");
1938 $ilCtrl->setParameter($this,
"c_name",
$_GET[
"c_name"]);
1939 $this->form_gui->setValuesByPost();
1940 $tpl->setContent($this->form_gui->getHTML());
1950 if (!is_array(
$_POST[
"color"]) || count(
$_POST[
"color"]) == 0)
1953 $ilCtrl->redirect($this,
"listColors");
1957 include_once(
"./Services/Utilities/classes/class.ilConfirmationGUI.php");
1959 $cgui->setFormAction($ilCtrl->getFormAction($this));
1960 $cgui->setHeaderText($lng->txt(
"sty_confirm_color_deletion"));
1961 $cgui->setCancel($lng->txt(
"cancel"),
"cancelColorDeletion");
1962 $cgui->setConfirm($lng->txt(
"delete"),
"deleteColor");
1964 foreach (
$_POST[
"color"] as $c)
1969 $tpl->setContent($cgui->getHTML());
1980 $ilCtrl->redirect($this,
"listColors");
1990 if (is_array(
$_POST[
"color"]))
1992 foreach (
$_POST[
"color"] as $c)
1994 $this->
object->removeColor($c);
1998 $ilCtrl->redirect($this,
"listColors");
2014 $ilToolbar->addButton($this->lng->txt(
"sty_add_media_query"),
2015 $ilCtrl->getLinkTarget($this,
"addMediaQuery"));
2018 include_once(
"./Services/Style/Content/classes/class.ilStyleMediaQueryTableGUI.php");
2021 $tpl->setContent($table_gui->getHTML());
2032 $tpl->setContent($this->form_gui->getHTML());
2042 $ilCtrl->setParameter($this,
"mq_id",
$_GET[
"mq_id"]);
2045 $tpl->setContent($this->form_gui->getHTML());
2056 include_once(
"Services/Form/classes/class.ilPropertyFormGUI.php");
2059 $this->form_gui->setTitle($lng->txt(
"sty_add_media_query"));
2063 $ti->setMaxLength(2000);
2064 $this->form_gui->addItem($ti);
2067 if ($a_mode ==
"create")
2069 $this->form_gui->addCommandButton(
"saveMediaQuery", $lng->txt(
"save"));
2070 $this->form_gui->addCommandButton(
"listMediaQueries", $lng->txt(
"cancel"));
2074 $this->form_gui->addCommandButton(
"updateMediaQuery", $lng->txt(
"save"));
2075 $this->form_gui->addCommandButton(
"listMediaQueries", $lng->txt(
"cancel"));
2077 $this->form_gui->setFormAction($ilCtrl->getFormAction($this));
2085 if (
$_GET[
"mq_id"] !=
"")
2087 foreach ($this->
object->getMediaQueries() as $mq)
2089 if ($mq[
"id"] == (
int)
$_GET[
"mq_id"])
2091 $values[
"mquery"] = $mq[
"mquery"];
2094 $this->form_gui->setValuesByArray($values);
2107 if ($this->form_gui->checkInput())
2109 $this->
object->addMediaQuery(
$_POST[
"mquery"]);
2110 $ilCtrl->redirect($this,
"listMediaQueries");
2112 $this->form_gui->setValuesByPost();
2113 $tpl->setContent($this->form_gui->getHTML());
2125 if ($this->form_gui->checkInput())
2127 $this->
object->updateMediaQuery((
int)
$_GET[
"mq_id"],
$_POST[
"mquery"]);
2128 $ilCtrl->redirect($this,
"listMediaQueries");
2130 $ilCtrl->setParameter($this,
"mq_id",
$_GET[
"mq_id"]);
2131 $this->form_gui->setValuesByPost();
2132 $tpl->setContent($this->form_gui->getHTML());
2142 if (!is_array(
$_POST[
"mq_id"]) || count(
$_POST[
"mq_id"]) == 0)
2145 $ilCtrl->redirect($this,
"listMediaQueries");
2149 include_once(
"./Services/Utilities/classes/class.ilConfirmationGUI.php");
2151 $cgui->setFormAction($ilCtrl->getFormAction($this));
2152 $cgui->setHeaderText($lng->txt(
"sty_sure_del_mqueries"));
2153 $cgui->setCancel($lng->txt(
"cancel"),
"listMediaQueries");
2154 $cgui->setConfirm($lng->txt(
"delete"),
"deleteMediaQueries");
2156 foreach (
$_POST[
"mq_id"] as $i)
2158 $mq = $this->
object->getMediaQueryForId($i);
2159 $cgui->addItem(
"mq_id[]", $i, $mq[
"mquery"]);
2162 $tpl->setContent($cgui->getHTML());
2178 foreach (
$_POST[
"mq_id"] as $id)
2180 $this->
object->deleteMediaQuery($id);
2183 $ilCtrl->redirect($this,
"listMediaQueries");
2196 if (is_array(
$_POST[
"order"]))
2198 $this->
object->saveMediaQueryOrder(
$_POST[
"order"]);
2200 $ilCtrl->redirect($this,
"listMediaQueries");
2215 $ctype =
$_GET[
"temp_type"];
2219 $ilCtrl->setParameter($this,
"temp_type", $ctype);
2220 $_GET[
"temp_type"] = $ctype;
2224 $ilTabs->setSubTabActive(
"sty_".$ctype.
"_templates");
2227 include_once(
"./Services/Style/Content/classes/class.ilTableTemplatesTableGUI.php");
2230 $tpl->setContent($table_gui->getHTML());
2242 $tpl->setContent($this->form_gui->getHTML());
2252 $ilCtrl->setParameter($this,
"t_id",
$_GET[
"t_id"]);
2265 $this->
object,
$a_type, $a_t_id, $a_small_mode);
2282 $ts = $a_style->getTemplate($a_t_id);
2283 $t = $ts[
"classes"];
2288 $p_content =
'<PageContent><Table DataTable="y"';
2289 if (
$t[
"row_head"] !=
"")
2291 $p_content.=
' HeaderRows="1"';
2293 if (
$t[
"row_foot"] !=
"")
2295 $p_content.=
' FooterRows="1"';
2297 if (
$t[
"col_head"] !=
"")
2299 $p_content.=
' HeaderCols="1"';
2301 if (
$t[
"col_foot"] !=
"")
2303 $p_content.=
' FooterCols="1"';
2305 $p_content.=
' Template="'.$a_style->lookupTemplateName($a_t_id).
'">';
2308 $p_content.=
'<Caption>'.$lng->txt(
"sty_caption").
'</Caption>';
2310 for($i = 1; $i<=$kr; $i++)
2312 $p_content.=
'<TableRow>';
2313 for($j = 1; $j<=$kc; $j++)
2317 $cell =
'<div style="height:2px;"></div>';
2323 $p_content.=
'<TableData><PageContent><Paragraph Characteristic="TableContent">'.$cell.
'</Paragraph></PageContent></TableData>';
2325 $p_content.=
'</TableRow>';
2327 $p_content.=
'</Table></PageContent>';
2332 include_once(
"./Services/Accordion/classes/class.ilAccordionGUI.php");
2347 $p_content =
'<PageContent><Tabs HorizontalAlign="Left" Type="VerticalAccordion" ';
2350 $p_content.=
' ContentWidth="70"';
2353 else if (
$a_type ==
"haccordion")
2355 $p_content =
'<PageContent><Tabs Type="HorizontalAccordion"';
2358 $p_content.=
' ContentHeight="40"';
2359 $p_content.=
' ContentWidth="70"';
2360 $c =
'&nbsp;&nbsp;&nbsp;&nbsp;';
2364 $p_content.=
' ContentHeight="40"';
2367 else if (
$a_type ==
"carousel")
2369 $p_content =
'<PageContent><Tabs HorizontalAlign="Left" Type="Carousel" ';
2372 $p_content.=
' ContentWidth="70"';
2377 $p_content.=
' Template="'.$a_style->lookupTemplateName($a_t_id).
'">';
2378 $p_content.=
'<Tab><PageContent><Paragraph>'.$c.
'</Paragraph></PageContent>';
2379 $p_content.=
'<TabCaption>'.$h.
'</TabCaption>';
2380 $p_content.=
'</Tab>';
2381 $p_content.=
'</Tabs></PageContent>';
2384 $txml = $a_style->getTemplateXML();
2387 include_once(
"./Services/COPage/classes/class.ilPCTableGUI.php");
2393 $r_content.=
"<style>.owl-carousel{ display:block !important; }</style>";
2407 include_once(
"Services/Form/classes/class.ilPropertyFormGUI.php");
2410 if ($a_mode ==
"create")
2412 $this->form_gui->setTitle($lng->txt(
"sty_add_template"));
2416 $this->form_gui->setTitle($lng->txt(
"sty_edit_template"));
2420 $name_input =
new ilRegExpInputGUI($lng->txt(
"sty_template_name"),
"name");
2421 $name_input->
setPattern(
"/^[a-zA-Z]+[a-zA-Z0-9]*$/");
2422 $name_input->setNoMatchMessage($lng->txt(
"sty_msg_color_must_only_include").
" A-Z, a-z, 1-9");
2423 $name_input->setRequired(
true);
2424 $name_input->setSize(30);
2425 $name_input->setMaxLength(30);
2426 $this->form_gui->addItem($name_input);
2430 foreach ($scs as $sc => $st)
2432 $sc_input =
new ilSelectInputGUI($lng->txt(
"sty_".$sc.
"_class"), $sc.
"_class");
2433 $chars = $this->
object->getCharacteristics($st);
2435 foreach($chars as $char)
2440 $this->form_gui->addItem($sc_input);
2443 if ($a_mode ==
"create")
2445 $this->form_gui->addCommandButton(
"saveTemplate", $lng->txt(
"save"));
2446 $this->form_gui->addCommandButton(
"cancelTemplateSaving", $lng->txt(
"cancel"));
2450 $this->form_gui->addCommandButton(
"refreshTemplate", $lng->txt(
"save_refresh"));
2451 $this->form_gui->addCommandButton(
"updateTemplate", $lng->txt(
"save_return"));
2452 $this->form_gui->addCommandButton(
"cancelTemplateSaving", $lng->txt(
"cancel"));
2454 $this->form_gui->setFormAction($ilCtrl->getFormAction($this));
2464 $ilCtrl->redirect($this,
"listTemplates");
2477 if ($this->form_gui->checkInput())
2481 $name_input = $this->form_gui->getItemByPostVar(
"name");
2482 $name_input->setAlert($lng->txt(
"sty_table_template_already_exists"));
2489 $classes[$tct] =
$_POST[$tct.
"_class"];
2491 $t_id = $this->
object->addTemplate(
$_GET[
"temp_type"],
$_POST[
"name"], $classes);
2492 $this->
object->writeTemplatePreview($t_id,
2494 $ilCtrl->redirect($this,
"listTemplates");
2497 $this->form_gui->setValuesByPost();
2498 $tpl->setContent($this->form_gui->getHTML());
2508 $ilCtrl->setParameter($this,
"t_id",
$_GET[
"t_id"]);
2511 if ($this->form_gui->checkInput())
2516 $name_input = $this->form_gui->getItemByPostVar(
"name");
2517 $name_input->setAlert($lng->txt(
"sty_template_already_exists"));
2524 $classes[$tct] =
$_POST[$tct.
"_class"];
2527 $this->
object->updateTemplate(
$_GET[
"t_id"],
2528 $_POST[
"name"], $classes);
2529 $this->
object->writeTemplatePreview(
$_GET[
"t_id"],
2533 $ilCtrl->redirect($this,
"listTemplates");
2538 $this->form_gui->setValuesByPost();
2549 $a_tpl =
new ilTemplate(
"tpl.template_edit.html",
true,
true,
2550 "Services/Style/Content");
2552 $a_tpl->setVariable(
"FORM", $this->form_gui->getHTML());
2554 $tpl->setContent($a_tpl->get());
2570 if (
$_GET[
"t_id"] > 0)
2572 $t = $this->
object->getTemplate(
$_GET[
"t_id"]);
2574 $values[
"name"] =
$t[
"name"];
2576 foreach ($scs as $k => $type)
2578 $values[$k.
"_class"] =
$t[
"classes"][$k];
2580 $this->form_gui->setValuesByArray($values);
2591 if (!is_array(
$_POST[
"tid"]) || count(
$_POST[
"tid"]) == 0)
2594 $ilCtrl->redirect($this,
"listTemplates");
2598 include_once(
"./Services/Utilities/classes/class.ilConfirmationGUI.php");
2600 $cgui->setFormAction($ilCtrl->getFormAction($this));
2601 $cgui->setHeaderText($lng->txt(
"sty_confirm_template_deletion"));
2602 $cgui->setCancel($lng->txt(
"cancel"),
"cancelTemplateDeletion");
2603 $cgui->setConfirm($lng->txt(
"sty_del_template"),
"deleteTemplate");
2605 foreach (
$_POST[
"tid"] as $tid)
2607 $classes = $this->
object->getTemplateClasses($tid);
2610 foreach ($classes as $cl)
2612 if ($cl !=
"" && !$listed[$cl])
2614 $cl_str.=
'<div>- '.
2616 $listed[$cl] =
true;
2621 $cl_str =
'<div style="padding-left:30px;" class="small">'.
2622 "<div><i>".$lng->txt(
"sty_style_class").
"</i></div>".$cl_str.
"</div>";
2624 $cgui->addItem(
"tid[]", $tid, $this->
object->lookupTemplateName($tid).$cl_str);
2627 $cgui->addButton($lng->txt(
"sty_del_template_keep_classes"),
"deleteTemplateKeepClasses");
2629 $tpl->setContent($cgui->getHTML());
2640 $ilCtrl->redirect($this,
"listTemplates");
2650 if (is_array(
$_POST[
"tid"]))
2652 foreach (
$_POST[
"tid"] as $tid)
2654 $this->
object->removeTemplate($tid);
2658 $ilCtrl->redirect($this,
"listTemplates");
2668 if (is_array(
$_POST[
"tid"]))
2670 foreach (
$_POST[
"tid"] as $tid)
2672 $cls = $this->
object->getTemplateClasses($tid);
2673 foreach ($cls as $k => $cls)
2675 $ty = $this->
object->determineTemplateStyleClassType(
$_GET[
"temp_type"], $k);
2677 $this->
object->deleteCharacteristic($ty, $ta, $cls);
2679 $this->
object->removeTemplate($tid);
2683 $ilCtrl->redirect($this,
"listTemplates");
2694 $tpl->setContent($this->form_gui->getHTML());
2704 include_once(
"Services/Form/classes/class.ilPropertyFormGUI.php");
2707 $this->form_gui->setTitle($lng->txt(
"sty_generate_template"));
2710 $name_input =
new ilRegExpInputGUI($lng->txt(
"sty_template_name"),
"name");
2711 $name_input->
setPattern(
"/^[a-zA-Z]+[a-zA-Z0-9]*$/");
2712 $name_input->setNoMatchMessage($lng->txt(
"sty_msg_color_must_only_include").
" A-Z, a-z, 1-9");
2713 $name_input->setRequired(
true);
2714 $name_input->setSize(30);
2715 $name_input->setMaxLength(30);
2716 $this->form_gui->addItem($name_input);
2719 $bl_input =
new ilSelectInputGUI($lng->txt(
"sty_template_layout"),
"layout");
2721 "coloredZebra" => $lng->txt(
"sty_table_template_colored_zebra"),
2722 "bwZebra" => $lng->txt(
"sty_table_template_bw_zebra"),
2723 "noZebra" => $lng->txt(
"sty_table_template_no_zebra")
2725 $bl_input->setOptions($options);
2726 $this->form_gui->addItem($bl_input);
2729 include_once(
"./Services/Style/Content/classes/class.ilNumericStyleValueInputGUI.php");
2732 $num_input->setValue(
"3px");
2733 $this->form_gui->addItem($num_input);
2738 $num_input->setValue(
"10px");
2739 $this->form_gui->addItem($num_input);
2742 $bc_input =
new ilSelectInputGUI($lng->txt(
"sty_base_color"),
"base_color");
2743 $cs = $this->
object->getColors();
2747 $options[$c[
"name"]] = $c[
"name"];
2750 $this->form_gui->addItem($bc_input);
2753 $lss =
array(
"border" => 90,
"header_text" => 70,
"header_bg" => 0,
2754 "cell1_text" => -60,
"cell1_bg" => 90,
"cell2_text" => -60,
"cell2_bg" => 75);
2755 foreach ($lss as $ls => $v)
2757 $l_input =
new ilNumberInputGUI($lng->txt(
"sty_lightness_".$ls),
"lightness_".$ls);
2759 $l_input->setMinValue(-100);
2760 $l_input->setValue($v);
2761 $l_input->setSize(4);
2762 $l_input->setMaxLength(4);
2763 $this->form_gui->addItem($l_input);
2766 $this->form_gui->addCommandButton(
"templateGeneration", $lng->txt(
"generate"));
2767 $this->form_gui->addCommandButton(
"cancelTemplateSaving", $lng->txt(
"cancel"));
2768 $this->form_gui->setFormAction($ilCtrl->getFormAction($this));
2780 if ($this->form_gui->checkInput())
2784 $name_input = $this->form_gui->getItemByPostVar(
"name");
2785 $name_input->setAlert($lng->txt(
"sty_table_template_already_exists"));
2792 $cells =
array(
"H" =>
"header",
"C1" =>
"cell1",
"C2" =>
"cell2");
2793 $tb_p = $this->form_gui->getItemByPostVar(
"tb_padding");
2794 $tb_padding = $tb_p->getValue();
2795 $lr_p = $this->form_gui->getItemByPostVar(
"lr_padding");
2796 $lr_padding = $lr_p->getValue();
2797 $cell_color =
$_POST[
"base_color"];
2800 if (
$_POST[
"layout"] ==
"bwZebra")
2802 $cell_color =
"MidGray";
2803 if (!$this->
object->colorExists($cell_color))
2805 $this->
object->addColor($cell_color,
"7F7F7F");
2807 $this->
object->updateColor($cell_color, $cell_color,
"7F7F7F");
2810 foreach ($cells as $k => $cell)
2812 $cell_class[$k] =
$_POST[
"name"].$k;
2813 if (!$this->
object->characteristicExists($cell_class[$k],
"table_cell"))
2815 $this->
object->addCharacteristic(
"table_cell", $cell_class[$k],
true);
2817 if (
$_POST[
"layout"] ==
"bwZebra" && $k ==
"H")
2819 $this->
object->replaceStylePar(
"td", $cell_class[$k],
"color",
2820 "!".
$_POST[
"base_color"].
"(".
$_POST[
"lightness_".$cell.
"_text"].
")",
"table_cell");
2821 $this->
object->replaceStylePar(
"td", $cell_class[$k],
"background-color",
2822 "!".$_POST[
"base_color"].
"(".$_POST[
"lightness_".$cell.
"_bg"].
")",
"table_cell");
2826 $this->
object->replaceStylePar(
"td", $cell_class[$k],
"color",
2827 "!".$cell_color.
"(".
$_POST[
"lightness_".$cell.
"_text"].
")",
"table_cell");
2828 $this->
object->replaceStylePar(
"td", $cell_class[$k],
"background-color",
2829 "!".$cell_color.
"(".
$_POST[
"lightness_".$cell.
"_bg"].
")",
"table_cell");
2831 $this->
object->replaceStylePar(
"td", $cell_class[$k],
"padding-top",
2832 $tb_padding,
"table_cell");
2833 $this->
object->replaceStylePar(
"td", $cell_class[$k],
"padding-bottom",
2834 $tb_padding,
"table_cell");
2835 $this->
object->replaceStylePar(
"td", $cell_class[$k],
"padding-left",
2836 $lr_padding,
"table_cell");
2837 $this->
object->replaceStylePar(
"td", $cell_class[$k],
"padding-right",
2838 $lr_padding,
"table_cell");
2839 $this->
object->replaceStylePar(
"td", $cell_class[$k],
"border-width",
2840 "1px",
"table_cell");
2841 $this->
object->replaceStylePar(
"td", $cell_class[$k],
"border-style",
2842 "solid",
"table_cell");
2843 $this->
object->replaceStylePar(
"td", $cell_class[$k],
"border-color",
2844 "!".$cell_color.
"(".
$_POST[
"lightness_border"].
")",
"table_cell");
2845 $this->
object->replaceStylePar(
"td", $cell_class[$k],
"font-weight",
2846 "normal",
"table_cell");
2850 $classes[
"table"] =
$_POST[
"name"].
"T";
2851 if (!$this->
object->characteristicExists($classes[
"table"],
"table"))
2853 $this->
object->addCharacteristic(
"table", $classes[
"table"],
true);
2855 $this->
object->replaceStylePar(
"table", $classes[
"table"],
"caption-side",
2857 $this->
object->replaceStylePar(
"table", $classes[
"table"],
"border-collapse",
2858 "collapse",
"table");
2859 $this->
object->replaceStylePar(
"table", $classes[
"table"],
"margin-top",
2861 $this->
object->replaceStylePar(
"table", $classes[
"table"],
"margin-bottom",
2863 if (
$_POST[
"layout"] ==
"bwZebra")
2865 $this->
object->replaceStylePar(
"table", $classes[
"table"],
"border-bottom-color",
2866 "!".
$_POST[
"base_color"],
"table");
2867 $this->
object->replaceStylePar(
"table", $classes[
"table"],
"border-bottom-style",
2869 $this->
object->replaceStylePar(
"table", $classes[
"table"],
"border-bottom-width",
2871 $sb =
array(
"left",
"right",
"top");
2874 $this->
object->replaceStylePar(
"table", $classes[
"table"],
"border-".$b.
"-width",
2879 switch (
$_POST[
"layout"])
2881 case "coloredZebra":
2882 $classes[
"row_head"] = $cell_class[
"H"];
2883 $classes[
"odd_row"] = $cell_class[
"C1"];
2884 $classes[
"even_row"] = $cell_class[
"C2"];
2888 $classes[
"row_head"] = $cell_class[
"H"];
2889 $classes[
"odd_row"] = $cell_class[
"C1"];
2890 $classes[
"even_row"] = $cell_class[
"C2"];
2894 $classes[
"row_head"] = $cell_class[
"H"];
2895 $classes[
"odd_row"] = $cell_class[
"C1"];
2896 $classes[
"even_row"] = $cell_class[
"C1"];
2897 $classes[
"col_head"] = $cell_class[
"C2"];
2902 $t_id = $this->
object->addTemplate(
$_GET[
"temp_type"],
2903 $_POST[
"name"], $classes);
2904 $this->
object->writeTemplatePreview($t_id,
2906 $ilCtrl->redirect($this,
"listTemplates");
2909 $this->form_gui->setValuesByPost();
2910 $tpl->setContent($this->form_gui->getHTML());
2917 include_once(
"./Services/Accordion/classes/class.ilAccordionGUI.php");
2920 $acc->addItem(
"Header 1", str_repeat(
"bla bla bla bla bla bla", 30));
2921 $acc->addItem(
"Header 2", str_repeat(
"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx xx x xx x xx", 30));
2925 $ac2->addItem(
"Header 1", str_repeat(
"bla bla bla bla bla bla", 30));
2926 $ac2->addItem(
"Header 2", $acc->getHTML());
2929 $tpl->setContent($ac2->getHTML());
2943 $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
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.
static _lookupTemplateName($a_t_id)
Lookup table template name for template ID.
exportStyleObject()
export style
static _getTemplatePreview($a_style, $a_type, $a_t_id, $a_small_mode=false)
Get table template preview.
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.
static getImageTagByType($a_type, $a_path, $a_big=false)
Builds an html image tag TODO: function still in use, but in future use getImagePath and move HTML-Co...
outputTagStyleEditScreen()
Output tag style edit screen.
Class ilObject Basic functions for all objects.
getAdminTabs()
admin and normal tabs are equal for roles
propertiesObject()
Properties.
afterImport(ilObject $a_new_obj)
After import.
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)
static _lookupTitle($a_id)
lookup object title
getTabs()
adds tabs to tab gui object
addCharacteristicFormObject()
Add characteristic.
setCreationMode($a_mode=true)
if true, a creation screen is displayed the current $_GET[ref_id] don't belong to the current class! ...
deleteTemplateConfirmationObject()
Delete table template confirmation.
writeStylePar($cur_tag, $cur_class, $par, $value, $a_type, $a_mq_id, $a_custom=false)
deleteCoreCharMessage()
Message that appears, when user tries to delete core characteristics.
static _getClonableContentStyles()
Get all clonable styles (active standard styles and individual learning module styles with write perm...
deleteColorConfirmationObject()
Delete color confirmation.
deleteCharacteristicConfirmationObject()
Characteristic deletion confirmation screen.
initMediaQueryForm($a_mode="create")
Init media query form.
setTemplatesSubTabs()
adds tabs to tab gui object
generateTemplateObject()
Generate table template.
saveHideStatusObject()
Save hide status for characteristics.
static _getStyleSuperTypes()
addColorObject()
Add a color.
addImageObject()
Add an image.
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.
prepareOutput($a_show_subobjects=true)
prepare output
getCreationFormsHTML(array $a_forms)
Get HTML for creation forms (accordion)
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.
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.
static getInstanceByObjId($a_obj_id, $stop_on_error=true)
get an instance of an Ilias object by object id
getColorFormValues()
Set values for color editing.
saveColorObject()
Save color.
Create styles array
The data for the language used.
includeCSS()
Include CSS in output.
TableGUI class for style editor (image list)
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
pasteCharacteristicsObject()
Paste characteristics.
if(php_sapi_name() !='cli') $in
refreshTagStyleObject()
save and refresh tag editing
static getContentStylePath($a_style_id)
get content style path
switchMQueryObject()
Switch media query.
updateTemplateObject($a_refresh=false)
Update table template.
refreshObject()
refresh style sheet
deleteImageObject()
Delete images.
cancelObject()
update style sheet
addTemplateObject()
Add template.
static _writeStandard($a_id, $a_std)
Write standard flag.
cancelDeleteObject()
cancel oobject deletion
addMediaQueryObject()
Add a media query.
Create new PHPExcel object
obj_idprivate
Class ilObjStyleSheetGUI.
saveMediaQueryObject()
Save media query.
initColorForm($a_mode="create")
Init color form.
static _renderTable($content, $a_mode="table_edit", $a_submode="", $a_table_obj=null)
Static render table function.
This class represents a text area property in a property form.
initTagStyleForm($a_mode, $a_cur_tag)
Init tag style editing form.
static _getStyleParameters($a_tag="")
__construct($a_data, $a_id, $a_call_by_reference, $a_prep=true)
Constructor public.
deleteObject($a_error=false)
display deletion confirmation screen
cancelUploadObject()
Cancel Upload.
copyCharacteristicsObject()
Copy style classes.
listTemplatesObject()
List templates.
static getInstanceByRefId($a_ref_id, $stop_on_error=true)
get an instance of an Ilias object by reference id
executeCommand()
execute command
cancelTemplateSavingObject()
Cancel color saving.
editTemplateObject()
Edit table template.
updateObject()
Update properties.
static _getStyleParameterInputType($par)
initTemplateGenerationForm()
Init table template generation form.
deleteColorObject()
Delete colors.
Accordion user interface class.
displayTemplateEditForm()
Display table tempalte edit form.
addAdminLocatorItems($a_do_not_add_object=false)
should be overwritten to add object specific items (repository items are preloaded) ...
editMediaQueryObject()
Edit media query.
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.
static _writeUpToDate($a_id, $a_up_to_date)
Write up to date.
Confirmation screen class.