19declare(strict_types=1);
49 protected readonly UIFactory $ui_factory,
50 protected readonly UIRenderer $ui_renderer,
56 protected readonly array $actions
78 return $action->getTableAction(
92 return $this->actions[$action_id] ??
null;
101 return match($this->test_request->strVal($action_type_token->getName())) {
102 self::SUBMIT_ACTION => $this->submit(
108 default => $this->showModal(
120 array_keys($this->actions),
121 fn(
DataRow $c,
string $v):
DataRow => $this->actions[$v]->allowActionForRecord($record)
123 :
$c->withDisabledAction($v),
134 $action = $this->actions[$this->test_request->strVal($action_token->getName())];
135 $selected_participants_from_request = $this->test_request
136 ->getMultiSelectionIds($row_id_token->
getName());
137 $selected_participants = $this->resolveSelectedParticipants(
139 $selected_participants_from_request
142 if ($selected_participants === []) {
143 $error_message = $action->getSelectionErrorMessage() ?? $this->
lng->txt(
'no_valid_participant_selection');
144 $this->test_response->sendAsync(
145 $this->ui_renderer->renderAsync(
146 $this->ui_factory->messageBox()->failure(
153 $this->test_response->sendAsync(
154 $this->ui_renderer->renderAsync(
157 ->
withParameter($row_id_token, $selected_participants_from_request)
158 ->withParameter($action_token, $action->getActionId())
159 ->withParameter($action_type_token, self::SUBMIT_ACTION),
160 $selected_participants,
161 $selected_participants_from_request ===
'ALL_OBJECTS'
173 $action = $this->actions[$this->test_request->strVal($action_token->getName())];
174 $selected_participants_from_request = $this->test_request
175 ->getMultiSelectionIds($row_id_token->
getName());
176 $selected_participants = $this->resolveSelectedParticipants(
178 $selected_participants_from_request
181 if ($selected_participants === []) {
182 $this->tpl->setOnScreenMessage(
184 $this->
lng->txt(
'no_valid_participant_selection'),
189 return $action->onSubmit(
191 ->withParameter($row_id_token, $selected_participants_from_request)
192 ->withParameter($action_token, $action->getActionId())
193 ->withParameter($action_type_token, self::SUBMIT_ACTION),
194 $this->test_request->getRequest(),
195 $selected_participants,
196 $selected_participants_from_request ===
'ALL_OBJECTS'
202 if ($selected_participants ===
'ALL_OBJECTS') {
204 iterator_to_array($this->
repository->getParticipants($this->test_obj->getTestId())),
212 $selected_participants
Builds a Color from either hex- or rgb values.
submit(URLBuilder $url_builder, URLBuilderToken $row_id_token, URLBuilderToken $action_token, URLBuilderToken $action_type_token)
getEnabledActions(URLBuilder $url_builder, URLBuilderToken $row_id_token, URLBuilderToken $action_token, URLBuilderToken $action_type_token)
const ACTION_TYPE_PARAMETER
execute(URLBuilder $url_builder, URLBuilderToken $row_id_token, URLBuilderToken $action_token, URLBuilderToken $action_type_token)
__construct(protected readonly \ilCtrlInterface $ctrl, protected readonly Language $lng, protected readonly \ilGlobalTemplateInterface $tpl, protected readonly UIFactory $ui_factory, protected readonly UIRenderer $ui_renderer, protected readonly Refinery $refinery, protected readonly RequestDataCollector $test_request, protected readonly ResponseHandler $test_response, protected readonly ParticipantRepository $repository, protected readonly \ilObjTest $test_obj, protected readonly array $actions)
resolveSelectedParticipants(TableAction $action, array|string $selected_participants)
showModal(URLBuilder $url_builder, URLBuilderToken $row_id_token, URLBuilderToken $action_token, URLBuilderToken $action_type_token)
onDataRow(DataRow $row, mixed $record)
getAction(string $action_id)
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...
allowActionForRecord(Participant $record)
const MESSAGE_TYPE_FAILURE
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...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
if(!file_exists('../ilias.ini.php'))