ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
class.ilContentStylesTableGUI.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
26{
27 protected \ILIAS\Style\Content\InternalGUIService $gui;
28 protected int $default_style = 0;
29 protected int $fixed_style = 0;
32
33 public function __construct(
34 ilContentStyleSettingsGUI $a_parent_obj,
35 string $a_parent_cmd,
36 array $a_data
37 ) {
38 global $DIC;
39
40 $this->ctrl = $DIC->ctrl();
41 $this->lng = $DIC->language();
42 $this->settings = $DIC->settings();
43 $this->rbacsystem = $DIC->rbac()->system();
44 $ilCtrl = $DIC->ctrl();
45 $lng = $DIC->language();
46 $ilSetting = $DIC->settings();
47 $this->gui = $DIC->contentStyle()
48 ->internal()
49 ->gui();
50
51 $this->fixed_style = (int) $ilSetting->get("fixed_content_style_id");
52 $this->default_style = (int) $ilSetting->get("default_content_style_id");
53
54 $this->setId("sty_cs");
55
56 parent::__construct($a_parent_obj, $a_parent_cmd);
57 $this->setData($a_data);
58 $this->setTitle($lng->txt("content_styles"));
59
60 $this->addColumn("", "", "1", true);
61 $this->addColumn($this->lng->txt("title"));
62 $this->addColumn($this->lng->txt("sty_nr_objects"));
63 $this->addColumn($this->lng->txt("purpose"));
64 $this->addColumn($this->lng->txt("sty_scope"));
65 $this->addColumn($this->lng->txt("active"));
66 $this->addColumn($this->lng->txt("actions"));
67
68 $this->setFormAction($ilCtrl->getFormAction($a_parent_obj));
69 $this->setRowTemplate("tpl.content_style_row.html", "components/ILIAS/Style/Content");
70 if ($this->parent_obj->checkPermission("sty_write_content", false)) {
71 $this->addMultiCommand("deleteStyle", $lng->txt("delete"));
72 $this->addCommandButton("saveActiveStyles", $lng->txt("sty_save_active_styles"));
73 }
74 }
75
79 protected function fillRow(array $a_set): void
80 {
82 $ilCtrl = $this->ctrl;
83 $ui_factory = $this->gui->ui()->factory();
84 $ui_renderer = $this->gui->ui()->renderer();
85
86 if ($a_set["id"] > 0) {
87 $this->tpl->setCurrentBlock("cb");
88 $this->tpl->setVariable("ID", $a_set["id"]);
89 $this->tpl->parseCurrentBlock();
90
91 $this->tpl->setCurrentBlock("cb_act");
92 if ($a_set["active"]) {
93 $this->tpl->setVariable("ACT_CHECKED", "checked='checked'");
94 }
95 $this->tpl->setVariable("ID", $a_set["id"]);
96 $this->tpl->parseCurrentBlock();
97
98 $this->tpl->setCurrentBlock("edit_link");
99 $ilCtrl->setParameterByClass("ilobjstylesheetgui", "obj_id", $a_set["id"]);
100 $this->tpl->setVariable("EDIT_LINK", $ilCtrl->getLinkTargetByClass("ilobjstylesheetgui", ""));
101 $ilCtrl->setParameterByClass("ilobjstylesheetgui", "obj_id", "");
102 $this->tpl->setVariable("EDIT_TITLE", $a_set["title"]);
103 $this->tpl->parseCurrentBlock();
104 } else {
105 $this->tpl->setVariable("TITLE", $a_set["title"]);
106 }
107
108 $ilCtrl->setParameter($this->parent_obj, "id", $a_set["id"]);
109 if ($a_set["id"] > 0 && $this->parent_obj->checkPermission("sty_write_content", false)) {
110 $actions = [];
111
112 // default style
113 if ($this->default_style == $a_set["id"]) {
114 $actions[] = $ui_factory->link()->standard(
115 $lng->txt("sty_remove_global_default_state"),
116 $ilCtrl->getLinkTarget($this->parent_obj, "toggleGlobalDefault")
117 );
118 } elseif ($a_set["active"]) {
119 $actions[] = $ui_factory->link()->standard(
120 $lng->txt("sty_make_global_default"),
121 $ilCtrl->getLinkTarget($this->parent_obj, "toggleGlobalDefault")
122 );
123 }
124
125 // fixed style
126 if ($this->fixed_style == $a_set["id"]) {
127 $actions[] = $ui_factory->link()->standard(
128 $lng->txt("sty_remove_global_fixed_state"),
129 $ilCtrl->getLinkTarget($this->parent_obj, "toggleGlobalFixed")
130 );
131 } elseif ($a_set["active"]) {
132 $actions[] = $ui_factory->link()->standard(
133 $lng->txt("sty_make_global_fixed"),
134 $ilCtrl->getLinkTarget($this->parent_obj, "toggleGlobalFixed")
135 );
136 }
137 $actions[] = $ui_factory->link()->standard(
138 $lng->txt("sty_set_scope"),
139 $ilCtrl->getLinkTarget($this->parent_obj, "setScope")
140 );
141
142 $dd = $ui_factory->dropdown()->standard($actions);
143
144 $this->tpl->setVariable("ACTIONS", $ui_renderer->render($dd));
145
146 if ($a_set["id"] == $this->fixed_style) {
147 $this->tpl->setVariable("PURPOSE", $lng->txt("global_fixed"));
148 }
149 if ($a_set["id"] == $this->default_style) {
150 $this->tpl->setVariable("PURPOSE", $lng->txt("global_default"));
151 }
152 }
153 $ilCtrl->setParameter($this->parent_obj, "id", "");
154
155 $this->tpl->setVariable("NR_LM", $a_set["lm_nr"]);
156 if (($a_set["category"] ?? 0) > 0) {
157 $this->tpl->setVariable(
158 "SCOPE",
160 ilObject::_lookupObjId((int) $a_set["category"])
161 )
162 );
163 }
164 }
165}
Settings UI class for system styles.
__construct(ilContentStyleSettingsGUI $a_parent_obj, string $a_parent_cmd, array $a_data)
ILIAS Style Content InternalGUIService $gui
fillRow(array $a_set)
Fill table row.
setParameterByClass(string $a_class, string $a_parameter, $a_value)
@inheritDoc
txt(string $a_topic, string $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
static _lookupObjId(int $ref_id)
static _lookupTitle(int $obj_id)
class ilRbacSystem system function like checkAccess, addActiveRole ... Supporting system functions ar...
ILIAS Setting Class.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
setTitle(string $a_title, string $a_icon="", string $a_icon_alt="")
addCommandButton(string $a_cmd, string $a_text, string $a_onclick='', string $a_id="", string $a_class="")
addMultiCommand(string $a_cmd, string $a_text)
setFormAction(string $a_form_action, bool $a_multipart=false)
addColumn(string $a_text, string $a_sort_field="", string $a_width="", bool $a_is_checkbox_action_column=false, string $a_class="", string $a_tooltip="", bool $a_tooltip_with_html=false)
setRowTemplate(string $a_template, string $a_template_dir="")
Set row template.
setId(string $a_val)
setData(array $a_data)
Set table data.
ilLanguage $lng
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
global $ilSetting
Definition: privfeed.php:31
global $DIC
Definition: shib_login.php:26