4 require_once
"./Services/Object/classes/class.ilObjectGUI.php";
5 require_once
"./Services/Style/Content/classes/class.ilObjStyleSheet.php";
47 public function __construct($a_data, $a_id, $a_call_by_reference, $a_prep =
true)
51 $this->tpl = $DIC[
"tpl"];
52 $this->rbacsystem = $DIC->rbac()->system();
53 $this->help = $DIC[
"ilHelp"];
54 $this->tabs = $DIC->tabs();
55 $this->toolbar = $DIC->toolbar();
56 $this->locator = $DIC[
"ilLocator"];
57 $this->tree = $DIC->repositoryTree();
58 $this->obj_definition = $DIC[
"objDefinition"];
60 $lng = $DIC->language();
65 $this->lng->loadLanguageModule(
"style");
66 $ilCtrl->saveParameter($this, array(
"tag",
"style_type",
"temp_type"));
67 if (
$_GET[
"style_type"] !=
"") {
72 parent::__construct($a_data, $a_id, $a_call_by_reference,
false);
80 $next_class = $this->ctrl->getNextClass($this);
81 $cmd = $this->ctrl->getCmd(
"edit");
89 switch ($next_class) {
117 $ilHelp->setScreenIdComponent(
"sty");
122 include_once
"Services/Form/classes/class.ilPropertyFormGUI.php";
124 $form->setFormAction($this->ctrl->getFormAction($this));
125 $form->setTitle($this->lng->txt(
"sty_create_new_stylesheet"));
128 $ti =
new ilTextInputGUI($this->lng->txt(
"title"),
"style_title");
131 $ti->setRequired(
true);
140 $form->addCommandButton(
"save", $this->lng->txt(
"save"));
141 $form->addCommandButton(
"cancel", $this->lng->txt(
"cancel"));
148 include_once
"Services/Form/classes/class.ilPropertyFormGUI.php";
150 $form->setFormAction($this->ctrl->getFormAction($this));
151 $form->setTitle($this->lng->txt(
"sty_import_stylesheet"));
154 $ti =
new ilFileInputGUI($this->lng->txt(
"import_file"),
"importfile");
158 $form->addCommandButton(
"importStyle", $this->lng->txt(
"import"));
159 $form->addCommandButton(
"cancel", $this->lng->txt(
"cancel"));
166 include_once
"Services/Form/classes/class.ilPropertyFormGUI.php";
168 $form->setFormAction($this->ctrl->getFormAction($this));
169 $form->setTitle($this->lng->txt(
"sty_copy_other_stylesheet"));
177 $form->addCommandButton(
"copyStyle", $this->lng->txt(
"copy"));
178 $form->addCommandButton(
"cancel", $this->lng->txt(
"cancel"));
192 $this->tpl->setCurrentBlock(
"ContentStyle");
193 $this->tpl->setVariable(
194 "LOCATION_CONTENT_STYLESHEET",
197 $this->tpl->parseCurrentBlock();
212 ||
$rbacsystem->checkAccess(
"sty_write_content", (
int) $_GET[
"ref_id"]));
232 $ctpl =
new ilTemplate(
"tpl.sty_classes.html",
true,
true,
"Services/Style/Content");
235 $chars = $this->
object->getCharacteristics();
237 $style_type = ($this->super_type !=
"")
240 $ilCtrl->setParameter($this,
"style_type", $style_type);
241 $ilTabs->setSubTabActive(
"sty_" . $style_type .
"_char");
244 if ($this->super_type ==
"rte") {
245 $tpl->addCss(
"Modules/Scorm2004/templates/default/player.css");
246 include_once(
"./Modules/Scorm2004/classes/ilSCORM13Player.php");
247 $tpl->addInlineCss(ilSCORM13Player::getInlineCss());
252 $subtypes = $all_super_types[$style_type];
254 foreach ($subtypes as
$t) {
260 $ilToolbar->addButton(
261 $lng->txt(
"sty_add_characteristic"),
262 $ilCtrl->getLinkTarget($this,
"addCharacteristicForm")
267 $style_cp = explode(
":::",
$_SESSION[
"sty_copy"]);
268 if ($style_cp[1] == $style_type) {
270 $ilToolbar->addSeparator();
272 $ilToolbar->addButton(
273 $lng->txt(
"sty_paste_style_classes"),
274 $ilCtrl->getLinkTarget($this,
"pasteCharacteristicsOverview")
279 include_once(
"./Services/Style/Content/classes/class.ilStyleTableGUI.php");
288 $ctpl->setCurrentBlock(
"style_table");
289 $ctpl->setVariable(
"STYLE_TABLE", $table_gui->getHTML());
290 $ctpl->parseCurrentBlock();
292 $this->tpl->setContent($ctpl->get());
305 $this->tpl->setCurrentBlock(
"ContentStyle");
306 $this->tpl->setVariable(
307 "LOCATION_CONTENT_STYLESHEET",
310 $this->tpl->parseCurrentBlock();
313 $ilToolbar->addButton(
314 $this->lng->txt(
"export"),
315 $this->ctrl->getLinkTarget($this,
"exportStyle")
320 $this->tpl->setContent($this->form->getHTML());
331 $values[
"style_title"] = $this->
object->getTitle();
332 $values[
"style_description"] = $this->
object->getDescription();
333 $values[
"disable_auto_margins"] = (int) $this->object->lookupStyleSetting(
"disable_auto_margins");
335 $this->form->setValuesByArray(
$values);
348 include_once(
"Services/Form/classes/class.ilPropertyFormGUI.php");
352 $ti =
new ilTextInputGUI($this->lng->txt(
"title"),
"style_title");
355 $ti->setRequired(
true);
356 $this->form->addItem($ti);
362 $this->form->addItem($ta);
365 $cb =
new ilCheckboxInputGUI($this->lng->txt(
"sty_disable_auto_margins"),
"disable_auto_margins");
366 $cb->
setInfo($this->lng->txt(
"sty_disable_auto_margins_info"));
367 $this->form->addItem($cb);
371 if ($a_mode ==
"create") {
372 $this->form->addCommandButton(
"save",
$lng->txt(
"save"));
373 $this->form->addCommandButton(
"cancelSave",
$lng->txt(
"cancel"));
376 $this->form->addCommandButton(
"update",
$lng->txt(
"save"));
380 $this->form->setTitle(
$lng->txt(
"edit_stylesheet"));
381 $this->form->setFormAction($this->ctrl->getFormAction($this));
394 if ($this->form->checkInput()) {
395 $this->
object->setTitle($this->form->getInput(
"style_title"));
396 $this->
object->setDescription($this->form->getInput(
"style_description"));
397 $this->
object->writeStyleSetting(
398 "disable_auto_margins",
399 $this->form->getInput(
"disable_auto_margins")
401 $this->
object->update();
403 $ilCtrl->redirect($this,
"properties");
405 $this->form->setValuesByPost();
406 $tpl->setContent($this->form->getHtml());
417 $cur = explode(
".",
$_GET[
"tag"]);
419 $cur_class = $cur[1];
423 if ($this->form_gui->checkInput()) {
425 $ilCtrl->redirect($this,
"editTagStyle");
427 $this->form_gui->setValuesByPost();
439 $cur = explode(
".",
$_GET[
"tag"]);
441 $cur_class = $cur[1];
444 if ($this->form_gui->checkInput()) {
446 $ilCtrl->redirect($this,
"edit");
448 $this->form_gui->setValuesByPost();
458 $cur = explode(
".",
$_GET[
"tag"]);
460 $cur_class = $cur[1];
462 foreach ($avail_pars as $par => $v) {
463 $var = str_replace(
"-",
"_", $par);
464 $basepar_arr = explode(
".", $par);
465 $basepar = $basepar_arr[0];
466 if ($basepar_arr[1] !=
"" && $basepar_arr[1] != $cur_tag) {
470 switch ($v[
"input"]) {
472 case "numeric_no_perc":
474 case "background_image":
475 $in = $this->form_gui->getItemByPostVar($basepar);
481 $color = trim(
$_POST[$basepar]);
482 if ($color !=
"" && trim(substr($color, 0, 1) !=
"!")) {
483 $color =
"#" . $color;
491 $in = $this->form_gui->getItemByPostVar($basepar);
492 $this->
writeStylePar($cur_tag, $cur_class, $v[
"subpar"][0],
$in->getAllValue(), $_GET[
"style_type"], (int) $_GET[
"mq_id"]);
493 $this->
writeStylePar($cur_tag, $cur_class, $v[
"subpar"][1],
$in->getTopValue(), $_GET[
"style_type"], (int) $_GET[
"mq_id"]);
494 $this->
writeStylePar($cur_tag, $cur_class, $v[
"subpar"][2],
$in->getRightValue(), $_GET[
"style_type"], (int) $_GET[
"mq_id"]);
495 $this->
writeStylePar($cur_tag, $cur_class, $v[
"subpar"][3],
$in->getBottomValue(), $_GET[
"style_type"], (int) $_GET[
"mq_id"]);
496 $this->
writeStylePar($cur_tag, $cur_class, $v[
"subpar"][4],
$in->getLeftValue(), $_GET[
"style_type"], (int) $_GET[
"mq_id"]);
500 $in = $this->form_gui->getItemByPostVar($basepar);
501 $tblr_p = array(0 =>
"getAllValue", 1 =>
"getTopValue", 2 =>
"getRightValue",
502 3 =>
"getBottomValue", 4 =>
"getLeftValue");
503 foreach ($tblr_p as $k => $func) {
504 $val = trim(
$in->$func());
505 $val = ((
$in->getAcceptNamedColors() && substr($val, 0, 1) ==
"!")
509 $this->
writeStylePar($cur_tag, $cur_class, $v[
"subpar"][$k], $val, $_GET[
"style_type"], (
int) $_GET[
"mq_id"]);
513 case "background_position":
514 $in = $this->form_gui->getItemByPostVar($basepar);
515 $this->
writeStylePar($cur_tag, $cur_class, $basepar,
$in->getValue(), $_GET[
"style_type"], (int) $_GET[
"mq_id"]);
519 $this->
writeStylePar($cur_tag, $cur_class, $basepar,
$_POST[$basepar], $_GET[
"style_type"], (
int) $_GET[
"mq_id"]);
525 $this->
object->deleteCustomStylePars($cur_tag, $cur_class,
$_GET[
"style_type"], (
int)
$_GET[
"mq_id"]);
526 if (is_array(
$_POST[
"custom_par"])) {
527 foreach (
$_POST[
"custom_par"] as $cpar) {
528 $par_arr = explode(
":", $cpar);
529 if (count($par_arr) == 2) {
530 $par = trim($par_arr[0]);
531 $val = trim(str_replace(
";",
"", $par_arr[1]));
532 $this->
writeStylePar($cur_tag, $cur_class, $par, $val, $_GET[
"style_type"], (
int) $_GET[
"mq_id"],
true);
537 $this->
object->update();
549 $this->
object->replaceStylePar($cur_tag, $cur_class, $par, $value,
$a_type, $a_mq_id, $a_custom);
551 $this->
object->deleteStylePar($cur_tag, $cur_class, $par,
$a_type, $a_mq_id, $a_custom);
567 $mqs = $this->
object->getMediaQueries();
568 if (count($mqs) > 0) {
571 "" =>
$lng->txt(
"sty_default"),
573 foreach ($mqs as $mq) {
574 $options[$mq[
"id"]] = $mq[
"mquery"];
576 include_once(
"./Services/Form/classes/class.ilSelectInputGUI.php");
579 $si->setValue((
int)
$_GET[
"mq_id"]);
580 $ilToolbar->addInputItem(
$si,
true);
581 $ilToolbar->setFormAction(
$ilCtrl->getFormAction($this));
582 $ilToolbar->addFormButton(
$lng->txt(
"sty_switch"),
"switchMQuery");
587 if ($this->super_type ==
"rte") {
588 $tpl->addCss(
"Modules/Scorm2004/templates/default/player.css");
589 include_once(
"./Modules/Scorm2004/classes/ilSCORM13Player.php");
590 $tpl->addInlineCss(ilSCORM13Player::getInlineCss());
593 $cur = explode(
".",
$_GET[
"tag"]);
595 $cur_class = $cur[1];
612 $ilCtrl->setParameter($this,
"mq_id", (
int)
$_POST[
"mq_id"]);
613 $ilCtrl->redirect($this,
"editTagStyle");
627 $tpl->setCurrentBlock(
"ContentStyle");
629 "LOCATION_CONTENT_STYLESHEET",
633 $ts_tpl =
new ilTemplate(
"tpl.style_tag_edit.html",
true,
true,
"Services/Style/Content");
635 $cur = explode(
".",
$_GET[
"tag"]);
637 $cur_class = $cur[1];
639 $ts_tpl->setVariable(
644 $ts_tpl->setVariable(
646 $this->form_gui->getHtml()
649 $tpl->setTitle($cur_class .
" (" .
$lng->txt(
"sty_type_" .
$_GET[
"style_type"]) .
")");
651 $tpl->setContent($ts_tpl->get());
665 $ilCtrl->saveParameter($this, array(
"mq_id"));
667 include_once(
"Services/Form/classes/class.ilPropertyFormGUI.php");
670 $avail_pars = $this->
object->getAvailableParameters();
671 $groups = $this->
object->getStyleParameterGroups();
674 foreach ($groups as $k => $group) {
678 if (is_array($filtered_groups[$k]) && !in_array($a_cur_tag, $filtered_groups[$k])) {
683 $sh->setTitle(
$lng->txt(
"sty_" . $k));
684 $this->form_gui->addItem($sh);
686 foreach ($group as $par) {
687 $basepar = explode(
".", $par);
688 $basepar = $basepar[0];
690 $var = str_replace(
"-",
"_", $basepar);
691 $up_par = strtoupper($var);
697 foreach ($avail_pars[$par] as $p) {
701 $this->form_gui->addItem($sel_input);
707 $text_input->setSize(20);
708 $this->form_gui->addItem($text_input);
712 include_once(
"./Services/Style/Content/classes/class.ilFontSizeInputGUI.php");
714 $this->form_gui->addItem($fs_input);
717 case "numeric_no_perc":
719 include_once(
"./Services/Style/Content/classes/class.ilNumericStyleValueInputGUI.php");
724 $this->form_gui->addItem($num_input);
730 $per_input->setMaxValue(100);
731 $per_input->setMaxLength(3);
732 $per_input->setSize(3);
733 $this->form_gui->addItem($per_input);
740 $col_input->setAcceptNamedColors(
true);
741 $this->form_gui->addItem($col_input);
745 include_once(
"./Services/Style/Content/classes/class.ilTRBLNumericStyleValueInputGUI.php");
750 $this->form_gui->addItem($num_input);
754 include_once(
"./Services/Style/Content/classes/class.ilTRBLBorderWidthInputGUI.php");
756 $this->form_gui->addItem($bw_input);
760 include_once(
"./Services/Style/Content/classes/class.ilTRBLBorderStyleInputGUI.php");
762 $this->form_gui->addItem($bw_input);
766 include_once(
"./Services/Style/Content/classes/class.ilTRBLColorPickerInputGUI.php");
769 $this->form_gui->addItem($col_input);
772 case "background_image":
773 include_once(
"./Services/Style/Content/classes/class.ilBackgroundImageInputGUI.php");
776 foreach ($this->object->getImages() as $entry) {
777 $imgs[] = $entry[
"entry"];
780 $this->form_gui->addItem($im_input);
783 case "background_position":
784 include_once(
"./Services/Style/Content/classes/class.ilBackgroundPositionInputGUI.php");
786 $this->form_gui->addItem($im_input);
794 $sh->setTitle(
$lng->txt(
"sty_custom"));
795 $this->form_gui->addItem($sh);
798 $ti =
new ilTextInputGUI($this->lng->txt(
"sty_custom_par"),
"custom_par");
802 $ti->setInfo($this->lng->txt(
"sty_custom_par_info"));
803 $this->form_gui->addItem($ti);
807 $this->form_gui->addCommandButton(
"updateTagStyle",
$lng->txt(
"save_return"));
808 $this->form_gui->addCommandButton(
"refreshTagStyle",
$lng->txt(
"save_refresh"));
811 $this->form_gui->setFormAction($this->ctrl->getFormAction($this));
820 $style = $this->
object->getStyle();
821 $cur = explode(
".",
$_GET[
"tag"]);
823 $cur_class = $cur[1];
829 (
int)
$_GET[
"mq_id"],
833 foreach ($parameters as $p => $v) {
835 if (is_array($filtered_groups[$v[
"group"]]) && !in_array($cur_tag, $filtered_groups[$v[
"group"]])) {
838 $p = explode(
".", $p);
840 $input = $this->form_gui->getItemByPostVar($p);
841 switch ($v[
"input"]) {
849 $input->setAllValue($cur_parameters[$v[
"subpar"][0]]);
850 $input->setTopValue($cur_parameters[$v[
"subpar"][1]]);
851 $input->setRightValue($cur_parameters[$v[
"subpar"][2]]);
852 $input->setBottomValue($cur_parameters[$v[
"subpar"][3]]);
853 $input->setLeftValue($cur_parameters[$v[
"subpar"][4]]);
857 $input->setValue($cur_parameters[$p]);
867 (
int) $_GET[
"mq_id"],
871 foreach ($cust_parameters as $k =>
$c) {
872 $vals[] = $k .
": " .
$c;
874 $input = $this->form_gui->getItemByPostVar(
"custom_par");
883 include_once(
"./Services/Export/classes/class.ilExport.php");
885 $r = $exp->exportObject($this->object->getType(), $this->
object->getId());
892 $parameters = array();
893 foreach ($a_style as
$tag) {
894 foreach ($tag as $par) {
895 if ($par[
"tag"] == $a_tag && $par[
"class"] == $a_class
896 && $par[
"type"] ==
$a_type && (
int) $a_mq_id == (
int) $par[
"mq_id"]
897 && (
int) $a_custom == (
int) $par[
"custom"]) {
898 $parameters[$par[
"parameter"]] = $par[
"value"];
910 $this->
object->addParameter(
$_POST[
"tag"],
$_POST[
"parameter"]);
919 $this->
object->setTitle(
$_POST[
"style_title"]);
920 $this->
object->setDescription(
$_POST[
"style_description"]);
922 foreach (
$_POST[
"styval"] as
$id => $value) {
923 $this->
object->updateStyleParameter(
$id, $value);
925 $this->
object->update();
939 include_once(
"./Services/Utilities/classes/class.ilConfirmationGUI.php");
941 $cgui->setFormAction($this->ctrl->getFormAction($this));
942 $cgui->setHeaderText($this->lng->txt(
"info_delete_sure"));
943 $cgui->setCancel($this->lng->txt(
"cancel"),
"cancelDelete");
944 $cgui->setConfirm($this->lng->txt(
"confirm"),
"confirmedDelete");
949 $cgui->addItem(
"id[]",
"", $caption);
951 $this->tpl->setContent($cgui->getHTML());
960 $this->ctrl->returnToParent($this);
968 $this->
object->delete();
970 $this->ctrl->returnToParent($this);
978 if (is_array(
$_POST[
"sty_select"])) {
979 foreach (
$_POST[
"sty_select"] as
$id => $dummy) {
980 $this->
object->deleteParameter(
$id);
983 $this->
object->read();
984 $this->
object->writeCSSFile();
993 if (!trim(
$_POST[
"style_title"])) {
994 $this->ctrl->redirect($this,
"create");
998 $default_style = $this->
settings->get(
"default_content_style_id");
1001 $new_id = $style_obj->ilClone();
1006 $style_id = $imp->importObject(
1011 $a_comp =
"Services/Style",
1026 if (
$_GET[
"ref_id"] > 0) {
1028 if ($fold->getType() ==
"stys") {
1029 include_once(
"./Services/Style/Content/classes/class.ilContentStyleSettings.php");
1031 $cont_style_settings->addStyle($newObj->getId());
1032 $cont_style_settings->update();
1035 $this->ctrl->returnToParent($this);
1039 return $newObj->getId();
1047 if (
$_POST[
"source_style"] > 0) {
1049 $new_id = $style_obj->ilClone();
1054 if (
$_GET[
"ref_id"] > 0) {
1056 if ($fold->getType() ==
"stys") {
1057 include_once(
"./Services/Style/Content/classes/class.ilContentStyleSettings.php");
1059 $cont_style_settings->addStyle($new_id);
1060 $cont_style_settings->update();
1062 $this->ctrl->returnToParent($this);
1075 $source = $_FILES[
"importfile"][
"tmp_name"];
1077 $this->
ilias->raiseError(
"No file selected!", $this->
ilias->error_obj->MESSAGE);
1081 $info = pathinfo($_FILES[
"importfile"][
"name"]);
1082 if (strtolower(
$info[
"extension"]) !=
"zip" && strtolower(
$info[
"extension"]) !=
"xml") {
1083 $this->
ilias->raiseError(
"File must be a zip or xml file!", $this->
ilias->error_obj->MESSAGE);
1087 $fname = explode(
"_", $_FILES[
"importfile"][
"name"]);
1088 if (strtolower(
$info[
"extension"]) ==
"zip" && $fname[4] ==
"sty") {
1089 include_once(
"./Services/Export/classes/class.ilImport.php");
1091 $new_id = $imp->importObject(
1093 $_FILES[
"importfile"][
"tmp_name"],
1094 $_FILES[
"importfile"][
"name"],
1101 require_once(
"./Services/Style/Content/classes/class.ilObjStyleSheet.php");
1103 $newObj->import($_FILES[
"importfile"]);
1108 if (
$_GET[
"ref_id"] > 0) {
1110 if ($fold->getType() ==
"stys") {
1111 include_once(
"./Services/Style/Content/classes/class.ilContentStyleSettings.php");
1113 $cont_style_settings->addStyle($newObj->getId());
1114 $cont_style_settings->update();
1116 $this->ctrl->returnToParent($this);
1119 return $newObj->getId();
1141 $this->ctrl->returnToParent($this);
1159 $this->
getTabs($this->tabs_gui);
1161 if (strtolower(get_class($this->
object)) ==
"ilobjstylesheet") {
1162 $this->tpl->setVariable(
"HEADER", $this->object->getTitle());
1164 $this->tpl->setVariable(
"HEADER",
$lng->txt(
"create_stylesheet"));
1180 $ilHelp->setScreenIdComponent(
"sty");
1182 if (
$ilCtrl->getCmd() ==
"editTagStyle") {
1184 $this->tabs_gui->setBackTarget(
1186 $ilCtrl->getLinkTarget($this,
"edit")
1189 $t = explode(
".",
$_GET[
"tag"]);
1190 $t2 = explode(
":",
$t[1]);
1191 $pc = $this->
object->_getPseudoClasses(
$t[0]);
1192 if (is_array($pc) && count($pc) > 0) {
1194 $ilCtrl->setParameter($this,
"tag",
$t[0] .
"." . $t2[0]);
1195 $this->tabs_gui->addTarget(
1197 $this->ctrl->getLinkTarget($this,
"editTagStyle"),
1198 array(
"editTagStyle",
""),
1202 $ilTabs->setTabActive(
"sty_tag_normal");
1205 foreach ($pc as $p) {
1207 $ilCtrl->setParameter($this,
"tag",
$t[0] .
"." . $t2[0] .
":" . $p);
1208 $this->tabs_gui->addTarget(
1210 $this->ctrl->getLinkTarget($this,
"editTagStyle"),
1211 array(
"editTagStyle",
""),
1215 $ilTabs->setTabActive(
"sty_tag_" . $p);
1222 $this->tabs_gui->setBackTarget(
1224 $this->ctrl->getLinkTarget($this,
"returnToUpperContext")
1228 $this->tabs_gui->addTarget(
1230 $this->ctrl->getLinkTarget($this,
"edit"),
1236 $this->tabs_gui->addTarget(
1238 $this->ctrl->getLinkTarget($this,
"listColors"),
1244 $this->tabs_gui->addTarget(
1245 "sty_media_queries",
1246 $this->ctrl->getLinkTarget($this,
"listMediaQueries"),
1252 $this->tabs_gui->addTarget(
1254 $this->ctrl->getLinkTarget($this,
"listImages"),
1260 $this->tabs_gui->addTarget(
1262 $this->ctrl->getLinkTarget($this,
"listTemplates"),
1268 $this->tabs_gui->addTarget(
1270 $this->ctrl->getLinkTarget($this,
"properties"),
1296 foreach ($types as $super_type => $types) {
1298 $ilCtrl->setParameter($this,
"style_type", $super_type);
1299 $ilTabs->addSubTabTarget(
1300 "sty_" . $super_type .
"_char",
1301 $this->ctrl->getLinkTarget($this,
"edit"),
1307 $ilCtrl->setParameter($this,
"style_type",
$_GET[
"style_type"]);
1323 foreach ($types as
$t =>
$c) {
1324 $ilCtrl->setParameter($this,
"temp_type",
$t);
1325 $ilTabs->addSubTabTarget(
1326 "sty_" .
$t .
"_templates",
1327 $this->ctrl->getLinkTarget($this,
"listTemplates"),
1328 array(
"listTemplates",
""),
1333 $ilCtrl->setParameter($this,
"temp_type",
$_GET[
"temp_type"]);
1344 if (
$_GET[
"admin_mode"] ==
"settings") {
1345 parent::addAdminLocatorItems(
true);
1347 $ilLocator->addItem(
1351 $this->ctrl->getLinkTargetByClass(
"ilobjstylesettingsgui",
"")
1354 if (
$_GET[
"obj_id"] > 0) {
1355 $ilLocator->addItem(
1356 $this->object->getTitle(),
1357 $this->ctrl->getLinkTarget($this,
"edit")
1371 if (strtolower(
$_GET[
"baseClass"]) ==
"iladministrationgui") {
1373 $this->ctrl->getLinkTargetByClass(
1374 "ilcontentstylesettings",
1395 $ilToolbar->addButton(
1396 $lng->txt(
"sty_add_image"),
1397 $ilCtrl->getLinkTarget($this,
"addImage")
1401 include_once(
"./Services/Style/Content/classes/class.ilStyleImageTableGUI.php");
1407 $tpl->setContent($table_gui->getHTML());
1418 $tpl->setContent($this->form_gui->getHTML());
1428 $ilCtrl->redirect($this,
"listImages");
1441 if ($this->form_gui->checkInput()) {
1442 $this->
object->uploadImage($_FILES[
"image_file"]);
1443 $ilCtrl->redirect($this,
"listImages");
1446 $tpl->setContent($this->form_gui->getHTML());
1458 include_once(
"Services/Form/classes/class.ilPropertyFormGUI.php");
1461 $this->form_gui->setTitle(
$lng->txt(
"sty_add_image"));
1465 $this->form_gui->addItem($file_input);
1467 $this->form_gui->addCommandButton(
"uploadImage",
$lng->txt(
"upload"));
1468 $this->form_gui->addCommandButton(
"cancelUpload",
$lng->txt(
"cancel"));
1469 $this->form_gui->setFormAction(
$ilCtrl->getFormAction($this));
1479 $images = $this->
object->getImages();
1481 foreach ($images as $image) {
1482 if (is_array(
$_POST[
"file"]) && in_array($image[
"entry"],
$_POST[
"file"])) {
1483 $this->
object->deleteImage($image[
"entry"]);
1486 $ilCtrl->redirect($this,
"listImages");
1500 if (!is_array(
$_POST[
"char"]) || count(
$_POST[
"char"]) == 0) {
1502 $ilCtrl->redirect($this,
"edit");
1506 foreach (
$_POST[
"char"] as $char) {
1507 if (!empty($core_styles[$char])) {
1513 include_once(
"./Services/Utilities/classes/class.ilConfirmationGUI.php");
1515 $cgui->setFormAction(
$ilCtrl->getFormAction($this));
1516 $cgui->setHeaderText(
$lng->txt(
"sty_confirm_char_deletion"));
1517 $cgui->setCancel(
$lng->txt(
"cancel"),
"cancelCharacteristicDeletion");
1518 $cgui->setConfirm(
$lng->txt(
"delete"),
"deleteCharacteristic");
1520 foreach (
$_POST[
"char"] as $char) {
1521 $char_comp = explode(
".", $char);
1522 $cgui->addItem(
"char[]", $char, $char_comp[2]);
1525 $tpl->setContent($cgui->getHTML());
1541 include_once(
"./Services/Utilities/classes/class.ilConfirmationGUI.php");
1543 $cgui->setFormAction(
$ilCtrl->getFormAction($this));
1548 foreach (
$_POST[
"char"] as $char) {
1549 if (!empty($core_styles[$char])) {
1551 $char_comp = explode(
".", $char);
1552 $cgui->addItem(
"",
"", $char_comp[2]);
1554 $cgui->addHiddenItem(
"char[]", $char);
1557 $all_core_styles = ($cnt == count(
$_POST[
"char"]))
1561 if ($all_core_styles) {
1562 $cgui->setHeaderText(
$lng->txt(
"sty_all_styles_obligatory"));
1563 $cgui->setCancel(
$lng->txt(
"back"),
"cancelCharacteristicDeletion");
1565 $cgui->setHeaderText(
$lng->txt(
"sty_some_styles_obligatory_delete_rest"));
1566 $cgui->setCancel(
$lng->txt(
"cancel"),
"cancelCharacteristicDeletion");
1567 $cgui->setConfirm(
$lng->txt(
"sty_delete_other_selected"),
"deleteCharacteristicConfirmation");
1570 $tpl->setContent($cgui->getHTML());
1582 $ilCtrl->redirect($this,
"edit");
1592 if (is_array(
$_POST[
"char"])) {
1593 foreach (
$_POST[
"char"] as $char) {
1594 $char_comp = explode(
".", $char);
1595 $type = $char_comp[0];
1596 $tag = $char_comp[1];
1597 $class = $char_comp[2];
1599 $this->
object->deleteCharacteristic(
$type,
$tag, $class);
1603 $ilCtrl->redirect($this,
"edit");
1614 $tpl->setContent($this->form_gui->getHTML());
1628 if ($this->form_gui->checkInput()) {
1629 if ($this->object->characteristicExists(
$_POST[
"new_characteristic"],
$_GET[
"style_type"])) {
1630 $char_input = $this->form_gui->getItemByPostVar(
"new_characteristic");
1631 $char_input->setAlert(
$lng->txt(
"sty_characteristic_already_exists"));
1633 $this->
object->addCharacteristic(
$_POST[
"type"],
$_POST[
"new_characteristic"]);
1640 $ilCtrl->setParameter($this,
"style_type", $_POST[
"type"]);
1641 $ilCtrl->redirect($this,
"editTagStyle");
1644 $this->form_gui->setValuesByPost();
1645 $tpl->setContent($this->form_gui->getHTML());
1658 include_once(
"Services/Form/classes/class.ilPropertyFormGUI.php");
1663 $txt_input->
setPattern(
"/^[a-zA-Z]+[a-zA-Z0-9]*$/");
1664 $txt_input->setNoMatchMessage(
$lng->txt(
"sty_msg_characteristic_must_only_include") .
" A-Z, a-z, 0-9");
1665 $txt_input->setRequired(
true);
1666 $this->form_gui->addItem($txt_input);
1670 $types = $all_super_types[$this->super_type];
1671 $exp_types = array();
1672 foreach ($types as
$t) {
1674 $exp_types[
$t] =
$lng->txt(
"sty_type_" . $t);
1677 if (count($exp_types) > 1) {
1680 $type_input->setValue(key($exp_types));
1681 $this->form_gui->addItem($type_input);
1682 } elseif (count($exp_types) == 1) {
1684 $hid_input->setValue(key($exp_types));
1685 $this->form_gui->addItem($hid_input);
1688 $this->form_gui->setTitle(
$lng->txt(
"sty_add_characteristic"));
1689 $this->form_gui->addCommandButton(
"saveCharacteristic",
$lng->txt(
"save"));
1690 $this->form_gui->addCommandButton(
"edit",
$lng->txt(
"cancel"));
1691 $this->form_gui->setFormAction(
$ilCtrl->getFormAction($this));
1701 $lng = $DIC->language();
1703 $c = explode(
":", $a_class);
1706 $ex_tpl =
new ilTemplate(
"tpl.style_example.html",
true,
true,
"Services/Style/Content");
1708 if ($ex_tpl->blockExists(
"Example_" .
$a_type)) {
1709 $ex_tpl->setCurrentBlock(
"Example_" .
$a_type);
1711 $ex_tpl->setCurrentBlock(
"Example_default");
1713 $ex_tpl->setVariable(
"EX_CLASS",
"ilc_" .
$a_type .
"_" . $a_class);
1714 $ex_tpl->setVariable(
"EX_TEXT",
"ABC abc 123");
1715 if (in_array(
$a_type, array(
"media_cont",
"qimg"))) {
1718 if (in_array(
$a_type, array(
"table",
"table_caption"))) {
1719 $ex_tpl->setVariable(
"TXT_CAPTION",
$lng->txt(
"sty_caption"));
1721 if (in_array($a_class, array(
"OrderListItemHorizontal",
"OrderListHorizontal"))) {
1722 $ex_tpl->setVariable(
"HOR",
"Horizontal");
1724 $ex_tpl->parseCurrentBlock();
1726 return $ex_tpl->get();
1739 foreach (
$_POST[
"all_chars"] as $char) {
1740 $ca = explode(
".", $char);
1741 $this->
object->saveHideStatus(
1744 (is_array(
$_POST[
"hide"]) && in_array($char,
$_POST[
"hide"]))
1749 $ilCtrl->redirect($this,
"edit");
1763 if (!is_array(
$_POST[
"char"]) || count(
$_POST[
"char"]) == 0) {
1766 $style_cp = implode(
"::",
$_POST[
"char"]);
1767 $style_cp = $this->
object->getId() .
":::" .
$_GET[
"style_type"] .
":::" . $style_cp;
1769 ilUtil::sendSuccess(
$lng->txt(
"sty_copied_please_select_target"),
true);
1771 $ilCtrl->redirect($this,
"edit");
1785 $ilTabs->clearTargets();
1787 include_once(
"./Services/Style/Content/classes/class.ilPasteStyleCharacteristicTableGUI.php");
1804 if (is_array(
$_POST[
"title"])) {
1805 foreach (
$_POST[
"title"] as $from_char => $to_title) {
1806 $fc = explode(
".", $from_char);
1808 if (
$_POST[
"conflict_action"][$from_char] ==
"overwrite" ||
1809 !$this->object->characteristicExists($to_title, $fc[0])) {
1810 $this->
object->copyCharacteristic(
1820 ilUtil::sendSuccess(
$lng->txt(
"sty_style_classes_copied"),
true);
1823 $ilCtrl->redirect($this,
"edit");
1841 $ilToolbar->addButton(
1842 $this->lng->txt(
"sty_add_color"),
1843 $ilCtrl->getLinkTarget($this,
"addColor")
1847 include_once(
"./Services/Style/Content/classes/class.ilStyleColorTableGUI.php");
1853 $tpl->setContent($table_gui->getHTML());
1864 $tpl->setContent($this->form_gui->getHTML());
1875 $ilCtrl->setParameter($this,
"c_name",
$_GET[
"c_name"]);
1878 $tpl->setContent($this->form_gui->getHTML());
1890 include_once(
"Services/Form/classes/class.ilPropertyFormGUI.php");
1893 $this->form_gui->setTitle(
$lng->txt(
"sty_add_color"));
1897 $name_input->
setPattern(
"/^[a-zA-Z]+[a-zA-Z0-9]*$/");
1898 $name_input->setNoMatchMessage(
$lng->txt(
"sty_msg_color_must_only_include") .
" A-Z, a-z, 1-9");
1899 $name_input->setRequired(
true);
1900 $name_input->setSize(15);
1901 $name_input->setMaxLength(15);
1902 $this->form_gui->addItem($name_input);
1907 $color_input->setDefaultColor(
"");
1908 $this->form_gui->addItem($color_input);
1910 if ($a_mode ==
"create") {
1911 $this->form_gui->addCommandButton(
"saveColor",
$lng->txt(
"save"));
1912 $this->form_gui->addCommandButton(
"cancelColorSaving",
$lng->txt(
"cancel"));
1914 $this->form_gui->addCommandButton(
"updateColor",
$lng->txt(
"save"));
1915 $this->form_gui->addCommandButton(
"cancelColorSaving",
$lng->txt(
"cancel"));
1917 $this->form_gui->setFormAction(
$ilCtrl->getFormAction($this));
1925 if (
$_GET[
"c_name"] !=
"") {
1927 $values[
"color_code"] = $this->
object->getColorCodeForName(
$_GET[
"c_name"]);
1928 $this->form_gui->setValuesByArray(
$values);
1939 $ilCtrl->redirect($this,
"listColors");
1953 if ($this->form_gui->checkInput()) {
1954 if ($this->object->colorExists(
$_POST[
"color_name"])) {
1955 $col_input = $this->form_gui->getItemByPostVar(
"color_name");
1956 $col_input->setAlert(
$lng->txt(
"sty_color_already_exists"));
1958 $this->
object->addColor(
1962 $ilCtrl->redirect($this,
"listColors");
1965 $this->form_gui->setValuesByPost();
1966 $tpl->setContent($this->form_gui->getHTML());
1980 if ($this->form_gui->checkInput()) {
1981 if ($this->object->colorExists(
$_POST[
"color_name"]) &&
1983 $col_input = $this->form_gui->getItemByPostVar(
"color_name");
1984 $col_input->setAlert(
$lng->txt(
"sty_color_already_exists"));
1986 $this->
object->updateColor(
1991 $ilCtrl->redirect($this,
"listColors");
1994 $ilCtrl->setParameter($this,
"c_name",
$_GET[
"c_name"]);
1995 $this->form_gui->setValuesByPost();
1996 $tpl->setContent($this->form_gui->getHTML());
2008 if (!is_array(
$_POST[
"color"]) || count(
$_POST[
"color"]) == 0) {
2010 $ilCtrl->redirect($this,
"listColors");
2012 include_once(
"./Services/Utilities/classes/class.ilConfirmationGUI.php");
2014 $cgui->setFormAction(
$ilCtrl->getFormAction($this));
2015 $cgui->setHeaderText(
$lng->txt(
"sty_confirm_color_deletion"));
2016 $cgui->setCancel(
$lng->txt(
"cancel"),
"cancelColorDeletion");
2017 $cgui->setConfirm(
$lng->txt(
"delete"),
"deleteColor");
2023 $tpl->setContent($cgui->getHTML());
2034 $ilCtrl->redirect($this,
"listColors");
2044 if (is_array(
$_POST[
"color"])) {
2046 $this->
object->removeColor($c);
2050 $ilCtrl->redirect($this,
"listColors");
2068 $ilToolbar->addButton(
2069 $this->lng->txt(
"sty_add_media_query"),
2070 $ilCtrl->getLinkTarget($this,
"addMediaQuery")
2074 include_once(
"./Services/Style/Content/classes/class.ilStyleMediaQueryTableGUI.php");
2080 $tpl->setContent($table_gui->getHTML());
2091 $tpl->setContent($this->form_gui->getHTML());
2105 $tpl->setContent($this->form_gui->getHTML());
2117 include_once(
"Services/Form/classes/class.ilPropertyFormGUI.php");
2120 $this->form_gui->setTitle(
$lng->txt(
"sty_add_media_query"));
2124 $ti->setMaxLength(2000);
2125 $ti->setInfo(
$lng->txt(
"sty_add_media_query_info"));
2126 $this->form_gui->addItem($ti);
2129 if ($a_mode ==
"create") {
2130 $this->form_gui->addCommandButton(
"saveMediaQuery",
$lng->txt(
"save"));
2131 $this->form_gui->addCommandButton(
"listMediaQueries",
$lng->txt(
"cancel"));
2133 $this->form_gui->addCommandButton(
"updateMediaQuery",
$lng->txt(
"save"));
2134 $this->form_gui->addCommandButton(
"listMediaQueries",
$lng->txt(
"cancel"));
2136 $this->form_gui->setFormAction(
$ilCtrl->getFormAction($this));
2144 if (
$_GET[
"mq_id"] !=
"") {
2145 foreach ($this->object->getMediaQueries() as $mq) {
2146 if ($mq[
"id"] == (
int)
$_GET[
"mq_id"]) {
2147 $values[
"mquery"] = $mq[
"mquery"];
2150 $this->form_gui->setValuesByArray(
$values);
2165 if ($this->form_gui->checkInput()) {
2166 $this->
object->addMediaQuery(
$_POST[
"mquery"]);
2167 $ilCtrl->redirect($this,
"listMediaQueries");
2169 $this->form_gui->setValuesByPost();
2170 $tpl->setContent($this->form_gui->getHTML());
2184 if ($this->form_gui->checkInput()) {
2185 $this->
object->updateMediaQuery((
int)
$_GET[
"mq_id"],
$_POST[
"mquery"]);
2186 $ilCtrl->redirect($this,
"listMediaQueries");
2189 $this->form_gui->setValuesByPost();
2190 $tpl->setContent($this->form_gui->getHTML());
2202 if (!is_array(
$_POST[
"mq_id"]) || count(
$_POST[
"mq_id"]) == 0) {
2204 $ilCtrl->redirect($this,
"listMediaQueries");
2206 include_once(
"./Services/Utilities/classes/class.ilConfirmationGUI.php");
2208 $cgui->setFormAction(
$ilCtrl->getFormAction($this));
2209 $cgui->setHeaderText(
$lng->txt(
"sty_sure_del_mqueries"));
2210 $cgui->setCancel(
$lng->txt(
"cancel"),
"listMediaQueries");
2211 $cgui->setConfirm(
$lng->txt(
"delete"),
"deleteMediaQueries");
2214 $mq = $this->
object->getMediaQueryForId($i);
2215 $cgui->addItem(
"mq_id[]", $i, $mq[
"mquery"]);
2218 $tpl->setContent($cgui->getHTML());
2235 $this->
object->deleteMediaQuery($id);
2238 $ilCtrl->redirect($this,
"listMediaQueries");
2251 if (is_array(
$_POST[
"order"])) {
2252 $this->
object->saveMediaQueryOrder(
$_POST[
"order"]);
2254 $ilCtrl->redirect($this,
"listMediaQueries");
2272 $ctype =
$_GET[
"temp_type"];
2275 $ilCtrl->setParameter($this,
"temp_type", $ctype);
2276 $_GET[
"temp_type"] = $ctype;
2280 $ilTabs->setSubTabActive(
"sty_" . $ctype .
"_templates");
2284 if ($ctype ==
"table") {
2285 $ilToolbar->addButton(
2286 $this->lng->txt(
"sty_generate_template"),
2287 $ilCtrl->getLinkTarget($this,
"generateTemplate")
2290 $ilToolbar->addButton(
2291 $this->lng->txt(
"sty_add_template"),
2292 $ilCtrl->getLinkTarget($this,
"addTemplate")
2299 include_once(
"./Services/Style/Content/classes/class.ilTableTemplatesTableGUI.php");
2306 $tpl->setContent($table_gui->getHTML());
2317 $tpl->setContent($this->form_gui->getHTML());
2355 $lng = $DIC->language();
2359 if ($a_small_mode) {
2364 $ts = $a_style->getTemplate($a_t_id);
2365 $t = $ts[
"classes"];
2369 $p_content =
'<PageContent><Table DataTable="y"';
2370 if (
$t[
"row_head"] !=
"") {
2371 $p_content .=
' HeaderRows="1"';
2373 if (
$t[
"row_foot"] !=
"") {
2374 $p_content .=
' FooterRows="1"';
2376 if (
$t[
"col_head"] !=
"") {
2377 $p_content .=
' HeaderCols="1"';
2379 if (
$t[
"col_foot"] !=
"") {
2380 $p_content .=
' FooterCols="1"';
2382 $p_content .=
' Template="' . $a_style->lookupTemplateName($a_t_id) .
'">';
2383 if (!$a_small_mode) {
2384 $p_content .=
'<Caption>' .
$lng->txt(
"sty_caption") .
'</Caption>';
2386 for (
$i = 1;
$i <= $kr;
$i++) {
2387 $p_content .=
'<TableRow>';
2388 for ($j = 1; $j <= $kc; $j++) {
2389 if ($a_small_mode) {
2390 $cell =
'<div style="height:2px;"></div>';
2394 $p_content .=
'<TableData><PageContent><Paragraph Characteristic="TableContent">' . $cell .
'</Paragraph></PageContent></TableData>';
2396 $p_content .=
'</TableRow>';
2398 $p_content .=
'</Table></PageContent>';
2402 include_once(
"./Services/Accordion/classes/class.ilAccordionGUI.php");
2405 if ($a_small_mode) {
2412 if (
$a_type ==
"vaccordion") {
2413 $p_content =
'<PageContent><Tabs HorizontalAlign="Left" Type="VerticalAccordion" ';
2414 if ($a_small_mode) {
2415 $p_content .=
' ContentWidth="70"';
2417 } elseif (
$a_type ==
"haccordion") {
2418 $p_content =
'<PageContent><Tabs Type="HorizontalAccordion"';
2419 if ($a_small_mode) {
2420 $p_content .=
' ContentHeight="40"';
2421 $p_content .=
' ContentWidth="70"';
2422 $c =
'&nbsp;&nbsp;&nbsp;&nbsp;';
2424 $p_content .=
' ContentHeight="40"';
2426 } elseif (
$a_type ==
"carousel") {
2427 $p_content =
'<PageContent><Tabs HorizontalAlign="Left" Type="Carousel" ';
2428 if ($a_small_mode) {
2429 $p_content .=
' ContentWidth="70"';
2434 $p_content .=
' Template="' . $a_style->lookupTemplateName($a_t_id) .
'">';
2435 $p_content .=
'<Tab><PageContent><Paragraph>' .
$c .
'</Paragraph></PageContent>';
2436 $p_content .=
'<TabCaption>' .
$h .
'</TabCaption>';
2437 $p_content .=
'</Tab>';
2438 $p_content .=
'</Tabs></PageContent>';
2441 $txml = $a_style->getTemplateXML();
2443 $p_content .= $txml;
2444 include_once(
"./Services/COPage/classes/class.ilPCTableGUI.php");
2449 $r_content .=
"<style>.owl-carousel{ display:block !important; }</style>";
2464 include_once(
"Services/Form/classes/class.ilPropertyFormGUI.php");
2467 if ($a_mode ==
"create") {
2468 $this->form_gui->setTitle(
$lng->txt(
"sty_add_template"));
2470 $this->form_gui->setTitle(
$lng->txt(
"sty_edit_template"));
2475 $name_input->
setPattern(
"/^[a-zA-Z]+[a-zA-Z0-9]*$/");
2476 $name_input->setNoMatchMessage(
$lng->txt(
"sty_msg_color_must_only_include") .
" A-Z, a-z, 1-9");
2477 $name_input->setRequired(
true);
2478 $name_input->setSize(30);
2479 $name_input->setMaxLength(30);
2480 $this->form_gui->addItem($name_input);
2484 foreach ($scs as
$sc => $st) {
2486 $chars = $this->
object->getCharacteristics($st);
2488 foreach ($chars as $char) {
2492 $this->form_gui->addItem($sc_input);
2495 if ($a_mode ==
"create") {
2496 $this->form_gui->addCommandButton(
"saveTemplate",
$lng->txt(
"save"));
2497 $this->form_gui->addCommandButton(
"cancelTemplateSaving",
$lng->txt(
"cancel"));
2499 $this->form_gui->addCommandButton(
"refreshTemplate",
$lng->txt(
"save_refresh"));
2500 $this->form_gui->addCommandButton(
"updateTemplate",
$lng->txt(
"save_return"));
2501 $this->form_gui->addCommandButton(
"cancelTemplateSaving",
$lng->txt(
"cancel"));
2503 $this->form_gui->setFormAction(
$ilCtrl->getFormAction($this));
2513 $ilCtrl->redirect($this,
"listTemplates");
2528 if ($this->form_gui->checkInput()) {
2529 if ($this->object->templateExists(
$_POST[
"name"])) {
2530 $name_input = $this->form_gui->getItemByPostVar(
"name");
2531 $name_input->setAlert(
$lng->txt(
"sty_table_template_already_exists"));
2535 $classes[$tct] =
$_POST[$tct .
"_class"];
2537 $t_id = $this->
object->addTemplate(
$_GET[
"temp_type"],
$_POST[
"name"], $classes);
2538 $this->
object->writeTemplatePreview(
2542 $ilCtrl->redirect($this,
"listTemplates");
2545 $this->form_gui->setValuesByPost();
2546 $tpl->setContent($this->form_gui->getHTML());
2561 if ($this->form_gui->checkInput()) {
2562 if ($this->object->templateExists(
$_POST[
"name"]) &&
2564 $name_input = $this->form_gui->getItemByPostVar(
"name");
2565 $name_input->setAlert(
$lng->txt(
"sty_template_already_exists"));
2569 $classes[$tct] =
$_POST[$tct .
"_class"];
2572 $this->
object->updateTemplate(
2577 $this->
object->writeTemplatePreview(
2582 $ilCtrl->redirect($this,
"listTemplates");
2587 $this->form_gui->setValuesByPost();
2599 "tpl.template_edit.html",
2602 "Services/Style/Content" 2605 $a_tpl->setVariable(
"FORM", $this->form_gui->getHTML());
2607 $tpl->setContent($a_tpl->get());
2623 if (
$_GET[
"t_id"] > 0) {
2624 $t = $this->
object->getTemplate(
$_GET[
"t_id"]);
2628 foreach ($scs as $k =>
$type) {
2629 $values[$k .
"_class"] =
$t[
"classes"][$k];
2631 $this->form_gui->setValuesByArray(
$values);
2644 if (!is_array(
$_POST[
"tid"]) || count(
$_POST[
"tid"]) == 0) {
2646 $ilCtrl->redirect($this,
"listTemplates");
2648 include_once(
"./Services/Utilities/classes/class.ilConfirmationGUI.php");
2650 $cgui->setFormAction(
$ilCtrl->getFormAction($this));
2651 $cgui->setHeaderText(
$lng->txt(
"sty_confirm_template_deletion"));
2652 $cgui->setCancel(
$lng->txt(
"cancel"),
"cancelTemplateDeletion");
2653 $cgui->setConfirm(
$lng->txt(
"sty_del_template"),
"deleteTemplate");
2655 foreach (
$_POST[
"tid"] as $tid) {
2656 $classes = $this->
object->getTemplateClasses($tid);
2659 foreach ($classes as $cl) {
2660 if ($cl !=
"" && !$listed[$cl]) {
2661 $cl_str .=
'<div>- ' .
2663 $listed[$cl] =
true;
2666 if ($cl_str !=
"") {
2667 $cl_str =
'<div style="padding-left:30px;" class="small">' .
2668 "<div><i>" .
$lng->txt(
"sty_style_class") .
"</i></div>" . $cl_str .
"</div>";
2670 $cgui->addItem(
"tid[]", $tid, $this->object->lookupTemplateName($tid) . $cl_str);
2673 $cgui->addButton(
$lng->txt(
"sty_del_template_keep_classes"),
"deleteTemplateKeepClasses");
2675 $tpl->setContent($cgui->getHTML());
2686 $ilCtrl->redirect($this,
"listTemplates");
2696 if (is_array(
$_POST[
"tid"])) {
2697 foreach (
$_POST[
"tid"] as $tid) {
2698 $this->
object->removeTemplate($tid);
2702 $ilCtrl->redirect($this,
"listTemplates");
2712 if (is_array(
$_POST[
"tid"])) {
2713 foreach (
$_POST[
"tid"] as $tid) {
2714 $cls = $this->
object->getTemplateClasses($tid);
2715 foreach ($cls as $k => $cls) {
2716 $ty = $this->
object->determineTemplateStyleClassType(
$_GET[
"temp_type"], $k);
2718 $this->
object->deleteCharacteristic($ty, $ta, $cls);
2720 $this->
object->removeTemplate($tid);
2724 $ilCtrl->redirect($this,
"listTemplates");
2735 $tpl->setContent($this->form_gui->getHTML());
2746 include_once(
"Services/Form/classes/class.ilPropertyFormGUI.php");
2749 $this->form_gui->setTitle(
$lng->txt(
"sty_generate_template"));
2753 $name_input->
setPattern(
"/^[a-zA-Z]+[a-zA-Z0-9]*$/");
2754 $name_input->setNoMatchMessage(
$lng->txt(
"sty_msg_color_must_only_include") .
" A-Z, a-z, 1-9");
2755 $name_input->setRequired(
true);
2756 $name_input->setSize(30);
2757 $name_input->setMaxLength(30);
2758 $this->form_gui->addItem($name_input);
2763 "coloredZebra" =>
$lng->txt(
"sty_table_template_colored_zebra"),
2764 "bwZebra" =>
$lng->txt(
"sty_table_template_bw_zebra"),
2765 "noZebra" =>
$lng->txt(
"sty_table_template_no_zebra")
2767 $bl_input->setOptions($options);
2768 $this->form_gui->addItem($bl_input);
2771 include_once(
"./Services/Style/Content/classes/class.ilNumericStyleValueInputGUI.php");
2774 $num_input->setValue(
"3px");
2775 $this->form_gui->addItem($num_input);
2780 $num_input->setValue(
"10px");
2781 $this->form_gui->addItem($num_input);
2785 $cs = $this->
object->getColors();
2787 foreach ($cs as
$c) {
2788 $options[$c[
"name"]] = $c[
"name"];
2791 $this->form_gui->addItem($bc_input);
2794 $lss = array(
"border" => 90,
"header_text" => 70,
"header_bg" => 0,
2795 "cell1_text" => -60,
"cell1_bg" => 90,
"cell2_text" => -60,
"cell2_bg" => 75);
2796 foreach ($lss as $ls => $v) {
2799 $l_input->setMinValue(-100);
2800 $l_input->setValue($v);
2801 $l_input->setSize(4);
2802 $l_input->setMaxLength(4);
2803 $this->form_gui->addItem($l_input);
2806 $this->form_gui->addCommandButton(
"templateGeneration",
$lng->txt(
"generate"));
2807 $this->form_gui->addCommandButton(
"cancelTemplateSaving",
$lng->txt(
"cancel"));
2808 $this->form_gui->setFormAction(
$ilCtrl->getFormAction($this));
2822 if ($this->form_gui->checkInput()) {
2823 if ($this->object->templateExists(
$_POST[
"name"])) {
2824 $name_input = $this->form_gui->getItemByPostVar(
"name");
2825 $name_input->setAlert(
$lng->txt(
"sty_table_template_already_exists"));
2830 $cells = array(
"H" =>
"header",
"C1" =>
"cell1",
"C2" =>
"cell2");
2831 $tb_p = $this->form_gui->getItemByPostVar(
"tb_padding");
2832 $tb_padding = $tb_p->getValue();
2833 $lr_p = $this->form_gui->getItemByPostVar(
"lr_padding");
2834 $lr_padding = $lr_p->getValue();
2835 $cell_color =
$_POST[
"base_color"];
2838 if (
$_POST[
"layout"] ==
"bwZebra") {
2839 $cell_color =
"MidGray";
2840 if (!$this->object->colorExists($cell_color)) {
2841 $this->
object->addColor($cell_color,
"7F7F7F");
2843 $this->
object->updateColor($cell_color, $cell_color,
"7F7F7F");
2846 foreach ($cells as $k => $cell) {
2847 $cell_class[$k] =
$_POST[
"name"] . $k;
2848 if (!$this->object->characteristicExists($cell_class[$k],
"table_cell")) {
2849 $this->
object->addCharacteristic(
"table_cell", $cell_class[$k],
true);
2851 if (
$_POST[
"layout"] ==
"bwZebra" && $k ==
"H") {
2852 $this->
object->replaceStylePar(
2856 "!" .
$_POST[
"base_color"] .
"(" .
$_POST[
"lightness_" . $cell .
"_text"] .
")",
2859 $this->
object->replaceStylePar(
2863 "!" .
$_POST[
"base_color"] .
"(" .
$_POST[
"lightness_" . $cell .
"_bg"] .
")",
2867 $this->
object->replaceStylePar(
2871 "!" . $cell_color .
"(" .
$_POST[
"lightness_" . $cell .
"_text"] .
")",
2874 $this->
object->replaceStylePar(
2878 "!" . $cell_color .
"(" .
$_POST[
"lightness_" . $cell .
"_bg"] .
")",
2882 $this->
object->replaceStylePar(
2889 $this->
object->replaceStylePar(
2896 $this->
object->replaceStylePar(
2903 $this->
object->replaceStylePar(
2910 $this->
object->replaceStylePar(
2917 $this->
object->replaceStylePar(
2924 $this->
object->replaceStylePar(
2928 "!" . $cell_color .
"(" .
$_POST[
"lightness_border"] .
")",
2931 $this->
object->replaceStylePar(
2941 $classes[
"table"] =
$_POST[
"name"] .
"T";
2942 if (!$this->object->characteristicExists($classes[
"table"],
"table")) {
2943 $this->
object->addCharacteristic(
"table", $classes[
"table"],
true);
2945 $this->
object->replaceStylePar(
2952 $this->
object->replaceStylePar(
2959 $this->
object->replaceStylePar(
2966 $this->
object->replaceStylePar(
2973 if (
$_POST[
"layout"] ==
"bwZebra") {
2974 $this->
object->replaceStylePar(
2977 "border-bottom-color",
2978 "!" .
$_POST[
"base_color"],
2981 $this->
object->replaceStylePar(
2984 "border-bottom-style",
2988 $this->
object->replaceStylePar(
2991 "border-bottom-width",
2995 $sb = array(
"left",
"right",
"top");
2996 foreach ($sb as $b) {
2997 $this->
object->replaceStylePar(
3000 "border-" . $b .
"-width",
3007 switch (
$_POST[
"layout"]) {
3008 case "coloredZebra":
3009 $classes[
"row_head"] = $cell_class[
"H"];
3010 $classes[
"odd_row"] = $cell_class[
"C1"];
3011 $classes[
"even_row"] = $cell_class[
"C2"];
3015 $classes[
"row_head"] = $cell_class[
"H"];
3016 $classes[
"odd_row"] = $cell_class[
"C1"];
3017 $classes[
"even_row"] = $cell_class[
"C2"];
3021 $classes[
"row_head"] = $cell_class[
"H"];
3022 $classes[
"odd_row"] = $cell_class[
"C1"];
3023 $classes[
"even_row"] = $cell_class[
"C1"];
3024 $classes[
"col_head"] = $cell_class[
"C2"];
3029 $t_id = $this->
object->addTemplate(
3034 $this->
object->writeTemplatePreview(
3038 $ilCtrl->redirect($this,
"listTemplates");
3041 $this->form_gui->setValuesByPost();
3042 $tpl->setContent($this->form_gui->getHTML());
3049 include_once(
"./Services/Accordion/classes/class.ilAccordionGUI.php");
3052 $acc->addItem(
"Header 1", str_repeat(
"bla bla bla bla bla bla", 30));
3053 $acc->addItem(
"Header 2", str_repeat(
"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx xx x xx x xx", 30));
3057 $ac2->addItem(
"Header 1", str_repeat(
"bla bla bla bla bla bla", 30));
3058 $ac2->addItem(
"Header 2", $acc->getHTML());
3061 $tpl->setContent($ac2->getHTML());
3075 $ilCtrl->returnToParent($this);
getTemplatePreview($a_type, $a_t_id, $a_small_mode=false)
Get table template preview.
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 getBasicZipPath()
Get basic zip path.
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.
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.
if(!array_key_exists('StateId', $_REQUEST)) $id
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(isset($_POST['submit'])) $form
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 getContentStylePath($a_style_id, $add_random=true)
get content style path
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.
static _lookupType($a_id, $a_reference=false)
lookup object type
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
switchMQueryObject()
Switch media query.
static _addMissingStyleClassesToStyle($a_id)
Add missing style classes to all styles.
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.
Class ilObjStyleSheetGUI.
saveMediaQueryObject()
Save media query.
initColorForm($a_mode="create")
Init color form.
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.
if(empty($password)) $table
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 _renderTable( $content, $a_mode="table_edit", $a_submode="", $a_table_obj=null, $unmask=true)
Static render table function.
if(function_exists('posix_getuid') &&posix_getuid()===0) if(!array_key_exists('t', $options)) $tag
static getStyleExampleHTML($a_type, $a_class)
Get style example HTML.
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 (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.