ILIAS  trunk Revision v11.0_alpha-1744-gb0451eebef4
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
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.

References $access_manager, $DIC, $domain_service, $gui_service, $image_manager, $manager, and $super_type.

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  }
Content InternalGUIService $gui_service
standardRequest(?array $passed_query_params=null, ?array $passed_post_data=null)
Content CharacteristicManager $manager
Access StyleAccessManager $access_manager
global $DIC
Definition: shib_login.php:22
Content InternalDomainService $domain_service

Member Function Documentation

◆ addCharacteristic()

ilStyleCharacteristicGUI::addCharacteristic ( )

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

References initCharacteristicForm().

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.
+ Here is the call graph for this function:

◆ cancelCharacteristicDeletion()

ilStyleCharacteristicGUI::cancelCharacteristicDeletion ( )

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

References $lng.

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

◆ copyCharacteristics()

ilStyleCharacteristicGUI::copyCharacteristics ( )

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

References $lng.

1039  : void
1040  {
1041  $ilCtrl = $this->gui_service->ctrl();
1042  $lng = $this->domain_service->lng();
1043 
1044  $chars = $this->request->getCharacteristics();
1045  if (count($chars) == 0) {
1046  $this->main_tpl->setOnScreenMessage('failure', $lng->txt("no_checkbox"), true);
1047  } else {
1048  $this->manager->setCopyCharacteristics(
1049  $this->style_type,
1050  $chars
1051  );
1052  $this->main_tpl->setOnScreenMessage('success', $lng->txt("sty_copied_please_select_target"), true);
1053  }
1054  $ilCtrl->redirect($this, "listCharacteristics");
1055  }
global $lng
Definition: privfeed.php:31

◆ deleteCharacteristic()

ilStyleCharacteristicGUI::deleteCharacteristic ( )

Delete one or multiple style characteristic.

Exceptions
Content

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.

References $lng, ilObjStyleSheet\_getCoreStyles(), and deleteCoreCharMessage().

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  }
global $lng
Definition: privfeed.php:31
+ Here is the call graph for this function:

◆ deleteCoreCharMessage()

ilStyleCharacteristicGUI::deleteCoreCharMessage ( )

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

References $lng, and ilObjStyleSheet\_getCoreStyles().

Referenced by deleteCharacteristicConfirmation().

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  }
global $lng
Definition: privfeed.php:31
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ editTagStyle()

ilStyleCharacteristicGUI::editTagStyle ( )
protected

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

References $lng, getValues(), initTagStyleForm(), outputTagStyleEditScreen(), setParameterSubTabs(), and setTabs().

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.
initTagStyleForm()
Init tag style editing form.
getValues(ilPropertyFormGUI $form)
FORM: Get current values from persistent object.
global $lng
Definition: privfeed.php:31
outputTagStyleEditScreen(ilPropertyFormGUI $form)
+ Here is the call graph for this function:

◆ editTagTitles()

ilStyleCharacteristicGUI::editTagTitles ( )
protected

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

References getTagTitlesForm(), setTabs(), and setTitle().

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  }
+ Here is the call graph for this function:

◆ 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.

Referenced by getValues().

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  }
+ Here is the caller graph for this function:

◆ getCharacterTitleFormFields()

ilStyleCharacteristicGUI::getCharacterTitleFormFields ( string  $char)
protected

Get character title form section.

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

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

Referenced by getPasteFromOtherStyleForm(), and getPasteWithinStyleForm().

1150  : array
1151  {
1152  $ui = $this->gui_service->ui();
1153  $f = $ui->factory();
1154  $refinery = $this->domain_service->refinery();
1155  $lng = $this->domain_service->lng();
1157  $style_obj = $this->object;
1158 
1159 
1160  $lng->loadLanguageModule("meta");
1161 
1162  $char_regexp_constraint = $refinery->custom()->constraint(function ($v) use ($lng) {
1163  return (bool) preg_match("/^[a-zA-Z]+[a-zA-Z0-9]*$/", $v);
1164  }, $lng->txt("sty_msg_characteristic_must_only_include") . " A-Z, a-z, 0-9");
1165 
1166  $char_exists_constraint = $refinery->custom()->constraint(function ($v) use ($style_obj, $style_type) {
1167  return !$style_obj->characteristicExists($v, $style_type);
1168  }, $lng->txt("sty_characteristic_already_exists"));
1169 
1170  $fields = [];
1171  $fields["char_" . $char] = $f->input()->field()->text($lng->txt("sty_class_name"))
1172  ->withRequired(true)
1173  ->withAdditionalTransformation($char_regexp_constraint)
1174  ->withAdditionalTransformation($char_exists_constraint);
1175 
1176  foreach ($lng->getInstalledLanguages() as $l) {
1177  $fields["title_" . $char . "_" . $l] = $f->input()->field()->text($lng->txt("title") .
1178  " - " . $lng->txt("meta_l_" . $l))
1179  ->withRequired(false)
1180  ->withValue($titles[$l] ?? "");
1181  }
1182 
1183  return $fields;
1184  }
global $lng
Definition: privfeed.php:31
+ Here is the caller graph for this function:

◆ getPasteFromOtherStyleForm()

ilStyleCharacteristicGUI::getPasteFromOtherStyleForm ( )

Init past from other style form.

Exceptions
ilCtrlException

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

References $c, Vendor\Package\$f, $lng, and getCharacterTitleFormFields().

Referenced by pasteCharacteristicsFromOtherStyle(), and pasteCharacteristicsOverview().

1102  : Standard
1103  {
1104  $ui = $this->gui_service->ui();
1105  $lng = $this->domain_service->lng();
1106  $f = $ui->factory();
1107  $ctrl = $this->gui_service->ctrl();
1108 
1109  $sections = [];
1110  $fields = [];
1111  foreach ($this->manager->getCopyCharacteristics() as $char) {
1112  $char_text = explode(".", $char);
1113  $options = [];
1114  foreach ($this->manager->getByType($char_text[0]) as $c) {
1115  $options[$c->getCharacteristic()] = $c->getCharacteristic();
1116  }
1117  $group1 = $f->input()->field()->group(
1118  $this->getCharacterTitleFormFields($char),
1119  $lng->txt("sty_create_new_class")
1120  );
1121  $group2 = $f->input()->field()->group(
1122  [
1123  "overwrite_class" => $f->input()->field()->select(
1124  $lng->txt("sty_class"),
1125  $options
1126  )->withRequired(true)
1127  ],
1128  $lng->txt("sty_overwrite_existing_class")
1129  );
1130  $fields[$char] = $f->input()->field()->switchableGroup(
1131  [
1132  "new_" . $char => $group1,
1133  "overwrite_" . $char => $group2
1134  ],
1135  $char_text[2]
1136  )->withValue("new_" . $char);
1137  }
1138  $sections["sec"] = $f->input()->field()->section(
1139  $fields,
1140  $lng->txt("sty_paste_chars")
1141  );
1142 
1143  $form_action = $ctrl->getLinkTarget($this, "pasteCharacteristicsFromOtherStyle");
1144  return $f->input()->container()->form()->standard($form_action, $sections);
1145  }
$c
Definition: deliver.php:25
global $lng
Definition: privfeed.php:31
getCharacterTitleFormFields(string $char)
Get character title form section.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getPasteWithinStyleForm()

ilStyleCharacteristicGUI::getPasteWithinStyleForm ( )

Init past within style form.

Exceptions
ilCtrlException

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

References Vendor\Package\$f, and getCharacterTitleFormFields().

Referenced by pasteCharacteristicsOverview(), and pasteCharacteristicsWithinStyle().

