ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ilObjDashboardSettingsGUI Class Reference

@ilCtrl_Calls ilObjDashboardSettingsGUI: ilPermissionGUI @ilCtrl_Calls ilObjDashboardSettingsGUI: ilDashboardPageLanguageSelectGUI, ilObjectContentStyleSettingsGUI @ilCtrl_isCalledBy 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 ()
 administration tabs show only permissions and trash folder More...
 
 editSettings ()
 
 editSorting (?StandardForm $form=null)
 
 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 ()
 @abstract 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
 
GlobalHttpState $http
 
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
 
CustomIconFactory $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 ()
 
 manuallySortingSettings (int $view, string $name, array $saved)
 
 sortingCheckbox (int $view, string $name, array $saved)
 
 sortingInputs (int $view)
 

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 50 of file class.ilObjDashboardSettingsGUI.php.

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

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().

+ Here is the call graph for this function:

Member Function Documentation

◆ canWrite()

ilObjDashboardSettingsGUI::canWrite ( )
private

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

414 : bool
415 {
416 return $this->rbac_system->checkAccess('write', $this->object->getRefId());
417 }

References ILIAS\Repository\object().

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

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ editCustomization()

ilObjDashboardSettingsGUI::editCustomization ( )

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

301 : void
302 {
303 $this->ui->mainTemplate()->setOnScreenMessage(
304 $this->ui->mainTemplate()::MESSAGE_TYPE_INFO,
305 $this->lng->txt('dash_page_edit_info'),
306 true
307 );
308
309 $this->tabs_gui->activateTab('dash_customization');
310
311 $content = $this->ui->renderer()->render(
312 $this->ui->factory()->button()->standard(
313 $this->lng->txt('customize_page'),
314 $this->ctrl->getLinkTargetByClass([self::class, ilDashboardPageLanguageSelectGUI::class], 'select')
315 )
316 );
317
318 if (ilDashboardPageGUI::isLanguageAvailable($this->user->getLanguage())) {
319 $content .= (new ilDashboardPageGUI($this->user->getLanguage()))->showPage();
320 } elseif (ilDashboardPageGUI::isLanguageAvailable($this->lng->getContentLanguage())) {
321 $content .= (new ilDashboardPageGUI($this->lng->getDefaultLanguage()))->showPage();
322 }
323
324 $this->tpl->setContent($content);
325 }
@ilCtrl_Calls ilDashboardPageGUI: ilPageEditorGUI, ilEditClipboardGUI, ilMDEditorGUI @ilCtrl_isCalled...
static isLanguageAvailable(string $lang)

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

+ Here is the call graph for this function:

◆ editPresentation()

ilObjDashboardSettingsGUI::editPresentation ( )

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

291 : void
292 {
293 $this->tabs_gui->activateTab('settings');
294 $this->setSettingsSubTabs('presentation');
295
296 $form = $this->getViewForm(self::VIEW_MODE_PRESENTATION);
297
298 $this->tpl->setContent($this->ui->renderer()->renderAsync($form));
299 }

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

Referenced by savePresentation().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ editSettings()

ilObjDashboardSettingsGUI::editSettings ( )

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

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

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

Referenced by saveSettings().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ editSorting()

ilObjDashboardSettingsGUI::editSorting ( ?StandardForm  $form = null)

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

160 : void
161 {
162 $this->tabs_gui->activateTab('settings');
163 $this->setSettingsSubTabs('sorting');
164 $form = $form ?? $this->getViewForm(self::VIEW_MODE_SORTING);
165 $this->tpl->setContent($this->ui->renderer()->renderAsync($form));
166 }

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

Referenced by saveSorting().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ executeCommand()

ilObjDashboardSettingsGUI::executeCommand ( )

Reimplemented from ilObjectGUI.

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

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

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

+ Here is the call graph for this function:

◆ getAdminTabs()

ilObjDashboardSettingsGUI::getAdminTabs ( )

administration tabs show only permissions and trash folder

Reimplemented from ilObjectGUI.

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

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

References ILIAS\Repository\ctrl().

+ Here is the call graph for this function:

◆ getViewByMode()

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

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

211 : Section
212 {
213 switch ($mode) {
215 return $this->getViewSectionSorting(
216 $view,
217 $this->lng->txt('dash_' . $this->viewSettings->getViewName($view))
218 );
220 default:
221 return $this->getViewSectionPresentation(
222 $view,
223 $this->lng->txt('dash_' . $this->viewSettings->getViewName($view))
224 );
225 }
226 }
getViewSectionPresentation(int $view, string $title)
getViewSectionSorting(int $view, string $title)
This describes section inputs.
Definition: Section.php:29

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

