ILIAS  trunk Revision v12.0_alpha-1227-g7ff6d300864
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 (!$this->test_access->checkOtherParticipantsLearningProgressAccess()
562 && !$this->getTestObject()->canShowTestResults($test_session)) {
563 $this->tpl->setOnScreenMessage(
564 'info',
565 $this->lng->txt('tst_res_tab_msg_no_lp_access'),
566 );
567 break;
568 }
569
571 $this->ctrl->forwardCommand($new_gui);
572
573 break;
574
575 case "ilcertificategui":
576 if ((!$this->access->checkAccess("read", "", $this->testrequest->getRefId()))) {
578 }
579 $this->prepareOutput();
580 $this->addHeaderAction();
581
582 $this->tabs_manager->activateTab(TabsManager::TAB_ID_SETTINGS);
583
585 $output_gui = $gui_factory->create($this->getTestObject());
586
587 $this->ctrl->forwardCommand($output_gui);
588 break;
589
590 case strtolower(ConsecutiveScoringGUI::class):
591 if ((!$this->access->checkAccess("read", "", $this->testrequest->getRefId()))) {
593 }
594 $output_gui = $this->gui_factory->get(ConsecutiveScoringGUI::class, $this->getTestObject());
595 $this->prepareOutput();
596 $this->ctrl->forwardCommand($output_gui);
597 $this->addHeaderAction();
598 break;
599
600
601 case strtolower(MarkSchemaGUI::class):
602 if ((!$this->access->checkAccess("read", "", $this->testrequest->getRefId()))) {
604 }
606
607 $mark_schema_gui = new MarkSchemaGUI(
608 $this->getTestObject(),
609 $this->user,
610 $this->lng,
611 $this->ctrl,
612 $this->tpl,
613 $this->toolbar,
614 $this->getObject()->getTestLogger(),
615 $this->post_wrapper,
616 $this->request_wrapper,
617 $this->response_handler,
618 $this->request,
619 $this->refinery,
620 $this->ui_factory,
621 $this->ui_renderer,
622 $this->mark_schema_factory
623 );
624 $this->ctrl->forwardCommand($mark_schema_gui);
625
626 $this->prepareOutput();
627 $this->addHeaderAction();
628 $this->tabs_manager->activateTab(TabsManager::TAB_ID_SETTINGS);
629 $this->tabs_manager->activateSubTab(TabsManager::SETTINGS_SUBTAB_ID_MARK_SCHEMA);
630
631 break;
632
633 case strtolower(SettingsMainGUI::class):
634 if ((!$this->access->checkAccess("read", "", $this->testrequest->getRefId()))) {
636 }
637
638 $gui = new SettingsMainGUI(
639 $this->tpl,
640 $this->ctrl,
641 $this->access,
642 $this->lng,
643 $this->tree,
644 $this->db,
645 $this->obj_data_cache,
646 $this->settings,
647 $this->ui_factory,
648 $this->ui_renderer,
649 $this->refinery,
650 $this->request,
651 $this->component_repository,
652 $this->user,
653 $this,
654 $this->getTestObject()->getTestLogger(),
655 $this->questionrepository
656 );
657 $this->ctrl->forwardCommand($gui);
658 $this->prepareOutput();
659 $this->tabs_manager->activateTab(TabsManager::TAB_ID_SETTINGS);
660 $this->tabs_manager->activateSubTab(TabsManager::SUBTAB_ID_GENERAL_SETTINGS);
661 $this->addHeaderAction();
662 break;
663
664 case strtolower(SettingsScoringGUI::class):
665 if ((!$this->access->checkAccess("read", "", $this->testrequest->getRefId()))) {
667 }
668 $this->prepareOutput();
669 $this->addHeaderAction();
670 $gui = new SettingsScoringGUI(
671 $this->ctrl,
672 $this->access,
673 $this->lng,
674 $this->tree,
675 $this->db,
676 $this->component_repository,
677 $this,
678 $this->tpl,
679 $this->tabs_gui,
680 $this->getTestObject()->getTestLogger(),
681 $this->getTestObject()->getScoreSettingsRepository(),
682 $this->getTestObject()->getTestId(),
683 $this->ui_factory,
684 $this->ui_renderer,
685 $this->refinery,
686 $this->request,
687 $this->user
688 );
689
690 $this->ctrl->forwardCommand($gui);
691 break;
692
693 case 'iltestrandomquestionsetconfiggui':
694 if ((!$this->access->checkAccess("read", "", $this->testrequest->getRefId()))) {
696 }
697 $this->prepareOutput();
698 $this->addHeaderAction();
699 $test_process_locker_factory = (new ilTestProcessLockerFactory(
700 new ilSetting('assessment'),
701 $this->db,
702 $this->getTestObject()->getTestLogger()
703 ))->withContextId($this->getTestObject()->getId());
705 $this->getTestObject(),
706 $this->ctrl,
707 $this->user,
708 $this->access,
709 $this->ui_factory,
710 $this->ui_renderer,
711 $this->data_factory,
712 $this->tabs_manager,
713 $this->lng,
714 $this->getTestObject()->getTestlogger(),
715 $this->tpl,
716 $this->db,
717 $this->tree,
718 $this->component_repository,
719 $this->obj_definition,
720 $this->obj_data_cache,
721 $test_process_locker_factory,
722 $this->testrequest,
723 $this->title_builder,
724 $this->questionrepository
725 );
726 $this->ctrl->forwardCommand($gui);
727 break;
728
729 case 'iltestquestionbrowsertablegui':
730 if ((!$this->access->checkAccess("read", "", $this->testrequest->getRefId()))) {
732 }
733 $this->prepareOutput();
734 $this->addHeaderAction();
736 $this->tabs_gui,
737 $this->tree,
738 $this->db,
739 $this->getTestObject()->getTestlogger(),
740 $this->component_repository,
741 $this->getTestObject(),
742 $this->user,
743 $this->access,
744 $this->http,
745 $this->refinery,
746 $this->ui_factory,
747 $this->ui_renderer,
748 $this->testrequest,
749 $this->questionrepository,
750 $this->lng,
751 $this->ctrl,
752 $this->tpl,
753 $this->ui_service,
754 $this->data_factory,
755 $this->taxonomy,
756 );
757 $this->ctrl->forwardCommand($gui);
758 break;
759
760 case 'iltestskilladministrationgui':
761 if ((!$this->access->checkAccess("read", "", $this->testrequest->getRefId()))) {
763 }
764 $this->prepareOutput();
765 $this->addHeaderAction();
767 $this->ctrl,
768 $this->access,
769 $this->tabs_manager,
770 $this->tpl,
771 $this->lng,
772 $this->refinery,
773 $this->db,
774 $this->getTestObject()->getTestlogger(),
775 $this->tree,
776 $this->component_repository,
777 $this->getTestObject(),
778 $this->questionrepository,
779 $this->testrequest,
780 $this->http,
781 $this->toolbar,
782 $this->skill_usage_service,
783 $this->ui_factory,
784 $this->ui_renderer,
785 $this->tabs_gui,
786 $this->ref_id
787 );
788 $this->ctrl->forwardCommand($gui);
789 break;
790
791 case 'ilobjectcopygui':
792 if ((!$this->access->checkAccess("copy", "", $this->testrequest->getRefId()))) {
794 }
795 $this->prepareOutput();
796 $this->addHeaderAction();
797 $cp = new ilObjectCopyGUI($this);
798 $cp->setType('tst');
799 $this->ctrl->forwardCommand($cp);
800 break;
801
802 case strtolower(ilAssQuestionPreviewGUI::class):
803 if (!$this->access->checkAccess('write', '', $this->getTestObject()->getRefId())) {
805 }
806 $this->prepareOutput();
808 break;
809 case 'ilassquestionpagegui':
810 if ($cmd === 'finishEditing') {
811 $this->prepareOutput();
813 break;
814 }
815 if ((!$this->access->checkAccess("read", "", $this->testrequest->getRefId()))) {
817 }
818 if ($cmd === 'edit' && !$this->access->checkAccess('write', '', $this->testrequest->getRefId())) {
820 }
821 $this->prepareOutput();
822 $forwarder = new ilAssQuestionPageCommandForwarder(
823 $this->getTestObject(),
824 $this->lng,
825 $this->ctrl,
826 $this->tpl,
827 $this->questionrepository,
828 $this->testrequest
829 );
830 $forwarder->forward();
831 break;
832
833 case 'ilassspecfeedbackpagegui':
834 if ((!$this->access->checkAccess("write", "", $this->testrequest->getRefId()))) {
836 }
837 $pg_gui = new ilAssSpecFeedbackPageGUI((int) $this->testrequest->raw("feedback_id"));
838 $this->ctrl->forwardCommand($pg_gui);
839 break;
840
841 case 'ilassgenfeedbackpagegui':
842 if ((!$this->access->checkAccess("write", "", $this->testrequest->getRefId()))) {
844 }
845 $pg_gui = new ilAssGenFeedbackPageGUI($this->testrequest->int("feedback_id"));
846 $this->ctrl->forwardCommand($pg_gui);
847 break;
848
849 case 'illocalunitconfigurationgui':
850 if ((!$this->access->checkAccess("write", "", $this->testrequest->getRefId()))) {
852 }
853 $this->prepareSubGuiOutput();
854
855 // set return target
857 $question = $question_gui->getObject();
858 $question->setObjId($this->getTestObject()->getId());
859 $question_gui->setObject($question);
860 $question_gui->setQuestionTabs();
862 new ilUnitConfigurationRepository($this->testrequest->getQuestionId())
863 );
864 $this->ctrl->forwardCommand($gui);
865 break;
866
867 case "ilcommonactiondispatchergui":
868 if (!$this->access->checkAccess("read", "", $this->testrequest->getRefId()) && !$this->access->checkAccess("visible", "", $this->testrequest->getRefId())) {
870 }
871 $this->prepareOutput();
873 $this->ctrl->forwardCommand($gui);
874 break;
875
876 case 'ilassquestionfeedbackeditinggui':
877 if (!$this->access->checkAccess('write', '', $this->getTestObject()->getRefId())) {
879 }
880 $this->prepareSubGuiOutput();
881
882 // set return target
883 $this->ctrl->setReturnByClass(self::class, self::SHOW_QUESTIONS_CMD);
885 $question = $question_gui->getObject();
886 $question->setObjId($this->getTestObject()->getId());
887 $question_gui->setObject($question);
888 $question_gui->setQuestionTabs();
889 $question_gui->setContextAllowsSyncToPool(true);
890
891 $this->addQuestionTitleToObjectTitle($question->getTitleForHTMLOutput());
892
893 if ($this->getTestObject()->evalTotalPersons() !== 0) {
894 $this->tpl->setOnScreenMessage('failure', $this->lng->txt('question_is_part_of_running_test'), true);
895 $this->prepareOutput();
897 }
899 $question_gui,
900 $this->ctrl,
901 $this->access,
902 $this->tpl,
903 $this->tabs_gui,
904 $this->lng,
905 $this->help,
906 $this->qplrequest,
907 $this->content_style
908 );
909 $this->ctrl->forwardCommand($gui);
910 break;
911
912 case 'iltestcorrectionsgui':
913 if ((!$this->access->checkAccess('read', '', $this->testrequest->getRefId()))) {
915 }
916 $this->prepareOutput();
917 $gui = new ilTestCorrectionsGUI(
918 $this->db,
919 $this->ctrl,
920 $this->lng,
921 $this->tabs_gui,
922 $this->help,
923 $this->ui_factory,
924 $this->tpl,
925 $this->refinery,
926 $this->getTestObject()->getTestLogger(),
927 $this->testrequest,
928 $this->getTestObject(),
929 $this->user,
930 $this->test_pass_result_repository
931 );
932 $this->ctrl->forwardCommand($gui);
933 break;
934
935 case 'iltestpagegui':
936 if ((!$this->access->checkAccess("write", "", $this->testrequest->getRefId()))) {
938 }
939
940 if ($cmd === 'downloadFile') {
941 $page_id = $this->object->getIntroductionPageId();
942 if ($this->testrequest->strVal('page_type') === 'concludingremarkspage') {
943 $page_id = $this->object->getConcludingRemarksPageId();
944 }
945 $this->ctrl->forwardCommand(new ilTestPageGUI('tst', $page_id));
946 }
947 $this->showEditTestPageGUI();
948 break;
949
950 case '':
951 case 'ilobjtestgui':
952 if (!$this->access->checkAccess('read', '', $this->testrequest->getRefId())
953 && !$this->access->checkAccess('visible', '', $this->testrequest->getRefId())) {
955 }
956 $this->prepareOutput();
957 $this->addHeaderAction();
958
959 if ($cmd === 'testScreen') {
960 $this->ctrl->forwardCommand($this->getTestScreenGUIInstance());
961 return;
962 }
963
964 $local_cmd = "{$cmd}Object";
965
966 if (!method_exists($this, $local_cmd)) {
967 $local_cmd = self::SHOW_QUESTIONS_CMD . 'Object';
968 }
969 $this->$local_cmd();
970 break;
971
972 default:
973 if ((!$this->access->checkAccess('read', '', $this->testrequest->getRefId()))) {
975 }
976 if (in_array(
977 $cmd,
978 ['editQuestion', 'previewQuestion', 'save', 'saveReturn', 'uploadImage',
979 'removeImage', 'syncQuestion', 'syncQuestionReturn', 'suggestedsolution']
980 )
981 && !$this->access->checkAccess('write', '', $this->getTestObject()->getRefId())) {
983 }
984 if (in_array($cmd, ['editQuestion', 'save', 'saveReturn', 'suggestedsolution'])
985 && $this->getTestObject()->evalTotalPersons() !== 0) {
986 $this->tpl->setOnScreenMessage('failure', $this->lng->txt('question_is_part_of_running_test'), true);
987 $this->prepareOutput();
989 return;
990 }
991 $this->forwardCommandToQuestion($cmd);
992 break;
993 }
994 if (!in_array(strtolower($this->testrequest->raw('baseClass')), ['iladministrationgui', 'ilrepositorygui'])
995 && $this->getCreationMode() !== true) {
996 $this->tpl->printToStdout();
997 }
998 }
999
1000 protected function redirectAfterMissingWrite()
1001 {
1002 $this->tpl->setOnScreenMessage('failure', $this->lng->txt('no_permission'), true);
1003 $target_class = get_class($this->object) . 'GUI';
1004 $this->ctrl->setParameterByClass($target_class, 'ref_id', $this->ref_id);
1005 $this->ctrl->redirectByClass($target_class);
1006 }
1007
1008 protected function redirectAfterMissingRead(): void
1009 {
1010 $this->tpl->setOnScreenMessage('failure', sprintf(
1011 $this->lng->txt("msg_no_perm_read_item"),
1012 $this->object->getTitle()
1013 ), true);
1014 $this->ctrl->setParameterByClass('ilrepositorygui', 'ref_id', ROOT_FOLDER_ID);
1015 $this->ctrl->redirectByClass('ilrepositorygui');
1016 }
1017
1019 string $cmd,
1020 ?assQuestionGUI $question_gui = null
1021 ): void {
1022 $nr_of_participants_with_results = $this->getTestObject()->evalTotalPersons();
1023
1024 $this->ctrl->saveParameterByClass(self::class, 'q_id');
1025 $gui = new ilAssQuestionPreviewGUI(
1026 $this->ctrl,
1027 $this->rbac_system,
1028 $this->tabs_gui,
1029 $this->toolbar,
1030 $this->tpl,
1031 $this->ui_factory,
1032 $this->lng,
1033 $this->db,
1034 $this->refinery->random(),
1035 $this->global_screen,
1036 $this->http,
1037 $this->refinery,
1038 $this->ref_id
1039 );
1040
1041 if ($nr_of_participants_with_results > 0) {
1042 $gui->addAdditionalCmd(
1043 $this->lng->txt('tst_corrections_qst_form'),
1044 $this->ctrl->getLinkTargetByClass(ilTestCorrectionsGUI::class, 'showQuestion')
1045 );
1046 }
1047
1048 $question_gui ??= assQuestion::instantiateQuestionGUI($this->fetchAuthoringQuestionIdParameter());
1049
1050 $this->addQuestionTitleToObjectTitle($question_gui->getObject()->getTitleForHTMLOutput());
1051
1052 if (!$this->getTestObject()->isRandomTest() && $nr_of_participants_with_results === 0) {
1053 $gui->setPrimaryCmd(
1054 $this->lng->txt('edit_question'),
1055 $this->ctrl->getLinkTargetByClass(
1056 get_class($question_gui),
1057 'editQuestion'
1058 )
1059 );
1060 $gui->addAdditionalCmd(
1061 $this->lng->txt('edit_page'),
1062 $this->ctrl->getLinkTargetByClass(
1063 ilAssQuestionPageGUI::class,
1064 'edit'
1065 )
1066 );
1067 }
1068
1069 $gui->initQuestion($question_gui, $this->getTestObject()->getId());
1070 $gui->initPreviewSettings($this->getTestObject()->getRefId());
1071 $gui->initPreviewSession($this->user->getId(), $this->testrequest->getQuestionId());
1072 $gui->initStyleSheets();
1073
1074 $this->ctrl->clearParameterByClass(self::class, 'q_id');
1075 $this->tabs_gui->setBackTarget(
1076 $this->lng->txt('backtocallingtest'),
1077 $this->ctrl->getLinkTargetByClass(self::class, self::SHOW_QUESTIONS_CMD)
1078 );
1079 $this->ctrl->saveParameterByClass(self::class, 'q_id');
1080 $gui->{$cmd . 'Cmd'}();
1081 }
1082
1083 private function addQuestionTitleToObjectTitle(string $question_title): void
1084 {
1085 $this->tpl->setTitle(
1086 $this->refinery->encode()->htmlSpecialCharsAsEntities()->transform(
1087 "{$this->getTestObject()->getTitle()}: {$question_title}"
1088 )
1089 );
1090 }
1091
1092 protected function forwardCommandToQuestion(string $cmd): void
1093 {
1094 $this->create_question_mode = true;
1095 $this->prepareOutput();
1096
1097 try {
1098 $qid = $this->fetchAuthoringQuestionIdParameter();
1099
1100 $this->ctrl->setReturnByClass(self::class, self::SHOW_QUESTIONS_CMD);
1101
1102 $question_gui = assQuestionGUI::_getQuestionGUI(
1103 ilUtil::stripSlashes($this->testrequest->strVal('question_type')),
1104 $qid
1105 );
1106
1107 $question_gui->setEditContext(assQuestionGUI::EDIT_CONTEXT_AUTHORING);
1108 $question = $question_gui->getObject();
1109 $question->setObjId($this->getTestObject()->getId());
1110 $question_gui->setObject($question);
1111 $question_gui->setContextAllowsSyncToPool(true);
1112 $question_gui->setQuestionTabs();
1113
1114 $this->addQuestionTitleToObjectTitle($question->getTitleForHTMLOutput());
1115
1116 $target = strpos($cmd, 'Return') === false ? 'stay' : 'return';
1117
1118 if (in_array($cmd, ['syncQuestion', 'syncQuestionReturn'])) {
1119 $question_gui->syncQuestion();
1120 $this->showNextViewAfterQuestionSave($question_gui, $target);
1121 return;
1122 }
1123
1124 if ($question_gui->isSaveCommand()
1125 || $question_gui->cmdNeedsExistingQuestion($cmd)) {
1126 $question_gui = $this->addPostCreationTasksToQuestionGUI($question_gui);
1127 }
1128
1129 if ($qid === 0 && $question_gui->cmdNeedsExistingQuestion($cmd)) {
1130 $question_gui->getObject()->createNewQuestion();
1131 $question_gui->setQuestionTabs();
1132 $this->executeAfterQuestionCreationTasks($question_gui);
1133 }
1134
1135 if (!$question_gui->isSaveCommand()) {
1136 $this->ctrl->forwardCommand($question_gui);
1137 return;
1138 }
1139
1140 if (!$question_gui->saveQuestion()) {
1141 return;
1142 }
1143
1144 $this->tpl->setOnScreenMessage('success', $this->lng->txt('msg_obj_modified'), true);
1145 if ($qid === 0) {
1146 $this->executeAfterQuestionCreationTasks($question_gui);
1147 }
1148 $this->executeAfterQuestionSaveTasks($question_gui);
1149 $this->showNextViewAfterQuestionSave($question_gui, $target);
1150 } catch (ilTestException $e) {
1151 $this->showQuestionsObject();
1152 }
1153 }
1154
1156 assQuestionGUI $question_gui
1157 ): assQuestionGUI {
1158 if ($this->testrequest->isset('move_after_question_with_id')) {
1159 $question_gui->setMoveAfterQuestionId(
1160 $this->testrequest->int('move_after_question_with_id')
1161 );
1162 }
1163
1164 if ($this->testrequest->isset('pool_title')) {
1165 $question_gui->setCopyToNewPoolOnSave(
1166 $this->testrequest->strVal('pool_title')
1167 );
1168 }
1169
1170 if ($this->testrequest->isset('pool_ref')) {
1171 $question_gui->setCopyToExistingPoolOnSave(
1172 $this->testrequest->int('pool_ref')
1173 );
1174 }
1175 return $question_gui;
1176 }
1177
1178 private function executeAfterQuestionSaveTasks(assQuestionGUI $question_gui): void
1179 {
1180 if ($this->getTestObject()->getTestLogger()->isLoggingEnabled()) {
1181 $this->getTestObject()->getTestLogger()->logQuestionAdministrationInteraction(
1182 $question_gui->getObject()->toQuestionAdministrationInteraction(
1183 $this->getTestObject()->getTestLogger()->getAdditionalInformationGenerator(),
1184 $this->getTestObject()->getRefId(),
1185 TestQuestionAdministrationInteractionTypes::QUESTION_MODIFIED
1186 )
1187 );
1188 }
1189 }
1190
1191 private function executeAfterQuestionCreationTasks(assQuestionGUI $question_gui): void
1192 {
1193 if ($this->getTestObject()->getQuestionSetType() === ilObjTest::QUESTION_SET_TYPE_FIXED
1194 && !in_array($question_gui->getObject()->getId(), $this->getTestObject()->getQuestions())) {
1195 $this->getTestObject()->insertQuestion($question_gui->getObject()->getId(), true);
1196 }
1197
1198 if ($question_gui->getMoveAfterQuestionId() !== null) {
1199 $this->getTestObject()->moveQuestions(
1200 [$question_gui->getObject()->getId()],
1201 $question_gui->getMoveAfterQuestionId() === 0
1202 ? $this->getTestObject()->getQuestions()[1]
1203 : $question_gui->getMoveAfterQuestionId(),
1204 $question_gui->getMoveAfterQuestionId() === 0 ? 0 : 1
1205 );
1206 $question_gui->setMoveAfterQuestionId(null);
1207 }
1208
1209 if ($question_gui->getCopyToExistingPoolOnSave() !== null) {
1210 $original_id = $this->copyQuestionToPool(
1211 $question_gui,
1213 );
1214 assQuestion::saveOriginalId($question_gui->getObject()->getId(), $original_id);
1215 $question_gui->setCopyToExistingPoolOnSave(null);
1216 }
1217
1218 if ($question_gui->getCopyToNewPoolOnSave() !== null) {
1219 $question_pool = $this->createQuestionPool($question_gui->getCopyToNewPoolOnSave());
1220 $original_id = $this->copyQuestionToPool(
1221 $question_gui,
1222 $question_pool
1223 );
1224 assQuestion::saveOriginalId($question_gui->getObject()->getId(), $original_id);
1225 $question_gui->setCopyToNewPoolOnSave(null);
1226 }
1227 }
1228
1229 private function showNextViewAfterQuestionSave(assQuestionGUI $question_gui, string $target): void
1230 {
1231 if ($target === 'return') {
1232 $this->forwardCommandToQuestionPreview(
1234 $question_gui
1235 );
1236 }
1237
1238 if ($target === 'stay') {
1239 $this->ctrl->setParameterByClass(ilAssQuestionPreviewGUI::class, 'q_id', $question_gui->getObject()->getId());
1240 $this->tabs_gui->setBackTarget(
1241 $this->lng->txt('backtocallingpage'),
1242 $this->ctrl->getLinkTargetByClass(
1243 ilAssQuestionPreviewGUI::class,
1245 )
1246 );
1247 $question_gui->editQuestion(false, false);
1248 }
1249 }
1250
1251 protected function trackTestObjectReadEvent()
1252 {
1254 $this->getTestObject()->getType(),
1255 $this->getTestObject()->getRefId(),
1256 $this->getTestObject()->getId(),
1257 $this->user->getId()
1258 );
1259 }
1260
1265 protected function exportObject()
1266 {
1267 $this->ctrl->redirectByClass('ilTestExportGUI');
1268 }
1269
1275 {
1276 $qid = $this->testrequest->int('q_id');
1277
1278 if ($qid === 0 || $this->getTestObject()->checkQuestionParent($qid)) {
1279 return $qid;
1280 }
1281
1282 throw new ilTestException('question id does not relate to parent object!');
1283 }
1284
1285 private function questionsTabGatewayObject()
1286 {
1287 if ($this->getTestObject()->isRandomTest()) {
1288 $this->ctrl->redirectByClass('ilTestRandomQuestionSetConfigGUI');
1289 }
1290
1291 $this->ctrl->redirectByClass('ilObjTestGUI', self::SHOW_QUESTIONS_CMD);
1292 }
1293
1294 private function showEditTestPageGUI(): void
1295 {
1296 $this->prepareOutput();
1297 $this->tabs_manager->getSettingsSubTabs();
1298
1299 if ($this->request_wrapper->has('page_type')
1300 && $this->request_wrapper->retrieve(
1301 'page_type',
1302 $this->refinery->kindlyTo()->string()
1303 ) === 'introductionpage'
1304 ) {
1305 $page_type = 'IntroductionPage';
1306 $this->tabs_manager->activateSubTab(TabsManager::SETTINGS_SUBTAB_ID_EDIT_INTRODUCTION_PAGE);
1307 $page_id = $this->getTestObject()->getIntroductionPageId();
1308 } else {
1309 $page_type = 'ConcludingRemarksPage';
1310 $this->tabs_manager->activateSubTab(TabsManager::SETTINGS_SUBTAB_ID_EDIT_CONCLUSION_PAGE);
1311 $page_id = $this->getTestObject()->getConcludingRemarksPageId();
1312 }
1313 $this->ctrl->saveParameterByClass(ilTestPageGUI::class, 'page_type');
1314
1315 $gui = new ilTestPageGUI('tst', $page_id);
1316 $this->content_style->gui()->addCss($this->tpl, $this->ref_id);
1317 $this->tpl->setContent($this->ctrl->forwardCommand($gui));
1318
1319 if ($this->ctrl->getCmdClass() === strtolower(ilTestPageGUI::class)) {
1320 $this->tabs_manager->activateTab(TabsManager::TAB_ID_SETTINGS);
1321 }
1322 }
1323
1324 public function getTestAccess(): ilTestAccess
1325 {
1326 return $this->test_access;
1327 }
1328
1329 public function setTestAccess(ilTestAccess $test_access)
1330 {
1331 $this->test_access = $test_access;
1332 }
1333
1334 private function forwardToEvaluationGUI()
1335 {
1336 $this->prepareOutput();
1337 $this->addHeaderAction();
1338 $gui = new ilTestEvaluationGUI($this->getTestObject());
1339 $gui->setObjectiveOrientedContainer($this->getObjectiveOrientedContainer());
1340 $gui->setTestAccess($this->getTestAccess());
1341
1342 $this->ctrl->forwardCommand($gui);
1343 }
1344
1346 {
1347 $this->ctrl->redirectByClass(SettingsMainGUI::class, SettingsMainGUI::CMD_SHOW_FORM);
1348 }
1349
1350 private function prepareSubGuiOutput()
1351 {
1352 $this->tpl->loadStandardTemplate();
1353 $this->setLocator();
1354 $this->setTitleAndDescription();
1355 }
1356
1357 public function runObject()
1358 {
1359 $this->ctrl->redirectByClass([ilRepositoryGUI::class, self::class, ilInfoScreenGUI::class]);
1360 }
1361
1362 protected function importFile(string $file_to_import, string $path_to_uploaded_file_in_temp_dir): void
1363 {
1364 list($subdir, $importdir, $xmlfile, $qtifile) = $this->buildImportDirectoriesFromImportFile($file_to_import);
1365
1367 ->withZipOutputPath($this->getImportTempDirectory());
1368
1369 $unzip = $this->archives->unzip(Streams::ofResource(fopen($file_to_import, 'r')), $options);
1370 $unzip->extract();
1371
1372 if (!is_file($qtifile)) {
1373 ilFileUtils::delDir($importdir);
1374 $this->deleteUploadedImportFile($path_to_uploaded_file_in_temp_dir);
1375 $this->tpl->setOnScreenMessage('failure', $this->lng->txt('tst_import_non_ilias_zip'), true);
1376 }
1377 $qtiParser = new ilQTIParser($importdir, $qtifile, ilQTIParser::IL_MO_VERIFY_QTI, 0, [], [], true);
1378 try {
1379 $qtiParser->startParsing();
1380 } catch (ilSaxParserException) {
1381 $this->tpl->setOnScreenMessage('failure', $this->lng->txt('import_file_not_valid'), true);
1382 $this->ctrl->redirect($this, 'create');
1383 }
1384 $founditems = $qtiParser->getFoundItems();
1385
1386 $complete = 0;
1387 $incomplete = 0;
1388 foreach ($founditems as $item) {
1389 if ($item["type"] !== '') {
1390 $complete++;
1391 } else {
1392 $incomplete++;
1393 }
1394 }
1395
1396 if (count($founditems) && $complete == 0) {
1397 ilFileUtils::delDir($importdir);
1398 $this->deleteUploadedImportFile($path_to_uploaded_file_in_temp_dir);
1399 $this->tpl->setOnScreenMessage('info', $this->lng->txt('qpl_import_non_ilias_files'));
1400 return;
1401 }
1402
1403 ilSession::set('path_to_import_file', $file_to_import);
1404 ilSession::set('path_to_uploaded_file_in_temp_dir', $path_to_uploaded_file_in_temp_dir);
1405
1406 if ($qtiParser->getQuestionSetType() !== ilObjTest::QUESTION_SET_TYPE_FIXED
1407 || file_exists($this->buildResultsFilePath($importdir, $subdir))
1408 || $founditems === []) {
1409 $this->importVerifiedFileObject(true);
1410 return;
1411 }
1412
1413 $form = $this->buildImportQuestionsSelectionForm(
1414 'importVerifiedFile',
1415 $importdir,
1416 $qtifile,
1417 $file_to_import,
1418 $path_to_uploaded_file_in_temp_dir
1419 );
1420
1421 if ($form === null) {
1422 return;
1423 }
1424
1425 $panel = $this->ui_factory->panel()->standard(
1426 $this->lng->txt('import_tst'),
1427 [
1428 $this->ui_factory->legacy()->content($this->lng->txt('qpl_import_verify_found_questions')),
1429 $form
1430 ]
1431 );
1432 $this->tpl->setContent($this->ui_renderer->render($panel));
1433 $this->tpl->printToStdout();
1434 exit;
1435 }
1436
1441 public function afterSave(ilObject $new_object): void
1442 {
1443 $info = '';
1444 $new_object->saveToDb();
1445
1446 if ($new_object->getTestLogger()->isLoggingEnabled()) {
1447 $new_object->getTestLogger()->logTestAdministrationInteraction(
1448 $new_object->getTestLogger()->getInteractionFactory()->buildTestAdministrationInteraction(
1449 $this->getRefId(),
1450 $this->user->getId(),
1451 TestAdministrationInteractionTypes::NEW_TEST_CREATED,
1452 []
1453 )
1454 );
1455 }
1456
1457 if ($info === '') {
1458 $this->tpl->setOnScreenMessage('success', $this->lng->txt('object_added'), true);
1459 } else {
1460 $this->tpl->setOnScreenMessage('info', $this->lng->txt($info), true);
1461 }
1462 $this->ctrl->setParameter($this, 'ref_id', $new_object->getRefId());
1463 $this->ctrl->redirectByClass(SettingsMainGUI::class);
1464 }
1465
1466
1467 public function backToRepositoryObject()
1468 {
1469 $path = $this->tree->getPathFull($this->getTestObject()->getRefID());
1470 ilUtil::redirect($this->getReturnLocation("cancel", "./ilias.php?baseClass=ilRepositoryGUI&cmd=frameset&ref_id=" . $path[count($path) - 2]["child"]));
1471 }
1472
1473 public function getTestObject(): ?ilObjTest
1474 {
1475 return $this->object;
1476 }
1477
1482 bool $skip_retrieve_selected_questions = false
1483 ): void {
1484 if (!$this->checkPermissionBool('create', '', 'tst')) {
1485 $this->tpl->setOnScreenMessage('failure', $this->lng->txt('no_permission'), true);
1486 $this->ctrl->returnToParent($this);
1487 }
1488 $file_to_import = ilSession::get('path_to_import_file');
1489 $path_to_uploaded_file_in_temp_dir = ilSession::get('path_to_uploaded_file_in_temp_dir');
1490 list($subdir, $importdir, $xmlfile, $qtifile) = $this->buildImportDirectoriesFromImportFile($file_to_import);
1491
1492 $new_obj = new ilObjTest(0, true);
1493 $new_obj->setTitle('dummy');
1494 $new_obj->setDescription('test import');
1495 $new_obj->create(true);
1496 $new_obj->createReference();
1497 $new_obj->putInTree($this->testrequest->getRefId());
1498 $new_obj->setPermissions($this->testrequest->getRefId());
1499 $new_obj->saveToDb();
1500
1501 $selected_questions = [];
1502 if (!$skip_retrieve_selected_questions) {
1504 'importVerifiedFile',
1505 $importdir,
1506 $qtifile,
1507 $this->request
1508 );
1509 }
1510
1511 ilSession::set('tst_import_selected_questions', $selected_questions);
1512
1513 $imp = new ilImport($this->testrequest->getRefId());
1514 $map = $imp->getMapping();
1515 $map->addMapping('components/ILIAS/Test', 'tst', 'new_id', (string) $new_obj->getId());
1516
1521 if (is_file($importdir . DIRECTORY_SEPARATOR . '/manifest.xml')) {
1522 $imp->importObject($new_obj, $file_to_import, basename($file_to_import), 'tst', 'components/ILIAS/Test', true);
1523 } else {
1524 $test_importer = new ilTestImporter();
1525 $test_importer->setImport($imp);
1526 $test_importer->setInstallId(IL_INST_ID);
1527 $test_importer->setImportDirectory($importdir . '/' . $subdir);
1528 $test_importer->init();
1529
1530 $test_importer->importXmlRepresentation(
1531 '',
1532 '',
1533 '',
1534 $map,
1535 );
1536 }
1537
1538 if ($new_obj->getTestLogger()->isLoggingEnabled()) {
1539 $new_obj->getTestLogger()->logTestAdministrationInteraction(
1540 $new_obj->getTestLogger()->getInteractionFactory()->buildTestAdministrationInteraction(
1541 $new_obj->getRefId(),
1542 $this->user->getId(),
1543 TestAdministrationInteractionTypes::NEW_TEST_CREATED,
1544 []
1545 )
1546 );
1547 }
1548
1549 ilFileUtils::delDir($importdir);
1550 $this->deleteUploadedImportFile($path_to_uploaded_file_in_temp_dir);
1551 ilSession::clear('path_to_import_file');
1552 ilSession::clear('path_to_uploaded_file_in_temp_dir');
1553
1554 $this->tpl->setOnScreenMessage('success', $this->lng->txt("object_imported"), true);
1555
1556 $question_skill_assignments_import_fails = new ilAssQuestionSkillAssignmentImportFails($new_obj->getId());
1557 if ($question_skill_assignments_import_fails->failedImportsRegistered()) {
1558 $this->tpl->setOnScreenMessage(
1559 'info',
1560 $question_skill_assignments_import_fails->getFailedImportsMessage($this->lng),
1561 true
1562 );
1563 }
1564
1565 $this->ctrl->setParameterByClass(ilObjTestGUI::class, 'ref_id', $new_obj->getRefId());
1566 $this->ctrl->redirectByClass(ilObjTestGUI::class);
1567 }
1568
1572 public function downloadFileObject()
1573 {
1574 $file = explode("_", $this->testrequest->raw("file_id"));
1575 $fileObj = new ilObjFile((int) $file[count($file) - 1], false);
1576 $fileObj->sendFile();
1577 exit;
1578 }
1579
1583 public function fullscreenObject()
1584 {
1585 $page_gui = new ilAssQuestionPageGUI($this->testrequest->raw('pg_id'));
1586 $page_gui->setFileDownloadLink(
1587 $this->ctrl->getLinkTargetByClass(ilObjTestGUI::class, 'downloadFile')
1588 );
1589 $page_gui->showMediaFullscreen();
1590 }
1591
1596 {
1597 $pg_obj = new ilAssQuestionPage($this->testrequest->raw("pg_id"));
1598 $pg_obj->sendParagraph($this->testrequest->raw("par_id"), $this->testrequest->raw("downloadtitle"));
1599 exit;
1600 }
1601
1602 public function createQuestionPool($name = "dummy", $description = ""): ilObjQuestionPool
1603 {
1604 $parent_ref = $this->tree->getParentId($this->getTestObject()->getRefId());
1605 $qpl = new ilObjQuestionPool();
1606 $qpl->setType("qpl");
1607 $qpl->setTitle($name);
1608 $qpl->setDescription($description);
1609 $qpl->create();
1610 $qpl->createReference();
1611 $qpl->putInTree($parent_ref);
1612 $qpl->setPermissions($parent_ref);
1613 $qpl->getObjectProperties()->storePropertyIsOnline($qpl->getObjectProperties()->getPropertyIsOnline()->withOnline()); // must be online to be available
1614 $qpl->saveToDb();
1615 return $qpl;
1616 }
1617
1618 public function createQuestionObject(): void
1619 {
1620 $this->protectByWritePermission();
1621
1622 $this->ctrl->setReturnByClass(self::class, self::SHOW_QUESTIONS_CMD);
1623
1624 $form = $this->buildQuestionCreationForm()->withRequest($this->request);
1625 $data_with_section = $form->getData();
1626 if ($data_with_section === null) {
1627 $this->createQuestionFormObject($form);
1628 return;
1629 }
1630 $data = $data_with_section[0];
1631
1632 $qpl_mode = $data['pool_selection']['qpl_type'];
1633
1634 if ($qpl_mode === self::QUESTION_CREATION_POOL_SELECTION_NEW_POOL
1635 && ! $this->userCanCreatePoolAtCurrentLocation()) {
1636 $this->tpl->setOnScreenMessage('failure', $this->lng->txt('permission_denied'), true);
1637 $this->showQuestionsObject();
1638 return;
1639 }
1640
1641 if ($qpl_mode === self::QUESTION_CREATION_POOL_SELECTION_NEW_POOL && $data['pool_selection']['title'] === ''
1642 || $qpl_mode === self::QUESTION_CREATION_POOL_SELECTION_EXISTING_POOL && $data['pool_selection']['pool_ref_id'] === 0) {
1643 $this->tpl->setOnScreenMessage('info', $this->lng->txt("questionpool_not_entered"));
1644 $this->createQuestionFormObject($form);
1645 return;
1646 }
1647
1649 $question_gui = assQuestionGUI::_getQuestionGUI(
1651 );
1652 $question_gui->setEditContext(assQuestionGUI::EDIT_CONTEXT_AUTHORING);
1653 $question = $question_gui->getObject();
1654 $question->setAdditionalContentEditingMode($data['editing_type']);
1655 $question->setObjId($this->getTestObject()->getId());
1656 $question_gui->setObject($question);
1657 $question_gui->setQuestionTabs();
1658
1659 if (array_key_exists('position', $data)) {
1660 $question_gui->setMoveAfterQuestionId($data['position']);
1661 }
1662
1663 if ($qpl_mode === self::QUESTION_CREATION_POOL_SELECTION_NEW_POOL) {
1664 $question_gui->setCopyToNewPoolOnSave($data['pool_selection']['title']);
1665 }
1666
1667 if ($qpl_mode === self::QUESTION_CREATION_POOL_SELECTION_EXISTING_POOL) {
1668 $question_gui->setCopyToExistingPoolOnSave($data['pool_selection']['pool_ref_id']);
1669 }
1670
1671 $question_gui->editQuestion();
1672 }
1673
1674 public function cancelCreateQuestionObject(): void
1675 {
1676 $this->ctrl->redirect($this, self::SHOW_QUESTIONS_CMD);
1677 }
1678
1679 private function insertQuestionsObject(?array $selected_array = null): void
1680 {
1681 $this->protectByWritePermission();
1682
1683 if (($selected_array ?? $this->testrequest->getQuestionIds()) === []) {
1684 $this->tpl->setOnScreenMessage('info', $this->lng->txt('tst_insert_missing_question'), true);
1685 $this->ctrl->redirect($this, 'browseForQuestions');
1686 }
1687
1688 $this->getTestObject()->saveCompleteStatus($this->test_question_set_config_factory->getQuestionSetConfig());
1689 $this->tpl->setOnScreenMessage('success', $this->lng->txt('tst_questions_inserted'), true);
1690 $this->ctrl->redirect($this, self::SHOW_QUESTIONS_CMD);
1691 return;
1692 }
1693
1694 public function createQuestionFormObject(?Form $form = null): void
1695 {
1696 $this->protectByWritePermission();
1697
1698 $this->tabs_manager->getQuestionsSubTabs();
1699 $this->tabs_manager->activateSubTab(TabsManager::SUBTAB_ID_QST_LIST_VIEW);
1700
1701 $sub_screen_id = ['createQuestion'];
1702
1703 $this->tabs_manager->activateTab(TabsManager::TAB_ID_QUESTIONS);
1704 $this->help->setScreenId('assQuestions');
1705 $this->help->setSubScreenId(implode('_', $sub_screen_id));
1706
1707 $this->tpl->setContent(
1708 $this->ui_renderer->render(
1709 $form ?? $this->buildQuestionCreationForm()
1710 )
1711 );
1712 }
1713
1715 {
1716 $inputs['question_type'] = $this->buildInputQuestionType();
1717 $questions = $this->getTestObject()->getQuestionTitlesAndIndexes();
1718 if ($questions !== []) {
1719 $inputs['position'] = $this->buildInputPosition($questions);
1720 }
1721
1722 $inputs['editing_type'] = $this->buildInputEditingType();
1723
1724 if ($inputs['editing_type'] instanceof Radio) {
1725 $sub_screen_id[] = 'editMode';
1726 }
1727
1728 $sub_screen_id[] = 'poolSelect';
1729
1730 $inputs['pool_selection'] = $this->buildInputPoolSelection();
1731
1732 $section = [
1733 $this->ui_factory->input()->field()->section($inputs, $this->lng->txt('ass_create_question'))
1734 ];
1735
1736 $form = $this->ui_factory->input()->container()->form()->standard(
1737 $this->ctrl->getFormAction($this, 'createQuestion'),
1738 $section
1739 )->withSubmitLabel($this->lng->txt('create'));
1740
1741 return $form;
1742 }
1743
1744 private function buildInputQuestionType(): Select
1745 {
1746 $question_types = (new ilObjQuestionPool())->getQuestionTypes(false, true, false);
1747 $options = [];
1748 foreach ($question_types as $label => $data) {
1749 $options[$data['question_type_id']] = $label;
1750 }
1751
1752 return $this->ui_factory->input()->field()->select(
1753 $this->lng->txt('question_type'),
1754 $options
1755 )->withRequired(true);
1756 }
1757
1758 private function buildInputPosition(array $questions): Select
1759 {
1760 $options = [0 => $this->lng->txt('first')];
1761 foreach ($questions as $key => $title) {
1762 $options[$key] = $this->lng->txt('behind') . ' ' . $title
1763 . ' [' . $this->lng->txt('question_id_short') . ': ' . $key . ']';
1764 }
1765 return $this->ui_factory->input()->field()->select(
1766 $this->lng->txt('position'),
1767 $options
1768 )->withAdditionalTransformation($this->refinery->kindlyTo()->int());
1769 }
1770
1771 private function buildInputEditingType(): Input
1772 {
1773 if (!$this->getTestObject()->getGlobalSettings()->isPageEditorEnabled()) {
1774 return $this->ui_factory->input()->field()->hidden()->withValue(
1776 );
1777 }
1778
1779 return $this->ui_factory->input()->field()->radio($this->lng->txt('tst_add_quest_cont_edit_mode'))
1780 ->withOption(
1782 $this->lng->txt('tst_add_quest_cont_edit_mode_IPE'),
1783 $this->lng->txt('tst_add_quest_cont_edit_mode_IPE_info')
1784 )->withOption(
1786 $this->lng->txt('tst_add_quest_cont_edit_mode_RTE'),
1787 $this->lng->txt('tst_add_quest_cont_edit_mode_RTE_info')
1788 )
1790 }
1791
1793 {
1794 $f = $this->ui_factory->input()->field();
1795 $kt = $this->refinery->kindlyTo();
1796
1797 $trafo = $this->refinery->custom()->transformation(
1798 static function ($values) use ($kt): array {
1799 $return['qpl_type'] = $kt->int()->transform($values[0]);
1800 if ($return['qpl_type'] === self::QUESTION_CREATION_POOL_SELECTION_NO_POOL) {
1801 return $return;
1802 }
1803 if ($return['qpl_type'] === self::QUESTION_CREATION_POOL_SELECTION_NEW_POOL) {
1804 return $return + ['title' => $kt->string()->transform($values[1][0])];
1805 }
1806 return $return + [
1807 'pool_ref_id' => $kt->int()->transform($values[1][0])
1808 ];
1809 }
1810 );
1811
1812 $questionpools = ilObjQuestionPool::_getAvailableQuestionpools(false, false, true, false, false, "write");
1813 $pools_data = [];
1814 foreach ($questionpools as $key => $p) {
1815 $pools_data[$key] = $p['title'];
1816 }
1817
1818 $inputs = [
1819 self::QUESTION_CREATION_POOL_SELECTION_NO_POOL => $f->group([], $this->lng->txt('assessment_no_pool')),
1820 self::QUESTION_CREATION_POOL_SELECTION_EXISTING_POOL => $f->group(
1821 [
1822 $f->select(
1823 $this->lng->txt('select_questionpool'),
1824 $pools_data
1825 )->withRequired(true)
1826 ],
1827 $this->lng->txt('assessment_existing_pool')
1828 )
1829 ];
1830
1831 if ($this->userCanCreatePoolAtCurrentLocation()) {
1832 $inputs[self::QUESTION_CREATION_POOL_SELECTION_NEW_POOL] = $f->group(
1833 [$f->text($this->lng->txt('name'))],
1834 $this->lng->txt('assessment_new_pool')
1835 );
1836 }
1837
1838 return $f->switchableGroup(
1839 $inputs,
1840 $this->lng->txt('assessment_pool_selection')
1841 )->withAdditionalTransformation($trafo)
1842 ->withRequired(true)
1843 ->withValue(1);
1844 }
1845
1846 public function showQuestionsObject()
1847 {
1848 $this->protectByWritePermission();
1849
1850 if ($this->testrequest->raw('add')) {
1851 $this->addQuestion();
1852 return;
1853 }
1854
1855 $table_query = $this->getQuestionsTableQuery();
1856 if (($table_cmd = $table_query->getTableAction()) !== null) {
1857 if (!$this->getQuestionsTableActions()->handleCommand(
1858 $table_cmd,
1859 $table_query->getRowIds($this->object),
1860 fn() => $this->protectByWritePermission(),
1861 fn() => $this->createQuestionpoolTargetObject('copyAndLinkQuestionsToPool'),
1862 fn() => $this->getTable()
1863 )) {
1864 return;
1865 }
1866 }
1867
1868 $this->tpl->addBlockFile('ADM_CONTENT', 'adm_content', 'tpl.il_as_tst_questions.html', 'components/ILIAS/Test');
1869
1870 $this->setupToolBarAndMessage($this->getTestObject()->evalTotalPersons() !== 0);
1871
1872 $this->tabs_manager->getQuestionsSubTabs();
1873 $this->tabs_manager->activateSubTab(TabsManager::SUBTAB_ID_QST_LIST_VIEW);
1874
1875 $this->tpl->setCurrentBlock('adm_content');
1876 $this->tpl->setVariable('ACTION_QUESTION_FORM', $this->ctrl->getFormAction($this));
1877 $this->tpl->setVariable(
1878 'QUESTIONBROWSER',
1879 $this->ui_renderer->render(
1880 $this->getTable()->getTableComponent()
1881 )
1882 );
1883 $this->tpl->parseCurrentBlock();
1884 }
1885
1886 private function addQuestion(): void
1887 {
1888 $selected_array = [$this->testrequest->int('add')];
1889 $total = $this->getTestObject()->evalTotalPersons();
1890 if ($total > 0) {
1891 // the test was executed previously
1892 $this->tpl->setOnScreenMessage('failure', $this->lng->txt('test_has_datasets_warning_page_view'));
1893 $this->showQuestionsObject();
1894 return;
1895 }
1896 $this->tpl->setOnScreenMessage('info', $this->lng->txt('tst_insert_questions'));
1897 $this->insertQuestionsObject($selected_array);
1898 }
1899
1900 private function setupToolBarAndMessage(bool $has_started_test_runs): void
1901 {
1902 if (!$this->access->checkAccess('write', '', $this->ref_id)
1903 || $this->getTestObject()->isRandomTest()) {
1904 return;
1905 }
1906
1907 if ($has_started_test_runs) {
1908 $link = $this->ui_factory->link()->standard(
1909 $this->lng->txt('test_has_datasets_warning_page_view_link'),
1910 $this->ctrl->getLinkTargetByClass([\ilTestParticipantsGUI::class])
1911 );
1912
1913 $message = $this->lng->txt('test_has_datasets_warning_page_view');
1914 $massage_box = $this->ui_factory->messageBox()->info($message)->withLinks([$link]);
1915 $this->tpl->setCurrentBlock('pax_info_message');
1916 $this->tpl->setVariable(
1917 'PAX_INFO_MESSAGE',
1918 $this->ui_renderer->render($massage_box)
1919 );
1920 $this->tpl->parseCurrentBlock();
1921 return;
1922 }
1923
1924 $this->toolbar->addButton($this->lng->txt('ass_create_question'), $this->ctrl->getLinkTarget($this, 'createQuestionForm'));
1925 $this->toolbar->addSeparator();
1926 $this->populateQuestionBrowserToolbarButtons($this->toolbar);
1927 }
1928
1930 {
1931 $this->ctrl->setParameterByClass(
1932 ilTestQuestionBrowserTableGUI::class,
1935 );
1936
1937 $toolbar->addButton(
1938 $this->lng->txt('tst_browse_for_qpl_questions'),
1939 $this->ctrl->getLinkTargetByClass(
1940 ilTestQuestionBrowserTableGUI::class,
1942 )
1943 );
1944
1945 $this->ctrl->setParameterByClass(
1946 ilTestQuestionBrowserTableGUI::class,
1949 );
1950
1951 $toolbar->addButton(
1952 $this->lng->txt('tst_browse_for_tst_questions'),
1953 $this->ctrl->getLinkTargetByClass(
1954 ilTestQuestionBrowserTableGUI::class,
1956 )
1957 );
1958 }
1959
1960 public function takenObject(): void
1961 {
1962 }
1963
1964 public function historyObject(): void
1965 {
1966 if (!$this->getTestObject()->getTestLogger()->isLoggingEnabled()
1967 || !$this->rbac_review->isAssigned($this->user->getId(), SYSTEM_ROLE_ID)
1968 && !$this->access->checkAccess('tst_history_read', '', $this->getTestObject()->getRefId())) {
1969 $this->redirectAfterMissingWrite();
1970 }
1971
1972 $here_uri = $this->data_factory->uri(ILIAS_HTTP_PATH
1973 . '/' . $this->ctrl->getLinkTargetByClass(self::class, self::SHOW_LOGS_CMD));
1974 list($url_builder, $action_parameter_token, $row_id_token) = (new URLBuilder($here_uri))->acquireParameters(
1975 LogTable::QUERY_PARAMETER_NAME_SPACE,
1976 LogTable::ACTION_TOKEN_STRING,
1977 LogTable::ENTRY_TOKEN_STRING
1978 );
1979
1980 if ($this->request_wrapper->has($action_parameter_token->getName())) {
1981 $this->getTestObject()->getTestLogViewer()->executeLogTableAction(
1982 $url_builder,
1983 $action_parameter_token,
1984 $row_id_token,
1985 $this->getTestObject()->getRefId()
1986 );
1987 }
1988
1989 $this->toolbar->addComponent(
1990 $this->ui_factory->button()->standard(
1991 $this->lng->txt('export_legacy_logs'),
1992 $this->ctrl->getLinkTargetByClass(self::class, 'exportLegacyLogs')
1993 )
1994 );
1995 $this->tabs_manager->activateTab(TabsManager::TAB_ID_HISTORY);
1996
1997 list($filter, $table_gui) = $this->getTestObject()->getTestLogViewer()->getLogTable(
1998 $url_builder,
1999 $action_parameter_token,
2000 $row_id_token,
2001 $this->getTestObject()->getRefId()
2002 );
2003
2004 $this->tpl->setVariable('ADM_CONTENT', $this->ui_renderer->render([$filter, $table_gui]));
2005 }
2006
2007 public function exportLegacyLogsObject(): void
2008 {
2009 $this->protectByWritePermission();
2010
2011 $csv_output = $this->getTestObject()->getTestLogViewer()->getLegacyLogExportForObjId($this->getTestObject()->getId());
2012
2014 $csv_output,
2015 "legacy_logs_for_{$this->getTestObject()->getRefId()}.csv"
2016 );
2017 }
2018
2022 public function participantsActionObject(): void
2023 {
2024 $command = $this->testrequest->strVal('command');
2025 if ($command === '') {
2026 $method = $command . 'Object';
2027 if (method_exists($this, $method)) {
2028 $this->$method();
2029 return;
2030 }
2031 }
2032 $this->ctrl->redirect($this, 'participants');
2033 }
2034
2035
2036 public function showTemplatesObject(?Modal $modal = null): void
2037 {
2038 $this->protectByWritePermission();
2039
2040 $this->tabs_manager->activateTab(TabsManager::TAB_ID_SETTINGS);
2041
2042 $create_input = $this->buildPersonalSettingsCreateAction()
2043 ->buildModal($this->ctrl->getLinkTargetByClass(self::class, 'createTemplate'));
2044 $import_input = $this->buildPersonalSettingsImportAction()
2045 ->buildModal($this->ctrl->getLinkTargetByClass(self::class, 'importTemplate'));
2046
2047 $this->toolbar->addComponent(
2048 $this->ui_factory->button()->standard(
2049 $this->lng->txt('personal_settings_create'),
2050 $create_input->getShowSignal()
2051 )
2052 );
2053 $this->toolbar->addComponent(
2054 $this->ui_factory->button()->standard(
2055 $this->lng->txt('personal_settings_import'),
2056 $import_input->getShowSignal()
2057 )
2058 );
2059
2060 $components = [
2061 $this->buildPersonalSettingsTable()->getComponent(),
2062 $modal,
2063 $create_input,
2064 $import_input
2065 ];
2066
2067 $this->tpl->setContent(
2068 $this->ui_renderer->render(array_filter($components))
2069 );
2070 }
2071
2072 public function createTemplateObject(): void
2073 {
2074 $this->protectByWritePermission();
2075
2076 try {
2077 $this->buildPersonalSettingsCreateAction()
2078 ->perform($this->getTestObject()->getTestId(), $this->request);
2079 } catch (\InvalidArgumentException $e) {
2080 $this->tpl->setOnScreenMessage('failure', $this->lng->txt($e->getMessage()), true);
2081 }
2082
2083 $this->ctrl->redirectByClass(self::class, 'showTemplates');
2084 }
2085
2086 public function importTemplateObject(): void
2087 {
2088 $this->protectByWritePermission();
2089
2090 try {
2091 $this->buildPersonalSettingsImportAction()
2092 ->perform($this->request);
2093
2094 $this->tpl->setOnScreenMessage('success', $this->lng->txt('personal_settings_import_success'), true);
2095 } catch (\InvalidArgumentException $e) {
2096 $this->tpl->setOnScreenMessage('failure', $this->lng->txt($e->getMessage()), true);
2097 }
2098
2099 $this->ctrl->redirectByClass(self::class, 'showTemplates');
2100 }
2101
2102 public function executeTemplatesActionObject(): void
2103 {
2104 $this->protectByWritePermission();
2105
2106 $modal = $this->buildPersonalSettingsTable()->perform();
2107 if ($modal !== null) {
2108 $this->showTemplatesObject($modal);
2109 return;
2110 }
2111 $this->ctrl->redirectByClass(self::class, 'showTemplates');
2112 }
2113
2115 {
2117 $this->ui_factory,
2118 $this->lng,
2119 $this->user,
2120 $this->personal_settings_templates_repository,
2121 $this->main_settings_repository,
2122 $this->score_settings_repository,
2123 $this->marks_repository
2124 );
2125 }
2126
2128 {
2130 $this->ui_factory,
2131 $this->lng,
2132 $this->data_factory,
2133 $this->temp_file_system,
2134 $this->personal_settings_templates_repository,
2135 $this->main_settings_repository,
2136 $this->score_settings_repository,
2137 $this->marks_repository
2138 );
2139 }
2140
2142 {
2143 $actions = new PersonalSettingsTableActions(
2144 $this->testrequest,
2145 $this->response_handler,
2146 $this->ui_renderer,
2147 $this->ui_factory,
2148 $this->lng,
2149 $this->user,
2150 $this->personal_settings_templates_repository,
2151 [
2152 PersonalSettingsTableShowAction::ACTION_ID => new PersonalSettingsTableShowAction(
2153 $this->lng,
2154 $this->ui_factory,
2155 $this->user,
2156 $this->personal_settings_templates_repository,
2157 $this->main_settings_repository,
2158 $this->score_settings_repository,
2159 $this->marks_repository,
2160 $this->additional_information_generator
2161 ),
2162 PersonalSettingsTableApplyAction::ACTION_ID => new PersonalSettingsTableApplyAction(
2163 $this->lng,
2164 $this->ui_factory,
2165 $this->test_question_set_config_factory,
2166 $this->tpl,
2167 $this->getTestObject(),
2168 $this->personal_settings_templates_repository,
2169 $this->main_settings_repository,
2170 $this->score_settings_repository,
2171 $this->marks_repository
2172 ),
2173 PersonalSettingsTableExportAction::ACTION_ID => new PersonalSettingsTableExportAction(
2174 $this->lng,
2175 $this->ui_factory,
2176 $this->personal_settings_exporter
2177 ),
2178 PersonalSettingsTableDeleteAction::ACTION_ID => new PersonalSettingsTableDeleteAction(
2179 $this->lng,
2180 $this->ui_factory,
2181 $this->tpl,
2182 $this->personal_settings_templates_repository,
2183 $this->marks_repository
2184 ),
2185 ]
2186 );
2187
2188 $uri = $this->ctrl->getLinkTargetByClass(self::class, 'executeTemplatesAction', '', true);
2189 return new PersonalSettingsTable(
2190 $this->lng,
2191 $this->ui_factory,
2192 $this->data_factory,
2193 $this->user,
2194 $this->testrequest,
2195 $actions,
2196 new URLBuilder($this->data_factory->uri(ILIAS_HTTP_PATH . '/' . $uri)),
2197 $this->personal_settings_templates_repository,
2198 );
2199 }
2200
2201 private function isCommandClassAnyInfoScreenChild(): bool
2202 {
2203 if (in_array(
2204 $this->ctrl->getCmdClass(),
2205 [
2206 strtolower(PublicProfileGUI::class),
2207 'ilobjportfoliogui'
2208 ]
2209 )) {
2210 return true;
2211 }
2212
2213 return false;
2214 }
2215
2216 private function infoScreenObject(): void
2217 {
2218 $this->ctrl->redirectByClass(
2219 [ilRepositoryGUI::class, self::class, ilInfoScreenGUI::class]
2220 );
2221 }
2222
2223 private function forwardToInfoScreen(): void
2224 {
2225 if (!$this->access->checkAccess('visible', '', $this->ref_id)
2226 && !$this->access->checkAccess('read', '', $this->ref_id)) {
2227 $this->redirectAfterMissingRead();
2228 }
2229
2230 if ($this->getTestObject()->getMainSettings()->getAdditionalSettings()->getHideInfoTab()) {
2231 $this->ctrl->redirectByClass([self::class, TestScreenGUI::class], TestScreenGUI::DEFAULT_CMD);
2232 }
2233
2234 $this->tabs_manager->activateTab(TabsManager::TAB_ID_INFOSCREEN);
2235
2236 if ($this->access->checkAccess('read', '', $this->ref_id)) {
2237 $this->trackTestObjectReadEvent();
2238 }
2239 $info = new ilInfoScreenGUI($this);
2240
2241 if ($this->isCommandClassAnyInfoScreenChild()) {
2242 $this->ctrl->forwardCommand($info);
2243 }
2244
2245 $toolbar = new ilTestInfoScreenToolbarGUI(
2246 $this->getTestObject(),
2247 $this->test_player_factory->getPlayerGUI(),
2248 $this->test_question_set_config_factory->getQuestionSetConfig(),
2249 $this->test_session_factory->getSession(),
2250 $this->db,
2251 $this->access,
2252 $this->ctrl,
2253 $this->lng,
2254 $this->ui_factory,
2255 $this->ui_renderer,
2256 $this->tpl,
2257 $this->toolbar
2258 );
2259
2260 $toolbar->setCloseFormTag(false);
2261
2262 $toolbar->setSessionLockString('');
2263 $toolbar->build();
2264 $toolbar->sendMessages();
2265
2266 $info->enablePrivateNotes();
2267
2268 $info->addSection($this->lng->txt('tst_general_properties'));
2269 $info->addProperty(
2270 $this->lng->txt('author'),
2271 $this->refinery->encode()->htmlSpecialCharsAsEntities()->transform(
2272 $this->getTestObject()->getAuthor()
2273 )
2274 );
2275 $info->addProperty(
2276 $this->lng->txt('title'),
2277 $this->refinery->encode()->htmlSpecialCharsAsEntities()->transform(
2278 $this->getTestObject()->getTitle()
2279 )
2280 );
2281
2282 if ($this->type !== 'tst') {
2283 $info->hideFurtherSections(false);
2284 }
2285
2286 if ($this->getTestObject()->getEnableProcessingTime()) {
2287 $info->addProperty($this->lng->txt('tst_processing_time'), $this->getTestObject()->getProcessingTime());
2288 }
2289
2290 $starting_time = $this->getTestObject()->getStartingTime();
2291 if ($this->getTestObject()->isStartingTimeEnabled() && $starting_time !== 0) {
2292 $info->addProperty($this->lng->txt('tst_starting_time'), ilDatePresentation::formatDate(new ilDateTime($starting_time, IL_CAL_UNIX)));
2293 }
2294 $ending_time = $this->getTestObject()->getEndingTime();
2295 if ($this->getTestObject()->isEndingTimeEnabled() && $ending_time != 0) {
2296 $info->addProperty($this->lng->txt('tst_ending_time'), ilDatePresentation::formatDate(new ilDateTime($ending_time, IL_CAL_UNIX)));
2297 }
2298 $info->addMetaDataSections($this->getTestObject()->getId(), 0, $this->getTestObject()->getType());
2299
2300 $this->ctrl->forwardCommand($info);
2301 }
2302
2303 protected function removeImportFailsObject()
2304 {
2305 $qsaImportFails = new ilAssQuestionSkillAssignmentImportFails($this->getTestObject()->getId());
2306 $qsaImportFails->deleteRegisteredImportFails();
2307 $sltImportFails = new ilTestSkillLevelThresholdImportFails($this->getTestObject()->getId());
2308 $sltImportFails->deleteRegisteredImportFails();
2309
2310 $this->ctrl->redirectByClass([ilRepositoryGUI::class, self::class, ilInfoScreenGUI::class]);
2311 }
2312
2313 public function addLocatorItems(): void
2314 {
2315 switch ($this->ctrl->getCmd()) {
2316 case "run":
2317 case "infoScreen":
2318 case "redirectToInfoScreen":
2319 case "start":
2320 case "resume":
2321 case "previous":
2322 case "next":
2323 case "summary":
2324 case "finishTest":
2325 case "outCorrectSolution":
2326 case "showAnswersOfUser":
2327 case "outUserResultsOverview":
2328 case "backFromSummary":
2329 case "show_answers":
2330 case "setsolved":
2331 case "resetsolved":
2332 case "outTestSummary":
2333 case "outQuestionSummary":
2334 case "gotoQuestion":
2335 case "selectImagemapRegion":
2336 case "confirmSubmitAnswers":
2337 case "finalSubmission":
2338 case "postpone":
2339 case "outUserPassDetails":
2340 case "checkPassword":
2341 $this->locator->addItem(
2342 $this->getTestObject()->getTitle(),
2343 $this->ctrl->getLinkTargetByClass(
2344 [self::class, TestScreenGUI::class],
2345 TestScreenGUI::DEFAULT_CMD
2346 ),
2347 '',
2348 $this->testrequest->getRefId()
2349 );
2350 break;
2351 case "eval_stat":
2352 case "evalAllUsers":
2353 case "evalUserDetail":
2354 $this->locator->addItem(
2355 $this->getTestObject()->getTitle(),
2356 $this->ctrl->getLinkTarget($this, 'eval_stat'),
2357 '',
2358 $this->testrequest->getRefId()
2359 );
2360 break;
2361 case "importFile":
2362 case "cloneAll":
2363 case "importVerifiedFile":
2364 case "cancelImport":
2365 break;
2366 default:
2367 $this->locator->addItem(
2368 $this->getTestObject()->getTitle(),
2369 $this->ctrl->getLinkTargetByClass(
2370 [self::class, TestScreenGUI::class],
2371 TestScreenGUI::DEFAULT_CMD
2372 ),
2373 '',
2374 $this->testrequest->getRefId()
2375 );
2376 break;
2377 }
2378 }
2379
2380 public function statisticsObject()
2381 {
2382 }
2383
2387 public function certificateObject()
2388 {
2389 $this->tabs_manager->activateTab(TabsManager::TAB_ID_SETTINGS);
2390
2391 $guiFactory = new ilCertificateGUIFactory();
2392 $output_gui = $guiFactory->create($this->getTestObject());
2393
2394 $output_gui->certificateEditor();
2395 }
2396
2402 public function getTabs(): void
2403 {
2404 $this->help->setScreenIdComponent("tst");
2405
2406 if ($this->tabs_manager === null) {
2407 return;
2408 }
2409
2410 if ($this->getObjectiveOrientedContainer()->isObjectiveOrientedPresentationRequired()) {
2411 $courseLink = ilLink::_getLink($this->getObjectiveOrientedContainer()->getRefId());
2412 $this->tabs_manager->setParentBackLabel($this->lng->txt('back_to_objective_container'));
2413 $this->tabs_manager->setParentBackHref($courseLink);
2414 }
2415
2416 $this->tabs_manager->perform();
2417 }
2418
2419 public static function accessViolationRedirect()
2420 {
2422 global $DIC;
2423 $main_tpl = $DIC->ui()->mainTemplate();
2424
2425 $main_tpl->setOnScreenMessage('failure', $DIC->language()->txt("no_permission"), true);
2426 $DIC->ctrl()->redirectByClass(TestScreenGUI::class, TestScreenGUI::DEFAULT_CMD);
2427 }
2428
2435 public static function _goto($target)
2436 {
2437 global $DIC;
2438 $main_tpl = $DIC->ui()->mainTemplate();
2439 $ilAccess = $DIC['ilAccess'];
2440 $ilErr = $DIC['ilErr'];
2441 $lng = $DIC['lng'];
2442
2443 if ($ilAccess->checkAccess('read', '', (int) $target)
2444 || $ilAccess->checkAccess('visible', '', (int) $target)) {
2445 $DIC->ctrl()->setParameterByClass(self::class, 'ref_id', (int) $target);
2446 $DIC->ctrl()->redirectByClass(
2447 [
2448 ilRepositoryGUI::class,
2449 ilObjTestGUI::class,
2450 TestScreenGUI::class
2451 ],
2452 TestScreenGUI::DEFAULT_CMD
2453 );
2454 } elseif ($ilAccess->checkAccess('read', '', ROOT_FOLDER_ID)) {
2455 $main_tpl->setOnScreenMessage('info', sprintf(
2456 $lng->txt('msg_no_perm_read_item'),
2458 ), true);
2460 }
2461
2462 $ilErr->raiseError($lng->txt('msg_no_perm_read_lm'), $ilErr->FATAL);
2463 }
2464
2466 {
2467 $this->copyQuestionsToPool($this->testrequest->raw('q_id'), $this->testrequest->raw('sel_qpl'));
2468 $this->ctrl->redirect($this, self::SHOW_QUESTIONS_CMD);
2469 }
2470
2475 public function copyQuestionsToPool(array $question_ids, int $qpl_id): stdClass
2476 {
2477 $target_pool = new ilObjQuestionPool($qpl_id, false);
2478 $new_ids = [];
2479 foreach ($question_ids as $q_id) {
2480 $new_id = $this->copyQuestionToPool(assQuestion::instantiateQuestionGUI($q_id), $target_pool);
2481 $new_ids[$q_id] = $new_id;
2482 }
2483
2484 $result = new stdClass();
2485 $result->ids = $new_ids;
2486 $result->qpoolid = $qpl_id;
2487
2488 return $result;
2489 }
2490
2491 public function copyQuestionToPool(assQuestionGUI $source_question_gui, ilObjQuestionPool $target_pool): int
2492 {
2493 $new_title = $target_pool->appendCounterToQuestionTitleIfNecessary(
2494 $source_question_gui->getObject()->getTitle()
2495 );
2496
2497 return $source_question_gui->getObject()->createNewOriginalFromThisDuplicate($target_pool->getId(), $new_title);
2498 }
2499
2501 ?int $ref_id = null,
2502 array $question_ids = []
2503 ) {
2504
2505 $ref_id = $ref_id ?? $this->testrequest->int('sel_qpl');
2506 if ($ref_id === null
2507 || $ref_id === 0) {
2508 $this->tpl->setOnScreenMessage('failure', $this->lng->txt("questionpool_not_selected"));
2509 $this->showQuestionsObject();
2510 return;
2511 }
2512
2513 $qpl_id = $this->obj_data_cache->lookupObjId($ref_id);
2514
2515
2516 if ($question_ids === []) {
2517 $question_ids = $this->testrequest->getQuestionIds();
2518 $question_id = $this->testrequest->getQuestionId();
2519 if ($question_ids === [] && $question_id !== 0) {
2520 $question_ids = [$question_id];
2521 }
2522 }
2523
2524 if ($question_ids === []) {
2525 $this->tpl->setOnScreenMessage('failure', $this->lng->txt("tst_no_question_selected_for_moving_to_qpl"));
2526 $this->ctrl->redirect($this, 'questions');
2527 }
2528
2529 $result = $this->copyQuestionsToPool($question_ids, $qpl_id);
2530
2531 foreach ($result->ids as $oldId => $newId) {
2532 $questionInstance = assQuestion::instantiateQuestion($oldId);
2533
2534 $original_question_id = $questionInstance->getOriginalId();
2535 if ($original_question_id !== null
2536 && $this->test_questions_repository->originalQuestionExists($original_question_id)) {
2537 $oldOriginal = assQuestion::instantiateQuestion($original_question_id);
2538 $oldOriginal->delete($oldOriginal->getId());
2539 }
2540 assQuestion::saveOriginalId($questionInstance->getId(), $newId);
2541 }
2542
2543 $this->tpl->setOnScreenMessage('success', $this->lng->txt('tst_qst_added_to_pool_' . (count($result->ids) > 1 ? 'p' : 's')), true);
2544 $this->ctrl->redirect($this, self::SHOW_QUESTIONS_CMD);
2545 }
2546
2548 {
2549 $this->createQuestionpoolTargetObject('copyQuestionsToPool');
2550 }
2551
2553 {
2554 if (!$this->access->checkAccess('write', '', $this->object->getRefId())
2555 || !$this->checkPermissionBool('create', '', 'qpl')) {
2556 $this->redirectAfterMissingWrite();
2557 }
2558
2559 if ($this->testrequest->raw('title')) {
2560 $title = $this->testrequest->raw('title');
2561 } else {
2562 $title = $this->testrequest->raw('txt_qpl');
2563 }
2564
2565 if (!$title) {
2566 $this->tpl->setOnScreenMessage('failure', $this->lng->txt('questionpool_not_entered'));
2567 $this->createQuestionpoolTargetObject('createQuestionPoolAndCopy');
2568 return;
2569 }
2570
2571 $question_pool = $this->createQuestionPool($title, $this->testrequest->raw('description'));
2572 $_REQUEST['sel_qpl'] = $question_pool->getRefId();
2573
2574 $this->copyAndLinkQuestionsToPoolObject();
2575 }
2576
2581 public function createQuestionpoolTargetObject(string $cmd): void
2582 {
2583 $this->protectByWritePermission();
2584
2585 $this->tabs_manager->getQuestionsSubTabs();
2586 $this->tabs_manager->activateSubTab(TabsManager::SUBTAB_ID_QST_LIST_VIEW);
2587
2588 $questionpools = $this->getTestObject()->getAvailableQuestionpools(
2589 false,
2590 false,
2591 false,
2592 true,
2593 false,
2594 'write'
2595 );
2596
2597 if ($questionpools === []) {
2598 $form = $this->getTargetQuestionpoolForm($questionpools, 'createQuestionPoolAndCopy');
2599 } else {
2600 $form = $this->getTargetQuestionpoolForm($questionpools, $cmd);
2601
2602 switch ($cmd) {
2603 case 'copyQuestionsToPool':
2604 break;
2605
2606 case 'copyAndLinkQuestionsToPool':
2607 $hidden = new ilHiddenInputGUI('link');
2608 $hidden->setValue('1');
2609 $form->addItem($hidden);
2610 break;
2611 }
2612 }
2613
2614 $this->tpl->setContent($form->getHTML());
2615 }
2616
2617 protected function getTargetQuestionpoolForm($questionpools, string $cmd): ilPropertyFormGUI
2618 {
2619 $form = new ilPropertyFormGUI();
2620 $form->setFormAction($this->ctrl->getFormAction($this));
2621 $form->addCommandButton($cmd, $this->lng->txt('submit'));
2622 $form->addCommandButton('cancelCreateQuestion', $this->lng->txt('cancel'));
2623
2624 if (count($questionpools) == 0) {
2625 $form->setTitle($this->lng->txt("tst_enter_questionpool"));
2626
2627 $title = new ilTextInputGUI($this->lng->txt('title'), 'title');
2628 $title->setRequired(true);
2629 $form->addItem($title);
2630
2631 $description = new ilTextAreaInputGUI($this->lng->txt('description'), 'description');
2632 $form->addItem($description);
2633 } else {
2634 $form->setTitle($this->lng->txt("tst_select_questionpool"));
2635
2636 $selectOptions = [
2637 '' => $this->lng->txt('please_select')
2638 ];
2639
2640 foreach ($questionpools as $key => $value) {
2641 $selectOptions[$key] = $value["title"];
2642 }
2643
2644 $select = new ilSelectInputGUI($this->lng->txt('tst_source_question_pool'), 'sel_qpl');
2645 $select->setRequired(true);
2646 $select->setOptions($selectOptions);
2647
2648 $form->addItem($select);
2649 }
2650
2651 $table_query = $this->getQuestionsTableQuery();
2652 if ($table_query->getTableAction() !== null) {
2653 $question_ids = $table_query->getRowIds($this->object);
2654 } elseif ($this->testrequest->isset('q_id') && is_array($this->testrequest->raw('q_id'))) {
2655 $question_ids = $this->testrequest->raw('q_id');
2656 }
2657
2658 foreach ($question_ids as $id) {
2659 $hidden = new ilHiddenInputGUI('q_id[]');
2660 $hidden->setValue((string) $id);
2661 $form->addItem($hidden);
2662 }
2663
2664 return $form;
2665 }
2666
2667 protected function protectByWritePermission(): void
2668 {
2669 if (!$this->access->checkAccess('write', '', $this->ref_id)) {
2670 $this->tpl->setOnScreenMessage('info', $this->lng->txt('cannot_edit_test'), true);
2671 $this->ctrl->redirectByClass([ilRepositoryGUI::class, self::class, ilInfoScreenGUI::class]);
2672 }
2673 }
2674
2676 {
2677 if (!ilLOSettings::isObjectiveTest($this->ref_id)) {
2678 return;
2679 }
2680
2681 $path = $this->tree->getPathFull($this->ref_id);
2682
2683 while ($parent = array_pop($path)) {
2684 if ($parent['type'] === 'crs') {
2685 $container_ref_id = $parent['ref_id'];
2686 break;
2687 }
2688 }
2689
2690 $container_obj_id = ilObject2::_lookupObjId($container_ref_id);
2691
2692 $this->objective_oriented_container->setObjId($container_obj_id);
2693 $this->objective_oriented_container->setRefId($container_ref_id);
2694 }
2695
2697 {
2698 return $this->objective_oriented_container;
2699 }
2700
2702 {
2703 return new TestScreenGUI(
2704 $this->getTestObject(),
2705 $this->user,
2706 $this->ui_factory,
2707 $this->ui_renderer,
2708 $this->lng,
2709 $this->refinery,
2710 $this->ctrl,
2711 $this->tpl,
2712 $this->content_style,
2713 $this->http,
2714 $this->tabs_manager,
2715 $this->access,
2716 $this->test_access,
2717 $this->db,
2718 $this->rbac_system
2719 );
2720 }
2721
2723 {
2724 if ($this->table_query === null) {
2725 $id = $this->object ? $this->object->getId() : '';
2726 $this->table_query = new QuestionsTableQuery(
2727 $this->http,
2728 $this->refinery,
2729 $this->data_factory,
2730 ['qlist', $id]
2731 );
2732 }
2733 return $this->table_query;
2734 }
2735
2737 {
2738 if ($this->table_actions === null) {
2739 $this->table_actions = new QuestionsTableActions(
2740 $this->ui_factory,
2741 $this->ui_renderer,
2742 $this->tpl,
2743 $this->request,
2744 $this->getQuestionsTableQuery(),
2745 $this->lng,
2746 $this->ctrl,
2747 $this->test_questions_repository,
2748 new QuestionPrinter(
2749 $this->ui_factory,
2750 $this->tpl,
2751 $this->tabs_manager,
2752 $this->toolbar,
2753 $this->refinery,
2754 $this->lng,
2755 $this->ctrl,
2756 $this->user,
2758 $this->getTestObject()
2759 ),
2760 $this->object,
2761 $this->getTestObject()->getGlobalSettings()->isAdjustingQuestionsWithResultsAllowed(),
2762 $this->getTestObject()->evalTotalPersons() !== 0,
2763 $this->getTestObject()->isRandomTest(),
2764 $this->test_question_set_config_factory
2765 );
2766 }
2767 return $this->table_actions;
2768 }
2769
2770 protected function getTable(): QuestionsTable
2771 {
2772 return new QuestionsTable(
2773 $this->ui_factory,
2774 $this->refinery,
2775 $this->http->request(),
2776 $this->getQuestionsTableActions(),
2777 $this->lng,
2778 $this->object,
2779 $this->test_questions_repository,
2780 $this->title_builder
2781 );
2782 }
2783
2784 private function userCanCreatePoolAtCurrentLocation(): bool
2785 {
2786 return $this->settings->get('obj_dis_creation_qpl') !== '1'
2787 && $this->checkPermissionBool('create', '', 'qpl', $this->tree->getParentId($this->ref_id));
2788 }
2789}
$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.
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:31
$ilErr
Definition: raiseError.php:33
if(!file_exists('../ilias.ini.php'))
global $DIC
Definition: shib_login.php:26