1078  : Standard
1079  {
1080  $ui = $this->gui_service->ui();
1081  $f = $ui->factory();
1082  $ctrl = $this->gui_service->ctrl();
1083 
1084  $sections = [];
1085  foreach ($this->manager->getCopyCharacteristics() as $char) {
1086  // section
1087  $char_text = explode(".", $char);
1088  $sections[$char] = $f->input()->field()->section(
1089  $this->getCharacterTitleFormFields($char),
1090  $char_text[2]
1091  );
1092  }
1093 
1094  $form_action = $ctrl->getLinkTarget($this, "pasteCharacteristicsWithinStyle");
1095  return $f->input()->container()->form()->standard($form_action, $sections);
1096  }
getCharacterTitleFormFields(string $char)
Get character title form section.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getTagTitlesForm()

ilStyleCharacteristicGUI::getTagTitlesForm ( )
protected
Exceptions
ilCtrlException

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

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

Referenced by editTagTitles(), and saveTagTitles().

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  }
global $lng
Definition: privfeed.php:31
+ Here is the caller graph for this function:

◆ getValues()

ilStyleCharacteristicGUI::getValues ( ilPropertyFormGUI  $form)
protected

FORM: Get current values from persistent object.

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

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

Referenced by editTagStyle().

655  : void
656  {
657  $cur_parameters = $this->extractParametersOfTag();
658  $parameters = ilObjStyleSheet::_getStyleParameters();
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  }
getItemByPostVar(string $a_post_var)
static _getStyleParameters(string $a_tag="")
$c
Definition: deliver.php:25
extractParametersOfTag(bool $a_custom=false)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ initCharacteristicForm()

ilStyleCharacteristicGUI::initCharacteristicForm ( )

Init tag style editing form.

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

References $lng, $super_type, ilObjStyleSheet\_getStyleSuperTypes(), ilObjStyleSheet\_isExpandable(), ilSelectInputGUI\setOptions(), and ilRegExpInputGUI\setPattern().

Referenced by addCharacteristic(), and saveCharacteristic().

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  }
static _isExpandable(string $a_type)
This class represents a selection list property in a property form.
setPattern(string $pattern)
setOptions(array $a_options)
This class represents a hidden form property in a property form.
This class represents a regular expression input property in a property form.
global $lng
Definition: privfeed.php:31
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ initTagStyleForm()

ilStyleCharacteristicGUI::initTagStyleForm ( )
protected

Init tag style editing form.

Exceptions

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

References $lng, ilObjStyleSheet\_getFilteredGroups(), ilObjStyleSheet\_getStyleParameterInputType(), ilTRBLColorPickerInputGUI\setAcceptNamedColors(), ilNumericStyleValueInputGUI\setAllowPercentage(), ilTRBLNumericStyleValueInputGUI\setAllowPercentage(), ilColorPickerInputGUI\setDefaultColor(), ilBackgroundImageInputGUI\setImages(), ilNumberInputGUI\setMinValue(), and ilSelectInputGUI\setOptions().

Referenced by editTagStyle(), refreshTagStyle(), and updateTagStyle().

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 selection list property in a property form.
Color picker form for selecting color hexcodes using yui library.
setDefaultColor(string $a_defaultcolor)
setOptions(array $a_options)
Color picker form for selecting color hexcodes using yui library (all/top/right/bottom/left) ...
This class represents a numeric style property in a property form.
This class represents a border style with all/top/right/bottom/left in a property form...
This class represents a number property in a property form.
This class represents a border width with all/top/right/bottom/left in a property form...
setAcceptNamedColors(bool $a_acceptnamedcolors)
This class represents a fint size property in a property form.
setMinValue(float $a_minvalue, bool $a_display_always=false)
global $lng
Definition: privfeed.php:31
This class represents a numeric style property with all/top/right/bottom/left in a property form...
This class represents a background image property in a property form.
This class represents a background position in a property form.
static _getStyleParameterInputType(string $par)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ listCharacteristics()

ilStyleCharacteristicGUI::listCharacteristics ( )

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

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

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",
175  $style_type,
176  $this->object,
177  $this->manager,
178  $this->access_manager
179  );
180 
181  $tpl->setContent($table_gui->getHTML());
182  }
static _isExpandable(string $a_type)
global $lng
Definition: privfeed.php:31
+ Here is the call graph for this function:

◆ outputTagStyleEditScreen()

ilStyleCharacteristicGUI::outputTagStyleEditScreen ( ilPropertyFormGUI  $form)
protected

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

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

Referenced by editTagStyle(), refreshTagStyle(), and updateTagStyle().

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)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ pasteCharacteristics()

ilStyleCharacteristicGUI::pasteCharacteristics ( )

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

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

1286  : void
1287  {
1288  $ilCtrl = $this->gui_service->ctrl();
1289  $lng = $this->domain_service->lng();
1290 
1291  $titles = $this->request->getTitles();
1292  $conflict_action = $this->request->getConflictAction();
1293  if (count($titles) > 0) {
1294  foreach ($titles as $from_char => $to_title) {
1295  $fc = explode(".", $from_char);
1296 
1297  if ($conflict_action[$from_char] == "overwrite" ||
1298  !$this->object->characteristicExists($to_title, $fc[0])) {
1299  // @todo check this
1300  $this->manager->copyCharacteristicFromSource(
1301  $this->request->getFromStyleId(),
1302  $fc[0],
1303  $fc[2],
1304  $fc[2],
1305  ["en" => $to_title]
1306  );
1307  }
1308  }
1309  ilObjStyleSheet::_writeUpToDate($this->object->getId(), false);
1310  $this->manager->clearCopyCharacteristics();
1311  $this->main_tpl->setOnScreenMessage('success', $lng->txt("sty_style_classes_copied"), true);
1312  }
1313 
1314  $ilCtrl->redirect($this, "listCharacteristics");
1315  }
static _writeUpToDate(int $a_id, bool $a_up_to_date)
global $lng
Definition: privfeed.php:31
+ Here is the call graph for this function:

◆ pasteCharacteristicsFromOtherStyle()

ilStyleCharacteristicGUI::pasteCharacteristicsFromOtherStyle ( )
Exceptions
Content

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

References Vendor\Package\$d, $data, $lng, $manager, and getPasteFromOtherStyleForm().

1230  : void
1231  {
1232  $request = $this->gui_service->http()->request();
1233  $form = $this->getPasteFromOtherStyleForm();
1234  $tpl = $this->gui_service->mainTemplate();
1235  $ctrl = $this->gui_service->ctrl();
1236  $lng = $this->domain_service->lng();
1237  $ui = $this->gui_service->ui();
1239 
1240  if ($request->getMethod() == "POST") {
1241  $form = $form->withRequest($request);
1242  $data = $form->getData();
1243  if (is_null($data)) {
1244  $tpl->setContent($ui->renderer()->render($form));
1245  return;
1246  }
1247  foreach ($this->manager->getCopyCharacteristics() as $char) {
1248  if (is_array($data["sec"][$char])) {
1249  $d = $data["sec"][$char];
1250  $char_parts = explode(".", $char);
1251 
1252  if (isset($d[1])) {
1253  $d = $d[1];
1254  }
1255 
1256  // overwrite existing class
1257  if (isset($d["overwrite_class"])) {
1260  $char_parts[0],
1261  $char_parts[2],
1262  $d["overwrite_class"],
1263  []
1264  );
1265  } elseif (isset($d["char_" . $char])) {
1266  $titles = [];
1267  foreach ($lng->getInstalledLanguages() as $l) {
1268  $titles[$l] = $d["title_" . $char . "_" . $l];
1269  }
1270  $new_char = $d["char_" . $char];
1273  $char_parts[0],
1274  $char_parts[2],
1275  $new_char,
1276  $titles
1277  );
1278  }
1279  }
1280  }
1281  $this->main_tpl->setOnScreenMessage('info', $lng->txt("msg_obj_modified"), true);
1282  }
1283  $ctrl->redirect($this, "listCharacteristics");
1284  }
Content StandardGUIRequest $request
getPasteFromOtherStyleForm()
Init past from other style form.
Content CharacteristicManager $manager
global $lng
Definition: privfeed.php:31
copyCharacteristicFromSource(int $source_style_id, string $source_style_type, string $source_char, string $new_char, array $new_titles)
Copy characteristic.
+ Here is the call graph for this function:

◆ pasteCharacteristicsOverview()

ilStyleCharacteristicGUI::pasteCharacteristicsOverview ( )

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

References getPasteFromOtherStyleForm(), and getPasteWithinStyleForm().

1057  : void
1058  {
1059  $tpl = $this->gui_service->mainTemplate();
1060  $ilTabs = $this->gui_service->tabs();
1061  $ui = $this->gui_service->ui();
1062 
1063  $ilTabs->clearTargets();
1064 
1065  if ($this->manager->getCopyCharacteristicStyleId() ==
1066  $this->object->getId()) {
1067  $form = $this->getPasteWithinStyleForm();
1068  } else {
1069  $form = $this->getPasteFromOtherStyleForm();
1070  }
1071  $tpl->setContent($ui->renderer()->render($form));
1072  }
getPasteWithinStyleForm()
Init past within style form.
getPasteFromOtherStyleForm()
Init past from other style form.
+ Here is the call graph for this function:

◆ pasteCharacteristicsWithinStyle()

ilStyleCharacteristicGUI::pasteCharacteristicsWithinStyle ( )

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

References Vendor\Package\$d, $data, $lng, $manager, and getPasteWithinStyleForm().

1186  : void
1187  {
1188  $ui = $this->gui_service->ui();
1189  $request = $this->gui_service->http()->request();
1190  $form = $this->getPasteWithinStyleForm();
1191  $tpl = $this->gui_service->mainTemplate();
1192  $ctrl = $this->gui_service->ctrl();
1193  $lng = $this->domain_service->lng();
1195 
1196  if ($request->getMethod() == "POST") {
1197  $form = $form->withRequest($request);
1198  $data = $form->getData();
1199  if (is_null($data)) {
1200  $tpl->setContent($ui->renderer()->render($form));
1201  return;
1202  }
1203  foreach ($this->manager->getCopyCharacteristics() as $char) {
1204  if (is_array($data[$char])) {
1205  $d = $data[$char];
1206  $titles = [];
1207  foreach ($lng->getInstalledLanguages() as $l) {
1208  $titles[$l] = $d["title_" . $char . "_" . $l];
1209  }
1210  $new_char = $d["char_" . $char];
1211  $char_parts = explode(".", $char);
1213  $this->manager->getCopyCharacteristicStyleId(),
1214  $char_parts[0],
1215  $char_parts[2],
1216  $new_char,
1217  $titles
1218  );
1219  }
1220  }
1221  $this->main_tpl->setOnScreenMessage('info', $lng->txt("msg_obj_modified"), true);
1222  }
1223  $ctrl->redirect($this, "listCharacteristics");
1224  }
getPasteWithinStyleForm()
Init past within style form.
Content StandardGUIRequest $request
Content CharacteristicManager $manager
global $lng
Definition: privfeed.php:31
copyCharacteristicFromSource(int $source_style_id, string $source_style_type, string $source_char, string $new_char, array $new_titles)
Copy characteristic.
+ Here is the call graph for this function:

◆ refreshTagStyle()

ilStyleCharacteristicGUI::refreshTagStyle ( )
protected

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

References initTagStyleForm(), outputTagStyleEditScreen(), and saveTagStyle().

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  }
initTagStyleForm()
Init tag style editing form.
outputTagStyleEditScreen(ilPropertyFormGUI $form)
+ Here is the call graph for this function:

◆ removeOutdated()

ilStyleCharacteristicGUI::removeOutdated ( )
protected

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

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

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  }
$c
Definition: deliver.php:25
static isCoreStyle(string $a_type, string $a_class)
global $lng
Definition: privfeed.php:31
+ Here is the call graph for this function:

◆ saveCharacteristic()

ilStyleCharacteristicGUI::saveCharacteristic ( )

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

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

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  }
initCharacteristicForm()
Init tag style editing form.
global $lng
Definition: privfeed.php:31
static _determineTag(string $a_type)
+ Here is the call graph for this function:

◆ saveStatus()

ilStyleCharacteristicGUI::saveStatus ( )

Save hide status for characteristics.

Exceptions
Content

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

References $lng.

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  }
global $lng
Definition: privfeed.php:31

◆ saveTagStyle()

ilStyleCharacteristicGUI::saveTagStyle ( ilPropertyFormGUI  $form)
protected

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

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

Referenced by refreshTagStyle(), and updateTagStyle().

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  }
getItemByPostVar(string $a_post_var)
static _getStyleParameters(string $a_tag="")
writeStylePar(string $par, string $value, bool $a_custom=false)
Write style parameter.
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-...
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ saveTagTitles()

ilStyleCharacteristicGUI::saveTagTitles ( )

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

References Vendor\Package\$d, $data, $lng, $manager, and getTagTitlesForm().

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  }
Content StandardGUIRequest $request
Content CharacteristicManager $manager
global $lng
Definition: privfeed.php:31
saveTitles(string $type, string $characteristic, array $titles)
Save titles for characteristic.
+ Here is the call graph for this function:

◆ setListSubTabs()

ilStyleCharacteristicGUI::setListSubTabs ( )

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

References $lng, and ilObjStyleSheet\_getStyleSuperTypes().

Referenced by listCharacteristics().

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  }
global $lng
Definition: privfeed.php:31
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setOutdated()

ilStyleCharacteristicGUI::setOutdated ( )
protected

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

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

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  }
$c
Definition: deliver.php:25
static isCoreStyle(string $a_type, string $a_class)
global $lng
Definition: privfeed.php:31
+ Here is the call graph for this function:

◆ setParameterSubTabs()

ilStyleCharacteristicGUI::setParameterSubTabs ( )
protected

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

References $lng.

Referenced by editTagStyle().

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  }
global $lng
Definition: privfeed.php:31
+ Here is the caller graph for this function:

◆ setTabs()

ilStyleCharacteristicGUI::setTabs ( )
protected

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

References $lng.

Referenced by editTagStyle(), and editTagTitles().

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  }
global $lng
Definition: privfeed.php:31
+ Here is the caller graph for this function:

◆ setTitle()

ilStyleCharacteristicGUI::setTitle ( )
protected

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

References $lng.

Referenced by editTagTitles(), and outputTagStyleEditScreen().

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  }
global $lng
Definition: privfeed.php:31
+ Here is the caller graph for this function:

◆ switchMQuery()

ilStyleCharacteristicGUI::switchMQuery ( )

Switch media query.

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

1320  : void
1321  {
1322  $ctrl = $this->gui_service->ctrl();
1323  $ctrl->setParameter($this, "mq_id", $this->request->getMediaQueryId());
1324  $ctrl->redirectByClass("ilstylecharacteristicgui", "editTagStyle");
1325  }

◆ updateTagStyle()

ilStyleCharacteristicGUI::updateTagStyle ( )
protected

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

References initTagStyleForm(), outputTagStyleEditScreen(), and saveTagStyle().

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  }
initTagStyleForm()
Init tag style editing form.
outputTagStyleEditScreen(ilPropertyFormGUI $form)
+ Here is the call graph for this function:

◆ writeStylePar()

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

Write style parameter.

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

Referenced by saveTagStyle().

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  }
+ Here is the caller graph for this function:

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

◆ $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.

Referenced by getCharacterTitleFormFields().

◆ $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

◆ $super_type

string ilStyleCharacteristicGUI::$super_type
protected

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

Referenced by __construct(), and initCharacteristicForm().


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