ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ilStyleCharacteristicGUI Class Reference

Characteristics UI. More...

+ Collaboration diagram for ilStyleCharacteristicGUI:

Public Member Functions

 __construct (Content\InternalDomainService $domain_service, Content\InternalGUIService $gui_service, ilObjStyleSheet $style_sheet, string $super_type, Access\StyleAccessManager $access_manager, Content\CharacteristicManager $manager, Content\ImageManager $image_manager)
 
 executeCommand ()
 Execute command. More...
 
 listCharacteristics ()
 
 setListSubTabs ()
 
 addCharacteristic ()
 
 saveCharacteristic ()
 
 deleteCharacteristicConfirmation ()
 
 deleteCoreCharMessage ()
 
 cancelCharacteristicDeletion ()
 
 deleteCharacteristic ()
 Delete one or multiple style characteristic. More...
 
 initCharacteristicForm ()
 Init tag style editing form. More...
 
 saveTagTitles ()
 
 saveStatus ()
 Save hide status for characteristics. More...
 
 copyCharacteristics ()
 
 pasteCharacteristicsOverview ()
 
 getPasteWithinStyleForm ()
 Init past within style form. More...
 
 getPasteFromOtherStyleForm ()
 Init past from other style form. More...
 
 pasteCharacteristicsWithinStyle ()
 
 pasteCharacteristicsFromOtherStyle ()
 
 pasteCharacteristics ()
 
 switchMQuery ()
 Switch media query. More...
 

Protected Member Functions

 extractParametersOfTag (bool $a_custom=false)
 
 setTabs ()
 
 setParameterSubTabs ()
 
 editTagStyle ()
 
 initTagStyleForm ()
 Init tag style editing form. More...
 
 getValues (ilPropertyFormGUI $form)
 FORM: Get current values from persistent object. More...
 
 outputTagStyleEditScreen (ilPropertyFormGUI $form)
 
 setTitle ()
 
 refreshTagStyle ()
 
 updateTagStyle ()
 
 saveTagStyle (ilPropertyFormGUI $form)
 
 writeStylePar (string $par, string $value, bool $a_custom=false)
 Write style parameter. More...
 
 editTagTitles ()
 
 getTagTitlesForm ()
 
 setOutdated ()
 
 removeOutdated ()
 
 getCharacterTitleFormFields (string $char)
 Get character title form section. More...
 

Protected Attributes

string $requested_char
 
Content StandardGUIRequest $request
 
ilObjStyleSheet $object
 
string $super_type
 
string $current_tag
 
string $current_class
 
string $current_base_class
 
string $current_pseudo_class
 
string $style_type
 
int $mq_id
 
Content CharacteristicManager $manager
 
Access StyleAccessManager $access_manager
 
Content ImageManager $image_manager
 
Content InternalGUIService $gui_service
 
Content InternalDomainService $domain_service
 

Private Attributes

ilGlobalTemplateInterface $main_tpl
 

Detailed Description

Characteristics UI.

Author
Alexander Killing killi.nosp@m.ng@l.nosp@m.eifos.nosp@m..de

Definition at line 31 of file class.ilStyleCharacteristicGUI.php.

Constructor & Destructor Documentation

◆ __construct()

ilStyleCharacteristicGUI::__construct ( Content\InternalDomainService  $domain_service,
Content\InternalGUIService  $gui_service,
ilObjStyleSheet  $style_sheet,
string  $super_type,
Access\StyleAccessManager  $access_manager,
Content\CharacteristicManager  $manager,
Content\ImageManager  $image_manager 
)

Definition at line 50 of file class.ilStyleCharacteristicGUI.php.

58 {
59 global $DIC;
60 $this->main_tpl = $DIC->ui()->mainTemplate();
61 $this->gui_service = $gui_service;
62 $this->domain_service = $domain_service;
63 $this->access_manager = $access_manager;
64 $this->object = $style_sheet;
65 $this->super_type = $super_type;
66 $this->manager = $manager;
67 $this->image_manager = $image_manager;
68 $this->request = $gui_service->standardRequest();
69
70 $cur = explode(".", $this->request->getTag());
71 $this->current_tag = (string) $cur[0];
72 $this->current_class = (string) ($cur[1] ?? "");
73
74 $t = explode(":", $cur[1] ?? "");
75 $this->current_base_class = (string) $t[0];
76 $this->current_pseudo_class = (string) ($t[1] ?? "");
77
78 $this->style_type = $this->request->getStyleType();
79 $this->requested_char = $this->request->getCharacteristic();
80 $this->mq_id = $this->request->getMediaQueryId();
81
82 $ctrl = $gui_service->ctrl();
83 $ctrl->saveParameter($this, "tag");
84 }
Access StyleAccessManager $access_manager
Content CharacteristicManager $manager
Content InternalDomainService $domain_service
Content InternalGUIService $gui_service
global $DIC
Definition: shib_login.php:26

References $access_manager, $DIC, $domain_service, $gui_service, $image_manager, $manager, $super_type, and ILIAS\Repository\InternalGUIService\standardRequest().

+ Here is the call graph for this function:

Member Function Documentation

◆ addCharacteristic()

ilStyleCharacteristicGUI::addCharacteristic ( )

Definition at line 205 of file class.ilStyleCharacteristicGUI.php.

205 : void
206 {
207 $tpl = $this->gui_service->mainTemplate();
208
209 $form = $this->initCharacteristicForm();
210 $tpl->setContent($form->getHTML());
211 }
initCharacteristicForm()
Init tag style editing form.

◆ cancelCharacteristicDeletion()

ilStyleCharacteristicGUI::cancelCharacteristicDeletion ( )

Definition at line 319 of file class.ilStyleCharacteristicGUI.php.

319 : void
320 {
321 $ilCtrl = $this->gui_service->ctrl();
322 $lng = $this->domain_service->lng();
323
324 $this->main_tpl->setOnScreenMessage('info', $lng->txt("action_aborted"), true);
325 $ilCtrl->redirect($this, "listCharacteristics");
326 }
global $lng
Definition: privfeed.php:31

References $lng.

◆ copyCharacteristics()

ilStyleCharacteristicGUI::copyCharacteristics ( )

Definition at line 1039 of file class.ilStyleCharacteristicGUI.php.

1039 : void
1040 {
1041 $ilCtrl = $this->gui_service->ctrl();
1042 $lng = $this->domain_service->lng();
1043
1044 $chars = $this->request->getCharacteristics();
1045
1046 // check, if type can be copied (is expanable)
1047 foreach ($chars as $c) {
1048 $type_arr = explode(".", $c);
1049 if (!ilObjStyleSheet::_isExpandable($type_arr[0] ?? "")) {
1050 $this->main_tpl->setOnScreenMessage(
1051 'failure',
1052 $lng->txt("sty_cannot_be_copied") . ": " . $lng->txt("sty_type_" . $type_arr[0] ?? ""),
1053 true
1054 );
1055 $ilCtrl->redirect($this, "listCharacteristics");
1056 }
1057 }
1058
1059 if (count($chars) == 0) {
1060 $this->main_tpl->setOnScreenMessage('failure', $lng->txt("no_checkbox"), true);
1061 } else {
1062 $this->manager->setCopyCharacteristics(
1063 $this->style_type,
1064 $chars
1065 );
1066 $this->main_tpl->setOnScreenMessage('success', $lng->txt("sty_copied_please_select_target"), true);
1067 }
1068 $ilCtrl->redirect($this, "listCharacteristics");
1069 }
static _isExpandable(string $a_type)
$c
Definition: deliver.php:25

References $c, $lng, and ilObjStyleSheet\_isExpandable().

+ Here is the call graph for this function:

◆ deleteCharacteristic()

ilStyleCharacteristicGUI::deleteCharacteristic ( )

Delete one or multiple style characteristic.

Exceptions
Content

