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

Public Member Functions

 __construct (private readonly Language $lng, private readonly UIFactory $ui_factory, private readonly \ilTestAccess $test_access, private readonly \ilCtrl $ctrl, 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 = 'show_results'
 

Detailed Description

Definition at line 31 of file ParticipantTableShowResultsAction.php.

Constructor & Destructor Documentation

◆ __construct()

ILIAS\Test\Participants\ParticipantTableShowResultsAction::__construct ( private readonly Language  $lng,
private readonly UIFactory  $ui_factory,
private readonly \ilTestAccess  $test_access,
private readonly \ilCtrl  $ctrl,
private readonly \ilObjTest  $test_obj 
)

Definition at line 35 of file ParticipantTableShowResultsAction.php.

41 {
42 }

Member Function Documentation

◆ allowActionForRecord()

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

Implements ILIAS\Test\Participants\TableAction.

Definition at line 119 of file ParticipantTableShowResultsAction.php.

119 : bool
120 {
121 return $record->getActiveId() !== null && $this->test_access->checkResultsAccessForActiveId(
122 $record->getActiveId(),
123 $this->test_obj->getTestId()
124 );
125 }

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

+ Here is the call graph for this function:

◆ getActionId()

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

◆ getModal()

ILIAS\Test\Participants\ParticipantTableShowResultsAction::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 ParticipantTableShowResultsAction.php.

74 : ?Modal {
75 return null;
76 }

◆ getSelectionErrorMessage()

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

Implements ILIAS\Test\Participants\TableAction.

Definition at line 127 of file ParticipantTableShowResultsAction.php.

127 : ?string
128 {
129 return null;
130 }

◆ getTableAction()

ILIAS\Test\Participants\ParticipantTableShowResultsAction::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 ParticipantTableShowResultsAction.php.

60 : Action {
61 return $this->ui_factory->table()->action()->standard(
62 $this->lng->txt(self::ACTION_ID),
63 $url_builder
64 ->withParameter($action_token, self::ACTION_ID)
65 ->withParameter($action_type_token, ParticipantTableActions::SUBMIT_ACTION),
66 $row_id_token
67 );
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\ParticipantTableShowResultsAction::isAvailable ( )

Implements ILIAS\Test\Participants\TableAction.

Definition at line 49 of file ParticipantTableShowResultsAction.php.

49 : bool
50 {
51 return $this->test_access->checkParticipantsResultsAccess()
52 && $this->test_obj->evalTotalPersons() > 0;
53 }

◆ onSubmit()

ILIAS\Test\Participants\ParticipantTableShowResultsAction::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 78 of file ParticipantTableShowResultsAction.php.

83 : ?Modal {
84 if ($selected_participants === []) {
85 return null;
86 }
87 foreach ($selected_participants as $participant) {
88 if (!$this->test_access->checkResultsAccessForActiveId(
89 $participant->getActiveId(),
90 $this->test_obj->getTestId()
91 )) {
92 $this->tpl->setOnScreenMessage(
94 $this->lng->txt('no_permission'),
95 true
96 );
97 return null;
98 }
99 }
100 $this->ctrl->setParameterByClass(
101 \ilTestEvaluationGUI::class,
102 'active_ids',
103 array_reduce(
104 $selected_participants,
105 static function (string $c, Participant $v): string {
106 if ($c === '') {
107 return (string) $v->getActiveId();
108 }
109 $c .= ",{$v->getActiveId()}";
110 return $c;
111 },
112 ''
113 )
114 );
115
116 $this->ctrl->redirectByClass(\ilTestEvaluationGUI::class, 'showResults');
117 }
$c
Definition: deliver.php:25

Field Documentation

◆ ACTION_ID

const ILIAS\Test\Participants\ParticipantTableShowResultsAction::ACTION_ID = 'show_results'

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