ILIAS  trunk Revision v12.0_alpha-1221-g4e438232683
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

readonly ilPDSelectedItemsBlockViewSettings $view_settings
 
readonly UIServices $ui
 
readonly ilDashboardSidePanelSettingsRepository $side_panel_settings
 
readonly 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 48 of file class.ilObjDashboardSettingsGUI.php.

53 {
54 global $DIC;
55
56 $this->ui = $DIC->ui();
57 $this->style_gui = $DIC->contentStyle()->gui();
58
59 parent::__construct($a_data, $a_id, $a_call_by_reference, $a_prepare_output);
60
61 $this->lng->loadLanguageModule('dash');
62 $this->view_settings = new ilPDSelectedItemsBlockViewSettings($this->user);
63 $this->side_panel_settings = new ilDashboardSidePanelSettingsRepository();
64 }
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
global $DIC
Definition: shib_login.php:26

References $DIC, ILIAS\GlobalScreen\Provider\__construct(), ILIAS\Repository\lng(), ILIAS\Repository\ui(), and ILIAS\Repository\user().

+ Here is the call graph for this function:

Member Function Documentation

◆ canWrite()

ilObjDashboardSettingsGUI::canWrite ( )
private

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

403 : bool
404 {
405 return $this->rbac_system->checkAccess('write', $this->object->getRefId());
406 }

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

287 : void
288 {
289 $this->ui->mainTemplate()->setOnScreenMessage(
290 $this->ui->mainTemplate()::MESSAGE_TYPE_INFO,
291 $this->lng->txt('dash_page_edit_info'),
292 true
293 );
294
295 $this->tabs_gui->activateTab('dash_customization');
296
297 $content = $this->ui->renderer()->render(
298 $this->ui->factory()->button()->standard(
299 $this->lng->txt('customize_page'),
300 $this->ctrl->getLinkTargetByClass([self::class, ilDashboardPageLanguageSelectGUI::class], 'select')
301 )
302 );
303
304 if (ilDashboardPageGUI::isLanguageAvailable($this->user->getLanguage())) {
305 $content .= (new ilDashboardPageGUI($this->user->getLanguage()))->showPage();
306 } elseif (ilDashboardPageGUI::isLanguageAvailable($this->lng->getContentLanguage())) {
307 $content .= (new ilDashboardPageGUI($this->lng->getDefaultLanguage()))->showPage();
308 }
309
310 $this->tpl->setContent($content);
311 }
@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 277 of file class.ilObjDashboardSettingsGUI.php.

277 : void
278 {
279 $this->tabs_gui->activateTab('settings');
280 $this->setSettingsSubTabs('presentation');
281
282 $form = $this->getViewForm(self::VIEW_MODE_PRESENTATION);
283
284 $this->tpl->setContent($this->ui_renderer->renderAsync($form));
285 }

References getViewForm(), and setSettingsSubTabs().

+ Here is the call graph for this function:

◆ editSettings()

ilObjDashboardSettingsGUI::editSettings ( )

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

132 : void
133 {
134 if ($this->settings->get('rep_favourites', '0') !== '1') {
135 $content[] = $this->ui_factory->messageBox()->info($this->lng->txt('favourites_disabled_info'));
136 }
137
138 if ($this->settings->get('mmbr_my_crs_grp', '0') !== '1') {
139 $content[] = $this->ui_factory->messageBox()->info($this->lng->txt('memberships_disabled_info'));
140 }
141 $this->setSettingsSubTabs('general');
142 $table = new ilDashboardSortationTableGUI($this, 'editSettings', !$this->canWrite());
143 $this->tpl->setContent($table->getHTML());
144 }

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

+ Here is the call graph for this function:

◆ editSorting()

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

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

146 : void
147 {
148 $this->tabs_gui->activateTab('settings');
149 $this->setSettingsSubTabs('sorting');
150 $form = $form ?? $this->getViewForm(self::VIEW_MODE_SORTING);
151 $this->tpl->setContent($this->ui_renderer->renderAsync($form));
152 }

References getViewForm(), and setSettingsSubTabs().

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

