ILIAS  trunk Revision v12.0_alpha-1329-g1094ddb0c33
class.ilObjTestGUI.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
23use ILIAS\Test\Results\Data\Repository as TestResultRepository;
48use ILIAS\Test\Questions\Properties\Repository as TestQuestionsRepository;
59use ILIAS\Test\Results\Data\Factory as ResultsDataFactory;
60use ILIAS\Test\Results\Presentation\Factory as ResultsPresentationFactory;
62use ILIAS\Test\ExportImport\Factory as ExportImportFactory;
63use ILIAS\Test\ExportImport\DBRepository as ExportRepository;
65use ILIAS\TestQuestionPool\RequestDataCollector as QPLRequestDataCollector;
67use ILIAS\Data\Factory as DataFactory;
75use ILIAS\GlobalScreen\Services as GlobalScreen;
80use ILIAS\Taxonomy\DomainService as TaxonomyService;
81use ILIAS\Style\Content\Service as ContentStyle;
84
127{
129
130 public const SHOW_QUESTIONS_CMD = 'showQuestions';
131 private const SHOW_LOGS_CMD = 'history';
132
136
140 private ExportImportFactory $export_factory;
141 private ExportRepository $export_repository;
142 private TestQuestionsRepository $test_questions_repository;
146 private QPLRequestDataCollector $qplrequest;
148 protected ?TabsManager $tabs_manager = null;
156 private ContentStyle $content_style;
157 protected ilHelpGUI $help;
158 protected GlobalScreen $global_screen;
161 protected IRSS $irss;
166 protected ResultsDataFactory $results_data_factory;
167 protected ResultsPresentationFactory $results_presentation_factory;
168 protected TestResultRepository $test_pass_result_repository;
179 protected DataFactory $data_factory;
180 protected TaxonomyService $taxonomy;
183
184 protected bool $create_question_mode;
185
191 public function __construct()
192 {
194 global $DIC;
195 $this->navigation_history = $DIC['ilNavigationHistory'];
196 $this->component_repository = $DIC['component.repository'];
197 $this->component_factory = $DIC['component.factory'];
198 $this->ui_service = $DIC->uiService();
199 $this->error = $DIC['ilErr'];
200 $this->db = $DIC['ilDB'];
201 $this->help = $DIC['ilHelp'];
202 $this->global_screen = $DIC['global_screen'];
203 $this->obj_data_cache = $DIC['ilObjDataCache'];
204 $this->irss = $DIC['resource_storage'];
205 $this->skills_service = $DIC->skills();
206 $this->archives = $DIC->archives();
207 $this->type = 'tst';
208 $this->data_factory = new DataFactory();
209 $this->taxonomy = $DIC->taxonomy()->domain();
210 $this->ui_service = $DIC->uiService();
211 $this->content_style = $DIC->contentStyle();
212 $this->skill_usage_service = $DIC->skills()->usage();
213
214 $local_dic = TestDIC::dic();
215 $this->questionrepository = $local_dic['question.general_properties.repository'];
216 $this->test_questions_repository = $local_dic['questions.properties.repository'];
217 $this->qplrequest = $local_dic['question.request_data_wrapper'];
218 $this->title_builder = $local_dic['title_columns_builder'];
219 $this->testrequest = $local_dic['request_data_collector'];
220 $this->response_handler = $local_dic['response_handler'];
221 $this->participant_repository = $local_dic['participant.repository'];
222 $this->results_data_factory = $local_dic['results.data.factory'];
223 $this->results_presentation_factory = $local_dic['results.presentation.factory'];
224 $this->export_factory = $local_dic['exportimport.factory'];
225 $this->export_repository = $local_dic['exportimport.repository'];
226 $this->participant_access_filter_factory = $local_dic['participant.access_filter.factory'];
227 $this->test_pass_result_repository = $local_dic['results.data.repository'];
228 $this->toplist_repository = $local_dic['results.toplist.repository'];
229 $this->personal_settings_templates_repository = $local_dic['settings.personal_templates.repository'];
230 $this->main_settings_repository = $local_dic['settings.main.repository'];
231 $this->score_settings_repository = $local_dic['settings.scoring.repository'];
232 $this->marks_repository = $local_dic['marks.repository'];
233 $this->settings_factory = $local_dic['settings.factory'];
234 $this->mark_schema_factory = $local_dic['marks.factory'];
235 $this->additional_information_generator = $local_dic['logging.information_generator'];
236 $this->personal_settings_exporter = $local_dic['settings.personal_templates.exporter'];
237
238 $ref_id = 0;
239 if ($this->testrequest->hasRefId() && is_numeric($this->testrequest->getRefId())) {
240 $ref_id = $this->testrequest->getRefId();
241 }
242
243 try {
244 parent::__construct("", $ref_id, true, false);
245 } catch (SettingsNotFoundException $e) {
246 $this->object = null;
247 }
248
249 $this->ctrl->saveParameter($this, ['ref_id', 'test_ref_id']);
250
251 $this->lng->loadLanguageModule('assessment');
252
253 $this->objective_oriented_container = new ilTestObjectiveOrientedContainer();
254
255 if (!($this->object instanceof ilObjTest)) {
256 $this->setCreationMode(true);
257 return;
258 }
259
260 $this->test_question_set_config_factory = new ilTestQuestionSetConfigFactory(
261 $this->tree,
262 $this->db,
263 $this->lng,
264 $this->getTestObject()->getTestlogger(),
265 $this->component_repository,
266 $this->getTestObject(),
267 $this->questionrepository
268 );
269
270 $this->test_player_factory = new ilTestPlayerFactory($this->getTestObject());
271 $this->test_session_factory = new ilTestSessionFactory($this->getTestObject(), $this->db, $this->user);
272 $this->setTestAccess(new ilTestAccess($this->ref_id, $this->getTestObject()->getTestId()));
273
274 $this->tabs_manager = new TabsManager(
275 $this->tabs_gui,
276 $this->lng,
277 $this->ctrl,
278 $this->access,
279 $this->test_access,
280 $this->getTestObject(),
281 $this->objective_oriented_container,
282 $this->test_session_factory->getSession()
283 );
284
285 $this->gui_factory = $local_dic['gui.factory'];
286 }
287
291 public function executeCommand(): void
292 {
293 if ($this->object === null) {
294 $this->error->raiseError($this->lng->txt('tst_settings_not_found_msg'), $this->error->MESSAGE);
295 return;
296 }
297
298 $cmd = $this->ctrl->getCmd('testScreen');
299
300 $cmds_disabled_due_to_offline_status = [
301 'resumePlayer', 'resumePlayer', 'outUserResultsOverview', 'outUserListOfAnswerPasses'
302 ];
303
304 if (!$this->getCreationMode() && $this->object->getOfflineStatus() && in_array($cmd, $cmds_disabled_due_to_offline_status)) {
305 $cmd = 'infoScreen';
306 }
307
308 $next_class = $this->ctrl->getNextClass($this);
309
310 // add entry to navigation history
311 if (!$this->getCreationMode() &&
312 $this->access->checkAccess('read', '', $this->testrequest->getRefId())
313 ) {
314 $this->navigation_history->addItem(
315 $this->testrequest->getRefId(),
316 ilLink::_getLink($this->testrequest->getRefId(), 'tst'),
317 'tst',
318 );
319 }
320
322
323 switch ($next_class) {
324 case 'illtiproviderobjectsettinggui':
325 if ((!$this->access->checkAccess("read", "", $this->testrequest->getRefId()))) {
327 }
328 $this->prepareOutput();
329 $this->addHeaderAction();
330 $this->tabs_manager->getSettingsSubTabs();
331 $this->tabs_manager->activateTab('settings');
332 $this->tabs_manager->activateSubTab('lti_provider');
333 $lti_gui = new ilLTIProviderObjectSettingGUI($this->getTestObject()->getRefId());
334 $lti_gui->setCustomRolesForSelection($this->rbac_review->getLocalRoles($this->getTestObject()->getRefId()));
335 $lti_gui->offerLTIRolesForSelection(false);
336 $this->ctrl->forwardCommand($lti_gui);
337 break;
338
339 case 'iltestexportgui':
340 if (!$this->access->checkAccess('write', '', $this->ref_id)) {
342 }
343
344 $this->prepareOutput();
345 $this->addHeaderAction();
346 $this->tabs_manager->activateTab(TabsManager::TAB_ID_EXPORT);
347
348 $selected_files = [];
349 if ($this->testrequest->isset('file') && $this->testrequest->raw('file')) {
350 $selected_files = $this->testrequest->raw('file');
351 }
352
353 if (is_string($selected_files)) {
354 $selected_files = [$selected_files];
355 }
356
357 $export_gui = new ilTestExportGUI(
358 $this,
359 $this->db,
360 $this->obj_data_cache,
361 $this->user,
362 $this->ui_factory,
363 $this->ui_renderer,
364 $this->irss,
365 $this->request,
366 $this->export_repository,
367 $this->temp_file_system,
368 $this->participant_access_filter_factory,
369 $this->test_pass_result_repository,
371 );
372 $this->ctrl->forwardCommand($export_gui);
373 break;
374
375 case strtolower(ilInfoScreenGUI::class):
376 if (
377 !$this->access->checkAccess('read', '', $this->testrequest->getRefId())
378 && !$this->access->checkAccess('visible', '', $this->testrequest->getRefId())
379 ) {
381 }
382
383 $this->prepareOutput();
384 $this->addHeaderAction();
385 $this->forwardToInfoScreen();
386 break;
387
388 case strtolower(TestScreenGUI::class):
389 if (!$this->access->checkAccess('read', '', $this->testrequest->getRefId()) && !$this->access->checkAccess('visible', '', $this->testrequest->getRefId())) {
391 }
392 $this->prepareOutput();
393 $this->addHeaderAction();
394 $this->ctrl->forwardCommand($this->getTestScreenGUIInstance());
395 break;
396
397 case 'ilobjectmetadatagui':
398 if (!$this->access->checkAccess('write', '', $this->getTestObject()->getRefId())) {
400 }
401
402 $this->prepareOutput();
403 $this->addHeaderAction();
404 $this->tabs_manager->activateTab(TabsManager::TAB_ID_META_DATA);
405 $md_gui = new ilObjectMetaDataGUI($this->getTestObject());
406 $this->ctrl->forwardCommand($md_gui);
407 break;
408
409 case strtolower(ilTestParticipantsGUI::class):
410 if ((!$this->access->checkAccess("read", "", $this->testrequest->getRefId()))) {
412 }
413
414 $gui = new ilTestParticipantsGUI(
415 $this->getTestObject(),
416 $this->user,
418 $this->test_question_set_config_factory->getQuestionSetConfig(),
419 $this->access,
420 $this->test_access,
421 $this->tpl,
422 $this->ui_factory,
423 $this->ui_renderer,
424 $this->ui_service,
425 $this->data_factory,
426 $this->lng,
427 $this->ctrl,
428 $this->refinery,
429 $this->db,
430 $this->tabs_manager,
431 $this->toolbar,
432 $this->component_factory,
433 $this->export_factory,
434 $this->testrequest,
435 $this->response_handler,
436 $this->participant_repository,
437 $this->results_data_factory,
438 $this->results_presentation_factory,
439 $this->test_pass_result_repository
440 );
441
442 $this->ctrl->forwardCommand($gui);
443
449 $this->prepareOutput();
450 $this->addHeaderAction();
451 $this->tabs_manager->activateTab(TabsManager::TAB_ID_PARTICIPANTS);
452
453 break;
454
455 case 'iltestresultsgui':
456 if ((!$this->access->checkAccess("read", "", $this->testrequest->getRefId()))) {
458 }
459 $this->prepareOutput();
460 $this->addHeaderAction();
461
462 $gui = new ilTestResultsGUI(
463 $this->getTestObject(),
464 $this->ctrl,
465 $this->test_access,
466 $this->db,
467 $this->refinery,
468 $this->user,
469 $this->lng,
470 $this->getTestObject()->getTestlogger(),
471 $this->component_repository,
472 $this->tabs_manager,
473 $this->toolbar,
474 $this->tpl,
475 $this->ui_factory,
476 $this->ui_renderer,
477 $this->skills_service,
478 $this->questionrepository,
479 $this->toplist_repository,
480 $this->testrequest,
481 $this->http,
482 $this->data_factory,
483 $this->test_session_factory->getSession(),
484 $this->getObjectiveOrientedContainer(),
485 $this->participant_repository
486 );
487
488 $this->ctrl->forwardCommand($gui);
489 break;
490
491 case "iltestplayerfixedquestionsetgui":
492 if (
493 $cmd !== 'autosave' &&
494 (!$this->access->checkAccess("read", "", $this->testrequest->getRefId()))
495 ) {
497 }
499 if (!$this->getTestObject()->getKioskMode()) {
500 $this->prepareOutput();
501 }
503 $gui->setObjectiveOrientedContainer($this->getObjectiveOrientedContainer());
504 $this->ctrl->forwardCommand($gui);
505 break;
506
507 case "iltestplayerrandomquestionsetgui":
508 if (
509 $cmd !== 'autosave' &&
510 (!$this->access->checkAccess("read", "", $this->testrequest->getRefId()))
511 ) {
513 }
515 if (!$this->getTestObject()->getKioskMode()) {
516 $this->prepareOutput();
517 }
519 $gui->setObjectiveOrientedContainer($this->getObjectiveOrientedContainer());
520 $this->ctrl->forwardCommand($gui);
521 break;
522
523 case "iltestevaluationgui":
524 if ((!$this->access->checkAccess("read", "", $this->testrequest->getRefId()))) {
526 }
527 $this->forwardToEvaluationGUI();
528 break;
529
530 case "iltestservicegui":
531 if ((!$this->access->checkAccess("read", "", $this->testrequest->getRefId()))) {
533 }
534 $this->prepareOutput();
535 $this->addHeaderAction();
536 $serviceGUI = new ilTestServiceGUI($this->getTestObject());
537 $this->ctrl->forwardCommand($serviceGUI);
538 break;
539
540 case 'ilpermissiongui':
541 if ((!$this->access->checkAccess("read", "", $this->testrequest->getRefId()))) {
543 }
544 $this->prepareOutput();
545 $this->addHeaderAction();
546 $this->tabs_manager->activateTab(TabsManager::TAB_ID_PERMISSIONS);
547 $perm_gui = new ilPermissionGUI($this);
548 $ret = $this->ctrl->forwardCommand($perm_gui);
549 break;
550
551 case "illearningprogressgui":
552 if ((!$this->access->checkAccess("read", "", $this->testrequest->getRefId()))) {
554 }
555
556 $this->prepareOutput();
557 $this->addHeaderAction();
558 $this->tabs_manager->activateTab(TabsManager::TAB_ID_LEARNING_PROGRESS);
559
560 $test_session = $this->test_session_factory->getSessionByUserId($this->user->getId());
561 if (
562 !$this->test_access->checkOtherParticipantsLearningProgressAccess()
563 && !$this->getTestObject()->canShowTestResults($test_session)
564 && !\ilLearningProgressAccess::checkAccess($this->getTestObject()->getRefId())
565 ) {
566 $this->tpl->setOnScreenMessage(
567 'info',
568 $this->lng->txt('tst_res_tab_msg_no_lp_access'),
569 );
570 break;
571 }
572
574 $this->ctrl->forwardCommand($new_gui);
575
576 break;
577
578 case "ilcertificategui":
579 if ((!$this->access->checkAccess("read", "", $this->testrequest->getRefId()))) {
581 }
582 $this->prepareOutput();
583 $this->addHeaderAction();
584
585 $this->tabs_manager->activateTab(TabsManager::TAB_ID_SETTINGS);
586
588 $output_gui = $gui_factory->create($this->getTestObject());
589
590 $this->ctrl->forwardCommand($output_gui);
591 break;
592
593 case strtolower(ConsecutiveScoringGUI::class):
594 if ((!$this->access->checkAccess("read", "", $this->testrequest->getRefId()))) {
596 }
597 $output_gui = $this->gui_factory->get(ConsecutiveScoringGUI::class, $this->getTestObject());
598 $this->prepareOutput();
599 $this->ctrl->forwardCommand($output_gui);
600 $this->addHeaderAction();
601 break;
602
603
604 case strtolower(MarkSchemaGUI::class):
605 if ((!$this->access->checkAccess("read", "", $this->testrequest->getRefId()))) {
607 }
609
610 $mark_schema_gui = new MarkSchemaGUI(
611 $this->getTestObject(),
612 $this->user,
613 $this->lng,
614 $this->ctrl,
615 $this->tpl,
616 $this->toolbar,
617 $this->getObject()->getTestLogger(),
618 $this->post_wrapper,
619 $this->request_wrapper,
620 $this->response_handler,
621 $this->request,
622 $this->refinery,
623 $this->ui_factory,
624 $this->ui_renderer,
625 $this->mark_schema_factory
626 );
627 $this->ctrl->forwardCommand($mark_schema_gui);
628
629 $this->prepareOutput();
630 $this->addHeaderAction();
631 $this->tabs_manager->activateTab(TabsManager::TAB_ID_SETTINGS);
632 $this->tabs_manager->activateSubTab(TabsManager::SETTINGS_SUBTAB_ID_MARK_SCHEMA);
633
634 break;
635
636 case strtolower(SettingsMainGUI::class):
637 if ((!$this->access->checkAccess("read", "", $this->testrequest->getRefId()))) {
639 }
640
641 $gui = new SettingsMainGUI(
642 $this->tpl,
643 $this->ctrl,
644 $this->access,
645 $this->lng,
646 $this->tree,
647 $this->db,
648 $this->obj_data_cache,
649 $this->settings,
650 $this->ui_factory,
651 $this->ui_renderer,
652 $this->refinery,
653 $this->request,
654 $this->component_repository,
655 $this->user,
656 $this,
657 $this->getTestObject()->getTestLogger(),
658 $this->questionrepository
659 );
660 $this->ctrl->forwardCommand($gui);
661 $this->prepareOutput();
662 $this->tabs_manager->activateTab(TabsManager::TAB_ID_SETTINGS);
663 $this->tabs_manager->activateSubTab(TabsManager::SUBTAB_ID_GENERAL_SETTINGS);
664 $this->addHeaderAction();
665 break;
666
667 case strtolower(SettingsScoringGUI::class):
668 if ((!$this->access->checkAccess("read", "", $this->testrequest->getRefId()))) {
670 }
671 $this->prepareOutput();
672 $this->addHeaderAction();
673 $gui = new SettingsScoringGUI(
674 $this->ctrl,
675 $this->access,
676 $this->lng,
677 $this->tree,
678 $this->db,
679 $this->component_repository,
680 $this,
681 $this->tpl,
682 $this->tabs_gui,
683 $this->getTestObject()->getTestLogger(),
684 $this->getTestObject()->getScoreSettingsRepository(),
685 $this->getTestObject()->getTestId(),
686 $this->ui_factory,
687 $this->ui_renderer,
688 $this->refinery,
689 $this->request,
690 $this->user
691 );
692
693 $this->ctrl->forwardCommand($gui);
694 break;
695
696 case 'iltestrandomquestionsetconfiggui':
697 if ((!$this->access->checkAccess("read", "", $this->testrequest->getRefId()))) {
699 }
700 $this->prepareOutput();
701 $this->addHeaderAction();
702 $test_process_locker_factory = (new ilTestProcessLockerFactory(
703 new ilSetting('assessment'),
704 $this->db,
705 $this->getTestObject()->getTestLogger()
706 ))->withContextId($this->getTestObject()->getId());
708 $this->getTestObject(),
709 $this->ctrl,
710 $this->user,
711 $this->access,
712 $this->ui_factory,
713 $this->ui_renderer,
714 $this->data_factory,
715 $this->tabs_manager,
716 $this->lng,
717 $this->getTestObject()->getTestlogger(),
718 $this->tpl,
719 $this->db,
720 $this->tree,
721 $this->component_repository,
722 $this->obj_definition,
723 $this->obj_data_cache,
724 $test_process_locker_factory,
725 $this->testrequest,
726 $this->title_builder,
727 $this->questionrepository
728 );
729 $this->ctrl->forwardCommand($gui);
730 break;
731
732 case 'iltestquestionbrowsertablegui':
733 if ((!$this->access->checkAccess("read", "", $this->testrequest->getRefId()))) {
735 }
736 $this->prepareOutput();
737 $this->addHeaderAction();
739 $this->tabs_gui,
740 $this->tree,
741 $this->db,
742 $this->getTestObject()->getTestlogger(),
743 $this->component_repository,
744 $this->getTestObject(),
745 $this->user,
746 $this->access,
747 $this->http,
748 $this->refinery,
749 $this->ui_factory,
750 $this->ui_renderer,
751 $this->testrequest,
752 $this->questionrepository,
753 $this->lng,
754 $this->ctrl,
755 $this->tpl,
756 $this->ui_service,
757 $this->data_factory,
758 $this->taxonomy,
759 );
760 $this->ctrl->forwardCommand($gui);
761 break;
762
763 case 'iltestskilladministrationgui':
764 if ((!$this->access->checkAccess("read", "", $this->testrequest->getRefId()))) {
766 }
767 $this->prepareOutput();
768 $this->addHeaderAction();
770 $this->ctrl,
771 $this->access,
772 $this->tabs_manager,
773 $this->tpl,
774 $this->lng,
775 $this->refinery,
776 $this->db,
777 $this->getTestObject()->getTestlogger(),
778 $this->tree,
779 $this->component_repository,
780 $this->getTestObject(),
781 $this->questionrepository,
782 $this->testrequest,
783 $this->http,
784 $this->toolbar,
785 $this->skill_usage_service,
786 $this->ui_factory,
787 $this->ui_renderer,
788 $this->tabs_gui,
789 $this->ref_id
790 );
791 $this->ctrl->forwardCommand($gui);
792 break;
793
794 case 'ilobjectcopygui':
795 if ((!$this->access->checkAccess("copy", "", $this->testrequest->getRefId()))) {
797 }
798 $this->prepareOutput();
799 $this->addHeaderAction();
800 $cp = new ilObjectCopyGUI($this);
801 $cp->setType('tst');
802 $this->ctrl->forwardCommand($cp);
803 break;
804
805 case strtolower(ilAssQuestionPreviewGUI::class):
806 if (!$this->access->checkAccess('write', '', $this->getTestObject()->getRefId())) {
808 }
809 $this->prepareOutput();
811 break;
812 case 'ilassquestionpagegui':
813 if ($cmd === 'finishEditing') {
814 $this->prepareOutput();
816 break;
817 }
818 if ((!$this->access->checkAccess("read", "", $this->testrequest->getRefId()))) {
820 }
821 if ($cmd === 'edit' && !$this->access->checkAccess('write', '', $this->testrequest->getRefId())) {
823 }
824 $this->prepareOutput();
825 $forwarder = new ilAssQuestionPageCommandForwarder(
826 $this->getTestObject(),
827 $this->lng,
828 $this->ctrl,
829 $this->tpl,
830 $this->questionrepository,
831 $this->testrequest
832 );
833 $forwarder->forward();
834 break;
835
836 case 'ilassspecfeedbackpagegui':
837 if ((!$this->access->checkAccess("write", "", $this->testrequest->getRefId()))) {
839 }
840 $pg_gui = new ilAssSpecFeedbackPageGUI((int) $this->testrequest->raw("feedback_id"));
841 $this->ctrl->forwardCommand($pg_gui);
842 break;
843
844 case 'ilassgenfeedbackpagegui':
845 if ((!$this->access->checkAccess("write", "", $this->testrequest->getRefId()))) {
847 }
848 $pg_gui = new ilAssGenFeedbackPageGUI($this->testrequest->int("feedback_id"));
849 $this->ctrl->forwardCommand($pg_gui);
850 break;
851
852 case 'illocalunitconfigurationgui':
853 if ((!$this->access->checkAccess("write", "", $this->testrequest->getRefId()))) {
855 }
856 $this->prepareSubGuiOutput();
857
858 // set return target
860 $question = $question_gui->getObject();
861 $question->setObjId($this->getTestObject()->getId());
862 $question_gui->setObject($question);
863 $question_gui->setQuestionTabs();
865 new ilUnitConfigurationRepository($this->testrequest->getQuestionId())
866 );
867 $this->ctrl->forwardCommand($gui);
868 break;
869
870 case "ilcommonactiondispatchergui":
871 if (!$this->access->checkAccess("read", "", $this->testrequest->getRefId()) && !$this->access->checkAccess("visible", "", $this->testrequest->getRefId())) {
873 }
874 $this->prepareOutput();
876 $this->ctrl->forwardCommand($gui);
877 break;
878
879 case 'ilassquestionfeedbackeditinggui':
880 if (!$this->access->checkAccess('write', '', $this->getTestObject()->getRefId())) {
882 }
883 $this->prepareSubGuiOutput();
884
885 // set return target
886 $this->ctrl->setReturnByClass(self::class, self::SHOW_QUESTIONS_CMD);
888 $question = $question_gui->getObject();
889 $question->setObjId($this->getTestObject()->getId());
890 $question_gui->setObject($question);
891 $question_gui->setQuestionTabs();
892 $question_gui->setContextAllowsSyncToPool(true);
893
894 $this->addQuestionTitleToObjectTitle($question->getTitleForHTMLOutput());
895
896 if ($this->getTestObject()->evalTotalPersons() !== 0) {
897 $this->tpl->setOnScreenMessage('failure', $this->lng->txt('question_is_part_of_running_test'), true);
898 $this->prepareOutput();
900 }
902 $question_gui,
903 $this->ctrl,
904 $this->access,
905 $this->tpl,
906 $this->tabs_gui,
907 $this->lng,
908 $this->help,
909 $this->qplrequest,
910 $this->content_style
911 );
912 $this->ctrl->forwardCommand($gui);
913 break;
914
915 case 'iltestcorrectionsgui':
916 if ((!$this->access->checkAccess('read', '', $this->testrequest->getRefId()))) {
918 }
919 $this->prepareOutput();
920 $gui = new ilTestCorrectionsGUI(
921 $this->db,
922 $this->ctrl,
923 $this->lng,
924 $this->tabs_gui,
925 $this->help,
926 $this->ui_factory,
927 $this->tpl,
928 $this->refinery,
929 $this->getTestObject()->getTestLogger(),
930 $this->testrequest,
931 $this->getTestObject(),
932 $this->user,
933 $this->test_pass_result_repository
934 );
935 $this->ctrl->forwardCommand($gui);
936 break;
937
938 case 'iltestpagegui':
939 if ((!$this->access->checkAccess("write", "", $this->testrequest->getRefId()))) {
941 }
942
943 if ($cmd === 'downloadFile') {
944 $page_id = $this->object->getIntroductionPageId();
945 if ($this->testrequest->strVal('page_type') === 'concludingremarkspage') {
946 $page_id = $this->object->getConcludingRemarksPageId();
947 }
948 $this->ctrl->forwardCommand(new ilTestPageGUI('tst', $page_id));
949 }
950 $this->showEditTestPageGUI();
951 break;
952
953 case '':
954 case 'ilobjtestgui':
955 if (!$this->access->checkAccess('read', '', $this->testrequest->getRefId())
956 && !$this->access->checkAccess('visible', '', $this->testrequest->getRefId())) {
958 }
959 $this->prepareOutput();
960 $this->addHeaderAction();
961
962 if ($cmd === 'testScreen') {
963 $this->ctrl->forwardCommand($this->getTestScreenGUIInstance());
964 return;
965 }
966
967 $local_cmd = "{$cmd}Object";
968
969 if (!method_exists($this, $local_cmd)) {
970 $local_cmd = self::SHOW_QUESTIONS_CMD . 'Object';
971 }
972 $this->$local_cmd();
973 break;
974
975 default:
976 if ((!$this->access->checkAccess('read', '', $this->testrequest->getRefId()))) {
978 }
979 if (in_array(
980 $cmd,
981 ['editQuestion', 'previewQuestion', 'save', 'saveReturn', 'uploadImage',
982 'removeImage', 'syncQuestion', 'syncQuestionReturn', 'suggestedsolution']
983 )
984 && !$this->access->checkAccess('write', '', $this->getTestObject()->getRefId())) {
986 }
987 if (in_array($cmd, ['editQuestion', 'save', 'saveReturn', 'suggestedsolution'])
988 && $this->getTestObject()->evalTotalPersons() !== 0) {
989 $this->tpl->setOnScreenMessage('failure', $this->lng->txt('question_is_part_of_running_test'), true);
990 $this->prepareOutput();
992 return;
993 }
994 $this->forwardCommandToQuestion($cmd);
995 break;
996 }
997 if (!in_array(strtolower($this->testrequest->raw('baseClass')), ['iladministrationgui', 'ilrepositorygui'])
998 && $this->getCreationMode() !== true) {
999 $this->tpl->printToStdout();
1000 }
1001 }
1002
1003 protected function redirectAfterMissingWrite()
1004 {
1005 $this->tpl->setOnScreenMessage('failure', $this->lng->txt('no_permission'), true);
1006 $target_class = get_class($this->object) . 'GUI';
1007 $this->ctrl->setParameterByClass($target_class, 'ref_id', $this->ref_id);
1008 $this->ctrl->redirectByClass($target_class);
1009 }
1010
1011 protected function redirectAfterMissingRead(): void
1012 {
1013 $this->tpl->setOnScreenMessage('failure', sprintf(
1014 $this->lng->txt("msg_no_perm_read_item"),
1015 $this->object->getTitle()
1016 ), true);
1017 $this->ctrl->setParameterByClass('ilrepositorygui', 'ref_id', ROOT_FOLDER_ID);
1018 $this->ctrl->redirectByClass('ilrepositorygui');
1019 }
1020
1022 string $cmd,
1023 ?assQuestionGUI $question_gui = null
1024 ): void {
1025 $nr_of_participants_with_results = $this->getTestObject()->evalTotalPersons();
1026
1027 $this->ctrl->saveParameterByClass(self::class, 'q_id');
1028 $gui = new ilAssQuestionPreviewGUI(
1029 $this->ctrl,
1030 $this->rbac_system,
1031 $this->tabs_gui,
1032 $this->toolbar,
1033 $this->tpl,
1034 $this->ui_factory,
1035 $this->lng,
1036 $this->db,
1037 $this->refinery->random(),
1038 $this->global_screen,
1039 $this->http,
1040 $this->refinery,
1041 $this->ref_id
1042 );
1043
1044 if ($nr_of_participants_with_results > 0) {
1045 $gui->addAdditionalCmd(
1046 $this->lng->txt('tst_corrections_qst_form'),
1047 $this->ctrl->getLinkTargetByClass(ilTestCorrectionsGUI::class, 'showQuestion')
1048 );
1049 }
1050
1051 $question_gui ??= assQuestion::instantiateQuestionGUI($this->fetchAuthoringQuestionIdParameter());
1052
1053 $this->addQuestionTitleToObjectTitle($question_gui->getObject()->getTitleForHTMLOutput());
1054
1055 if (!$this->getTestObject()->isRandomTest() && $nr_of_participants_with_results === 0) {
1056 $gui->setPrimaryCmd(
1057 $this->lng->txt('edit_question'),
1058 $this->ctrl->getLinkTargetByClass(
1059 get_class($question_gui),
1060 'editQuestion'
1061 )
1062 );
1063 $gui->addAdditionalCmd(
1064 $this->lng->txt('edit_page'),
1065 $this->ctrl->getLinkTargetByClass(
1066 ilAssQuestionPageGUI::class,
1067 'edit'
1068 )
1069 );
1070 }
1071
1072 $gui->initQuestion($question_gui, $this->getTestObject()->getId());
1073 $gui->initPreviewSettings($this->getTestObject()->getRefId());
1074 $gui->initPreviewSession($this->user->getId(), $this->testrequest->getQuestionId());
1075 $gui->initStyleSheets();
1076
1077 $this->ctrl->clearParameterByClass(self::class, 'q_id');
1078 $this->tabs_gui->setBackTarget(
1079 $this->lng->txt('backtocallingtest'),
1080 $this->ctrl->getLinkTargetByClass(self::class, self::SHOW_QUESTIONS_CMD)
1081 );
1082 $this->ctrl->saveParameterByClass(self::class, 'q_id');
1083 $gui->{$cmd . 'Cmd'}();
1084 }
1085
1086 private function addQuestionTitleToObjectTitle(string $question_title): void
1087 {
1088 $this->tpl->setTitle(
1089 $this->refinery->encode()->htmlSpecialCharsAsEntities()->transform(
1090 "{$this->getTestObject()->getTitle()}: {$question_title}"
1091 )
1092 );
1093 }
1094
1095 protected function forwardCommandToQuestion(string $cmd): void
1096 {
1097 $this->create_question_mode = true;
1098 $this->prepareOutput();
1099
1100 try {
1101 $qid = $this->fetchAuthoringQuestionIdParameter();
1102
1103 $this->ctrl->setReturnByClass(self::class, self::SHOW_QUESTIONS_CMD);
1104
1105 $question_gui = assQuestionGUI::_getQuestionGUI(
1106 ilUtil::stripSlashes($this->testrequest->strVal('question_type')),
1107 $qid
1108 );
1109
1110 $question_gui->setEditContext(assQuestionGUI::EDIT_CONTEXT_AUTHORING);
1111 $question = $question_gui->getObject();
1112 $question->setObjId($this->getTestObject()->getId());
1113 $question_gui->setObject($question);
1114 $question_gui->setContextAllowsSyncToPool(true);
1115 $question_gui->setQuestionTabs();
1116
1117 $this->addQuestionTitleToObjectTitle($question->getTitleForHTMLOutput());
1118
1119 $target = strpos($cmd, 'Return') === false ? 'stay' : 'return';
1120
1121 if (in_array($cmd, ['syncQuestion', 'syncQuestionReturn'])) {
1122 $question_gui->syncQuestion();
1123 $this->showNextViewAfterQuestionSave($question_gui, $target);
1124 return;
1125 }
1126
1127 if ($question_gui->isSaveCommand()
1128 || $question_gui->cmdNeedsExistingQuestion($cmd)) {
1129 $question_gui = $this->addPostCreationTasksToQuestionGUI($question_gui);
1130 }
1131
1132 if ($qid === 0 && $question_gui->cmdNeedsExistingQuestion($cmd)) {
1133 $question_gui->getObject()->createNewQuestion();
1134 $question_gui->setQuestionTabs();
1135 $this->executeAfterQuestionCreationTasks($question_gui);
1136 }
1137
1138 if (!$question_gui->isSaveCommand()) {
1139 $this->ctrl->forwardCommand($question_gui);
1140 return;
1141 }
1142
1143 if (!$question_gui->saveQuestion()) {
1144 return;
1145 }
1146
1147 $this->tpl->setOnScreenMessage('success', $this->lng->txt('msg_obj_modified'), true);
1148 if ($qid === 0) {
1149 $this->executeAfterQuestionCreationTasks($question_gui);
1150 }
1151 $this->executeAfterQuestionSaveTasks($question_gui);
1152 $this->showNextViewAfterQuestionSave($question_gui, $target);
1153 } catch (ilTestException $e) {
1154 $this->showQuestionsObject();
1155 }
1156 }
1157
1159 assQuestionGUI $question_gui
1160 ): assQuestionGUI {
1161 if ($this->testrequest->isset('move_after_question_with_id')) {
1162 $question_gui->setMoveAfterQuestionId(
1163 $this->testrequest->int('move_after_question_with_id')
1164 );
1165 }
1166
1167 if ($this->testrequest->isset('pool_title')) {
1168 $question_gui->setCopyToNewPoolOnSave(
1169 $this->testrequest->strVal('pool_title')
1170 );
1171 }
1172
1173 if ($this->testrequest->isset('pool_ref')) {
1174 $question_gui->setCopyToExistingPoolOnSave(
1175 $this->testrequest->int('pool_ref')
1176 );
1177 }
1178 return $question_gui;
1179 }
1180
1181 private function executeAfterQuestionSaveTasks(assQuestionGUI $question_gui): void
1182 {
1183 if ($this->getTestObject()->getTestLogger()->isLoggingEnabled()) {
1184 $this->getTestObject()->getTestLogger()->logQuestionAdministrationInteraction(
1185 $question_gui->getObject()->toQuestionAdministrationInteraction(
1186 $this->getTestObject()->getTestLogger()->getAdditionalInformationGenerator(),
1187 $this->getTestObject()->getRefId(),
1188 TestQuestionAdministrationInteractionTypes::QUESTION_MODIFIED
1189 )
1190 );
1191 }
1192 }
1193
1194 private function executeAfterQuestionCreationTasks(assQuestionGUI $question_gui): void
1195 {
1196 if ($this->getTestObject()->getQuestionSetType() === ilObjTest::QUESTION_SET_TYPE_FIXED
1197 && !in_array($question_gui->getObject()->getId(), $this->getTestObject()->getQuestions())) {
1198 $this->getTestObject()->insertQuestion($question_gui->getObject()->getId(), true);
1199 }
1200
1201 if ($question_gui->getMoveAfterQuestionId() !== null) {
1202 $this->getTestObject()->moveQuestions(
1203 [$question_gui->getObject()->getId()],
1204 $question_gui->getMoveAfterQuestionId() === 0
1205 ? $this->getTestObject()->getQuestions()[1]
1206 : $question_gui->getMoveAfterQuestionId(),
1207 $question_gui->getMoveAfterQuestionId() === 0 ? 0 : 1
1208 );
1209 $question_gui->setMoveAfterQuestionId(null);
1210 }
1211
1212 if ($question_gui->getCopyToExistingPoolOnSave() !== null) {
1213 $original_id = $this->copyQuestionToPool(
1214 $question_gui,
1216 );
1217 assQuestion::saveOriginalId($question_gui->getObject()->getId(), $original_id);
1218 $question_gui->setCopyToExistingPoolOnSave(null);
1219 }
1220
1221 if ($question_gui->getCopyToNewPoolOnSave() !== null) {
1222 $question_pool = $this->createQuestionPool($question_gui->getCopyToNewPoolOnSave());
1223 $original_id = $this->copyQuestionToPool(
1224 $question_gui,
1225 $question_pool
1226 );
1227 assQuestion::saveOriginalId($question_gui->getObject()->getId(), $original_id);
1228 $question_gui->setCopyToNewPoolOnSave(null);
1229 }
1230 }
1231
1232 private function showNextViewAfterQuestionSave(assQuestionGUI $question_gui, string $target): void
1233 {
1234 if ($target === 'return') {
1235 $this->forwardCommandToQuestionPreview(
1237 $question_gui
1238 );
1239 }
1240
1241 if ($target === 'stay') {
1242 $this->ctrl->setParameterByClass(ilAssQuestionPreviewGUI::class, 'q_id', $question_gui->getObject()->getId());
1243 $this->tabs_gui->setBackTarget(
1244 $this->lng->txt('backtocallingpage'),
1245 $this->ctrl->getLinkTargetByClass(
1246 ilAssQuestionPreviewGUI::class,
1248 )
1249 );
1250 $question_gui->editQuestion(false, false);
1251 }
1252 }
1253
1254 protected function trackTestObjectReadEvent()
1255 {
1257 $this->getTestObject()->getType(),
1258 $this->getTestObject()->getRefId(),
1259 $this->getTestObject()->getId(),
1260 $this->user->getId()
1261 );
1262 }
1263
1268 protected function exportObject()
1269 {
1270 $this->ctrl->redirectByClass('ilTestExportGUI');
1271 }
1272
1278 {
1279 $qid = $this->testrequest->int('q_id');
1280
1281 if ($qid === 0 || $this->getTestObject()->checkQuestionParent($qid)) {
1282 return $qid;
1283 }
1284
1285 throw new ilTestException('question id does not relate to parent object!');
1286 }
1287
1288 private function questionsTabGatewayObject()
1289 {
1290 if ($this->getTestObject()->isRandomTest()) {
1291 $this->ctrl->redirectByClass('ilTestRandomQuestionSetConfigGUI');
1292 }
1293
1294 $this->ctrl->redirectByClass('ilObjTestGUI', self::SHOW_QUESTIONS_CMD);
1295 }
1296
1297 private function showEditTestPageGUI(): void
1298 {
1299 $this->prepareOutput();
1300 $this->tabs_manager->getSettingsSubTabs();
1301
1302 if ($this->request_wrapper->has('page_type')
1303 && $this->request_wrapper->retrieve(
1304 'page_type',
1305 $this->refinery->kindlyTo()->string()
1306 ) === 'introductionpage'
1307 ) {
1308 $page_type = 'IntroductionPage';
1309 $this->tabs_manager->activateSubTab(TabsManager::SETTINGS_SUBTAB_ID_EDIT_INTRODUCTION_PAGE);
1310 $page_id = $this->getTestObject()->getIntroductionPageId();
1311 } else {
1312 $page_type = 'ConcludingRemarksPage';
1313 $this->tabs_manager->activateSubTab(TabsManager::SETTINGS_SUBTAB_ID_EDIT_CONCLUSION_PAGE);
1314 $page_id = $this->getTestObject()->getConcludingRemarksPageId();
1315 }
1316 $this->ctrl->saveParameterByClass(ilTestPageGUI::class, 'page_type');
1317
1318 $gui = new ilTestPageGUI('tst', $page_id);
1319 $this->content_style->gui()->addCss($this->tpl, $this->ref_id);
1320 $this->tpl->setContent($this->ctrl->forwardCommand($gui));
1321
1322 if ($this->ctrl->getCmdClass() === strtolower(ilTestPageGUI::class)) {
1323 $this->tabs_manager->activateTab(TabsManager::TAB_ID_SETTINGS);
1324 }
1325 }
1326
1327 public function getTestAccess(): ilTestAccess
1328 {
1329 return $this->test_access;
1330 }
1331
1332 public function setTestAccess(ilTestAccess $test_access)
1333 {
1334 $this->test_access = $test_access;
1335 }
1336
1337 private function forwardToEvaluationGUI()
1338 {
1339 $this->prepareOutput();
1340 $this->addHeaderAction();
1341 $gui = new ilTestEvaluationGUI($this->getTestObject());
1342 $gui->setObjectiveOrientedContainer($this->getObjectiveOrientedContainer());
1343 $gui->setTestAccess($this->getTestAccess());
1344
1345 $this->ctrl->forwardCommand($gui);
1346 }
1347
1349 {
1350 $this->ctrl->redirectByClass(SettingsMainGUI::class, SettingsMainGUI::CMD_SHOW_FORM);
1351 }
1352
1353 private function prepareSubGuiOutput()
1354 {
1355 $this->tpl->loadStandardTemplate();
1356 $this->setLocator();
1357 $this->setTitleAndDescription();
1358 }
1359
1360 public function runObject()
1361 {
1362 $this->ctrl->redirectByClass([ilRepositoryGUI::class, self::class, ilInfoScreenGUI::class]);
1363 }
1364
1365 protected function importFile(string $file_to_import, string $path_to_uploaded_file_in_temp_dir): void
1366 {
1367 list($subdir, $importdir, $xmlfile, $qtifile) = $this->buildImportDirectoriesFromImportFile($file_to_import);
1368
1370 ->withZipOutputPath($this->getImportTempDirectory());
1371
1372 $unzip = $this->archives->unzip(Streams::ofResource(fopen($file_to_import, 'r')), $options);
1373 $unzip->extract();
1374
1375 if (!is_file($qtifile)) {
1376 ilFileUtils::delDir($importdir);
1377 $this->deleteUploadedImportFile($path_to_uploaded_file_in_temp_dir);
1378 $this->tpl->setOnScreenMessage('failure', $this->lng->txt('tst_import_non_ilias_zip'), true);
1379 }
1380 $qtiParser = new ilQTIParser($importdir, $qtifile, ilQTIParser::IL_MO_VERIFY_QTI, 0, [], [], true);
1381 try {
1382 $qtiParser->startParsing();
1383 } catch (ilSaxParserException) {
1384 $this->tpl->setOnScreenMessage('failure', $this->lng->txt('import_file_not_valid'), true);
1385 $this->ctrl->redirect($this, 'create');
1386 }
1387 $founditems = $qtiParser->getFoundItems();
1388
1389 $complete = 0;
1390 $incomplete = 0;
1391 foreach ($founditems as $item) {
1392 if ($item["type"] !== '') {
1393 $complete++;
1394 } else {
1395 $incomplete++;
1396 }
1397 }
1398
1399 if (count($founditems) && $complete == 0) {
1400 ilFileUtils::delDir($importdir);
1401 $this->deleteUploadedImportFile($path_to_uploaded_file_in_temp_dir);
1402 $this->tpl->setOnScreenMessage('info', $this->lng->txt('qpl_import_non_ilias_files'));
1403 return;
1404 }
1405
1406 ilSession::set('path_to_import_file', $file_to_import);
1407 ilSession::set('path_to_uploaded_file_in_temp_dir', $path_to_uploaded_file_in_temp_dir);
1408
1409 if ($qtiParser->getQuestionSetType() !== ilObjTest::QUESTION_SET_TYPE_FIXED
1410 || file_exists($this->buildResultsFilePath($importdir, $subdir))
1411 || $founditems === []) {
1412 $this->importVerifiedFileObject(true);
1413 return;
1414 }
1415
1416 $form = $this->buildImportQuestionsSelectionForm(
1417 'importVerifiedFile',
1418 $importdir,
1419 $qtifile,
1420 $file_to_import,
1421 $path_to_uploaded_file_in_temp_dir
1422 );
1423
1424 if ($form === null) {
1425 return;
1426 }
1427
1428 $panel = $this->ui_factory->panel()->standard(
1429 $this->lng->txt('import_tst'),
1430 [
1431 $this->ui_factory->legacy()->content($this->lng->txt('qpl_import_verify_found_questions')),
1432 $form
1433 ]
1434 );
1435 $this->tpl->setContent($this->ui_renderer->render($panel));
1436 $this->tpl->printToStdout();
1437 exit;
1438 }
1439
1444 public function afterSave(ilObject $new_object): void
1445 {
1446 $info = '';
1447 $new_object->saveToDb();
1448
1449 if ($new_object->getTestLogger()->isLoggingEnabled()) {
1450 $new_object->getTestLogger()->logTestAdministrationInteraction(
1451 $new_object->getTestLogger()->getInteractionFactory()->buildTestAdministrationInteraction(
1452 $this->getRefId(),
1453 $this->user->getId(),
1454 TestAdministrationInteractionTypes::NEW_TEST_CREATED,
1455 []
1456 )
1457 );
1458 }
1459
1460 if ($info === '') {
1461 $this->tpl->setOnScreenMessage('success', $this->lng->txt('object_added'), true);
1462 } else {
1463 $this->tpl->setOnScreenMessage('info', $this->lng->txt($info), true);
1464 }
1465 $this->ctrl->setParameter($this, 'ref_id', $new_object->getRefId());
1466 $this->ctrl->redirectByClass(SettingsMainGUI::class);
1467 }
1468
1469
1470 public function backToRepositoryObject()
1471 {
1472 $path = $this->tree->getPathFull($this->getTestObject()->getRefID());
1473 ilUtil::redirect($this->getReturnLocation("cancel", "./ilias.php?baseClass=ilRepositoryGUI&cmd=frameset&ref_id=" . $path[count($path) - 2]["child"]));
1474 }
1475
1476 public function getTestObject(): ?ilObjTest
1477 {
1478 return $this->object;
1479 }
1480
1485 bool $skip_retrieve_selected_questions = false
1486 ): void {
1487 if (!$this->checkPermissionBool('create', '', 'tst')) {
1488 $this->tpl->setOnScreenMessage('failure', $this->lng->txt('no_permission'), true);
1489 $this->ctrl->returnToParent($this);
1490 }
1491 $file_to_import = ilSession::get('path_to_import_file');
1492 $path_to_uploaded_file_in_temp_dir = ilSession::get('path_to_uploaded_file_in_temp_dir');
1493 list($subdir, $importdir, $xmlfile, $qtifile) = $this->buildImportDirectoriesFromImportFile($file_to_import);
1494
1495 $new_obj = new ilObjTest(0, true);
1496 $new_obj->setTitle('dummy');
1497 $new_obj->setDescription('test import');
1498 $new_obj->create(true);
1499 $new_obj->createReference();
1500 $new_obj->putInTree($this->testrequest->getRefId());
1501 $new_obj->setPermissions($this->testrequest->getRefId());
1502 $new_obj->saveToDb();
1503
1504 $selected_questions = [];
1505 if (!$skip_retrieve_selected_questions) {
1507 'importVerifiedFile',
1508 $importdir,
1509 $qtifile,
1510 $this->request
1511 );
1512 }
1513
1514 ilSession::set('tst_import_selected_questions', $selected_questions);
1515
1516 $imp = new ilImport($this->testrequest->getRefId());
1517 $map = $imp->getMapping();
1518 $map->addMapping('components/ILIAS/Test', 'tst', 'new_id', (string) $new_obj->getId());
1519
1524 if (is_file($importdir . DIRECTORY_SEPARATOR . '/manifest.xml')) {
1525 $imp->importObject($new_obj, $file_to_import, basename($file_to_import), 'tst', 'components/ILIAS/Test', true);
1526 } else {
1527 $test_importer = new ilTestImporter();
1528 $test_importer->setImport($imp);
1529 $test_importer->setInstallId(IL_INST_ID);
1530 $test_importer->setImportDirectory($importdir . '/' . $subdir);
1531 $test_importer->init();
1532
1533 $test_importer->importXmlRepresentation(
1534 '',
1535 '',
1536 '',
1537 $map,
1538 );
1539 }
1540
1541 if ($new_obj->getTestLogger()->isLoggingEnabled()) {
1542 $new_obj->getTestLogger()->logTestAdministrationInteraction(
1543 $new_obj->getTestLogger()->getInteractionFactory()->buildTestAdministrationInteraction(
1544 $new_obj->getRefId(),
1545 $this->user->getId(),
1546 TestAdministrationInteractionTypes::NEW_TEST_CREATED,
1547 []
1548 )
1549 );
1550 }
1551
1552 ilFileUtils::delDir($importdir);
1553 $this->deleteUploadedImportFile($path_to_uploaded_file_in_temp_dir);
1554 ilSession::clear('path_to_import_file');
1555 ilSession::clear('path_to_uploaded_file_in_temp_dir');
1556
1557 $this->tpl->setOnScreenMessage('success', $this->lng->txt("object_imported"), true);
1558
1559 $question_skill_assignments_import_fails = new ilAssQuestionSkillAssignmentImportFails($new_obj->getId());
1560 if ($question_skill_assignments_import_fails->failedImportsRegistered()) {
1561 $this->tpl->setOnScreenMessage(
1562 'info',
1563 $question_skill_assignments_import_fails->getFailedImportsMessage($this->lng),
1564 true
1565 );
1566 }
1567
1568 $this->ctrl->setParameterByClass(ilObjTestGUI::class, 'ref_id', $new_obj->getRefId());
1569 $this->ctrl->redirectByClass(ilObjTestGUI::class);
1570 }
1571
1575 public function downloadFileObject()
1576 {
1577 $file = explode("_", $this->testrequest->raw("file_id"));
1578 $fileObj = new ilObjFile((int) $file[count($file) - 1], false);
1579 $fileObj->sendFile();
1580 exit;
1581 }
1582
1586 public function fullscreenObject()
1587 {
1588 $page_gui = new ilAssQuestionPageGUI($this->testrequest->raw('pg_id'));
1589 $page_gui->setFileDownloadLink(
1590 $this->ctrl->getLinkTargetByClass(ilObjTestGUI::class, 'downloadFile')
1591 );
1592 $page_gui->showMediaFullscreen();
1593 }
1594
1599 {
1600 $pg_obj = new ilAssQuestionPage($this->testrequest->raw("pg_id"));
1601 $pg_obj->sendParagraph($this->testrequest->raw("par_id"), $this->testrequest->raw("downloadtitle"));
1602 exit;
1603 }
1604
1605 public function createQuestionPool($name = "dummy", $description = ""): ilObjQuestionPool
1606 {
1607 $parent_ref = $this->tree->getParentId($this->getTestObject()->getRefId());
1608 $qpl = new ilObjQuestionPool();
1609 $qpl->setType("qpl");
1610 $qpl->setTitle($name);
1611 $qpl->setDescription($description);
1612 $qpl->create();
1613 $qpl->createReference();
1614 $qpl->putInTree($parent_ref);
1615 $qpl->setPermissions($parent_ref);
1616 $qpl->getObjectProperties()->storePropertyIsOnline($qpl->getObjectProperties()->getPropertyIsOnline()->withOnline()); // must be online to be available
1617 $qpl->saveToDb();
1618 return $qpl;
1619 }
1620
1621 public function createQuestionObject(): void
1622 {
1623 $this->protectByWritePermission();
1624
1625 $this->ctrl->setReturnByClass(self::class, self::SHOW_QUESTIONS_CMD);
1626
1627 $form = $this->buildQuestionCreationForm()->withRequest($this->request);
1628 $data_with_section = $form->getData();
1629 if ($data_with_section === null) {
1630 $this->createQuestionFormObject($form);
1631 return;
1632 }
1633 $data = $data_with_section[0];
1634
1635 $qpl_mode = $data['pool_selection']['qpl_type'];
1636
1637 if ($qpl_mode === self::QUESTION_CREATION_POOL_SELECTION_NEW_POOL
1638 && ! $this->userCanCreatePoolAtCurrentLocation()) {
1639 $this->tpl->setOnScreenMessage('failure', $this->lng->txt('permission_denied'), true);
1640 $this->showQuestionsObject();
1641 return;
1642 }
1643
1644 if ($qpl_mode === self::QUESTION_CREATION_POOL_SELECTION_NEW_POOL && $data['pool_selection']['title'] === ''
1645 || $qpl_mode === self::QUESTION_CREATION_POOL_SELECTION_EXISTING_POOL && $data['pool_selection']['pool_ref_id'] === 0) {
1646 $this->tpl->setOnScreenMessage('info', $this->lng->txt("questionpool_not_entered"));
1647 $this->createQuestionFormObject($form);
1648 return;
1649 }
1650
1652 $question_gui = assQuestionGUI::_getQuestionGUI(
1654 );
1655 $question_gui->setEditContext(assQuestionGUI::EDIT_CONTEXT_AUTHORING);
1656 $question = $question_gui->getObject();
1657 $question->setAdditionalContentEditingMode($data['editing_type']);
1658 $question->setObjId($this->getTestObject()->getId());
1659 $question_gui->setObject($question);
1660 $question_gui->setQuestionTabs();
1661
1662 if (array_key_exists('position', $data)) {
1663 $question_gui->setMoveAfterQuestionId($data['position']);
1664 }
1665
1666 if ($qpl_mode === self::QUESTION_CREATION_POOL_SELECTION_NEW_POOL) {
1667 $question_gui->setCopyToNewPoolOnSave($data['pool_selection']['title']);
1668 }
1669
1670 if ($qpl_mode === self::QUESTION_CREATION_POOL_SELECTION_EXISTING_POOL) {
1671 $question_gui->setCopyToExistingPoolOnSave($data['pool_selection']['pool_ref_id']);
1672 }
1673
1674 $question_gui->editQuestion();
1675 }
1676
1677 public function cancelCreateQuestionObject(): void
1678 {
1679 $this->ctrl->redirect($this, self::SHOW_QUESTIONS_CMD);
1680 }
1681
1682 private function insertQuestionsObject(?array $selected_array = null): void
1683 {
1684 $this->protectByWritePermission();
1685
1686 if (($selected_array ?? $this->testrequest->getQuestionIds()) === []) {
1687 $this->tpl->setOnScreenMessage('info', $this->lng->txt('tst_insert_missing_question'), true);
1688 $this->ctrl->redirect($this, 'browseForQuestions');
1689 }
1690
1691 $this->getTestObject()->saveCompleteStatus($this->test_question_set_config_factory->getQuestionSetConfig());
1692 $this->tpl->setOnScreenMessage('success', $this->lng->txt('tst_questions_inserted'), true);
1693 $this->ctrl->redirect($this, self::SHOW_QUESTIONS_CMD);
1694 return;
1695 }
1696
1697 public function createQuestionFormObject(?Form $form = null): void
1698 {
1699 $this->protectByWritePermission();
1700
1701 $this->tabs_manager->getQuestionsSubTabs();
1702 $this->tabs_manager->activateSubTab(TabsManager::SUBTAB_ID_QST_LIST_VIEW);
1703
1704 $sub_screen_id = ['createQuestion'];
1705
1706 $this->tabs_manager->activateTab(TabsManager::TAB_ID_QUESTIONS);
1707 $this->help->setScreenId('assQuestions');
1708 $this->help->setSubScreenId(implode('_', $sub_screen_id));
1709
1710 $this->tpl->setContent(
1711 $this->ui_renderer->render(
1712 $form ?? $this->buildQuestionCreationForm()
1713 )
1714 );
1715 }
1716
1718 {
1719 $inputs['question_type'] = $this->buildInputQuestionType();
1720 $questions = $this->getTestObject()->getQuestionTitlesAndIndexes();
1721 if ($questions !== []) {
1722 $inputs['position'] = $this->buildInputPosition($questions);
1723 }
1724
1725 $inputs['editing_type'] = $this->buildInputEditingType();
1726
1727 if ($inputs['editing_type'] instanceof Radio) {
1728 $sub_screen_id[] = 'editMode';
1729 }
1730
1731 $sub_screen_id[] = 'poolSelect';
1732
1733 $inputs['pool_selection'] = $this->buildInputPoolSelection();
1734
1735 $section = [
1736 $this->ui_factory->input()->field()->section($inputs, $this->lng->txt('ass_create_question'))
1737 ];
1738
1739 $form = $this->ui_factory->input()->container()->form()->standard(
1740 $this->ctrl->getFormAction($this, 'createQuestion'),
1741 $section
1742 )->withSubmitLabel($this->lng->txt('create'));
1743
1744 return $form;
1745 }
1746
1747 private function buildInputQuestionType(): Select
1748 {
1749 $question_types = (new ilObjQuestionPool())->getQuestionTypes(false, true, false);
1750 $options = [];
1751 foreach ($question_types as $label => $data) {
1752 $options[$data['question_type_id']] = $label;
1753 }
1754
1755 return $this->ui_factory->input()->field()->select(
1756 $this->lng->txt('question_type'),
1757 $options
1758 )->withRequired(true);
1759 }
1760
1761 private function buildInputPosition(array $questions): Select
1762 {
1763 $options = [0 => $this->lng->txt('first')];
1764 foreach ($questions as $key => $title) {
1765 $options[$key] = $this->lng->txt('behind') . ' ' . $title
1766 . ' [' . $this->lng->txt('question_id_short') . ': ' . $key . ']';
1767 }
1768 return $this->ui_factory->input()->field()->select(
1769 $this->lng->txt('position'),
1770 $options
1771 )->withAdditionalTransformation($this->refinery->kindlyTo()->int());
1772 }
1773
1774 private function buildInputEditingType(): Input
1775 {
1776 if (!$this->getTestObject()->getGlobalSettings()->isPageEditorEnabled()) {
1777 return $this->ui_factory->input()->field()->hidden()->withValue(
1779 );
1780 }
1781
1782 return $this->ui_factory->input()->field()->radio($this->lng->txt('tst_add_quest_cont_edit_mode'))
1783 ->withOption(
1785 $this->lng->txt('tst_add_quest_cont_edit_mode_IPE'),
1786 $this->lng->txt('tst_add_quest_cont_edit_mode_IPE_info')
1787 )->withOption(
1789 $this->lng->txt('tst_add_quest_cont_edit_mode_RTE'),
1790 $this->lng->txt('tst_add_quest_cont_edit_mode_RTE_info')
1791 )
1793 }
1794
1796 {
1797 $f = $this->ui_factory->input()->field();
1798 $kt = $this->refinery->kindlyTo();
1799
1800 $trafo = $this->refinery->custom()->transformation(
1801 static function ($values) use ($kt): array {
1802 $return['qpl_type'] = $kt->int()->transform($values[0]);
1803 if ($return['qpl_type'] === self::QUESTION_CREATION_POOL_SELECTION_NO_POOL) {
1804 return $return;
1805 }
1806 if ($return['qpl_type'] === self::QUESTION_CREATION_POOL_SELECTION_NEW_POOL) {
1807 return $return + ['title' => $kt->string()->transform($values[1][0])];
1808 }
1809 return $return + [
1810 'pool_ref_id' => $kt->int()->transform($values[1][0])
1811 ];
1812 }
1813 );
1814
1815 $questionpools = ilObjQuestionPool::_getAvailableQuestionpools(false, false, true, false, false, "write");
1816 $pools_data = [];
1817 foreach ($questionpools as $key => $p) {
1818 $pools_data[$key] = $p['title'];
1819 }
1820
1821 $inputs = [
1822 self::QUESTION_CREATION_POOL_SELECTION_NO_POOL => $f->group([], $this->lng->txt('assessment_no_pool')),
1823 self::QUESTION_CREATION_POOL_SELECTION_EXISTING_POOL => $f->group(
1824 [
1825 $f->select(
1826 $this->lng->txt('select_questionpool'),
1827 $pools_data
1828 )->withRequired(true)
1829 ],
1830 $this->lng->txt('assessment_existing_pool')
1831 )
1832 ];
1833
1834 if ($this->userCanCreatePoolAtCurrentLocation()) {
1835 $inputs[self::QUESTION_CREATION_POOL_SELECTION_NEW_POOL] = $f->group(
1836 [$f->text($this->lng->txt('name'))],
1837 $this->lng->txt('assessment_new_pool')
1838 );
1839 }
1840
1841 return $f->switchableGroup(
1842 $inputs,
1843 $this->lng->txt('assessment_pool_selection')
1844 )->withAdditionalTransformation($trafo)
1845 ->withRequired(true)
1846 ->withValue(1);
1847 }
1848
1849 public function showQuestionsObject()
1850 {
1851 $this->protectByWritePermission();
1852
1853 if ($this->testrequest->raw('add')) {
1854 $this->addQuestion();
1855 return;
1856 }
1857
1858 $table_query = $this->getQuestionsTableQuery();
1859 if (($table_cmd = $table_query->getTableAction()) !== null) {
1860 if (!$this->getQuestionsTableActions()->handleCommand(
1861 $table_cmd,
1862 $table_query->getRowIds($this->object),
1863 fn() => $this->protectByWritePermission(),
1864 fn() => $this->createQuestionpoolTargetObject('copyAndLinkQuestionsToPool'),
1865 fn() => $this->getTable()
1866 )) {
1867 return;
1868 }
1869 }
1870
1871 $this->tpl->addBlockFile('ADM_CONTENT', 'adm_content', 'tpl.il_as_tst_questions.html', 'components/ILIAS/Test');
1872
1873 $this->setupToolBarAndMessage($this->getTestObject()->evalTotalPersons() !== 0);
1874
1875 $this->tabs_manager->getQuestionsSubTabs();
1876 $this->tabs_manager->activateSubTab(TabsManager::SUBTAB_ID_QST_LIST_VIEW);
1877
1878 $this->tpl->setCurrentBlock('adm_content');
1879 $this->tpl->setVariable('ACTION_QUESTION_FORM', $this->ctrl->getFormAction($this));
1880 $this->tpl->setVariable(
1881 'QUESTIONBROWSER',
1882 $this->ui_renderer->render(
1883 $this->getTable()->getTableComponent()
1884 )
1885 );
1886 $this->tpl->parseCurrentBlock();
1887 }
1888
1889 private function addQuestion(): void
1890 {
1891 $selected_array = [$this->testrequest->int('add')];
1892 $total = $this->getTestObject()->evalTotalPersons();
1893 if ($total > 0) {
1894 // the test was executed previously
1895 $this->tpl->setOnScreenMessage('failure', $this->lng->txt('test_has_datasets_warning_page_view'));
1896 $this->showQuestionsObject();
1897 return;
1898 }
1899 $this->tpl->setOnScreenMessage('info', $this->lng->txt('tst_insert_questions'));
1900 $this->insertQuestionsObject($selected_array);
1901 }
1902
1903 private function setupToolBarAndMessage(bool $has_started_test_runs): void
1904 {
1905 if (!$this->access->checkAccess('write', '', $this->ref_id)
1906 || $this->getTestObject()->isRandomTest()) {
1907 return;
1908 }
1909
1910 if ($has_started_test_runs) {
1911 $link = $this->ui_factory->link()->standard(
1912 $this->lng->txt('test_has_datasets_warning_page_view_link'),
1913 $this->ctrl->getLinkTargetByClass([\ilTestParticipantsGUI::class])
1914 );
1915
1916 $message = $this->lng->txt('test_has_datasets_warning_page_view');
1917 $massage_box = $this->ui_factory->messageBox()->info($message)->withLinks([$link]);
1918 $this->tpl->setCurrentBlock('pax_info_message');
1919 $this->tpl->setVariable(
1920 'PAX_INFO_MESSAGE',
1921 $this->ui_renderer->render($massage_box)
1922 );
1923 $this->tpl->parseCurrentBlock();
1924 return;
1925 }
1926
1927 $this->toolbar->addButton($this->lng->txt('ass_create_question'), $this->ctrl->getLinkTarget($this, 'createQuestionForm'));
1928 $this->toolbar->addSeparator();
1929 $this->populateQuestionBrowserToolbarButtons($this->toolbar);
1930 }
1931
1933 {
1934 $this->ctrl->setParameterByClass(
1935 ilTestQuestionBrowserTableGUI::class,
1938 );
1939
1940 $toolbar->addButton(
1941 $this->lng->txt('tst_browse_for_qpl_questions'),
1942 $this->ctrl->getLinkTargetByClass(
1943 ilTestQuestionBrowserTableGUI::class,
1945 )
1946 );
1947
1948 $this->ctrl->setParameterByClass(
1949 ilTestQuestionBrowserTableGUI::class,
1952 );
1953
1954 $toolbar->addButton(
1955 $this->lng->txt('tst_browse_for_tst_questions'),
1956 $this->ctrl->getLinkTargetByClass(
1957 ilTestQuestionBrowserTableGUI::class,
1959 )
1960 );
1961 }
1962
1963 public function takenObject(): void
1964 {
1965 }
1966
1967 public function historyObject(): void
1968 {
1969 if (!$this->getTestObject()->getTestLogger()->isLoggingEnabled()
1970 || !$this->rbac_review->isAssigned($this->user->getId(), SYSTEM_ROLE_ID)
1971 && !$this->access->checkAccess('tst_history_read', '', $this->getTestObject()->getRefId())) {
1972 $this->redirectAfterMissingWrite();
1973 }
1974
1975 $here_uri = $this->data_factory->uri(ILIAS_HTTP_PATH
1976 . '/' . $this->ctrl->getLinkTargetByClass(self::class, self::SHOW_LOGS_CMD));
1977 list($url_builder, $action_parameter_token, $row_id_token) = (new URLBuilder($here_uri))->acquireParameters(
1978 LogTable::QUERY_PARAMETER_NAME_SPACE,
1979 LogTable::ACTION_TOKEN_STRING,
1980 LogTable::ENTRY_TOKEN_STRING
1981 );
1982
1983 if ($this->request_wrapper->has($action_parameter_token->getName())) {
1984 $this->getTestObject()->getTestLogViewer()->executeLogTableAction(
1985 $url_builder,
1986 $action_parameter_token,
1987 $row_id_token,
1988 $this->getTestObject()->getRefId()
1989 );
1990 }
1991
1992 $this->toolbar->addComponent(
1993 $this->ui_factory->button()->standard(
1994 $this->lng->txt('export_legacy_logs'),
1995 $this->ctrl->getLinkTargetByClass(self::class, 'exportLegacyLogs')
1996 )
1997 );
1998 $this->tabs_manager->activateTab(TabsManager::TAB_ID_HISTORY);
1999
2000 list($filter, $table_gui) = $this->getTestObject()->getTestLogViewer()->getLogTable(
2001 $url_builder,
2002 $action_parameter_token,
2003 $row_id_token,
2004 $this->getTestObject()->getRefId()
2005 );
2006
2007 $this->tpl->setVariable('ADM_CONTENT', $this->ui_renderer->render([$filter, $table_gui]));
2008 }
2009
2010 public function exportLegacyLogsObject(): void
2011 {
2012 $this->protectByWritePermission();
2013
2014 $csv_output = $this->getTestObject()->getTestLogViewer()->getLegacyLogExportForObjId($this->getTestObject()->getId());
2015
2017 $csv_output,
2018 "legacy_logs_for_{$this->getTestObject()->getRefId()}.csv"
2019 );
2020 }
2021
2025 public function participantsActionObject(): void
2026 {
2027 $command = $this->testrequest->strVal('command');
2028 if ($command === '') {
2029 $method = $command . 'Object';
2030 if (method_exists($this, $method)) {
2031 $this->$method();
2032 return;
2033 }
2034 }
2035 $this->ctrl->redirect($this, 'participants');
2036 }
2037
2038
2039 public function showTemplatesObject(?Modal $modal = null): void
2040 {
2041 $this->protectByWritePermission();
2042
2043 $this->tabs_manager->activateTab(TabsManager::TAB_ID_SETTINGS);
2044
2045 $create_input = $this->buildPersonalSettingsCreateAction()
2046 ->buildModal($this->ctrl->getLinkTargetByClass(self::class, 'createTemplate'));
2047 $import_input = $this->buildPersonalSettingsImportAction()
2048 ->buildModal($this->ctrl->getLinkTargetByClass(self::class, 'importTemplate'));
2049
2050 $this->toolbar->addComponent(
2051 $this->ui_factory->button()->standard(
2052 $this->lng->txt('personal_settings_create'),
2053 $create_input->getShowSignal()
2054 )
2055 );
2056 $this->toolbar->addComponent(
2057 $this->ui_factory->button()->standard(
2058 $this->lng->txt('personal_settings_import'),
2059 $import_input->getShowSignal()
2060 )
2061 );
2062
2063 $components = [
2064 $this->buildPersonalSettingsTable()->getComponent(),
2065 $modal,
2066 $create_input,
2067 $import_input
2068 ];
2069
2070 $this->tpl->setContent(
2071 $this->ui_renderer->render(array_filter($components))
2072 );
2073 }
2074
2075 public function createTemplateObject(): void
2076 {
2077 $this->protectByWritePermission();
2078
2079 try {
2080 $this->buildPersonalSettingsCreateAction()
2081 ->perform($this->getTestObject()->getTestId(), $this->request);
2082 } catch (\InvalidArgumentException $e) {
2083 $this->tpl->setOnScreenMessage('failure', $this->lng->txt($e->getMessage()), true);
2084 }
2085
2086 $this->ctrl->redirectByClass(self::class, 'showTemplates');
2087 }
2088
2089 public function importTemplateObject(): void
2090 {
2091 $this->protectByWritePermission();
2092
2093 try {
2094 $this->buildPersonalSettingsImportAction()
2095 ->perform($this->request);
2096
2097 $this->tpl->setOnScreenMessage('success', $this->lng->txt('personal_settings_import_success'), true);
2098 } catch (\InvalidArgumentException $e) {
2099 $this->tpl->setOnScreenMessage('failure', $this->lng->txt($e->getMessage()), true);
2100 }
2101
2102 $this->ctrl->redirectByClass(self::class, 'showTemplates');
2103 }
2104
2105 public function executeTemplatesActionObject(): void
2106 {
2107 $this->protectByWritePermission();
2108
2109 $modal = $this->buildPersonalSettingsTable()->perform();
2110 if ($modal !== null) {
2111 $this->showTemplatesObject($modal);
2112 return;
2113 }
2114 $this->ctrl->redirectByClass(self::class, 'showTemplates');
2115 }
2116
2118 {
2120 $this->ui_factory,
2121 $this->lng,
2122 $this->user,
2123 $this->personal_settings_templates_repository,
2124 $this->main_settings_repository,
2125 $this->score_settings_repository,
2126 $this->marks_repository
2127 );
2128 }
2129
2131 {
2133 $this->ui_factory,
2134 $this->lng,
2135 $this->data_factory,
2136 $this->temp_file_system,
2137 $this->personal_settings_templates_repository,
2138 $this->main_settings_repository,
2139 $this->score_settings_repository,
2140 $this->marks_repository
2141 );
2142 }
2143
2145 {
2146 $actions = new PersonalSettingsTableActions(
2147 $this->testrequest,
2148 $this->response_handler,
2149 $this->ui_renderer,
2150 $this->ui_factory,
2151 $this->lng,
2152 $this->user,
2153 $this->personal_settings_templates_repository,
2154 [
2155 PersonalSettingsTableShowAction::ACTION_ID => new PersonalSettingsTableShowAction(
2156 $this->lng,
2157 $this->ui_factory,
2158 $this->user,
2159 $this->personal_settings_templates_repository,
2160 $this->main_settings_repository,
2161 $this->score_settings_repository,
2162 $this->marks_repository,
2163 $this->additional_information_generator
2164 ),
2165 PersonalSettingsTableApplyAction::ACTION_ID => new PersonalSettingsTableApplyAction(
2166 $this->lng,
2167 $this->ui_factory,
2168 $this->test_question_set_config_factory,
2169 $this->tpl,
2170 $this->getTestObject(),
2171 $this->personal_settings_templates_repository,
2172 $this->main_settings_repository,
2173 $this->score_settings_repository,
2174 $this->marks_repository
2175 ),
2176 PersonalSettingsTableExportAction::ACTION_ID => new PersonalSettingsTableExportAction(
2177 $this->lng,
2178 $this->ui_factory,
2179 $this->personal_settings_exporter
2180 ),
2181 PersonalSettingsTableDeleteAction::ACTION_ID => new PersonalSettingsTableDeleteAction(
2182 $this->lng,
2183 $this->ui_factory,
2184 $this->tpl,
2185 $this->personal_settings_templates_repository,
2186 $this->marks_repository
2187 ),
2188 ]
2189 );
2190
2191 $uri = $this->ctrl->getLinkTargetByClass(self::class, 'executeTemplatesAction', '', true);
2192 return new PersonalSettingsTable(
2193 $this->lng,
2194 $this->ui_factory,
2195 $this->data_factory,
2196 $this->user,
2197 $this->testrequest,
2198 $actions,
2199 new URLBuilder($this->data_factory->uri(ILIAS_HTTP_PATH . '/' . $uri)),
2200 $this->personal_settings_templates_repository,
2201 );
2202 }
2203
2204 private function isCommandClassAnyInfoScreenChild(): bool
2205 {
2206 if (in_array(
2207 $this->ctrl->getCmdClass(),
2208 [
2209 strtolower(PublicProfileGUI::class),
2210 'ilobjportfoliogui'
2211 ]
2212 )) {
2213 return true;
2214 }
2215
2216 return false;
2217 }
2218
2219 private function infoScreenObject(): void
2220 {
2221 $this->ctrl->redirectByClass(
2222 [ilRepositoryGUI::class, self::class, ilInfoScreenGUI::class]
2223 );
2224 }
2225
2226 private function forwardToInfoScreen(): void
2227 {
2228 if (!$this->access->checkAccess('visible', '', $this->ref_id)
2229 && !$this->access->checkAccess('read', '', $this->ref_id)) {
2230 $this->redirectAfterMissingRead();
2231 }
2232
2233 if ($this->getTestObject()->getMainSettings()->getAdditionalSettings()->getHideInfoTab()) {
2234 $this->ctrl->redirectByClass([self::class, TestScreenGUI::class], TestScreenGUI::DEFAULT_CMD);
2235 }
2236
2237 $this->tabs_manager->activateTab(TabsManager::TAB_ID_INFOSCREEN);
2238
2239 if ($this->access->checkAccess('read', '', $this->ref_id)) {
2240 $this->trackTestObjectReadEvent();
2241 }
2242 $info = new ilInfoScreenGUI($this);
2243
2244 if ($this->isCommandClassAnyInfoScreenChild()) {
2245 $this->ctrl->forwardCommand($info);
2246 }
2247
2248 $toolbar = new ilTestInfoScreenToolbarGUI(
2249 $this->getTestObject(),
2250 $this->test_player_factory->getPlayerGUI(),
2251 $this->test_question_set_config_factory->getQuestionSetConfig(),
2252 $this->test_session_factory->getSession(),
2253 $this->db,
2254 $this->access,
2255 $this->ctrl,
2256 $this->lng,
2257 $this->ui_factory,
2258 $this->ui_renderer,
2259 $this->tpl,
2260 $this->toolbar
2261 );
2262
2263 $toolbar->setCloseFormTag(false);
2264
2265 $toolbar->setSessionLockString('');
2266 $toolbar->build();
2267 $toolbar->sendMessages();
2268
2269 $info->enablePrivateNotes();
2270
2271 $info->addSection($this->lng->txt('tst_general_properties'));
2272 $info->addProperty(
2273 $this->lng->txt('author'),
2274 $this->refinery->encode()->htmlSpecialCharsAsEntities()->transform(
2275 $this->getTestObject()->getAuthor()
2276 )
2277 );
2278 $info->addProperty(
2279 $this->lng->txt('title'),
2280 $this->refinery->encode()->htmlSpecialCharsAsEntities()->transform(
2281 $this->getTestObject()->getTitle()
2282 )
2283 );
2284
2285 if ($this->type !== 'tst') {
2286 $info->hideFurtherSections(false);
2287 }
2288
2289 if ($this->getTestObject()->getEnableProcessingTime()) {
2290 $info->addProperty($this->lng->txt('tst_processing_time'), $this->getTestObject()->getProcessingTime());
2291 }
2292
2293 $starting_time = $this->getTestObject()->getStartingTime();
2294 if ($this->getTestObject()->isStartingTimeEnabled() && $starting_time !== 0) {
2295 $info->addProperty($this->lng->txt('tst_starting_time'), ilDatePresentation::formatDate(new ilDateTime($starting_time, IL_CAL_UNIX)));
2296 }
2297 $ending_time = $this->getTestObject()->getEndingTime();
2298 if ($this->getTestObject()->isEndingTimeEnabled() && $ending_time != 0) {
2299 $info->addProperty($this->lng->txt('tst_ending_time'), ilDatePresentation::formatDate(new ilDateTime($ending_time, IL_CAL_UNIX)));
2300 }
2301 $info->addMetaDataSections($this->getTestObject()->getId(), 0, $this->getTestObject()->getType());
2302
2303 $this->ctrl->forwardCommand($info);
2304 }
2305
2306 protected function removeImportFailsObject()
2307 {
2308 $qsaImportFails = new ilAssQuestionSkillAssignmentImportFails($this->getTestObject()->getId());
2309 $qsaImportFails->deleteRegisteredImportFails();
2310 $sltImportFails = new ilTestSkillLevelThresholdImportFails($this->getTestObject()->getId());
2311 $sltImportFails->deleteRegisteredImportFails();
2312
2313 $this->ctrl->redirectByClass([ilRepositoryGUI::class, self::class, ilInfoScreenGUI::class]);
2314 }
2315
2316 public function addLocatorItems(): void
2317 {
2318 switch ($this->ctrl->getCmd()) {
2319 case "run":
2320 case "infoScreen":
2321 case "redirectToInfoScreen":
2322 case "start":
2323 case "resume":
2324 case "previous":
2325 case "next":
2326 case "summary":
2327 case "finishTest":
2328 case "outCorrectSolution":
2329 case "showAnswersOfUser":
2330 case "outUserResultsOverview":
2331 case "backFromSummary":
2332 case "show_answers":
2333 case "setsolved":
2334 case "resetsolved":
2335 case "outTestSummary":
2336 case "outQuestionSummary":
2337 case "gotoQuestion":
2338 case "selectImagemapRegion":
2339 case "confirmSubmitAnswers":
2340 case "finalSubmission":
2341 case "postpone":
2342 case "outUserPassDetails":
2343 case "checkPassword":
2344 $this->locator->addItem(
2345 $this->getTestObject()->getTitle(),
2346 $this->ctrl->getLinkTargetByClass(
2347 [self::class, TestScreenGUI::class],
2348 TestScreenGUI::DEFAULT_CMD
2349 ),
2350 '',
2351 $this->testrequest->getRefId()
2352 );
2353 break;
2354 case "eval_stat":
2355 case "evalAllUsers":
2356 case "evalUserDetail":
2357 $this->locator->addItem(
2358 $this->getTestObject()->getTitle(),
2359 $this->ctrl->getLinkTarget($this, 'eval_stat'),
2360 '',
2361 $this->testrequest->getRefId()
2362 );
2363 break;
2364 case "importFile":
2365 case "cloneAll":
2366 case "importVerifiedFile":
2367 case "cancelImport":
2368 break;
2369 default:
2370 $this->locator->addItem(
2371 $this->getTestObject()->getTitle(),
2372 $this->ctrl->getLinkTargetByClass(
2373 [self::class, TestScreenGUI::class],
2374 TestScreenGUI::DEFAULT_CMD
2375 ),
2376 '',
2377 $this->testrequest->getRefId()
2378 );
2379 break;
2380 }
2381 }
2382
2383 public function statisticsObject()
2384 {
2385 }
2386
2390 public function certificateObject()
2391 {
2392 $this->tabs_manager->activateTab(TabsManager::TAB_ID_SETTINGS);
2393
2394 $guiFactory = new ilCertificateGUIFactory();
2395 $output_gui = $guiFactory->create($this->getTestObject());
2396
2397 $output_gui->certificateEditor();
2398 }
2399
2405 public function getTabs(): void
2406 {
2407 $this->help->setScreenIdComponent("tst");
2408
2409 if ($this->tabs_manager === null) {
2410 return;
2411 }
2412
2413 if ($this->getObjectiveOrientedContainer()->isObjectiveOrientedPresentationRequired()) {
2414 $courseLink = ilLink::_getLink($this->getObjectiveOrientedContainer()->getRefId());
2415 $this->tabs_manager->setParentBackLabel($this->lng->txt('back_to_objective_container'));
2416 $this->tabs_manager->setParentBackHref($courseLink);
2417 }
2418
2419 $this->tabs_manager->perform();
2420 }
2421
2422 public static function accessViolationRedirect()
2423 {
2425 global $DIC;
2426 $main_tpl = $DIC->ui()->mainTemplate();
2427
2428 $main_tpl->setOnScreenMessage('failure', $DIC->language()->txt("no_permission"), true);
2429 $DIC->ctrl()->redirectByClass(TestScreenGUI::class, TestScreenGUI::DEFAULT_CMD);
2430 }
2431
2438 public static function _goto($target)
2439 {
2440 global $DIC;
2441 $main_tpl = $DIC->ui()->mainTemplate();
2442 $ilAccess = $DIC['ilAccess'];
2443 $ilErr = $DIC['ilErr'];
2444 $lng = $DIC['lng'];
2445
2446 if ($ilAccess->checkAccess('read', '', (int) $target)
2447 || $ilAccess->checkAccess('visible', '', (int) $target)) {
2448 $DIC->ctrl()->setParameterByClass(self::class, 'ref_id', (int) $target);
2449 $DIC->ctrl()->redirectByClass(
2450 [
2451 ilRepositoryGUI::class,
2452 ilObjTestGUI::class,
2453 TestScreenGUI::class
2454 ],
2455 TestScreenGUI::DEFAULT_CMD
2456 );
2457 } elseif ($ilAccess->checkAccess('read', '', ROOT_FOLDER_ID)) {
2458 $main_tpl->setOnScreenMessage('info', sprintf(
2459 $lng->txt('msg_no_perm_read_item'),
2461 ), true);
2463 }
2464
2465 $ilErr->raiseError($lng->txt('msg_no_perm_read_lm'), $ilErr->FATAL);
2466 }
2467
2469 {
2470 $this->copyQuestionsToPool($this->testrequest->raw('q_id'), $this->testrequest->raw('sel_qpl'));
2471 $this->ctrl->redirect($this, self::SHOW_QUESTIONS_CMD);
2472 }
2473
2478 public function copyQuestionsToPool(array $question_ids, int $qpl_id): stdClass
2479 {
2480 $target_pool = new ilObjQuestionPool($qpl_id, false);
2481 $new_ids = [];
2482 foreach ($question_ids as $q_id) {
2483 $new_id = $this->copyQuestionToPool(assQuestion::instantiateQuestionGUI($q_id), $target_pool);
2484 $new_ids[$q_id] = $new_id;
2485 }
2486
2487 $result = new stdClass();
2488 $result->ids = $new_ids;
2489 $result->qpoolid = $qpl_id;
2490
2491 return $result;
2492 }
2493
2494 public function copyQuestionToPool(assQuestionGUI $source_question_gui, ilObjQuestionPool $target_pool): int
2495 {
2496 $new_title = $target_pool->appendCounterToQuestionTitleIfNecessary(
2497 $source_question_gui->getObject()->getTitle()
2498 );
2499
2500 return $source_question_gui->getObject()->createNewOriginalFromThisDuplicate($target_pool->getId(), $new_title);
2501 }
2502
2504 ?int $ref_id = null,
2505 array $question_ids = []
2506 ) {
2507
2508 $ref_id = $ref_id ?? $this->testrequest->int('sel_qpl');
2509 if ($ref_id === null
2510 || $ref_id === 0) {
2511 $this->tpl->setOnScreenMessage('failure', $this->lng->txt("questionpool_not_selected"));
2512 $this->showQuestionsObject();
2513 return;
2514 }
2515
2516 $qpl_id = $this->obj_data_cache->lookupObjId($ref_id);
2517
2518
2519 if ($question_ids === []) {
2520 $question_ids = $this->testrequest->getQuestionIds();
2521 $question_id = $this->testrequest->getQuestionId();
2522 if ($question_ids === [] && $question_id !== 0) {
2523 $question_ids = [$question_id];
2524 }
2525 }
2526
2527 if ($question_ids === []) {
2528 $this->tpl->setOnScreenMessage('failure', $this->lng->txt("tst_no_question_selected_for_moving_to_qpl"));
2529 $this->ctrl->redirect($this, 'questions');
2530 }
2531
2532 $result = $this->copyQuestionsToPool($question_ids, $qpl_id);
2533
2534 foreach ($result->ids as $oldId => $newId) {
2535 $questionInstance = assQuestion::instantiateQuestion($oldId);
2536
2537 $original_question_id = $questionInstance->getOriginalId();
2538 if ($original_question_id !== null
2539 && $this->test_questions_repository->originalQuestionExists($original_question_id)) {
2540 $oldOriginal = assQuestion::instantiateQuestion($original_question_id);
2541 $oldOriginal->delete($oldOriginal->getId());
2542 }
2543 assQuestion::saveOriginalId($questionInstance->getId(), $newId);
2544 }
2545
2546 $this->tpl->setOnScreenMessage('success', $this->lng->txt('tst_qst_added_to_pool_' . (count($result->ids) > 1 ? 'p' : 's')), true);
2547 $this->ctrl->redirect($this, self::SHOW_QUESTIONS_CMD);
2548 }
2549
2551 {
2552 $this->createQuestionpoolTargetObject('copyQuestionsToPool');
2553 }
2554
2556 {
2557 if (!$this->access->checkAccess('write', '', $this->object->getRefId())
2558 || !$this->checkPermissionBool('create', '', 'qpl')) {
2559 $this->redirectAfterMissingWrite();
2560 }
2561
2562 if ($this->testrequest->raw('title')) {
2563 $title = $this->testrequest->raw('title');
2564 } else {
2565 $title = $this->testrequest->raw('txt_qpl');
2566 }
2567
2568 if (!$title) {
2569 $this->tpl->setOnScreenMessage('failure', $this->lng->txt('questionpool_not_entered'));
2570 $this->createQuestionpoolTargetObject('createQuestionPoolAndCopy');
2571 return;
2572 }
2573
2574 $question_pool = $this->createQuestionPool($title, $this->testrequest->raw('description'));
2575 $_REQUEST['sel_qpl'] = $question_pool->getRefId();
2576
2577 $this->copyAndLinkQuestionsToPoolObject();
2578 }
2579
2584 public function createQuestionpoolTargetObject(string $cmd): void
2585 {
2586 $this->protectByWritePermission();
2587
2588 $this->tabs_manager->getQuestionsSubTabs();
2589 $this->tabs_manager->activateSubTab(TabsManager::SUBTAB_ID_QST_LIST_VIEW);
2590
2591 $questionpools = $this->getTestObject()->getAvailableQuestionpools(
2592 false,
2593 false,
2594 false,
2595 true,
2596 false,
2597 'write'
2598 );
2599
2600 if ($questionpools === []) {
2601 $form = $this->getTargetQuestionpoolForm($questionpools, 'createQuestionPoolAndCopy');
2602 } else {
2603 $form = $this->getTargetQuestionpoolForm($questionpools, $cmd);
2604
2605 switch ($cmd) {
2606 case 'copyQuestionsToPool':
2607 break;
2608
2609 case 'copyAndLinkQuestionsToPool':
2610 $hidden = new ilHiddenInputGUI('link');
2611 $hidden->setValue('1');
2612 $form->addItem($hidden);
2613 break;
2614 }
2615 }
2616
2617 $this->tpl->setContent($form->getHTML());
2618 }
2619
2620 protected function getTargetQuestionpoolForm($questionpools, string $cmd): ilPropertyFormGUI
2621 {
2622 $form = new ilPropertyFormGUI();
2623 $form->setFormAction($this->ctrl->getFormAction($this));
2624 $form->addCommandButton($cmd, $this->lng->txt('submit'));
2625 $form->addCommandButton('cancelCreateQuestion', $this->lng->txt('cancel'));
2626
2627 if (count($questionpools) == 0) {
2628 $form->setTitle($this->lng->txt("tst_enter_questionpool"));
2629
2630 $title = new ilTextInputGUI($this->lng->txt('title'), 'title');
2631 $title->setRequired(true);
2632 $form->addItem($title);
2633
2634 $description = new ilTextAreaInputGUI($this->lng->txt('description'), 'description');
2635 $form->addItem($description);
2636 } else {
2637 $form->setTitle($this->lng->txt("tst_select_questionpool"));
2638
2639 $selectOptions = [
2640 '' => $this->lng->txt('please_select')
2641 ];
2642
2643 foreach ($questionpools as $key => $value) {
2644 $selectOptions[$key] = $value["title"];
2645 }
2646
2647 $select = new ilSelectInputGUI($this->lng->txt('tst_source_question_pool'), 'sel_qpl');
2648 $select->setRequired(true);
2649 $select->setOptions($selectOptions);
2650
2651 $form->addItem($select);
2652 }
2653
2654 $table_query = $this->getQuestionsTableQuery();
2655 if ($table_query->getTableAction() !== null) {
2656 $question_ids = $table_query->getRowIds($this->object);
2657 } elseif ($this->testrequest->isset('q_id') && is_array($this->testrequest->raw('q_id'))) {
2658 $question_ids = $this->testrequest->raw('q_id');
2659 }
2660
2661 foreach ($question_ids as $id) {
2662 $hidden = new ilHiddenInputGUI('q_id[]');
2663 $hidden->setValue((string) $id);
2664 $form->addItem($hidden);
2665 }
2666
2667 return $form;
2668 }
2669
2670 protected function protectByWritePermission(): void
2671 {
2672 if (!$this->access->checkAccess('write', '', $this->ref_id)) {
2673 $this->tpl->setOnScreenMessage('info', $this->lng->txt('cannot_edit_test'), true);
2674 $this->ctrl->redirectByClass([ilRepositoryGUI::class, self::class, ilInfoScreenGUI::class]);
2675 }
2676 }
2677
2679 {
2680 if (!ilLOSettings::isObjectiveTest($this->ref_id)) {
2681 return;
2682 }
2683
2684 $path = $this->tree->getPathFull($this->ref_id);
2685
2686 while ($parent = array_pop($path)) {
2687 if ($parent['type'] === 'crs') {
2688 $container_ref_id = $parent['ref_id'];
2689 break;
2690 }
2691 }
2692
2693 $container_obj_id = ilObject2::_lookupObjId($container_ref_id);
2694
2695 $this->objective_oriented_container->setObjId($container_obj_id);
2696 $this->objective_oriented_container->setRefId($container_ref_id);
2697 }
2698
2700 {
2701 return $this->objective_oriented_container;
2702 }
2703
2705 {
2706 return new TestScreenGUI(
2707 $this->getTestObject(),
2708 $this->user,
2709 $this->ui_factory,
2710 $this->ui_renderer,
2711 $this->lng,
2712 $this->refinery,
2713 $this->ctrl,
2714 $this->tpl,
2715 $this->content_style,
2716 $this->http,
2717 $this->tabs_manager,
2718 $this->access,
2719 $this->test_access,
2720 $this->db,
2721 $this->rbac_system
2722 );
2723 }
2724
2726 {
2727 if ($this->table_query === null) {
2728 $id = $this->object ? $this->object->getId() : '';
2729 $this->table_query = new QuestionsTableQuery(
2730 $this->http,
2731 $this->refinery,
2732 $this->data_factory,
2733 ['qlist', $id]
2734 );
2735 }
2736 return $this->table_query;
2737 }
2738
2740 {
2741 if ($this->table_actions === null) {
2742 $this->table_actions = new QuestionsTableActions(
2743 $this->ui_factory,
2744 $this->ui_renderer,
2745 $this->tpl,
2746 $this->request,
2747 $this->getQuestionsTableQuery(),
2748 $this->lng,
2749 $this->ctrl,
2750 $this->test_questions_repository,
2751 new QuestionPrinter(
2752 $this->ui_factory,
2753 $this->tpl,
2754 $this->tabs_manager,
2755 $this->toolbar,
2756 $this->refinery,
2757 $this->lng,
2758 $this->ctrl,
2759 $this->user,
2761 $this->getTestObject()
2762 ),
2763 $this->object,
2764 $this->getTestObject()->getGlobalSettings()->isAdjustingQuestionsWithResultsAllowed(),
2765 $this->getTestObject()->evalTotalPersons() !== 0,
2766 $this->getTestObject()->isRandomTest(),
2767 $this->test_question_set_config_factory
2768 );
2769 }
2770 return $this->table_actions;
2771 }
2772
2773 protected function getTable(): QuestionsTable
2774 {
2775 return new QuestionsTable(
2776 $this->ui_factory,
2777 $this->refinery,
2778 $this->http->request(),
2779 $this->getQuestionsTableActions(),
2780 $this->lng,
2781 $this->object,
2782 $this->test_questions_repository,
2783 $this->title_builder
2784 );
2785 }
2786
2787 private function userCanCreatePoolAtCurrentLocation(): bool
2788 {
2789 return $this->settings->get('obj_dis_creation_qpl') !== '1'
2790 && $this->checkPermissionBool('create', '', 'qpl', $this->tree->getParentId($this->ref_id));
2791 }
2792}
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
$components
Builds data types.
Definition: Factory.php:36
Stream factory which enables the user to create streams without the knowledge of the concrete class.
Definition: Streams.php:32
@ilCtrl_Calls ILIAS\Test\Settings\MainSettings\SettingsMainGUI: ilPropertyFormGUI @ilCtrl_Calls ILIAS...
@depracated This is only a temporary exception to identify missing migrations and will be removed in ...
GUI class for public user profile presentation.
const IL_CAL_UNIX
error(string $a_errmsg)
setMoveAfterQuestionId(?int $question_id)
setCopyToNewPoolOnSave(?string $pool_title)
static _getQuestionGUI(string $question_type='', int $question_id=-1)
Creates a question gui representation and returns the alias to the question gui.
editQuestion(bool $checkonly=false, ?bool $is_save_cmd=null)
setCopyToExistingPoolOnSave(?int $pool_ref_id)
const ADDITIONAL_CONTENT_EDITING_MODE_RTE
const ADDITIONAL_CONTENT_EDITING_MODE_IPE
static saveOriginalId(int $questionId, int $originalId)
static instantiateQuestion(int $question_id)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Question page GUI class.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static _recordReadEvent(string $a_type, int $a_ref_id, int $obj_id, int $usr_id, $a_ext_rc=null, $a_ext_time=null)
static getInstanceFromAjaxCall()
(Re-)Build instance from ajax call
static formatDate(ilDateTime $date, bool $a_skip_day=false, bool $a_include_wd=false, bool $include_seconds=false, ?ilObjUser $user=null,)
@classDescription Date and time handling
static delDir(string $a_dir, bool $a_clean_only=false)
removes a dir and all its content (subdirs and files) recursively
Help GUI class.
This class represents a hidden form property in a property form.
Import class.
Class ilInfoScreenGUI.
static isObjectiveTest(int $a_trst_ref_id)
Check if test ref_id is used in an objective course.
GUI class for LTI provider object settings.
static checkAccess(int $a_ref_id, bool $a_allow_only_read=true)
check access to learning progress
Class ilObjUserTrackingGUI.
Class ilLocalUnitConfigurationGUI.
Last visited history for repository items.
Class ilObjFile.
static _getAvailableQuestionpools(bool $use_object_id=false, bool $equal_points=false, bool $could_be_offline=false, bool $showPath=false, bool $with_questioncount=false, string $permission='read', int $usr_id=0)
Returns the available question pools for the active user.
static getQuestionTypeByTypeId($type_id)
appendCounterToQuestionTitleIfNecessary(string $title)
Class ilObjTestGUI.
RequestDataCollector $testrequest
SkillService $skills_service
addQuestionTitleToObjectTitle(string $question_title)
createQuestionpoolTargetObject(string $cmd)
Called when a new question should be created from a test Important: $cmd may be overwritten if no que...
addPostCreationTasksToQuestionGUI(assQuestionGUI $question_gui)
executeAfterQuestionCreationTasks(assQuestionGUI $question_gui)
download_paragraphObject()
download source code paragraph
GeneralQuestionPropertiesRepository $questionrepository
TestTopListRepository $toplist_repository
addLocatorItems()
should be overwritten to add object specific items (repository items are preloaded)
ilTestPlayerFactory $test_player_factory
static _goto($target)
Redirect script to call a test with the test reference id.
ResponseHandler $response_handler
ExportRepository $export_repository
TestResultRepository $test_pass_result_repository
ParticipantRepository $participant_repository
showNextViewAfterQuestionSave(assQuestionGUI $question_gui, string $target)
ilComponentRepository $component_repository
MarksRepository $marks_repository
createQuestionPool($name="dummy", $description="")
MainSettingsRepository $main_settings_repository
PersonalSettingsRepository $personal_settings_templates_repository
SettingsFactory $settings_factory
ilNavigationHistory $navigation_history
insertQuestionsObject(?array $selected_array=null)
ExportImportFactory $export_factory
TitleColumnsBuilder $title_builder
getTargetQuestionpoolForm($questionpools, string $cmd)
QuestionsTableActions $table_actions
importFile(string $file_to_import, string $path_to_uploaded_file_in_temp_dir)
participantsActionObject()
Evaluates the actions on the participants page.
TaxonomyService $taxonomy
executeCommand()
execute command
QPLRequestDataCollector $qplrequest
ilTestObjectiveOrientedContainer $objective_oriented_container
ilTestQuestionSetConfigFactory $test_question_set_config_factory
SkillUsageService $skill_usage_service
forwardCommandToQuestionPreview(string $cmd, ?assQuestionGUI $question_gui=null)
ResultsDataFactory $results_data_factory
ilTestParticipantAccessFilterFactory $participant_access_filter_factory
forwardCommandToQuestion(string $cmd)
MarkSchemaFactory $mark_schema_factory
afterSave(ilObject $new_object)
save object @access public
populateQuestionBrowserToolbarButtons(ilToolbarGUI $toolbar)
TestQuestionsRepository $test_questions_repository
AdditionalInformationGenerator $additional_information_generator
ilTestSessionFactory $test_session_factory
ilUIService $ui_service
showTemplatesObject(?Modal $modal=null)
downloadFileObject()
download file
const QUESTION_CREATION_POOL_SELECTION_NO_POOL
copyAndLinkQuestionsToPoolObject(?int $ref_id=null, array $question_ids=[])
setupToolBarAndMessage(bool $has_started_test_runs)
copyQuestionsToPool(array $question_ids, int $qpl_id)
getTabs()
adds tabs to tab gui object
const QUESTION_CREATION_POOL_SELECTION_EXISTING_POOL
fullscreenObject()
show fullscreen view
GlobalScreen $global_screen
ContentStyle $content_style
copyQuestionToPool(assQuestionGUI $source_question_gui, ilObjQuestionPool $target_pool)
createQuestionFormObject(?Form $form=null)
ilDBInterface $db
executeAfterQuestionSaveTasks(assQuestionGUI $question_gui)
exportObject()
Gateway for exports initiated from workspace, as there is a generic forward to {objTypeMainGUI}::expo...
buildInputPosition(array $questions)
setTestAccess(ilTestAccess $test_access)
ilObjectDataCache $obj_data_cache
ScoreSettingsRepository $score_settings_repository
GUIFactory $gui_factory
DataFactory $data_factory
const QUESTION_CREATION_POOL_SELECTION_NEW_POOL
ilComponentFactory $component_factory
redirectTo_SettingsMainGUI_showForm_Object()
PersonalSettingsExporter $personal_settings_exporter
QuestionsTableQuery $table_query
importVerifiedFileObject(bool $skip_retrieve_selected_questions=false)
imports question(s) into the questionpool (after verification)
ilTestAccess $test_access
ResultsPresentationFactory $results_presentation_factory
certificateObject()
Shows the certificate editor.
TabsManager $tabs_manager
const QUESTION_SET_TYPE_FIXED
GUI class for the workflow of copying objects.
class ilObjectDataCache
Class ilObjectGUI Basic methods of all Output classes.
static _gotoRepositoryRoot(bool $raise_error=false)
Goto repository root.
setCreationMode(bool $mode=true)
If true, a creation screen is displayed the current [ref_id] does belong to the parent class The mode...
addHeaderAction()
Add header action menu.
prepareOutput(bool $show_sub_objects=true)
Class ilObjectMetaDataGUI.
Class ilObject Basic functions for all objects.
static _lookupObjId(int $ref_id)
static _lookupTitle(int $obj_id)
This class represents a property form user interface.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This class represents a selection list property in a property form.
static get(string $a_var)
static clear(string $a_var)
static set(string $a_var, $a_val)
Set a value.
ILIAS Setting Class.
Output class for assessment test evaluation.
Base Exception for all Exceptions relating to Modules/Test.
Export User Interface Class.
Class that handles PDF generation for test and assessment.
Importer class for files.
@ilCtrl_Calls ilTestPageGUI: ilPageEditorGUI, ilEditClipboardGUI, ilMDEditorGUI @ilCtrl_Calls ilTestP...
Class ilTestParticipantsGUI.
@ilCtrl_Calls ilTestQuestionBrowserTableGUI: ilFormPropertyDispatchGUI
Service GUI class for tests.
This class represents a text area property in a property form.
This class represents a text property in a property form.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
addButton(string $a_txt, string $a_cmd, string $a_target="", ?int $a_acc_key=null, string $a_additional_attrs='', string $a_id="", string $a_class='submit')
Filter service.
Class ilUnitConfigurationRepository.
static stripSlashes(string $a_str, bool $a_strip_html=true, string $a_allow="")
static redirect(string $a_script)
static deliverData(string $a_data, string $a_filename, string $mime="application/octet-stream")
const SYSTEM_ROLE_ID
Definition: constants.php:29
const IL_INST_ID
Definition: constants.php:40
const ROOT_FOLDER_ID
Definition: constants.php:32
exit
$info
Definition: entry_point.php:21
This describes commonalities between all forms.
Definition: Form.php:34
This is what a radio-input looks like.
Definition: Radio.php:29
This describes select field.
Definition: Select.php:29
This describes switchable group inputs.
This describes commonalities between all inputs.
Definition: Input.php:47
withValue($value)
Get an input like this with another value displayed on the client side.
This describes commonalities between the different modals.
Definition: Modal.php:35
Readable part of repository interface to ilComponentDataDB.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Interface ilDBInterface.
$ref_id
Definition: ltiauth.php:66
$path
Definition: ltiservices.php:30
static http()
Fetches the global http state from ILIAS.
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
buildImportQuestionsSelectionForm(string $form_cmd, string $importdir, string $qtifile, ?string $path_to_uploaded_file_in_temp_dir=null)
buildImportDirectoriesFromImportFile(string $file_to_import)
buildResultsFilePath(string $importdir, string $subdir)
retrieveSelectedQuestionsFromImportQuestionsSelectionForm(string $form_cmd, string $importdir, string $qtifile, ServerRequestInterface $request)
global $lng
Definition: privfeed.php:26
$ilErr
Definition: raiseError.php:33
if(!file_exists('../ilias.ini.php'))
global $DIC
Definition: shib_login.php:26