ILIAS  trunk Revision v13.0_alpha-62-g3b72d83f2e5
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 283 of file class.ilTestParticipantsGUI.php.

283 : array
284 {
285 try {
286 if ((new ilCertificateActiveValidator())->validate()) {
287 $this->ctrl->setParameterByClass(self::class, self::EXPORT_TYPE_PARAMETER, ExportImportTypes::CERTIFICATE_ARCHIVE->value);
288 $options[] = $this->ui_factory->button()->shy(
289 $this->lng->txt('exp_grammar_as') . ' ' . $this->lng->txt('exp_type_certificate'),
290 $this->ctrl->getLinkTargetByClass(self::class, 'exportResults')
291 );
292 }
293 } catch (ilException $e) {
294 }
295 return $options;
296 }
Base class for ILIAS Exception handling.

References Vendor\Package\$e, ILIAS\UI\Implementation\Component\Input\Field\$options, 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 244 of file class.ilTestParticipantsGUI.php.

244 : void
245 {
246 if ($this->test_access->checkManageParticipantsAccess()) {
247 $toolbar->addSeparator();
248 }
249
250 $this->ctrl->clearParameterByClass(self::class, 'export_type');
251 $toolbar->addComponent(
252 $this->ui_factory->dropdown()->standard(
253 $this->buildOptionsForTestWithNames()
254 )->withLabel($this->lng->txt('exp_eval_data'))
255 );
256 }
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 }

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 302 of file class.ilTestParticipantsGUI.php.

302 : array
303 {
304 foreach ($this->component_factory->getActivePluginsInSlot('texp') as $plugin) {
305 $plugin->setTest($this->test_obj);
306 $this->ctrl->setParameterByClass(self::class, self::EXPORT_TYPE_PARAMETER, ExportImportTypes::PLUGIN->value);
307 $this->ctrl->setParameterByClass(self::class, self::EXPORT_PLUGIN_TYPE_PARAMETER, $plugin->getFormat());
308 $options[] = $this->ui_factory->button()->shy(
309 $plugin->getFormatLabel(),
310 $this->ctrl->getLinkTargetByClass(self::class, 'exportResults')
311 );
312 }
313 $this->ctrl->clearParameterByClass(self::class, self::EXPORT_PLUGIN_TYPE_PARAMETER);
314 return $options;
315 }

References ILIAS\UI\Implementation\Component\Input\Field\$options, 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 222 of file class.ilTestParticipantsGUI.php.

222 : void
223 {
224 if (!$this->test_access->checkManageParticipantsAccess()) {
225 return;
226 }
228 $this,
229 $toolbar,
230 [
231 'auto_complete_name' => $this->lng->txt('user'),
232 'submit_name' => $this->lng->txt('add')
233 ]
234 );
235 $toolbar->addSeparator();
236
237 $search_btn = $this->ui_factory->button()->standard(
238 $this->lng->txt('tst_search_users'),
239 $this->ctrl->getLinkTargetByClass('ilRepositorySearchGUI', 'start')
240 );
241 $toolbar->addComponent($search_btn);
242 }
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 261 of file class.ilTestParticipantsGUI.php.

261 : array
262 {
263 $this->ctrl->setParameterByClass(self::class, self::EXPORT_TYPE_PARAMETER, ExportImportTypes::SCORED_ATTEMPT->value);
264 $options = [
265 $this->ui_factory->button()->shy(
266 $this->lng->txt('exp_scored_test_attempt'),
267 $this->ctrl->getLinkTargetByClass(self::class, 'exportResults')
268 )
269 ];
270 $this->ctrl->setParameterByClass(self::class, self::EXPORT_TYPE_PARAMETER, ExportImportTypes::ALL_ATTEMPTS->value);
271 $options[] = $this->ui_factory->button()->shy(
272 $this->lng->txt('exp_all_test_runs'),
273 $this->ctrl->getLinkTargetByClass(self::class, 'exportResults')
274 );
277 }

References ILIAS\UI\Implementation\Component\Input\Field\$options, addCertificateExportToOptions(), addPluginExportsToOptions(), ILIAS\Repository\ctrl(), and ILIAS\Repository\lng().

+ Here is the call graph for this function:

◆ buildParticipantTableActions()

ilTestParticipantsGUI::buildParticipantTableActions ( )
private

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

