ILIAS  trunk Revision v11.0_alpha-1761-g6dbbfa7b760
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
ilObjDashboardSettingsGUI Class Reference

ilObjDashboardSettingsGUI: ilPermissionGUI ilObjDashboardSettingsGUI: ilDashboardPageLanguageSelectGUI, ilObjectContentStyleSettingsGUI ilObjDashboardSettingsGUI: ilAdministrationGUI More...

+ Inheritance diagram for ilObjDashboardSettingsGUI:
+ Collaboration diagram for ilObjDashboardSettingsGUI:

Public Member Functions

 __construct ( $a_data, int $a_id, bool $a_call_by_reference=true, bool $a_prepare_output=true)
 
 executeCommand ()
 
 getAdminTabs ()
 
 editSettings ()
 
 editSorting ()
 
 getViewForm (string $mode)
 
 getViewSectionSorting (int $view, string $title)
 
 getViewByMode (string $mode, int $view)
 
 saveSettings ()
 
 setSettingsSubTabs (string $a_active)
 
 editPresentation ()
 
 editCustomization ()
 
 getViewSectionPresentation (int $view, string $title)
 
 saveSorting ()
 
- Public Member Functions inherited from ilObjectGUI
 getRefId ()
 
 setAdminMode (string $mode)
 
 getAdminMode ()
 
 getObject ()
 
 executeCommand ()
 
 withReferences ()
 determines whether objects are referenced or not (got ref ids or not) More...
 
 setCreationMode (bool $mode=true)
 If true, a creation screen is displayed the current [ref_id] does belong to the parent class The mode is determined in ilRepositoryGUI. More...
 
 getCreationMode ()
 
 prepareOutput (bool $show_sub_objects=true)
 
 getAdminTabs ()
 administration tabs show only permissions and trash folder More...
 
 getHTML ()
 
 confirmedDeleteObject ()
 confirmed deletion of object -> objects are moved to trash or deleted immediately, if trash is disabled More...
 
 cancelObject ()
 cancel action and go back to previous page More...
 
 createObject ()
 create new object form More...
 
 editAvailabilityPeriodObject ()
 
 saveAvailabilityPeriodObject ()
 
 cancelCreation ()
 cancel create action and go back to repository parent More...
 
 saveObject ()
 
 getDidacticTemplateVar (string $type)
 Get didactic template setting from creation screen. More...
 
 putObjectInTree (ilObject $obj, ?int $parent_node_id=null)
 Add object to tree at given position. More...
 
 editObject ()
 
 addExternalEditFormCustom (ilPropertyFormGUI $form)
 
 updateObject ()
 updates object entry in object_data More...
 
 getFormAction (string $cmd, string $default_form_action="")
 Get form action for command (command is method name without "Object", e.g. More...
 
 isVisible (int $ref_id, string $type)
 
 viewObject ()
 viewObject container presentation for "administration -> repository, trash, permissions" More...
 
 deleteObject (bool $error=false)
 Display deletion confirmation screen. More...
 
 setColumnSettings (ilColumnGUI $column_gui)
 
 addToDeskObject ()
 
 removeFromDeskObject ()
 
- Public Member Functions inherited from ILIAS\Object\ImplementsCreationCallback
 callCreationCallback (\ilObject $object, \ilObjectDefinition $obj_definition, int $requested_crtcb)
 

Data Fields

const VIEW_MODE_SETTINGS = 'Settings'
 
const VIEW_MODE_PRESENTATION = 'Presentation'
 
const VIEW_MODE_SORTING = 'Sorting'
 
const DASH_SORT_PREFIX = 'dash_sort_by_'
 
const DASH_ENABLE_PREFIX = 'dash_enable_'
 
- Data Fields inherited from ilObjectGUI
const ADMIN_MODE_NONE = ""
 
const ADMIN_MODE_SETTINGS = "settings"
 
const ADMIN_MODE_REPOSITORY = "repository"
 
const UPLOAD_TYPE_LOCAL = 1
 
const UPLOAD_TYPE_UPLOAD_DIRECTORY = 2
 
const CFORM_NEW = 1
 
const CFORM_IMPORT = 2
 
const CFORM_CLONE = 3
 
const SUPPORTED_IMPORT_MIME_TYPES = [MimeType::APPLICATION__ZIP, MimeType::APPLICATION__X_ZIP_COMPRESSED]
 

Protected Member Functions

 savePresentation ()
 
- Protected Member Functions inherited from ilObjectGUI
 getObjectService ()
 
 assignObject ()
 
 setTitleAndDescription ()
 
 createActionDispatcherGUI ()
 
 initHeaderAction (?string $sub_type=null, ?int $sub_id=null)
 Add header action menu. More...
 
 insertHeaderAction (?ilObjectListGUI $list_gui=null)
 Insert header action into main template. More...
 
 addHeaderAction ()
 Add header action menu. More...
 
 redrawHeaderActionObject ()
 Ajax call: redraw action header only. More...
 
 setTabs ()
 set admin tabs More...
 
 setAdminTabs ()
 set admin tabs More...
 
 setLocator ()
 
 addLocatorItems ()
 should be overwritten to add object specific items (repository items are preloaded) More...
 
 omitLocator (bool $omit=true)
 
 addAdminLocatorItems (bool $do_not_add_object=false)
 should be overwritten to add object specific items (repository items are preloaded) More...
 
 getCreationFormsHTML (StandardForm|ilPropertyFormGUI|array $form)
 
 getTitleForCreationFormPage ()
 
 getCreationFormTitle ()
 
 initCreateForm (string $new_type)
 
 didacticTemplatesToForm ()
 
 initDidacticTemplate (ilPropertyFormGUI $form)
 
 retrieveAdditionalDidacticTemplateOptions ()
 
 addAdoptContentLinkToToolbar ()
 
 addImportButtonToToolbar ()
 
 addAvailabilityPeriodButtonToToolbar (ilToolbarGUI $toolbar)
 
 parseDidacticTemplateVar (string $var, string $type)
 
 afterSave (ilObject $new_object)
 Post (successful) object creation hook. More...
 
 initEditForm ()
 
 initEditCustomForm (ilPropertyFormGUI $a_form)
 Add custom fields to update form. More...
 
 getEditFormValues ()
 
 getEditFormCustomValues (array &$a_values)
 Add values to custom edit fields. More...
 
 validateCustom (ilPropertyFormGUI $form)
 Validate custom values (if not possible with checkInput()) More...
 
 updateCustom (ilPropertyFormGUI $form)
 Insert custom update form values into object. More...
 
 afterUpdate ()
 Post (successful) object update hook. More...
 
 routeImportCmdObject ()
 
 importFile (string $file_to_import, string $path_to_uploaded_file_in_temp_dir)
 
 deleteUploadedImportFile (string $path_to_uploaded_file_in_temp_dir)
 
 afterImport (ilObject $new_object)
 Post (successful) object import hook. More...
 
 setFormAction (string $cmd, string $form_action)
 
 getReturnLocation (string $cmd, string $default_location="")
 Get return location for command (command is method name without "Object", e.g. More...
 
 setReturnLocation (string $cmd, string $location)
 set specific return location for command More...
 
 getTargetFrame (string $cmd, string $default_target_frame="")
 get target frame for command (command is method name without "Object", e.g. More...
 
 setTargetFrame (string $cmd, string $target_frame)
 Set specific target frame for command. More...
 
 showPossibleSubObjects ()
 show possible sub objects (pull down menu) More...
 
 getTabs ()
 overwrite in derived GUI class of your object type More...
 
 redirectToRefId (int $ref_id, string $cmd="")
 redirects to (repository) view per ref id usually to a container and usually used at the end of a save/import method where the object gui type (of the new object) doesn't match with the type of the current ["ref_id"] value of the request More...
 
 getCenterColumnHTML ()
 Get center column. More...
 
 getRightColumnHTML ()
 Display right column. More...
 
 checkPermission (string $perm, string $cmd="", string $type="", ?int $ref_id=null)
 
 checkPermissionBool (string $perm, string $cmd="", string $type="", ?int $ref_id=null)
 
 enableDragDropFileUpload ()
 Enables the file upload into this object by dropping files. More...
 
 getCreatableObjectTypes ()
 
 buildAddNewItemElements (array $subtypes, string $create_target_class=ilRepositoryGUI::class, ?int $redirect_target_ref_id=null,)
 
 buildGroup (string $create_target_class, array $obj_types_in_group, string $title, array $subtypes)
 

Protected Attributes

Factory $ui_factory
 
Renderer $ui_renderer
 
ilPDSelectedItemsBlockViewSettings $viewSettings
 
UIServices $ui
 
ilDashboardSidePanelSettingsRepository $side_panel_settings
 
GUIService $style_gui
 
- Protected Attributes inherited from ilObjectGUI
ILIAS Notes Service $notes_service
 
ServerRequestInterface $request
 
ilLocatorGUI $locator
 
ilObjUser $user
 
ilAccessHandler $access
 
ilSetting $settings
 
ilToolbarGUI $toolbar
 
ilRbacAdmin $rbac_admin
 
ilRbacSystem $rbac_system
 
ilRbacReview $rbac_review
 
ilObjectService $object_service
 
ilObjectDefinition $obj_definition
 
ilGlobalTemplateInterface $tpl
 
ilTree $tree
 
ilCtrl $ctrl
 
ilErrorHandling $error
 
ilLanguage $lng
 
ilTabsGUI $tabs_gui
 
ILIAS $ilias
 
ArrayBasedRequestWrapper $post_wrapper
 
RequestWrapper $request_wrapper
 
Refinery $refinery
 
ilFavouritesManager $favourites
 
ilObjectCustomIconFactory $custom_icon_factory
 
UIFactory $ui_factory
 
UIRenderer $ui_renderer
 
Filesystem $temp_file_system
 
ilObject $object = null
 
bool $creation_mode = false
 
 $data
 
int $id
 
bool $call_by_reference = false
 
bool $prepare_output
 
int $ref_id
 
int $obj_id
 
int $maxcount
 
array $form_action = []
 
array $return_location = []
 
array $target_frame = []
 
string $tmp_import_dir
 
string $sub_objects = ""
 
bool $omit_locator = false
 
string $type = ""
 
string $admin_mode = self::ADMIN_MODE_NONE
 
int $requested_ref_id = 0
 
int $requested_crtptrefid = 0
 
int $requested_crtcb = 0
 
string $requested_new_type = ""
 
string $link_params
 
string $html = ""
 

Private Member Functions

 maybeDisable (array $fields)
 
 canWrite ()
 

Additional Inherited Members

- Static Public Member Functions inherited from ilObjectGUI
static _gotoRepositoryRoot (bool $raise_error=false)
 Goto repository root. More...
 
static _gotoRepositoryNode (int $ref_id, string $cmd="")
 
static _gotoSharedWorkspaceNode (int $wsp_id)
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilObjDashboardSettingsGUI::__construct (   $a_data,
int  $a_id,
bool  $a_call_by_reference = true,
bool  $a_prepare_output = true 
)

Definition at line 49 of file class.ilObjDashboardSettingsGUI.php.

References $DIC, ilObjectGUI\$lng, ILIAS\GlobalScreen\Provider\__construct(), ILIAS\Repository\access(), ILIAS\Repository\ctrl(), ILIAS\Repository\lng(), ilLanguage\loadLanguageModule(), ILIAS\Repository\settings(), and ILIAS\Repository\ui().

54  {
55  global $DIC;
56 
57  $this->lng = $DIC->language();
58  $this->rbac_system = $DIC->rbac()->system();
59  $this->access = $DIC->access();
60  $this->ctrl = $DIC->ctrl();
61  $this->settings = $DIC->settings();
62  $lng = $DIC->language();
63  $this->ui_factory = $DIC->ui()->factory();
64  $this->ui_renderer = $DIC->ui()->renderer();
65  $this->request = $DIC->http()->request();
66  $this->ui = $DIC->ui();
67  $this->style_gui = $DIC->contentStyle()->gui();
68 
69  $this->type = 'dshs';
70  parent::__construct($a_data, $a_id, $a_call_by_reference, $a_prepare_output);
71 
72  $lng->loadLanguageModule('dash');
73 
74  $this->viewSettings = new ilPDSelectedItemsBlockViewSettings($DIC->user());
75 
76  $this->side_panel_settings = new ilDashboardSidePanelSettingsRepository();
77  }
loadLanguageModule(string $a_module)
Load language module.
ilLanguage $lng
global $DIC
Definition: shib_login.php:22
__construct(Container $dic, ilPlugin $plugin)
+ Here is the call graph for this function:

Member Function Documentation

◆ canWrite()

ilObjDashboardSettingsGUI::canWrite ( )
private

Definition at line 427 of file class.ilObjDashboardSettingsGUI.php.

References ILIAS\Repository\object().

Referenced by editSettings(), getViewSectionSorting(), maybeDisable(), savePresentation(), saveSettings(), and saveSorting().

427  : bool
428  {
429  return $this->rbac_system->checkAccess('write', $this->object->getRefId());
430  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ editCustomization()

ilObjDashboardSettingsGUI::editCustomization ( )

Definition at line 317 of file class.ilObjDashboardSettingsGUI.php.

References ILIAS\Repository\ctrl(), ilDashboardPageGUI\isLanguageAvailable(), ILIAS\Repository\lng(), ILIAS\Repository\ui(), and ILIAS\Repository\user().

317  : void
318  {
319  $this->ui->mainTemplate()->setOnScreenMessage(
320  $this->ui->mainTemplate()::MESSAGE_TYPE_INFO,
321  $this->lng->txt('dash_page_edit_info'),
322  true
323  );
324 
325  $this->tabs_gui->activateTab('dash_customization');
326 
327  $content = $this->ui->renderer()->render(
328  $this->ui->factory()->button()->standard(
329  $this->lng->txt('customize_page'),
330  $this->ctrl->getLinkTargetByClass([self::class, ilDashboardPageLanguageSelectGUI::class], 'select')
331  )
332  );
333 
334  if (ilDashboardPageGUI::isLanguageAvailable($this->user->getLanguage())) {
335  $content .= (new ilDashboardPageGUI($this->user->getLanguage()))->showPage();
336  } elseif (ilDashboardPageGUI::isLanguageAvailable($this->lng->getContentLanguage())) {
337  $content .= (new ilDashboardPageGUI($this->lng->getDefaultLanguage()))->showPage();
338  }
339 
340  $this->tpl->setContent($content);
341  }
ilDashboardPageGUI: ilPageEditorGUI, ilEditClipboardGUI, ilMDEditorGUI ilDashboardPageGUI: ilAdminis...
static isLanguageAvailable(string $lang)
+ Here is the call graph for this function:

◆ editPresentation()

ilObjDashboardSettingsGUI::editPresentation ( )

Definition at line 307 of file class.ilObjDashboardSettingsGUI.php.

References getViewForm(), setSettingsSubTabs(), and ILIAS\Repository\ui().

Referenced by savePresentation().

307  : void
308  {
309  $this->tabs_gui->activateTab('settings');
310  $this->setSettingsSubTabs('presentation');
311 
312  $form = $this->getViewForm(self::VIEW_MODE_PRESENTATION);
313 
314  $this->tpl->setContent($this->ui->renderer()->renderAsync($form));
315  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ editSettings()

ilObjDashboardSettingsGUI::editSettings ( )

Definition at line 145 of file class.ilObjDashboardSettingsGUI.php.

References canWrite(), ILIAS\Repository\lng(), setSettingsSubTabs(), and ILIAS\Repository\settings().

Referenced by saveSettings().

145  : void
146  {
147  if ($this->settings->get('rep_favourites', '0') !== '1') {
148  $content[] = $this->ui_factory->messageBox()->info($this->lng->txt('favourites_disabled_info'));
149  }
150 
151  if ($this->settings->get('mmbr_my_crs_grp', '0') !== '1') {
152  $content[] = $this->ui_factory->messageBox()->info($this->lng->txt('memberships_disabled_info'));
153  }
154  $this->setSettingsSubTabs('general');
155  $table = new ilDashboardSortationTableGUI($this, 'editSettings', !$this->canWrite());
156  $this->tpl->setContent($table->getHTML());
157  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ editSorting()

ilObjDashboardSettingsGUI::editSorting ( )

Definition at line 159 of file class.ilObjDashboardSettingsGUI.php.

References getViewForm(), setSettingsSubTabs(), and ILIAS\Repository\ui().

Referenced by saveSorting().

159  : void
160  {
161  $this->tabs_gui->activateTab('settings');
162  $this->setSettingsSubTabs('sorting');
163  $form = $this->getViewForm(self::VIEW_MODE_SORTING);
164  $this->tpl->setContent($this->ui->renderer()->renderAsync($form));
165  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ executeCommand()

ilObjDashboardSettingsGUI::executeCommand ( )

Definition at line 79 of file class.ilObjDashboardSettingsGUI.php.

References ILIAS\Repository\ctrl(), ilObjectGUI\getRefId(), ILIAS\Repository\lng(), null, and ilObjectGUI\prepareOutput().

79  : void
80  {
81  $cmd = $this->ctrl->getCmd();
82 
83  $this->prepareOutput();
84 
85  if (!$this->rbac_system->checkAccess('visible,read', $this->object->getRefId())) {
86  throw new ilPermissionException($this->lng->txt('no_permission'));
87  }
88 
89  switch ($this->ctrl->getNextClass($this)) {
90  case strtolower(ilPermissionGUI::class):
91  $this->tabs_gui->activateTab('perm_settings');
92  $perm_gui = new ilPermissionGUI($this);
93  $this->ctrl->forwardCommand($perm_gui);
94  break;
95  case strtolower(ilDashboardPageLanguageSelectGUI::class):
96  $this->tabs_gui->activateTab('dash_customization');
97  $this->ctrl->forwardCommand(new ilDashboardPageLanguageSelectGUI());
98  break;
99  case strtolower(ilObjectContentStyleSettingsGUI::class):
100  $this->tabs_gui->clearTargets();
101  $this->ctrl->setParameterByClass(ilDashboardPageGUI::class, 'dshs_lang', $this->request->getQueryParams()['dshs_lang']);
102  $this->tabs_gui->setBackTarget($this->lng->txt('back'), $this->ctrl->getLinkTargetByClass(
103  [ilDashboardPageLanguageSelectGUI::class, ilDashboardPageGUI::class],
104  'edit'
105  ));
106  $gui = $this->style_gui->objectSettingsGUIForRefId(null, $this->getRefId());
107  $this->ctrl->setParameter($gui, 'dshs_lang', $this->request->getQueryParams()['dshs_lang']);
108  $this->ctrl->forwardCommand($gui);
109  break;
110  default:
111  $this->tabs_gui->activateTab('settings');
112  if (!$cmd || $cmd === 'view') {
113  $cmd = 'editSettings';
114  }
115 
116  $this->$cmd();
117  break;
118  }
119  }
prepareOutput(bool $show_sub_objects=true)
@ilCtrl_isCalledBy ilDashboardPageLanguageSelectGUI: ilObjDashboardSettingsGUI
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
+ Here is the call graph for this function:

◆ getAdminTabs()

ilObjDashboardSettingsGUI::getAdminTabs ( )

Definition at line 121 of file class.ilObjDashboardSettingsGUI.php.

References ILIAS\Repository\ctrl().

121  : void
122  {
123  if ($this->rbac_system->checkAccess('visible,read', $this->object->getRefId())) {
124  $this->tabs_gui->addTarget(
125  'settings',
126  $this->ctrl->getLinkTarget($this, 'editSettings'),
127  ['editSettings', 'view']
128  );
129  $this->tabs_gui->addTarget(
130  'dash_customization',
131  $this->ctrl->getLinkTargetByClass(ilDashboardPageLanguageSelectGUI::class)
132  );
133  }
134 
135  if ($this->rbac_system->checkAccess('edit_permission', $this->object->getRefId())) {
136  $this->tabs_gui->addTarget(
137  'perm_settings',
138  $this->ctrl->getLinkTargetByClass(ilPermissionGUI::class, 'perm'),
139  [],
140  ilPermissionGUI::class
141  );
142  }
143  }
+ Here is the call graph for this function:

◆ getViewByMode()

ilObjDashboardSettingsGUI::getViewByMode ( string  $mode,
int  $view 
)

Definition at line 227 of file class.ilObjDashboardSettingsGUI.php.

References getViewSectionPresentation(), getViewSectionSorting(), and ILIAS\Repository\lng().

Referenced by getViewForm().

227  : Section
228  {
229  switch ($mode) {
230  case self::VIEW_MODE_SORTING:
231  return $this->getViewSectionSorting(
232  $view,
233  $this->lng->txt('dash_' . $this->viewSettings->getViewName($view))
234  );
235  case self::VIEW_MODE_PRESENTATION:
236  default:
237  return $this->getViewSectionPresentation(
238  $view,
239  $this->lng->txt('dash_' . $this->viewSettings->getViewName($view))
240  );
241  }
242  }
getViewSectionPresentation(int $view, string $title)
getViewSectionSorting(int $view, string $title)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getViewForm()

ilObjDashboardSettingsGUI::getViewForm ( string  $mode)

Definition at line 167 of file class.ilObjDashboardSettingsGUI.php.

References ILIAS\Repository\ctrl(), getViewByMode(), and null.

Referenced by editPresentation(), editSorting(), savePresentation(), and saveSorting().

167  : ?StandardForm
168  {
169  switch ($mode) {
170  case self::VIEW_MODE_PRESENTATION:
171  case self::VIEW_MODE_SORTING:
172  return $this->ui_factory->input()->container()->form()->standard(
173  $this->ctrl->getFormAction($this, 'save' . $mode),
174  array_map(
175  fn(int $view): Section => $this->getViewByMode($mode, $view),
176  $this->viewSettings->getPresentationViews()
177  )
178  );
179  }
180  return null;
181  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getViewSectionPresentation()

ilObjDashboardSettingsGUI::getViewSectionPresentation ( int  $view,
string  $title 
)

Definition at line 343 of file class.ilObjDashboardSettingsGUI.php.

References ilObjectGUI\$lng, maybeDisable(), ilLanguage\txt(), and ILIAS\UI\Implementation\Component\Input\withValue().

Referenced by getViewByMode().

343  : Section
344  {
345  $lng = $this->lng;
346  $ops = $this->viewSettings->getAvailablePresentationsByView($view);
347  $pres_options = array_column(
348  array_map(
349  static fn(int $k, string $v): array => [$v, $lng->txt('dash_' . $v)],
350  array_keys($ops),
351  $ops
352  ),
353  1,
354  0
355  );
356  $avail_pres = $this->ui_factory->input()->field()->multiSelect(
357  $lng->txt('dash_avail_presentation'),
358  $pres_options
359  )
360  ->withValue($this->viewSettings->getActivePresentationsByView($view));
361  $default_pres = $this->ui_factory->input()->field()->radio($lng->txt('dash_default_presentation'))
362  ->withOption('list', $lng->txt('dash_list'))
363  ->withOption('tile', $lng->txt('dash_tile'));
364  $default_pres = $default_pres->withValue($this->viewSettings->getDefaultPresentationByView($view));
365  return $this->ui_factory->input()->field()->section(
366  $this->maybeDisable(['avail_pres' => $avail_pres, 'default_pres' => $default_pres]),
367  $title
368  );
369  }
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...
ilLanguage $lng
withValue($value)
Get an input like this with another value displayed on the client side.
Definition: Group.php:61
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getViewSectionSorting()

ilObjDashboardSettingsGUI::getViewSectionSorting ( int  $view,
string  $title 
)

Definition at line 183 of file class.ilObjDashboardSettingsGUI.php.

References ilObjectGUI\$id, ilObjectGUI\$lng, canWrite(), ILIAS\Repository\lng(), maybeDisable(), ilLanguage\txt(), ILIAS\UI\Implementation\Component\withAdditionalOnLoadCode(), and ILIAS\UI\Implementation\Component\Input\withValue().

Referenced by getViewByMode().

183  : Section
184  {
185  if ($this->canWrite()) {
186  $this->tpl->addJavaScript("assets/js/SortationUserInputHandler.js");
187  }
188  $lng = $this->lng;
189  $availabe_sort_options = $this->viewSettings->getAvailableSortOptionsByView($view);
190  $options = array_reduce(
191  $availabe_sort_options,
192  static function (array $options, string $option) use ($lng): array {
193  $options[$option] = $lng->txt(self::DASH_SORT_PREFIX . $option);
194  return $options;
195  },
196  []
197  );
198 
199  $available_sorting = $this->ui_factory
200  ->input()
201  ->field()
202  ->multiSelect($this->lng->txt('dash_avail_sortation'), $options)
203  ->withValue(
204  $this->viewSettings->getActiveSortingsByView($view)
205  )
207  static fn(string $id) => "document.getElementById('$id').setAttribute('data-checkbox', 'activeSorting$view');
208  document.addEventListener('DOMContentLoaded', function () {
209  il.Dashboard.handleUserInputForSortationsByView($view);
210  });"
211  );
212  $default_sorting = $this->ui_factory
213  ->input()
214  ->field()
215  ->select($this->lng->txt('dash_default_sortation'), $options)
216  ->withValue($this->viewSettings->getDefaultSortingByView($view))
217  ->withRequired(true)
218  ->withAdditionalOnLoadCode(
219  static fn(string $id) => "document.getElementById('$id').setAttribute('data-select', 'sorting$view');"
220  );
221  return $this->ui_factory->input()->field()->section(
222  $this->maybeDisable(['avail_sorting' => $available_sorting, 'default_sorting' => $default_sorting]),
223  $title
224  );
225  }
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...
ilLanguage $lng
withValue($value)
Get an input like this with another value displayed on the client side.
Definition: Group.php:61
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ maybeDisable()

ilObjDashboardSettingsGUI::maybeDisable ( array  $fields)
private
Parameters
FormInput[]$fields
Returns
FormInput[]

Definition at line 418 of file class.ilObjDashboardSettingsGUI.php.

References canWrite(), and ILIAS\UI\Implementation\Component\Input\Field\FormInput\withDisabled().

Referenced by getViewSectionPresentation(), and getViewSectionSorting().

418  : array
419  {
420  if ($this->canWrite()) {
421  return $fields;
422  }
423 
424  return array_map(static fn(FormInput $field): FormInput => $field->withDisabled(true), $fields);
425  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ savePresentation()

ilObjDashboardSettingsGUI::savePresentation ( )
protected

Definition at line 371 of file class.ilObjDashboardSettingsGUI.php.

References ilObjectGUI\$data, canWrite(), editPresentation(), getViewForm(), and ILIAS\Repository\lng().

371  : void
372  {
373  if ($this->canWrite()) {
374  $data = $this->getViewForm(self::VIEW_MODE_PRESENTATION)->withRequest($this->request)->getData();
375 
376  foreach ($data as $view => $view_data) {
377  $this->viewSettings->storeViewPresentation(
378  $view,
379  $view_data['default_pres'],
380  $view_data['avail_pres'] ?? []
381  );
382  }
383  $this->tpl->setOnScreenMessage($this->tpl::MESSAGE_TYPE_SUCCESS, $this->lng->txt('msg_obj_modified'), true);
384  } else {
385  $this->tpl->setOnScreenMessage($this->tpl::MESSAGE_TYPE_FAILURE, $this->lng->txt('no_permission'), true);
386  }
387  $this->editPresentation();
388  }
+ Here is the call graph for this function:

◆ saveSettings()

ilObjDashboardSettingsGUI::saveSettings ( )

Definition at line 244 of file class.ilObjDashboardSettingsGUI.php.

References canWrite(), editSettings(), ILIAS\Repository\lng(), and ilPDSelectedItemsBlockConstants\VIEW_RECOMMENDED_CONTENT.

244  : void
245  {
246  if ($this->canWrite()) {
247  $form_data = $this->request->getParsedBody();
248  foreach ($this->viewSettings->getPresentationViews() as $presentation_view) {
249  if (isset($form_data['main_panel']['enable'][$presentation_view])) {
250  $this->viewSettings->enableView(
251  $presentation_view,
252  (bool) $form_data['main_panel']['enable'][$presentation_view]
253  );
254  } elseif ($presentation_view !== ilPDSelectedItemsBlockConstants::VIEW_RECOMMENDED_CONTENT) {
255  $this->viewSettings->enableView($presentation_view, false);
256  }
257  }
258 
259  $positions = $form_data['main_panel']['position'];
260  asort($positions);
261  $this->viewSettings->setViewPositions(array_keys($positions));
262 
263  foreach ($this->side_panel_settings->getValidModules() as $mod) {
264  $this->side_panel_settings->enable($mod, (bool) ($form_data['side_panel']['enable'][$mod] ?? false));
265  }
266 
267  $positions = $form_data['side_panel']['position'];
268  asort($positions);
269  $this->side_panel_settings->setPositions(array_keys($positions));
270 
271  $this->tpl->setOnScreenMessage($this->tpl::MESSAGE_TYPE_SUCCESS, $this->lng->txt('settings_saved'), true);
272  } else {
273  $this->tpl->setOnScreenMessage($this->tpl::MESSAGE_TYPE_FAILURE, $this->lng->txt('no_permission'), true);
274  }
275  $this->editSettings();
276  }
+ Here is the call graph for this function:

◆ saveSorting()

ilObjDashboardSettingsGUI::saveSorting ( )

Definition at line 390 of file class.ilObjDashboardSettingsGUI.php.

References ilObjectGUI\$data, canWrite(), editSorting(), getViewForm(), ILIAS\Repository\lng(), and null.

390  : void
391  {
392  if ($this->canWrite()) {
393  $data = $this->getViewForm(self::VIEW_MODE_SORTING)->withRequest($this->request)->getData();
394 
395  foreach ($data as $view => $view_data) {
396  if (isset($view_data['default_sorting'])) {
397  if (!is_array($view_data['avail_sorting'] ?? null)) {
398  $view_data['avail_sorting'] = [$view_data['default_sorting']];
399  }
400  $this->viewSettings->storeViewSorting(
401  $view,
402  $view_data['default_sorting'],
403  $view_data['avail_sorting']
404  );
405  }
406  }
407  $this->tpl->setOnScreenMessage($this->tpl::MESSAGE_TYPE_SUCCESS, $this->lng->txt('msg_obj_modified'), true);
408  } else {
409  $this->tpl->setOnScreenMessage($this->tpl::MESSAGE_TYPE_FAILURE, $this->lng->txt('no_permission'), true);
410  }
411  $this->editSorting();
412  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
+ Here is the call graph for this function:

◆ setSettingsSubTabs()

ilObjDashboardSettingsGUI::setSettingsSubTabs ( string  $a_active)

Definition at line 278 of file class.ilObjDashboardSettingsGUI.php.

References ilObjectGUI\$ctrl, ilObjectGUI\$lng, ilObjectGUI\$tabs_gui, ilCtrl\getLinkTarget(), and ilLanguage\txt().

Referenced by editPresentation(), editSettings(), and editSorting().

278  : void
279  {
280  $tabs = $this->tabs_gui;
281  $ctrl = $this->ctrl;
282  $lng = $this->lng;
283 
284  if ($this->rbac_system->checkAccess('visible,read', $this->object->getRefId())) {
285  $tabs->addSubTab(
286  'general',
287  $lng->txt('general_settings'),
288  $ctrl->getLinkTarget($this, 'editSettings')
289  );
290 
291  $tabs->addSubTab(
292  'presentation',
293  $lng->txt('dash_presentation'),
294  $ctrl->getLinkTarget($this, 'editPresentation')
295  );
296 
297  $tabs->addSubTab(
298  'sorting',
299  $lng->txt('dash_sortation'),
300  $ctrl->getLinkTarget($this, 'editSorting')
301  );
302  }
303 
304  $tabs->activateSubTab($a_active);
305  }
ilTabsGUI $tabs_gui
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...
getLinkTarget(object $a_gui_obj, ?string $a_cmd=null, ?string $a_anchor=null, bool $is_async=false, bool $has_xml_style=false)
ilLanguage $lng
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ $side_panel_settings

ilDashboardSidePanelSettingsRepository ilObjDashboardSettingsGUI::$side_panel_settings
protected

Definition at line 46 of file class.ilObjDashboardSettingsGUI.php.

◆ $style_gui

GUIService ilObjDashboardSettingsGUI::$style_gui
protected

Definition at line 47 of file class.ilObjDashboardSettingsGUI.php.

◆ $ui

UIServices ilObjDashboardSettingsGUI::$ui
protected

Definition at line 45 of file class.ilObjDashboardSettingsGUI.php.

◆ $ui_factory

Factory ilObjDashboardSettingsGUI::$ui_factory
protected

Definition at line 42 of file class.ilObjDashboardSettingsGUI.php.

◆ $ui_renderer

Renderer ilObjDashboardSettingsGUI::$ui_renderer
protected

Definition at line 43 of file class.ilObjDashboardSettingsGUI.php.

◆ $viewSettings

ilPDSelectedItemsBlockViewSettings ilObjDashboardSettingsGUI::$viewSettings
protected

Definition at line 44 of file class.ilObjDashboardSettingsGUI.php.

◆ DASH_ENABLE_PREFIX

const ilObjDashboardSettingsGUI::DASH_ENABLE_PREFIX = 'dash_enable_'

Definition at line 40 of file class.ilObjDashboardSettingsGUI.php.

◆ DASH_SORT_PREFIX

const ilObjDashboardSettingsGUI::DASH_SORT_PREFIX = 'dash_sort_by_'

◆ VIEW_MODE_PRESENTATION

const ilObjDashboardSettingsGUI::VIEW_MODE_PRESENTATION = 'Presentation'

Definition at line 37 of file class.ilObjDashboardSettingsGUI.php.

◆ VIEW_MODE_SETTINGS

const ilObjDashboardSettingsGUI::VIEW_MODE_SETTINGS = 'Settings'

Definition at line 36 of file class.ilObjDashboardSettingsGUI.php.

◆ VIEW_MODE_SORTING

const ilObjDashboardSettingsGUI::VIEW_MODE_SORTING = 'Sorting'

Definition at line 38 of file class.ilObjDashboardSettingsGUI.php.


The documentation for this class was generated from the following file: