16 require_once
"./classes/class.ilObjectGUI.php";
17 require_once
"./Services/Style/classes/class.ilObjStyleSheet.php";
36 $this->lng->loadLanguageModule(
"style");
37 $ilCtrl->saveParameter($this, array(
"tag",
"style_type",
"temp_type"));
38 if (
$_GET[
"style_type"] !=
"")
44 $this->
ilObjectGUI($a_data,$a_id,$a_call_by_reference,
false);
52 $next_class = $this->ctrl->getNextClass($this);
53 $cmd = $this->ctrl->getCmd(
"edit");
85 $this->tpl->setVariable(
"TXT_ACTION", $this->lng->txt(
"sty_create_new_stylesheet"));
87 $this->tpl->setVariable(
"TXT_STYLE_BY_IMPORT", $this->lng->txt(
"sty_import_stylesheet"));
88 $this->tpl->setVariable(
"TXT_STYLE_BY_COPY", $this->lng->txt(
"sty_copy_other_stylesheet"));
89 $this->tpl->setVariable(
"TXT_SELECT_FILE", $this->lng->txt(
"import_file"));
90 $this->tpl->setVariable(
"TXT_SOURCE", $this->lng->txt(
"sty_source"));
91 $this->tpl->setVariable(
"TXT_TITLE", $this->lng->txt(
"title"));
92 $this->tpl->setVariable(
"TXT_DESC", $this->lng->txt(
"description"));
94 $this->ctrl->setParameter($this,
"new_type",
"sty");
95 $this->tpl->setVariable(
"FORMACTION", $this->ctrl->getFormAction($this));
96 $this->tpl->setVariable(
"TXT_SAVE", $this->lng->txt(
"save"));
97 $this->tpl->setVariable(
"TXT_IMPORT", $this->lng->txt(
"import"));
98 $this->tpl->setVariable(
"TXT_COPY", $this->lng->txt(
"copy"));
99 $this->tpl->setVariable(
"TXT_CANCEL", $this->lng->txt(
"cancel"));
100 $this->tpl->setVariable(
"TXT_REQUIRED_FLD", $this->lng->txt(
"required_field"));
105 $this->tpl->setVariable(
"SOURCE_SELECT", $select);
114 $this->tpl->setCurrentBlock(
"ContentStyle");
115 $this->tpl->setVariable(
"LOCATION_CONTENT_STYLESHEET",
116 $this->object->getContentStylePath($this->object->getId()));
117 $this->tpl->parseCurrentBlock();
131 $ctpl =
new ilTemplate(
"tpl.sty_classes.html",
true,
true,
"Services/Style");
134 $chars = $this->
object->getCharacteristics();
136 $style_type = ($this->super_type !=
"")
139 $ilCtrl->setParameter($this,
"style_type", $style_type);
141 $ilTabs->setSubTabActive(
"sty_".$style_type.
"_char");
143 include_once(
"./Services/Style/classes/class.ilStyleTableGUI.php");
147 $ctpl->setCurrentBlock(
"style_table");
148 $ctpl->setVariable(
"STYLE_TABLE", $table_gui->getHTML());
149 $ctpl->parseCurrentBlock();
151 $this->tpl->setContent($ctpl->get());
159 global $rbacsystem,
$lng;
162 $this->tpl->setCurrentBlock(
"ContentStyle");
163 $this->tpl->setVariable(
"LOCATION_CONTENT_STYLESHEET",
164 $this->object->getContentStylePath($this->object->getId()));
165 $this->tpl->parseCurrentBlock();
168 $this->tpl->addBlockfile(
"BUTTONS",
"buttons",
"tpl.buttons.html");
171 $this->tpl->setCurrentBlock(
"btn_cell");
172 $this->tpl->setVariable(
"BTN_LINK", $this->ctrl->getLinkTarget($this,
"exportStyle"));
173 $this->tpl->setVariable(
"BTN_TXT",$this->lng->txt(
"export"));
174 $this->tpl->parseCurrentBlock();
178 $this->tpl->setContent($this->form->getHTML());
206 $values[
"style_title"] = $this->
object->getTitle();
207 $values[
"style_description"] = $this->
object->getDescription();
208 $values[
"disable_auto_margins"] = (int) $this->object->lookupStyleSetting(
"disable_auto_margins");
210 $this->form->setValuesByArray($values);
221 include_once(
"Services/Form/classes/class.ilPropertyFormGUI.php");
225 $ti =
new ilTextInputGUI($this->lng->txt(
"title"),
"style_title");
228 $ti->setRequired(
true);
229 $this->form->addItem($ti);
235 $this->form->addItem($ta);
238 $cb =
new ilCheckboxInputGUI($this->lng->txt(
"sty_disable_auto_margins"),
"disable_auto_margins");
239 $cb->
setInfo($this->lng->txt(
"sty_disable_auto_margins_info"));
240 $this->form->addItem($cb);
244 if ($a_mode ==
"create")
246 $this->form->addCommandButton(
"save", $lng->txt(
"save"));
247 $this->form->addCommandButton(
"cancelSave", $lng->txt(
"cancel"));
251 $this->form->addCommandButton(
"update", $lng->txt(
"save"));
254 $this->form->setTitle($lng->txt(
"edit_stylesheet"));
255 $this->form->setFormAction($this->ctrl->getFormAction($this));
267 if ($this->form->checkInput())
269 $this->
object->setTitle($this->form->getInput(
"style_title"));
270 $this->
object->setDescription($this->form->getInput(
"style_description"));
271 $this->
object->writeStyleSetting(
"disable_auto_margins",
272 $this->form->getInput(
"disable_auto_margins"));
273 $this->
object->update();
275 $ilCtrl->redirect($this,
"properties");
279 $this->form->setValuesByPost();
280 $tpl->setContent($this->form->getHtml());
291 $cur = explode(
".",
$_GET[
"tag"]);
293 $cur_class = $cur[1];
297 if ($this->form_gui->checkInput())
300 $ilCtrl->redirect($this,
"editTagStyle");
304 $this->form_gui->setValuesByPost();
316 $cur = explode(
".",
$_GET[
"tag"]);
318 $cur_class = $cur[1];
321 if ($this->form_gui->checkInput())
324 $ilCtrl->redirect($this,
"edit");
328 $this->form_gui->setValuesByPost();
338 $cur = explode(
".",
$_GET[
"tag"]);
340 $cur_class = $cur[1];
342 foreach ($avail_pars as $par => $v)
344 $var = str_replace(
"-",
"_", $par);
345 $basepar_arr = explode(
".", $par);
346 $basepar = $basepar_arr[0];
348 if ($basepar_arr[1] !=
"" && $basepar_arr[1] != $cur_tag)
356 case "numeric_no_perc":
358 case "background_image":
359 $in = $this->form_gui->getItemByPostVar($basepar);
365 $color = trim(
$_POST[$basepar]);
366 if ($color !=
"" && trim(substr($color,0,1) !=
"!"))
376 $in = $this->form_gui->getItemByPostVar($basepar);
377 $this->
writeStylePar($cur_tag, $cur_class, $v[
"subpar"][0],
$in->getAllValue(),
$_GET[
"style_type"]);
378 $this->
writeStylePar($cur_tag, $cur_class, $v[
"subpar"][1],
$in->getTopValue(),
$_GET[
"style_type"]);
379 $this->
writeStylePar($cur_tag, $cur_class, $v[
"subpar"][2],
$in->getRightValue(),
$_GET[
"style_type"]);
380 $this->
writeStylePar($cur_tag, $cur_class, $v[
"subpar"][3],
$in->getBottomValue(),
$_GET[
"style_type"]);
381 $this->
writeStylePar($cur_tag, $cur_class, $v[
"subpar"][4],
$in->getLeftValue(),
$_GET[
"style_type"]);
385 $in = $this->form_gui->getItemByPostVar($basepar);
386 $tblr_p = array (0 =>
"getAllValue", 1 =>
"getTopValue", 2 =>
"getRightValue",
387 3 =>
"getBottomValue", 4 =>
"getLeftValue");
388 foreach ($tblr_p as $k => $func)
390 $val = trim(
$in->$func());
391 $val = ((
$in->getAcceptNamedColors() && substr($val, 0, 1) ==
"!")
395 $this->
writeStylePar($cur_tag, $cur_class, $v[
"subpar"][$k], $val,
$_GET[
"style_type"]);
410 case "background_position":
411 $in = $this->form_gui->getItemByPostVar($basepar);
421 $this->
object->update();
433 $this->
object->replaceStylePar($cur_tag, $cur_class, $par, $value, $a_type);
437 $this->
object->deleteStylePar($cur_tag, $cur_class, $par, $a_type);
449 $cur = explode(
".",
$_GET[
"tag"]);
451 $cur_class = $cur[1];
466 $tpl->setCurrentBlock(
"ContentStyle");
467 $tpl->setVariable(
"LOCATION_CONTENT_STYLESHEET",
468 $this->object->getContentStylePath($this->object->getId()));
470 $ts_tpl =
new ilTemplate(
"tpl.style_tag_edit.html",
true,
true,
"Services/Style");
472 $cur = explode(
".",
$_GET[
"tag"]);
474 $cur_class = $cur[1];
476 $ts_tpl->setVariable(
"EXAMPLE",
479 $ts_tpl->setVariable(
"FORM",
480 $this->form_gui->getHtml());
482 $tpl->setTitle($cur_class.
" (".$lng->txt(
"sty_type_".$_GET[
"style_type"]).
")");
484 $tpl->setContent($ts_tpl->get());
497 include_once(
"Services/Form/classes/class.ilPropertyFormGUI.php");
500 $avail_pars = $this->
object->getAvailableParameters();
501 $groups = $this->
object->getStyleParameterGroups();
504 foreach ($groups as $k => $group)
509 if (is_array($filtered_groups[$k]) && !in_array($a_cur_tag, $filtered_groups[$k]))
515 $sh->setTitle($lng->txt(
"sty_".$k));
516 $this->form_gui->addItem($sh);
518 foreach ($group as $par)
520 $basepar = explode(
".", $par);
521 $basepar = $basepar[0];
523 $var = str_replace(
"-",
"_", $basepar);
524 $up_par = strtoupper($var);
530 $options = array(
"" =>
"");
531 foreach ($avail_pars[$par] as $p)
536 $this->form_gui->addItem($sel_input);
540 $text_input =
new ilTextInputGUI($lng->txt(
"sty_".$var), $basepar);
542 $text_input->setSize(20);
543 $this->form_gui->addItem($text_input);
547 include_once(
"./Services/Style/classes/class.ilFontSizeInputGUI.php");
549 $this->form_gui->addItem($fs_input);
552 case "numeric_no_perc":
554 include_once(
"./Services/Style/classes/class.ilNumericStyleValueInputGUI.php");
560 $this->form_gui->addItem($num_input);
566 $per_input->setMaxValue(100);
567 $per_input->setMaxLength(3);
568 $per_input->setSize(3);
569 $this->form_gui->addItem($per_input);
576 $col_input->setAcceptNamedColors(
true);
577 $this->form_gui->addItem($col_input);
581 include_once(
"./Services/Style/classes/class.ilTRBLNumericStyleValueInputGUI.php");
587 $this->form_gui->addItem($num_input);
591 include_once(
"./Services/Style/classes/class.ilTRBLBorderWidthInputGUI.php");
593 $this->form_gui->addItem($bw_input);
597 include_once(
"./Services/Style/classes/class.ilTRBLBorderStyleInputGUI.php");
599 $this->form_gui->addItem($bw_input);
603 include_once(
"./Services/Style/classes/class.ilTRBLColorPickerInputGUI.php");
606 $this->form_gui->addItem($col_input);
609 case "background_image":
610 include_once(
"./Services/Style/classes/class.ilBackgroundImageInputGUI.php");
613 foreach ($this->object->getImages() as $entry)
615 $imgs[] = $entry[
"entry"];
618 $this->form_gui->addItem($im_input);
621 case "background_position":
622 include_once(
"./Services/Style/classes/class.ilBackgroundPositionInputGUI.php");
624 $this->form_gui->addItem($im_input);
631 $this->form_gui->addCommandButton(
"updateTagStyle", $lng->txt(
"save_return"));
632 $this->form_gui->addCommandButton(
"refreshTagStyle", $lng->txt(
"save_refresh"));
635 $this->form_gui->setFormAction($this->ctrl->getFormAction($this));
644 $style = $this->
object->getStyle();
645 $cur = explode(
".",
$_GET[
"tag"]);
647 $cur_class = $cur[1];
651 foreach($parameters as $p => $v)
654 if (is_array($filtered_groups[$v[
"group"]]) && !in_array($cur_tag, $filtered_groups[$v[
"group"]]))
658 $p = explode(
".", $p);
660 $input = $this->form_gui->getItemByPostVar($p);
670 $input->setAllValue($cur_parameters[$v[
"subpar"][0]]);
671 $input->setTopValue($cur_parameters[$v[
"subpar"][1]]);
672 $input->setRightValue($cur_parameters[$v[
"subpar"][2]]);
673 $input->setBottomValue($cur_parameters[$v[
"subpar"][3]]);
674 $input->setLeftValue($cur_parameters[$v[
"subpar"][4]]);
678 $input->setValue($cur_parameters[$p]);
689 $file = $this->
object->export();
696 $parameters = array();
697 foreach($a_style as $tag)
699 foreach($tag as $par)
701 if ($par[
"tag"] == $a_tag && $par[
"class"] == $a_class
702 && $par[
"type"] == $a_type)
704 $parameters[$par[
"parameter"]] = $par[
"value"];
716 $this->
object->addParameter(
$_POST[
"tag"],
$_POST[
"parameter"]);
727 $this->
object->setTitle(
$_POST[
"style_title"]);
728 $this->
object->setDescription(
$_POST[
"style_description"]);
730 foreach(
$_POST[
"styval"] as $id => $value)
732 $this->
object->updateStyleParameter($id, $value);
734 $this->
object->update();
747 $this->tpl->addBlockFile(
"ADM_CONTENT",
"adm_content",
"tpl.confirm_deletion.html");
754 $this->tpl->setVariable(
"FORMACTION", $this->ctrl->getFormAction($this));
757 $this->tpl->setCurrentBlock(
"table_header");
758 $this->tpl->setVariable(
"TEXT", $this->lng->txt(
"objects"));
759 $this->tpl->parseCurrentBlock();
766 $this->tpl->setCurrentBlock(
"table_row");
770 $this->tpl->parseCurrentBlock();
775 $buttons = array(
"confirmedDelete" => $this->lng->txt(
"confirm"),
776 "cancelDelete" => $this->lng->txt(
"cancel"));
777 foreach ($buttons as
$name => $value)
779 $this->tpl->setCurrentBlock(
"operation_btn");
781 $this->tpl->setVariable(
"BTN_NAME",
$name);
782 $this->tpl->setVariable(
"BTN_VALUE",$value);
783 $this->tpl->parseCurrentBlock();
793 $this->ctrl->returnToParent($this);
803 $this->
object->delete();
805 $this->ctrl->returnToParent($this);
813 if (is_array(
$_POST[
"sty_select"]))
815 foreach(
$_POST[
"sty_select"] as $id => $dummy)
817 $this->
object->deleteParameter($id);
820 $this->
object->read();
821 $this->
object->writeCSSFile();
831 $class_name =
"ilObjStyleSheet";
832 require_once(
"./Services/Style/classes/class.ilObjStyleSheet.php");
834 $newObj->setTitle(
"-");
842 if (
$_GET[
"ref_id"] > 0)
846 if ($fold->getType() ==
"stys")
848 $fold->addStyle($newObj->getId());
851 $this->ctrl->redirectByClass(
"ilobjstylesettingsgui",
"editContentStyles");
855 return $newObj->getId();
865 if (
$_POST[
"source_style"] > 0)
866 $style_obj =& $ilias->obj_factory->getInstanceByObjId(
$_POST[
"source_style"]);
867 $new_id = $style_obj->ilClone();
871 if (
$_GET[
"ref_id"] > 0)
875 if ($fold->getType() ==
"stys")
877 $fold->addStyle($new_id);
880 $this->ctrl->redirectByClass(
"ilobjstylesettingsgui",
"editContentStyles");
893 $source = $_FILES[
"stylefile"][
"tmp_name"];
894 if (($source ==
'none') || (!$source))
896 $this->ilias->raiseError(
"No file selected!",$this->ilias->error_obj->MESSAGE);
900 $info = pathinfo($_FILES[
"stylefile"][
"name"]);
901 if (strtolower($info[
"extension"]) !=
"zip" && strtolower($info[
"extension"]) !=
"xml")
903 $this->ilias->raiseError(
"File must be a zip or xml file!",$this->ilias->error_obj->MESSAGE);
906 $class_name =
"ilObjStyleSheet";
907 require_once(
"./Services/Style/classes/class.ilObjStyleSheet.php");
911 $newObj->import($_FILES[
"stylefile"]);
916 if (
$_GET[
"ref_id"] > 0)
920 if ($fold->getType() ==
"stys")
922 $fold->addStyle($newObj->getId());
925 $this->ctrl->redirectByClass(
"ilobjstylesettingsgui",
"editContentStyles");
929 return $newObj->getId();
940 $this->ctrl->returnToParent($this);
958 $this->
getTabs($this->tabs_gui);
960 if (strtolower(get_class($this->
object)) ==
"ilobjstylesheet")
962 $this->tpl->setVariable(
"HEADER", $this->object->getTitle());
966 $this->tpl->setVariable(
"HEADER", $lng->txt(
"create_stylesheet"));
979 if ($ilCtrl->getCmd() ==
"editTagStyle")
982 $tabs_gui->setBackTarget($lng->txt(
"back"),
983 $ilCtrl->getLinkTarget($this,
"edit"));
985 $t = explode(
".",
$_GET[
"tag"]);
986 $t2 = explode(
":",
$t[1]);
987 $pc = $this->
object->_getPseudoClasses(
$t[0]);
988 if (is_array($pc) && count($pc) > 0)
991 $ilCtrl->setParameter($this,
"tag",
$t[0].
".".$t2[0]);
992 $tabs_gui->addTarget(
"sty_tag_normal",
993 $this->ctrl->getLinkTarget($this,
"editTagStyle"), array(
"editTagStyle",
""),
997 $ilTabs->setTabActive(
"sty_tag_normal");
1003 $ilCtrl->setParameter($this,
"tag",
$t[0].
".".$t2[0].
":".$p);
1004 $tabs_gui->addTarget(
"sty_tag_".$p,
1005 $this->ctrl->getLinkTarget($this,
"editTagStyle"), array(
"editTagStyle",
""),
1009 $ilTabs->setTabActive(
"sty_tag_".$p);
1012 $ilCtrl->setParameter($this,
"tag",
$_GET[
"tag"]);
1018 $tabs_gui->setBackTarget($lng->txt(
"back"),
1019 $this->ctrl->getLinkTarget($this,
"returnToUpperContext"));
1022 $tabs_gui->addTarget(
"sty_style_chars",
1023 $this->ctrl->getLinkTarget($this,
"edit"), array(
"edit",
""),
1027 $tabs_gui->addTarget(
"sty_colors",
1028 $this->ctrl->getLinkTarget($this,
"listColors"),
"listColors",
1032 $tabs_gui->addTarget(
"sty_images",
1033 $this->ctrl->getLinkTarget($this,
"listImages"),
"listImages",
1037 $tabs_gui->addTarget(
"sty_templates",
1038 $this->ctrl->getLinkTarget($this,
"listTemplates"),
"listTemplates",
1042 $tabs_gui->addTarget(
"settings",
1043 $this->ctrl->getLinkTarget($this,
"properties"),
"properties",
1066 foreach ($types as $super_type => $types)
1069 $ilCtrl->setParameter($this,
"style_type", $super_type);
1070 $ilTabs->addSubTabTarget(
"sty_".$super_type.
"_char",
1071 $this->ctrl->getLinkTarget($this,
"edit"), array(
"edit",
""),
1075 $ilCtrl->setParameter($this,
"style_type",
$_GET[
"style_type"]);
1089 foreach ($types as
$t => $c)
1091 $ilCtrl->setParameter($this,
"temp_type",
$t);
1092 $ilTabs->addSubTabTarget(
"sty_".
$t.
"_templates",
1093 $this->ctrl->getLinkTarget($this,
"listTemplates"), array(
"listTemplates",
""),
1097 $ilCtrl->setParameter($this,
"temp_type",
$_GET[
"temp_type"]);
1108 if (
$_GET[
"admin_mode"] ==
"settings")
1110 $ilLocator->addItem($this->lng->txt(
"administration"),
1111 $this->ctrl->getLinkTargetByClass(
"iladministrationgui",
"frameset"),
1116 $this->ctrl->getLinkTargetByClass(
"ilobjstylesettingsgui",
"view"));
1118 if (
$_GET[
"obj_id"] > 0)
1120 $ilLocator->addItem($this->object->getTitle(),
1121 $this->ctrl->getLinkTarget($this,
"edit"));
1135 if (strtolower(
$_GET[
"baseClass"]) ==
"iladministrationgui")
1138 $this->ctrl->getLinkTargetByClass(
"ilobjstylesettingsgui",
1139 "editContentStyles"));
1154 include_once(
"./Services/Style/classes/class.ilStyleImageTableGUI.php");
1157 $tpl->setContent($table_gui->getHTML());
1169 $tpl->setContent($this->form_gui->getHTML());
1179 $ilCtrl->redirect($this,
"listImages");
1191 if ($this->form_gui->checkInput())
1193 $this->
object->uploadImage($_FILES[
"image_file"]);
1194 $ilCtrl->redirect($this,
"listImages");
1199 $tpl->setContent($this->form_gui->getHTML());
1211 include_once(
"Services/Form/classes/class.ilPropertyFormGUI.php");
1214 $this->form_gui->setTitle($lng->txt(
"sty_add_image"));
1218 $this->form_gui->addItem($file_input);
1220 $this->form_gui->addCommandButton(
"uploadImage", $lng->txt(
"upload"));
1221 $this->form_gui->addCommandButton(
"cancelUpload", $lng->txt(
"cancel"));
1222 $this->form_gui->setFormAction($ilCtrl->getFormAction($this));
1232 $images = $this->
object->getImages();
1234 foreach ($images as $image)
1236 if (is_array(
$_POST[
"file"]) && in_array($image[
"entry"],
$_POST[
"file"]))
1238 $this->
object->deleteImage($image[
"entry"]);
1241 $ilCtrl->redirect($this,
"listImages");
1253 if (!is_array(
$_POST[
"char"]) || count(
$_POST[
"char"]) == 0)
1256 $ilCtrl->redirect($this,
"edit");
1260 include_once(
"./Services/Utilities/classes/class.ilConfirmationGUI.php");
1262 $cgui->setFormAction($ilCtrl->getFormAction($this));
1263 $cgui->setHeaderText($lng->txt(
"sty_confirm_char_deletion"));
1264 $cgui->setCancel($lng->txt(
"cancel"),
"cancelCharacteristicDeletion");
1265 $cgui->setConfirm($lng->txt(
"delete"),
"deleteCharacteristic");
1267 foreach (
$_POST[
"char"] as $char)
1269 $char_comp = explode(
".", $char);
1270 $cgui->addItem(
"char[]", $char, $char_comp[2]);
1273 $tpl->setContent($cgui->getHTML());
1285 $ilCtrl->redirect($this,
"edit");
1295 if (is_array(
$_POST[
"char"]))
1297 foreach(
$_POST[
"char"] as $char)
1299 $char_comp = explode(
".", $char);
1300 $type = $char_comp[0];
1301 $tag = $char_comp[1];
1302 $class = $char_comp[2];
1304 $this->
object->deleteCharacteristic(
$type, $tag, $class);
1308 $ilCtrl->redirect($this,
"edit");
1319 $tpl->setContent($this->form_gui->getHTML());
1331 if ($this->form_gui->checkInput())
1333 if ($this->object->characteristicExists(
$_POST[
"new_characteristic"],
$_GET[
"style_type"]))
1335 $char_input = $this->form_gui->getItemByPostVar(
"new_characteristic");
1336 $char_input->setAlert($lng->txt(
"sty_characteristic_already_exists"));
1340 $this->
object->addCharacteristic(
$_POST[
"type"],
$_POST[
"new_characteristic"]);
1342 $ilCtrl->redirect($this,
"edit");
1345 $this->form_gui->setValuesByPost();
1346 $tpl->setContent($this->form_gui->getHTML());
1358 include_once(
"Services/Form/classes/class.ilPropertyFormGUI.php");
1362 $txt_input =
new ilRegExpInputGUI($lng->txt(
"title"),
"new_characteristic");
1363 $txt_input->
setPattern(
"/^[a-zA-Z]+[a-zA-Z0-9]*$/");
1364 $txt_input->setNoMatchMessage($lng->txt(
"sty_msg_characteristic_must_only_include").
" A-Z, a-z, 1-9");
1365 $txt_input->setRequired(
true);
1366 $this->form_gui->addItem($txt_input);
1370 $types = $all_super_types[$this->super_type];
1371 $exp_types = array();
1372 foreach($types as
$t)
1376 $exp_types[
$t] = $lng->txt(
"sty_type_".$t);
1379 if (count($exp_types) > 1)
1383 $type_input->setValue(key($exp_types));
1384 $this->form_gui->addItem($type_input);
1386 else if (count($exp_types) == 1)
1389 $hid_input->setValue(key($exp_types));
1390 $this->form_gui->addItem($hid_input);
1393 $this->form_gui->setTitle($lng->txt(
"sty_add_characteristic"));
1394 $this->form_gui->addCommandButton(
"saveCharacteristic", $lng->txt(
"save"));
1395 $this->form_gui->addCommandButton(
"edit", $lng->txt(
"cancel"));
1396 $this->form_gui->setFormAction($ilCtrl->getFormAction($this));
1406 $c = explode(
":", $a_class);
1409 $ex_tpl =
new ilTemplate(
"tpl.style_example.html",
true,
true,
"Services/Style");
1411 $ex_tpl->setCurrentBlock(
"Example_".$a_type);
1412 $ex_tpl->setVariable(
"EX_CLASS",
"ilc_".$a_type.
"_".$a_class);
1413 $ex_tpl->setVariable(
"EX_TEXT",
"ABC abc 123");
1414 if ($a_type ==
"media_cont")
1418 if (in_array($a_type, array(
"table",
"table_caption")))
1420 $ex_tpl->setVariable(
"TXT_CAPTION", $lng->txt(
"sty_caption"));
1422 $ex_tpl->parseCurrentBlock();
1424 return $ex_tpl->get();
1436 foreach (
$_POST[
"all_chars"] as $char)
1438 $ca = explode(
".", $char);
1439 $this->
object->saveHideStatus($ca[0], $ca[2],
1440 (is_array(
$_POST[
"hide"]) && in_array($char,
$_POST[
"hide"])));
1444 $ilCtrl->redirect($this,
"edit");
1459 include_once(
"./Services/Style/classes/class.ilStyleColorTableGUI.php");
1462 $tpl->setContent($table_gui->getHTML());
1474 $tpl->setContent($this->form_gui->getHTML());
1484 $ilCtrl->setParameter($this,
"c_name",
$_GET[
"c_name"]);
1487 $tpl->setContent($this->form_gui->getHTML());
1498 include_once(
"Services/Form/classes/class.ilPropertyFormGUI.php");
1501 $this->form_gui->setTitle($lng->txt(
"sty_add_color"));
1504 $name_input =
new ilRegExpInputGUI($lng->txt(
"sty_color_name"),
"color_name");
1505 $name_input->
setPattern(
"/^[a-zA-Z]+[a-zA-Z0-9]*$/");
1506 $name_input->setNoMatchMessage($lng->txt(
"sty_msg_color_must_only_include").
" A-Z, a-z, 1-9");
1507 $name_input->setRequired(
true);
1508 $name_input->setSize(15);
1509 $name_input->setMaxLength(15);
1510 $this->form_gui->addItem($name_input);
1515 $color_input->setDefaultColor(
"");
1516 $this->form_gui->addItem($color_input);
1518 if ($a_mode ==
"create")
1520 $this->form_gui->addCommandButton(
"saveColor", $lng->txt(
"save"));
1521 $this->form_gui->addCommandButton(
"cancelColorSaving", $lng->txt(
"cancel"));
1525 $this->form_gui->addCommandButton(
"updateColor", $lng->txt(
"save"));
1526 $this->form_gui->addCommandButton(
"cancelColorSaving", $lng->txt(
"cancel"));
1528 $this->form_gui->setFormAction($ilCtrl->getFormAction($this));
1536 if (
$_GET[
"c_name"] !=
"")
1538 $values[
"color_name"] =
$_GET[
"c_name"];
1539 $values[
"color_code"] = $this->
object->getColorCodeForName(
$_GET[
"c_name"]);
1540 $this->form_gui->setValuesByArray($values);
1551 $ilCtrl->redirect($this,
"listColors");
1563 if ($this->form_gui->checkInput())
1565 if ($this->object->colorExists(
$_POST[
"color_name"]))
1567 $col_input = $this->form_gui->getItemByPostVar(
"color_name");
1568 $col_input->setAlert($lng->txt(
"sty_color_already_exists"));
1572 $this->
object->addColor(
$_POST[
"color_name"],
1574 $ilCtrl->redirect($this,
"listColors");
1577 $this->form_gui->setValuesByPost();
1578 $tpl->setContent($this->form_gui->getHTML());
1590 if ($this->form_gui->checkInput())
1592 if ($this->object->colorExists(
$_POST[
"color_name"]) &&
1595 $col_input = $this->form_gui->getItemByPostVar(
"color_name");
1596 $col_input->setAlert($lng->txt(
"sty_color_already_exists"));
1600 $this->
object->updateColor(
$_GET[
"c_name"],
$_POST[
"color_name"],
1602 $ilCtrl->redirect($this,
"listColors");
1605 $ilCtrl->setParameter($this,
"c_name",
$_GET[
"c_name"]);
1606 $this->form_gui->setValuesByPost();
1607 $tpl->setContent($this->form_gui->getHTML());
1617 if (!is_array(
$_POST[
"color"]) || count(
$_POST[
"color"]) == 0)
1620 $ilCtrl->redirect($this,
"listColors");
1624 include_once(
"./Services/Utilities/classes/class.ilConfirmationGUI.php");
1626 $cgui->setFormAction($ilCtrl->getFormAction($this));
1627 $cgui->setHeaderText($lng->txt(
"sty_confirm_color_deletion"));
1628 $cgui->setCancel($lng->txt(
"cancel"),
"cancelColorDeletion");
1629 $cgui->setConfirm($lng->txt(
"delete"),
"deleteColor");
1631 foreach (
$_POST[
"color"] as $c)
1636 $tpl->setContent($cgui->getHTML());
1647 $ilCtrl->redirect($this,
"listColors");
1657 if (is_array(
$_POST[
"color"]))
1659 foreach (
$_POST[
"color"] as $c)
1661 $this->
object->removeColor($c);
1665 $ilCtrl->redirect($this,
"listColors");
1679 $ctype =
$_GET[
"temp_type"];
1683 $ilCtrl->setParameter($this,
"temp_type", $ctype);
1684 $_GET[
"temp_type"] = $ctype;
1688 $ilTabs->setSubTabActive(
"sty_".$ctype.
"_templates");
1691 include_once(
"./Services/Style/classes/class.ilTableTemplatesTableGUI.php");
1694 $tpl->setContent($table_gui->getHTML());
1706 $tpl->setContent($this->form_gui->getHTML());
1716 $ilCtrl->setParameter($this,
"t_id",
$_GET[
"t_id"]);
1729 $this->
object, $a_type, $a_t_id, $a_small_mode);
1746 $ts = $a_style->getTemplate($a_t_id);
1747 $t = $ts[
"classes"];
1750 if ($a_type ==
"table")
1752 $p_content =
'<PageContent><Table DataTable="y"';
1753 if (
$t[
"row_head"] !=
"")
1755 $p_content.=
' HeaderRows="1"';
1757 if (
$t[
"row_foot"] !=
"")
1759 $p_content.=
' FooterRows="1"';
1761 if (
$t[
"col_head"] !=
"")
1763 $p_content.=
' HeaderCols="1"';
1765 if (
$t[
"col_foot"] !=
"")
1767 $p_content.=
' FooterCols="1"';
1769 $p_content.=
' Template="'.$a_style->lookupTemplateName($a_t_id).
'">';
1772 $p_content.=
'<Caption>'.$lng->txt(
"sty_caption").
'</Caption>';
1774 for($i = 1; $i<=$kr; $i++)
1776 $p_content.=
'<TableRow>';
1777 for($j = 1; $j<=$kc; $j++)
1781 $cell =
'<div style="height:2px;"></div>';
1787 $p_content.=
'<TableData><PageContent><Paragraph Characteristic="TableContent">'.$cell.
'</Paragraph></PageContent></TableData>';
1789 $p_content.=
'</TableRow>';
1791 $p_content.=
'</Table></PageContent>';
1794 if ($a_type ==
"vaccordion" || $a_type ==
"haccordion")
1796 include_once(
"./Services/Accordion/classes/class.ilAccordionGUI.php");
1809 if ($a_type ==
"vaccordion")
1811 $p_content =
'<PageContent><Tabs HorizontalAlign="Left" Type="VerticalAccordion" ';
1814 $p_content.=
' ContentWidth="70"';
1819 $p_content =
'<PageContent><Tabs Type="HorizontalAccordion"';
1822 $p_content.=
' ContentHeight="40"';
1823 $p_content.=
' ContentWidth="70"';
1824 $c =
'&nbsp;&nbsp;&nbsp;&nbsp;';
1828 $p_content.=
' ContentHeight="40"';
1831 $p_content.=
' Template="'.$a_style->lookupTemplateName($a_t_id).
'">';
1832 $p_content.=
'<Tab><PageContent><Paragraph>'.$c.
'</Paragraph></PageContent>';
1833 $p_content.=
'<TabCaption>'.$h.
'</TabCaption>';
1834 $p_content.=
'</Tab>';
1835 $p_content.=
'</Tabs></PageContent>';
1838 $txml = $a_style->getTemplateXML();
1841 include_once(
"./Services/COPage/classes/class.ilPCTableGUI.php");
1854 include_once(
"Services/Form/classes/class.ilPropertyFormGUI.php");
1857 if ($a_mode ==
"create")
1859 $this->form_gui->setTitle($lng->txt(
"sty_add_template"));
1863 $this->form_gui->setTitle($lng->txt(
"sty_edit_template"));
1867 $name_input =
new ilRegExpInputGUI($lng->txt(
"sty_template_name"),
"name");
1868 $name_input->
setPattern(
"/^[a-zA-Z]+[a-zA-Z0-9]*$/");
1869 $name_input->setNoMatchMessage($lng->txt(
"sty_msg_color_must_only_include").
" A-Z, a-z, 1-9");
1870 $name_input->setRequired(
true);
1871 $name_input->setSize(30);
1872 $name_input->setMaxLength(30);
1873 $this->form_gui->addItem($name_input);
1877 foreach ($scs as $sc => $st)
1879 $sc_input =
new ilSelectInputGUI($lng->txt(
"sty_".$sc.
"_class"), $sc.
"_class");
1880 $chars = $this->
object->getCharacteristics($st);
1881 $options = array(
"" =>
"");
1882 foreach($chars as $char)
1884 $options[$char] = $char;
1886 $sc_input->setOptions($options);
1887 $this->form_gui->addItem($sc_input);
1890 if ($a_mode ==
"create")
1892 $this->form_gui->addCommandButton(
"saveTemplate", $lng->txt(
"save"));
1893 $this->form_gui->addCommandButton(
"cancelTemplateSaving", $lng->txt(
"cancel"));
1897 $this->form_gui->addCommandButton(
"refreshTemplate", $lng->txt(
"save_refresh"));
1898 $this->form_gui->addCommandButton(
"updateTemplate", $lng->txt(
"save_return"));
1899 $this->form_gui->addCommandButton(
"cancelTemplateSaving", $lng->txt(
"cancel"));
1901 $this->form_gui->setFormAction($ilCtrl->getFormAction($this));
1911 $ilCtrl->redirect($this,
"listTemplates");
1923 if ($this->form_gui->checkInput())
1925 if ($this->object->templateExists(
$_POST[
"name"]))
1927 $name_input = $this->form_gui->getItemByPostVar(
"name");
1928 $name_input->setAlert($lng->txt(
"sty_table_template_already_exists"));
1935 $classes[$tct] =
$_POST[$tct.
"_class"];
1937 $t_id = $this->
object->addTemplate(
$_GET[
"temp_type"],
$_POST[
"name"], $classes);
1938 $this->
object->writeTemplatePreview($t_id,
1940 $ilCtrl->redirect($this,
"listTemplates");
1943 $this->form_gui->setValuesByPost();
1944 $tpl->setContent($this->form_gui->getHTML());
1954 $ilCtrl->setParameter($this,
"t_id",
$_GET[
"t_id"]);
1957 if ($this->form_gui->checkInput())
1959 if ($this->object->templateExists(
$_POST[
"name"]) &&
1962 $name_input = $this->form_gui->getItemByPostVar(
"name");
1963 $name_input->setAlert($lng->txt(
"sty_template_already_exists"));
1970 $classes[$tct] =
$_POST[$tct.
"_class"];
1973 $this->
object->updateTemplate(
$_GET[
"t_id"],
1974 $_POST[
"name"], $classes);
1975 $this->
object->writeTemplatePreview(
$_GET[
"t_id"],
1979 $ilCtrl->redirect($this,
"listTemplates");
1984 $this->form_gui->setValuesByPost();
1995 $a_tpl =
new ilTemplate(
"tpl.template_edit.html",
true,
true,
1998 $a_tpl->setVariable(
"FORM", $this->form_gui->getHTML());
2000 $tpl->setContent($a_tpl->get());
2016 if (
$_GET[
"t_id"] > 0)
2018 $t = $this->
object->getTemplate(
$_GET[
"t_id"]);
2020 $values[
"name"] =
$t[
"name"];
2022 foreach ($scs as $k =>
$type)
2024 $values[$k.
"_class"] =
$t[
"classes"][$k];
2026 $this->form_gui->setValuesByArray($values);
2037 if (!is_array(
$_POST[
"tid"]) || count(
$_POST[
"tid"]) == 0)
2040 $ilCtrl->redirect($this,
"listTemplates");
2044 include_once(
"./Services/Utilities/classes/class.ilConfirmationGUI.php");
2046 $cgui->setFormAction($ilCtrl->getFormAction($this));
2047 $cgui->setHeaderText($lng->txt(
"sty_confirm_template_deletion"));
2048 $cgui->setCancel($lng->txt(
"cancel"),
"cancelTemplateDeletion");
2049 $cgui->setConfirm($lng->txt(
"sty_del_template"),
"deleteTemplate");
2051 foreach (
$_POST[
"tid"] as $tid)
2053 $classes = $this->
object->getTemplateClasses($tid);
2056 foreach ($classes as $cl)
2058 if ($cl !=
"" && !$listed[$cl])
2060 $cl_str.=
'<div>- '.
2062 $listed[$cl] =
true;
2067 $cl_str =
'<div style="padding-left:30px;" class="small">'.
2068 "<div><i>".$lng->txt(
"sty_style_class").
"</i></div>".$cl_str.
"</div>";
2070 $cgui->addItem(
"tid[]", $tid, $this->object->lookupTemplateName($tid).$cl_str);
2073 $cgui->addButton($lng->txt(
"sty_del_template_keep_classes"),
"deleteTemplateKeepClasses");
2075 $tpl->setContent($cgui->getHTML());
2086 $ilCtrl->redirect($this,
"listTemplates");
2096 if (is_array(
$_POST[
"tid"]))
2098 foreach (
$_POST[
"tid"] as $tid)
2100 $this->
object->removeTemplate($tid);
2104 $ilCtrl->redirect($this,
"listTemplates");
2114 if (is_array(
$_POST[
"tid"]))
2116 foreach (
$_POST[
"tid"] as $tid)
2118 $cls = $this->
object->getTemplateClasses($tid);
2119 foreach ($cls as $k => $cls)
2121 $ty = $this->
object->determineTemplateStyleClassType(
$_GET[
"temp_type"], $k);
2123 $this->
object->deleteCharacteristic($ty, $ta, $cls);
2125 $this->
object->removeTemplate($tid);
2129 $ilCtrl->redirect($this,
"listTemplates");
2140 $tpl->setContent($this->form_gui->getHTML());
2150 include_once(
"Services/Form/classes/class.ilPropertyFormGUI.php");
2153 $this->form_gui->setTitle($lng->txt(
"sty_generate_template"));
2156 $name_input =
new ilRegExpInputGUI($lng->txt(
"sty_template_name"),
"name");
2157 $name_input->
setPattern(
"/^[a-zA-Z]+[a-zA-Z0-9]*$/");
2158 $name_input->setNoMatchMessage($lng->txt(
"sty_msg_color_must_only_include").
" A-Z, a-z, 1-9");
2159 $name_input->setRequired(
true);
2160 $name_input->setSize(30);
2161 $name_input->setMaxLength(30);
2162 $this->form_gui->addItem($name_input);
2165 $bl_input =
new ilSelectInputGUI($lng->txt(
"sty_template_layout"),
"layout");
2167 "coloredZebra" => $lng->txt(
"sty_table_template_colored_zebra"),
2168 "bwZebra" => $lng->txt(
"sty_table_template_bw_zebra"),
2169 "noZebra" => $lng->txt(
"sty_table_template_no_zebra")
2172 $this->form_gui->addItem($bl_input);
2175 include_once(
"./Services/Style/classes/class.ilNumericStyleValueInputGUI.php");
2178 $num_input->setValue(
"3px");
2179 $this->form_gui->addItem($num_input);
2184 $num_input->setValue(
"10px");
2185 $this->form_gui->addItem($num_input);
2188 $bc_input =
new ilSelectInputGUI($lng->txt(
"sty_base_color"),
"base_color");
2189 $cs = $this->
object->getColors();
2193 $options[$c[
"name"]] = $c[
"name"];
2196 $this->form_gui->addItem($bc_input);
2199 $lss = array(
"border" => 90,
"header_text" => 70,
"header_bg" => 0,
2200 "cell1_text" => -60,
"cell1_bg" => 90,
"cell2_text" => -60,
"cell2_bg" => 75);
2201 foreach ($lss as $ls => $v)
2203 $l_input =
new ilNumberInputGUI($lng->txt(
"sty_lightness_".$ls),
"lightness_".$ls);
2205 $l_input->setMinValue(-100);
2206 $l_input->setValue($v);
2207 $l_input->setSize(4);
2208 $l_input->setMaxLength(4);
2209 $this->form_gui->addItem($l_input);
2212 $this->form_gui->addCommandButton(
"templateGeneration", $lng->txt(
"generate"));
2213 $this->form_gui->addCommandButton(
"cancelTemplateSaving", $lng->txt(
"cancel"));
2214 $this->form_gui->setFormAction($ilCtrl->getFormAction($this));
2226 if ($this->form_gui->checkInput())
2228 if ($this->object->templateExists(
$_POST[
"name"]))
2230 $name_input = $this->form_gui->getItemByPostVar(
"name");
2231 $name_input->setAlert($lng->txt(
"sty_table_template_already_exists"));
2238 $cells = array(
"H" =>
"header",
"C1" =>
"cell1",
"C2" =>
"cell2");
2239 $tb_p = $this->form_gui->getItemByPostVar(
"tb_padding");
2240 $tb_padding = $tb_p->getValue();
2241 $lr_p = $this->form_gui->getItemByPostVar(
"lr_padding");
2242 $lr_padding = $lr_p->getValue();
2243 $cell_color =
$_POST[
"base_color"];
2246 if (
$_POST[
"layout"] ==
"bwZebra")
2248 $cell_color =
"MidGray";
2249 if (!$this->object->colorExists($cell_color))
2251 $this->
object->addColor($cell_color,
"7F7F7F");
2253 $this->
object->updateColor($cell_color, $cell_color,
"7F7F7F");
2256 foreach ($cells as $k => $cell)
2258 $cell_class[$k] =
$_POST[
"name"].$k;
2259 if (!$this->object->characteristicExists($cell_class[$k],
"table_cell"))
2261 $this->
object->addCharacteristic(
"table_cell", $cell_class[$k],
true);
2263 if (
$_POST[
"layout"] ==
"bwZebra" && $k ==
"H")
2265 $this->
object->replaceStylePar(
"td", $cell_class[$k],
"color",
2266 "!".
$_POST[
"base_color"].
"(".
$_POST[
"lightness_".$cell.
"_text"].
")",
"table_cell");
2267 $this->
object->replaceStylePar(
"td", $cell_class[$k],
"background-color",
2268 "!".$_POST[
"base_color"].
"(".$_POST[
"lightness_".$cell.
"_bg"].
")",
"table_cell");
2272 $this->
object->replaceStylePar(
"td", $cell_class[$k],
"color",
2273 "!".$cell_color.
"(".
$_POST[
"lightness_".$cell.
"_text"].
")",
"table_cell");
2274 $this->
object->replaceStylePar(
"td", $cell_class[$k],
"background-color",
2275 "!".$cell_color.
"(".
$_POST[
"lightness_".$cell.
"_bg"].
")",
"table_cell");
2277 $this->
object->replaceStylePar(
"td", $cell_class[$k],
"padding-top",
2278 $tb_padding,
"table_cell");
2279 $this->
object->replaceStylePar(
"td", $cell_class[$k],
"padding-bottom",
2280 $tb_padding,
"table_cell");
2281 $this->
object->replaceStylePar(
"td", $cell_class[$k],
"padding-left",
2282 $lr_padding,
"table_cell");
2283 $this->
object->replaceStylePar(
"td", $cell_class[$k],
"padding-right",
2284 $lr_padding,
"table_cell");
2285 $this->
object->replaceStylePar(
"td", $cell_class[$k],
"border-width",
2286 "1px",
"table_cell");
2287 $this->
object->replaceStylePar(
"td", $cell_class[$k],
"border-style",
2288 "solid",
"table_cell");
2289 $this->
object->replaceStylePar(
"td", $cell_class[$k],
"border-color",
2290 "!".$cell_color.
"(".
$_POST[
"lightness_border"].
")",
"table_cell");
2291 $this->
object->replaceStylePar(
"td", $cell_class[$k],
"font-weight",
2292 "normal",
"table_cell");
2296 $classes[
"table"] =
$_POST[
"name"].
"T";
2297 if (!$this->object->characteristicExists($classes[
"table"],
"table"))
2299 $this->
object->addCharacteristic(
"table", $classes[
"table"],
true);
2301 $this->
object->replaceStylePar(
"table", $classes[
"table"],
"caption-side",
2303 $this->
object->replaceStylePar(
"table", $classes[
"table"],
"border-collapse",
2304 "collapse",
"table");
2305 $this->
object->replaceStylePar(
"table", $classes[
"table"],
"margin-top",
2307 $this->
object->replaceStylePar(
"table", $classes[
"table"],
"margin-bottom",
2309 if (
$_POST[
"layout"] ==
"bwZebra")
2311 $this->
object->replaceStylePar(
"table", $classes[
"table"],
"border-bottom-color",
2312 "!".
$_POST[
"base_color"],
"table");
2313 $this->
object->replaceStylePar(
"table", $classes[
"table"],
"border-bottom-style",
2315 $this->
object->replaceStylePar(
"table", $classes[
"table"],
"border-bottom-width",
2317 $sb = array(
"left",
"right",
"top");
2320 $this->
object->replaceStylePar(
"table", $classes[
"table"],
"border-".$b.
"-width",
2325 switch (
$_POST[
"layout"])
2327 case "coloredZebra":
2328 $classes[
"row_head"] = $cell_class[
"H"];
2329 $classes[
"odd_row"] = $cell_class[
"C1"];
2330 $classes[
"even_row"] = $cell_class[
"C2"];
2334 $classes[
"row_head"] = $cell_class[
"H"];
2335 $classes[
"odd_row"] = $cell_class[
"C1"];
2336 $classes[
"even_row"] = $cell_class[
"C2"];
2340 $classes[
"row_head"] = $cell_class[
"H"];
2341 $classes[
"odd_row"] = $cell_class[
"C1"];
2342 $classes[
"even_row"] = $cell_class[
"C1"];
2343 $classes[
"col_head"] = $cell_class[
"C2"];
2348 $t_id = $this->
object->addTemplate(
$_GET[
"temp_type"],
2349 $_POST[
"name"], $classes);
2350 $this->
object->writeTemplatePreview($t_id,
2352 $ilCtrl->redirect($this,
"listTemplates");
2355 $this->form_gui->setValuesByPost();
2356 $tpl->setContent($this->form_gui->getHTML());
2363 include_once(
"./Services/Accordion/classes/class.ilAccordionGUI.php");
2366 $acc->addItem(
"Header 1", str_repeat(
"bla bla bla bla bla bla", 30));
2367 $acc->addItem(
"Header 2", str_repeat(
"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx xx x xx x xx", 30));
2371 $ac2->addItem(
"Header 1", str_repeat(
"bla bla bla bla bla bla", 30));
2372 $ac2->addItem(
"Header 2", $acc->getHTML());
2375 $tpl->setContent($ac2->getHTML());
2385 if (
$_GET[
"baseClass"] ==
"ilAdministrationGUI")
2387 $ilCtrl->redirectByClass(
"ilobjstylesettingsgui",
"editContentStyles");
2389 $ilCtrl->returnToParent($this);