ContentStyleNoPermissionException

Definition at line 332 of file class.ilStyleCharacteristicGUI.php.

332 : void
333 {
334 $ilCtrl = $this->gui_service->ctrl();
335
336 $chars = $this->request->getCharacteristics();
337 foreach ($chars as $char) {
338 $char_comp = explode(".", $char);
339 $type = $char_comp[0];
340 $tag = $char_comp[1];
341 $class = $char_comp[2];
342
343 $this->manager->deleteCharacteristic(
344 $type,
345 $class
346 );
347 }
348
349 $ilCtrl->redirect($this, "listCharacteristics");
350 }

◆ deleteCharacteristicConfirmation()

ilStyleCharacteristicGUI::deleteCharacteristicConfirmation ( )

Definition at line 243 of file class.ilStyleCharacteristicGUI.php.

243 : void
244 {
245 $ilCtrl = $this->gui_service->ctrl();
246 $tpl = $this->gui_service->mainTemplate();
247 $lng = $this->domain_service->lng();
248
249 //var_dump($_POST);
250
251 $chars = $this->request->getCharacteristics();
252 if (count($chars) == 0) {
253 $this->main_tpl->setOnScreenMessage('info', $lng->txt("no_checkbox"), true);
254 $ilCtrl->redirect($this, "edit");
255 } else {
256 // check whether there are any core style classes included
257 $core_styles = ilObjStyleSheet::_getCoreStyles();
258 foreach ($chars as $char) {
259 if (!empty($core_styles[$char])) {
260 $this->deleteCoreCharMessage();
261 return;
262 }
263 }
264
265 $cgui = new ilConfirmationGUI();
266 $cgui->setFormAction($ilCtrl->getFormAction($this));
267 $cgui->setHeaderText($lng->txt("sty_confirm_char_deletion"));
268 $cgui->setCancel($lng->txt("cancel"), "cancelCharacteristicDeletion");
269 $cgui->setConfirm($lng->txt("delete"), "deleteCharacteristic");
270
271 foreach ($chars as $char) {
272 $char_comp = explode(".", $char);
273 $cgui->addItem("char[]", $char, $char_comp[2]);
274 }
275
276 $tpl->setContent($cgui->getHTML());
277 }
278 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...

References $lng, and ilObjStyleSheet\_getCoreStyles().

+ Here is the call graph for this function:

◆ deleteCoreCharMessage()

ilStyleCharacteristicGUI::deleteCoreCharMessage ( )

Definition at line 281 of file class.ilStyleCharacteristicGUI.php.

281 : void
282 {
283 $ilCtrl = $this->gui_service->ctrl();
284 $tpl = $this->gui_service->mainTemplate();
285 $lng = $this->domain_service->lng();
286
287 $cgui = new ilConfirmationGUI();
288 $cgui->setFormAction($ilCtrl->getFormAction($this));
289
290
291 $core_styles = ilObjStyleSheet::_getCoreStyles();
292 $cnt = 0;
293
294 $chars = $this->request->getCharacteristics();
295 foreach ($chars as $char) {
296 if (!empty($core_styles[$char])) {
297 $cnt++;
298 $char_comp = explode(".", $char);
299 $cgui->addItem("", "", $char_comp[2]);
300 } else {
301 $cgui->addHiddenItem("char[]", $char);
302 }
303 }
304 $all_core_styles = ($cnt == count($chars));
305
306 if ($all_core_styles) {
307 $cgui->setHeaderText($lng->txt("sty_all_styles_obligatory"));
308 $cgui->setCancel($lng->txt("back"), "cancelCharacteristicDeletion");
309 $cgui->setConfirm($lng->txt("ok"), "cancelCharacteristicDeletion");
310 } else {
311 $cgui->setHeaderText($lng->txt("sty_some_styles_obligatory_delete_rest"));
312 $cgui->setCancel($lng->txt("cancel"), "cancelCharacteristicDeletion");
313 $cgui->setConfirm($lng->txt("sty_delete_other_selected"), "deleteCharacteristicConfirmation");
314 }
315
316 $tpl->setContent($cgui->getHTML());
317 }

References $lng, and ilObjStyleSheet\_getCoreStyles().

+ Here is the call graph for this function:

◆ editTagStyle()

ilStyleCharacteristicGUI::editTagStyle ( )
protected

Definition at line 468 of file class.ilStyleCharacteristicGUI.php.

468 : void
469 {
470 $ilToolbar = $this->gui_service->toolbar();
471 $lng = $this->domain_service->lng();
472 $ilCtrl = $this->gui_service->ctrl();
473 $tabs = $this->gui_service->tabs();
474
475 $this->setTabs();
476 $this->setParameterSubTabs();
477 $tabs->activateTab("parameters");
478
479 // media query selector
480 $mqs = $this->object->getMediaQueries();
481 if (count($mqs) > 0) {
482 //
483 $options = array(
484 "" => $lng->txt("sty_default"),
485 );
486 foreach ($mqs as $mq) {
487 $options[$mq["id"]] = $mq["mquery"];
488 }
489 $si = new ilSelectInputGUI("@media", "mq_id");
490 $si->setOptions($options);
491 $si->setValue($this->mq_id);
492 $ilToolbar->addInputItem($si, true);
493 $ilToolbar->setFormAction($ilCtrl->getFormAction($this));
494 $ilToolbar->addFormButton($lng->txt("sty_switch"), "switchMQuery");
495 }
496
497 $form = $this->initTagStyleForm();
498 $this->getValues($form);
499 $this->outputTagStyleEditScreen($form);
500 }
This class represents a selection list property in a property form.
outputTagStyleEditScreen(ilPropertyFormGUI $form)
initTagStyleForm()
Init tag style editing form.
getValues(ilPropertyFormGUI $form)
FORM: Get current values from persistent object.

References $lng.

◆ editTagTitles()

ilStyleCharacteristicGUI::editTagTitles ( )
protected

Definition at line 860 of file class.ilStyleCharacteristicGUI.php.

860 : void
861 {
862 $this->setTabs();
863 $tpl = $this->gui_service->mainTemplate();
864 $ui = $this->gui_service->ui();
865 $tabs = $this->gui_service->tabs();
866
867 $form = $this->getTagTitlesForm();
868 $this->setTitle();
869 $tabs->activateTab("titles");
870 $tpl->setContent($ui->renderer()->render($form));
871 }

◆ executeCommand()

ilStyleCharacteristicGUI::executeCommand ( )

Execute command.

Definition at line 106 of file class.ilStyleCharacteristicGUI.php.

106 : void
107 {
108 $ctrl = $this->gui_service->ctrl();
109
110 $next_class = $ctrl->getNextClass($this);
111 $cmd = $ctrl->getCmd();
112 switch ($next_class) {
113 default:
114 if (in_array($cmd, [
115 "listCharacteristics", "addCharacteristic", "saveCharacteristic",
116 "deleteCharacteristicConfirmation", "cancelCharacteristicDeletion", "deleteCharacteristic",
117 "copyCharacteristics", "pasteCharacteristicsOverview", "pasteCharacteristics",
118 "pasteCharacteristicsWithinStyle", "pasteCharacteristicsFromOtherStyle",
119 "saveStatus", "setOutdated", "removeOutdated",
120 "editTagStyle", "refreshTagStyle", "updateTagStyle",
121 "editTagTitles", "saveTagTitles", "switchMQuery"])) {
122 $this->$cmd();
123 }
124 }
125 }

◆ extractParametersOfTag()

ilStyleCharacteristicGUI::extractParametersOfTag ( bool  $a_custom = false)
protected

Definition at line 86 of file class.ilStyleCharacteristicGUI.php.

88 : array {
89 $style = $this->object->getStyle();
90 $parameters = array();
91 foreach ($style as $tag) {
92 foreach ($tag as $par) {
93 if ($par["tag"] == $this->current_tag && $par["class"] == $this->current_class
94 && $par["type"] == $this->style_type && $this->mq_id == (int) $par["mq_id"]
95 && (int) $a_custom == (int) $par["custom"]) {
96 $parameters[$par["parameter"]] = $par["value"];
97 }
98 }
99 }
100 return $parameters;
101 }

◆ getCharacterTitleFormFields()

ilStyleCharacteristicGUI::getCharacterTitleFormFields ( string  $char)
protected

Get character title form section.

Definition at line 1164 of file class.ilStyleCharacteristicGUI.php.

1164 : array
1165 {
1166 $ui = $this->gui_service->ui();
1167 $f = $ui->factory();
1168 $refinery = $this->domain_service->refinery();
1169 $lng = $this->domain_service->lng();
1171 $style_obj = $this->object;
1172
1173
1174 $lng->loadLanguageModule("meta");
1175
1176 $char_regexp_constraint = $refinery->custom()->constraint(function ($v) use ($lng) {
1177 return (bool) preg_match("/^[a-zA-Z]+[a-zA-Z0-9]*$/", $v);
1178 }, $lng->txt("sty_msg_characteristic_must_only_include") . " A-Z, a-z, 0-9");
1179
1180 $char_exists_constraint = $refinery->custom()->constraint(function ($v) use ($style_obj, $style_type) {
1181 return !$style_obj->characteristicExists($v, $style_type);
1182 }, $lng->txt("sty_characteristic_already_exists"));
1183
1184 $fields = [];
1185 $fields["char_" . $char] = $f->input()->field()->text($lng->txt("sty_class_name"))
1186 ->withRequired(true)
1187 ->withAdditionalTransformation($char_regexp_constraint)
1188 ->withAdditionalTransformation($char_exists_constraint);
1189
1190 foreach ($lng->getInstalledLanguages() as $l) {
1191 $fields["title_" . $char . "_" . $l] = $f->input()->field()->text($lng->txt("title") .
1192 " - " . $lng->txt("meta_l_" . $l))
1193 ->withRequired(false)
1194 ->withValue($titles[$l] ?? "");
1195 }
1196
1197 return $fields;
1198 }

References Vendor\Package\$f, $lng, and ILIAS\UI\examples\Layout\Page\Standard\$refinery.

◆ getPasteFromOtherStyleForm()

ilStyleCharacteristicGUI::getPasteFromOtherStyleForm ( )

Init past from other style form.

Exceptions
ilCtrlException

Definition at line 1116 of file class.ilStyleCharacteristicGUI.php.

1116 : Standard
1117 {
1118 $ui = $this->gui_service->ui();
1119 $lng = $this->domain_service->lng();
1120 $f = $ui->factory();
1121 $ctrl = $this->gui_service->ctrl();
1122
1123 $sections = [];
1124 $fields = [];
1125 foreach ($this->manager->getCopyCharacteristics() as $char) {
1126 $char_text = explode(".", $char);
1127 $options = [];
1128 foreach ($this->manager->getByType($char_text[0]) as $c) {
1129 $options[$c->getCharacteristic()] = $c->getCharacteristic();
1130 }
1131 $group1 = $f->input()->field()->group(
1132 $this->getCharacterTitleFormFields($char),
1133 $lng->txt("sty_create_new_class")
1134 );
1135 $group2 = $f->input()->field()->group(
1136 [
1137 "overwrite_class" => $f->input()->field()->select(
1138 $lng->txt("sty_class"),
1139 $options
1140 )->withRequired(true)
1141 ],
1142 $lng->txt("sty_overwrite_existing_class")
1143 );
1144 $fields[$char] = $f->input()->field()->switchableGroup(
1145 [
1146 "new_" . $char => $group1,
1147 "overwrite_" . $char => $group2
1148 ],
1149 $char_text[2]
1150 )->withValue("new_" . $char);
1151 }
1152 $sections["sec"] = $f->input()->field()->section(
1153 $fields,
1154 $lng->txt("sty_paste_chars")
1155 );
1156
1157 $form_action = $ctrl->getLinkTarget($this, "pasteCharacteristicsFromOtherStyle");
1158 return $f->input()->container()->form()->standard($form_action, $sections);
1159 }
getCharacterTitleFormFields(string $char)
Get character title form section.

References $c, Vendor\Package\$f, and $lng.

◆ getPasteWithinStyleForm()

ilStyleCharacteristicGUI::getPasteWithinStyleForm ( )

Init past within style form.

Exceptions
ilCtrlException

Definition at line 1092 of file class.ilStyleCharacteristicGUI.php.

1092 : Standard
1093 {
1094 $ui = $this->gui_service->ui();
1095 $f = $ui->factory();
1096 $ctrl = $this->gui_service->ctrl();
1097
1098 $sections = [];
1099 foreach ($this->manager->getCopyCharacteristics() as $char) {
1100 // section
1101 $char_text = explode(".", $char);
1102 $sections[$char] = $f->input()->field()->section(
1103 $this->getCharacterTitleFormFields($char),
1104 $char_text[2]
1105 );
1106 }
1107
1108 $form_action = $ctrl->getLinkTarget($this, "pasteCharacteristicsWithinStyle");
1109 return $f->input()->container()->form()->standard($form_action, $sections);
1110 }

References Vendor\Package\$f.

◆ getTagTitlesForm()

ilStyleCharacteristicGUI::getTagTitlesForm ( )
protected
Exceptions
ilCtrlException

Definition at line 876 of file class.ilStyleCharacteristicGUI.php.

876 : Standard
877 {
878 $ui = $this->gui_service->ui();
879 $f = $ui->factory();
880 $ctrl = $this->gui_service->ctrl();
881 $lng = $this->domain_service->lng();
882 $fields = [];
883
884 $lng->loadLanguageModule("meta");
885
886 $characteristic = $this->manager->getByKey(
887 $this->style_type,
888 $this->current_base_class
889 );
890 $titles = $characteristic->getTitles();
891
892 foreach ($lng->getInstalledLanguages() as $l) {
893 $fields["title_" . $l] = $f->input()->field()->text($lng->txt("title") .
894 " - " . $lng->txt("meta_l_" . $l))
895 ->withRequired(false)
896 ->withValue($titles[$l] ?? "");
897 }
898
899 // section
900 $section1 = $f->input()->field()->section($fields, $lng->txt("sty_titles"));
901
902 $form_action = $ctrl->getLinkTarget($this, "saveTagTitles");
903 return $f->input()->container()->form()->standard($form_action, ["sec" => $section1]);
904 }

References Vendor\Package\$f, and $lng.

◆ getValues()

ilStyleCharacteristicGUI::getValues ( ilPropertyFormGUI  $form)
protected

FORM: Get current values from persistent object.

Definition at line 655 of file class.ilStyleCharacteristicGUI.php.

655 : void
656 {
657 $cur_parameters = $this->extractParametersOfTag();
659 foreach ($parameters as $p => $v) {
660 $filtered_groups = ilObjStyleSheet::_getFilteredGroups();
661 if (isset($filtered_groups[$v["group"]]) && !in_array($this->current_tag, $filtered_groups[$v["group"]])) {
662 continue;
663 }
664 $p = explode(".", $p);
665 $p = $p[0];
666 $input = $form->getItemByPostVar($p);
667 switch ($v["input"]) {
668 case "":
669 break;
670
671 case "trbl_numeric":
672 case "border_width":
673 case "border_style":
674 case "trbl_color":
675 $input->setAllValue($cur_parameters[$v["subpar"][0]] ?? "");
676 $input->setTopValue($cur_parameters[$v["subpar"][1]] ?? "");
677 $input->setRightValue($cur_parameters[$v["subpar"][2]] ?? "");
678 $input->setBottomValue($cur_parameters[$v["subpar"][3]] ?? "");
679 $input->setLeftValue($cur_parameters[$v["subpar"][4]] ?? "");
680 break;
681
682 default:
683 $input->setValue($cur_parameters[$p] ?? "");
684 break;
685 }
686 }
687
688 $cust_parameters = $this->extractParametersOfTag(true);
689 $vals = array();
690 foreach ($cust_parameters as $k => $c) {
691 $vals[] = $k . ": " . $c;
692 }
693 $input = $form->getItemByPostVar("custom_par");
694 $input->setValue($vals);
695 }
static _getStyleParameters(string $a_tag="")
getItemByPostVar(string $a_post_var)
extractParametersOfTag(bool $a_custom=false)

References $c, ilObjStyleSheet\_getFilteredGroups(), ilObjStyleSheet\_getStyleParameters(), and ilPropertyFormGUI\getItemByPostVar().

+ Here is the call graph for this function:

◆ initCharacteristicForm()

ilStyleCharacteristicGUI::initCharacteristicForm ( )

Init tag style editing form.

Definition at line 355 of file class.ilStyleCharacteristicGUI.php.

356 {
357 $lng = $this->domain_service->lng();
358 $ilCtrl = $this->gui_service->ctrl();
359
360 $form = new ilPropertyFormGUI();
361
362 // title
363 $txt_input = new ilRegExpInputGUI($lng->txt("title"), "new_characteristic");
364 $txt_input->setPattern("/^[a-zA-Z]+[a-zA-Z0-9]*$/");
365 $txt_input->setNoMatchMessage($lng->txt("sty_msg_characteristic_must_only_include") . " A-Z, a-z, 0-9");
366 $txt_input->setRequired(true);
367 $form->addItem($txt_input);
368
369 // type
370 $all_super_types = ilObjStyleSheet::_getStyleSuperTypes();
371 $types = $all_super_types[$this->super_type];
372 $exp_types = array();
373 foreach ($types as $t) {
375 $exp_types[$t] = $lng->txt("sty_type_" . $t);
376 }
377 }
378 if (count($exp_types) > 1) {
379 $type_input = new ilSelectInputGUI($lng->txt("sty_type"), "type");
380 $type_input->setOptions($exp_types);
381 $type_input->setValue(key($exp_types));
382 $form->addItem($type_input);
383 } elseif (count($exp_types) == 1) {
384 $hid_input = new ilHiddenInputGUI("type");
385 $hid_input->setValue(key($exp_types));
386 $form->addItem($hid_input);
387 }
388
389 $form->setTitle($lng->txt("sty_add_characteristic"));
390 $form->addCommandButton("saveCharacteristic", $lng->txt("save"));
391 $form->addCommandButton("listCharacteristics", $lng->txt("cancel"));
392 $form->setFormAction($ilCtrl->getFormAction($this));
393
394 return $form;
395 }
This class represents a hidden form property in a property form.
This class represents a property form user interface.
This class represents a regular expression input property in a property form.