66 : void
67 {
68 $cmd = $this->ctrl->getCmd();
69
70 $this->prepareOutput();
71
72 if (!$this->rbac_system->checkAccess('read', $this->object->getRefId())) {
73 throw new ilPermissionException($this->lng->txt('no_permission'));
74 }
75
76 switch ($this->ctrl->getNextClass($this)) {
77 case strtolower(ilPermissionGUI::class):
78 $this->tabs_gui->activateTab('perm_settings');
79 $perm_gui = new ilPermissionGUI($this);
80 $this->ctrl->forwardCommand($perm_gui);
81 break;
82 case strtolower(ilDashboardPageLanguageSelectGUI::class):
83 $this->tabs_gui->activateTab('dash_customization');
84 $this->ctrl->forwardCommand(new ilDashboardPageLanguageSelectGUI());
85 break;
86 case strtolower(ilObjectContentStyleSettingsGUI::class):
87 $this->tabs_gui->clearTargets();
88 $this->ctrl->setParameterByClass(ilDashboardPageGUI::class, 'dshs_lang', $this->request->getQueryParams()['dshs_lang']);
89 $this->tabs_gui->setBackTarget($this->lng->txt('back'), $this->ctrl->getLinkTargetByClass(
90 [ilDashboardPageLanguageSelectGUI::class, ilDashboardPageGUI::class],
91 'edit'
92 ));
93 $gui = $this->style_gui->objectSettingsGUIForRefId(null, $this->getRefId());
94 $this->ctrl->setParameter($gui, 'dshs_lang', $this->request->getQueryParams()['dshs_lang']);
95 $this->ctrl->forwardCommand($gui);
96 break;
97 default:
98 $this->tabs_gui->activateTab('settings');
99 if (!$cmd || $cmd === 'view') {
100 $cmd = 'editSettings';
101 }
102
103 $this->$cmd();
104 break;
105 }
106 }
@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 108 of file class.ilObjDashboardSettingsGUI.php.

108 : void
109 {
110 if ($this->rbac_system->checkAccess('read', $this->object->getRefId())) {
111 $this->tabs_gui->addTarget(
112 'settings',
113 $this->ctrl->getLinkTarget($this, 'editSettings'),
114 ['editSettings', 'view']
115 );
116 $this->tabs_gui->addTarget(
117 'dash_customization',
118 $this->ctrl->getLinkTargetByClass(ilDashboardPageLanguageSelectGUI::class)
119 );
120 }
121
122 if ($this->rbac_system->checkAccess('edit_permission', $this->object->getRefId())) {
123 $this->tabs_gui->addTarget(
124 'perm_settings',
125 $this->ctrl->getLinkTargetByClass(ilPermissionGUI::class, 'perm'),
126 [],
127 ilPermissionGUI::class
128 );
129 }
130 }

References ILIAS\Repository\ctrl().

+ Here is the call graph for this function:

◆ getViewByMode()

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

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

197 : Section
198 {
199 switch ($mode) {
201 return $this->getViewSectionSorting(
202 $view,
203 $this->lng->txt('dash_' . $this->view_settings->getViewName($view))
204 );
206 default:
207 return $this->getViewSectionPresentation(
208 $view,
209 $this->lng->txt('dash_' . $this->view_settings->getViewName($view))
210 );
211 }
212 }
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 154 of file class.ilObjDashboardSettingsGUI.php.

154 : ?StandardForm
155 {
156 switch ($mode) {
159 return $this->ui_factory->input()->container()->form()->standard(
160 $this->ctrl->getFormAction($this, 'save' . $mode),
161 array_map(
162 fn(int $view): Section => $this->getViewByMode($mode, $view),
163 $this->view_settings->getPresentationViews()
164 )
165 );
166 }
167 return null;
168 }

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

313 : Section
314 {
316 $ops = $this->view_settings->getAvailablePresentationsByView($view);
317 $pres_options = array_column(
318 array_map(
319 static fn(int $k, string $v): array => [$v, $lng->txt('dash_' . $v)],
320 array_keys($ops),
321 $ops
322 ),
323 1,
324 0
325 );
326 $avail_pres = $this->ui_factory->input()->field()->multiSelect(
327 $lng->txt('dash_avail_presentation'),
328 $pres_options
329 )
330 ->withValue($this->view_settings->getActivePresentationsByView($view));
331 $default_pres = $this->ui_factory->input()->field()->radio($lng->txt('dash_default_presentation'))
332 ->withOption('list', $lng->txt('dash_list'))
333 ->withOption('tile', $lng->txt('dash_tile'));
334 $default_pres = $default_pres->withValue($this->view_settings->getDefaultPresentationByView($view));
335 return $this->ui_factory->input()->field()->section(
336 $this->maybeDisable(['avail_pres' => $avail_pres, 'default_pres' => $default_pres]),
337 $title
338 );
339 }
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

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

170 : Section
171 {
172 if ($this->canWrite()) {
173 $this->tpl->addJavaScript("assets/js/SortationUserInputHandler.js");
174 }
175 $available = $this->view_settings->getAvailableSortOptionsByView($view);
176 $options = array_combine($available, $available);
177 $select_options = array_map(fn($s) => $this->lng->txt(self::DASH_SORT_PREFIX . $s), $options);
178 $available_sorting = array_map($this->sortingInputs($view), $options);
179 $default_sorting = $this->ui_factory
180 ->input()
181 ->field()
182 ->select($this->lng->txt('dash_default_sortation'), $select_options)
183 ->withValue($this->view_settings->getDefaultSortingByView($view))
184 ->withAdditionalOnLoadCode(
185 static fn(string $id) => "
186 document.getElementById('$id').setAttribute('data-select', 'sorting$view');
187 window.addEventListener('DOMContentLoaded', () => il.Dashboard.handleUserInputForSortationsByView($view));
188 "
189 );
190
191 return $this->ui_factory->input()->field()->section(
192 $this->maybeDisable([...$available_sorting, 'default_sorting' => $default_sorting]),
193 $title
194 );
195 }

References ilObjectGUI\$id, ILIAS\UI\Implementation\Component\Input\Field\$options, 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 411 of file class.ilObjDashboardSettingsGUI.php.

411 : Input
412 {
413 $options = $this->view_settings->getSortingOptionsByView($view);
414 $sort_options = $this->view_settings->getAvailableOptionsBySortation($name);
415 $value = isset($saved[$name]) ?
416 ['new_items' => ($options[$name]['new_items'] ?? null) ?: 'top'] :
417 null;
418
419 return $this->ui_factory->input()->field()->optionalGroup([
420 'new_items' => array_reduce(
421 $sort_options,
422 fn($r, $o) => $r->withOption($o, $this->lng->txt('dash_manual_new_item_pos_' . $o)),
423 $this->ui_factory->input()->field()->radio($this->lng->txt('dash_manual_new_item_pos'), '')
424 )
425 ], $this->lng->txt(self::DASH_SORT_PREFIX . $name))
426 ->withValue($value);
427 }
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\UI\Implementation\Component\Input\Field\$options, 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 394 of file class.ilObjDashboardSettingsGUI.php.

394 : array
395 {
396 if ($this->canWrite()) {
397 return $fields;
398 }
399
400 return array_map(static fn(FormInput $field): FormInput => $field->withDisabled(true), $fields);
401 }
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 341 of file class.ilObjDashboardSettingsGUI.php.

341 : void
342 {
343 if ($this->canWrite()) {
344 $data = $this->getViewForm(self::VIEW_MODE_PRESENTATION)->withRequest($this->request)->getData();
345
346 foreach ($data as $view => $view_data) {
347 $this->view_settings->storeViewPresentation(
348 $view,
349 $view_data['default_pres'],
350 $view_data['avail_pres'] ?? []
351 );
352 }
353 $this->tpl->setOnScreenMessage($this->tpl::MESSAGE_TYPE_SUCCESS, $this->lng->txt('msg_obj_modified'), true);
354 } else {
355 $this->tpl->setOnScreenMessage($this->tpl::MESSAGE_TYPE_FAILURE, $this->lng->txt('no_permission'), true);
356 }
357 $this->ctrl->redirect($this, 'editPresentation');
358 }

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

+ Here is the call graph for this function:

◆ saveSettings()

ilObjDashboardSettingsGUI::saveSettings ( )

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

214 : void
215 {
216 if ($this->canWrite()) {
217 $form_data = $this->request->getParsedBody();
218 foreach ($this->view_settings->getPresentationViews() as $presentation_view) {
219 if (isset($form_data['main_panel']['enable'][$presentation_view])) {
220 $this->view_settings->enableView(
221 $presentation_view,
222 (bool) $form_data['main_panel']['enable'][$presentation_view]
223 );
224 } elseif ($presentation_view !== ilPDSelectedItemsBlockConstants::VIEW_RECOMMENDED_CONTENT) {
225 $this->view_settings->enableView($presentation_view, false);
226 }
227 }
228
229 $positions = $form_data['main_panel']['position'];
230 asort($positions);
231 $this->view_settings->setViewPositions(array_keys($positions));
232
233 foreach ($this->side_panel_settings->getValidModules() as $mod) {
234 $this->side_panel_settings->enable($mod, (bool) ($form_data['side_panel']['enable'][$mod] ?? false));
235 }
236
237 $positions = $form_data['side_panel']['position'];
238 asort($positions);
239 $this->side_panel_settings->setPositions(array_keys($positions));
240
241 $this->tpl->setOnScreenMessage($this->tpl::MESSAGE_TYPE_SUCCESS, $this->lng->txt('settings_saved'), true);
242 } else {
243 $this->tpl->setOnScreenMessage($this->tpl::MESSAGE_TYPE_FAILURE, $this->lng->txt('no_permission'), true);
244 }
245 $this->ctrl->redirect($this, 'editSettings');
246 }

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

+ Here is the call graph for this function:

◆ saveSorting()

ilObjDashboardSettingsGUI::saveSorting ( )

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

360 : void
361 {
362 $form = null;
363 if ($this->canWrite()) {
364 $form = $this->getViewForm(self::VIEW_MODE_SORTING)->withRequest($this->request);
365 $data = $form->getData();
366 if ($data) {
367 foreach ($data as $view => $view_data) {
368 $avail_sorting = array_keys(array_filter($view_data));
369 $saved = array_filter($view_data, fn($x) => !is_bool($x));
370 if (isset($view_data['default_sorting'])) {
371 $this->view_settings->storeViewSorting(
372 $view,
373 $view_data['default_sorting'],
374 $avail_sorting
375 );
376 $this->view_settings->storeViewSortingOptions($view, $saved);
377 }
378 }
379 $this->tpl->setOnScreenMessage($this->tpl::MESSAGE_TYPE_SUCCESS, $this->lng->txt('msg_obj_modified'), true);
380 } else {
381 $this->editSorting($form);
382 return;
383 }
384 } else {
385 $this->tpl->setOnScreenMessage($this->tpl::MESSAGE_TYPE_FAILURE, $this->lng->txt('no_permission'), true);
386 }
387 $this->ctrl->redirect($this, 'editSorting');
388 }

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

+ Here is the call graph for this function:

◆ setSettingsSubTabs()

ilObjDashboardSettingsGUI::setSettingsSubTabs ( string  $a_active)

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

248 : void
249 {
250 $tabs = $this->tabs_gui;
253
254 if ($this->rbac_system->checkAccess('read', $this->object->getRefId())) {
255 $tabs->addSubTab(
256 'general',
257 $lng->txt('general_settings'),
258 $ctrl->getLinkTarget($this, 'editSettings')
259 );
260
261 $tabs->addSubTab(
262 'presentation',
263 $lng->txt('dash_presentation'),
264 $ctrl->getLinkTarget($this, 'editPresentation')
265 );
266
267 $tabs->addSubTab(
268 'sorting',
269 $lng->txt('dash_sortation'),
270 $ctrl->getLinkTarget($this, 'editSorting')
271 );
272 }
273
274 $tabs->activateSubTab($a_active);
275 }
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 432 of file class.ilObjDashboardSettingsGUI.php.

432 : Input
433 {
434 return $this->ui_factory->input()->field()
435 ->checkbox($this->lng->txt(self::DASH_SORT_PREFIX . $name))
436 ->withAdditionalOnLoadCode(fn(string $id) => "
437 document.getElementById('$id').closest('form').addEventListener('submit', e => (
438 e.target.querySelectorAll('input[disabled]').forEach(x => {x.disabled = false;})
439 ));
440 ")
441 ->withValue(isset($saved[$name]));
442 }
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 444 of file class.ilObjDashboardSettingsGUI.php.

444 : Closure
445 {
446 $saved = array_flip($this->view_settings->getActiveSortingsByView($view));
447 $with_js = fn($name, $check) => $check->withAdditionalOnLoadCode(fn($id) => "
448 document.getElementById('$id').setAttribute('data-checkbox', 'activeSorting$view');
449 document.querySelector('#$id input').setAttribute('data-value', '$name')
450 ");
451
452 $special_settings = ['manually'];
453 $method_for = fn($name) => in_array($name, $special_settings, true) ?
454 $name . 'SortingSettings' :
455 'sortingCheckbox';
456
457 return fn(string $name) => $with_js($name, $this->{$method_for($name)}($view, $name, $saved));
458 }
$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

readonly ilDashboardSidePanelSettingsRepository ilObjDashboardSettingsGUI::$side_panel_settings
protected

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

◆ $style_gui

readonly GUIService ilObjDashboardSettingsGUI::$style_gui
protected

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

◆ $ui

readonly UIServices ilObjDashboardSettingsGUI::$ui
protected

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

◆ $view_settings

readonly ilPDSelectedItemsBlockViewSettings ilObjDashboardSettingsGUI::$view_settings
protected

Definition at line 43 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: