4require_once
"./Services/Object/classes/class.ilObjectGUI.php";
5require_once
"./Services/Style/Content/classes/class.ilObjStyleSheet.php";
49 public function __construct($a_data, $a_id, $a_call_by_reference, $a_prep =
true)
53 $this->tpl =
$DIC[
"tpl"];
54 $this->rbacsystem =
$DIC->rbac()->system();
55 $this->
help = $DIC[
"ilHelp"];
56 $this->tabs =
$DIC->tabs();
57 $this->toolbar =
$DIC->toolbar();
58 $this->locator =
$DIC[
"ilLocator"];
59 $this->tree =
$DIC->repositoryTree();
60 $this->obj_definition =
$DIC[
"objDefinition"];
67 $this->lng->loadLanguageModule(
"style");
68 $ilCtrl->saveParameter($this, array(
"tag",
"style_type",
"temp_type"));
69 if (
$_GET[
"style_type"] !=
"") {
82 $this->enable_write = $a_write;
90 $next_class = $this->ctrl->getNextClass($this);
91 $cmd = $this->ctrl->getCmd(
"edit");
99 switch ($next_class) {
102 $ret = $this->$cmd();
127 $ilHelp->setScreenIdComponent(
"sty");
132 include_once
"Services/Form/classes/class.ilPropertyFormGUI.php";
134 $form->setFormAction($this->ctrl->getFormAction($this));
135 $form->setTitle($this->lng->txt(
"sty_create_new_stylesheet"));
138 $ti =
new ilTextInputGUI($this->lng->txt(
"title"),
"style_title");
139 $ti->setMaxLength(128);
141 $ti->setRequired(
true);
150 $form->addCommandButton(
"save", $this->lng->txt(
"save"));
151 $form->addCommandButton(
"cancel", $this->lng->txt(
"cancel"));
158 include_once
"Services/Form/classes/class.ilPropertyFormGUI.php";
160 $form->setFormAction($this->ctrl->getFormAction($this));
161 $form->setTitle($this->lng->txt(
"sty_import_stylesheet"));
164 $ti =
new ilFileInputGUI($this->lng->txt(
"import_file"),
"importfile");
165 $ti->setRequired(
true);
168 $form->addCommandButton(
"importStyle", $this->lng->txt(
"import"));
169 $form->addCommandButton(
"cancel", $this->lng->txt(
"cancel"));
176 include_once
"Services/Form/classes/class.ilPropertyFormGUI.php";
178 $form->setFormAction($this->ctrl->getFormAction($this));
179 $form->setTitle($this->lng->txt(
"sty_copy_other_stylesheet"));
183 $ti->setRequired(
true);
187 $form->addCommandButton(
"copyStyle", $this->lng->txt(
"copy"));
188 $form->addCommandButton(
"cancel", $this->lng->txt(
"cancel"));
202 $this->tpl->setCurrentBlock(
"ContentStyle");
203 $this->tpl->setVariable(
204 "LOCATION_CONTENT_STYLESHEET",
207 $this->tpl->parseCurrentBlock();
221 return ($this->enable_write ||
$rbacsystem->checkAccess(
"write", (
int)
$_GET[
"ref_id"])
242 $ctpl =
new ilTemplate(
"tpl.sty_classes.html",
true,
true,
"Services/Style/Content");
245 $chars = $this->
object->getCharacteristics();
247 $style_type = ($this->super_type !=
"")
250 $ilCtrl->setParameter($this,
"style_type", $style_type);
251 $ilTabs->setSubTabActive(
"sty_" . $style_type .
"_char");
254 if ($this->super_type ==
"rte") {
255 $tpl->addCss(
"Modules/Scorm2004/templates/default/player.css");
256 include_once(
"./Modules/Scorm2004/classes/ilSCORM13Player.php");
257 $tpl->addInlineCss(ilSCORM13Player::getInlineCss());
262 $subtypes = $all_super_types[$style_type];
264 foreach ($subtypes as $t) {
270 $ilToolbar->addButton(
271 $lng->txt(
"sty_add_characteristic"),
272 $ilCtrl->getLinkTarget($this,
"addCharacteristicForm")
277 $style_cp = explode(
":::",
$_SESSION[
"sty_copy"]);
278 if ($style_cp[1] == $style_type) {
280 $ilToolbar->addSeparator();
282 $ilToolbar->addButton(
283 $lng->txt(
"sty_paste_style_classes"),
284 $ilCtrl->getLinkTarget($this,
"pasteCharacteristicsOverview")
289 include_once(
"./Services/Style/Content/classes/class.ilStyleTableGUI.php");
298 $ctpl->setCurrentBlock(
"style_table");
299 $ctpl->setVariable(
"STYLE_TABLE", $table_gui->getHTML());
300 $ctpl->parseCurrentBlock();
302 $this->tpl->setContent($ctpl->get());
315 $this->tpl->setCurrentBlock(
"ContentStyle");
316 $this->tpl->setVariable(
317 "LOCATION_CONTENT_STYLESHEET",
320 $this->tpl->parseCurrentBlock();
323 $ilToolbar->addButton(
324 $this->lng->txt(
"export"),
325 $this->ctrl->getLinkTarget($this,
"exportStyle")
330 $this->tpl->setContent($this->form->getHTML());
341 $values[
"style_title"] = $this->
object->getTitle();
342 $values[
"style_description"] = $this->
object->getDescription();
343 $values[
"disable_auto_margins"] = (int) $this->object->lookupStyleSetting(
"disable_auto_margins");
345 $this->form->setValuesByArray($values);
358 include_once(
"Services/Form/classes/class.ilPropertyFormGUI.php");
362 $ti =
new ilTextInputGUI($this->lng->txt(
"title"),
"style_title");
363 $ti->setMaxLength(128);
365 $ti->setRequired(
true);
366 $this->form->addItem($ti);
372 $this->form->addItem($ta);
375 $cb =
new ilCheckboxInputGUI($this->lng->txt(
"sty_disable_auto_margins"),
"disable_auto_margins");
376 $cb->setInfo($this->lng->txt(
"sty_disable_auto_margins_info"));
377 $this->form->addItem($cb);
381 if ($a_mode ==
"create") {
382 $this->form->addCommandButton(
"save",
$lng->txt(
"save"));
383 $this->form->addCommandButton(
"cancelSave",
$lng->txt(
"cancel"));
386 $this->form->addCommandButton(
"update",
$lng->txt(
"save"));
390 $this->form->setTitle(
$lng->txt(
"edit_stylesheet"));
391 $this->form->setFormAction($this->ctrl->getFormAction($this));
404 if ($this->form->checkInput()) {
405 $this->
object->setTitle($this->form->getInput(
"style_title"));
406 $this->
object->setDescription($this->form->getInput(
"style_description"));
407 $this->
object->writeStyleSetting(
408 "disable_auto_margins",
409 $this->form->getInput(
"disable_auto_margins")
411 $this->
object->update();
413 $ilCtrl->redirect($this,
"properties");
415 $this->form->setValuesByPost();
416 $tpl->setContent($this->form->getHtml());
427 $cur = explode(
".",
$_GET[
"tag"]);
429 $cur_class = $cur[1];
433 if ($this->form_gui->checkInput()) {
435 $ilCtrl->redirect($this,
"editTagStyle");
437 $this->form_gui->setValuesByPost();
449 $cur = explode(
".",
$_GET[
"tag"]);
451 $cur_class = $cur[1];
454 if ($this->form_gui->checkInput()) {
456 $ilCtrl->redirect($this,
"edit");
458 $this->form_gui->setValuesByPost();
468 $cur = explode(
".",
$_GET[
"tag"]);
470 $cur_class = $cur[1];
472 foreach ($avail_pars as $par => $v) {
473 $var = str_replace(
"-",
"_", $par);
474 $basepar_arr = explode(
".", $par);
475 $basepar = $basepar_arr[0];
476 if ($basepar_arr[1] !=
"" && $basepar_arr[1] != $cur_tag) {
480 switch ($v[
"input"]) {
482 case "numeric_no_perc":
484 case "background_image":
485 $in = $this->form_gui->getItemByPostVar($basepar);
491 $color = trim(
$_POST[$basepar]);
492 if ($color !=
"" && trim(substr($color, 0, 1) !=
"!")) {
493 $color =
"#" . $color;
501 $in = $this->form_gui->getItemByPostVar($basepar);
505 $this->
writeStylePar($cur_tag, $cur_class, $v[
"subpar"][3],
$in->getBottomValue(),
$_GET[
"style_type"], (
int)
$_GET[
"mq_id"]);
510 $in = $this->form_gui->getItemByPostVar($basepar);
511 $tblr_p = array(0 =>
"getAllValue", 1 =>
"getTopValue", 2 =>
"getRightValue",
512 3 =>
"getBottomValue", 4 =>
"getLeftValue");
513 foreach ($tblr_p as $k => $func) {
514 $val = trim(
$in->$func());
515 $val = ((
$in->getAcceptNamedColors() && substr($val, 0, 1) ==
"!")
523 case "background_position":
524 $in = $this->form_gui->getItemByPostVar($basepar);
535 $this->
object->deleteCustomStylePars($cur_tag, $cur_class,
$_GET[
"style_type"], (
int)
$_GET[
"mq_id"]);
536 if (is_array(
$_POST[
"custom_par"])) {
537 foreach (
$_POST[
"custom_par"] as $cpar) {
538 $par_arr = explode(
":", $cpar);
539 if (count($par_arr) == 2) {
540 $par = trim($par_arr[0]);
541 $val = trim(str_replace(
";",
"", $par_arr[1]));
547 $this->
object->update();
559 $this->
object->replaceStylePar($cur_tag, $cur_class, $par, $value,
$a_type, $a_mq_id, $a_custom);
561 $this->
object->deleteStylePar($cur_tag, $cur_class, $par,
$a_type, $a_mq_id, $a_custom);
577 $mqs = $this->
object->getMediaQueries();
578 if (count($mqs) > 0) {
581 "" =>
$lng->txt(
"sty_default"),
583 foreach ($mqs as $mq) {
584 $options[$mq[
"id"]] = $mq[
"mquery"];
586 include_once(
"./Services/Form/classes/class.ilSelectInputGUI.php");
588 $si->setOptions($options);
589 $si->setValue((
int)
$_GET[
"mq_id"]);
590 $ilToolbar->addInputItem(
$si,
true);
591 $ilToolbar->setFormAction(
$ilCtrl->getFormAction($this));
592 $ilToolbar->addFormButton(
$lng->txt(
"sty_switch"),
"switchMQuery");
597 if ($this->super_type ==
"rte") {
598 $tpl->addCss(
"Modules/Scorm2004/templates/default/player.css");
599 include_once(
"./Modules/Scorm2004/classes/ilSCORM13Player.php");
600 $tpl->addInlineCss(ilSCORM13Player::getInlineCss());
603 $cur = explode(
".",
$_GET[
"tag"]);
605 $cur_class = $cur[1];
622 $ilCtrl->setParameter($this,
"mq_id", (
int)
$_POST[
"mq_id"]);
623 $ilCtrl->redirect($this,
"editTagStyle");
637 $tpl->setCurrentBlock(
"ContentStyle");
639 "LOCATION_CONTENT_STYLESHEET",
643 $ts_tpl =
new ilTemplate(
"tpl.style_tag_edit.html",
true,
true,
"Services/Style/Content");
645 $cur = explode(
".",
$_GET[
"tag"]);
647 $cur_class = $cur[1];
649 $ts_tpl->setVariable(
654 $ts_tpl->setVariable(
656 $this->form_gui->getHtml()
659 $tpl->setTitle($cur_class .
" (" .
$lng->txt(
"sty_type_" .
$_GET[
"style_type"]) .
")");
661 $tpl->setContent($ts_tpl->get());
675 $ilCtrl->saveParameter($this, array(
"mq_id"));
677 include_once(
"Services/Form/classes/class.ilPropertyFormGUI.php");
680 $avail_pars = $this->
object->getAvailableParameters();
681 $groups = $this->
object->getStyleParameterGroups();
684 foreach ($groups as $k => $group) {
688 if (is_array($filtered_groups[$k]) && !in_array($a_cur_tag, $filtered_groups[$k])) {
693 $sh->setTitle(
$lng->txt(
"sty_" . $k));
694 $this->form_gui->addItem($sh);
696 foreach ($group as $par) {
697 $basepar = explode(
".", $par);
698 $basepar = $basepar[0];
700 $var = str_replace(
"-",
"_", $basepar);
701 $up_par = strtoupper($var);
706 $options = array(
"" =>
"");
707 foreach ($avail_pars[$par] as $p) {
710 $sel_input->setOptions($options);
711 $this->form_gui->addItem($sel_input);
716 $text_input->setMaxLength(200);
717 $text_input->setSize(20);
718 $this->form_gui->addItem($text_input);
722 include_once(
"./Services/Style/Content/classes/class.ilFontSizeInputGUI.php");
724 $this->form_gui->addItem($fs_input);
727 case "numeric_no_perc":
729 include_once(
"./Services/Style/Content/classes/class.ilNumericStyleValueInputGUI.php");
732 $num_input->setAllowPercentage(
false);
734 $this->form_gui->addItem($num_input);
739 $per_input->setMinValue(0);
740 $per_input->setMaxValue(100);
741 $per_input->setMaxLength(3);
742 $per_input->setSize(3);
743 $this->form_gui->addItem($per_input);
749 $col_input->setDefaultColor(
"");
750 $col_input->setAcceptNamedColors(
true);
751 $this->form_gui->addItem($col_input);
755 include_once(
"./Services/Style/Content/classes/class.ilTRBLNumericStyleValueInputGUI.php");
758 $num_input->setAllowPercentage(
false);
760 $this->form_gui->addItem($num_input);
764 include_once(
"./Services/Style/Content/classes/class.ilTRBLBorderWidthInputGUI.php");
766 $this->form_gui->addItem($bw_input);
770 include_once(
"./Services/Style/Content/classes/class.ilTRBLBorderStyleInputGUI.php");
772 $this->form_gui->addItem($bw_input);
776 include_once(
"./Services/Style/Content/classes/class.ilTRBLColorPickerInputGUI.php");
778 $col_input->setAcceptNamedColors(
true);
779 $this->form_gui->addItem($col_input);
782 case "background_image":
783 include_once(
"./Services/Style/Content/classes/class.ilBackgroundImageInputGUI.php");
786 foreach ($this->object->getImages() as $entry) {
787 $imgs[] = $entry[
"entry"];
789 $im_input->setImages($imgs);
790 $this->form_gui->addItem($im_input);
793 case "background_position":
794 include_once(
"./Services/Style/Content/classes/class.ilBackgroundPositionInputGUI.php");
796 $this->form_gui->addItem($im_input);
804 $sh->setTitle(
$lng->txt(
"sty_custom"));
805 $this->form_gui->addItem($sh);
808 $ti =
new ilTextInputGUI($this->lng->txt(
"sty_custom_par"),
"custom_par");
809 $ti->setMaxLength(300);
812 $ti->setInfo($this->lng->txt(
"sty_custom_par_info"));
813 $this->form_gui->addItem($ti);
817 $this->form_gui->addCommandButton(
"updateTagStyle",
$lng->txt(
"save_return"));
818 $this->form_gui->addCommandButton(
"refreshTagStyle",
$lng->txt(
"save_refresh"));
821 $this->form_gui->setFormAction($this->ctrl->getFormAction($this));
830 $style = $this->
object->getStyle();
831 $cur = explode(
".",
$_GET[
"tag"]);
833 $cur_class = $cur[1];
839 (
int)
$_GET[
"mq_id"],
843 foreach ($parameters as $p => $v) {
845 if (is_array($filtered_groups[$v[
"group"]]) && !in_array($cur_tag, $filtered_groups[$v[
"group"]])) {
848 $p = explode(
".", $p);
850 $input = $this->form_gui->getItemByPostVar($p);
851 switch ($v[
"input"]) {
859 $input->setAllValue($cur_parameters[$v[
"subpar"][0]]);
860 $input->setTopValue($cur_parameters[$v[
"subpar"][1]]);
861 $input->setRightValue($cur_parameters[$v[
"subpar"][2]]);
862 $input->setBottomValue($cur_parameters[$v[
"subpar"][3]]);
863 $input->setLeftValue($cur_parameters[$v[
"subpar"][4]]);
867 $input->setValue($cur_parameters[$p]);
877 (
int)
$_GET[
"mq_id"],
881 foreach ($cust_parameters as $k =>
$c) {
882 $vals[] = $k .
": " .
$c;
884 $input = $this->form_gui->getItemByPostVar(
"custom_par");
885 $input->setValue($vals);
893 include_once(
"./Services/Export/classes/class.ilExport.php");
895 $r = $exp->exportObject($this->object->getType(), $this->object->getId());
902 $parameters = array();
903 foreach ($a_style as $tag) {
904 foreach ($tag as $par) {
905 if ($par[
"tag"] == $a_tag && $par[
"class"] == $a_class
906 && $par[
"type"] ==
$a_type && (
int) $a_mq_id == (
int) $par[
"mq_id"]
907 && (
int) $a_custom == (
int) $par[
"custom"]) {
908 $parameters[$par[
"parameter"]] = $par[
"value"];
920 $this->
object->addParameter(
$_POST[
"tag"],
$_POST[
"parameter"]);
929 $this->
object->setTitle(
$_POST[
"style_title"]);
930 $this->
object->setDescription(
$_POST[
"style_description"]);
932 foreach (
$_POST[
"styval"] as $id => $value) {
933 $this->
object->updateStyleParameter($id, $value);
935 $this->
object->update();
947 include_once(
"./Services/Utilities/classes/class.ilConfirmationGUI.php");
949 $cgui->setFormAction($this->ctrl->getFormAction($this));
950 $cgui->setHeaderText($this->lng->txt(
"info_delete_sure"));
951 $cgui->setCancel($this->lng->txt(
"cancel"),
"cancelDelete");
952 $cgui->setConfirm($this->lng->txt(
"confirm"),
"confirmedDelete");
957 $cgui->addItem(
"id[]",
"", $caption);
959 $this->tpl->setContent($cgui->getHTML());
968 $this->ctrl->returnToParent($this);
976 $this->
object->delete();
978 $this->ctrl->returnToParent($this);
986 if (is_array(
$_POST[
"sty_select"])) {
987 foreach (
$_POST[
"sty_select"] as $id => $dummy) {
988 $this->
object->deleteParameter($id);
991 $this->
object->read();
992 $this->
object->writeCSSFile();
1001 if (!trim(
$_POST[
"style_title"])) {
1002 $this->ctrl->redirect($this,
"create");
1006 $default_style = $this->
settings->get(
"default_content_style_id");
1009 $new_id = $style_obj->ilClone();
1014 $style_id = $imp->importObject(
1019 $a_comp =
"Services/Style",
1034 if (
$_GET[
"ref_id"] > 0) {
1036 if ($fold->getType() ==
"stys") {
1037 include_once(
"./Services/Style/Content/classes/class.ilContentStyleSettings.php");
1039 $cont_style_settings->addStyle($newObj->getId());
1040 $cont_style_settings->update();
1043 $this->ctrl->returnToParent($this);
1047 return $newObj->getId();
1055 if (
$_POST[
"source_style"] > 0) {
1057 $new_id = $style_obj->ilClone();
1062 if (
$_GET[
"ref_id"] > 0) {
1064 if ($fold->getType() ==
"stys") {
1065 include_once(
"./Services/Style/Content/classes/class.ilContentStyleSettings.php");
1067 $cont_style_settings->addStyle($new_id);
1068 $cont_style_settings->update();
1070 $this->ctrl->returnToParent($this);
1083 $source = $_FILES[
"importfile"][
"tmp_name"];
1085 $this->
ilias->raiseError(
"No file selected!", $this->
ilias->error_obj->MESSAGE);
1089 $info = pathinfo($_FILES[
"importfile"][
"name"]);
1090 if (strtolower($info[
"extension"]) !=
"zip" && strtolower($info[
"extension"]) !=
"xml") {
1091 $this->
ilias->raiseError(
"File must be a zip or xml file!", $this->
ilias->error_obj->MESSAGE);
1095 $fname = explode(
"_", $_FILES[
"importfile"][
"name"]);
1096 if (strtolower($info[
"extension"]) ==
"zip" && $fname[4] ==
"sty") {
1097 include_once(
"./Services/Export/classes/class.ilImport.php");
1099 $new_id = $imp->importObject(
1101 $_FILES[
"importfile"][
"tmp_name"],
1102 $_FILES[
"importfile"][
"name"],
1109 require_once(
"./Services/Style/Content/classes/class.ilObjStyleSheet.php");
1111 $newObj->import($_FILES[
"importfile"]);
1116 if (
$_GET[
"ref_id"] > 0) {
1118 if ($fold->getType() ==
"stys") {
1119 include_once(
"./Services/Style/Content/classes/class.ilContentStyleSettings.php");
1121 $cont_style_settings->addStyle($newObj->getId());
1122 $cont_style_settings->update();
1124 $this->ctrl->returnToParent($this);
1127 return $newObj->getId();
1149 $this->ctrl->returnToParent($this);
1173 $ilHelp->setScreenIdComponent(
"sty");
1175 if (
$ilCtrl->getCmd() ==
"editTagStyle") {
1177 $this->tabs_gui->setBackTarget(
1179 $ilCtrl->getLinkTarget($this,
"edit")
1182 $t = explode(
".",
$_GET[
"tag"]);
1183 $t2 = explode(
":", $t[1]);
1184 $pc = $this->
object->_getPseudoClasses($t[0]);
1185 if (is_array($pc) && count($pc) > 0) {
1187 $ilCtrl->setParameter($this,
"tag", $t[0] .
"." . $t2[0]);
1188 $this->tabs_gui->addTarget(
1190 $this->ctrl->getLinkTarget($this,
"editTagStyle"),
1191 array(
"editTagStyle",
""),
1195 $ilTabs->setTabActive(
"sty_tag_normal");
1198 foreach ($pc as $p) {
1200 $ilCtrl->setParameter($this,
"tag", $t[0] .
"." . $t2[0] .
":" . $p);
1201 $this->tabs_gui->addTarget(
1203 $this->ctrl->getLinkTarget($this,
"editTagStyle"),
1204 array(
"editTagStyle",
""),
1208 $ilTabs->setTabActive(
"sty_tag_" . $p);
1215 $this->tabs_gui->setBackTarget(
1217 $this->ctrl->getLinkTarget($this,
"returnToUpperContext")
1221 $this->tabs_gui->addTarget(
1223 $this->ctrl->getLinkTarget($this,
"edit"),
1229 $this->tabs_gui->addTarget(
1231 $this->ctrl->getLinkTarget($this,
"listColors"),
1237 $this->tabs_gui->addTarget(
1238 "sty_media_queries",
1239 $this->ctrl->getLinkTarget($this,
"listMediaQueries"),
1245 $this->tabs_gui->addTarget(
1247 $this->ctrl->getLinkTarget($this,
"listImages"),
1253 $this->tabs_gui->addTarget(
1255 $this->ctrl->getLinkTarget($this,
"listTemplates"),
1261 $this->tabs_gui->addTarget(
1263 $this->ctrl->getLinkTarget($this,
"properties"),
1289 foreach ($types as $super_type => $types) {
1291 $ilCtrl->setParameter($this,
"style_type", $super_type);
1292 $ilTabs->addSubTabTarget(
1293 "sty_" . $super_type .
"_char",
1294 $this->ctrl->getLinkTarget($this,
"edit"),
1300 $ilCtrl->setParameter($this,
"style_type",
$_GET[
"style_type"]);
1316 foreach ($types as $t =>
$c) {
1317 $ilCtrl->setParameter($this,
"temp_type", $t);
1318 $ilTabs->addSubTabTarget(
1319 "sty_" . $t .
"_templates",
1320 $this->ctrl->getLinkTarget($this,
"listTemplates"),
1321 array(
"listTemplates",
""),
1326 $ilCtrl->setParameter($this,
"temp_type",
$_GET[
"temp_type"]);
1337 if (
$_GET[
"admin_mode"] ==
"settings") {
1338 parent::addAdminLocatorItems(
true);
1340 $ilLocator->addItem(
1344 $this->ctrl->getLinkTargetByClass(
"ilobjstylesettingsgui",
"")
1347 if (
$_GET[
"obj_id"] > 0) {
1348 $ilLocator->addItem(
1349 $this->object->getTitle(),
1350 $this->ctrl->getLinkTarget($this,
"edit")
1370 $ilToolbar->addButton(
1371 $lng->txt(
"sty_add_image"),
1372 $ilCtrl->getLinkTarget($this,
"addImage")
1376 include_once(
"./Services/Style/Content/classes/class.ilStyleImageTableGUI.php");
1382 $tpl->setContent($table_gui->getHTML());
1393 $tpl->setContent($this->form_gui->getHTML());
1403 $ilCtrl->redirect($this,
"listImages");
1416 if ($this->form_gui->checkInput()) {
1417 $this->
object->uploadImage($_FILES[
"image_file"]);
1418 $ilCtrl->redirect($this,
"listImages");
1421 $tpl->setContent($this->form_gui->getHTML());
1433 include_once(
"Services/Form/classes/class.ilPropertyFormGUI.php");
1436 $this->form_gui->setTitle(
$lng->txt(
"sty_add_image"));
1439 $file_input->setSuffixes([
"jpg",
"jpeg",
"png",
"gif",
"svg"]);
1440 $file_input->setRequired(
true);
1441 $this->form_gui->addItem($file_input);
1443 $this->form_gui->addCommandButton(
"uploadImage",
$lng->txt(
"upload"));
1444 $this->form_gui->addCommandButton(
"cancelUpload",
$lng->txt(
"cancel"));
1445 $this->form_gui->setFormAction(
$ilCtrl->getFormAction($this));
1455 $images = $this->
object->getImages();
1457 foreach ($images as $image) {
1458 if (is_array(
$_POST[
"file"]) && in_array($image[
"entry"],
$_POST[
"file"])) {
1459 $this->
object->deleteImage($image[
"entry"]);
1462 $ilCtrl->redirect($this,
"listImages");
1476 if (!is_array(
$_POST[
"char"]) || count(
$_POST[
"char"]) == 0) {
1478 $ilCtrl->redirect($this,
"edit");
1482 foreach (
$_POST[
"char"] as $char) {
1483 if (!empty($core_styles[$char])) {
1489 include_once(
"./Services/Utilities/classes/class.ilConfirmationGUI.php");
1491 $cgui->setFormAction(
$ilCtrl->getFormAction($this));
1492 $cgui->setHeaderText(
$lng->txt(
"sty_confirm_char_deletion"));
1493 $cgui->setCancel(
$lng->txt(
"cancel"),
"cancelCharacteristicDeletion");
1494 $cgui->setConfirm(
$lng->txt(
"delete"),
"deleteCharacteristic");
1496 foreach (
$_POST[
"char"] as $char) {
1497 $char_comp = explode(
".", $char);
1498 $cgui->addItem(
"char[]", $char, $char_comp[2]);
1501 $tpl->setContent($cgui->getHTML());
1517 include_once(
"./Services/Utilities/classes/class.ilConfirmationGUI.php");
1519 $cgui->setFormAction(
$ilCtrl->getFormAction($this));
1524 foreach (
$_POST[
"char"] as $char) {
1525 if (!empty($core_styles[$char])) {
1527 $char_comp = explode(
".", $char);
1528 $cgui->addItem(
"",
"", $char_comp[2]);
1530 $cgui->addHiddenItem(
"char[]", $char);
1533 $all_core_styles = ($cnt == count(
$_POST[
"char"]))
1537 if ($all_core_styles) {
1538 $cgui->setHeaderText(
$lng->txt(
"sty_all_styles_obligatory"));
1539 $cgui->setCancel(
$lng->txt(
"back"),
"cancelCharacteristicDeletion");
1541 $cgui->setHeaderText(
$lng->txt(
"sty_some_styles_obligatory_delete_rest"));
1542 $cgui->setCancel(
$lng->txt(
"cancel"),
"cancelCharacteristicDeletion");
1543 $cgui->setConfirm(
$lng->txt(
"sty_delete_other_selected"),
"deleteCharacteristicConfirmation");
1546 $tpl->setContent($cgui->getHTML());
1558 $ilCtrl->redirect($this,
"edit");
1568 if (is_array(
$_POST[
"char"])) {
1569 foreach (
$_POST[
"char"] as $char) {
1570 $char_comp = explode(
".", $char);
1571 $type = $char_comp[0];
1572 $tag = $char_comp[1];
1573 $class = $char_comp[2];
1575 $this->
object->deleteCharacteristic(
$type, $tag, $class);
1579 $ilCtrl->redirect($this,
"edit");
1590 $tpl->setContent($this->form_gui->getHTML());
1604 if ($this->form_gui->checkInput()) {
1605 if ($this->object->characteristicExists(
$_POST[
"new_characteristic"],
$_GET[
"style_type"])) {
1606 $char_input = $this->form_gui->getItemByPostVar(
"new_characteristic");
1607 $char_input->setAlert(
$lng->txt(
"sty_characteristic_already_exists"));
1609 $this->
object->addCharacteristic(
$_POST[
"type"],
$_POST[
"new_characteristic"]);
1617 $ilCtrl->redirect($this,
"editTagStyle");
1620 $this->form_gui->setValuesByPost();
1621 $tpl->setContent($this->form_gui->getHTML());
1634 include_once(
"Services/Form/classes/class.ilPropertyFormGUI.php");
1639 $txt_input->setPattern(
"/^[a-zA-Z]+[a-zA-Z0-9]*$/");
1640 $txt_input->setNoMatchMessage(
$lng->txt(
"sty_msg_characteristic_must_only_include") .
" A-Z, a-z, 0-9");
1641 $txt_input->setRequired(
true);
1642 $this->form_gui->addItem($txt_input);
1646 $types = $all_super_types[$this->super_type];
1647 $exp_types = array();
1648 foreach ($types as $t) {
1650 $exp_types[$t] =
$lng->txt(
"sty_type_" . $t);
1653 if (count($exp_types) > 1) {
1655 $type_input->setOptions($exp_types);
1656 $type_input->setValue(key($exp_types));
1657 $this->form_gui->addItem($type_input);
1658 } elseif (count($exp_types) == 1) {
1660 $hid_input->setValue(key($exp_types));
1661 $this->form_gui->addItem($hid_input);
1664 $this->form_gui->setTitle(
$lng->txt(
"sty_add_characteristic"));
1665 $this->form_gui->addCommandButton(
"saveCharacteristic",
$lng->txt(
"save"));
1666 $this->form_gui->addCommandButton(
"edit",
$lng->txt(
"cancel"));
1667 $this->form_gui->setFormAction(
$ilCtrl->getFormAction($this));
1679 $c = explode(
":", $a_class);
1682 $ex_tpl =
new ilTemplate(
"tpl.style_example.html",
true,
true,
"Services/Style/Content");
1684 if ($ex_tpl->blockExists(
"Example_" .
$a_type)) {
1685 $ex_tpl->setCurrentBlock(
"Example_" .
$a_type);
1687 $ex_tpl->setCurrentBlock(
"Example_default");
1689 $ex_tpl->setVariable(
"EX_CLASS",
"ilc_" .
$a_type .
"_" . $a_class);
1690 $ex_tpl->setVariable(
"EX_TEXT",
"ABC abc 123");
1691 if (in_array(
$a_type, array(
"media_cont",
"qimg"))) {
1694 if (in_array(
$a_type, array(
"table",
"table_caption"))) {
1695 $ex_tpl->setVariable(
"TXT_CAPTION",
$lng->txt(
"sty_caption"));
1697 if (in_array($a_class, array(
"OrderListItemHorizontal",
"OrderListHorizontal"))) {
1698 $ex_tpl->setVariable(
"HOR",
"Horizontal");
1700 $ex_tpl->parseCurrentBlock();
1702 return $ex_tpl->get();
1715 foreach (
$_POST[
"all_chars"] as $char) {
1716 $ca = explode(
".", $char);
1717 $this->
object->saveHideStatus(
1720 (is_array(
$_POST[
"hide"]) && in_array($char,
$_POST[
"hide"]))
1725 $ilCtrl->redirect($this,
"edit");
1739 if (!is_array(
$_POST[
"char"]) || count(
$_POST[
"char"]) == 0) {
1742 $style_cp = implode(
"::",
$_POST[
"char"]);
1743 $style_cp = $this->
object->getId() .
":::" .
$_GET[
"style_type"] .
":::" . $style_cp;
1745 ilUtil::sendSuccess(
$lng->txt(
"sty_copied_please_select_target"),
true);
1747 $ilCtrl->redirect($this,
"edit");
1761 $ilTabs->clearTargets();
1763 include_once(
"./Services/Style/Content/classes/class.ilPasteStyleCharacteristicTableGUI.php");
1766 $tpl->setContent($table->getHTML());
1780 if (is_array(
$_POST[
"title"])) {
1781 foreach (
$_POST[
"title"] as $from_char => $to_title) {
1782 $fc = explode(
".", $from_char);
1784 if (
$_POST[
"conflict_action"][$from_char] ==
"overwrite" ||
1785 !$this->object->characteristicExists($to_title, $fc[0])) {
1786 $this->
object->copyCharacteristic(
1796 ilUtil::sendSuccess(
$lng->txt(
"sty_style_classes_copied"),
true);
1799 $ilCtrl->redirect($this,
"edit");
1817 $ilToolbar->addButton(
1818 $this->lng->txt(
"sty_add_color"),
1819 $ilCtrl->getLinkTarget($this,
"addColor")
1823 include_once(
"./Services/Style/Content/classes/class.ilStyleColorTableGUI.php");
1829 $tpl->setContent($table_gui->getHTML());
1840 $tpl->setContent($this->form_gui->getHTML());
1851 $ilCtrl->setParameter($this,
"c_name",
$_GET[
"c_name"]);
1854 $tpl->setContent($this->form_gui->getHTML());
1866 include_once(
"Services/Form/classes/class.ilPropertyFormGUI.php");
1869 $this->form_gui->setTitle(
$lng->txt(
"sty_add_color"));
1873 $name_input->setPattern(
"/^[a-zA-Z]+[a-zA-Z0-9]*$/");
1874 $name_input->setNoMatchMessage(
$lng->txt(
"sty_msg_color_must_only_include") .
" A-Z, a-z, 1-9");
1875 $name_input->setRequired(
true);
1876 $name_input->setSize(15);
1877 $name_input->setMaxLength(15);
1878 $this->form_gui->addItem($name_input);
1882 $color_input->setRequired(
true);
1883 $color_input->setDefaultColor(
"");
1884 $this->form_gui->addItem($color_input);
1886 if ($a_mode ==
"create") {
1887 $this->form_gui->addCommandButton(
"saveColor",
$lng->txt(
"save"));
1888 $this->form_gui->addCommandButton(
"cancelColorSaving",
$lng->txt(
"cancel"));
1890 $this->form_gui->addCommandButton(
"updateColor",
$lng->txt(
"save"));
1891 $this->form_gui->addCommandButton(
"cancelColorSaving",
$lng->txt(
"cancel"));
1893 $this->form_gui->setFormAction(
$ilCtrl->getFormAction($this));
1901 if (
$_GET[
"c_name"] !=
"") {
1902 $values[
"color_name"] =
$_GET[
"c_name"];
1903 $values[
"color_code"] = $this->
object->getColorCodeForName(
$_GET[
"c_name"]);
1904 $this->form_gui->setValuesByArray($values);
1915 $ilCtrl->redirect($this,
"listColors");
1929 if ($this->form_gui->checkInput()) {
1930 if ($this->object->colorExists(
$_POST[
"color_name"])) {
1931 $col_input = $this->form_gui->getItemByPostVar(
"color_name");
1932 $col_input->setAlert(
$lng->txt(
"sty_color_already_exists"));
1934 $this->
object->addColor(
1938 $ilCtrl->redirect($this,
"listColors");
1941 $this->form_gui->setValuesByPost();
1942 $tpl->setContent($this->form_gui->getHTML());
1956 if ($this->form_gui->checkInput()) {
1957 if ($this->object->colorExists(
$_POST[
"color_name"]) &&
1959 $col_input = $this->form_gui->getItemByPostVar(
"color_name");
1960 $col_input->setAlert(
$lng->txt(
"sty_color_already_exists"));
1962 $this->
object->updateColor(
1967 $ilCtrl->redirect($this,
"listColors");
1970 $ilCtrl->setParameter($this,
"c_name",
$_GET[
"c_name"]);
1971 $this->form_gui->setValuesByPost();
1972 $tpl->setContent($this->form_gui->getHTML());
1984 if (!is_array(
$_POST[
"color"]) || count(
$_POST[
"color"]) == 0) {
1986 $ilCtrl->redirect($this,
"listColors");
1988 include_once(
"./Services/Utilities/classes/class.ilConfirmationGUI.php");
1990 $cgui->setFormAction(
$ilCtrl->getFormAction($this));
1991 $cgui->setHeaderText(
$lng->txt(
"sty_confirm_color_deletion"));
1992 $cgui->setCancel(
$lng->txt(
"cancel"),
"cancelColorDeletion");
1993 $cgui->setConfirm(
$lng->txt(
"delete"),
"deleteColor");
1999 $tpl->setContent($cgui->getHTML());
2010 $ilCtrl->redirect($this,
"listColors");
2020 if (is_array(
$_POST[
"color"])) {
2022 $this->
object->removeColor($c);
2026 $ilCtrl->redirect($this,
"listColors");
2044 $ilToolbar->addButton(
2045 $this->lng->txt(
"sty_add_media_query"),
2046 $ilCtrl->getLinkTarget($this,
"addMediaQuery")
2050 include_once(
"./Services/Style/Content/classes/class.ilStyleMediaQueryTableGUI.php");
2056 $tpl->setContent($table_gui->getHTML());
2067 $tpl->setContent($this->form_gui->getHTML());
2081 $tpl->setContent($this->form_gui->getHTML());
2093 include_once(
"Services/Form/classes/class.ilPropertyFormGUI.php");
2096 $this->form_gui->setTitle(
$lng->txt(
"sty_add_media_query"));
2100 $ti->setMaxLength(2000);
2101 $ti->setInfo(
$lng->txt(
"sty_add_media_query_info"));
2102 $this->form_gui->addItem($ti);
2105 if ($a_mode ==
"create") {
2106 $this->form_gui->addCommandButton(
"saveMediaQuery",
$lng->txt(
"save"));
2107 $this->form_gui->addCommandButton(
"listMediaQueries",
$lng->txt(
"cancel"));
2109 $this->form_gui->addCommandButton(
"updateMediaQuery",
$lng->txt(
"save"));
2110 $this->form_gui->addCommandButton(
"listMediaQueries",
$lng->txt(
"cancel"));
2112 $this->form_gui->setFormAction(
$ilCtrl->getFormAction($this));
2120 if (
$_GET[
"mq_id"] !=
"") {
2121 foreach ($this->object->getMediaQueries() as $mq) {
2122 if ($mq[
"id"] == (
int)
$_GET[
"mq_id"]) {
2123 $values[
"mquery"] = $mq[
"mquery"];
2126 $this->form_gui->setValuesByArray($values);
2141 if ($this->form_gui->checkInput()) {
2142 $this->
object->addMediaQuery(
$_POST[
"mquery"]);
2143 $ilCtrl->redirect($this,
"listMediaQueries");
2145 $this->form_gui->setValuesByPost();
2146 $tpl->setContent($this->form_gui->getHTML());
2160 if ($this->form_gui->checkInput()) {
2161 $this->
object->updateMediaQuery((
int)
$_GET[
"mq_id"],
$_POST[
"mquery"]);
2162 $ilCtrl->redirect($this,
"listMediaQueries");
2165 $this->form_gui->setValuesByPost();
2166 $tpl->setContent($this->form_gui->getHTML());
2178 if (!is_array(
$_POST[
"mq_id"]) || count(
$_POST[
"mq_id"]) == 0) {
2180 $ilCtrl->redirect($this,
"listMediaQueries");
2182 include_once(
"./Services/Utilities/classes/class.ilConfirmationGUI.php");
2184 $cgui->setFormAction(
$ilCtrl->getFormAction($this));
2185 $cgui->setHeaderText(
$lng->txt(
"sty_sure_del_mqueries"));
2186 $cgui->setCancel(
$lng->txt(
"cancel"),
"listMediaQueries");
2187 $cgui->setConfirm(
$lng->txt(
"delete"),
"deleteMediaQueries");
2190 $mq = $this->
object->getMediaQueryForId($i);
2191 $cgui->addItem(
"mq_id[]",
$i, $mq[
"mquery"]);
2194 $tpl->setContent($cgui->getHTML());
2210 foreach (
$_POST[
"mq_id"] as $id) {
2211 $this->
object->deleteMediaQuery($id);
2214 $ilCtrl->redirect($this,
"listMediaQueries");
2227 if (is_array(
$_POST[
"order"])) {
2228 $this->
object->saveMediaQueryOrder(
$_POST[
"order"]);
2230 $ilCtrl->redirect($this,
"listMediaQueries");
2248 $ctype =
$_GET[
"temp_type"];
2251 $ilCtrl->setParameter($this,
"temp_type", $ctype);
2252 $_GET[
"temp_type"] = $ctype;
2256 $ilTabs->setSubTabActive(
"sty_" . $ctype .
"_templates");
2260 if ($ctype ==
"table") {
2261 $ilToolbar->addButton(
2262 $this->lng->txt(
"sty_generate_template"),
2263 $ilCtrl->getLinkTarget($this,
"generateTemplate")
2266 $ilToolbar->addButton(
2267 $this->lng->txt(
"sty_add_template"),
2268 $ilCtrl->getLinkTarget($this,
"addTemplate")
2275 include_once(
"./Services/Style/Content/classes/class.ilTableTemplatesTableGUI.php");
2282 $tpl->setContent($table_gui->getHTML());
2293 $tpl->setContent($this->form_gui->getHTML());
2335 if ($a_small_mode) {
2340 $ts = $a_style->getTemplate($a_t_id);
2341 $t = $ts[
"classes"];
2345 $p_content =
'<PageContent><Table DataTable="y"';
2346 if ($t[
"row_head"] !=
"") {
2347 $p_content .=
' HeaderRows="1"';
2349 if ($t[
"row_foot"] !=
"") {
2350 $p_content .=
' FooterRows="1"';
2352 if ($t[
"col_head"] !=
"") {
2353 $p_content .=
' HeaderCols="1"';
2355 if ($t[
"col_foot"] !=
"") {
2356 $p_content .=
' FooterCols="1"';
2358 $p_content .=
' Template="' . $a_style->lookupTemplateName($a_t_id) .
'">';
2359 if (!$a_small_mode) {
2360 $p_content .=
'<Caption>' .
$lng->txt(
"sty_caption") .
'</Caption>';
2362 for (
$i = 1;
$i <= $kr;
$i++) {
2363 $p_content .=
'<TableRow>';
2364 for ($j = 1; $j <= $kc; $j++) {
2365 if ($a_small_mode) {
2366 $cell =
'<div style="height:2px;"></div>';
2370 $p_content .=
'<TableData><PageContent><Paragraph Characteristic="TableContent">' . $cell .
'</Paragraph></PageContent></TableData>';
2372 $p_content .=
'</TableRow>';
2374 $p_content .=
'</Table></PageContent>';
2378 include_once(
"./Services/Accordion/classes/class.ilAccordionGUI.php");
2381 if ($a_small_mode) {
2388 if (
$a_type ==
"vaccordion") {
2389 $p_content =
'<PageContent><Tabs HorizontalAlign="Left" Type="VerticalAccordion" ';
2390 if ($a_small_mode) {
2391 $p_content .=
' ContentWidth="70"';
2393 } elseif (
$a_type ==
"haccordion") {
2394 $p_content =
'<PageContent><Tabs Type="HorizontalAccordion"';
2395 if ($a_small_mode) {
2396 $p_content .=
' ContentHeight="40"';
2397 $p_content .=
' ContentWidth="70"';
2398 $c =
'&nbsp;&nbsp;&nbsp;&nbsp;';
2400 $p_content .=
' ContentHeight="40"';
2402 } elseif (
$a_type ==
"carousel") {
2403 $p_content =
'<PageContent><Tabs HorizontalAlign="Left" Type="Carousel" ';
2404 if ($a_small_mode) {
2405 $p_content .=
' ContentWidth="70"';
2410 $p_content .=
' Template="' . $a_style->lookupTemplateName($a_t_id) .
'">';
2411 $p_content .=
'<Tab><PageContent><Paragraph>' .
$c .
'</Paragraph></PageContent>';
2412 $p_content .=
'<TabCaption>' . $h .
'</TabCaption>';
2413 $p_content .=
'</Tab>';
2414 $p_content .=
'</Tabs></PageContent>';
2417 $txml = $a_style->getTemplateXML();
2419 $p_content .= $txml;
2420 include_once(
"./Services/COPage/classes/class.ilPCTableGUI.php");
2425 $r_content .=
"<style>.owl-carousel{ display:block !important; }</style>";
2440 include_once(
"Services/Form/classes/class.ilPropertyFormGUI.php");
2443 if ($a_mode ==
"create") {
2444 $this->form_gui->setTitle(
$lng->txt(
"sty_add_template"));
2446 $this->form_gui->setTitle(
$lng->txt(
"sty_edit_template"));
2451 $name_input->setPattern(
"/^[a-zA-Z]+[a-zA-Z0-9]*$/");
2452 $name_input->setNoMatchMessage(
$lng->txt(
"sty_msg_color_must_only_include") .
" A-Z, a-z, 1-9");
2453 $name_input->setRequired(
true);
2454 $name_input->setSize(30);
2455 $name_input->setMaxLength(30);
2456 $this->form_gui->addItem($name_input);
2460 foreach ($scs as $sc => $st) {
2462 $chars = $this->
object->getCharacteristics($st);
2463 $options = array(
"" =>
"");
2464 foreach ($chars as $char) {
2465 $options[$char] = $char;
2467 $sc_input->setOptions($options);
2468 $this->form_gui->addItem($sc_input);
2471 if ($a_mode ==
"create") {
2472 $this->form_gui->addCommandButton(
"saveTemplate",
$lng->txt(
"save"));
2473 $this->form_gui->addCommandButton(
"cancelTemplateSaving",
$lng->txt(
"cancel"));
2475 $this->form_gui->addCommandButton(
"refreshTemplate",
$lng->txt(
"save_refresh"));
2476 $this->form_gui->addCommandButton(
"updateTemplate",
$lng->txt(
"save_return"));
2477 $this->form_gui->addCommandButton(
"cancelTemplateSaving",
$lng->txt(
"cancel"));
2479 $this->form_gui->setFormAction(
$ilCtrl->getFormAction($this));
2489 $ilCtrl->redirect($this,
"listTemplates");
2504 if ($this->form_gui->checkInput()) {
2505 if ($this->object->templateExists(
$_POST[
"name"])) {
2506 $name_input = $this->form_gui->getItemByPostVar(
"name");
2507 $name_input->setAlert(
$lng->txt(
"sty_table_template_already_exists"));
2511 $classes[$tct] =
$_POST[$tct .
"_class"];
2513 $t_id = $this->
object->addTemplate(
$_GET[
"temp_type"],
$_POST[
"name"], $classes);
2514 $this->
object->writeTemplatePreview(
2518 $ilCtrl->redirect($this,
"listTemplates");
2521 $this->form_gui->setValuesByPost();
2522 $tpl->setContent($this->form_gui->getHTML());
2537 if ($this->form_gui->checkInput()) {
2538 if ($this->object->templateExists(
$_POST[
"name"]) &&
2540 $name_input = $this->form_gui->getItemByPostVar(
"name");
2541 $name_input->setAlert(
$lng->txt(
"sty_template_already_exists"));
2545 $classes[$tct] =
$_POST[$tct .
"_class"];
2548 $this->
object->updateTemplate(
2553 $this->
object->writeTemplatePreview(
2558 $ilCtrl->redirect($this,
"listTemplates");
2563 $this->form_gui->setValuesByPost();
2575 "tpl.template_edit.html",
2578 "Services/Style/Content"
2581 $a_tpl->setVariable(
"FORM", $this->form_gui->getHTML());
2583 $tpl->setContent($a_tpl->get());
2599 if (
$_GET[
"t_id"] > 0) {
2600 $t = $this->
object->getTemplate(
$_GET[
"t_id"]);
2602 $values[
"name"] = $t[
"name"];
2604 foreach ($scs as $k =>
$type) {
2605 $values[$k .
"_class"] = $t[
"classes"][$k];
2607 $this->form_gui->setValuesByArray($values);
2620 if (!is_array(
$_POST[
"tid"]) || count(
$_POST[
"tid"]) == 0) {
2622 $ilCtrl->redirect($this,
"listTemplates");
2624 include_once(
"./Services/Utilities/classes/class.ilConfirmationGUI.php");
2626 $cgui->setFormAction(
$ilCtrl->getFormAction($this));
2627 $cgui->setHeaderText(
$lng->txt(
"sty_confirm_template_deletion"));
2628 $cgui->setCancel(
$lng->txt(
"cancel"),
"cancelTemplateDeletion");
2629 $cgui->setConfirm(
$lng->txt(
"sty_del_template"),
"deleteTemplate");
2631 foreach (
$_POST[
"tid"] as $tid) {
2632 $classes = $this->
object->getTemplateClasses($tid);
2635 foreach ($classes as $cl) {
2636 if ($cl !=
"" && !$listed[$cl]) {
2637 $cl_str .=
'<div>- ' .
2639 $listed[$cl] =
true;
2642 if ($cl_str !=
"") {
2643 $cl_str =
'<div style="padding-left:30px;" class="small">' .
2644 "<div><i>" .
$lng->txt(
"sty_style_class") .
"</i></div>" . $cl_str .
"</div>";
2646 $cgui->addItem(
"tid[]", $tid, $this->object->lookupTemplateName($tid) . $cl_str);
2649 $cgui->addButton(
$lng->txt(
"sty_del_template_keep_classes"),
"deleteTemplateKeepClasses");
2651 $tpl->setContent($cgui->getHTML());
2662 $ilCtrl->redirect($this,
"listTemplates");
2672 if (is_array(
$_POST[
"tid"])) {
2673 foreach (
$_POST[
"tid"] as $tid) {
2674 $this->
object->removeTemplate($tid);
2678 $ilCtrl->redirect($this,
"listTemplates");
2688 if (is_array(
$_POST[
"tid"])) {
2689 foreach (
$_POST[
"tid"] as $tid) {
2690 $cls = $this->
object->getTemplateClasses($tid);
2691 foreach ($cls as $k => $cls) {
2692 $ty = $this->
object->determineTemplateStyleClassType(
$_GET[
"temp_type"], $k);
2694 $this->
object->deleteCharacteristic($ty, $ta, $cls);
2696 $this->
object->removeTemplate($tid);
2700 $ilCtrl->redirect($this,
"listTemplates");
2711 $tpl->setContent($this->form_gui->getHTML());
2722 include_once(
"Services/Form/classes/class.ilPropertyFormGUI.php");
2725 $this->form_gui->setTitle(
$lng->txt(
"sty_generate_template"));
2729 $name_input->setPattern(
"/^[a-zA-Z]+[a-zA-Z0-9]*$/");
2730 $name_input->setNoMatchMessage(
$lng->txt(
"sty_msg_color_must_only_include") .
" A-Z, a-z, 1-9");
2731 $name_input->setRequired(
true);
2732 $name_input->setSize(30);
2733 $name_input->setMaxLength(30);
2734 $this->form_gui->addItem($name_input);
2739 "coloredZebra" =>
$lng->txt(
"sty_table_template_colored_zebra"),
2740 "bwZebra" =>
$lng->txt(
"sty_table_template_bw_zebra"),
2741 "noZebra" =>
$lng->txt(
"sty_table_template_no_zebra")
2743 $bl_input->setOptions($options);
2744 $this->form_gui->addItem($bl_input);
2747 include_once(
"./Services/Style/Content/classes/class.ilNumericStyleValueInputGUI.php");
2749 $num_input->setAllowPercentage(
false);
2750 $num_input->setValue(
"3px");
2751 $this->form_gui->addItem($num_input);
2755 $num_input->setAllowPercentage(
false);
2756 $num_input->setValue(
"10px");
2757 $this->form_gui->addItem($num_input);
2761 $cs = $this->
object->getColors();
2763 foreach ($cs as
$c) {
2764 $options[
$c[
"name"]] =
$c[
"name"];
2766 $bc_input->setOptions($options);
2767 $this->form_gui->addItem($bc_input);
2770 $lss = array(
"border" => 90,
"header_text" => 70,
"header_bg" => 0,
2771 "cell1_text" => -60,
"cell1_bg" => 90,
"cell2_text" => -60,
"cell2_bg" => 75);
2772 foreach ($lss as $ls => $v) {
2774 $l_input->setMaxValue(100);
2775 $l_input->setMinValue(-100);
2776 $l_input->setValue($v);
2777 $l_input->setSize(4);
2778 $l_input->setMaxLength(4);
2779 $this->form_gui->addItem($l_input);
2782 $this->form_gui->addCommandButton(
"templateGeneration",
$lng->txt(
"generate"));
2783 $this->form_gui->addCommandButton(
"cancelTemplateSaving",
$lng->txt(
"cancel"));
2784 $this->form_gui->setFormAction(
$ilCtrl->getFormAction($this));
2798 if ($this->form_gui->checkInput()) {
2799 if ($this->object->templateExists(
$_POST[
"name"])) {
2800 $name_input = $this->form_gui->getItemByPostVar(
"name");
2801 $name_input->setAlert(
$lng->txt(
"sty_table_template_already_exists"));
2806 $cells = array(
"H" =>
"header",
"C1" =>
"cell1",
"C2" =>
"cell2");
2807 $tb_p = $this->form_gui->getItemByPostVar(
"tb_padding");
2808 $tb_padding = $tb_p->getValue();
2809 $lr_p = $this->form_gui->getItemByPostVar(
"lr_padding");
2810 $lr_padding = $lr_p->getValue();
2811 $cell_color =
$_POST[
"base_color"];
2814 if (
$_POST[
"layout"] ==
"bwZebra") {
2815 $cell_color =
"MidGray";
2816 if (!$this->object->colorExists($cell_color)) {
2817 $this->
object->addColor($cell_color,
"7F7F7F");
2819 $this->
object->updateColor($cell_color, $cell_color,
"7F7F7F");
2822 foreach ($cells as $k => $cell) {
2823 $cell_class[$k] =
$_POST[
"name"] . $k;
2824 if (!$this->object->characteristicExists($cell_class[$k],
"table_cell")) {
2825 $this->
object->addCharacteristic(
"table_cell", $cell_class[$k],
true);
2827 if (
$_POST[
"layout"] ==
"bwZebra" && $k ==
"H") {
2828 $this->
object->replaceStylePar(
2832 "!" .
$_POST[
"base_color"] .
"(" .
$_POST[
"lightness_" . $cell .
"_text"] .
")",
2835 $this->
object->replaceStylePar(
2839 "!" .
$_POST[
"base_color"] .
"(" .
$_POST[
"lightness_" . $cell .
"_bg"] .
")",
2843 $this->
object->replaceStylePar(
2847 "!" . $cell_color .
"(" .
$_POST[
"lightness_" . $cell .
"_text"] .
")",
2850 $this->
object->replaceStylePar(
2854 "!" . $cell_color .
"(" .
$_POST[
"lightness_" . $cell .
"_bg"] .
")",
2858 $this->
object->replaceStylePar(
2865 $this->
object->replaceStylePar(
2872 $this->
object->replaceStylePar(
2879 $this->
object->replaceStylePar(
2886 $this->
object->replaceStylePar(
2893 $this->
object->replaceStylePar(
2900 $this->
object->replaceStylePar(
2904 "!" . $cell_color .
"(" .
$_POST[
"lightness_border"] .
")",
2907 $this->
object->replaceStylePar(
2917 $classes[
"table"] =
$_POST[
"name"] .
"T";
2918 if (!$this->object->characteristicExists($classes[
"table"],
"table")) {
2919 $this->
object->addCharacteristic(
"table", $classes[
"table"],
true);
2921 $this->
object->replaceStylePar(
2928 $this->
object->replaceStylePar(
2935 $this->
object->replaceStylePar(
2942 $this->
object->replaceStylePar(
2949 if (
$_POST[
"layout"] ==
"bwZebra") {
2950 $this->
object->replaceStylePar(
2953 "border-bottom-color",
2954 "!" .
$_POST[
"base_color"],
2957 $this->
object->replaceStylePar(
2960 "border-bottom-style",
2964 $this->
object->replaceStylePar(
2967 "border-bottom-width",
2971 $sb = array(
"left",
"right",
"top");
2972 foreach ($sb as
$b) {
2973 $this->
object->replaceStylePar(
2976 "border-" .
$b .
"-width",
2983 switch (
$_POST[
"layout"]) {
2984 case "coloredZebra":
2985 $classes[
"row_head"] = $cell_class[
"H"];
2986 $classes[
"odd_row"] = $cell_class[
"C1"];
2987 $classes[
"even_row"] = $cell_class[
"C2"];
2991 $classes[
"row_head"] = $cell_class[
"H"];
2992 $classes[
"odd_row"] = $cell_class[
"C1"];
2993 $classes[
"even_row"] = $cell_class[
"C2"];
2997 $classes[
"row_head"] = $cell_class[
"H"];
2998 $classes[
"odd_row"] = $cell_class[
"C1"];
2999 $classes[
"even_row"] = $cell_class[
"C1"];
3000 $classes[
"col_head"] = $cell_class[
"C2"];
3005 $t_id = $this->
object->addTemplate(
3010 $this->
object->writeTemplatePreview(
3014 $ilCtrl->redirect($this,
"listTemplates");
3017 $this->form_gui->setValuesByPost();
3018 $tpl->setContent($this->form_gui->getHTML());
3025 include_once(
"./Services/Accordion/classes/class.ilAccordionGUI.php");
3028 $acc->addItem(
"Header 1", str_repeat(
"bla bla bla bla bla bla", 30));
3029 $acc->addItem(
"Header 2", str_repeat(
"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx xx x xx x xx", 30));
3033 $ac2->addItem(
"Header 1", str_repeat(
"bla bla bla bla bla bla", 30));
3034 $ac2->addItem(
"Header 2", $acc->getHTML());
3037 $tpl->setContent($ac2->getHTML());
3051 $ilCtrl->returnToParent($this);
if(php_sapi_name() !='cli') $in
An exception for terminatinating execution or to throw for unit testing.
Accordion user interface class.
static addCss()
Add required css.
Confirmation screen class.
Class ilObjStyleSheetGUI.
editTemplateObject()
Edit table template.
listImagesObject()
List images of style.
updateMediaQueryObject()
Update media query.
saveMediaQueryOrderObject()
Save media query order.
__construct($a_data, $a_id, $a_call_by_reference, $a_prep=true)
Constructor @access public.
cancelCharacteristicDeletionObject()
Cancel characteristic deletion.
generateTemplateObject()
Generate table template.
initTagStyleForm($a_mode, $a_cur_tag)
Init tag style editing form.
getAdminTabs()
admin and normal tabs are equal for roles
templateGenerationObject()
Table template generation.
getValues()
FORM: Get current values from persistent object.
refreshObject()
refresh style sheet
cancelUploadObject()
Cancel Upload.
cancelObject()
update style sheet
deleteImageObject()
Delete images.
exportStyleObject()
export style
deleteMediaQueryConfirmationObject()
Confirm media query deletion.
listMediaQueriesObject()
List media queries of style.
deleteCharacteristicConfirmationObject()
Characteristic deletion confirmation screen.
cancelTemplateDeletionObject()
Cancel table template deletion.
deleteColorObject()
Delete colors.
getPropertiesValues()
Get current values for properties from.
getTemplatePreview($a_type, $a_t_id, $a_small_mode=false)
Get table template preview.
newStyleParameterObject()
add style parameter
afterImport(ilObject $a_new_obj)
After import.
addCharacteristicFormObject()
Add characteristic.
pasteCharacteristicsObject()
Paste characteristics.
editObject()
edit style sheet
deleteObject($a_error=false)
display deletion confirmation screen
refreshTemplateObject()
Refresh table template.
deleteTemplateObject()
Delete table template.
deleteColorConfirmationObject()
Delete color confirmation.
cancelColorDeletionObject()
Cancel color deletion.
deleteTemplateKeepClassesObject()
Delete table template.
getColorFormValues()
Set values for color editing.
getTemplateFormValues()
Set values for table template editing.
updateTagStyleObject()
save and refresh tag editing
initTemplateGenerationForm()
Init table template generation form.
deleteTemplateConfirmationObject()
Delete table template confirmation.
pasteCharacteristicsOverviewObject()
Paste characteristics overview.
saveHideStatusObject()
Save hide status for characteristics.
writeStylePar($cur_tag, $cur_class, $par, $value, $a_type, $a_mq_id, $a_custom=false)
initColorForm($a_mode="create")
Init color form.
cancelColorSavingObject()
Cancel color saving.
copyStyleObject()
save style sheet
outputTagStyleEditScreen()
Output tag style edit screen.
switchMQueryObject()
Switch media query.
addMediaQueryObject()
Add a media query.
updateObject()
Update properties.
addColorObject()
Add a color.
initTemplateForm($a_mode="create")
Init table template form.
deleteStyleParameterObject()
delete style parameters
displayTemplateEditForm()
Display table tempalte edit form.
updateTemplateObject($a_refresh=false)
Update table template.
static _getTemplatePreview($a_style, $a_type, $a_t_id, $a_small_mode=false)
Get table template preview.
addTemplateObject()
Add template.
importStyleObject()
import style sheet
deleteMediaQueriesObject()
Delete Media Queries.
initMediaQueryForm($a_mode="create")
Init media query form.
saveCharacteristicObject()
Save Characteristic.
copyCharacteristicsObject()
Copy style classes.
cancelDeleteObject()
cancel oobject deletion
refreshTagStyleObject()
save and refresh tag editing
saveTagStyle()
Save tag style.
editMediaQueryObject()
Edit media query.
executeCommand()
execute command
initImageForm()
Init image form.
editTagStyleObject()
Edit tag style.
confirmedDeleteObject()
delete selected style objects
saveObject()
save style sheet
saveColorObject()
Save color.
initPropertiesForm($a_mode="edit")
FORM: Init properties form.
listColorsObject()
List colors of style.
setTemplatesSubTabs()
adds tabs to tab gui object
saveTemplateObject()
Save table template.
updateColorObject()
Update color.
getMediaQueryFormValues()
Set values for media query editing.
static getStyleExampleHTML($a_type, $a_class)
Get style example HTML.
viewObject()
viewObject container presentation for "administration -> repository, trash, permissions"
deleteCoreCharMessage()
Message that appears, when user tries to delete core characteristics.
addAdminLocatorItems($a_do_not_add_object=false)
should be overwritten to add object specific items (repository items are preloaded)
uploadImageObject()
Upload image.
includeCSS()
Include CSS in output.
returnToUpperContextObject()
return to upper context
initCharacteristicForm($a_mode)
Init tag style editing form.
extractParametersOfTag($a_tag, $a_class, $a_style, $a_type, $a_mq_id=0, $a_custom=false)
propertiesObject()
Properties.
getTabs()
adds tabs to tab gui object
setSubTabs()
adds tabs to tab gui object
enableWrite($a_write)
Enable writing.
saveMediaQueryObject()
Save media query.
addImageObject()
Add an image.
listTemplatesObject()
List templates.
editColorObject()
Edit color.
cancelTemplateSavingObject()
Cancel color saving.
deleteCharacteristicObject()
Delete one or multiple style characteristic.
static getBasicZipPath()
Get basic zip path.
static _getStyleParameterInputType($par)
static _getTemplateClassTypes($a_template_type="")
Get template class types.
static _getClonableContentStyles()
Get all clonable styles (active standard styles and individual learning module styles with write perm...
static _getFilteredGroups()
static _getStyleParameters($a_tag="")
static _writeStandard($a_id, $a_std)
Write standard flag.
static _isExpandable($a_type)
static _addMissingStyleClassesToStyle($a_id)
Add missing style classes to all styles.
static _determineTag($a_type)
static _getStyleSuperTypeForType($a_type)
static getContentStylePath($a_style_id, $add_random=true, $add_token=true)
get content style path
static _lookupTemplateName($a_t_id)
Lookup table template name for template ID.
static _writeUpToDate($a_id, $a_up_to_date)
Write up to date.
static _getStyleSuperTypes()
static _getCoreStyles()
Get core styles.
static getInstanceByObjId($a_obj_id, $stop_on_error=true)
get an instance of an Ilias object by object id
static getInstanceByRefId($a_ref_id, $stop_on_error=true)
get an instance of an Ilias object by reference id
Class ilObjectGUI Basic methods of all Output classes.
prepareOutput($a_show_subobjects=true)
prepare output
getCreationFormsHTML(array $a_forms)
Get HTML for creation forms (accordion)
setCreationMode($a_mode=true)
if true, a creation screen is displayed the current $_GET[ref_id] don't belong to the current class!...
Class ilObject Basic functions for all objects.
static _lookupObjId($a_id)
static _lookupTitle($a_id)
lookup object title
static _lookupType($a_id, $a_reference=false)
lookup object type
static _renderTable( $content, $a_mode="table_edit", $a_submode="", $a_table_obj=null, $unmask=true, $page_object=null)
Static render table function.
Paste style overview table.
TableGUI class for style editor (image list)
TableGUI class for style editor (image list)
TableGUI class for style editor.
special template class to simplify handling of ITX/PEAR
This class represents a text area property in a property form.
This class represents a text property in a property form.
static getImageTagByType($a_type, $a_path, $a_big=false)
Builds an html image tag TODO: function still in use, but in future use getImagePath and move HTML-Co...
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
static deliverFile( $a_file, $a_filename, $a_mime='', $isInline=false, $removeAfterDelivery=false, $a_exit_after=true)
deliver file for download via browser.
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
static prepareFormOutput($a_str, $a_strip=false)
prepares string output for html forms @access public
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
redirection script todo: (a better solution should control the processing via a xml file)