References $lng, ilObjStyleSheet\_getStyleSuperTypes(), and ilObjStyleSheet\_isExpandable().

+ Here is the call graph for this function:

◆ initTagStyleForm()

ilStyleCharacteristicGUI::initTagStyleForm ( )
protected

Init tag style editing form.

Exceptions

ILIAS\Filesystem\Exception\DirectoryNotFoundException

Exceptions
ilCtrlException
ilFormException

Definition at line 508 of file class.ilStyleCharacteristicGUI.php.

509 {
510 $lng = $this->domain_service->lng();
511 $ilCtrl = $this->gui_service->ctrl();
512
513 $ilCtrl->saveParameter($this, array("mq_id"));
514
515 $form_gui = new ilPropertyFormGUI();
516
517 $avail_pars = $this->object->getAvailableParameters();
518 $groups = $this->object->getStyleParameterGroups();
519
520 // output select lists
521 foreach ($groups as $k => $group) {
522 // filter groups of properties that should only be
523 // displayed with matching tag
524 $filtered_groups = ilObjStyleSheet::_getFilteredGroups();
525 if (isset($filtered_groups[$k]) && !in_array($this->current_tag, $filtered_groups[$k])) {
526 continue;
527 }
528
529 $sh = new ilFormSectionHeaderGUI();
530 $sh->setTitle($lng->txt("sty_" . $k));
531 $form_gui->addItem($sh);
532
533 foreach ($group as $par) {
534 $basepar = explode(".", $par);
535 $basepar = $basepar[0];
536
537 $var = str_replace("-", "_", $basepar);
538
540 case "select":
541 $sel_input = new ilSelectInputGUI($lng->txt("sty_" . $var), $basepar);
542 $options = array("" => "");
543 foreach ($avail_pars[$par] as $p) {
544 $options[$p] = $p;
545 }
546 $sel_input->setOptions($options);
547 $form_gui->addItem($sel_input);
548 break;
549
550 case "text":
551 $text_input = new ilTextInputGUI($lng->txt("sty_" . $var), $basepar);
552 $text_input->setMaxLength(200);
553 $text_input->setSize(20);
554 $form_gui->addItem($text_input);
555 break;
556
557 case "fontsize":
558 $fs_input = new ilFontSizeInputGUI($lng->txt("sty_" . $var), $basepar);
559 $form_gui->addItem($fs_input);
560 break;
561
562 case "numeric_no_perc":
563 case "numeric":
564 $num_input = new ilNumericStyleValueInputGUI($lng->txt("sty_" . $var), $basepar);
565 if (ilObjStyleSheet::_getStyleParameterInputType($par) == "numeric_no_perc") {
566 $num_input->setAllowPercentage(false);
567 }
568 $form_gui->addItem($num_input);
569 break;
570
571 case "percentage":
572 $per_input = new ilNumberInputGUI($lng->txt("sty_" . $var), $basepar);
573 $per_input->setMinValue(0);
574 $per_input->setMaxValue(100);
575 $per_input->setMaxLength(3);
576 $per_input->setSize(3);
577 $form_gui->addItem($per_input);
578 break;
579
580 case "color":
581 $col_input = new ilColorPickerInputGUI($lng->txt("sty_" . $var), $basepar);
582 $col_input->setDefaultColor("");
583 $col_input->setAcceptNamedColors(true);
584 $form_gui->addItem($col_input);
585 break;
586
587 case "trbl_numeric":
588 $num_input = new ilTRBLNumericStyleValueInputGUI($lng->txt("sty_" . $var), $basepar);
589 if (ilObjStyleSheet::_getStyleParameterInputType($par) == "trbl_numeric_no_perc") {
590 $num_input->setAllowPercentage(false);
591 }
592 $form_gui->addItem($num_input);
593 break;
594
595 case "border_width":
596 $bw_input = new ilTRBLBorderWidthInputGUI($lng->txt("sty_" . $var), $basepar);
597 $form_gui->addItem($bw_input);
598 break;
599
600 case "border_style":
601 $bw_input = new ilTRBLBorderStyleInputGUI($lng->txt("sty_" . $var), $basepar);
602 $form_gui->addItem($bw_input);
603 break;
604
605 case "trbl_color":
606 $col_input = new ilTRBLColorPickerInputGUI($lng->txt("sty_" . $var), $basepar);
607 $col_input->setAcceptNamedColors(true);
608 $form_gui->addItem($col_input);
609 break;
610
611 case "background_image":
612 $im_input = new ilBackgroundImageInputGUI($lng->txt("sty_" . $var), $basepar);
613 $images = array();
614 foreach ($this->image_manager->getImages() as $entry) {
615 $images[] = $entry->getFilename();
616 }
617 $im_input->setImages($images);
618 $im_input->setInfo($lng->txt("sty_bg_img_info"));
619 $form_gui->addItem($im_input);
620 break;
621
622 case "background_position":
623 $im_input = new ilBackgroundPositionInputGUI($lng->txt("sty_" . $var), $basepar);
624 $form_gui->addItem($im_input);
625 break;
626 }
627 }
628 }
629
630 // custom parameters
631 $sh = new ilFormSectionHeaderGUI();
632 $sh->setTitle($lng->txt("sty_custom"));
633 $form_gui->addItem($sh);
634
635 // custom parameters
636 $ti = new ilTextInputGUI($lng->txt("sty_custom_par"), "custom_par");
637 $ti->setMaxLength(300);
638 $ti->setSize(80);
639 $ti->setMulti(true);
640 $ti->setInfo($lng->txt("sty_custom_par_info"));
641 $form_gui->addItem($ti);
642
643
644 // save and cancel commands
645 $form_gui->addCommandButton("updateTagStyle", $lng->txt("save_return"));
646 $form_gui->addCommandButton("refreshTagStyle", $lng->txt("save_refresh"));
647
648 $form_gui->setFormAction($ilCtrl->getFormAction($this));
649 return $form_gui;
650 }
This class represents a background image property in a property form.
This class represents a background position in a property form.
Color picker form for selecting color hexcodes using yui library.
This class represents a fint size property in a property form.
This class represents a section header in a property form.
This class represents a number property in a property form.
This class represents a numeric style property in a property form.
static _getStyleParameterInputType(string $par)
This class represents a border style with all/top/right/bottom/left in a property form.
This class represents a border width with all/top/right/bottom/left in a property form.
Color picker form for selecting color hexcodes using yui library (all/top/right/bottom/left)
This class represents a numeric style property with all/top/right/bottom/left in a property form.
This class represents a text property in a property form.

References $lng, ilObjStyleSheet\_getFilteredGroups(), and ilObjStyleSheet\_getStyleParameterInputType().

+ Here is the call graph for this function:

◆ listCharacteristics()

ilStyleCharacteristicGUI::listCharacteristics ( )

Definition at line 127 of file class.ilStyleCharacteristicGUI.php.

127 : void
128 {
129 $lng = $this->domain_service->lng();
130 $ilTabs = $this->gui_service->tabs();
131 $ilCtrl = $this->gui_service->ctrl();
132 $ilToolbar = $this->gui_service->toolbar();
133 $tpl = $this->gui_service->mainTemplate();
134
135 $this->setListSubTabs();
136
137 // output characteristics
138 $chars = $this->object->getCharacteristics();
139
140 $style_type = ($this->super_type != "")
141 ? $this->super_type
142 : "text_block";
143 $ilCtrl->setParameter($this, "style_type", $style_type);
144 $ilTabs->activateSubTab("sty_" . $style_type . "_char");
145
146 // add new style?
147 $all_super_types = ilObjStyleSheet::_getStyleSuperTypes();
148 $subtypes = $all_super_types[$style_type];
149 $expandable = false;
150 foreach ($subtypes as $t) {
152 $expandable = true;
153 }
154 }
155 if ($expandable && $this->access_manager->checkWrite()) {
156 $ilToolbar->addButton(
157 $lng->txt("sty_add_characteristic"),
158 $ilCtrl->getLinkTarget($this, "addCharacteristic")
159 );
160 }
161
162 if ($this->manager->hasCopiedCharacteristics($style_type)) {
163 if ($expandable) {
164 $ilToolbar->addSeparator();
165 }
166 $ilToolbar->addButton(
167 $lng->txt("sty_paste_style_classes"),
168 $ilCtrl->getLinkTarget($this, "pasteCharacteristicsOverview")
169 );
170 }
171
172 $table_gui = $this->gui_service->characteristic()->CharacteristicTableGUI(
173 $this,
174 "edit",
176 $this->object,
177 $this->manager,
178 $this->access_manager
179 );
180
181 $tpl->setContent($table_gui->getHTML());
182 }

