19 declare(strict_types=1);
117 'ilpublicuserprofilegui',
'ilobjportfoliogui' 172 $this->navigation_history = $DIC[
'ilNavigationHistory'];
173 $this->component_repository = $DIC[
'component.repository'];
174 $this->component_factory = $DIC[
'component.factory'];
175 $this->ui_service = $DIC->uiService();
176 $this->error = $DIC[
'ilErr'];
177 $this->db = $DIC[
'ilDB'];
178 $this->
help = $DIC[
'ilHelp'];
179 $this->global_screen = $DIC[
'global_screen'];
180 $this->obj_data_cache = $DIC[
'ilObjDataCache'];
181 $this->irss = $DIC[
'resource_storage'];
182 $this->skills_service = $DIC->skills();
183 $this->archives = $DIC->archives();
186 $this->taxonomy = $DIC->taxonomy()->domain();
187 $this->ui_service = $DIC->uiService();
188 $this->content_style = $DIC->contentStyle();
190 $local_dic = TestDIC::dic();
191 $this->questionrepository = $local_dic[
'question.general_properties.repository'];
192 $this->test_questions_repository = $local_dic[
'questions.properties.repository'];
193 $this->qplrequest = $local_dic[
'question.request_data_wrapper'];
194 $this->title_builder = $local_dic[
'title_columns_builder'];
195 $this->testrequest = $local_dic[
'request_data_collector'];
196 $this->response_handler = $local_dic[
'response_handler'];
197 $this->participant_repository = $local_dic[
'participant.repository'];
198 $this->results_data_factory = $local_dic[
'results.data.factory'];
199 $this->results_presentation_factory = $local_dic[
'results.presentation.factory'];
200 $this->export_factory = $local_dic[
'exportimport.factory'];
201 $this->export_repository = $local_dic[
'exportimport.repository'];
202 $this->participant_access_filter_factory = $local_dic[
'participant.access_filter.factory'];
203 $this->test_pass_result_repository = $local_dic[
'results.data.repository'];
204 $this->toplist_repository = $local_dic[
'results.toplist.repository'];
207 if ($this->testrequest->hasRefId() && is_numeric($this->testrequest->getRefId())) {
208 $ref_id = $this->testrequest->getRefId();
212 $this->
ctrl->saveParameter($this, [
'ref_id',
'test_ref_id']);
214 $this->
lng->loadLanguageModule(
'assessment');
218 if (!($this->
object instanceof
ilObjTest)) {
228 $this->component_repository,
230 $this->questionrepository
244 $this->objective_oriented_container,
245 $this->test_session_factory->getSession()
254 $cmd = $this->
ctrl->getCmd(
'testScreen');
256 $cmds_disabled_due_to_offline_status = [
257 'resumePlayer',
'resumePlayer',
'outUserResultsOverview',
'outUserListOfAnswerPasses' 260 if (!$this->
getCreationMode() && $this->
object->getOfflineStatus() && in_array($cmd, $cmds_disabled_due_to_offline_status)) {
264 $next_class = $this->
ctrl->getNextClass($this);
268 $this->
access->checkAccess(
'read',
'', $this->testrequest->getRefId())
270 $this->navigation_history->addItem(
271 $this->testrequest->getRefId(),
272 ilLink::_getLink($this->testrequest->getRefId(),
'tst'),
279 switch ($next_class) {
280 case 'illtiproviderobjectsettinggui':
281 if ((!$this->
access->checkAccess(
"read",
"", $this->testrequest->getRefId()))) {
286 $this->tabs_manager->getSettingsSubTabs();
287 $this->tabs_manager->activateTab(
'settings');
288 $this->tabs_manager->activateSubTab(
'lti_provider');
290 $lti_gui->setCustomRolesForSelection($this->rbac_review->getLocalRoles($this->getTestObject()->getRefId()));
291 $lti_gui->offerLTIRolesForSelection(
false);
292 $this->
ctrl->forwardCommand($lti_gui);
295 case 'iltestexportgui':
296 if (!$this->
access->checkAccess(
'write',
'', $this->ref_id)) {
302 $this->tabs_manager->activateTab(TabsManager::TAB_ID_EXPORT);
304 $selected_files = [];
305 if ($this->testrequest->isset(
'file') && $this->testrequest->raw(
'file')) {
306 $selected_files = $this->testrequest->raw(
'file');
309 if (is_string($selected_files)) {
310 $selected_files = [$selected_files];
316 $this->obj_data_cache,
322 $this->export_repository,
323 $this->temp_file_system,
324 $this->participant_access_filter_factory,
327 $this->questionrepository,
330 $this->
ctrl->forwardCommand($export_gui);
333 case strtolower(ilInfoScreenGUI::class):
335 !$this->
access->checkAccess(
'read',
'', $this->testrequest->getRefId())
336 && !$this->
access->checkAccess(
'visible',
'', $this->testrequest->getRefId())
346 case strtolower(TestScreenGUI::class):
347 if (!$this->
access->checkAccess(
'read',
'', $this->testrequest->getRefId()) && !$this->
access->checkAccess(
'visible',
'', $this->testrequest->getRefId())) {
355 case 'ilobjectmetadatagui':
356 if (!$this->
access->checkAccess(
'write',
'', $this->getTestObject()->getRefId())) {
362 $this->tabs_manager->activateTab(TabsManager::TAB_ID_META_DATA);
364 $this->
ctrl->forwardCommand($md_gui);
367 case strtolower(ilTestParticipantsGUI::class):
368 if ((!$this->
access->checkAccess(
"read",
"", $this->testrequest->getRefId()))) {
376 $this->test_question_set_config_factory->getQuestionSetConfig(),
400 $this->ctrl->forwardCommand($gui);
409 $this->tabs_manager->activateTab(TabsManager::TAB_ID_PARTICIPANTS);
413 case 'iltestresultsgui':
414 if ((!$this->
access->checkAccess(
"read",
"", $this->testrequest->getRefId()))) {
429 $this->component_repository,
435 $this->skills_service,
436 $this->questionrepository,
437 $this->toplist_repository,
441 $this->test_session_factory->getSession(),
445 $this->ctrl->forwardCommand($gui);
448 case "iltestplayerfixedquestionsetgui":
450 $cmd !==
'autosave' &&
451 (!$this->
access->checkAccess(
"read",
"", $this->testrequest->getRefId()))
461 $this->ctrl->forwardCommand($gui);
464 case "iltestplayerrandomquestionsetgui":
466 $cmd !==
'autosave' &&
467 (!$this->
access->checkAccess(
"read",
"", $this->testrequest->getRefId()))
477 $this->ctrl->forwardCommand($gui);
480 case "iltestevaluationgui":
481 if ((!$this->
access->checkAccess(
"read",
"", $this->testrequest->getRefId()))) {
487 case "iltestservicegui":
488 if ((!$this->
access->checkAccess(
"read",
"", $this->testrequest->getRefId()))) {
494 $this->ctrl->forwardCommand($serviceGUI);
497 case 'ilpermissiongui':
498 if ((!$this->
access->checkAccess(
"read",
"", $this->testrequest->getRefId()))) {
503 $this->tabs_manager->activateTab(TabsManager::TAB_ID_PERMISSIONS);
505 $ret = $this->ctrl->forwardCommand($perm_gui);
508 case "illearningprogressgui":
509 if ((!$this->
access->checkAccess(
"read",
"", $this->testrequest->getRefId()))) {
515 $this->tabs_manager->activateTab(TabsManager::TAB_ID_LEARNING_PROGRESS);
517 $test_session = $this->test_session_factory->getSessionByUserId($this->
user->getId());
518 if (!$this->test_access->checkOtherParticipantsLearningProgressAccess()
519 && !$this->
getTestObject()->canShowTestResults($test_session)) {
520 $this->tpl->setOnScreenMessage(
522 $this->lng->txt(
'tst_res_tab_msg_no_lp_access'),
528 $this->ctrl->forwardCommand($new_gui);
532 case "ilcertificategui":
533 if ((!$this->
access->checkAccess(
"read",
"", $this->testrequest->getRefId()))) {
539 $this->tabs_manager->activateTab(TabsManager::TAB_ID_SETTINGS);
544 $this->ctrl->forwardCommand($output_gui);
547 case strtolower(TestScoringByQuestionGUI::class):
548 if (!$this->
access->checkAccess(
"read",
"", $this->testrequest->getRefId())
549 && !$this->
access->checkAccess(
"score_anon",
"", $this->testrequest->getRefId())
557 $this->ctrl->forwardCommand($output_gui);
560 case strtolower(TestScoringByParticipantGUI::class):
561 if (!$this->
access->checkAccess(
"read",
"", $this->testrequest->getRefId())
562 && !$this->
access->checkAccess(
"score_anon",
"", $this->testrequest->getRefId())
570 $this->ctrl->forwardCommand($output_gui);
573 case strtolower(MarkSchemaGUI::class):
574 if ((!$this->
access->checkAccess(
"read",
"", $this->testrequest->getRefId()))) {
588 $this->request_wrapper,
589 $this->response_handler,
595 $this->ctrl->forwardCommand($mark_schema_gui);
599 $this->tabs_manager->activateTab(TabsManager::TAB_ID_SETTINGS);
600 $this->tabs_manager->activateSubTab(TabsManager::SETTINGS_SUBTAB_ID_MARK_SCHEMA);
604 case strtolower(SettingsMainGUI::class):
605 if ((!$this->
access->checkAccess(
"read",
"", $this->testrequest->getRefId()))) {
617 $this->obj_data_cache,
623 $this->component_repository,
627 $this->questionrepository
629 $this->ctrl->forwardCommand($gui);
631 $this->tabs_manager->activateTab(TabsManager::TAB_ID_SETTINGS);
632 $this->tabs_manager->activateSubTab(TabsManager::SUBTAB_ID_GENERAL_SETTINGS);
636 case strtolower(SettingsScoringGUI::class):
637 if ((!$this->
access->checkAccess(
"read",
"", $this->testrequest->getRefId()))) {
648 $this->component_repository,
662 $this->ctrl->forwardCommand($gui);
665 case 'iltestrandomquestionsetconfiggui':
666 if ((!$this->
access->checkAccess(
"read",
"", $this->testrequest->getRefId()))) {
689 $this->component_repository,
690 $this->obj_definition,
691 $this->obj_data_cache,
692 $test_process_locker_factory,
694 $this->title_builder,
695 $this->questionrepository
697 $this->ctrl->forwardCommand($gui);
700 case 'iltestquestionbrowsertablegui':
701 if ((!$this->
access->checkAccess(
"read",
"", $this->testrequest->getRefId()))) {
711 $this->component_repository,
720 $this->questionrepository,
728 $this->ctrl->forwardCommand($gui);
731 case 'iltestskilladministrationgui':
732 if ((!$this->
access->checkAccess(
"read",
"", $this->testrequest->getRefId()))) {
747 $this->component_repository,
749 $this->questionrepository,
753 $this->ctrl->forwardCommand($gui);
756 case 'ilobjectcopygui':
757 if ((!$this->
access->checkAccess(
"read",
"", $this->testrequest->getRefId()))) {
764 $this->ctrl->forwardCommand($cp);
767 case strtolower(ilAssQuestionPreviewGUI::class):
768 if (!$this->
access->checkAccess(
'write',
'', $this->getTestObject()->getRefId())) {
774 case 'ilassquestionpagegui':
775 if ($cmd ===
'finishEditing') {
780 if ((!$this->
access->checkAccess(
"read",
"", $this->testrequest->getRefId()))) {
783 if ($cmd ===
'edit' && !$this->
access->checkAccess(
'write',
'', $this->testrequest->getRefId())) {
792 $this->questionrepository,
795 $forwarder->forward();
798 case 'ilassspecfeedbackpagegui':
799 if ((!$this->
access->checkAccess(
"read",
"", $this->testrequest->getRefId()))) {
803 $this->ctrl->forwardCommand($pg_gui);
806 case 'ilassgenfeedbackpagegui':
807 if ((!$this->
access->checkAccess(
"read",
"", $this->testrequest->getRefId()))) {
811 $this->ctrl->forwardCommand($pg_gui);
814 case 'illocalunitconfigurationgui':
815 if ((!$this->
access->checkAccess(
"read",
"", $this->testrequest->getRefId()))) {
822 $question = $question_gui->getObject();
824 $question_gui->setObject($question);
825 $question_gui->setQuestionTabs();
829 $this->ctrl->forwardCommand($gui);
832 case "ilcommonactiondispatchergui":
833 if (!$this->
access->checkAccess(
"read",
"", $this->testrequest->getRefId()) && !$this->
access->checkAccess(
"visible",
"", $this->testrequest->getRefId())) {
838 $this->ctrl->forwardCommand($gui);
841 case 'ilassquestionfeedbackeditinggui':
842 if (!$this->
access->checkAccess(
'write',
'', $this->getTestObject()->getRefId())) {
848 $this->ctrl->setReturnByClass(self::class, self::SHOW_QUESTIONS_CMD);
850 $question = $question_gui->getObject();
852 $question_gui->setObject($question);
853 $question_gui->setQuestionTabs();
858 $this->tpl->setOnScreenMessage(
'failure', $this->lng->txt(
'question_is_part_of_running_test'),
true);
873 $this->ctrl->forwardCommand($gui);
876 case 'iltestcorrectionsgui':
877 if ((!$this->
access->checkAccess(
'read',
'', $this->testrequest->getRefId()))) {
895 $this->ctrl->forwardCommand($gui);
898 case 'iltestpagegui':
899 if ((!$this->
access->checkAccess(
"write",
"", $this->testrequest->getRefId()))) {
903 if ($cmd ===
'downloadFile') {
904 $page_id = $this->
object->getIntroductionPageId();
905 if ($this->testrequest->strVal(
'page_type') ===
'concludingremarkspage') {
906 $page_id = $this->
object->getConcludingRemarksPageId();
908 $this->ctrl->forwardCommand(
new ilTestPageGUI(
'tst', $page_id));
915 if (!$this->
access->checkAccess(
'read',
'', $this->testrequest->getRefId())
916 && !$this->
access->checkAccess(
'visible',
'', $this->testrequest->getRefId())) {
922 if ($cmd ===
'testScreen') {
927 $local_cmd = $cmd .
'Object';
928 if (!method_exists($this, $local_cmd)) {
929 $local_cmd = self::SHOW_QUESTIONS_CMD .
'Object';
935 if ((!$this->
access->checkAccess(
'read',
'', $this->testrequest->getRefId()))) {
940 [
'editQuestion',
'previewQuestion',
'save',
'saveReturn',
'uploadImage',
941 'removeImage',
'syncQuestion',
'syncQuestionReturn',
'suggestedsolution']
943 && !$this->
access->checkAccess(
'write',
'', $this->getTestObject()->getRefId())) {
946 if (in_array($cmd, [
'editQuestion',
'save',
'saveReturn',
'suggestedsolution'])
948 $this->tpl->setOnScreenMessage(
'failure', $this->lng->txt(
'question_is_part_of_running_test'),
true);
956 if (!in_array(strtolower($this->testrequest->raw(
'baseClass')), [
'iladministrationgui',
'ilrepositorygui'])
958 $this->tpl->printToStdout();
964 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
'no_permission'),
true);
965 $target_class = get_class($this->
object) .
'GUI';
966 $this->
ctrl->setParameterByClass($target_class,
'ref_id', $this->ref_id);
967 $this->
ctrl->redirectByClass($target_class);
972 $this->tpl->setOnScreenMessage(
'failure', sprintf(
973 $this->
lng->txt(
"msg_no_perm_read_item"),
974 $this->
object->getTitle()
977 $this->
ctrl->redirectByClass(
'ilrepositorygui');
984 $nr_of_participants_with_results = $this->
getTestObject()->evalTotalPersons();
986 $this->
ctrl->saveParameterByClass(self::class,
'q_id');
1003 if ($nr_of_participants_with_results > 0) {
1005 $this->
lng->txt(
'tst_corrections_qst_form'),
1006 $this->
ctrl->getLinkTargetByClass(ilTestCorrectionsGUI::class,
'showQuestion')
1014 if (!$this->
getTestObject()->isRandomTest() && $nr_of_participants_with_results === 0) {
1015 $gui->setPrimaryCmd(
1016 $this->
lng->txt(
'edit_question'),
1017 $this->
ctrl->getLinkTargetByClass(
1018 get_class($question_gui),
1022 $gui->addAdditionalCmd(
1023 $this->
lng->txt(
'edit_page'),
1024 $this->
ctrl->getLinkTargetByClass(
1025 ilAssQuestionPageGUI::class,
1033 $gui->initPreviewSession($this->
user->getId(), $this->testrequest->getQuestionId());
1034 $gui->initStyleSheets();
1036 $this->
ctrl->clearParameterByClass(self::class,
'q_id');
1037 $this->tabs_gui->setBackTarget(
1038 $this->
lng->txt(
'backtocallingtest'),
1039 $this->
ctrl->getLinkTargetByClass(self::class, self::SHOW_QUESTIONS_CMD)
1041 $this->
ctrl->saveParameterByClass(self::class,
'q_id');
1042 $gui->{$cmd .
'Cmd'}();
1047 $this->tpl->setTitle(
1048 $this->
refinery->encode()->htmlSpecialCharsAsEntities()->transform(
1049 "{$this->getTestObject()->getTitle()}: {$question_title}" 1056 $this->create_question_mode =
true;
1062 $this->
ctrl->setReturnByClass(self::class, self::SHOW_QUESTIONS_CMD);
1070 $question = $question_gui->getObject();
1072 $question_gui->setObject($question);
1073 $question_gui->setContextAllowsSyncToPool(
true);
1074 $question_gui->setQuestionTabs();
1078 $target = strpos($cmd,
'Return') ===
false ?
'stay' :
'return';
1080 if (in_array($cmd, [
'syncQuestion',
'syncQuestionReturn'])) {
1081 $question_gui->syncQuestion();
1086 if ($question_gui->isSaveCommand()
1087 || $question_gui->cmdNeedsExistingQuestion($cmd)) {
1091 if ($qid === 0 && $question_gui->cmdNeedsExistingQuestion($cmd)) {
1092 $question_gui->getObject()->createNewQuestion();
1093 $question_gui->setQuestionTabs();
1097 if (!$question_gui->isSaveCommand()) {
1098 $this->
ctrl->forwardCommand($question_gui);
1102 if (!$question_gui->saveQuestion()) {
1106 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
'msg_obj_modified'),
true);
1120 if ($this->testrequest->isset(
'move_after_question_with_id')) {
1122 $this->testrequest->int(
'move_after_question_with_id')
1126 if ($this->testrequest->isset(
'pool_title')) {
1128 $this->testrequest->strVal(
'pool_title')
1132 if ($this->testrequest->isset(
'pool_ref')) {
1134 $this->testrequest->int(
'pool_ref')
1137 return $question_gui;
1142 if ($this->
getTestObject()->getTestLogger()->isLoggingEnabled()) {
1143 $this->
getTestObject()->getTestLogger()->logQuestionAdministrationInteraction(
1144 $question_gui->
getObject()->toQuestionAdministrationInteraction(
1145 $this->
getTestObject()->getTestLogger()->getAdditionalInformationGenerator(),
1147 TestQuestionAdministrationInteractionTypes::QUESTION_MODIFIED
1193 if ($target ===
'return') {
1200 if ($target ===
'stay') {
1201 $this->
ctrl->setParameterByClass(ilAssQuestionPreviewGUI::class,
'q_id', $question_gui->
getObject()->getId());
1202 $this->tabs_gui->setBackTarget(
1203 $this->
lng->txt(
'backtocallingpage'),
1204 $this->
ctrl->getLinkTargetByClass(
1205 ilAssQuestionPreviewGUI::class,
1219 $this->
user->getId()
1229 $this->
ctrl->redirectByClass(
'ilTestExportGUI');
1238 $qid = $this->testrequest->int(
'q_id');
1240 if ($qid === 0 || $this->
getTestObject()->checkQuestionParent($qid)) {
1244 throw new ilTestException(
'question id does not relate to parent object!');
1250 $this->
ctrl->redirectByClass(
'ilTestRandomQuestionSetConfigGUI');
1253 $this->
ctrl->redirectByClass(
'ilObjTestGUI', self::SHOW_QUESTIONS_CMD);
1259 $this->tabs_manager->getSettingsSubTabs();
1261 if ($this->request_wrapper->has(
'page_type')
1262 && $this->request_wrapper->retrieve(
1264 $this->
refinery->kindlyTo()->string()
1265 ) ===
'introductionpage' 1267 $page_type =
'IntroductionPage';
1268 $this->tabs_manager->activateSubTab(TabsManager::SETTINGS_SUBTAB_ID_EDIT_INTRODUCTION_PAGE);
1271 $page_type =
'ConcludingRemarksPage';
1272 $this->tabs_manager->activateSubTab(TabsManager::SETTINGS_SUBTAB_ID_EDIT_CONCLUSION_PAGE);
1273 $page_id = $this->
getTestObject()->getConcludingRemarksPageId();
1275 $this->
ctrl->saveParameterByClass(ilTestPageGUI::class,
'page_type');
1278 $this->content_style->gui()->addCss($this->tpl, $this->ref_id);
1279 $this->tpl->setContent($this->
ctrl->forwardCommand($gui));
1281 $this->tabs_manager->activateTab(TabsManager::TAB_ID_SETTINGS);
1302 $this->
ctrl->forwardCommand($gui);
1307 $this->
ctrl->redirectByClass(SettingsMainGUI::class, SettingsMainGUI::CMD_SHOW_FORM);
1312 $this->tpl->loadStandardTemplate();
1319 $this->
ctrl->redirectByClass([ilRepositoryGUI::class, self::class, ilInfoScreenGUI::class]);
1322 protected function importFile(
string $file_to_import,
string $path_to_uploaded_file_in_temp_dir): void
1329 $unzip = $this->archives->unzip(Streams::ofResource(fopen($file_to_import,
'r')), $options);
1332 if (!is_file($qtifile)) {
1335 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
'tst_import_non_ilias_zip'),
true);
1338 $qtiParser->startParsing();
1339 $founditems = $qtiParser->getFoundItems();
1343 foreach ($founditems as $item) {
1344 if ($item[
"type"] !==
'') {
1351 if (count($founditems) && $complete == 0) {
1354 $this->tpl->setOnScreenMessage(
'info', $this->
lng->txt(
'qpl_import_non_ilias_files'));
1359 ilSession::set(
'path_to_uploaded_file_in_temp_dir', $path_to_uploaded_file_in_temp_dir);
1363 || $founditems === []) {
1369 'importVerifiedFile',
1373 $path_to_uploaded_file_in_temp_dir
1376 if ($form ===
null) {
1380 $panel = $this->ui_factory->panel()->standard(
1381 $this->
lng->txt(
'import_tst'),
1383 $this->ui_factory->legacy()->content($this->
lng->txt(
'qpl_import_verify_found_questions')),
1387 $this->tpl->setContent($this->ui_renderer->render($panel));
1388 $this->tpl->printToStdout();
1395 $defaults = $tst->getAvailableDefaults();
1396 if ($defaults === []) {
1400 $additional_options = [];
1401 foreach ($defaults as $row) {
1402 $additional_options[
"tstdef_" . $row[
"test_defaults_id"]] = [$row[
"name"],
1403 $this->
lng->txt(
"tst_default_settings")];
1405 return $additional_options;
1415 $new_object->saveToDb();
1418 if ($test_def_id !==
null 1419 && ($defaults = $new_object->getTestDefaults($test_def_id)) !==
null) {
1420 $info = $new_object->applyDefaults($defaults);
1423 $new_object->saveToDb();
1425 if ($new_object->getTestLogger()->isLoggingEnabled()) {
1426 $new_object->getTestLogger()->logTestAdministrationInteraction(
1427 $new_object->getTestLogger()->getInteractionFactory()->buildTestAdministrationInteraction(
1429 $this->
user->getId(),
1430 TestAdministrationInteractionTypes::NEW_TEST_CREATED,
1437 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
'object_added'),
true);
1439 $this->tpl->setOnScreenMessage(
'info', $this->
lng->txt(
$info),
true);
1441 $this->
ctrl->setParameter($this,
'ref_id', $new_object->
getRefId());
1442 $this->
ctrl->redirectByClass(SettingsMainGUI::class);
1448 ->withRequest($this->request)
1450 return isset(
$data[
'didactic_templates'])
1470 bool $skip_retrieve_selected_questions =
false 1473 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
'no_permission'),
true);
1474 $this->
ctrl->returnToParent($this);
1477 $path_to_uploaded_file_in_temp_dir =
ilSession::get(
'path_to_uploaded_file_in_temp_dir');
1481 $new_obj->setTitle(
'dummy');
1482 $new_obj->setDescription(
'test import');
1483 $new_obj->create(
true);
1484 $new_obj->createReference();
1485 $new_obj->putInTree($this->testrequest->getRefId());
1486 $new_obj->setPermissions($this->testrequest->getRefId());
1487 $new_obj->saveToDb();
1489 $selected_questions = [];
1490 if (!$skip_retrieve_selected_questions) {
1492 'importVerifiedFile',
1499 ilSession::set(
'tst_import_selected_questions', $selected_questions);
1501 $imp =
new ilImport($this->testrequest->getRefId());
1503 $map->addMapping(
'components/ILIAS/Test',
'tst',
'new_id', (
string) $new_obj->getId());
1509 if (is_file($importdir . DIRECTORY_SEPARATOR .
'/manifest.xml')) {
1510 $imp->
importObject($new_obj, $file_to_import, basename($file_to_import),
'tst',
'components/ILIAS/Test',
true);
1513 $test_importer->setImport($imp);
1515 $test_importer->setImportDirectory($importdir .
'/' . $subdir);
1516 $test_importer->init();
1518 $test_importer->importXmlRepresentation(
1526 if ($new_obj->getTestLogger()->isLoggingEnabled()) {
1527 $new_obj->getTestLogger()->logTestAdministrationInteraction(
1528 $new_obj->getTestLogger()->getInteractionFactory()->buildTestAdministrationInteraction(
1529 $new_obj->getRefId(),
1530 $this->
user->getId(),
1531 TestAdministrationInteractionTypes::NEW_TEST_CREATED,
1542 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
"object_imported"),
true);
1545 if ($question_skill_assignments_import_fails->failedImportsRegistered()) {
1546 $this->tpl->setOnScreenMessage(
1548 $question_skill_assignments_import_fails->getFailedImportsMessage($this->lng),
1553 $this->
ctrl->setParameterByClass(ilObjTestGUI::class,
'ref_id', $new_obj->getRefId());
1554 $this->
ctrl->redirectByClass(ilObjTestGUI::class);
1562 $file = explode(
"_", $this->testrequest->raw(
"file_id"));
1563 $fileObj =
new ilObjFile((
int) $file[count($file) - 1],
false);
1564 $fileObj->sendFile();
1575 $this->
ctrl->getLinkTargetByClass(ilObjTestGUI::class,
'downloadFile')
1577 $page_gui->showMediaFullscreen();
1586 $pg_obj->
sendParagraph($this->testrequest->raw(
"par_id"), $this->testrequest->raw(
"downloadtitle"));
1594 $qpl->setType(
"qpl");
1595 $qpl->setTitle($name);
1596 $qpl->setDescription($description);
1598 $qpl->createReference();
1599 $qpl->putInTree($parent_ref);
1600 $qpl->setPermissions($parent_ref);
1601 $qpl->getObjectProperties()->storePropertyIsOnline($qpl->getObjectProperties()->getPropertyIsOnline()->withOnline());
1606 public function createQuestionObject():
void 1610 $this->
ctrl->setReturnByClass(self::class, self::SHOW_QUESTIONS_CMD);
1613 $data_with_section = $form->getData();
1614 if ($data_with_section ===
null) {
1618 $data = $data_with_section[0];
1620 $qpl_mode =
$data[
'pool_selection'][
'qpl_type'];
1621 if ($qpl_mode === self::QUESTION_CREATION_POOL_SELECTION_NEW_POOL &&
$data[
'pool_selection'][
'title'] ===
'' 1622 || $qpl_mode === self::QUESTION_CREATION_POOL_SELECTION_EXISTING_POOL &&
$data[
'pool_selection'][
'pool_ref_id'] === 0) {
1623 $this->tpl->setOnScreenMessage(
'info', $this->
lng->txt(
"questionpool_not_entered"));
1633 $question = $question_gui->getObject();
1634 $question->setAdditionalContentEditingMode(
$data[
'editing_type']);
1636 $question_gui->setObject($question);
1637 $question_gui->setQuestionTabs();
1639 if (array_key_exists(
'position',
$data)) {
1640 $question_gui->setMoveAfterQuestionId(
$data[
'position']);
1643 if ($qpl_mode === self::QUESTION_CREATION_POOL_SELECTION_NEW_POOL) {
1644 $question_gui->setCopyToNewPoolOnSave(
$data[
'pool_selection'][
'title']);
1647 if ($qpl_mode === self::QUESTION_CREATION_POOL_SELECTION_EXISTING_POOL) {
1648 $question_gui->setCopyToExistingPoolOnSave(
$data[
'pool_selection'][
'pool_ref_id']);
1651 $question_gui->editQuestion();
1656 $this->
ctrl->redirect($this, self::SHOW_QUESTIONS_CMD);
1663 if (($selected_array ?? $this->testrequest->getQuestionIds()) === []) {
1664 $this->tpl->setOnScreenMessage(
'info', $this->
lng->txt(
'tst_insert_missing_question'),
true);
1665 $this->
ctrl->redirect($this,
'browseForQuestions');
1668 $this->
getTestObject()->saveCompleteStatus($this->test_question_set_config_factory->getQuestionSetConfig());
1669 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
'tst_questions_inserted'),
true);
1670 $this->
ctrl->redirect($this, self::SHOW_QUESTIONS_CMD);
1678 $this->tabs_manager->getQuestionsSubTabs();
1679 $this->tabs_manager->activateSubTab(TabsManager::SUBTAB_ID_QST_LIST_VIEW);
1681 $sub_screen_id = [
'createQuestion'];
1683 $this->tabs_manager->activateTab(TabsManager::TAB_ID_QUESTIONS);
1684 $this->
help->setScreenId(
'assQuestions');
1685 $this->
help->setSubScreenId(implode(
'_', $sub_screen_id));
1687 $this->tpl->setContent(
1688 $this->ui_renderer->render(
1689 $form ?? $this->buildQuestionCreationForm()
1697 $questions = $this->
getTestObject()->getQuestionTitlesAndIndexes();
1698 if ($questions !== []) {
1705 $sub_screen_id[] =
'editMode';
1708 $sub_screen_id[] =
'poolSelect';
1713 $this->ui_factory->input()->field()->section(
$inputs, $this->
lng->txt(
'ass_create_question'))
1716 $form = $this->ui_factory->input()->container()->form()->standard(
1717 $this->
ctrl->getFormAction($this,
'createQuestion'),
1719 )->withSubmitLabel($this->
lng->txt(
'create'));
1726 $question_types = (
new ilObjQuestionPool())->getQuestionTypes(
false,
true,
false);
1728 foreach ($question_types as $label =>
$data) {
1729 $options[
$data[
'question_type_id']] = $label;
1732 return $this->ui_factory->input()->field()->select(
1733 $this->
lng->txt(
'question_type'),
1735 )->withRequired(
true);
1740 $options = [0 => $this->
lng->txt(
'first')];
1741 foreach ($questions as $key => $title) {
1742 $options[$key] = $this->
lng->txt(
'behind') .
' ' . $title
1743 .
' [' . $this->
lng->txt(
'question_id_short') .
': ' . $key .
']';
1745 return $this->ui_factory->input()->field()->select(
1746 $this->
lng->txt(
'position'),
1753 if (!$this->
getTestObject()->getGlobalSettings()->isPageEditorEnabled()) {
1754 return $this->ui_factory->input()->field()->hidden()->
withValue(
1759 return $this->ui_factory->input()->field()->radio($this->
lng->txt(
'tst_add_quest_cont_edit_mode'))
1762 $this->
lng->txt(
'tst_add_quest_cont_edit_mode_IPE'),
1763 $this->
lng->txt(
'tst_add_quest_cont_edit_mode_IPE_info')
1766 $this->
lng->txt(
'tst_add_quest_cont_edit_mode_RTE'),
1767 $this->
lng->txt(
'tst_add_quest_cont_edit_mode_RTE_info')
1774 $f = $this->ui_factory->input()->field();
1777 $trafo = $this->
refinery->custom()->transformation(
1778 static function ($values) use ($kt): array {
1779 $return[
'qpl_type'] = $kt->int()->transform($values[0]);
1780 if ($return[
'qpl_type'] === self::QUESTION_CREATION_POOL_SELECTION_NO_POOL) {
1783 if ($return[
'qpl_type'] === self::QUESTION_CREATION_POOL_SELECTION_NEW_POOL) {
1784 return $return + [
'title' => $kt->string()->transform($values[1][0])];
1786 return $return + [
'pool_ref_id' => $kt->int()->transform($values[1][0])];
1792 foreach ($questionpools as $key => $p) {
1793 $pools_data[$key] = $p[
'title'];
1797 self::QUESTION_CREATION_POOL_SELECTION_NO_POOL =>
$f->group([], $this->
lng->txt(
'assessment_no_pool')),
1798 self::QUESTION_CREATION_POOL_SELECTION_EXISTING_POOL =>
$f->group(
1799 [
$f->select($this->lng->txt(
'select_questionpool'), $pools_data)],
1800 $this->
lng->txt(
'assessment_existing_pool')
1802 self::QUESTION_CREATION_POOL_SELECTION_NEW_POOL =>
$f->group(
1803 [
$f->text($this->lng->txt(
'name'))],
1804 $this->
lng->txt(
'assessment_new_pool')
1808 return $f->switchableGroup(
1810 $this->
lng->txt(
'assessment_pool_selection')
1812 ->withRequired(
true)
1820 if ($this->testrequest->raw(
'add')) {
1838 $this->tpl->addBlockFile(
'ADM_CONTENT',
'adm_content',
'tpl.il_as_tst_questions.html',
'components/ILIAS/Test');
1842 $this->tabs_manager->getQuestionsSubTabs();
1843 $this->tabs_manager->activateSubTab(TabsManager::SUBTAB_ID_QST_LIST_VIEW);
1845 $this->tpl->setCurrentBlock(
'adm_content');
1846 $this->tpl->setVariable(
'ACTION_QUESTION_FORM', $this->
ctrl->getFormAction($this));
1847 $this->tpl->setVariable(
1849 $this->ui_renderer->render(
1850 $this->getTable()->getTableComponent()
1853 $this->tpl->parseCurrentBlock();
1858 $selected_array = [$this->testrequest->int(
'add')];
1862 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
'test_has_datasets_warning_page_view'));
1866 $this->tpl->setOnScreenMessage(
'info', $this->
lng->txt(
'tst_insert_questions'));
1872 if (!$this->
access->checkAccess(
'write',
'', $this->ref_id)
1877 if ($has_started_test_runs) {
1878 $link = $this->ui_factory->link()->standard(
1879 $this->
lng->txt(
'test_has_datasets_warning_page_view_link'),
1880 $this->
ctrl->getLinkTargetByClass([\ilTestParticipantsGUI::class])
1883 $message = $this->
lng->txt(
'test_has_datasets_warning_page_view');
1884 $massage_box = $this->ui_factory->messageBox()->info(
$message)->withLinks([$link]);
1885 $this->tpl->setCurrentBlock(
'mess');
1886 $this->tpl->setVariable(
1888 $this->ui_renderer->render($massage_box)
1890 $this->tpl->parseCurrentBlock();
1894 $this->
toolbar->addButton($this->
lng->txt(
'ass_create_question'), $this->
ctrl->getLinkTarget($this,
'createQuestionForm'));
1895 $this->
toolbar->addSeparator();
1901 $this->
ctrl->setParameterByClass(
1902 ilTestQuestionBrowserTableGUI::class,
1908 $this->
lng->txt(
'tst_browse_for_qpl_questions'),
1909 $this->
ctrl->getLinkTargetByClass(
1910 ilTestQuestionBrowserTableGUI::class,
1915 $this->
ctrl->setParameterByClass(
1916 ilTestQuestionBrowserTableGUI::class,
1922 $this->
lng->txt(
'tst_browse_for_tst_questions'),
1923 $this->
ctrl->getLinkTargetByClass(
1924 ilTestQuestionBrowserTableGUI::class,
1936 if (!$this->
getTestObject()->getTestLogger()->isLoggingEnabled()
1937 || !$this->rbac_review->isAssigned($this->user->getId(),
SYSTEM_ROLE_ID)
1938 && !$this->
access->checkAccess(
'tst_history_read',
'', $this->getTestObject()->getRefId())) {
1942 $here_uri = $this->data_factory->uri(ILIAS_HTTP_PATH
1943 .
'/' . $this->
ctrl->getLinkTargetByClass(self::class, self::SHOW_LOGS_CMD));
1944 list($url_builder, $action_parameter_token, $row_id_token) = (
new URLBuilder($here_uri))->acquireParameters(
1945 LogTable::QUERY_PARAMETER_NAME_SPACE,
1946 LogTable::ACTION_TOKEN_STRING,
1947 LogTable::ENTRY_TOKEN_STRING
1950 if ($this->request_wrapper->has($action_parameter_token->getName())) {
1951 $this->
getTestObject()->getTestLogViewer()->executeLogTableAction(
1953 $action_parameter_token,
1960 $this->ui_factory->button()->standard(
1961 $this->
lng->txt(
'export_legacy_logs'),
1962 $this->
ctrl->getLinkTargetByClass(self::class,
'exportLegacyLogs')
1965 $this->tabs_manager->activateTab(TabsManager::TAB_ID_HISTORY);
1967 list($filter, $table_gui) = $this->
getTestObject()->getTestLogViewer()->getLogTable(
1969 $action_parameter_token,
1974 $this->tpl->setVariable(
'ADM_CONTENT', $this->ui_renderer->render([$filter, $table_gui]));
1985 "legacy_logs_for_{$this->getTestObject()->getRefId()}.csv" 1994 $command = $this->testrequest->strVal(
'command');
1995 if ($command ===
'') {
1996 $method = $command .
'Object';
1997 if (method_exists($this, $method)) {
2002 $this->
ctrl->redirect($this,
'participants');
2012 $this->tabs_manager->activateTab(TabsManager::TAB_ID_SETTINGS);
2014 $this->
toolbar->setFormAction($this->
ctrl->getFormAction($this,
'addDefaults'));
2015 $this->
toolbar->addFormButton($this->
lng->txt(
'add'),
'addDefaults');
2019 $table->setData($defaults);
2020 $this->tpl->setContent($table->getHTML());
2030 $defaults_ids = $this->testrequest->retrieveArrayOfIntsFromPost(
'chb_defaults');
2031 if ($defaults_ids !==
null && $defaults_ids !== []) {
2032 foreach ($defaults_ids as $test_default_id) {
2036 $this->tpl->setOnScreenMessage(
'info', $this->
lng->txt(
'select_one'));
2059 $defaults_id = $this->testrequest->retrieveArrayOfIntsFromPost(
'chb_defaults');
2060 if ($defaults_id === []) {
2061 $this->tpl->setOnScreenMessage(
'info', $this->
lng->txt(
'tst_defaults_apply_select_one'));
2068 || ($defaults = $this->
getTestObject()->getTestDefaults($defaults_id[0])) ===
null) {
2069 $this->tpl->setOnScreenMessage(
'info', $this->
lng->txt(
'tst_defaults_apply_not_possible'));
2074 $default_settings = unserialize(
2075 $defaults[
'defaults'],
2076 [
'allowed_classes' => [DateTimeImmutable::class]]
2079 if (isset($default_settings[
'isRandomTest'])) {
2080 if ($default_settings[
'isRandomTest']) {
2087 } elseif (isset($default_settings[
'questionSetType'])) {
2088 $new_question_set_type = $default_settings[
'questionSetType'];
2090 $old_question_set_type = $this->
getTestObject()->getQuestionSetType();
2091 $question_set_type_setting_switched = ($old_question_set_type != $new_question_set_type);
2093 $old_question_set_config = $this->test_question_set_config_factory->getQuestionSetConfig();
2096 case !$question_set_type_setting_switched:
2097 case !$old_question_set_config->doesQuestionSetRelatedDataExist():
2106 $confirmation->setFormAction($this->
ctrl->getFormAction($this));
2107 $confirmation->setCancel($this->
lng->txt(
'cancel'),
'defaults');
2108 $confirmation->setConfirm($this->
lng->txt(
'confirm'),
'confirmedApplyDefaults');
2110 $confirmation->setOldQuestionSetType($this->
getTestObject()->getQuestionSetType());
2111 $confirmation->setNewQuestionSetType($new_question_set_type);
2112 $confirmation->setQuestionLossInfoEnabled(
false);
2113 $confirmation->build();
2115 $confirmation->populateParametersFromPost();
2117 $this->tpl->setContent($this->
ctrl->getHTML($confirmation));
2122 if ($question_set_type_setting_switched && !$this->
getTestObject()->getOfflineStatus()) {
2124 $info = $this->
lng->txt(
'tst_set_offline_due_to_switched_question_set_type_setting');
2125 $this->tpl->setOnScreenMessage(
'info',
$info,
true);
2130 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
'tst_defaults_applied'),
true);
2132 $this->tpl->setOnScreenMessage(
'info', $this->
lng->txt(
$info),
true);
2137 if ($question_set_type_setting_switched && $old_question_set_config->doesQuestionSetRelatedDataExist()) {
2138 $old_question_set_config->removeQuestionSetRelatedData();
2141 $this->
ctrl->redirect($this,
'defaults');
2151 $name = $this->testrequest->strVal(
'name');
2155 $this->tpl->setOnScreenMessage(
'info', $this->
lng->txt(
'tst_defaults_enter_name'));
2162 if (in_array($this->
ctrl->getCmdClass(), self::INFO_SCREEN_CHILD_CLASSES)) {
2171 $this->
ctrl->redirectByClass(
2172 [ilRepositoryGUI::class, self::class, ilInfoScreenGUI::class]
2178 if (!$this->
access->checkAccess(
'visible',
'', $this->ref_id)
2179 && !$this->
access->checkAccess(
'read',
'', $this->ref_id)) {
2183 if ($this->
getTestObject()->getMainSettings()->getAdditionalSettings()->getHideInfoTab()) {
2184 $this->
ctrl->redirectByClass([self::class, TestScreenGUI::class], TestScreenGUI::DEFAULT_CMD);
2187 $this->tabs_manager->activateTab(TabsManager::TAB_ID_INFOSCREEN);
2189 if ($this->
access->checkAccess(
'read',
'', $this->ref_id)) {
2200 $this->test_player_factory->getPlayerGUI(),
2201 $this->test_question_set_config_factory->getQuestionSetConfig(),
2202 $this->test_session_factory->getSession(),
2215 $toolbar->setSessionLockString(
'');
2219 $info->enablePrivateNotes();
2221 $info->addSection($this->lng->txt(
'tst_general_properties'));
2223 $this->lng->txt(
'author'),
2224 $this->
refinery->encode()->htmlSpecialCharsAsEntities()->transform(
2229 $this->lng->txt(
'title'),
2230 $this->
refinery->encode()->htmlSpecialCharsAsEntities()->transform(
2235 if ($this->type !==
'tst') {
2236 $info->hideFurtherSections(
false);
2239 $info->addSection($this->lng->txt(
'tst_sequence_properties'));
2241 $this->lng->txt(
'tst_sequence'),
2243 $this->
getTestObject()->getMainSettings()->getParticipantFunctionalitySettings()->getPostponedQuestionsMoveToEnd()
2244 ?
'tst_sequence_postpone' :
'tst_sequence_fixed' 2248 $info->addSection($this->lng->txt(
'tst_heading_scoring'));
2250 $this->lng->txt(
'tst_text_count_system'),
2252 ($this->
getTestObject()->getCountSystem() == SettingsScoring::COUNT_PARTIAL_SOLUTIONS) ?
'tst_count_partial_solutions' :
'tst_count_correct_solutions' 2259 $info->addSection($this->lng->txt(
'tst_score_reporting'));
2261 $this->lng->txt(
'tst_score_reporting'),
2262 $this->
getTestObject()->getScoreSettings()->getResultSummarySettings()
2263 ->getScoreReporting()->getTranslatedValue($this->lng)
2266 ->getScoreSettings()
2267 ->getResultSummarySettings()
2268 ->getReportingDate();
2269 if ($reporting_date !==
null) {
2271 $this->lng->txt(
'tst_score_reporting_date'),
2274 ->format($this->
user->getDateTimeFormat()->toString())
2278 $info->addSection($this->lng->txt(
'tst_session_settings'));
2279 $info->addProperty($this->lng->txt(
'tst_nr_of_tries'), $this->
getTestObject()->getNrOfTries() === 0 ? $this->lng->txt(
'unlimited') : (string) $this->
getTestObject()->getNrOfTries());
2282 $this->lng->txt(
'tst_nr_of_tries_of_user'),
2283 ($this->test_session_factory->getSession()->getPass() === 0) ?
2284 $this->lng->txt(
'tst_no_tries') : (string) $this->test_session_factory->getSession()->getPass()
2289 $info->addProperty($this->lng->txt(
'tst_processing_time'), $this->
getTestObject()->getProcessingTime());
2293 if ($this->
getTestObject()->isStartingTimeEnabled() && $starting_time !== 0) {
2297 if ($this->
getTestObject()->isEndingTimeEnabled() && $ending_time != 0) {
2302 $this->ctrl->forwardCommand(
$info);
2308 $qsaImportFails->deleteRegisteredImportFails();
2310 $sltImportFails->deleteRegisteredImportFails();
2312 $this->
ctrl->redirectByClass([ilRepositoryGUI::class, self::class, ilInfoScreenGUI::class]);
2317 switch ($this->
ctrl->getCmd()) {
2320 case "redirectToInfoScreen":
2327 case "outCorrectSolution":
2328 case "showAnswersOfUser":
2329 case "outUserResultsOverview":
2330 case "backFromSummary":
2331 case "show_answers":
2334 case "outTestSummary":
2335 case "outQuestionSummary":
2336 case "gotoQuestion":
2337 case "selectImagemapRegion":
2338 case "confirmSubmitAnswers":
2339 case "finalSubmission":
2341 case "outUserPassDetails":
2342 case "checkPassword":
2345 $this->
ctrl->getLinkTargetByClass(
2346 [self::class, TestScreenGUI::class],
2347 TestScreenGUI::DEFAULT_CMD
2350 $this->testrequest->getRefId()
2354 case "evalAllUsers":
2355 case "evalUserDetail":
2358 $this->
ctrl->getLinkTarget($this,
'eval_stat'),
2360 $this->testrequest->getRefId()
2365 case "importVerifiedFile":
2366 case "cancelImport":
2371 $this->
ctrl->getLinkTargetByClass(
2372 [self::class, TestScreenGUI::class],
2373 TestScreenGUI::DEFAULT_CMD
2376 $this->testrequest->getRefId()
2391 $this->tabs_manager->activateTab(TabsManager::TAB_ID_SETTINGS);
2396 $output_gui->certificateEditor();
2406 $this->
help->setScreenIdComponent(
"tst");
2408 if ($this->tabs_manager ===
null) {
2414 $this->tabs_manager->setParentBackLabel($this->
lng->txt(
'back_to_objective_container'));
2415 $this->tabs_manager->setParentBackHref($courseLink);
2418 $this->tabs_manager->perform();
2421 public static function accessViolationRedirect()
2425 $main_tpl = $DIC->ui()->mainTemplate();
2427 $main_tpl->setOnScreenMessage(
'failure', $DIC->language()->txt(
"no_permission"),
true);
2428 $DIC->ctrl()->redirectByClass(TestScreenGUI::class, TestScreenGUI::DEFAULT_CMD);
2440 $main_tpl = $DIC->ui()->mainTemplate();
2441 $ilAccess = $DIC[
'ilAccess'];
2445 if ($ilAccess->checkAccess(
'read',
'', (
int) $target)
2446 || $ilAccess->checkAccess(
'visible',
'', (
int) $target)) {
2447 $DIC->ctrl()->setParameterByClass(self::class,
'ref_id', (
int) $target);
2448 $DIC->ctrl()->redirectByClass(
2450 ilRepositoryGUI::class,
2451 ilObjTestGUI::class,
2452 TestScreenGUI::class
2454 TestScreenGUI::DEFAULT_CMD
2457 $main_tpl->setOnScreenMessage(
'info', sprintf(
2458 $lng->
txt(
'msg_no_perm_read_item'),
2469 $this->
copyQuestionsToPool($this->testrequest->raw(
'q_id'), $this->testrequest->raw(
'sel_qpl'));
2470 $this->
ctrl->redirect($this, self::SHOW_QUESTIONS_CMD);
2481 foreach ($question_ids as $q_id) {
2482 $new_id = $this->
copyQuestionToPool(assQuestion::instantiateQuestionGUI($q_id), $target_pool);
2483 $new_ids[$q_id] = $new_id;
2487 $result->ids = $new_ids;
2488 $result->qpoolid = $qpl_id;
2496 $source_question_gui->
getObject()->getTitle()
2499 return $source_question_gui->
getObject()->createNewOriginalFromThisDuplicate($target_pool->
getId(), $new_title);
2504 array $question_ids = []
2510 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
"questionpool_not_selected"));
2515 $qpl_id = $this->obj_data_cache->lookupObjId(
$ref_id);
2518 if ($question_ids === []) {
2519 $question_ids = $this->testrequest->getQuestionIds();
2520 $question_id = $this->testrequest->getQuestionId();
2521 if ($question_ids === [] && $question_id !== 0) {
2522 $question_ids = [$question_id];
2526 if ($question_ids === []) {
2527 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
"tst_no_question_selected_for_moving_to_qpl"));
2528 $this->
ctrl->redirect($this,
'questions');
2533 foreach ($result->ids as $oldId => $newId) {
2536 $original_question_id = $questionInstance->getOriginalId();
2537 if ($original_question_id !==
null 2538 && $this->test_questions_repository->originalQuestionExists($original_question_id)) {
2540 $oldOriginal->delete($oldOriginal->getId());
2545 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
'tst_qst_added_to_pool_' . (count($result->ids) > 1 ?
'p' :
's')),
true);
2546 $this->
ctrl->redirect($this, self::SHOW_QUESTIONS_CMD);
2556 if (!$this->
access->checkAccess(
'write',
'', $this->object->getRefId())
2561 if ($this->testrequest->raw(
'title')) {
2562 $title = $this->testrequest->raw(
'title');
2564 $title = $this->testrequest->raw(
'txt_qpl');
2568 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
'questionpool_not_entered'));
2573 $question_pool = $this->
createQuestionPool($title, $this->testrequest->raw(
'description'));
2574 $_REQUEST[
'sel_qpl'] = $question_pool->getRefId();
2587 $this->tabs_manager->getQuestionsSubTabs();
2588 $this->tabs_manager->activateSubTab(TabsManager::SUBTAB_ID_QST_LIST_VIEW);
2590 $questionpools = $this->
getTestObject()->getAvailableQuestionpools(
2599 if ($questionpools === []) {
2605 case 'copyQuestionsToPool':
2608 case 'copyAndLinkQuestionsToPool':
2610 $hidden->setValue(
'1');
2611 $form->addItem($hidden);
2616 $this->tpl->setContent($form->getHTML());
2622 $form->setFormAction($this->
ctrl->getFormAction($this));
2623 $form->addCommandButton($cmd, $this->
lng->txt(
'submit'));
2624 $form->addCommandButton(
'cancelCreateQuestion', $this->
lng->txt(
'cancel'));
2626 if (count($questionpools) == 0) {
2627 $form->setTitle($this->
lng->txt(
"tst_enter_questionpool"));
2630 $title->setRequired(
true);
2631 $form->addItem($title);
2634 $form->addItem($description);
2636 $form->
setTitle($this->
lng->txt(
"tst_select_questionpool"));
2639 '' => $this->
lng->txt(
'please_select')
2642 foreach ($questionpools as $key => $value) {
2643 $selectOptions[$key] = $value[
"title"];
2648 $select->setOptions($selectOptions);
2650 $form->addItem($select);
2656 } elseif ($this->testrequest->isset(
'q_id') && is_array($this->testrequest->raw(
'q_id'))) {
2657 $question_ids = $this->testrequest->raw(
'q_id');
2660 foreach ($question_ids as
$id) {
2662 $hidden->setValue((
string) $id);
2663 $form->addItem($hidden);
2671 if (!$this->
access->checkAccess(
'write',
'', $this->ref_id)) {
2672 $this->tpl->setOnScreenMessage(
'info', $this->
lng->txt(
'cannot_edit_test'),
true);
2673 $this->
ctrl->redirectByClass([ilRepositoryGUI::class, self::class, ilInfoScreenGUI::class]);
2683 $path = $this->tree->getPathFull($this->ref_id);
2685 while ($parent = array_pop(
$path)) {
2686 if ($parent[
'type'] ===
'crs') {
2687 $container_ref_id = $parent[
'ref_id'];
2694 $this->objective_oriented_container->setObjId($container_obj_id);
2695 $this->objective_oriented_container->setRefId($container_ref_id);
2714 $this->content_style,
2716 $this->tabs_manager,
2726 if ($this->table_query ===
null) {
2727 $id = $this->
object ? $this->
object->getId() :
'';
2731 $this->data_factory,
2740 if ($this->table_actions ===
null) {
2749 $this->test_questions_repository,
2750 new QuestionPrinter(
2753 $this->tabs_manager,
2763 $this->
getTestObject()->getGlobalSettings()->isAdjustingQuestionsWithResultsAllowed(),
2766 $this->test_question_set_config_factory
2777 $this->
http->request(),
buildImportQuestionsSelectionForm(string $form_cmd, string $importdir, string $qtifile, ?string $path_to_uploaded_file_in_temp_dir=null)
getQuestionsTableActions()
showNextViewAfterQuestionSave(assQuestionGUI $question_gui, string $target)
TestResultRepository $test_pass_result_repository
const ADDITIONAL_CONTENT_EDITING_MODE_IPE
copyQuestionsToPoolObject()
static get(string $a_var)
static _goto($target)
Redirect script to call a test with the test reference id.
setCopyToExistingPoolOnSave(?int $pool_ref_id)
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...
TaxonomyService $taxonomy
copyToQuestionpoolObject()
ilTestQuestionSetConfigFactory $test_question_set_config_factory
TestAdministrationInteractionTypes
QuestionsTableQuery $table_query
TestTopListRepository $toplist_repository
ilTestSessionFactory $test_session_factory
getTabs()
adds tabs to tab gui object
confirmedApplyDefaultsObject()
Export User Interface Class.
trackTestObjectReadEvent()
txt(string $a_topic, string $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
fullscreenObject()
show fullscreen view
GeneralQuestionPropertiesRepository $questionrepository
const QUESTION_CREATION_POOL_SELECTION_NO_POOL
GUI class for the workflow of copying objects.
const QUESTION_SET_TYPE_RANDOM
addPostCreationTasksToQuestionGUI(assQuestionGUI $question_gui)
Class ilTestPersonalDefaultSettingsTableGUI.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
prepareOutput(bool $show_sub_objects=true)
cancelCreateQuestionObject()
ilComponentFactory $component_factory
afterSave(ilObject $new_object)
save object public
static stripSlashes(string $a_str, bool $a_strip_html=true, string $a_allow="")
static getQuestionTypeByTypeId($type_id)
buildInputPosition(array $questions)
importVerifiedFileObject(bool $skip_retrieve_selected_questions=false)
imports question(s) into the questionpool (after verification)
determineObjectiveOrientedContainer()
createQuestionpoolTargetObject(string $cmd)
Called when a new question should be created from a test Important: $cmd may be overwritten if no que...
TestQuestionsRepository $test_questions_repository
trait TestQuestionsImportTrait
Class ilUnitConfigurationRepository.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
executeAfterQuestionSaveTasks(assQuestionGUI $question_gui)
downloadFileObject()
download file
const CMD_BROWSE_QUESTIONS
static deliverData(string $a_data, string $a_filename, string $mime="application/octet-stream")
TitleColumnsBuilder $title_builder
redirectAfterMissingRead()
ParticipantRepository $participant_repository
static _getQuestionGUI(string $question_type='', int $question_id=-1)
Creates a question gui representation and returns the alias to the question gui.
redirectAfterMissingWrite()
addDefaultsObject()
Adds the defaults of this test to the defaults.
Base Exception for all Exceptions relating to Modules/Test.
buildResultsFilePath(string $importdir, string $subdir)
importObject(?object $a_new_obj, string $a_tmp_file, string $a_filename, string $a_type, string $a_comp="", bool $a_copy_file=false)
participantsActionObject()
Evaluates the actions on the participants page.
ilObjectDataCache $obj_data_cache
static _lookupObjId(int $ref_id)
editQuestion(bool $checkonly=false, ?bool $is_save_cmd=null)
setCreationMode(bool $mode=true)
If true, a creation screen is displayed the current [ref_id] does belong to the parent class The mode...
ResultsDataFactory $results_data_factory
getTestScreenGUIInstance()
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
deleteUploadedImportFile(string $path_to_uploaded_file_in_temp_dir)
isCommandClassAnyInfoScreenChild()
defaultsObject()
Displays the settings page for test defaults.
ContentStyle $content_style
executeAfterQuestionCreationTasks(assQuestionGUI $question_gui)
protectByWritePermission()
bool $create_question_mode
removeImportFailsObject()
questionsTabGatewayObject()
static instantiateQuestion(int $question_id)
Importer class for files.
ilTestParticipantAccessFilterFactory $participant_access_filter_factory
TestQuestionAdministrationInteractionTypes
static http()
Fetches the global http state from ILIAS.
ilGlobalTemplateInterface $tpl
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static _lookupTitle(int $obj_id)
ilNavigationHistory $navigation_history
GUI class for LTI provider object settings.
const INFO_SCREEN_CHILD_CLASSES
copyQuestionsToPool(array $question_ids, int $qpl_id)
getTargetQuestionpoolForm($questionpools, string $cmd)
ilTestObjectiveOrientedContainer $objective_oriented_container
applyDefaultsObject($confirmed=false)
Applies the selected test defaults.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
download_paragraphObject()
download source code paragraph
DataFactory $data_factory
ilTestPageGUI: ilPageEditorGUI, ilEditClipboardGUI, ilMDEditorGUI ilTestPageGUI: ilPublicUserProfile...
fetchAuthoringQuestionIdParameter()
Class ilObjectGUI Basic methods of all Output classes.
static delDir(string $a_dir, bool $a_clean_only=false)
removes a dir and all its content (subdirs and files) recursively
ilTestPlayerFactory $test_player_factory
static _recordReadEvent(string $a_type, int $a_ref_id, int $obj_id, int $usr_id, bool $isCatchupWriteEvents=true, $a_ext_rc=null, $a_ext_time=null)
createQuestionPool($name="dummy", $description="")
ilTestAccess $test_access
showEditTestPageGUI(string $cmd)
Output class for assessment test evaluation.
ResponseHandler $response_handler
populateQuestionBrowserToolbarButtons(ilToolbarGUI $toolbar)
forwardCommandToQuestionPreview(string $cmd, ?assQuestionGUI $question_gui=null)
QPLRequestDataCollector $qplrequest
addQuestionTitleToObjectTitle(string $question_title)
RequestDataCollector $testrequest
getCopyToExistingPoolOnSave()
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Last visited history for repository items.
const EDIT_CONTEXT_AUTHORING
importFile(string $file_to_import, string $path_to_uploaded_file_in_temp_dir)
static saveOriginalId(int $questionId, int $originalId)
createQuestionFormObject(?Form $form=null)
copyQuestionToPool(assQuestionGUI $source_question_gui, ilObjQuestionPool $target_pool)
checkPermissionBool(string $perm, string $cmd="", string $type="", ?int $ref_id=null)
static isObjectiveTest(int $a_trst_ref_id)
Check if test ref_id is used in an objective course.
static redirect(string $a_script)
Class that handles PDF generation for test and assessment.
executeCommand()
execute command
exportObject()
Gateway for exports initiated from workspace, as there is a generic forward to {objTypeMainGUI}::expo...
const QUESTION_CREATION_POOL_SELECTION_EXISTING_POOL
setFileDownloadLink(string $a_download_link)
QuestionsTableActions $table_actions
retrieveAdditionalDidacticTemplateOptions()
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
createQuestionPoolAndCopyObject()
SkillService $skills_service
buildQuestionCreationForm()
setMoveAfterQuestionId(?int $question_id)
appendCounterToQuestionTitleIfNecessary(string $title)
certificateObject()
Shows the certificate editor.
retrieveSelectedQuestionsFromImportQuestionsSelectionForm(string $form_cmd, string $importdir, string $qtifile, ServerRequestInterface $request)
sendParagraph(string $par_id, string $filename)
__construct(Container $dic, ilPlugin $plugin)
getReturnLocation(string $cmd, string $default_location="")
Get return location for command (command is method name without "Object", e.g.
initCreateForm(string $new_type)
const LP_CONTEXT_REPOSITORY
This class represents a text area property in a property form.
const ADDITIONAL_CONTENT_EDITING_MODE_RTE
setTestAccess(ilTestAccess $test_access)
setCopyToNewPoolOnSave(?string $pool_title)
ResultsPresentationFactory $results_presentation_factory
static formatDate(ilDateTime $date, bool $a_skip_day=false, bool $a_include_wd=false, bool $include_seconds=false, ?ilObjUser $user=null,)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
const QUESTION_SET_TYPE_FIXED
Class ilTestParticipantsGUI.
getObjectiveOrientedContainer()
Class ilLocalUnitConfigurationGUI.
ExportRepository $export_repository
ExportImportFactory $export_factory
setupToolBarAndMessage(bool $has_started_test_runs)
array buildImportDirectoriesFromImportFile(string $file_to_import)
getSelectedPersonalDefaultsSettingsFromForm()
Service GUI class for tests.
redirectTo_SettingsMainGUI_showForm_Object()
const QUESTION_CREATION_POOL_SELECTION_NEW_POOL
GlobalScreen $global_screen
deleteDefaultsObject()
Deletes selected test defaults.
TabsManager $tabs_manager
parseDidacticTemplateVar(string $var, string $type)
ILIAS: ilPropertyFormGUI ILIAS: ilConfirmationGUI ILIAS: ilTestSettingsChangeConfirmationGUI ...
copyAndLinkQuestionsToPoolObject(?int $ref_id=null, array $question_ids=[])
addHeaderAction()
Add header action menu.
static clear(string $a_var)
forwardCommandToQuestion(string $cmd)
Class ilObjUserTrackingGUI.
insertQuestionsObject(?array $selected_array=null)
buildInputPoolSelection()
static set(string $a_var, $a_val)
Set a value.
getRowIds(\ilObjTest $obj_test)
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 getInstanceFromAjaxCall()
(Re-)Build instance from ajax call
addAdditionalCmd(string $label, string $cmd)
static _gotoRepositoryRoot(bool $raise_error=false)
Goto repository root.
ilComponentRepository $component_repository