ILIAS  trunk Revision v11.0_alpha-1831-g8615d53dadb
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
ILIAS\Test\Participants\ParticipantTableDeleteResultsAction Class Reference
+ Inheritance diagram for ILIAS\Test\Participants\ParticipantTableDeleteResultsAction:
+ Collaboration diagram for ILIAS\Test\Participants\ParticipantTableDeleteResultsAction:

Public Member Functions

 __construct (private readonly Language $lng, private readonly \ilGlobalTemplateInterface $tpl, private readonly UIFactory $ui_factory, private readonly \ilDBInterface $db, private readonly \ilTestParticipantAccessFilterFactory $participant_access_filter_factory, 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 ()
 

Data Fields

const ACTION_ID = 'delete_results'
 

Private Member Functions

 resolveMessage (bool $all_participants_selected)
 

Detailed Description

Definition at line 31 of file ParticipantTableDeleteResultsAction.php.

Constructor & Destructor Documentation

◆ __construct()

ILIAS\Test\Participants\ParticipantTableDeleteResultsAction::__construct ( private readonly Language  $lng,
private readonly \ilGlobalTemplateInterface  $tpl,
private readonly UIFactory  $ui_factory,
private readonly \ilDBInterface  $db,
private readonly \ilTestParticipantAccessFilterFactory  $participant_access_filter_factory,
private readonly \ilTestAccess  $test_access,
private readonly \ilObjTest  $test_obj 
)

Definition at line 35 of file ParticipantTableDeleteResultsAction.php.

43  {
44  }

Member Function Documentation

◆ allowActionForRecord()

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

Implements ILIAS\Test\Participants\TableAction.

Definition at line 130 of file ParticipantTableDeleteResultsAction.php.

References ILIAS\Test\Participants\Participant\getActiveId(), and null.

130  : bool
131  {
132  return $record->getActiveId() !== null;
133  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
+ Here is the call graph for this function:

◆ getActionId()

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

Implements ILIAS\Test\Participants\TableAction.

Definition at line 46 of file ParticipantTableDeleteResultsAction.php.

46  : string
47  {
48  return self::ACTION_ID;
49  }

◆ getModal()

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

Implements ILIAS\Test\Participants\TableAction.

Definition at line 72 of file ParticipantTableDeleteResultsAction.php.

References ilObjUser\_lookupFullname(), ILIAS\UI\URLBuilder\buildURI(), ILIAS\Test\Participants\Participant\getUserId(), ILIAS\Repository\lng(), and ILIAS\Test\Participants\ParticipantTableDeleteResultsAction\resolveMessage().

76  : ?Modal {
77  return $this->ui_factory->modal()->interruptive(
78  $this->lng->txt('confirm'),
79  $this->resolveMessage($all_participants_selected),
80  $url_builder->buildURI()->__toString()
81  )->withAffectedItems(
82  array_map(
83  fn(Participant $v) => $this->ui_factory->modal()->interruptiveItem()->standard(
84  (string) $v->getUserId(),
85  $this->test_obj->getAnonymity()
86  ? $this->lng->txt('anonymous')
87  : \ilObjUser::_lookupFullname($v->getUserId())
88  ),
89  $selected_participants
90  )
91  );
92  }
static _lookupFullname(int $a_user_id)
+ Here is the call graph for this function:

◆ getSelectionErrorMessage()

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

Implements ILIAS\Test\Participants\TableAction.

Definition at line 144 of file ParticipantTableDeleteResultsAction.php.

References ILIAS\Repository\lng().

144  : ?string
145  {
146  return $this->lng->txt('delete_result_no_valid_participants_selected');
147  }
+ Here is the call graph for this function:

◆ getTableAction()

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

Implements ILIAS\Test\Participants\TableAction.

Definition at line 57 of file ParticipantTableDeleteResultsAction.php.

References ILIAS\Repository\lng(), ILIAS\Test\Participants\ParticipantTableActions\SHOW_ACTION, and ILIAS\UI\URLBuilder\withParameter().

62  : Action {
63  return $this->ui_factory->table()->action()->standard(
64  $this->lng->txt('delete_user_data'),
65  $url_builder
66  ->withParameter($action_token, self::ACTION_ID)
67  ->withParameter($action_type_token, ParticipantTableActions::SHOW_ACTION),
68  $row_id_token
69  )->withAsync();
70  }
+ Here is the call graph for this function:

◆ isAvailable()

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

Implements ILIAS\Test\Participants\TableAction.

Definition at line 51 of file ParticipantTableDeleteResultsAction.php.

51  : bool
52  {
53  return $this->test_access->checkManageParticipantsAccess()
54  && $this->test_obj->evalTotalPersons() > 0;
55  }

◆ onSubmit()

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

References ILIAS\Test\Participants\Participant\getActiveId(), ILIAS\Repository\lng(), ILIAS\UICore\GlobalTemplate\MESSAGE_TYPE_FAILURE, ILIAS\UICore\GlobalTemplate\MESSAGE_TYPE_SUCCESS, and null.

99  : ?Modal {
100  if (!$this->test_access->checkManageParticipantsAccess()) {
101  $this->tpl->setOnScreenMessage(
103  $this->lng->txt('no_permission'),
104  true
105  );
106  return null;
107  }
108 
109  $access_filter = $this->participant_access_filter_factory
110  ->getManageParticipantsUserFilter($this->test_obj->getRefId());
111  $participant_data = new \ilTestParticipantData($this->db, $this->lng);
112  $participant_data->setParticipantAccessFilter($access_filter);
113  $participant_data->setActiveIdsFilter(
114  array_map(
115  static fn(Participant $v): int => $v->getActiveId(),
116  $selected_participants
117  )
118  );
119  $participant_data->load($this->test_obj->getTestId());
120  $this->test_obj->removeTestResults($participant_data);
121 
122  $this->tpl->setOnScreenMessage(
124  $this->lng->txt('tst_selected_user_data_deleted'),
125  true
126  );
127  return null;
128  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
+ Here is the call graph for this function:

◆ resolveMessage()

ILIAS\Test\Participants\ParticipantTableDeleteResultsAction::resolveMessage ( bool  $all_participants_selected)
private

Definition at line 135 of file ParticipantTableDeleteResultsAction.php.

References ILIAS\Repository\lng().

Referenced by ILIAS\Test\Participants\ParticipantTableDeleteResultsAction\getModal().

135  : string
136  {
137  if ($all_participants_selected) {
138  return $this->lng->txt('delete_all_user_data_confirmation');
139  }
140 
141  return $this->lng->txt('delete_selected_user_data_confirmation');
142  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ ACTION_ID

const ILIAS\Test\Participants\ParticipantTableDeleteResultsAction::ACTION_ID = 'delete_results'

Definition at line 33 of file ParticipantTableDeleteResultsAction.php.


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