Referenced by getViewForm().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getViewForm()

ilObjDashboardSettingsGUI::getViewForm ( string  $mode)

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

168 : ?StandardForm
169 {
170 switch ($mode) {
173 return $this->ui_factory->input()->container()->form()->standard(
174 $this->ctrl->getFormAction($this, 'save' . $mode),
175 array_map(
176 fn(int $view): Section => $this->getViewByMode($mode, $view),
177 $this->viewSettings->getPresentationViews()
178 )
179 );
180 }
181 return null;
182 }

References ILIAS\Repository\ctrl(), getViewByMode(), VIEW_MODE_PRESENTATION, and VIEW_MODE_SORTING.

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

+ 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 327 of file class.ilObjDashboardSettingsGUI.php.

327 : Section
328 {
330 $ops = $this->viewSettings->getAvailablePresentationsByView($view);
331 $pres_options = array_column(
332 array_map(
333 static fn(int $k, string $v): array => [$v, $lng->txt('dash_' . $v)],
334 array_keys($ops),
335 $ops
336 ),
337 1,
338 0
339 );
340 $avail_pres = $this->ui_factory->input()->field()->multiSelect(
341 $lng->txt('dash_avail_presentation'),
342 $pres_options
343 )
344 ->withValue($this->viewSettings->getActivePresentationsByView($view));
345 $default_pres = $this->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($this->viewSettings->getDefaultPresentationByView($view));
349 return $this->ui_factory->input()->field()->section(
350 $this->maybeDisable(['avail_pres' => $avail_pres, 'default_pres' => $default_pres]),
351 $title
352 );
353 }
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...

References ilObjectGUI\$lng, maybeDisable(), and ilLanguage\txt().

Referenced by getViewByMode().

+ 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 184 of file class.ilObjDashboardSettingsGUI.php.

184 : Section
185 {
186 if ($this->canWrite()) {
187 $this->tpl->addJavaScript("assets/js/SortationUserInputHandler.js");
188 }
189 $available = $this->viewSettings->getAvailableSortOptionsByView($view);
190 $options = array_combine($available, $available);
191 $select_options = array_map(fn($s) => $this->lng->txt(self::DASH_SORT_PREFIX . $s), $options);
192 $available_sorting = array_map($this->sortingInputs($view), $options);
193 $default_sorting = $this->ui_factory
194 ->input()
195 ->field()
196 ->select($this->lng->txt('dash_default_sortation'), $select_options)
197 ->withValue($this->viewSettings->getDefaultSortingByView($view))
198 ->withAdditionalOnLoadCode(
199 static fn(string $id) => "
200 document.getElementById('$id').setAttribute('data-select', 'sorting$view');
201 window.addEventListener('DOMContentLoaded', () => il.Dashboard.handleUserInputForSortationsByView($view));
202 "
203 );
204
205 return $this->ui_factory->input()->field()->section(
206 $this->maybeDisable([...$available_sorting, 'default_sorting' => $default_sorting]),
207 $title
208 );
209 }

References ilObjectGUI\$id, canWrite(), ILIAS\Repository\lng(), maybeDisable(), and sortingInputs().

Referenced by getViewByMode().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ manuallySortingSettings()

ilObjDashboardSettingsGUI::manuallySortingSettings ( int  $view,
string  $name,
array  $saved 
)
private
Parameters
array<string,mixed>$saved

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

422 : Input
423 {
424 $options = $this->viewSettings->getSortingOptionsByView($view);
425 $sort_options = $this->viewSettings->getAvailableOptionsBySortation($name);
426 $value = isset($saved[$name]) ?
427 ['new_items' => ($options[$name]['new_items'] ?? null) ?: 'top'] :
428 null;
429
430 return $this->ui_factory->input()->field()->optionalGroup([
431 'new_items' => array_reduce(
432 $sort_options,
433 fn($r, $o) => $r->withOption($o, $this->lng->txt('dash_manual_new_item_pos_' . $o)),
434 $this->ui_factory->input()->field()->radio($this->lng->txt('dash_manual_new_item_pos'), '')
435 )
436 ], $this->lng->txt(self::DASH_SORT_PREFIX . $name))
437 ->withValue($value);
438 }
This describes commonalities between all inputs.
Definition: Input.php:47
withValue($value)
Get an input like this with another value displayed on the client side.
Definition: Group.php:61

