19declare(strict_types=1);
23use ILIAS\User\RedirectOnMissingWrite;
40use Psr\Http\Message\ServerRequestInterface;
44 use RedirectOnMissingWrite;
54 private readonly \
ilCtrl $ctrl,
57 private readonly UIFactory $ui_factory,
58 private readonly UIRenderer $ui_renderer,
60 private readonly ServerRequestInterface $request,
62 private readonly HttpService
$http,
65 $this->available_settings = $this->user_settings_config_repo->get();
81 $this->redirectOnMissingWrite($this->
access, $this->
ctrl, $this->tpl, $this->
lng);
82 $cmd = $this->
ctrl->getCmd() .
'Cmd';
86 public function showCmd(?RoundTripModal $modal =
null): void
92 if ($modal !==
null) {
96 $this->tpl->setContent(
97 $this->ui_renderer->render($content)
103 $this->
http->saveResponse(
104 $this->
http->response()->withBody(
106 $this->ui_renderer->renderAsync($this->buildEditModal())
110 $this->
http->sendResponse();
111 $this->
http->close();
117 $data = $modal->getData();
118 if (
$data ===
null) {
120 $modal->withOnLoad($modal->getShowSignal())
125 $this->user_settings_config_repo->storeConfiguration(
$data[
'setting']);
126 $this->available_settings = $this->user_settings_config_repo->get();
127 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
'usr_settings_saved'));
133 array $visible_column_ids,
136 mixed $additional_viewcontrol_data,
138 mixed $additional_parameters
141 foreach ($this->available_settings as
$setting) {
150 mixed $additional_viewcontrol_data,
152 mixed $additional_parameters
154 return count($this->available_settings);
159 return $this->ui_factory->table()->data(
161 $this->
lng->txt(
'user_settings'),
164 $this->ui_factory->table()->action()->single(
165 $this->lng->txt(
'edit_setting'),
167 $this->setting_id_token
169 ])->withRequest($this->request);
174 $cf = $this->ui_factory->table()->column();
175 $icon_checked = $this->ui_factory->symbol()->icon()
176 ->custom(
'assets/images/standard/icon_checked.svg',
'',
'small');
177 $icon_unchecked = $this->ui_factory->symbol()->icon()
178 ->custom(
'assets/images/standard/icon_unchecked.svg',
'',
'small');
180 'field' => $cf->text($this->
lng->txt(
'user_field'))->withIsSortable(
true),
181 'changeable_by_user' => $cf->boolean(
183 PropertyAttributes::ChangeableByUser->value
187 )->withIsSortable(
true),
188 'changeable_in_local_user_administration' => $cf->boolean(
190 PropertyAttributes::ChangeableInLocalUserAdministration->value
194 )->withIsSortable(
true),
195 'export' => $cf->boolean(
197 PropertyAttributes::Export->value
201 )->withIsSortable(
true)
207 $identifier = $this->retrieveIdentifierFromQuery();
208 $this->
ctrl->setParameterByClass(self::class, $this->setting_id_token->getName(), $identifier);
209 return $this->ui_factory->modal()->roundtrip(
210 $this->
lng->txt(
'edit_setting'),
212 $this->user_settings_config_repo->getByIdentifier(
216 $this->ui_factory->input()->field(),
219 $this->ctrl->getFormActionByClass(self::class,
'save')
225 $identifier = $this->request_wrapper->retrieve(
226 $this->setting_id_token->getName(),
227 $this->refinery->byTrying([
228 $this->refinery->kindlyTo()->string(),
229 $this->refinery->kindlyTo()->listOf(
230 $this->refinery->kindlyTo()->string()
235 if (is_array($identifier)) {
236 return $identifier[0];
243 $order_array = $order->
get();
244 $key = array_key_first($order_array);
245 $factor = array_shift($order_array) ===
'ASC' ? 1 : -1;
246 if ($key ===
'field') {
248 $this->available_settings,
254 if ($key ===
'export') {
256 $this->available_settings,
262 if ($key ===
'changeable_by_user') {
264 $this->available_settings,
270 if ($key ===
'changeable_in_local_user_administration') {
272 $this->available_settings,
Builds a Color from either hex- or rgb values.
Both the subject and the direction need to be specified when expressing an order.
A simple class to express a naive range of whole positive numbers.
The scope of this class is split ilias-conform URI's into components.
Stream factory which enables the user to create streams without the knowledge of the concrete class.
static ofString(string $string)
Creates a new stream with an initial value.
acquireParameters(array $namespace, string ... $names)
array $available_settings
readonly URLBuilder $url_builder
getRows(DataRowBuilder $row_builder, array $visible_column_ids, Range $range, Order $order, mixed $additional_viewcontrol_data, mixed $filter_data, mixed $additional_parameters)
This is called by the table to retrieve rows; map data-records to rows using the $row_builder e....
readonly URLBuilderToken $setting_id_token
__construct(private readonly \ILIAS\Language\Language $lng, private readonly \ilCtrl $ctrl, private readonly \ilAccess $access, private readonly \ilGlobalTemplateInterface $tpl, private readonly UIFactory $ui_factory, private readonly UIRenderer $ui_renderer, private readonly Refinery $refinery, private readonly ServerRequestInterface $request, private readonly RequestWrapper $request_wrapper, private readonly HttpService $http, private readonly ConfigurationRepository $user_settings_config_repo)
getTotalRowCount(mixed $additional_viewcontrol_data, mixed $filter_data, mixed $additional_parameters)
Mainly for the purpose of pagination-support, it is important to know about the total number of recor...
retrieveIdentifierFromQuery()
readonly URLBuilderToken $action_token
showCmd(?RoundTripModal $modal=null)
isChangeableInLocalUserAdministration()
Class ilAccessHandler Checks access for ILIAS objects.
Class ilCtrl provides processing control methods.
return['delivery_method'=> 'php',]
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Interface RequestWrapper.
This describes a Data Table.
An entity that renders components to a string output.
static http()
Fetches the global http state from ILIAS.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Interface Observer \BackgroundTasks Contains several chained tasks and infos about them.