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