19 declare(strict_types=1);
49 bool $a_call_by_reference =
true,
50 bool $a_prepare_output =
true 54 $this->
lng = $DIC->language();
55 $this->rbac_system = $DIC->rbac()->system();
56 $this->
access = $DIC->access();
57 $this->
ctrl = $DIC->ctrl();
59 $lng = $DIC->language();
60 $this->ui_factory = $DIC->ui()->factory();
61 $this->ui_renderer = $DIC->ui()->renderer();
62 $this->request = $DIC->http()->request();
63 $this->
ui = $DIC->ui();
77 $cmd = $this->
ctrl->getCmd();
81 if (!$this->rbac_system->checkAccess(
'visible,read', $this->object->getRefId())) {
85 switch ($this->
ctrl->getNextClass($this)) {
86 case strtolower(ilPermissionGUI::class):
87 $this->tabs_gui->setTabActive(
'perm_settings');
89 $this->
ctrl->forwardCommand($perm_gui);
93 if (!$cmd || $cmd ===
'view') {
94 $cmd =
'editSettings';
104 if ($this->rbac_system->checkAccess(
'visible,read', $this->object->getRefId())) {
105 $this->tabs_gui->addTarget(
107 $this->
ctrl->getLinkTarget($this,
'editSettings'),
108 [
'editSettings',
'view']
112 if ($this->rbac_system->checkAccess(
'edit_permission', $this->object->getRefId())) {
113 $this->tabs_gui->addTarget(
115 $this->
ctrl->getLinkTargetByClass(ilPermissionGUI::class,
'perm'),
117 ilPermissionGUI::class
124 if ($this->
settings->get(
'rep_favourites',
'0') !==
'1') {
125 $content[] = $this->ui_factory->messageBox()->info($this->
lng->txt(
'favourites_disabled_info'));
128 if ($this->
settings->get(
'mmbr_my_crs_grp',
'0') !==
'1') {
129 $content[] = $this->ui_factory->messageBox()->info($this->
lng->txt(
'memberships_disabled_info'));
133 $this->tpl->setContent($table->getHTML());
138 $this->tabs_gui->activateTab(
'settings');
140 $form = $this->
getViewForm(self::VIEW_MODE_SORTING);
141 $this->tpl->setContent($this->
ui->renderer()->renderAsync($form));
147 case self::VIEW_MODE_PRESENTATION:
148 case self::VIEW_MODE_SORTING:
149 return $this->ui_factory->input()->container()->form()->standard(
150 $this->
ctrl->getFormAction($this,
'save' . $mode),
153 $this->viewSettings->getPresentationViews()
163 $this->tpl->addJavaScript(
'Services/Dashboard/Administration/js/SortationUserInputHandler.js');
166 $availabe_sort_options = $this->viewSettings->getAvailableSortOptionsByView($view);
167 $options = array_reduce(
168 $availabe_sort_options,
169 static function (array $options,
string $option) use (
$lng): array {
170 $options[$option] =
$lng->
txt(self::DASH_SORT_PREFIX . $option);
176 $available_sorting = $this->ui_factory
179 ->multiSelect($this->
lng->txt(
'dash_avail_sortation'), $options)
181 $this->viewSettings->getActiveSortingsByView($view)
184 static fn(
string $id) =>
"document.getElementById('$id').setAttribute('data-checkbox', 'activeSorting$view'); 185 document.addEventListener('DOMContentLoaded', function () { 186 il.Dashboard.handleUserInputForSortationsByView($view); 189 $default_sorting = $this->ui_factory
192 ->select($this->
lng->txt(
'dash_default_sortation'), $options)
193 ->
withValue($this->viewSettings->getDefaultSortingByView($view))
195 ->withAdditionalOnLoadCode(
196 static fn(
string $id) =>
"document.getElementById('$id').setAttribute('data-select', 'sorting$view');" 198 return $this->ui_factory->input()->field()->section(
199 $this->
maybeDisable([
'avail_sorting' => $available_sorting,
'default_sorting' => $default_sorting]),
207 case self::VIEW_MODE_SORTING:
210 $this->
lng->txt(
'dash_' . $this->viewSettings->getViewName($view))
212 case self::VIEW_MODE_PRESENTATION:
216 $this->
lng->txt(
'dash_' . $this->viewSettings->getViewName($view))
224 $form_data = $this->request->getParsedBody();
225 foreach ($this->viewSettings->getPresentationViews() as $presentation_view) {
226 if (isset($form_data[
'main_panel'][
'enable'][$presentation_view])) {
227 $this->viewSettings->enableView(
229 (
bool) $form_data[
'main_panel'][
'enable'][$presentation_view]
232 $this->viewSettings->enableView($presentation_view,
false);
236 $positions = $form_data[
'main_panel'][
'position'];
238 $this->viewSettings->setViewPositions(array_keys($positions));
240 foreach ($this->side_panel_settings->getValidModules() as $mod) {
241 $this->side_panel_settings->enable($mod, (
bool) ($form_data[
'side_panel'][
'enable'][$mod] ??
false));
244 $positions = $form_data[
'side_panel'][
'position'];
246 $this->side_panel_settings->setPositions(array_keys($positions));
248 $this->tpl->setOnScreenMessage($this->tpl::MESSAGE_TYPE_SUCCESS, $this->
lng->txt(
'settings_saved'),
true);
250 $this->tpl->setOnScreenMessage($this->tpl::MESSAGE_TYPE_FAILURE, $this->
lng->txt(
'no_permission'),
true);
261 if ($this->rbac_system->checkAccess(
'visible,read', $this->object->getRefId())) {
270 $lng->
txt(
'dash_presentation'),
281 $tabs->activateSubTab($a_active);
286 $this->tabs_gui->activateTab(
'settings');
289 $form = $this->
getViewForm(self::VIEW_MODE_PRESENTATION);
291 $this->tpl->setContent($this->
ui->renderer()->renderAsync($form));
297 $ops = $this->viewSettings->getAvailablePresentationsByView($view);
298 $pres_options = array_column(
300 static fn(
int $k,
string $v): array => [$v,
$lng->
txt(
'dash_' . $v)],
307 $avail_pres = $this->ui_factory->input()->field()->multiSelect(
308 $lng->
txt(
'dash_avail_presentation'),
311 ->
withValue($this->viewSettings->getActivePresentationsByView($view));
312 $default_pres = $this->ui_factory->input()->field()->radio(
$lng->
txt(
'dash_default_presentation'))
313 ->withOption(
'list',
$lng->
txt(
'dash_list'))
314 ->withOption(
'tile',
$lng->
txt(
'dash_tile'));
315 $default_pres = $default_pres->withValue($this->viewSettings->getDefaultPresentationByView($view));
316 return $this->ui_factory->input()->field()->section(
317 $this->
maybeDisable([
'avail_pres' => $avail_pres,
'default_pres' => $default_pres]),
325 $data = $this->
getViewForm(self::VIEW_MODE_PRESENTATION)->withRequest($this->request)->getData();
327 foreach (
$data as $view => $view_data) {
328 $this->viewSettings->storeViewPresentation(
330 $view_data[
'default_pres'],
331 $view_data[
'avail_pres'] ?? []
334 $this->tpl->setOnScreenMessage($this->tpl::MESSAGE_TYPE_SUCCESS, $this->
lng->txt(
'msg_obj_modified'),
true);
336 $this->tpl->setOnScreenMessage($this->tpl::MESSAGE_TYPE_FAILURE, $this->
lng->txt(
'no_permission'),
true);
344 $data = $this->
getViewForm(self::VIEW_MODE_SORTING)->withRequest($this->request)->getData();
346 foreach (
$data as $view => $view_data) {
347 if (isset($view_data[
'default_sorting'])) {
348 if (!is_array($view_data[
'avail_sorting'] ?? null)) {
349 $view_data[
'avail_sorting'] = [$view_data[
'default_sorting']];
351 $this->viewSettings->storeViewSorting(
353 $view_data[
'default_sorting'],
354 $view_data[
'avail_sorting']
358 $this->tpl->setOnScreenMessage($this->tpl::MESSAGE_TYPE_SUCCESS, $this->
lng->txt(
'msg_obj_modified'),
true);
360 $this->tpl->setOnScreenMessage($this->tpl::MESSAGE_TYPE_FAILURE, $this->
lng->txt(
'no_permission'),
true);
380 return $this->rbac_system->checkAccess(
'write', $this->
object->getRefId());
An entity that renders components to a string output.
ilDashboardSidePanelSettingsRepository $side_panel_settings
ilPDSelectedItemsBlockViewSettings $viewSettings
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...
getViewForm(string $mode)
maybeDisable(array $fields)
setSettingsSubTabs(string $a_active)
prepareOutput(bool $show_sub_objects=true)
withAdditionalOnLoadCode(Closure $binder)
loadLanguageModule(string $a_module)
Load language module.
__construct( $a_data, int $a_id, bool $a_call_by_reference=true, bool $a_prepare_output=true)
getViewSectionPresentation(int $view, string $title)
const VIEW_RECOMMENDED_CONTENT
Provides fluid interface to RBAC services.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Class ilObjectGUI Basic methods of all Output classes.
ilObjDashboardSettingsGUI: ilPermissionGUI ilObjDashboardSettingsGUI: ilAdministrationGUI ...
getViewByMode(string $mode, int $view)
const VIEW_MODE_PRESENTATION
getLinkTarget(object $a_gui_obj, string $a_cmd=null, string $a_anchor=null, bool $is_async=false, bool $has_xml_style=false)
getViewSectionSorting(int $view, string $title)
New PermissionGUI (extends from old ilPermission2GUI) RBAC related output.