References ILIAS\Repository\lng(), and ILIAS\UI\Implementation\Component\Input\withValue().

+ Here is the call graph for this function:

◆ maybeDisable()

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

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

405 : array
406 {
407 if ($this->canWrite()) {
408 return $fields;
409 }
410
411 return array_map(static fn(FormInput $field): FormInput => $field->withDisabled(true), $fields);
412 }
withDisabled(bool $is_disabled)
Get an input like this, but set it to a disabled state.static
Definition: FormInput.php:139

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

Referenced by getViewSectionPresentation(), and getViewSectionSorting().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ savePresentation()

ilObjDashboardSettingsGUI::savePresentation ( )
protected

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

355 : void
356 {
357 if ($this->canWrite()) {
358 $data = $this->getViewForm(self::VIEW_MODE_PRESENTATION)->withRequest($this->request)->getData();
359
360 foreach ($data as $view => $view_data) {
361 $this->viewSettings->storeViewPresentation(
362 $view,
363 $view_data['default_pres'],
364 $view_data['avail_pres'] ?? []
365 );
366 }
367 $this->tpl->setOnScreenMessage($this->tpl::MESSAGE_TYPE_SUCCESS, $this->lng->txt('msg_obj_modified'), true);
368 } else {
369 $this->tpl->setOnScreenMessage($this->tpl::MESSAGE_TYPE_FAILURE, $this->lng->txt('no_permission'), true);
370 }
371 $this->editPresentation();
372 }

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

+ Here is the call graph for this function:

◆ saveSettings()

ilObjDashboardSettingsGUI::saveSettings ( )

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

228 : void
229 {
230 if ($this->canWrite()) {
231 $form_data = $this->request->getParsedBody();
232 foreach ($this->viewSettings->getPresentationViews() as $presentation_view) {
233 if (isset($form_data['main_panel']['enable'][$presentation_view])) {
234 $this->viewSettings->enableView(
235 $presentation_view,
236 (bool) $form_data['main_panel']['enable'][$presentation_view]
237 );
238 } elseif ($presentation_view !== ilPDSelectedItemsBlockConstants::VIEW_RECOMMENDED_CONTENT) {
239 $this->viewSettings->enableView($presentation_view, false);
240 }
241 }
242
243 $positions = $form_data['main_panel']['position'];
244 asort($positions);
245 $this->viewSettings->setViewPositions(array_keys($positions));
246
247 foreach ($this->side_panel_settings->getValidModules() as $mod) {
248 $this->side_panel_settings->enable($mod, (bool) ($form_data['side_panel']['enable'][$mod] ?? false));
249 }
250
251 $positions = $form_data['side_panel']['position'];
252 asort($positions);
253 $this->side_panel_settings->setPositions(array_keys($positions));
254
255 $this->tpl->setOnScreenMessage($this->tpl::MESSAGE_TYPE_SUCCESS, $this->lng->txt('settings_saved'), true);
256 } else {
257 $this->tpl->setOnScreenMessage($this->tpl::MESSAGE_TYPE_FAILURE, $this->lng->txt('no_permission'), true);
258 }
259 $this->editSettings();
260 }

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

+ Here is the call graph for this function:

◆ saveSorting()

ilObjDashboardSettingsGUI::saveSorting ( )

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

374 : void
375 {
376 $form = null;
377 if ($this->canWrite()) {
378 $form = $this->getViewForm(self::VIEW_MODE_SORTING)->withRequest($this->request);
379 $data = $form->getData();
380 if ($data) {
381 foreach ($data as $view => $view_data) {
382 $avail_sorting = array_keys(array_filter($view_data));
383 $saved = array_filter($view_data, fn($x) => !is_bool($x));
384 if (isset($view_data['default_sorting'])) {
385 $this->viewSettings->storeViewSorting(
386 $view,
387 $view_data['default_sorting'],
388 $avail_sorting
389 );
390 $this->viewSettings->storeViewSortingOptions($view, $saved);
391 }
392 }
393 $this->tpl->setOnScreenMessage($this->tpl::MESSAGE_TYPE_SUCCESS, $this->lng->txt('msg_obj_modified'), true);
394 }
395 } else {
396 $this->tpl->setOnScreenMessage($this->tpl::MESSAGE_TYPE_FAILURE, $this->lng->txt('no_permission'), true);
397 }
398 $this->editSorting($form);
399 }

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