References $lng, ilObjStyleSheet\_getStyleSuperTypes(), and ilObjStyleSheet\_isExpandable().

+ Here is the call graph for this function:

◆ outputTagStyleEditScreen()

ilStyleCharacteristicGUI::outputTagStyleEditScreen ( ilPropertyFormGUI  $form)
protected

Definition at line 697 of file class.ilStyleCharacteristicGUI.php.

697 : void
698 {
699 $tpl = $this->gui_service->mainTemplate();
700
701 // set style sheet
702 $tpl->setCurrentBlock("ContentStyle");
703 $tpl->setVariable(
704 "LOCATION_CONTENT_STYLESHEET",
706 );
707
708 $ts_tpl = new ilTemplate("tpl.style_tag_edit.html", true, true, "components/ILIAS/Style/Content");
709
710 $ts_tpl->setVariable(
711 "EXAMPLE",
712 ilObjStyleSheetGUI::getStyleExampleHTML($this->style_type, $this->current_class)
713 );
714
715 $ts_tpl->setVariable(
716 "FORM",
717 $form->getHTML()
718 );
719
720 $this->setTitle();
721
722 $tpl->setContent($ts_tpl->get());
723 }
static getStyleExampleHTML(string $a_type, string $a_class)
Get style example HTML.
static getContentStylePath(int $a_style_id, bool $add_random=true, bool $add_token=true)
get content style path static (to avoid full reading)
special template class to simplify handling of ITX/PEAR

References ilObjStyleSheet\getContentStylePath(), ilPropertyFormGUI\getHTML(), ilObjStyleSheetGUI\getStyleExampleHTML(), and ILIAS\Repository\object().

+ Here is the call graph for this function:

◆ pasteCharacteristics()

ilStyleCharacteristicGUI::pasteCharacteristics ( )

Definition at line 1300 of file class.ilStyleCharacteristicGUI.php.

1300 : void
1301 {
1302 $ilCtrl = $this->gui_service->ctrl();
1303 $lng = $this->domain_service->lng();
1304
1305 $titles = $this->request->getTitles();
1306 $conflict_action = $this->request->getConflictAction();
1307 if (count($titles) > 0) {
1308 foreach ($titles as $from_char => $to_title) {
1309 $fc = explode(".", $from_char);
1310
1311 if ($conflict_action[$from_char] == "overwrite" ||
1312 !$this->object->characteristicExists($to_title, $fc[0])) {
1313 // @todo check this
1314 $this->manager->copyCharacteristicFromSource(
1315 $this->request->getFromStyleId(),
1316 $fc[0],
1317 $fc[2],
1318 $fc[2],
1319 ["en" => $to_title]
1320 );
1321 }
1322 }
1323 ilObjStyleSheet::_writeUpToDate($this->object->getId(), false);
1324 $this->manager->clearCopyCharacteristics();
1325 $this->main_tpl->setOnScreenMessage('success', $lng->txt("sty_style_classes_copied"), true);
1326 }
1327
1328 $ilCtrl->redirect($this, "listCharacteristics");
1329 }
static _writeUpToDate(int $a_id, bool $a_up_to_date)

References $lng, ilObjStyleSheet\_writeUpToDate(), and ILIAS\Repository\object().

+ Here is the call graph for this function:

◆ pasteCharacteristicsFromOtherStyle()

ilStyleCharacteristicGUI::pasteCharacteristicsFromOtherStyle ( )
Exceptions
Content

ContentStyleNoPermissionException

Exceptions
ilCtrlException

Definition at line 1244 of file class.ilStyleCharacteristicGUI.php.

1244 : void
1245 {
1246 $request = $this->gui_service->http()->request();
1247 $form = $this->getPasteFromOtherStyleForm();
1248 $tpl = $this->gui_service->mainTemplate();
1249 $ctrl = $this->gui_service->ctrl();
1250 $lng = $this->domain_service->lng();
1251 $ui = $this->gui_service->ui();
1253
1254 if ($request->getMethod() == "POST") {
1255 $form = $form->withRequest($request);
1256 $data = $form->getData();
1257 if (is_null($data)) {
1258 $tpl->setContent($ui->renderer()->render($form));
1259 return;
1260 }
1261 foreach ($this->manager->getCopyCharacteristics() as $char) {
1262 if (is_array($data["sec"][$char])) {
1263 $d = $data["sec"][$char];
1264 $char_parts = explode(".", $char);
1265
1266 if (isset($d[1])) {
1267 $d = $d[1];
1268 }
1269
1270 // overwrite existing class
1271 if (isset($d["overwrite_class"])) {
1274 $char_parts[0],
1275 $char_parts[2],
1276 $d["overwrite_class"],
1277 []
1278 );
1279 } elseif (isset($d["char_" . $char])) {
1280 $titles = [];
1281 foreach ($lng->getInstalledLanguages() as $l) {
1282 $titles[$l] = $d["title_" . $char . "_" . $l];
1283 }
1284 $new_char = $d["char_" . $char];
1287 $char_parts[0],
1288 $char_parts[2],
1289 $new_char,
1290 $titles
1291 );
1292 }
1293 }
1294 }
1295 $this->main_tpl->setOnScreenMessage('info', $lng->txt("msg_obj_modified"), true);
1296 }
1297 $ctrl->redirect($this, "listCharacteristics");
1298 }
copyCharacteristicFromSource(int $source_style_id, string $source_style_type, string $source_char, string $new_char, array $new_titles)
Copy characteristic.
Content StandardGUIRequest $request
getPasteFromOtherStyleForm()
Init past from other style form.

References Vendor\Package\$d, $data, and $lng.

◆ pasteCharacteristicsOverview()

ilStyleCharacteristicGUI::pasteCharacteristicsOverview ( )

Definition at line 1071 of file class.ilStyleCharacteristicGUI.php.

1071 : void
1072 {
1073 $tpl = $this->gui_service->mainTemplate();
1074 $ilTabs = $this->gui_service->tabs();
1075 $ui = $this->gui_service->ui();
1076
1077 $ilTabs->clearTargets();
1078
1079 if ($this->manager->getCopyCharacteristicStyleId() ==
1080 $this->object->getId()) {
1081 $form = $this->getPasteWithinStyleForm();
1082 } else {
1083 $form = $this->getPasteFromOtherStyleForm();
1084 }
1085 $tpl->setContent($ui->renderer()->render($form));
1086 }
getPasteWithinStyleForm()
Init past within style form.

◆ pasteCharacteristicsWithinStyle()

ilStyleCharacteristicGUI::pasteCharacteristicsWithinStyle ( )

Definition at line 1200 of file class.ilStyleCharacteristicGUI.php.

1200 : void
1201 {
1202 $ui = $this->gui_service->ui();
1203 $request = $this->gui_service->http()->request();
1204 $form = $this->getPasteWithinStyleForm();
1205 $tpl = $this->gui_service->mainTemplate();
1206 $ctrl = $this->gui_service->ctrl();
1207 $lng = $this->domain_service->lng();
1209
1210 if ($request->getMethod() == "POST") {
1211 $form = $form->withRequest($request);
1212 $data = $form->getData();
1213 if (is_null($data)) {
1214 $tpl->setContent($ui->renderer()->render($form));
1215 return;
1216 }
1217 foreach ($this->manager->getCopyCharacteristics() as $char) {
1218 if (is_array($data[$char])) {
1219 $d = $data[$char];
1220 $titles = [];
1221 foreach ($lng->getInstalledLanguages() as $l) {
1222 $titles[$l] = $d["title_" . $char . "_" . $l];
1223 }
1224 $new_char = $d["char_" . $char];
1225 $char_parts = explode(".", $char);
1227 $this->manager->getCopyCharacteristicStyleId(),
1228 $char_parts[0],
1229 $char_parts[2],
1230 $new_char,
1231 $titles
1232 );
1233 }
1234 }
1235 $this->main_tpl->setOnScreenMessage('info', $lng->txt("msg_obj_modified"), true);
1236 }
1237 $ctrl->redirect($this, "listCharacteristics");
1238 }

References Vendor\Package\$d, $data, and $lng.

◆ refreshTagStyle()

ilStyleCharacteristicGUI::refreshTagStyle ( )
protected

Definition at line 732 of file class.ilStyleCharacteristicGUI.php.

732 : void
733 {
734 $ilCtrl = $this->gui_service->ctrl();
735
736 $form = $this->initTagStyleForm();
737
738 if ($form->checkInput()) {
739 $this->saveTagStyle($form);
740 $ilCtrl->redirect($this, "editTagStyle");
741 } else {
742 $form->setValuesByPost();
743 $this->outputTagStyleEditScreen($form);
744 }
745 }

◆ removeOutdated()

ilStyleCharacteristicGUI::removeOutdated ( )
protected

Definition at line 1009 of file class.ilStyleCharacteristicGUI.php.

1009 : void
1010 {
1011 $lng = $this->domain_service->lng();
1012 $ctrl = $this->gui_service->ctrl();
1013 $chars = $this->request->getCharacteristics();
1014
1015 if (count($chars) > 0) {
1016 foreach ($chars as $c) {
1017 $c_parts = explode(".", $c);
1018 if (!ilObjStyleSheet::isCoreStyle($c_parts[0], $c_parts[2])) {
1019 $this->manager->saveOutdated(
1020 $c_parts[0],
1021 $c_parts[2],
1022 false
1023 );
1024 $this->main_tpl->setOnScreenMessage('info', $lng->txt("msg_obj_modified"), true);
1025 }
1026 }
1027 } else {
1028 $this->manager->saveOutdated(
1029 $this->style_type,
1030 $this->requested_char,
1031 false
1032 );
1033 $this->main_tpl->setOnScreenMessage('info', $lng->txt("msg_obj_modified"), true);
1034 }
1035
1036 $ctrl->redirect($this, "listCharacteristics");
1037 }
static isCoreStyle(string $a_type, string $a_class)

References $c, $lng, and ilObjStyleSheet\isCoreStyle().

+ Here is the call graph for this function:

◆ saveCharacteristic()

ilStyleCharacteristicGUI::saveCharacteristic ( )

Definition at line 213 of file class.ilStyleCharacteristicGUI.php.

213 : void
214 {
215 $ilCtrl = $this->gui_service->ctrl();
216 $tpl = $this->gui_service->mainTemplate();
217 $lng = $this->domain_service->lng();
218
219 $form = $this->initCharacteristicForm();
220
221 if ($form->checkInput()) {
222 $new_characteristic = $form->getInput("new_characteristic");
223 $type = $form->getInput("type");
224 if ($this->object->characteristicExists($new_characteristic, $this->style_type)) {
225 $char_input = $form->getItemByPostVar("new_characteristic");
226 $char_input->setAlert($lng->txt("sty_characteristic_already_exists"));
227 } else {
228 $this->object->addCharacteristic($type, $new_characteristic);
229 $this->main_tpl->setOnScreenMessage('info', $lng->txt("sty_added_characteristic"), true);
230 $ilCtrl->setParameter(
231 $this,
232 "tag",
233 ilObjStyleSheet::_determineTag($type) . "." . $new_characteristic
234 );
235 $ilCtrl->setParameter($this, "style_type", $type);
236 $ilCtrl->redirectByClass("ilstylecharacteristicgui", "editTagStyle");
237 }
238 }
239 $form->setValuesByPost();
240 $tpl->setContent($form->getHTML());
241 }
static _determineTag(string $a_type)

References $lng, ilObjStyleSheet\_determineTag(), and ILIAS\Repository\object().

+ Here is the call graph for this function:

◆ saveStatus()

ilStyleCharacteristicGUI::saveStatus ( )

Save hide status for characteristics.

Exceptions
Content

ContentStyleNoPermissionException

Exceptions
ilCtrlException

Definition at line 941 of file class.ilStyleCharacteristicGUI.php.

941 : void
942 {
943 $ilCtrl = $this->gui_service->ctrl();
944 $lng = $this->domain_service->lng();
945
946 $all_chars = $this->request->getAllCharacteristics();
947 $hidden = $this->request->getHidden();
948 $order = $this->request->getOrder();
949
950 // save hide status
951 foreach ($all_chars as $char) {
952 $ca = explode(".", $char);
953 $this->manager->saveHidden(
954 $ca[0],
955 $ca[2],
956 (in_array($char, $hidden))
957 );
958 }
959
960 // save order
961 if (count($order) > 0) {
962 $order_by_type = [];
963 foreach ($order as $char => $order_nr) {
964 $ca = explode(".", $char);
965 $order_by_type[$ca[0]][$ca[2]] = $order_nr;
966 }
967 foreach ($order_by_type as $type => $order_nrs) {
968 $this->manager->saveOrderNrs(
969 $type,
970 $order_nrs
971 );
972 }
973 }
974
975 $this->main_tpl->setOnScreenMessage('info', $lng->txt("msg_obj_modified"), true);
976 $ilCtrl->redirect($this, "listCharacteristics");
977 }

References $lng.

◆ saveTagStyle()

ilStyleCharacteristicGUI::saveTagStyle ( ilPropertyFormGUI  $form)
protected

Definition at line 761 of file class.ilStyleCharacteristicGUI.php.

761 : void
762 {
763 $avail_pars = ilObjStyleSheet::_getStyleParameters($this->current_tag);
764 foreach ($avail_pars as $par => $v) {
765 $var = str_replace("-", "_", $par);
766 $basepar_arr = explode(".", $par);
767 $basepar = $basepar_arr[0];
768 if (($basepar_arr[1] ?? "") != "" && $basepar_arr[1] != $this->current_tag) {
769 continue;
770 }
771
772 switch ($v["input"]) {
773 case "fontsize":
774 case "numeric_no_perc":
775 case "numeric":
776 case "background_image":
777 case "background_position":
778 $in = $form->getItemByPostVar($basepar);
779 $this->writeStylePar($basepar, (string) $in->getValue());
780 break;
781
782 case "color":
783 $color = trim($form->getInput($basepar));
784 if ($color != "" && trim(substr($color, 0, 1)) != "!") {
785 $color = "#" . $color;
786 }
787 $this->writeStylePar($basepar, $color);
788 break;
789
790 case "trbl_numeric":
791 case "border_width":
792 case "border_style":
793 $in = $form->getItemByPostVar($basepar);
794 $this->writeStylePar($v["subpar"][0], (string) $in->getAllValue());
795 $this->writeStylePar($v["subpar"][1], (string) $in->getTopValue());
796 $this->writeStylePar($v["subpar"][2], (string) $in->getRightValue());
797 $this->writeStylePar($v["subpar"][3], (string) $in->getBottomValue());
798 $this->writeStylePar($v["subpar"][4], (string) $in->getLeftValue());
799 break;
800
801 case "trbl_color":
802 $in = $form->getItemByPostVar($basepar);
803 $tblr_p = array(0 => "getAllValue", 1 => "getTopValue", 2 => "getRightValue",
804 3 => "getBottomValue", 4 => "getLeftValue");
805 foreach ($tblr_p as $k => $func) {
806 $val = trim($in->$func());
807 $val = (($in->getAcceptNamedColors() && substr($val, 0, 1) == "!")
808 || $val == "")
809 ? $val
810 : "#" . $val;
811 $this->writeStylePar($v["subpar"][$k], $val);
812 }
813 break;
814
815 default:
816 $this->writeStylePar($basepar, (string) $form->getInput($basepar));
817 break;
818 }
819 }
820
821 // write custom parameter
822 $this->object->deleteCustomStylePars(
823 $this->current_tag,
824 $this->current_class,
825 $this->style_type,
826 $this->mq_id
827 );
828 $custom_par = $form->getInput("custom_par");
829 foreach ($custom_par as $cpar) {
830 $par_arr = explode(":", $cpar);
831 if (count($par_arr) == 2) {
832 $par = trim($par_arr[0]);
833 $val = trim(str_replace(";", "", $par_arr[1]));
834 $this->writeStylePar($par, $val, true);
835 }
836 }
837
838 $this->object->update();
839 }
getInput(string $a_post_var, bool $ensureValidation=true)
Returns the input of an item, if item provides getInput method and as fallback the value of the HTTP-...
writeStylePar(string $par, string $value, bool $a_custom=false)
Write style parameter.

References ilObjStyleSheet\_getStyleParameters(), ilPropertyFormGUI\getInput(), and ilPropertyFormGUI\getItemByPostVar().

+ Here is the call graph for this function:

◆ saveTagTitles()

ilStyleCharacteristicGUI::saveTagTitles ( )

Definition at line 906 of file class.ilStyleCharacteristicGUI.php.

906 : void
907 {
908 $request = $this->gui_service->http()->request();
909 $form = $this->getTagTitlesForm();
910 $lng = $this->domain_service->lng();
911 $ctrl = $this->gui_service->ctrl();
913
914 if ($request->getMethod() == "POST") {
915 $form = $form->withRequest($request);
916 $data = $form->getData();
917 if (isset($data["sec"])) {
918 $d = $data["sec"];
919 $titles = [];
920 foreach ($lng->getInstalledLanguages() as $l) {
921 $titles[$l] = $d["title_" . $l];
922 }
923
925 $this->style_type,
926 $this->current_base_class,
927 $titles
928 );
929
930 $this->main_tpl->setOnScreenMessage('info', $lng->txt("msg_obj_modified"), true);
931 }
932 }
933 $ctrl->redirect($this, "editTagTitles");
934 }
saveTitles(string $type, string $characteristic, array $titles)
Save titles for characteristic.

References Vendor\Package\$d, $data, and $lng.

◆ setListSubTabs()

ilStyleCharacteristicGUI::setListSubTabs ( )

Definition at line 184 of file class.ilStyleCharacteristicGUI.php.

184 : void
185 {
186 $lng = $this->domain_service->lng();
187 $tabs = $this->gui_service->tabs();
188 $ctrl = $this->gui_service->ctrl();
189
191
192 foreach ($types as $super_type => $t) {
193 // text block characteristics
194 $ctrl->setParameter($this, "style_type", $super_type);
195 $tabs->addSubTab(
196 "sty_" . $super_type . "_char",
197 $lng->txt("sty_" . $super_type . "_char"),
198 $ctrl->getLinkTarget($this, "listCharacteristics")
199 );
200 }
201
202 $ctrl->setParameter($this, "style_type", $this->style_type);
203 }

References $lng, and ilObjStyleSheet\_getStyleSuperTypes().

+ Here is the call graph for this function:

◆ setOutdated()

ilStyleCharacteristicGUI::setOutdated ( )
protected

Definition at line 979 of file class.ilStyleCharacteristicGUI.php.

979 : void
980 {
981 $lng = $this->domain_service->lng();
982 $ctrl = $this->gui_service->ctrl();
983
984 $chars = $this->request->getCharacteristics();
985 if (count($chars) > 0) {
986 foreach ($chars as $c) {
987 $c_parts = explode(".", $c);
988 if (!ilObjStyleSheet::isCoreStyle($c_parts[0], $c_parts[2])) {
989 $this->manager->saveOutdated(
990 $c_parts[0],
991 $c_parts[2],
992 true
993 );
994 $this->main_tpl->setOnScreenMessage('info', $lng->txt("msg_obj_modified"), true);
995 }
996 }
997 } else {
998 $this->manager->saveOutdated(
999 $this->style_type,
1000 $this->requested_char,
1001 true
1002 );
1003 $this->main_tpl->setOnScreenMessage('info', $lng->txt("msg_obj_modified"), true);
1004 }
1005
1006 $ctrl->redirect($this, "listCharacteristics");
1007 }

