ILIAS  release_8 Revision v8.24
class.ilContentStylesTableGUI.php
Go to the documentation of this file.
1<?php
2
3declare(strict_types=1);
4
26{
27 protected int $default_style = 0;
28 protected int $fixed_style = 0;
31
32 public function __construct(
33 ilContentStyleSettingsGUI $a_parent_obj,
34 string $a_parent_cmd,
35 array $a_data
36 ) {
37 global $DIC;
38
39 $this->ctrl = $DIC->ctrl();
40 $this->lng = $DIC->language();
41 $this->settings = $DIC->settings();
42 $this->rbacsystem = $DIC->rbac()->system();
43 $ilCtrl = $DIC->ctrl();
44 $lng = $DIC->language();
45 $ilSetting = $DIC->settings();
46
47 $this->fixed_style = (int) $ilSetting->get("fixed_content_style_id");
48 $this->default_style = (int) $ilSetting->get("default_content_style_id");
49
50 $this->setId("sty_cs");
51
52 parent::__construct($a_parent_obj, $a_parent_cmd);
53 $this->setData($a_data);
54 $this->setTitle($lng->txt("content_styles"));
55
56 $this->addColumn("", "", "1", true);
57 $this->addColumn($this->lng->txt("title"));
58 $this->addColumn($this->lng->txt("sty_nr_learning_modules"));
59 $this->addColumn($this->lng->txt("purpose"));
60 $this->addColumn($this->lng->txt("sty_scope"));
61 $this->addColumn($this->lng->txt("active"));
62 $this->addColumn($this->lng->txt("actions"));
63
64 $this->setFormAction($ilCtrl->getFormAction($a_parent_obj));
65 $this->setRowTemplate("tpl.content_style_row.html", "Services/Style/Content");
66 if ($this->parent_obj->checkPermission("sty_write_content", false)) {
67 $this->addMultiCommand("deleteStyle", $lng->txt("delete"));
68 $this->addCommandButton("saveActiveStyles", $lng->txt("sty_save_active_styles"));
69 }
70 }
71
75 protected function fillRow(array $a_set): void
76 {
78 $ilCtrl = $this->ctrl;
79
80 if ($a_set["id"] > 0) {
81 $this->tpl->setCurrentBlock("cb");
82 $this->tpl->setVariable("ID", $a_set["id"]);
83 $this->tpl->parseCurrentBlock();
84
85 $this->tpl->setCurrentBlock("cb_act");
86 if ($a_set["active"]) {
87 $this->tpl->setVariable("ACT_CHECKED", "checked='checked'");
88 }
89 $this->tpl->setVariable("ID", $a_set["id"]);
90 $this->tpl->parseCurrentBlock();
91
92 $this->tpl->setCurrentBlock("edit_link");
93 $ilCtrl->setParameterByClass("ilobjstylesheetgui", "obj_id", $a_set["id"]);
94 $this->tpl->setVariable("EDIT_LINK", $ilCtrl->getLinkTargetByClass("ilobjstylesheetgui", ""));
95 $ilCtrl->setParameterByClass("ilobjstylesheetgui", "obj_id", "");
96 $this->tpl->setVariable("EDIT_TITLE", $a_set["title"]);
97 $this->tpl->parseCurrentBlock();
98 } else {
99 $this->tpl->setVariable("TITLE", $a_set["title"]);
100 }
101
102 $ilCtrl->setParameter($this->parent_obj, "id", $a_set["id"]);
103 if ($a_set["id"] > 0 && $this->parent_obj->checkPermission("sty_write_content", false)) {
104 $list = new ilAdvancedSelectionListGUI();
105 $list->setListTitle($lng->txt("actions"));
106 $list->setId("sty_act_" . $a_set["id"]);
107
108 // default style
109 if ($this->default_style == $a_set["id"]) {
110 $list->addItem(
111 $lng->txt("sty_remove_global_default_state"),
112 "",
113 $ilCtrl->getLinkTarget($this->parent_obj, "toggleGlobalDefault")
114 );
115 } elseif ($a_set["active"]) {
116 $list->addItem(
117 $lng->txt("sty_make_global_default"),
118 "",
119 $ilCtrl->getLinkTarget($this->parent_obj, "toggleGlobalDefault")
120 );
121 }
122
123 // fixed style
124 if ($this->fixed_style == $a_set["id"]) {
125 $list->addItem(
126 $lng->txt("sty_remove_global_fixed_state"),
127 "",
128 $ilCtrl->getLinkTarget($this->parent_obj, "toggleGlobalFixed")
129 );
130 } elseif ($a_set["active"]) {
131 $list->addItem(
132 $lng->txt("sty_make_global_fixed"),
133 "",
134 $ilCtrl->getLinkTarget($this->parent_obj, "toggleGlobalFixed")
135 );
136 }
137 $list->addItem(
138 $lng->txt("sty_set_scope"),
139 "",
140 $ilCtrl->getLinkTarget($this->parent_obj, "setScope")
141 );
142
143 $this->tpl->setVariable("ACTIONS", $list->getHTML());
144
145 if ($a_set["id"] == $this->fixed_style) {
146 $this->tpl->setVariable("PURPOSE", $lng->txt("global_fixed"));
147 }
148 if ($a_set["id"] == $this->default_style) {
149 $this->tpl->setVariable("PURPOSE", $lng->txt("global_default"));
150 }
151 }
152 $ilCtrl->setParameter($this->parent_obj, "id", "");
153
154 $this->tpl->setVariable("NR_LM", $a_set["lm_nr"]);
155 if (($a_set["category"] ?? 0) > 0) {
156 $this->tpl->setVariable(
157 "SCOPE",
159 ilObject::_lookupObjId((int) $a_set["category"])
160 )
161 );
162 }
163 }
164}
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Settings UI class for system styles.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
__construct(ilContentStyleSettingsGUI $a_parent_obj, string $a_parent_cmd, array $a_data)
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...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
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
global $DIC
Definition: feed.php:28
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
global $ilSetting
Definition: privfeed.php:17