+ Here is the call graph for this function:

◆ setSettingsSubTabs()

ilObjDashboardSettingsGUI::setSettingsSubTabs ( string  $a_active)

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

262 : void
263 {
264 $tabs = $this->tabs_gui;
267
268 if ($this->rbac_system->checkAccess('visible,read', $this->object->getRefId())) {
269 $tabs->addSubTab(
270 'general',
271 $lng->txt('general_settings'),
272 $ctrl->getLinkTarget($this, 'editSettings')
273 );
274
275 $tabs->addSubTab(
276 'presentation',
277 $lng->txt('dash_presentation'),
278 $ctrl->getLinkTarget($this, 'editPresentation')
279 );
280
281 $tabs->addSubTab(
282 'sorting',
283 $lng->txt('dash_sortation'),
284 $ctrl->getLinkTarget($this, 'editSorting')
285 );
286 }
287
288 $tabs->activateSubTab($a_active);
289 }
getLinkTarget(object $a_gui_obj, ?string $a_cmd=null, ?string $a_anchor=null, bool $is_async=false, bool $has_xml_style=false)
@inheritDoc
ilTabsGUI $tabs_gui

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

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

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ sortingCheckbox()

ilObjDashboardSettingsGUI::sortingCheckbox ( int  $view,
string  $name,
array  $saved 
)
private
Parameters
array<string,mixed>$saved

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

443 : Input
444 {
445 return $this->ui_factory->input()->field()
446 ->checkbox($this->lng->txt(self::DASH_SORT_PREFIX . $name))
447 ->withAdditionalOnLoadCode(fn(string $id) => "
448 document.getElementById('$id').closest('form').addEventListener('submit', e => (
449 e.target.querySelectorAll('input[disabled]').forEach(x => {x.disabled = false;})
450 ));
451 ")
452 ->withValue(isset($saved[$name]));
453 }
withValue($value)
Get an input like this with another value displayed on the client side.

References ilObjectGUI\$id, ILIAS\Repository\lng(), and ILIAS\UI\Component\Input\Input\withValue().

+ Here is the call graph for this function:

◆ sortingInputs()

ilObjDashboardSettingsGUI::sortingInputs ( int  $view)
private

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

455 : Closure
456 {
457 $saved = array_flip($this->viewSettings->getActiveSortingsByView($view));
458 $with_js = fn($name, $check) => $check->withAdditionalOnLoadCode(fn($id) => "
459 document.getElementById('$id').setAttribute('data-checkbox', 'activeSorting$view');
460 document.querySelector('#$id input').setAttribute('data-value', '$name')
461 ");
462
463 $special_settings = ['manually'];
464 $method_for = fn($name) => in_array($name, $special_settings, true) ?
465 $name . 'SortingSettings' :
466 'sortingCheckbox';
467
468 return fn(string $name) => $with_js($name, $this->{$method_for($name)}($view, $name, $saved));
469 }
$check
Definition: buildRTE.php:81

References $check, and ilObjectGUI\$id.

Referenced by getViewSectionSorting().

+ Here is the caller graph for this function:

Field Documentation

◆ $side_panel_settings

ilDashboardSidePanelSettingsRepository ilObjDashboardSettingsGUI::$side_panel_settings
protected

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

◆ $style_gui

GUIService ilObjDashboardSettingsGUI::$style_gui
protected

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

◆ $ui

UIServices ilObjDashboardSettingsGUI::$ui
protected

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

◆ $ui_factory

Factory ilObjDashboardSettingsGUI::$ui_factory
protected

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

◆ $ui_renderer

Renderer ilObjDashboardSettingsGUI::$ui_renderer
protected

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

◆ $viewSettings

ilPDSelectedItemsBlockViewSettings ilObjDashboardSettingsGUI::$viewSettings
protected

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

◆ DASH_ENABLE_PREFIX

const ilObjDashboardSettingsGUI::DASH_ENABLE_PREFIX = 'dash_enable_'

Definition at line 41 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 38 of file class.ilObjDashboardSettingsGUI.php.

Referenced by getViewByMode(), and getViewForm().

◆ VIEW_MODE_SETTINGS

const ilObjDashboardSettingsGUI::VIEW_MODE_SETTINGS = 'Settings'

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

◆ VIEW_MODE_SORTING

const ilObjDashboardSettingsGUI::VIEW_MODE_SORTING = 'Sorting'

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

Referenced by getViewByMode(), and getViewForm().


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