19 declare(strict_types=1);
78 public function __construct($a_data, $a_id, $a_call_by_reference =
true, $a_prepare_output =
true)
82 $this->lng = $DIC->language();
83 $this->rbacsystem = $DIC->rbac()->system();
84 $this->error = $DIC[
"ilErr"];
85 $this->access = $DIC->access();
86 $this->ctrl = $DIC->ctrl();
88 $lng = $DIC->language();
89 $this->ui_factory = $DIC->ui()->factory();
90 $this->ui_renderer = $DIC->ui()->renderer();
91 $this->request = $DIC->http()->request();
92 $this->
ui = $DIC->ui();
97 $lng->loadLanguageModule(
"dash");
112 $next_class = $this->ctrl->getNextClass($this);
113 $cmd = $this->ctrl->getCmd();
117 if (!$this->rbacsystem->checkAccess(
"visible,read", $this->object->getRefId())) {
118 $this->error->raiseError($this->lng->txt(
'no_permission'), $this->error->WARNING);
121 switch ($next_class) {
122 case 'ilpermissiongui':
123 $this->tabs_gui->setTabActive(
'perm_settings');
124 include_once(
"Services/AccessControl/classes/class.ilPermissionGUI.php");
126 $ret = $this->ctrl->forwardCommand($perm_gui);
130 if (!$cmd || $cmd ==
'view') {
131 $cmd =
"editSettings";
151 if (
$rbacsystem->checkAccess(
"visible,read", $this->object->getRefId())) {
152 $this->tabs_gui->addTarget(
154 $this->ctrl->getLinkTarget($this,
"editSettings"),
155 array(
"editSettings",
"view")
159 if (
$rbacsystem->checkAccess(
'edit_permission', $this->object->getRefId())) {
160 $this->tabs_gui->addTarget(
162 $this->ctrl->getLinkTargetByClass(
'ilpermissiongui',
"perm"),
174 if ($this->
settings->get(
'rep_favourites',
'0') !==
'1') {
175 $content[] = $this->
ui->factory()->messageBox()->info($this->lng->txt(
'favourites_disabled_info'));
178 if ($this->
settings->get(
'mmbr_my_crs_grp',
'0') !==
'1') {
179 $content[] = $this->
ui->factory()->messageBox()->info($this->lng->txt(
'memberships_disabled_info'));
183 $this->tpl->setContent($this->
ui->renderer()->renderAsync($content));
199 $fields[
"enable_favourites"] =
$f->input()->field()->checkbox(
$lng->txt(
"dash_enable_favourites"))
200 ->withValue($this->viewSettings->enabledSelectedItems());
201 $info_text = ($this->viewSettings->enabledMemberships())
203 :
$lng->txt(
"dash_member_main_alt") .
" " .
$ui->renderer()->render(
204 $ui->factory()->link()->standard(
205 $lng->txt(
"dash_click_here"),
206 $ctrl->getLinkTargetByClass([
"ilAdministrationGUI",
"ilObjMainMenuGUI",
"ilmmsubitemgui"])
210 $fields[
"enable_memberships"] =
$f->input()->field()->checkbox(
$lng->txt(
"dash_enable_memberships"), $info_text)
211 ->withValue($this->viewSettings->enabledMemberships());
214 $section1 =
$f->input()->field()->section($this->
maybeDisable($fields),
$lng->txt(
"dash_main_panel"));
217 foreach ($side_panel->getValidModules() as $mod) {
218 $sp_fields[
"enable_" . $mod] =
$f->input()->field()->checkbox(
$lng->txt(
"dash_enable_" . $mod))
219 ->withValue($side_panel->isEnabled($mod));
223 $section2 =
$f->input()->field()->section($this->
maybeDisable($sp_fields),
$lng->txt(
"dash_side_panel"));
225 $form_action =
$ctrl->getLinkTarget($this,
"saveSettings");
226 return $f->input()->container()->form()->standard(
228 [
"main_panel" => $section1,
"side_panel" => $section2]
243 $ilCtrl->redirect($this,
"editSettings");
249 $form = $form->withRequest(
$request);
250 $form_data = $form->getData();
251 $this->viewSettings->enableSelectedItems($form_data[
'main_panel'][
'enable_favourites']);
252 $this->viewSettings->enableMemberships($form_data[
'main_panel'][
'enable_memberships']);
254 foreach ($side_panel->getValidModules() as $mod) {
255 $side_panel->enable($mod, (
bool) $form_data[
'side_panel'][
'enable_' . $mod]);
259 ilUtil::sendSuccess($this->lng->txt(
"settings_saved"),
true);
260 $ilCtrl->redirect($this,
"editSettings");
279 if (
$rbacsystem->checkAccess(
"visible,read", $this->object->getRefId())) {
282 $lng->txt(
"general_settings"),
283 $ctrl->getLinkTarget($this,
"editSettings")
286 if ($this->viewSettings->enabledSelectedItems()) {
289 $lng->txt(
"dash_view_favourites"),
290 $ctrl->getLinkTarget($this,
"editViewFavourites")
294 if ($this->viewSettings->enabledMemberships()) {
296 "view_courses_groups",
297 $lng->txt(
"dash_view_courses_groups"),
298 $ctrl->getLinkTarget($this,
"editViewCoursesGroups")
303 $tabs->activateSubtab($a_active);
311 if ($this->
settings->get(
'mmbr_my_crs_grp',
'0') !==
'1') {
312 $content[] = $this->
ui->factory()->messageBox()->info($this->lng->txt(
'memberships_disabled_info'));
314 $this->tabs_gui->activateTab(
"settings");
318 $this->tpl->setContent($this->ui_renderer->render($content));
332 if ($view == $this->viewSettings->getSelectedItemsView()) {
333 $save_cmd =
"saveViewFavourites";
335 $save_cmd =
"saveViewCoursesGroups";
339 $ops = $this->viewSettings->getAvailablePresentationsByView($view);
340 $pres_options = array_column(array_map(
function ($k, $v) use (
$lng) {
341 return [$v,
$lng->txt(
"dash_" . $v)];
342 }, array_keys($ops), $ops), 1, 0);
343 $avail_pres =
$ui_factory->input()->field()->multiselect(
$lng->txt(
"dash_avail_presentation"), $pres_options)
344 ->withValue($this->viewSettings->getActivePresentationsByView($view));
345 $default_pres =
$ui_factory->input()->field()->radio(
$lng->txt(
"dash_default_presentation"))
346 ->withOption(
'list',
$lng->txt(
"dash_list"))
347 ->withOption(
'tile',
$lng->txt(
"dash_tile"));
348 $default_pres = $default_pres->withValue((
string) $this->viewSettings->getDefaultPresentationByView($view));
349 $sec_presentation =
$ui_factory->input()->field()->section(
350 $this->
maybeDisable([
"avail_pres" => $avail_pres,
"default_pres" => $default_pres]),
351 $lng->txt(
"dash_presentation")
355 $ops = $this->viewSettings->getAvailableSortOptionsByView($view);
356 $sortation_options = array_column(array_map(
function ($k, $v) use (
$lng) {
357 return [$v,
$lng->txt(
"dash_sort_by_" . $v)];
358 }, array_keys($ops), $ops), 1, 0);
359 $avail_sort =
$ui_factory->input()->field()->multiselect(
$lng->txt(
"dash_avail_sortation"), $sortation_options)
360 ->withValue($this->viewSettings->getActiveSortingsByView($view));
361 $default_sort =
$ui_factory->input()->field()->radio(
$lng->txt(
"dash_default_sortation"));
362 foreach ($sortation_options as $k => $text) {
363 $default_sort = $default_sort->withOption($k, $text);
365 $default_sort = $default_sort->withValue((
string) $this->viewSettings->getDefaultSortingByView($view));
366 $sec_sortation =
$ui_factory->input()->field()->section(
367 $this->
maybeDisable([
"avail_sort" => $avail_sort,
"default_sort" => $default_sort]),
368 $lng->txt(
"dash_sortation")
371 $form =
$ui_factory->input()->container()->form()->standard(
372 $ctrl->getFormAction($this, $save_cmd),
373 [
"presentation" => $sec_presentation,
"sortation" => $sec_sortation]
386 $this->viewSettings->getMembershipsView(),
387 "editViewCoursesGroups" 396 if ($this->
settings->get(
'rep_favourites',
"0") !==
'1') {
397 $content[] = $this->
ui->factory()->messageBox()->info($this->lng->txt(
'favourites_disabled_info'));
399 $this->tabs_gui->activateTab(
"settings");
403 $this->tpl->setContent($this->ui_renderer->render($content));
412 $this->viewSettings->getSelectedItemsView(),
428 $ctrl->redirect($this, $redirect_cmd);
432 $form = $form->withRequest(
$request);
433 $form_data = $form->getData();
434 $this->viewSettings->storeViewSorting(
436 $form_data[
'sortation'][
'default_sort'],
437 $form_data[
'sortation'][
'avail_sort'] ?: []
439 $this->viewSettings->storeViewPresentation(
441 $form_data[
'presentation'][
'default_pres'],
442 $form_data[
'presentation'][
'avail_pres'] ?: []
445 ilUtil::sendSuccess(
$lng->txt(
"msg_obj_modified"),
true);
446 $ctrl->redirect($this, $redirect_cmd);
466 return $this->rbacsystem->checkAccess(
'write', $this->object->getRefId());
getViewSettingsForm(int $view)
Get view courses and groups settings form.
saveViewCoursesGroups()
Save settings of courses and groups overview.
maybeDisable(array $fields)
__construct($a_data, $a_id, $a_call_by_reference=true, $a_prepare_output=true)
Contructor.
saveSettings()
Save personal desktop settings.
setSettingsSubTabs($a_active)
Get tabs.
saveViewSettings(int $view, string $redirect_cmd)
Save settings of favourites overview.
prepareOutput($a_show_subobjects=true)
prepare output
editViewFavourites()
Edit favourites view.
Dashboard side panel settings Repo.
editViewCoursesGroups()
Edit settings of courses and groups overview.
Class ilObjectGUI Basic methods of all Output classes.
if(!defined('PATH_SEPARATOR')) $GLOBALS['_PEAR_default_error_mode']
saveViewFavourites()
Save settings of favourites overview.
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
executeCommand()
Execute command.
editSettings()
Edit personal desktop settings.
__construct(Container $dic, ilPlugin $plugin)
New PermissionGUI (extends from old ilPermission2GUI) RBAC related output.