19declare(strict_types=1);
45 private readonly UIRenderer $ui_renderer,
46 private readonly UIFactory $ui_factory,
50 private readonly array $actions
70 return $this->actions[$action_id] ??
null;
79 $selection_ids = $this->test_request->getMultiSelectionIds($row_id_token->getName());
81 $selection = $selection_ids ===
'ALL_OBJECTS'
85 if ($selection === []) {
86 return $this->fail(
'personal_settings_invalid_selection');
89 if (!$this->checkAccess($selection)) {
90 return $this->fail(
'no_permission');
93 $action = $this->
getAction($this->test_request->strVal($action_token->
getName()));
95 $url_builder = $url_builder
97 ->withParameter($action_token, $action->getActionId())
98 ->withParameter($action_type_token, self::SUBMIT_ACTION);
100 return match ($this->test_request->strVal($action_type_token->
getName())) {
101 self::SUBMIT_ACTION => $this->submit(
106 default => $this->showModal(
112 }
catch (\InvalidArgumentException
$e) {
113 return $this->fail(
$e->getMessage());
124 $this->test_request->getRequest(),
134 $this->test_response->sendAsync(
135 $this->ui_renderer->renderAsync(
150 foreach ($selection as $template) {
151 if ($this->
user->getId() !== $template->getUserId()) {
158 private function fail(
string $message_key): null
160 $this->test_response->sendAsync(
161 $this->ui_renderer->renderAsync(
162 $this->ui_factory->messageBox()->failure($this->lng->txt($message_key))
Builds a Color from either hex- or rgb values.
checkAccess(array $selection)
getActions(URLBuilder $url_builder, URLBuilderToken $row_id_token, URLBuilderToken $action_token, URLBuilderToken $action_type_token)
const string ACTION_TYPE_PARAMETER
fail(string $message_key)
getAction(string $action_id)
const string ACTION_PARAMETER
perform(URLBuilder $url_builder, URLBuilderToken $row_id_token, URLBuilderToken $action_token, URLBuilderToken $action_type_token)
submit(TableAction $action, URLBuilder $url_builder, array $selection,)
const string SUBMIT_ACTION
showModal(TableAction $action, URLBuilder $url_builder, array $selection,)
__construct(private readonly RequestDataCollector $test_request, private readonly ResponseHandler $test_response, private readonly UIRenderer $ui_renderer, private readonly UIFactory $ui_factory, private readonly Language $lng, private readonly \ilObjUser $user, private readonly PersonalSettingsRepository $repository, private readonly array $actions)
const string ROW_ID_PARAMETER
getName()
Get the full name of the token including its namespace.
withParameter(URLBuilderToken $token, string|array $value)
Change an acquired parameter's value if the supplied token is valid.
return['delivery_method'=> 'php',]
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This describes commonalities between the different modals.
An entity that renders components to a string output.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...