ILIAS  trunk Revision v12.0_alpha-1227-g7ff6d300864
class.ilDashboardSortationTableGUI.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
23
25{
26 protected readonly Renderer $ui_renderer;
27 protected readonly Factory $ui_factory;
30
31 public function __construct(ilObjectGUI $a_parent_obj, string $a_parent_cmd, bool $disable = false)
32 {
33 global $DIC;
34 $this->ui_factory = $DIC->ui()->factory();
35 $this->ui_renderer = $DIC->ui()->renderer();
36 $this->view_settings = new ilPDSelectedItemsBlockViewSettings($DIC->user());
37 $this->side_panel_settings = new ilDashboardSidePanelSettingsRepository();
38 parent::__construct($a_parent_obj, $a_parent_cmd);
39 $this->lng->loadLanguageModule('mme');
40 $this->initColumns();
41 $this->setFormAction($this->ctrl->getFormAction($this->parent_obj));
42 if (!$disable) {
43 $this->addCommandButton('saveSettings', $this->lng->txt('save'));
44 }
45 $this->setRowTemplate(
46 'tpl.dashboard_sortation_row.html',
47 'components/ILIAS/Dashboard'
48 );
49 $this->setEnableNumInfo(false);
50 $this->initData($disable);
51 }
52
53 public function initColumns(): void
54 {
55 $this->addColumn($this->lng->txt('topitem_position'), '', '30px');
56 $this->addColumn($this->lng->txt('topitem_block'));
57 $this->addColumn($this->lng->txt('topitem_active'));
58 }
59
60 public function initData(bool $disable = false): void
61 {
62 $data[] = [
63 'position' => $this->ui_renderer->render(
64 $this->ui_factory->divider()->horizontal()->withLabel($this->lng->txt('dash_main_panel'))
65 ),
66 'title' => '',
67 'active_checkbox' => ''
68 ];
69
70 $position = 0;
71 foreach ($this->view_settings->getViewPositions() as $presentation_view) {
72 $presentation_cb = new ilCheckboxInputGUI('', 'main_panel[enable][' . $presentation_view . ']');
73 $presentation_cb->setChecked($this->view_settings->isViewEnabled($presentation_view));
74 $presentation_cb->setValue('1');
75 $presentation_cb->setDisabled(
76 $disable ?: ($presentation_view === ilPDSelectedItemsBlockConstants::VIEW_RECOMMENDED_CONTENT)
77 );
78
79 $position_input = new ilNumberInputGUI('', 'main_panel[position][' . $presentation_view . ']');
80 $position_input->setSize(3);
81 $position_input->setValue((string) (++$position * 10));
82 $position_input->setDisabled($disable);
83
84 $data[] = [
85 'position' => $position_input->render(),
86 'title' => $this->lng->txt('dash_enable_' . $this->view_settings->getViewName($presentation_view)),
87 'active_checkbox' => $presentation_cb->render()
88 ];
89 }
90
91 $data[] = [
92 'position' => $this->ui_renderer->render(
93 $this->ui_factory->divider()->horizontal()->withLabel($this->lng->txt('dash_side_panel'))
94 ),
95 'title' => '',
96 'active_checkbox' => ''
97 ];
98
99 $sp_fields = [];
100 $position = 0;
101 foreach ($this->side_panel_settings->getPositions() as $mod) {
102 $side_panel_module_cb = new ilCheckboxInputGUI('', 'side_panel[enable][' . $mod . ']');
103 $side_panel_module_cb->setChecked($this->side_panel_settings->isEnabled($mod));
104 $side_panel_module_cb->setDisabled($disable);
105
106 $position_input = new ilNumberInputGUI('', 'side_panel[position][' . $mod . ']');
107 $position_input->setSize(3);
108 $position_input->setValue((string) (++$position * 10));
109 $position_input->setDisabled($disable);
110
111 $data[] = [
112 'position' => $position_input->render(),
113 'title' => $this->lng->txt('dash_enable_' . $mod),
114 'active_checkbox' => $side_panel_module_cb->render()
115 ];
116 }
117 $this->setData($data);
118 }
119}
Builds a Color from either hex- or rgb values.
Definition: Factory.php:31
This class represents a checkbox property in a property form.
readonly ilDashboardSidePanelSettingsRepository $side_panel_settings
__construct(ilObjectGUI $a_parent_obj, string $a_parent_cmd, bool $disable=false)
readonly ilPDSelectedItemsBlockViewSettings $view_settings
This class represents a number property in a property form.
Class ilObjectGUI Basic methods of all Output classes.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
setEnableNumInfo(bool $a_val)
addCommandButton(string $a_cmd, string $a_text, string $a_onclick='', string $a_id="", string $a_class="")
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.
setData(array $a_data)
Set table data.
This is how the factory for UI elements looks.
Definition: Factory.php:38
An entity that renders components to a string output.
Definition: Renderer.php:31
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
global $DIC
Definition: shib_login.php:26