343 {
344 return new ParticipantTableActions(
345 $this->ctrl,
346 $this->lng,
347 $this->main_tpl,
348 $this->ui_factory,
349 $this->ui_renderer,
350 $this->refinery,
351 $this->testrequest,
352 $this->response_handler,
353 $this->participant_repository,
354 $this->test_obj,
355 [
356 ParticipantTableShowResultsAction::ACTION_ID => new ParticipantTableShowResultsAction(
357 $this->lng,
358 $this->ui_factory,
359 $this->test_access,
360 $this->ctrl,
361 $this->test_obj
362 ),
363 ParticipantTableDeleteResultsAction::ACTION_ID => new ParticipantTableDeleteResultsAction(
364 $this->lng,
365 $this->main_tpl,
366 $this->ui_factory,
367 $this->db,
368 $this->participant_access_filter,
369 $this->test_access,
370 $this->test_obj
371 ),
372 ParticipantTableFinishTestAction::ACTION_ID => new ParticipantTableFinishTestAction(
373 $this->lng,
374 $this->main_tpl,
375 $this->ui_factory,
376 $this->db,
378 new \ilSetting('assessment'),
379 $this->db,
380 $this->test_obj->getTestLogger()
381 ),
382 $this->current_user,
383 $this->test_access,
384 $this->test_obj,
385 $this->test_pass_result_repository
386 ),
387 ParticipantTableIpRangeAction::ACTION_ID => new ParticipantTableIpRangeAction(
388 $this->lng,
389 $this->main_tpl,
390 $this->ui_factory,
391 $this->refinery,
392 $this->participant_repository,
393 $this->test_access
394 ),
395 ParticipantTableExtraTimeAction::ACTION_ID => new ParticipantTableExtraTimeAction(
396 $this->lng,
397 $this->refinery,
398 $this->main_tpl,
399 $this->ui_factory,
400 $this->participant_repository,
401 $this->current_user,
402 $this->test_access,
403 $this->test_obj
404 ),
405 ParticipantTableDeleteParticipantAction::ACTION_ID => new ParticipantTableDeleteParticipantAction(
406 $this->lng,
407 $this->main_tpl,
408 $this->ui_factory,
409 $this->participant_repository,
410 $this->test_access,
411 $this->test_obj
412 )
413 ]
414 );
415 }
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 185 of file class.ilTestParticipantsGUI.php.

185 : void
186 {
187 $modal = $this->getParticipantTable()->execute($this->getTableActionUrlBuilder());
188 if ($modal !== null) {
189 $this->showCmd($modal);
190 return;
191 }
192 $this->ctrl->redirectByClass(self::class, self::CMD_SHOW);
193 }

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

+ Here is the call graph for this function:

◆ exportResultsCmd()

ilTestParticipantsGUI::exportResultsCmd ( )

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

317 : void
318 {
319 $export_type = ExportImportTypes::tryFrom(
320 $this->testrequest->strVal(self::EXPORT_TYPE_PARAMETER)
321 );
322
323 if ($export_type === null) {
324 $this->main_tpl->setOnScreenMessage('failure', $this->lng->txt('error'));
325 $this->showCmd();
326 return;
327 }
328
329 $plugin_type = null;
330 if ($export_type === ExportImportTypes::PLUGIN) {
331 $plugin_type = $this->testrequest->strVal(self::EXPORT_PLUGIN_TYPE_PARAMETER);
332 }
333
334 $this->export_factory->getExporter(
335 $this->test_obj,
336 $export_type,
337 $plugin_type
338 )->deliver();
339 $this->showCmd();
340 }

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 195 of file class.ilTestParticipantsGUI.php.

196 {
197 return new ParticipantTable(
198 $this->ui_factory,
199 $this->ui_service,
200 $this->lng,
201 $this->test_access,
202 $this->testrequest,
203 $this->participant_access_filter,
204 $this->participant_repository,
205 $this->results_data_factory,
206 $this->results_presentation_factory->getAttemptResultsSettings(
207 $this->test_obj,
208 false
209 ),
210 $this->current_user,
211 $this->test_obj,
212 $this->buildParticipantTableActions()
213 );
214 }

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 216 of file class.ilTestParticipantsGUI.php.

216 : URLBuilder
217 {
218 $uri = $this->ctrl->getLinkTargetByClass(self::class, 'executeTableAction', '', true);
219 return new URLBuilder($this->data_factory->uri(ILIAS_HTTP_PATH . '/' . $uri));
220 }

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 $tpl = new ilTemplate(
164 'tpl.il_as_tst_participants.html',
165 true,
166 true,
167 'components/ILIAS/Test'
168 );
169
171 'TITLE',
172 $this->lng->txt('list_of_participants')
173 );
174
176 'CONTENT',
177 $this->ui_renderer->render($components)
178 );
179
180 $this->main_tpl->setContent(
181 $tpl->get()
182 );
183 }
$components
special template class to simplify handling of ITX/PEAR
addUserSearchControls(ilToolbarGUI $toolbar)
addExportDropdown(ilToolbarGUI $toolbar)
setVariable(string $variable, $value='')
Sets the given variable to the given value.
get(string $part=self::DEFAULT_BLOCK)
Renders the given block and returns the html string.
readonly ilGlobalTemplateInterface $tpl

References $components, ILIAS\News\Common\Table\$tpl, addExportDropdown(), addUserSearchControls(), ILIAS\Repository\ctrl(), ILIAS\UICore\GlobalTemplate\get(), getParticipantTable(), getTableActionUrlBuilder(), ILIAS\Repository\lng(), ILIAS\UICore\GlobalTemplate\setVariable(), 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: