19 declare(strict_types=1);
29 protected \ILIAS\DI\UIServices
$ui;
32 public function __construct(
object $a_parent_obj,
string $a_parent_cmd =
'')
36 $this->
ui = $DIC->ui();
40 $this->
setTitle($this->
lng->txt(
'manage_system_styles'));
42 $this->
addColumn($this->
lng->txt(
'style_name'),
'style_name');
43 $this->
addColumn($this->
lng->txt(
'skin_name'),
'skin_name');
50 $this->
setRowTemplate(
'tpl.sys_styles_row.html',
'Services/Style/System');
58 public function addActions($management_enabled,
bool $read_documentation =
true)
65 $this->
setRowTemplate(
'tpl.sys_styles_row_with_actions.html',
'Services/Style/System');
67 if ($read_documentation || $management_enabled) {
72 if ($management_enabled) {
87 $users_missing_styles = 0;
88 foreach ($all_user_styles as $skin_style_id) {
89 $style_arr = explode(
':', $skin_style_id);
95 if ($users_missing_styles > 0) {
96 $all_styles[
'other'] =
98 'title' => $this->
lng->txt(
'other'),
101 'skin_id' =>
'other',
102 'style_id' =>
'other',
103 'skin_name' =>
'other',
104 'style_name' =>
'other',
105 'users' => $users_missing_styles,
118 protected function fillRow(array $a_set): void
120 $this->tpl->setVariable(
'STYLE_NAME', $a_set[
'style_name']);
121 $this->tpl->setVariable(
'SKIN_NAME', $a_set[
'skin_name']);
122 $is_substyle = isset($a_set[
'substyle_of']) && $a_set[
'substyle_of'] !=
'';
125 $this->tpl->setVariable(
'USERS', $a_set[
'users']);
127 $this->tpl->setVariable(
'USERS',
'-');
130 if ($a_set[
'id'] !=
'other') {
131 $this->tpl->setCurrentBlock(
'default_input');
134 $this->tpl->setVariable(
'DEFAULT_ID', $a_set[
'id']);
138 $this->tpl->setVariable(
'CHECKED_DEFAULT',
" checked='checked' ");
140 $this->tpl->setVariable(
'CHECKED_DEFAULT');
142 $this->tpl->parseCurrentBlock();
145 $this->tpl->setCurrentBlock(
'active_input');
146 $this->tpl->setVariable(
'ACTIVE_ID', $a_set[
'id']);
149 $this->tpl->setVariable(
'DISABLED_ACTIVE',
'disabled');
152 $this->tpl->setVariable(
'CHECKED_ACTIVE',
" checked='checked' ");
154 $this->tpl->setVariable(
'CHECKED_ACTIVE');
157 $this->tpl->setVariable(
'CHECKED_ACTIVE',
" checked='checked' ");
159 $this->tpl->setVariable(
'CHECKED_ACTIVE');
162 $this->tpl->parseCurrentBlock();
166 $this->tpl->setVariable(
'SUB_STYLE_OF', $a_set[
'substyle_of_name']);
170 $a_set[
'substyle_of'],
176 foreach ($assignments as $assignment) {
178 if ($category_title) {
179 $categories[] = $category_title;
183 $listing = $this->
ui->factory()->listing()->unordered($categories);
184 $this->tpl->setVariable(
186 $this->
lng->txt(
'local') . $this->
ui->renderer()->render($listing)
189 $this->tpl->setVariable(
'SUB_STYLE_OF');
190 $this->tpl->setVariable(
'CATEGORIES', $this->
lng->txt(
'global'));
193 $this->tpl->setVariable(
'VERSION', $a_set[
'version']);
201 $this->
ctrl->setParameterByClass(ilSystemStyleDocumentationGUI::class,
'skin_id', $a_set[
'skin_id']);
202 $this->
ctrl->setParameterByClass(ilSystemStyleDocumentationGUI::class,
'style_id', $a_set[
'style_id']);
203 $action_items[] = $this->
ui->factory()->link()->standard(
204 $this->
lng->txt(
'open_documentation'),
205 $this->
ctrl->getLinkTargetByClass(
'ilSystemStyleDocumentationGUI',
'entries')
210 $this->
ctrl->setParameterByClass(ilSystemStyleConfigGUI::class,
'skin_id', $a_set[
'skin_id']);
211 $this->
ctrl->setParameterByClass(ilSystemStyleConfigGUI::class,
'style_id', $a_set[
'style_id']);
213 $this->
ctrl->setParameterByClass(ilSystemStyleOverviewGUI::class,
'skin_id', $a_set[
'skin_id']);
214 $this->
ctrl->setParameterByClass(ilSystemStyleOverviewGUI::class,
'style_id', $a_set[
'style_id']);
217 if ($a_set[
'skin_id'] != $config->getDefaultSkinId()) {
222 if (!$is_substyle && $a_set[
'skin_id'] !=
'default') {
223 $action_items[] = $this->
ui->factory()->link()->standard(
224 $this->
lng->txt(
'export'),
225 $this->
ctrl->getLinkTargetByClass(ilSystemStyleOverviewGUI::class,
'export')
231 $this->
ctrl->setParameterByClass(ilSystemStyleOverviewGUI::class,
'old_skin_id', $a_set[
'skin_id']);
232 $this->
ctrl->setParameterByClass(ilSystemStyleOverviewGUI::class,
'old_style_id', $a_set[
'style_id']);
234 $assignment_modal = $this->parent_obj->getAssignmentCreationModal($a_set[
'style_name']);
236 if($assignment_modal) {
237 $this->modals[] = $assignment_modal;
239 $action_items[] = $this->
ui->factory()->button()->shy(
240 $this->
lng->txt(
'change_assignment'),
242 )->withOnClick($assignment_modal->getShowSignal());
246 $this->tpl->setCurrentBlock(
'actions');
247 $action_dropdown = $this->
ui->factory()->dropdown()->standard($action_items)->withLabel(
248 $this->
lng->txt(
'actions')
250 $this->tpl->setVariable(
'ACTIONS', $this->
ui->renderer()->render($action_dropdown));
251 $this->tpl->parseCurrentBlock();
257 return $this->
ui->renderer()->render($this->modals);
262 $action_items[] = $this->
ui->factory()->link()->standard(
263 $this->
lng->txt(
'edit'),
264 $this->
ctrl->getLinkTargetByClass(
'ilsystemstyleconfiggui')
266 $action_items[] = $this->
ui->factory()->link()->standard(
267 $this->
lng->txt(
'delete'),
268 $this->
ctrl->getLinkTargetByClass(
'ilSystemStyleOverviewGUI',
'deleteStyle')
270 return $action_items;
275 $this->tpl->setCurrentBlock(
'multi_actions');
276 $this->tpl->setVariable(
'MULTI_ACTIONS_ID',
$id);
277 $this->tpl->parseCurrentBlock();
static _lookupActivatedStyle(string $a_skin, string $a_style)
lookup if a style is activated
setFormAction(string $a_form_action, bool $a_multipart=false)
static styleExists(string $style_id)
static getCurrentDefaultSkin()
Gets default Skin of the System.
addCommandButton(string $a_cmd, string $a_text, string $a_onclick='', string $a_id="", string $a_class="")
static _lookupObjId(int $ref_id)
static _getNumberOfUsersForStyle(string $a_skin, string $a_style)
addActions($management_enabled, bool $read_documentation=true)
static getAllSkinStyles()
Get all skins/styles as array (convenient for tables) Attention: tempalte_name/template_id in this ar...
static _lookupTitle(int $obj_id)
setManagementEnabled(bool $management_enabled)
static getSubStyleCategoryAssignments(string $a_skin_id, string $a_style_id, string $a_sub_style_id)
Get all system category assignments of exactly one substyle.
setRowTemplate(string $a_template, string $a_template_dir="")
Set row template.
setTitle(string $a_title, string $a_icon="", string $a_icon_alt="")
ilSystemStyleConfig wraps all 'constants' to ensure the testability of all classes using those 'const...
setReadDocumentation(bool $read_documentation)
setLimit(int $a_limit=0, int $a_default_limit=0)
__construct(object $a_parent_obj, string $a_parent_cmd='')
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)
TableGUI class for system styles.
addManagementActionsToList(array $action_items)
static getCurrentDefaultStyle()
Gets default style of the system.
addMultiCommand(string $a_cmd, string $a_text)
setWithActions(bool $with_actions)
setEnableHeader(bool $a_enableheader)
static _getAllUserAssignedStyles()