19declare(strict_types=1);
35 public const string SHOW_MODAL_ACTION =
'showModalAction';
49 return match($this->
http->resolveRowParameter($action_type_token->getName())) {
51 default => $this->
showModal($url_builder, $row_id_token, $action_token, $action_type_token),
61 $selected_ids = $this->
http->resolveRowParameters($row_id_token->getName());
64 if ($all_records_selected) {
67 $selected_ids = is_string($selected_ids) ? [] : $selected_ids;
70 $selected_records = array_filter(
72 fn(mixed $record):
bool => $this->allowActionForRecord($record)
75 $this->
http->sendAsync(
76 $this->ui_renderer->renderAsync(
80 ->withParameter($action_token, $this->getActionId())
95 $selected_ids = $this->
http->resolveRowParameters($row_id_token->getName());
98 if ($all_records_selected) {
101 $selected_ids = is_string($selected_ids) ? [] : $selected_ids;
104 if (!$all_records_selected && $selected_ids === []) {
109 $selected_records = array_filter(
111 fn(mixed $record):
bool => $this->allowActionForRecord($record)
114 if ($selected_records === []) {
122 ->withParameter($action_token, $this->getActionId())
125 $all_records_selected
141 return $this->
lng->txt(
'no_valid_selection');
149 array $selected_records,
150 bool $all_records_selected
158 array $selected_records,
159 bool $all_records_selected
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...
const MESSAGE_TYPE_SUCCESS
const MESSAGE_TYPE_FAILURE
This describes commonalities between the different modals.
An entity that renders components to a string output.
showModal(URLBuilder $url_builder, URLBuilderToken $row_id_token, URLBuilderToken $action_token, URLBuilderToken $action_type_token,)
showErrorMessage(string $message)
getModal(URLBuilder $url_builder, array $selected_records, bool $all_records_selected)
resolveRecords(?array $selected_ids=null)
readonly HttpService $http
readonly UIRenderer $ui_renderer
getSelectionErrorMessage()
showSuccessMessage(string $message)
trait TableActionModalTrait
@template RecordType
const string SUBMIT_MODAL_ACTION
onExecute(URLBuilder $url_builder, URLBuilderToken $row_id_token, URLBuilderToken $action_token, URLBuilderToken $action_type_token)
submit(URLBuilder $url_builder, URLBuilderToken $row_id_token, URLBuilderToken $action_token, URLBuilderToken $action_type_token,)
onSubmit(URLBuilder $url_builder, array $selected_records, bool $all_records_selected)
static http()
Fetches the global http state from ILIAS.