ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ILIAS\Test\Participants\ParticipantTableDeleteParticipantAction Class Reference
+ Inheritance diagram for ILIAS\Test\Participants\ParticipantTableDeleteParticipantAction:
+ Collaboration diagram for ILIAS\Test\Participants\ParticipantTableDeleteParticipantAction:

Public Member Functions

 __construct (private readonly Language $lng, private readonly \ilGlobalTemplateInterface $tpl, private readonly UIFactory $ui_factory, private readonly ParticipantRepository $participant_repository, private readonly \ilTestAccess $test_access, private readonly \ilObjTest $test_obj)
 
 getActionId ()
 
 isAvailable ()
 
 getTableAction (URLBuilder $url_builder, URLBuilderToken $row_id_token, URLBuilderToken $action_token, URLBuilderToken $action_type_token)
 
 getModal (URLBuilder $url_builder, array $selected_participants, bool $all_participants_selected)
 
 onSubmit (URLBuilder $url_builder, ServerRequestInterface $request, array $selected_participants, bool $all_participants_selected)
 
 allowActionForRecord (Participant $record)
 
 getSelectionErrorMessage ()
 
 getActionId ()
 
 isAvailable ()
 
 getTableAction (URLBuilder $url_builder, URLBuilderToken $row_id_token, URLBuilderToken $action_token, URLBuilderToken $action_type_token)
 
 getModal (URLBuilder $url_builder, array $selected_participants, bool $all_participants_selected)
 
 onSubmit (URLBuilder $url_builder, ServerRequestInterface $request, array $selected_participants, bool $all_participants_selected)
 
 allowActionForRecord (Participant $record)
 
 getSelectionErrorMessage ()
 

Data Fields

const ACTION_ID = 'delete_pax'
 

Detailed Description

Definition at line 31 of file ParticipantTableDeleteParticipantAction.php.

Constructor & Destructor Documentation

◆ __construct()

ILIAS\Test\Participants\ParticipantTableDeleteParticipantAction::__construct ( private readonly Language  $lng,
private readonly \ilGlobalTemplateInterface  $tpl,
private readonly UIFactory  $ui_factory,
private readonly ParticipantRepository  $participant_repository,
private readonly \ilTestAccess  $test_access,
private readonly \ilObjTest  $test_obj 
)

Definition at line 35 of file ParticipantTableDeleteParticipantAction.php.

42 {
43 }

Member Function Documentation

◆ allowActionForRecord()

ILIAS\Test\Participants\ParticipantTableDeleteParticipantAction::allowActionForRecord ( Participant  $record)

Implements ILIAS\Test\Participants\TableAction.

Definition at line 117 of file ParticipantTableDeleteParticipantAction.php.

117 : bool
118 {
119 return $record->getActiveId() === null;
120 }

References ILIAS\Test\Participants\Participant\getActiveId().

+ Here is the call graph for this function:

◆ getActionId()

ILIAS\Test\Participants\ParticipantTableDeleteParticipantAction::getActionId ( )

◆ getModal()

ILIAS\Test\Participants\ParticipantTableDeleteParticipantAction::getModal ( URLBuilder  $url_builder,
array  $selected_participants,
bool  $all_participants_selected 
)
Parameters
array<Participant>$selected_participants

Implements ILIAS\Test\Participants\TableAction.

Definition at line 70 of file ParticipantTableDeleteParticipantAction.php.

74 : ?Modal {
75 return $this->ui_factory->modal()->interruptive(
76 $this->lng->txt('confirm'),
77 $this->lng->txt('remove_selected_participants_confirmation'),
78 $url_builder->buildURI()->__toString()
79 )->withAffectedItems(
80 array_map(
81 fn(Participant $v) => $this->ui_factory->modal()->interruptiveItem()->standard(
82 (string) $v->getUserId(),
83 $this->test_obj->getAnonymity()
84 ? $this->lng->txt('anonymous')
86 ),
87 $selected_participants
88 )
89 )->withActionButtonLabel($this->lng->txt('remove'));
90 }
buildURI()
Get a URI representation of the full URL including query string and fragment/hash.
Definition: URLBuilder.php:214
static _lookupFullname(int $a_user_id)

◆ getSelectionErrorMessage()

ILIAS\Test\Participants\ParticipantTableDeleteParticipantAction::getSelectionErrorMessage ( )

Implements ILIAS\Test\Participants\TableAction.

Definition at line 122 of file ParticipantTableDeleteParticipantAction.php.

122 : ?string
123 {
124 return $this->lng->txt('delete_participants_no_valid_participants_selected');
125 }

References ILIAS\Repository\lng().

+ Here is the call graph for this function:

◆ getTableAction()

ILIAS\Test\Participants\ParticipantTableDeleteParticipantAction::getTableAction ( URLBuilder  $url_builder,
URLBuilderToken  $row_id_token,
URLBuilderToken  $action_token,
URLBuilderToken  $action_type_token 
)

Implements ILIAS\Test\Participants\TableAction.

Definition at line 55 of file ParticipantTableDeleteParticipantAction.php.

60 : Action {
61 return $this->ui_factory->table()->action()->standard(
62 $this->lng->txt('remove_participants'),
63 $url_builder
64 ->withParameter($action_token, self::ACTION_ID)
65 ->withParameter($action_type_token, ParticipantTableActions::SHOW_ACTION),
66 $row_id_token
67 )->withAsync();
68 }
withParameter(URLBuilderToken $token, string|array $value)
Change an acquired parameter's value if the supplied token is valid.
Definition: URLBuilder.php:166

◆ isAvailable()

ILIAS\Test\Participants\ParticipantTableDeleteParticipantAction::isAvailable ( )

Implements ILIAS\Test\Participants\TableAction.

Definition at line 50 of file ParticipantTableDeleteParticipantAction.php.

50 : bool
51 {
52 return $this->test_access->checkManageParticipantsAccess();
53 }

◆ onSubmit()

ILIAS\Test\Participants\ParticipantTableDeleteParticipantAction::onSubmit ( URLBuilder  $url_builder,
ServerRequestInterface  $request,
array  $selected_participants,
bool  $all_participants_selected 
)
Parameters
array<Participant>$selected_participants

Implements ILIAS\Test\Participants\TableAction.

Definition at line 92 of file ParticipantTableDeleteParticipantAction.php.

97 : ?Modal {
98 if (!$this->test_access->checkManageParticipantsAccess()) {
99 $this->tpl->setOnScreenMessage(
101 $this->lng->txt('no_permission'),
102 true
103 );
104 return null;
105 }
106
107 $this->participant_repository->removeParticipants($selected_participants);
108
109 $this->tpl->setOnScreenMessage(
111 $this->lng->txt('tst_selected_user_data_deleted'),
112 true
113 );
114 return null;
115 }

References ILIAS\Repository\lng(), and ILIAS\UICore\GlobalTemplate\MESSAGE_TYPE_FAILURE.

+ Here is the call graph for this function:

Field Documentation

◆ ACTION_ID

const ILIAS\Test\Participants\ParticipantTableDeleteParticipantAction::ACTION_ID = 'delete_pax'

The documentation for this class was generated from the following file: