ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
class.ilDashboardSortationTableGUI.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
23
25{
30
31 public bool $max_limit = true;
32
33 public function __construct($a_parent_obj, $a_parent_cmd, bool $disable = false)
34 {
35 global $DIC;
36 $this->uiFactory = $DIC->ui()->factory();
37 $this->uiRenderer = $DIC->ui()->renderer();
38 $this->viewSettings = new ilPDSelectedItemsBlockViewSettings($DIC->user());
39 $this->side_panel_settings = new ilDashboardSidePanelSettingsRepository();
40 parent::__construct($a_parent_obj, $a_parent_cmd);
41 $this->lng->loadLanguageModule('mme');
42 $this->initColumns();
43 $this->setFormAction($this->ctrl->getFormAction($this->parent_obj));
44 if (!$disable) {
45 $this->addCommandButton('saveSettings', $this->lng->txt('save'));
46 }
47 $this->setRowTemplate(
48 'tpl.dashboard_sortation_row.html',
49 'components/ILIAS/Dashboard'
50 );
51 $this->setEnableNumInfo(false);
52 $this->initData($disable);
53 }
54
55 public function initColumns(): void
56 {
57 $this->addColumn($this->lng->txt('topitem_position'), '', '30px');
58 $this->addColumn($this->lng->txt('topitem_block'));
59 $this->addColumn($this->lng->txt('topitem_active'));
60 }
61
62 public function initData(bool $disable = false): void
63 {
64 $data[] = [
65 'position' => $this->uiRenderer->render(
66 $this->uiFactory->divider()->horizontal()->withLabel($this->lng->txt('dash_main_panel'))
67 ),
68 'title' => '',
69 'active_checkbox' => ''
70 ];
71
72 $position = 0;
73 foreach ($this->viewSettings->getViewPositions() as $presentation_view) {
74 $presentation_cb = new ilCheckboxInputGUI('', 'main_panel[enable][' . $presentation_view . ']');
75 $presentation_cb->setChecked($this->viewSettings->isViewEnabled($presentation_view));
76 $presentation_cb->setValue('1');
77 $presentation_cb->setDisabled(
78 $disable ?: ($presentation_view === ilPDSelectedItemsBlockConstants::VIEW_RECOMMENDED_CONTENT)
79 );
80
81 $position_input = new ilNumberInputGUI('', 'main_panel[position][' . $presentation_view . ']');
82 $position_input->setSize(3);
83 $position_input->setValue((string) (++$position * 10));
84 $position_input->setDisabled($disable);
85
86 $data[] = [
87 'position' => $position_input->render(),
88 'title' => $this->lng->txt('dash_enable_' . $this->viewSettings->getViewName($presentation_view)),
89 'active_checkbox' => $presentation_cb->render()
90 ];
91 }
92
93 $data[] = [
94 'position' => $this->uiRenderer->render(
95 $this->uiFactory->divider()->horizontal()->withLabel($this->lng->txt('dash_side_panel'))
96 ),
97 'title' => '',
98 'active_checkbox' => ''
99 ];
100
101 $sp_fields = [];
102 $position = 0;
103 foreach ($this->side_panel_settings->getPositions() as $mod) {
104 $side_panel_module_cb = new ilCheckboxInputGUI('', 'side_panel[enable][' . $mod . ']');
105 $side_panel_module_cb->setChecked($this->side_panel_settings->isEnabled($mod));
106 $side_panel_module_cb->setDisabled($disable);
107
108 $position_input = new ilNumberInputGUI('', 'side_panel[position][' . $mod . ']');
109 $position_input->setSize(3);
110 $position_input->setValue((string) (++$position * 10));
111 $position_input->setDisabled($disable);
112
113 $data[] = [
114 'position' => $position_input->render(),
115 'title' => $this->lng->txt('dash_enable_' . $mod),
116 'active_checkbox' => $side_panel_module_cb->render()
117 ];
118 }
119 $this->setData($data);
120 }
121}
Builds a Color from either hex- or rgb values.
Definition: Factory.php:31
This class represents a checkbox property in a property form.
__construct($a_parent_obj, $a_parent_cmd, bool $disable=false)
ilDashboardSidePanelSettingsRepository $side_panel_settings
ilPDSelectedItemsBlockViewSettings $viewSettings
This class represents a number property in a property form.
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