References $c, $lng, and ilObjStyleSheet\isCoreStyle().

+ Here is the call graph for this function:

◆ setParameterSubTabs()

ilStyleCharacteristicGUI::setParameterSubTabs ( )
protected

Definition at line 428 of file class.ilStyleCharacteristicGUI.php.

428 : void
429 {
430 $tabs = $this->gui_service->tabs();
431 $ctrl = $this->gui_service->ctrl();
432 $lng = $this->domain_service->lng();
433
434 $pc = $this->object->_getPseudoClasses($this->current_tag);
435 if (count($pc) > 0) {
436 // style classes
437 $ctrl->setParameter($this, "tag", $this->current_tag . "." . $this->current_base_class);
438 $tabs->addSubTab(
439 "sty_tag_normal",
440 $lng->txt("sty_tag_normal"),
441 $ctrl->getLinkTarget($this, "editTagStyle")
442 );
443 if ($this->current_pseudo_class == "") {
444 $tabs->activateSubTab("sty_tag_normal");
445 }
446
447 foreach ($pc as $p) {
448 // style classes
449 $ctrl->setParameter(
450 $this,
451 "tag",
452 $this->current_tag . "." . $this->current_base_class . ":" . $p
453 );
454 $tabs->addSubTab(
455 "sty_tag_" . $p,
456 ":" . $p,
457 $ctrl->getLinkTarget($this, "editTagStyle")
458 );
459 if ($this->current_pseudo_class == $p) {
460 $tabs->activateSubTab("sty_tag_" . $p);
461 }
462 }
463 $ctrl->setParameter($this, "tag", $this->current_tag . "." . $this->current_base_class);
464 }
465 $ctrl->setParameter($this, "tag", $this->request->getTag());
466 }

References $lng.

◆ setTabs()

ilStyleCharacteristicGUI::setTabs ( )
protected

Definition at line 397 of file class.ilStyleCharacteristicGUI.php.

397 : void
398 {
399 $tabs = $this->gui_service->tabs();
400 $ctrl = $this->gui_service->ctrl();
401 $lng = $this->domain_service->lng();
402
403 $tabs->clearTargets();
404
405 // back to upper context
406 $tabs->setBackTarget(
407 $lng->txt("back"),
408 $ctrl->getLinkTargetByClass("ilobjstylesheetgui", "edit")
409 );
410
411 // parameters
412 $ctrl->setParameter($this, "tag", $this->current_tag . "." . $this->current_base_class);
413 $tabs->addTab(
414 "parameters",
415 $lng->txt("sty_parameters"),
416 $ctrl->getLinkTarget($this, "editTagStyle")
417 );
418
419 // titles
420 $tabs->addTab(
421 "titles",
422 $lng->txt("sty_titles"),
423 $ctrl->getLinkTarget($this, "editTagTitles")
424 );
425 $ctrl->setParameter($this, "tag", $this->request->getTag());
426 }

References $lng.

◆ setTitle()

ilStyleCharacteristicGUI::setTitle ( )
protected

Definition at line 725 of file class.ilStyleCharacteristicGUI.php.

725 : void
726 {
727 $tpl = $this->gui_service->mainTemplate();
728 $lng = $this->domain_service->lng();
729 $tpl->setTitle($this->current_class . " (" . $lng->txt("sty_type_" . $this->style_type) . ")");
730 }

References $lng.

◆ switchMQuery()

ilStyleCharacteristicGUI::switchMQuery ( )

Switch media query.

Definition at line 1334 of file class.ilStyleCharacteristicGUI.php.

1334 : void
1335 {
1336 $ctrl = $this->gui_service->ctrl();
1337 $ctrl->setParameter($this, "mq_id", $this->request->getMediaQueryId());
1338 $ctrl->redirectByClass("ilstylecharacteristicgui", "editTagStyle");
1339 }

◆ updateTagStyle()

ilStyleCharacteristicGUI::updateTagStyle ( )
protected

Definition at line 747 of file class.ilStyleCharacteristicGUI.php.

747 : void
748 {
749 $ilCtrl = $this->gui_service->ctrl();
750
751 $form = $this->initTagStyleForm();
752 if ($form->checkInput()) {
753 $this->saveTagStyle($form);
754 $ilCtrl->redirectByClass("ilobjstylesheetgui", "edit");
755 } else {
756 $form->setValuesByPost();
757 $this->outputTagStyleEditScreen($form);
758 }
759 }

◆ writeStylePar()

ilStyleCharacteristicGUI::writeStylePar ( string  $par,
string  $value,
bool  $a_custom = false 
)
protected

Write style parameter.

Definition at line 844 of file class.ilStyleCharacteristicGUI.php.

844 : void
845 {
846 if ($this->style_type == "") {
847 return;
848 }
849 $this->manager->replaceParameter(
850 $this->current_tag,
851 $this->current_class,
852 $par,
853 $value,
854 $this->style_type,
855 $this->mq_id,
856 $a_custom
857 );
858 }

Field Documentation

◆ $access_manager

Access StyleAccessManager ilStyleCharacteristicGUI::$access_manager
protected

Definition at line 44 of file class.ilStyleCharacteristicGUI.php.

Referenced by __construct().

◆ $current_base_class

string ilStyleCharacteristicGUI::$current_base_class
protected

Definition at line 39 of file class.ilStyleCharacteristicGUI.php.

◆ $current_class

string ilStyleCharacteristicGUI::$current_class
protected

Definition at line 38 of file class.ilStyleCharacteristicGUI.php.

◆ $current_pseudo_class

string ilStyleCharacteristicGUI::$current_pseudo_class
protected

Definition at line 40 of file class.ilStyleCharacteristicGUI.php.

◆ $current_tag

string ilStyleCharacteristicGUI::$current_tag
protected

Definition at line 37 of file class.ilStyleCharacteristicGUI.php.

◆ $domain_service

Content InternalDomainService ilStyleCharacteristicGUI::$domain_service
protected

Definition at line 47 of file class.ilStyleCharacteristicGUI.php.

Referenced by __construct().

◆ $gui_service

Content InternalGUIService ilStyleCharacteristicGUI::$gui_service
protected

Definition at line 46 of file class.ilStyleCharacteristicGUI.php.

Referenced by __construct().

◆ $image_manager

Content ImageManager ilStyleCharacteristicGUI::$image_manager
protected

Definition at line 45 of file class.ilStyleCharacteristicGUI.php.

Referenced by __construct().

◆ $main_tpl

ilGlobalTemplateInterface ilStyleCharacteristicGUI::$main_tpl
private

Definition at line 48 of file class.ilStyleCharacteristicGUI.php.

◆ $manager

Content CharacteristicManager ilStyleCharacteristicGUI::$manager
protected

Definition at line 43 of file class.ilStyleCharacteristicGUI.php.

Referenced by __construct().

◆ $mq_id

int ilStyleCharacteristicGUI::$mq_id
protected

Definition at line 42 of file class.ilStyleCharacteristicGUI.php.

◆ $object

ilObjStyleSheet ilStyleCharacteristicGUI::$object
protected

Definition at line 35 of file class.ilStyleCharacteristicGUI.php.

◆ $request

Content StandardGUIRequest ilStyleCharacteristicGUI::$request
protected

Definition at line 34 of file class.ilStyleCharacteristicGUI.php.

◆ $requested_char

string ilStyleCharacteristicGUI::$requested_char
protected

Definition at line 33 of file class.ilStyleCharacteristicGUI.php.

◆ $style_type

string ilStyleCharacteristicGUI::$style_type
protected

Definition at line 41 of file class.ilStyleCharacteristicGUI.php.

◆ $super_type

string ilStyleCharacteristicGUI::$super_type
protected

Definition at line 36 of file class.ilStyleCharacteristicGUI.php.

Referenced by __construct().


The documentation for this class was generated from the following file: