ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ilTestParticipantsGUI Class Reference

Class ilTestParticipantsGUI. More...

+ Collaboration diagram for ilTestParticipantsGUI:

Public Member Functions

 __construct (protected ilObjTest $test_obj, protected readonly ilObjUser $current_user, protected readonly ilTestObjectiveOrientedContainer $objective_parent, protected readonly ilTestQuestionSetConfig $question_set_config, protected ilAccess $access, protected ilTestAccess $test_access, protected ilGlobalTemplateInterface $main_tpl, protected UIFactory $ui_factory, protected UIRenderer $ui_renderer, protected ilUIService $ui_service, protected DataFactory $data_factory, protected ilLanguage $lng, protected ilCtrlInterface $ctrl, protected Refinery $refinery, protected ilDBInterface $db, protected TabsManager $tabs_manager, protected ilToolbarGUI $toolbar, protected ilComponentFactory $component_factory, protected ExportImportFactory $export_factory, protected RequestDataCollector $testrequest, protected ResponseHandler $response_handler, protected ParticipantRepository $participant_repository, protected readonly ResultsDataFactory $results_data_factory, protected readonly ResultsPresentationFactory $results_presentation_factory, protected readonly TestResultRepository $test_pass_result_repository)
 
 executeCommand ()
 
 addParticipants ($user_ids=[])
 
 showCmd (?Modal $modal=null)
 
 executeTableActionCmd ()
 
 exportResultsCmd ()
 

Data Fields

const CMD_SHOW = 'show'
 
const CALLBACK_ADD_PARTICIPANT = 'addParticipants'
 

Protected Member Functions

 addUserSearchControls (ilToolbarGUI $toolbar)
 

Protected Attributes

ilTestParticipantAccessFilterFactory $participant_access_filter
 

Private Member Functions

 getParticipantTable ()
 
 getTableActionUrlBuilder ()
 
 addExportDropdown (ilToolbarGUI $toolbar)
 
 buildOptionsForTestWithNames ()
 
 addCertificateExportToOptions (array $options)
 
 addPluginExportsToOptions (array $options)
 
 buildParticipantTableActions ()
 

Private Attributes

const EXPORT_TYPE_PARAMETER = 'export_type'
 
const EXPORT_PLUGIN_TYPE_PARAMETER = 'export_plugin_type'
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilTestParticipantsGUI::__construct ( protected ilObjTest  $test_obj,
protected readonly ilObjUser  $current_user,
protected readonly ilTestObjectiveOrientedContainer  $objective_parent,
protected readonly ilTestQuestionSetConfig  $question_set_config,
protected ilAccess  $access,
protected ilTestAccess  $test_access,
protected ilGlobalTemplateInterface  $main_tpl,
protected UIFactory  $ui_factory,
protected UIRenderer  $ui_renderer,
protected ilUIService  $ui_service,
protected DataFactory  $data_factory,
protected ilLanguage  $lng,
protected ilCtrlInterface  $ctrl,
protected Refinery  $refinery,
protected ilDBInterface  $db,
protected TabsManager  $tabs_manager,
protected ilToolbarGUI  $toolbar,
protected ilComponentFactory  $component_factory,
protected ExportImportFactory  $export_factory,
protected RequestDataCollector  $testrequest,
protected ResponseHandler  $response_handler,
protected ParticipantRepository  $participant_repository,
protected readonly ResultsDataFactory  $results_data_factory,
protected readonly ResultsPresentationFactory  $results_presentation_factory,
protected readonly TestResultRepository  $test_pass_result_repository 
)

Definition at line 63 of file class.ilTestParticipantsGUI.php.

89 {
90 $this->participant_access_filter = new ilTestParticipantAccessFilterFactory($access);
91 }

Member Function Documentation

◆ addCertificateExportToOptions()

ilTestParticipantsGUI::addCertificateExportToOptions ( array  $options)
private
Parameters
array<

ILIAS\UI\Component\Button\Shy> $options

Returns
array<\ILIAS\UI\Component\Button\Shy>

Definition at line 266 of file class.ilTestParticipantsGUI.php.

266 : array
267 {
268 try {
269 if ((new ilCertificateActiveValidator())->validate()) {
270 $this->ctrl->setParameterByClass(self::class, self::EXPORT_TYPE_PARAMETER, ExportImportTypes::CERTIFICATE_ARCHIVE->value);
271 $options[] = $this->ui_factory->button()->shy(
272 $this->lng->txt('exp_grammar_as') . ' ' . $this->lng->txt('exp_type_certificate'),
273 $this->ctrl->getLinkTargetByClass(self::class, 'exportResults')
274 );
275 }
276 } catch (ilException $e) {
277 }
278 return $options;
279 }
Base class for ILIAS Exception handling.

References Vendor\Package\$e, ILIAS\Repository\ctrl(), and ILIAS\Repository\lng().

Referenced by buildOptionsForTestWithNames().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ addExportDropdown()

ilTestParticipantsGUI::addExportDropdown ( ilToolbarGUI  $toolbar)
private

Definition at line 227 of file class.ilTestParticipantsGUI.php.

227 : void
228 {
229 if ($this->test_access->checkManageParticipantsAccess()) {
230 $toolbar->addSeparator();
231 }
232
233 $this->ctrl->clearParameterByClass(self::class, 'export_type');
234 $toolbar->addComponent(
235 $this->ui_factory->dropdown()->standard(
236 $this->buildOptionsForTestWithNames()
237 )->withLabel($this->lng->txt('exp_eval_data'))
238 );
239 }
addComponent(\ILIAS\UI\Component\Component $a_comp)

References ilToolbarGUI\addComponent(), ilToolbarGUI\addSeparator(), and ILIAS\Repository\ctrl().

Referenced by showCmd().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ addParticipants()

ilTestParticipantsGUI::addParticipants (   $user_ids = [])

Definition at line 120 of file class.ilTestParticipantsGUI.php.

120 : ?bool
121 {
122 $filter_closure = $this->participant_access_filter->getManageParticipantsUserFilter($this->test_obj->getRefId());
123 $filtered_user_ids = $filter_closure($user_ids);
124
125 $users_count = 0;
126 $client_ips = $this->testrequest->retrieveArrayOfStringsFromPost('client_ip');
127 foreach ($filtered_user_ids as $user_id) {
128 $this->test_obj->inviteUser($user_id, $client_ips[$users_count] ?? '');
129 $users_count++;
130 }
131
132 $message = '';
133 if ($users_count > 0) {
134 $message = $this->lng->txt('tst_invited_selected_users');
135 }
136 if ($message !== '') {
137 $this->main_tpl->setOnScreenMessage('info', $message, true);
138 } else {
139 $this->main_tpl->setOnScreenMessage('info', $this->lng->txt('tst_invited_nobody'), true);
140 return false;
141 }
142
143 $this->ctrl->redirectByClass(self::class, self::CMD_SHOW);
144 }
$message
Definition: xapiexit.php:31

References $message, $user_id, ILIAS\Repository\ctrl(), and ILIAS\Repository\lng().

+ Here is the call graph for this function:

◆ addPluginExportsToOptions()

ilTestParticipantsGUI::addPluginExportsToOptions ( array  $options)
private
Parameters
array<

ILIAS\UI\Component\Button\Shy> $options

Returns
array<\ILIAS\UI\Component\Button\Shy>

Definition at line 285 of file class.ilTestParticipantsGUI.php.

285 : array
286 {
287 foreach ($this->component_factory->getActivePluginsInSlot('texp') as $plugin) {
288 $plugin->setTest($this->test_obj);
289 $this->ctrl->setParameterByClass(self::class, self::EXPORT_TYPE_PARAMETER, ExportImportTypes::PLUGIN->value);
290 $this->ctrl->setParameterByClass(self::class, self::EXPORT_PLUGIN_TYPE_PARAMETER, $plugin->getFormat());
291 $options[] = $this->ui_factory->button()->shy(
292 $plugin->getFormatLabel(),
293 $this->ctrl->getLinkTargetByClass(self::class, 'exportResults')
294 );
295 }
296 $this->ctrl->clearParameterByClass(self::class, self::EXPORT_PLUGIN_TYPE_PARAMETER);
297 return $options;
298 }

References XapiProxy\$plugin, ILIAS\Repository\ctrl(), and ILIAS\Test\ExportImport\PLUGIN.

Referenced by buildOptionsForTestWithNames().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ addUserSearchControls()

ilTestParticipantsGUI::addUserSearchControls ( ilToolbarGUI  $toolbar)
protected

Definition at line 205 of file class.ilTestParticipantsGUI.php.

205 : void
206 {
207 if (!$this->test_access->checkManageParticipantsAccess()) {
208 return;
209 }
211 $this,
212 $toolbar,
213 [
214 'auto_complete_name' => $this->lng->txt('user'),
215 'submit_name' => $this->lng->txt('add')
216 ]
217 );
218 $toolbar->addSeparator();
219
220 $search_btn = $this->ui_factory->button()->standard(
221 $this->lng->txt('tst_search_users'),
222 $this->ctrl->getLinkTargetByClass('ilRepositorySearchGUI', 'start')
223 );
224 $toolbar->addComponent($search_btn);
225 }
static fillAutoCompleteToolbar(object $parent_object, ?ilToolbarGUI $toolbar=null, array $a_options=[], bool $a_sticky=false)
array( auto_complete_name = $lng->txt('user'), auto_complete_size = 15, user_type = array(ilCoursePar...

References ilToolbarGUI\addComponent(), ilToolbarGUI\addSeparator(), ilRepositorySearchGUI\fillAutoCompleteToolbar(), and ILIAS\Repository\lng().

Referenced by showCmd().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ buildOptionsForTestWithNames()

ilTestParticipantsGUI::buildOptionsForTestWithNames ( )
private
Returns
array<\ILIAS\UI\Component\Button\Shy>

Definition at line 244 of file class.ilTestParticipantsGUI.php.

244 : array
245 {
246 $this->ctrl->setParameterByClass(self::class, self::EXPORT_TYPE_PARAMETER, ExportImportTypes::SCORED_ATTEMPT->value);
247 $options = [
248 $this->ui_factory->button()->shy(
249 $this->lng->txt('exp_scored_test_attempt'),
250 $this->ctrl->getLinkTargetByClass(self::class, 'exportResults')
251 )
252 ];
253 $this->ctrl->setParameterByClass(self::class, self::EXPORT_TYPE_PARAMETER, ExportImportTypes::ALL_ATTEMPTS->value);
254 $options[] = $this->ui_factory->button()->shy(
255 $this->lng->txt('exp_all_test_runs'),
256 $this->ctrl->getLinkTargetByClass(self::class, 'exportResults')
257 );
258 $options = $this->addPluginExportsToOptions($options);
259 return $this->addCertificateExportToOptions($options);
260 }

References addCertificateExportToOptions(), addPluginExportsToOptions(), ILIAS\Repository\ctrl(), and ILIAS\Repository\lng().

+ Here is the call graph for this function:

◆ buildParticipantTableActions()

ilTestParticipantsGUI::buildParticipantTableActions ( )
private

Definition at line 325 of file class.ilTestParticipantsGUI.php.

326 {
327 return new ParticipantTableActions(
328 $this->ctrl,
329 $this->lng,
330 $this->main_tpl,
331 $this->ui_factory,
332 $this->ui_renderer,
333 $this->refinery,
334 $this->testrequest,
335 $this->response_handler,
336 $this->participant_repository,
337 $this->test_obj,
338 [
339 ParticipantTableShowResultsAction::ACTION_ID => new ParticipantTableShowResultsAction(
340 $this->lng,
341 $this->ui_factory,
342 $this->test_access,
343 $this->ctrl,
344 $this->test_obj
345 ),
346 ParticipantTableDeleteResultsAction::ACTION_ID => new ParticipantTableDeleteResultsAction(
347 $this->lng,
348 $this->main_tpl,
349 $this->ui_factory,
350 $this->db,
351 $this->participant_access_filter,
352 $this->test_access,
353 $this->test_obj
354 ),
355 ParticipantTableFinishTestAction::ACTION_ID => new ParticipantTableFinishTestAction(
356 $this->lng,
357 $this->main_tpl,
358 $this->ui_factory,
359 $this->db,
361 new \ilSetting('assessment'),
362 $this->db
363 ),
364 $this->current_user,
365 $this->test_access,
366 $this->test_obj,
367 $this->test_pass_result_repository
368 ),
369 ParticipantTableIpRangeAction::ACTION_ID => new ParticipantTableIpRangeAction(
370 $this->lng,
371 $this->main_tpl,
372 $this->ui_factory,
373 $this->refinery,
374 $this->participant_repository,
375 $this->test_access
376 ),
377 ParticipantTableExtraTimeAction::ACTION_ID => new ParticipantTableExtraTimeAction(
378 $this->lng,
379 $this->refinery,
380 $this->main_tpl,
381 $this->ui_factory,
382 $this->participant_repository,
383 $this->current_user,
384 $this->test_access,
385 $this->test_obj
386 ),
387 ParticipantTableDeleteParticipantAction::ACTION_ID => new ParticipantTableDeleteParticipantAction(
388 $this->lng,
389 $this->main_tpl,
390 $this->ui_factory,
391 $this->participant_repository,
392 $this->test_access,
393 $this->test_obj
394 )
395 ]
396 );
397 }
ILIAS Setting Class.

References ILIAS\Repository\ctrl(), ILIAS\Repository\lng(), and ILIAS\Repository\refinery().

+ Here is the call graph for this function:

◆ executeCommand()

ilTestParticipantsGUI::executeCommand ( )

Definition at line 93 of file class.ilTestParticipantsGUI.php.

93 : void
94 {
95 if (!$this->test_access->checkManageParticipantsAccess()
96 && !$this->test_access->checkParticipantsResultsAccess()) {
97 ilObjTestGUI::accessViolationRedirect();
98 }
99 switch ($this->ctrl->getNextClass($this)) {
100 case 'ilrepositorysearchgui':
101 $gui = new ilRepositorySearchGUI();
102 $gui->setCallback($this, self::CALLBACK_ADD_PARTICIPANT, []);
103
104 $gui->addUserAccessFilterCallable($this->participant_access_filter->getManageParticipantsUserFilter(
105 $this->test_obj->getRefId()
106 ));
107
108
109 $this->ctrl->setReturnByClass(self::class, self::CMD_SHOW);
110 $this->ctrl->forwardCommand($gui);
111
112 break;
113
114 default:
115 $command = $this->ctrl->getCmd(self::CMD_SHOW) . 'Cmd';
116 $this->{$command}();
117 }
118 }

References ILIAS\Repository\ctrl().

+ Here is the call graph for this function:

◆ executeTableActionCmd()

ilTestParticipantsGUI::executeTableActionCmd ( )

Definition at line 168 of file class.ilTestParticipantsGUI.php.

168 : void
169 {
170 $modal = $this->getParticipantTable()->execute($this->getTableActionUrlBuilder());
171 if ($modal !== null) {
172 $this->showCmd($modal);
173 return;
174 }
175 $this->ctrl->redirectByClass(self::class, self::CMD_SHOW);
176 }

References ILIAS\Repository\ctrl(), getParticipantTable(), getTableActionUrlBuilder(), and showCmd().

+ Here is the call graph for this function:

◆ exportResultsCmd()

ilTestParticipantsGUI::exportResultsCmd ( )

Definition at line 300 of file class.ilTestParticipantsGUI.php.

300 : void
301 {
302 $export_type = ExportImportTypes::tryFrom(
303 $this->testrequest->strVal(self::EXPORT_TYPE_PARAMETER)
304 );
305
306 if ($export_type === null) {
307 $this->main_tpl->setOnScreenMessage('failure', $this->lng->txt('error'));
308 $this->showCmd();
309 return;
310 }
311
312 $plugin_type = null;
313 if ($export_type === ExportImportTypes::PLUGIN) {
314 $plugin_type = $this->testrequest->strVal(self::EXPORT_PLUGIN_TYPE_PARAMETER);
315 }
316
317 $this->export_factory->getExporter(
318 $this->test_obj,
319 $export_type,
320 $plugin_type
321 )->deliver();
322 $this->showCmd();
323 }

References ILIAS\Repository\lng(), ILIAS\Test\ExportImport\PLUGIN, and showCmd().

+ Here is the call graph for this function:

◆ getParticipantTable()

ilTestParticipantsGUI::getParticipantTable ( )
private

Definition at line 178 of file class.ilTestParticipantsGUI.php.

179 {
180 return new ParticipantTable(
181 $this->ui_factory,
182 $this->ui_service,
183 $this->lng,
184 $this->test_access,
185 $this->testrequest,
186 $this->participant_access_filter,
187 $this->participant_repository,
188 $this->results_data_factory,
189 $this->results_presentation_factory->getAttemptResultsSettings(
190 $this->test_obj,
191 false
192 ),
193 $this->current_user,
194 $this->test_obj,
195 $this->buildParticipantTableActions()
196 );
197 }

References ILIAS\Repository\lng().

Referenced by executeTableActionCmd(), and showCmd().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getTableActionUrlBuilder()

ilTestParticipantsGUI::getTableActionUrlBuilder ( )
private

Definition at line 199 of file class.ilTestParticipantsGUI.php.

199 : URLBuilder
200 {
201 $uri = $this->ctrl->getLinkTargetByClass(self::class, 'executeTableAction', '', true);
202 return new URLBuilder($this->data_factory->uri(ILIAS_HTTP_PATH . '/' . $uri));
203 }

References ILIAS\Repository\ctrl().

Referenced by executeTableActionCmd(), and showCmd().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ showCmd()

ilTestParticipantsGUI::showCmd ( ?Modal  $modal = null)

Definition at line 146 of file class.ilTestParticipantsGUI.php.

146 : void
147 {
148 $this->addUserSearchControls($this->toolbar);
149
150 if ($this->test_obj->evalTotalPersons() > 0) {
151 $this->addExportDropdown($this->toolbar);
152 }
153
154 $components = $this->getParticipantTable()->getComponents(
156 $this->ctrl->getLinkTargetByClass(self::class, 'show')
157 );
158
159 if ($modal !== null) {
160 $components[] = $modal;
161 }
162
163 $this->main_tpl->setContent(
164 $this->ui_renderer->render($components)
165 );
166 }
$components
addUserSearchControls(ilToolbarGUI $toolbar)
addExportDropdown(ilToolbarGUI $toolbar)

References $components, addExportDropdown(), addUserSearchControls(), ILIAS\Repository\ctrl(), getParticipantTable(), getTableActionUrlBuilder(), and ILIAS\Repository\toolbar().

Referenced by executeTableActionCmd(), and exportResultsCmd().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ $participant_access_filter

ilTestParticipantAccessFilterFactory ilTestParticipantsGUI::$participant_access_filter
protected

Definition at line 61 of file class.ilTestParticipantsGUI.php.

◆ CALLBACK_ADD_PARTICIPANT

const ilTestParticipantsGUI::CALLBACK_ADD_PARTICIPANT = 'addParticipants'

Definition at line 56 of file class.ilTestParticipantsGUI.php.

◆ CMD_SHOW

const ilTestParticipantsGUI::CMD_SHOW = 'show'

Definition at line 54 of file class.ilTestParticipantsGUI.php.

◆ EXPORT_PLUGIN_TYPE_PARAMETER

const ilTestParticipantsGUI::EXPORT_PLUGIN_TYPE_PARAMETER = 'export_plugin_type'
private

Definition at line 59 of file class.ilTestParticipantsGUI.php.

◆ EXPORT_TYPE_PARAMETER

const ilTestParticipantsGUI::EXPORT_TYPE_PARAMETER = 'export_type'
private

Definition at line 58 of file class.ilTestParticipantsGUI.php.


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