19 declare(strict_types=1);
117 'ilpublicuserprofilegui',
'ilobjportfoliogui' 175 $this->navigation_history = $DIC[
'ilNavigationHistory'];
176 $this->component_repository = $DIC[
'component.repository'];
177 $this->component_factory = $DIC[
'component.factory'];
178 $this->ui_factory = $DIC[
'ui.factory'];
179 $this->ui_renderer = $DIC[
'ui.renderer'];
180 $this->ui_service = $DIC->uiService();
181 $this->
http = $DIC[
'http'];
182 $this->error = $DIC[
'ilErr'];
183 $this->db = $DIC[
'ilDB'];
184 $this->
help = $DIC[
'ilHelp'];
185 $this->global_screen = $DIC[
'global_screen'];
186 $this->obj_data_cache = $DIC[
'ilObjDataCache'];
187 $this->irss = $DIC[
'resource_storage'];
188 $this->skills_service = $DIC->skills();
189 $this->archives = $DIC->archives();
192 $this->ui_service = $DIC->uiService();
193 $this->taxonomy = $DIC->taxonomy()->domain();
194 $this->ui_service = $DIC->uiService();
195 $this->content_style = $DIC->contentStyle();
197 $local_dic = TestDIC::dic();
198 $this->questionrepository = $local_dic[
'question.general_properties.repository'];
199 $this->test_questions_repository = $local_dic[
'questions.properties.repository'];
200 $this->qplrequest = $local_dic[
'question.request_data_wrapper'];
201 $this->title_builder = $local_dic[
'title_columns_builder'];
202 $this->testrequest = $local_dic[
'request_data_collector'];
203 $this->response_handler = $local_dic[
'response_handler'];
204 $this->participant_repository = $local_dic[
'participant.repository'];
205 $this->results_data_factory = $local_dic[
'results.data.factory'];
206 $this->results_presentation_factory = $local_dic[
'results.presentation.factory'];
207 $this->export_factory = $local_dic[
'exportimport.factory'];
208 $this->export_repository = $local_dic[
'exportimport.repository'];
209 $this->participant_access_filter_factory = $local_dic[
'participant.access_filter.factory'];
210 $this->test_pass_result_repository = $local_dic[
'results.data.test_result_repository'];
211 $this->toplist_repository = $local_dic[
'results.toplist.repository'];
214 if ($this->testrequest->hasRefId() && is_numeric($this->testrequest->getRefId())) {
215 $ref_id = $this->testrequest->getRefId();
219 $this->
ctrl->saveParameter($this, [
'ref_id',
'test_ref_id']);
221 $this->
lng->loadLanguageModule(
'assessment');
225 if (!($this->
object instanceof
ilObjTest)) {
235 $this->component_repository,
237 $this->questionrepository
251 $this->objective_oriented_container,
252 $this->test_session_factory->getSession()
261 $cmd = $this->
ctrl->getCmd(
'testScreen');
263 $cmds_disabled_due_to_offline_status = [
264 'resumePlayer',
'resumePlayer',
'outUserResultsOverview',
'outUserListOfAnswerPasses' 267 if (!$this->
getCreationMode() && $this->
object->getOfflineStatus() && in_array($cmd, $cmds_disabled_due_to_offline_status)) {
271 $next_class = $this->
ctrl->getNextClass($this);
275 $this->
access->checkAccess(
'read',
'', $this->testrequest->getRefId())
277 $this->navigation_history->addItem(
278 $this->testrequest->getRefId(),
279 ilLink::_getLink($this->testrequest->getRefId(),
'tst'),
286 switch ($next_class) {
287 case 'illtiproviderobjectsettinggui':
288 if ((!$this->
access->checkAccess(
"read",
"", $this->testrequest->getRefId()))) {
293 $this->tabs_manager->getSettingsSubTabs();
294 $this->tabs_manager->activateTab(
'settings');
295 $this->tabs_manager->activateSubTab(
'lti_provider');
297 $lti_gui->setCustomRolesForSelection($this->rbac_review->getLocalRoles($this->getTestObject()->getRefId()));
298 $lti_gui->offerLTIRolesForSelection(
false);
299 $this->
ctrl->forwardCommand($lti_gui);
302 case 'iltestexportgui':
303 if (!$this->
access->checkAccess(
'write',
'', $this->ref_id)) {
309 $this->tabs_manager->activateTab(TabsManager::TAB_ID_EXPORT);
311 $selected_files = [];
312 if ($this->testrequest->isset(
'file') && $this->testrequest->raw(
'file')) {
313 $selected_files = $this->testrequest->raw(
'file');
316 if (is_string($selected_files)) {
317 $selected_files = [$selected_files];
323 $this->obj_data_cache,
329 $this->export_repository,
330 $this->temp_file_system,
331 $this->participant_access_filter_factory,
334 $this->questionrepository,
337 $this->
ctrl->forwardCommand($export_gui);
340 case strtolower(ilInfoScreenGUI::class):
342 !$this->
access->checkAccess(
'read',
'', $this->testrequest->getRefId())
343 && !$this->
access->checkAccess(
'visible',
'', $this->testrequest->getRefId())
353 case strtolower(TestScreenGUI::class):
354 if (!$this->
access->checkAccess(
'read',
'', $this->testrequest->getRefId()) && !$this->
access->checkAccess(
'visible',
'', $this->testrequest->getRefId())) {
362 case 'ilobjectmetadatagui':
363 if (!$this->
access->checkAccess(
'write',
'', $this->getTestObject()->getRefId())) {
369 $this->tabs_manager->activateTab(TabsManager::TAB_ID_META_DATA);
371 $this->
ctrl->forwardCommand($md_gui);
374 case strtolower(ilTestParticipantsGUI::class):
375 if ((!$this->
access->checkAccess(
"read",
"", $this->testrequest->getRefId()))) {
383 $this->test_question_set_config_factory->getQuestionSetConfig(),
407 $this->ctrl->forwardCommand($gui);
416 $this->tabs_manager->activateTab(TabsManager::TAB_ID_PARTICIPANTS);
420 case 'iltestresultsgui':
421 if ((!$this->
access->checkAccess(
"read",
"", $this->testrequest->getRefId()))) {
436 $this->component_repository,
442 $this->skills_service,
443 $this->questionrepository,
444 $this->toplist_repository,
448 $this->test_session_factory->getSession(),
452 $this->ctrl->forwardCommand($gui);
455 case "iltestplayerfixedquestionsetgui":
457 $cmd !==
'autosave' &&
458 (!$this->
access->checkAccess(
"read",
"", $this->testrequest->getRefId()))
468 $this->ctrl->forwardCommand($gui);
471 case "iltestplayerrandomquestionsetgui":
473 $cmd !==
'autosave' &&
474 (!$this->
access->checkAccess(
"read",
"", $this->testrequest->getRefId()))
484 $this->ctrl->forwardCommand($gui);
487 case "iltestevaluationgui":
488 if ((!$this->
access->checkAccess(
"read",
"", $this->testrequest->getRefId()))) {
494 case "iltestservicegui":
495 if ((!$this->
access->checkAccess(
"read",
"", $this->testrequest->getRefId()))) {
501 $this->ctrl->forwardCommand($serviceGUI);
504 case 'ilpermissiongui':
505 if ((!$this->
access->checkAccess(
"read",
"", $this->testrequest->getRefId()))) {
510 $this->tabs_manager->activateTab(TabsManager::TAB_ID_PERMISSIONS);
512 $ret = $this->ctrl->forwardCommand($perm_gui);
515 case "illearningprogressgui":
516 if ((!$this->
access->checkAccess(
"read",
"", $this->testrequest->getRefId()))) {
522 $this->tabs_manager->activateTab(TabsManager::TAB_ID_LEARNING_PROGRESS);
524 $test_session = $this->test_session_factory->getSessionByUserId($this->
user->getId());
525 if (!$this->test_access->checkOtherParticipantsLearningProgressAccess()
526 && !$this->
getTestObject()->canShowTestResults($test_session)) {
527 $this->tpl->setOnScreenMessage(
529 $this->lng->txt(
'tst_res_tab_msg_no_lp_access'),
535 $this->ctrl->forwardCommand($new_gui);
539 case "ilcertificategui":
540 if ((!$this->
access->checkAccess(
"read",
"", $this->testrequest->getRefId()))) {
546 $this->tabs_manager->activateTab(TabsManager::TAB_ID_SETTINGS);
551 $this->ctrl->forwardCommand($output_gui);
554 case strtolower(TestScoringByQuestionGUI::class):
555 if ((!$this->
access->checkAccess(
"read",
"", $this->testrequest->getRefId()))) {
562 $this->ctrl->forwardCommand($output_gui);
565 case strtolower(TestScoringByParticipantGUI::class):
566 if ((!$this->
access->checkAccess(
"read",
"", $this->testrequest->getRefId()))) {
573 $this->ctrl->forwardCommand($output_gui);
576 case strtolower(MarkSchemaGUI::class):
577 if ((!$this->
access->checkAccess(
"read",
"", $this->testrequest->getRefId()))) {
591 $this->request_wrapper,
592 $this->response_handler,
598 $this->ctrl->forwardCommand($mark_schema_gui);
602 $this->tabs_manager->activateTab(TabsManager::TAB_ID_SETTINGS);
603 $this->tabs_manager->activateSubTab(TabsManager::SETTINGS_SUBTAB_ID_MARK_SCHEMA);
607 case strtolower(SettingsMainGUI::class):
608 if ((!$this->
access->checkAccess(
"read",
"", $this->testrequest->getRefId()))) {
620 $this->obj_data_cache,
626 $this->component_repository,
630 $this->questionrepository
632 $this->ctrl->forwardCommand($gui);
634 $this->tabs_manager->activateTab(TabsManager::TAB_ID_SETTINGS);
635 $this->tabs_manager->activateSubTab(TabsManager::SUBTAB_ID_GENERAL_SETTINGS);
639 case strtolower(SettingsScoringGUI::class):
640 if ((!$this->
access->checkAccess(
"read",
"", $this->testrequest->getRefId()))) {
651 $this->component_repository,
665 $this->ctrl->forwardCommand($gui);
668 case 'iltestrandomquestionsetconfiggui':
669 if ((!$this->
access->checkAccess(
"read",
"", $this->testrequest->getRefId()))) {
692 $this->component_repository,
693 $this->obj_definition,
694 $this->obj_data_cache,
695 $test_process_locker_factory,
697 $this->title_builder,
698 $this->questionrepository
700 $this->ctrl->forwardCommand($gui);
703 case 'iltestquestionbrowsertablegui':
704 if ((!$this->
access->checkAccess(
"read",
"", $this->testrequest->getRefId()))) {
714 $this->component_repository,
723 $this->questionrepository,
731 $this->ctrl->forwardCommand($gui);
734 case 'iltestskilladministrationgui':
735 if ((!$this->
access->checkAccess(
"read",
"", $this->testrequest->getRefId()))) {
750 $this->component_repository,
752 $this->questionrepository,
756 $this->ctrl->forwardCommand($gui);
759 case 'ilobjectcopygui':
760 if ((!$this->
access->checkAccess(
"read",
"", $this->testrequest->getRefId()))) {
767 $this->ctrl->forwardCommand($cp);
770 case strtolower(ilAssQuestionPreviewGUI::class):
771 if (!$this->
access->checkAccess(
'write',
'', $this->getTestObject()->getRefId())) {
777 case 'ilassquestionpagegui':
778 if ($cmd ===
'finishEditing') {
783 if ((!$this->
access->checkAccess(
"read",
"", $this->testrequest->getRefId()))) {
786 if ($cmd ===
'edit' && !$this->
access->checkAccess(
'write',
'', $this->testrequest->getRefId())) {
795 $this->questionrepository,
798 $forwarder->forward();
801 case 'ilassspecfeedbackpagegui':
802 if ((!$this->
access->checkAccess(
"read",
"", $this->testrequest->getRefId()))) {
806 $this->ctrl->forwardCommand($pg_gui);
809 case 'ilassgenfeedbackpagegui':
810 if ((!$this->
access->checkAccess(
"read",
"", $this->testrequest->getRefId()))) {
814 $this->ctrl->forwardCommand($pg_gui);
817 case 'illocalunitconfigurationgui':
818 if ((!$this->
access->checkAccess(
"read",
"", $this->testrequest->getRefId()))) {
825 $question = $question_gui->getObject();
827 $question_gui->setObject($question);
828 $question_gui->setQuestionTabs();
832 $this->ctrl->forwardCommand($gui);
835 case "ilcommonactiondispatchergui":
836 if (!$this->
access->checkAccess(
"read",
"", $this->testrequest->getRefId()) && !$this->
access->checkAccess(
"visible",
"", $this->testrequest->getRefId())) {
841 $this->ctrl->forwardCommand($gui);
844 case 'ilassquestionhintsgui':
845 if (!$this->
access->checkAccess(
'write',
'', $this->getTestObject()->getRefId())) {
850 $this->tpl->setOnScreenMessage(
'failure', $this->lng->txt(
'question_is_part_of_running_test'),
true);
858 $question = $question_gui->getObject();
860 $question_gui->setObject($question);
861 $question_gui->setQuestionTabs();
867 $gui->setEditingEnabled(
868 $this->
access->checkAccess(
'write',
'', $this->getTestObject()->getRefId())
871 $this->ctrl->forwardCommand($gui);
874 case 'ilassquestionfeedbackeditinggui':
875 if (!$this->
access->checkAccess(
'write',
'', $this->getTestObject()->getRefId())) {
881 $this->ctrl->setReturnByClass(self::class, self::SHOW_QUESTIONS_CMD);
883 $question = $question_gui->getObject();
885 $question_gui->setObject($question);
886 $question_gui->setQuestionTabs();
891 $this->tpl->setOnScreenMessage(
'failure', $this->lng->txt(
'question_is_part_of_running_test'),
true);
906 $this->ctrl->forwardCommand($gui);
909 case 'iltestcorrectionsgui':
910 if ((!$this->
access->checkAccess(
'read',
'', $this->testrequest->getRefId()))) {
928 $this->ctrl->forwardCommand($gui);
931 case 'iltestpagegui':
932 if ((!$this->
access->checkAccess(
"write",
"", $this->testrequest->getRefId()))) {
936 if ($cmd ===
'downloadFile') {
937 $page_id = $this->
object->getIntroductionPageId();
938 if ($this->testrequest->strVal(
'page_type') ===
'concludingremarkspage') {
939 $page_id = $this->
object->getConcludingRemarksPageId();
941 $this->ctrl->forwardCommand(
new ilTestPageGUI(
'tst', $page_id));
948 if (!$this->
access->checkAccess(
'read',
'', $this->testrequest->getRefId())
949 && !$this->
access->checkAccess(
'visible',
'', $this->testrequest->getRefId())) {
955 if ($cmd ===
'testScreen') {
960 $local_cmd = $cmd .
'Object';
961 if (!method_exists($this, $local_cmd)) {
962 $local_cmd = self::SHOW_QUESTIONS_CMD .
'Object';
968 if ((!$this->
access->checkAccess(
'read',
'', $this->testrequest->getRefId()))) {
973 [
'editQuestion',
'previewQuestion',
'save',
'saveReturn',
'uploadImage',
974 'removeImage',
'syncQuestion',
'syncQuestionReturn',
'suggestedsolution']
976 && !$this->
access->checkAccess(
'write',
'', $this->getTestObject()->getRefId())) {
979 if (in_array($cmd, [
'editQuestion',
'save',
'saveReturn',
'suggestedsolution'])
981 $this->tpl->setOnScreenMessage(
'failure', $this->lng->txt(
'question_is_part_of_running_test'),
true);
989 if (!in_array(strtolower($this->testrequest->raw(
'baseClass')), [
'iladministrationgui',
'ilrepositorygui'])
991 $this->tpl->printToStdout();
997 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
'no_permission'),
true);
998 $target_class = get_class($this->
object) .
'GUI';
999 $this->
ctrl->setParameterByClass($target_class,
'ref_id', $this->ref_id);
1000 $this->
ctrl->redirectByClass($target_class);
1005 $this->tpl->setOnScreenMessage(
'failure', sprintf(
1006 $this->
lng->txt(
"msg_no_perm_read_item"),
1007 $this->
object->getTitle()
1010 $this->
ctrl->redirectByClass(
'ilrepositorygui');
1017 $nr_of_participants_with_results = $this->
getTestObject()->evalTotalPersons();
1019 $this->
ctrl->saveParameterByClass(self::class,
'q_id');
1036 if ($nr_of_participants_with_results > 0) {
1038 $this->
lng->txt(
'tst_corrections_qst_form'),
1039 $this->
ctrl->getLinkTargetByClass(ilTestCorrectionsGUI::class,
'showQuestion')
1047 if (!$this->
getTestObject()->isRandomTest() && $nr_of_participants_with_results === 0) {
1048 $gui->setPrimaryCmd(
1049 $this->
lng->txt(
'edit_question'),
1050 $this->
ctrl->getLinkTargetByClass(
1051 get_class($question_gui),
1055 $gui->addAdditionalCmd(
1056 $this->
lng->txt(
'edit_page'),
1057 $this->
ctrl->getLinkTargetByClass(
1058 ilAssQuestionPageGUI::class,
1066 $gui->initPreviewSession($this->
user->getId(), $this->testrequest->getQuestionId());
1067 $gui->initHintTracking();
1068 $gui->initStyleSheets();
1070 $this->
ctrl->clearParameterByClass(self::class,
'q_id');
1071 $this->tabs_gui->setBackTarget(
1072 $this->
lng->txt(
'backtocallingtest'),
1073 $this->
ctrl->getLinkTargetByClass(self::class, self::SHOW_QUESTIONS_CMD)
1075 $this->
ctrl->saveParameterByClass(self::class,
'q_id');
1076 $gui->{$cmd .
'Cmd'}();
1081 $this->tpl->setTitle(
1082 $this->
refinery->encode()->htmlSpecialCharsAsEntities()->transform(
1083 "{$this->getTestObject()->getTitle()}: {$question_title}" 1090 $this->create_question_mode =
true;
1096 $this->
ctrl->setReturnByClass(self::class, self::SHOW_QUESTIONS_CMD);
1104 $question = $question_gui->getObject();
1106 $question_gui->setObject($question);
1107 $question_gui->setContextAllowsSyncToPool(
true);
1108 $question_gui->setQuestionTabs();
1112 $target = strpos($cmd,
'Return') ===
false ?
'stay' :
'return';
1114 if (in_array($cmd, [
'syncQuestion',
'syncQuestionReturn'])) {
1115 $question_gui->syncQuestion();
1120 if ($question_gui->isSaveCommand()
1121 || $question_gui->cmdNeedsExistingQuestion($cmd)) {
1125 if ($qid === 0 && $question_gui->cmdNeedsExistingQuestion($cmd)) {
1126 $question_gui->getObject()->createNewQuestion();
1127 $question_gui->setQuestionTabs();
1131 if (!$question_gui->isSaveCommand()) {
1132 $this->
ctrl->forwardCommand($question_gui);
1136 if (!$question_gui->saveQuestion()) {
1140 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
'msg_obj_modified'),
true);
1154 if ($this->testrequest->isset(
'move_after_question_with_id')) {
1156 $this->testrequest->int(
'move_after_question_with_id')
1160 if ($this->testrequest->isset(
'pool_title')) {
1162 $this->testrequest->strVal(
'pool_title')
1166 if ($this->testrequest->isset(
'pool_ref')) {
1168 $this->testrequest->int(
'pool_ref')
1171 return $question_gui;
1176 if ($this->
getTestObject()->getTestLogger()->isLoggingEnabled()) {
1177 $this->
getTestObject()->getTestLogger()->logQuestionAdministrationInteraction(
1178 $question_gui->
getObject()->toQuestionAdministrationInteraction(
1179 $this->
getTestObject()->getTestLogger()->getAdditionalInformationGenerator(),
1181 TestQuestionAdministrationInteractionTypes::QUESTION_MODIFIED
1227 if ($target ===
'return') {
1234 if ($target ===
'stay') {
1235 $this->
ctrl->setParameterByClass(ilAssQuestionPreviewGUI::class,
'q_id', $question_gui->
getObject()->getId());
1236 $this->tabs_gui->setBackTarget(
1237 $this->
lng->txt(
'backtocallingpage'),
1238 $this->
ctrl->getLinkTargetByClass(
1239 ilAssQuestionPreviewGUI::class,
1253 $this->
user->getId()
1263 $this->
ctrl->redirectByClass(
'ilTestExportGUI');
1272 $qid = $this->testrequest->int(
'q_id');
1274 if ($qid === 0 || $this->
getTestObject()->checkQuestionParent($qid)) {
1278 throw new ilTestException(
'question id does not relate to parent object!');
1284 $this->
ctrl->redirectByClass(
'ilTestRandomQuestionSetConfigGUI');
1287 $this->
ctrl->redirectByClass(
'ilObjTestGUI', self::SHOW_QUESTIONS_CMD);
1293 $this->tabs_manager->getSettingsSubTabs();
1295 if ($this->request_wrapper->has(
'page_type')
1296 && $this->request_wrapper->retrieve(
1298 $this->
refinery->kindlyTo()->string()
1299 ) ===
'introductionpage' 1301 $page_type =
'IntroductionPage';
1302 $this->tabs_manager->activateSubTab(TabsManager::SETTINGS_SUBTAB_ID_EDIT_INTRODUCTION_PAGE);
1305 $page_type =
'ConcludingRemarksPage';
1306 $this->tabs_manager->activateSubTab(TabsManager::SETTINGS_SUBTAB_ID_EDIT_CONCLUSION_PAGE);
1307 $page_id = $this->
getTestObject()->getConcludingRemarksPageId();
1309 $this->
ctrl->saveParameterByClass(ilTestPageGUI::class,
'page_type');
1312 $this->content_style->gui()->addCss($this->tpl, $this->ref_id);
1313 $this->tpl->setContent($this->
ctrl->forwardCommand($gui));
1315 $this->tabs_manager->activateTab(TabsManager::TAB_ID_SETTINGS);
1336 $this->
ctrl->forwardCommand($gui);
1341 $this->
ctrl->redirectByClass(SettingsMainGUI::class, SettingsMainGUI::CMD_SHOW_FORM);
1346 $this->tpl->loadStandardTemplate();
1353 $this->
ctrl->redirectByClass([ilRepositoryGUI::class, self::class, ilInfoScreenGUI::class]);
1356 protected function importFile(
string $file_to_import,
string $path_to_uploaded_file_in_temp_dir): void
1363 $unzip = $this->archives->unzip(Streams::ofResource(fopen($file_to_import,
'r')), $options);
1366 if (!is_file($qtifile)) {
1369 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
'tst_import_non_ilias_zip'),
true);
1372 $qtiParser->startParsing();
1373 $founditems = $qtiParser->getFoundItems();
1377 foreach ($founditems as $item) {
1378 if ($item[
"type"] !==
'') {
1385 if (count($founditems) && $complete == 0) {
1388 $this->tpl->setOnScreenMessage(
'info', $this->
lng->txt(
'qpl_import_non_ilias_files'));
1393 ilSession::set(
'path_to_uploaded_file_in_temp_dir', $path_to_uploaded_file_in_temp_dir);
1397 || $founditems === []) {
1403 'importVerifiedFile',
1407 $path_to_uploaded_file_in_temp_dir
1410 if ($form === null) {
1414 $panel = $this->ui_factory->panel()->standard(
1415 $this->
lng->txt(
'import_tst'),
1417 $this->ui_factory->legacy($this->
lng->txt(
'qpl_import_verify_found_questions')),
1421 $this->tpl->setContent($this->ui_renderer->render($panel));
1422 $this->tpl->printToStdout();
1429 $defaults = $tst->getAvailableDefaults();
1430 if ($defaults === []) {
1434 $additional_options = [];
1435 foreach ($defaults as $row) {
1436 $additional_options[
"tstdef_" . $row[
"test_defaults_id"]] = [$row[
"name"],
1437 $this->
lng->txt(
"tst_default_settings")];
1439 return $additional_options;
1449 $new_object->saveToDb();
1452 if ($test_def_id !== null
1453 && ($defaults = $new_object->getTestDefaults($test_def_id)) !== null) {
1454 $info = $new_object->applyDefaults($defaults);
1457 $new_object->saveToDb();
1459 if ($new_object->getTestLogger()->isLoggingEnabled()) {
1460 $new_object->getTestLogger()->logTestAdministrationInteraction(
1461 $new_object->getTestLogger()->getInteractionFactory()->buildTestAdministrationInteraction(
1463 $this->
user->getId(),
1464 TestAdministrationInteractionTypes::NEW_TEST_CREATED,
1471 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
'object_added'),
true);
1473 $this->tpl->setOnScreenMessage(
'info', $this->
lng->txt($info),
true);
1475 $this->
ctrl->setParameter($this,
'ref_id', $new_object->
getRefId());
1476 $this->
ctrl->redirectByClass(SettingsMainGUI::class);
1482 ->withRequest($this->request)
1484 return isset(
$data[
'didactic_templates'])
1504 bool $skip_retrieve_selected_questions =
false 1507 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
'no_permission'),
true);
1508 $this->
ctrl->returnToParent($this);
1511 $path_to_uploaded_file_in_temp_dir =
ilSession::get(
'path_to_uploaded_file_in_temp_dir');
1515 $new_obj->setTitle(
'dummy');
1516 $new_obj->setDescription(
'test import');
1517 $new_obj->create(
true);
1518 $new_obj->createReference();
1519 $new_obj->putInTree($this->testrequest->getRefId());
1520 $new_obj->setPermissions($this->testrequest->getRefId());
1521 $new_obj->saveToDb();
1523 $selected_questions = [];
1524 if (!$skip_retrieve_selected_questions) {
1526 'importVerifiedFile',
1533 ilSession::set(
'tst_import_selected_questions', $selected_questions);
1535 $imp =
new ilImport($this->testrequest->getRefId());
1537 $map->addMapping(
'components/ILIAS/Test',
'tst',
'new_id', (
string) $new_obj->getId());
1543 if (is_file($importdir . DIRECTORY_SEPARATOR .
'/manifest.xml')) {
1544 $imp->
importObject($new_obj, $file_to_import, basename($file_to_import),
'tst',
'components/ILIAS/Test',
true);
1547 $test_importer->setImport($imp);
1549 $test_importer->setImportDirectory($importdir .
'/' . $subdir);
1550 $test_importer->init();
1552 $test_importer->importXmlRepresentation(
1560 if ($new_obj->getTestLogger()->isLoggingEnabled()) {
1561 $new_obj->getTestLogger()->logTestAdministrationInteraction(
1562 $new_obj->getTestLogger()->getInteractionFactory()->buildTestAdministrationInteraction(
1563 $new_obj->getRefId(),
1564 $this->
user->getId(),
1565 TestAdministrationInteractionTypes::NEW_TEST_CREATED,
1576 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
"object_imported"),
true);
1579 if ($question_skill_assignments_import_fails->failedImportsRegistered()) {
1580 $this->tpl->setOnScreenMessage(
1582 $question_skill_assignments_import_fails->getFailedImportsMessage($this->lng),
1587 $this->
ctrl->setParameterByClass(ilObjTestGUI::class,
'ref_id', $new_obj->getRefId());
1588 $this->
ctrl->redirectByClass(ilObjTestGUI::class);
1596 $file = explode(
"_", $this->testrequest->raw(
"file_id"));
1597 $fileObj =
new ilObjFile((
int) $file[count($file) - 1],
false);
1598 $fileObj->sendFile();
1617 $pg_obj->
sendParagraph($this->testrequest->raw(
"par_id"), $this->testrequest->raw(
"downloadtitle"));
1625 $qpl->setType(
"qpl");
1626 $qpl->setTitle($name);
1627 $qpl->setDescription($description);
1629 $qpl->createReference();
1630 $qpl->putInTree($parent_ref);
1631 $qpl->setPermissions($parent_ref);
1632 $qpl->getObjectProperties()->storePropertyIsOnline($qpl->getObjectProperties()->getPropertyIsOnline()->withOnline());
1637 public function createQuestionObject():
void 1641 $this->
ctrl->setReturnByClass(self::class, self::SHOW_QUESTIONS_CMD);
1644 $data_with_section = $form->getData();
1645 if ($data_with_section === null) {
1649 $data = $data_with_section[0];
1651 $qpl_mode =
$data[
'pool_selection'][
'qpl_type'];
1652 if ($qpl_mode === self::QUESTION_CREATION_POOL_SELECTION_NEW_POOL &&
$data[
'pool_selection'][
'title'] ===
'' 1653 || $qpl_mode === self::QUESTION_CREATION_POOL_SELECTION_EXISTING_POOL &&
$data[
'pool_selection'][
'pool_ref_id'] === 0) {
1654 $this->tpl->setOnScreenMessage(
'info', $this->
lng->txt(
"questionpool_not_entered"));
1664 $question = $question_gui->getObject();
1665 $question->setAdditionalContentEditingMode(
$data[
'editing_type']);
1667 $question_gui->setObject($question);
1668 $question_gui->setQuestionTabs();
1670 if (array_key_exists(
'position',
$data)) {
1671 $question_gui->setMoveAfterQuestionId(
$data[
'position']);
1674 if ($qpl_mode === self::QUESTION_CREATION_POOL_SELECTION_NEW_POOL) {
1675 $question_gui->setCopyToNewPoolOnSave(
$data[
'pool_selection'][
'title']);
1678 if ($qpl_mode === self::QUESTION_CREATION_POOL_SELECTION_EXISTING_POOL) {
1679 $question_gui->setCopyToExistingPoolOnSave(
$data[
'pool_selection'][
'pool_ref_id']);
1682 $question_gui->editQuestion();
1687 $this->
ctrl->redirect($this, self::SHOW_QUESTIONS_CMD);
1694 if (($selected_array ?? $this->testrequest->getQuestionIds()) === []) {
1695 $this->tpl->setOnScreenMessage(
'info', $this->
lng->txt(
'tst_insert_missing_question'),
true);
1696 $this->
ctrl->redirect($this,
'browseForQuestions');
1699 $this->
getTestObject()->saveCompleteStatus($this->test_question_set_config_factory->getQuestionSetConfig());
1700 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
'tst_questions_inserted'),
true);
1701 $this->
ctrl->redirect($this, self::SHOW_QUESTIONS_CMD);
1709 $this->tabs_manager->getQuestionsSubTabs();
1710 $this->tabs_manager->activateSubTab(TabsManager::SUBTAB_ID_QST_LIST_VIEW);
1712 $sub_screen_id = [
'createQuestion'];
1714 $this->tabs_manager->activateTab(TabsManager::TAB_ID_QUESTIONS);
1715 $this->
help->setScreenId(
'assQuestions');
1716 $this->
help->setSubScreenId(implode(
'_', $sub_screen_id));
1718 $this->tpl->setContent(
1719 $this->ui_renderer->render(
1720 $form ?? $this->buildQuestionCreationForm()
1728 $questions = $this->
getTestObject()->getQuestionTitlesAndIndexes();
1729 if ($questions !== []) {
1736 $sub_screen_id[] =
'editMode';
1739 $sub_screen_id[] =
'poolSelect';
1744 $this->ui_factory->input()->field()->section(
$inputs, $this->
lng->txt(
'ass_create_question'))
1747 $form = $this->ui_factory->input()->container()->form()->standard(
1748 $this->
ctrl->getFormAction($this,
'createQuestion'),
1750 )->withSubmitLabel($this->
lng->txt(
'create'));
1757 $question_types = (
new ilObjQuestionPool())->getQuestionTypes(
false,
true,
false);
1759 foreach ($question_types as $label =>
$data) {
1760 $options[
$data[
'question_type_id']] = $label;
1763 return $this->ui_factory->input()->field()->select(
1764 $this->
lng->txt(
'question_type'),
1766 )->withRequired(
true);
1771 $options = [0 => $this->
lng->txt(
'first')];
1772 foreach ($questions as $key => $title) {
1773 $options[$key] = $this->
lng->txt(
'behind') .
' ' . $title
1774 .
' [' . $this->
lng->txt(
'question_id_short') .
': ' . $key .
']';
1776 return $this->ui_factory->input()->field()->select(
1777 $this->
lng->txt(
'position'),
1784 if (!$this->
getTestObject()->getGlobalSettings()->isPageEditorEnabled()) {
1785 return $this->ui_factory->input()->field()->hidden()->
withValue(
1790 return $this->ui_factory->input()->field()->radio($this->
lng->txt(
'tst_add_quest_cont_edit_mode'))
1793 $this->
lng->txt(
'tst_add_quest_cont_edit_mode_IPE'),
1794 $this->
lng->txt(
'tst_add_quest_cont_edit_mode_IPE_info')
1797 $this->
lng->txt(
'tst_add_quest_cont_edit_mode_RTE'),
1798 $this->
lng->txt(
'tst_add_quest_cont_edit_mode_RTE_info')
1805 $f = $this->ui_factory->input()->field();
1808 $trafo = $this->
refinery->custom()->transformation(
1809 static function ($values) use ($kt): array {
1810 $return[
'qpl_type'] = $kt->int()->transform($values[0]);
1811 if ($return[
'qpl_type'] === self::QUESTION_CREATION_POOL_SELECTION_NO_POOL) {
1814 if ($return[
'qpl_type'] === self::QUESTION_CREATION_POOL_SELECTION_NEW_POOL) {
1815 return $return + [
'title' => $kt->string()->transform($values[1][0])];
1817 return $return + [
'pool_ref_id' => $kt->int()->transform($values[1][0])];
1823 foreach ($questionpools as $key => $p) {
1824 $pools_data[$key] = $p[
'title'];
1828 self::QUESTION_CREATION_POOL_SELECTION_NO_POOL =>
$f->group([], $this->
lng->txt(
'assessment_no_pool')),
1829 self::QUESTION_CREATION_POOL_SELECTION_EXISTING_POOL =>
$f->group(
1830 [
$f->select($this->lng->txt(
'select_questionpool'), $pools_data)],
1831 $this->
lng->txt(
'assessment_existing_pool')
1833 self::QUESTION_CREATION_POOL_SELECTION_NEW_POOL =>
$f->group(
1834 [
$f->text($this->lng->txt(
'name'))],
1835 $this->
lng->txt(
'assessment_new_pool')
1839 return $f->switchableGroup(
1841 $this->
lng->txt(
'assessment_pool_selection')
1843 ->withRequired(
true)
1851 if ($this->testrequest->raw(
'add')) {
1869 $this->tpl->addBlockFile(
'ADM_CONTENT',
'adm_content',
'tpl.il_as_tst_questions.html',
'components/ILIAS/Test');
1873 $this->tabs_manager->getQuestionsSubTabs();
1874 $this->tabs_manager->activateSubTab(TabsManager::SUBTAB_ID_QST_LIST_VIEW);
1876 $this->tpl->setCurrentBlock(
'adm_content');
1877 $this->tpl->setVariable(
'ACTION_QUESTION_FORM', $this->
ctrl->getFormAction($this));
1878 $this->tpl->setVariable(
1880 $this->ui_renderer->render(
1881 $this->getTable()->getTableComponent()
1884 $this->tpl->parseCurrentBlock();
1889 $selected_array = [$this->testrequest->int(
'add')];
1893 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
'test_has_datasets_warning_page_view'));
1897 $this->tpl->setOnScreenMessage(
'info', $this->
lng->txt(
'tst_insert_questions'));
1903 if (!$this->
access->checkAccess(
'write',
'', $this->ref_id)
1908 if ($has_started_test_runs) {
1909 $link = $this->ui_factory->link()->standard(
1910 $this->
lng->txt(
'test_has_datasets_warning_page_view_link'),
1911 $this->
ctrl->getLinkTargetByClass([\ilTestParticipantsGUI::class])
1914 $message = $this->
lng->txt(
'test_has_datasets_warning_page_view');
1915 $massage_box = $this->ui_factory->messageBox()->info($message)->withLinks([$link]);
1916 $this->tpl->setCurrentBlock(
'mess');
1917 $this->tpl->setVariable(
1919 $this->ui_renderer->render($massage_box)
1921 $this->tpl->parseCurrentBlock();
1925 $this->
toolbar->addButton($this->
lng->txt(
'ass_create_question'), $this->
ctrl->getLinkTarget($this,
'createQuestionForm'));
1926 $this->
toolbar->addSeparator();
1932 $this->
ctrl->setParameterByClass(
1933 ilTestQuestionBrowserTableGUI::class,
1939 $this->
lng->txt(
'tst_browse_for_qpl_questions'),
1940 $this->
ctrl->getLinkTargetByClass(
1941 ilTestQuestionBrowserTableGUI::class,
1946 $this->
ctrl->setParameterByClass(
1947 ilTestQuestionBrowserTableGUI::class,
1953 $this->
lng->txt(
'tst_browse_for_tst_questions'),
1954 $this->
ctrl->getLinkTargetByClass(
1955 ilTestQuestionBrowserTableGUI::class,
1967 if (!$this->
getTestObject()->getTestLogger()->isLoggingEnabled()
1968 || !$this->rbac_review->isAssigned($this->user->getId(),
SYSTEM_ROLE_ID)
1969 && !$this->
access->checkAccess(
'tst_history_read',
'', $this->getTestObject()->getRefId())) {
1973 $here_uri = $this->data_factory->uri(ILIAS_HTTP_PATH
1974 .
'/' . $this->
ctrl->getLinkTargetByClass(self::class, self::SHOW_LOGS_CMD));
1975 list($url_builder, $action_parameter_token, $row_id_token) = (
new URLBuilder($here_uri))->acquireParameters(
1976 LogTable::QUERY_PARAMETER_NAME_SPACE,
1977 LogTable::ACTION_TOKEN_STRING,
1978 LogTable::ENTRY_TOKEN_STRING
1981 if ($this->request_wrapper->has($action_parameter_token->getName())) {
1982 $this->
getTestObject()->getTestLogViewer()->executeLogTableAction(
1984 $action_parameter_token,
1991 $this->ui_factory->button()->standard(
1992 $this->
lng->txt(
'export_legacy_logs'),
1993 $this->
ctrl->getLinkTargetByClass(self::class,
'exportLegacyLogs')
1996 $this->tabs_manager->activateTab(TabsManager::TAB_ID_HISTORY);
1998 list($filter, $table_gui) = $this->
getTestObject()->getTestLogViewer()->getLogTable(
2000 $action_parameter_token,
2005 $this->tpl->setVariable(
'ADM_CONTENT', $this->ui_renderer->render([$filter, $table_gui]));
2016 "legacy_logs_for_{$this->getTestObject()->getRefId()}.csv" 2025 $command = $this->testrequest->strVal(
'command');
2026 if ($command ===
'') {
2027 $method = $command .
'Object';
2028 if (method_exists($this, $method)) {
2033 $this->
ctrl->redirect($this,
'participants');
2043 $this->tabs_manager->activateTab(TabsManager::TAB_ID_SETTINGS);
2045 $this->
toolbar->setFormAction($this->
ctrl->getFormAction($this,
'addDefaults'));
2046 $this->
toolbar->addFormButton($this->
lng->txt(
'add'),
'addDefaults');
2050 $table->setData($defaults);
2051 $this->tpl->setContent($table->getHTML());
2061 $defaults_ids = $this->testrequest->retrieveArrayOfIntsFromPost(
'chb_defaults');
2062 if ($defaults_ids !== null && $defaults_ids !== []) {
2063 foreach ($defaults_ids as $test_default_id) {
2067 $this->tpl->setOnScreenMessage(
'info', $this->
lng->txt(
'select_one'));
2090 $defaults_id = $this->testrequest->retrieveArrayOfIntsFromPost(
'chb_defaults');
2091 if ($defaults_id === []) {
2092 $this->tpl->setOnScreenMessage(
'info', $this->
lng->txt(
'tst_defaults_apply_select_one'));
2099 || ($defaults = $this->
getTestObject()->getTestDefaults($defaults_id[0])) === null) {
2100 $this->tpl->setOnScreenMessage(
'info', $this->
lng->txt(
'tst_defaults_apply_not_possible'));
2105 $default_settings = unserialize(
2106 $defaults[
'defaults'],
2107 [
'allowed_classes' => [DateTimeImmutable::class]]
2110 if (isset($default_settings[
'isRandomTest'])) {
2111 if ($default_settings[
'isRandomTest']) {
2118 } elseif (isset($default_settings[
'questionSetType'])) {
2119 $new_question_set_type = $default_settings[
'questionSetType'];
2121 $old_question_set_type = $this->
getTestObject()->getQuestionSetType();
2122 $question_set_type_setting_switched = ($old_question_set_type != $new_question_set_type);
2124 $old_question_set_config = $this->test_question_set_config_factory->getQuestionSetConfig();
2127 case !$question_set_type_setting_switched:
2128 case !$old_question_set_config->doesQuestionSetRelatedDataExist():
2137 $confirmation->setFormAction($this->
ctrl->getFormAction($this));
2138 $confirmation->setCancel($this->
lng->txt(
'cancel'),
'defaults');
2139 $confirmation->setConfirm($this->
lng->txt(
'confirm'),
'confirmedApplyDefaults');
2141 $confirmation->setOldQuestionSetType($this->
getTestObject()->getQuestionSetType());
2142 $confirmation->setNewQuestionSetType($new_question_set_type);
2143 $confirmation->setQuestionLossInfoEnabled(
false);
2144 $confirmation->build();
2146 $confirmation->populateParametersFromPost();
2148 $this->tpl->setContent($this->
ctrl->getHTML($confirmation));
2153 if ($question_set_type_setting_switched && !$this->
getTestObject()->getOfflineStatus()) {
2155 $info = $this->
lng->txt(
'tst_set_offline_due_to_switched_question_set_type_setting');
2156 $this->tpl->setOnScreenMessage(
'info', $info,
true);
2161 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
'tst_defaults_applied'),
true);
2163 $this->tpl->setOnScreenMessage(
'info', $this->
lng->txt($info),
true);
2168 if ($question_set_type_setting_switched && $old_question_set_config->doesQuestionSetRelatedDataExist()) {
2169 $old_question_set_config->removeQuestionSetRelatedData();
2172 $this->
ctrl->redirect($this,
'defaults');
2182 $name = $this->testrequest->strVal(
'name');
2186 $this->tpl->setOnScreenMessage(
'info', $this->
lng->txt(
'tst_defaults_enter_name'));
2193 if (in_array($this->
ctrl->getCmdClass(), self::INFO_SCREEN_CHILD_CLASSES)) {
2202 $this->
ctrl->redirectByClass(
2203 [ilRepositoryGUI::class, self::class, ilInfoScreenGUI::class]
2209 if (!$this->
access->checkAccess(
'visible',
'', $this->ref_id)
2210 && !$this->
access->checkAccess(
'read',
'', $this->ref_id)) {
2214 if ($this->
getTestObject()->getMainSettings()->getAdditionalSettings()->getHideInfoTab()) {
2215 $this->
ctrl->redirectByClass([self::class, TestScreenGUI::class], TestScreenGUI::DEFAULT_CMD);
2218 $this->tabs_manager->activateTab(TabsManager::TAB_ID_INFOSCREEN);
2220 if ($this->
access->checkAccess(
'read',
'', $this->ref_id)) {
2226 $this->
ctrl->forwardCommand($info);
2231 $this->test_player_factory->getPlayerGUI(),
2232 $this->test_question_set_config_factory->getQuestionSetConfig(),
2233 $this->test_session_factory->getSession(),
2246 $toolbar->setSessionLockString(
'');
2250 $info->enablePrivateNotes();
2252 $info->addSection($this->lng->txt(
'tst_general_properties'));
2254 $this->lng->txt(
'author'),
2255 $this->
refinery->encode()->htmlSpecialCharsAsEntities()->transform(
2260 $this->lng->txt(
'title'),
2261 $this->
refinery->encode()->htmlSpecialCharsAsEntities()->transform(
2266 if ($this->type !==
'tst') {
2267 $info->hideFurtherSections(
false);
2270 $info->addSection($this->lng->txt(
'tst_sequence_properties'));
2272 $this->lng->txt(
'tst_sequence'),
2274 $this->
getTestObject()->getMainSettings()->getParticipantFunctionalitySettings()->getPostponedQuestionsMoveToEnd()
2275 ?
'tst_sequence_postpone' :
'tst_sequence_fixed' 2279 $info->addSection($this->lng->txt(
'tst_heading_scoring'));
2281 $this->lng->txt(
'tst_text_count_system'),
2283 ($this->
getTestObject()->getCountSystem() == SettingsScoring::COUNT_PARTIAL_SOLUTIONS) ?
'tst_count_partial_solutions' :
'tst_count_correct_solutions' 2287 $info->addProperty($this->lng->txt(
'tst_pass_scoring'), $this->lng->txt(($this->
getTestObject()->getPassScoring() ==
ilObjTest::SCORE_BEST_PASS) ?
'tst_pass_best_pass' :
'tst_pass_last_pass'));
2290 $info->addSection($this->lng->txt(
'tst_score_reporting'));
2292 $this->lng->txt(
'tst_score_reporting'),
2293 $this->
getTestObject()->getScoreSettings()->getResultSummarySettings()
2294 ->getScoreReporting()->getTranslatedValue($this->lng)
2297 ->getScoreSettings()
2298 ->getResultSummarySettings()
2299 ->getReportingDate();
2300 if ($reporting_date !== null) {
2302 $this->lng->txt(
'tst_score_reporting_date'),
2305 ->format($this->
user->getDateTimeFormat()->toString())
2309 $info->addSection($this->lng->txt(
'tst_session_settings'));
2310 $info->addProperty($this->lng->txt(
'tst_nr_of_tries'), $this->
getTestObject()->getNrOfTries() === 0 ? $this->lng->txt(
'unlimited') : (string) $this->
getTestObject()->getNrOfTries());
2313 $this->lng->txt(
'tst_nr_of_tries_of_user'),
2314 ($this->test_session_factory->getSession()->getPass() === 0) ?
2315 $this->lng->txt(
'tst_no_tries') : (string) $this->test_session_factory->getSession()->getPass()
2320 $info->addProperty($this->lng->txt(
'tst_processing_time'), $this->
getTestObject()->getProcessingTime());
2324 if ($this->
getTestObject()->isStartingTimeEnabled() && $starting_time !== 0) {
2328 if ($this->
getTestObject()->isEndingTimeEnabled() && $ending_time != 0) {
2333 $this->ctrl->forwardCommand($info);
2339 $qsaImportFails->deleteRegisteredImportFails();
2341 $sltImportFails->deleteRegisteredImportFails();
2343 $this->
ctrl->redirectByClass([ilRepositoryGUI::class, self::class, ilInfoScreenGUI::class]);
2348 switch ($this->
ctrl->getCmd()) {
2351 case "redirectToInfoScreen":
2358 case "outCorrectSolution":
2359 case "showAnswersOfUser":
2360 case "outUserResultsOverview":
2361 case "backFromSummary":
2362 case "show_answers":
2365 case "outTestSummary":
2366 case "outQuestionSummary":
2367 case "gotoQuestion":
2368 case "selectImagemapRegion":
2369 case "confirmSubmitAnswers":
2370 case "finalSubmission":
2372 case "outUserPassDetails":
2373 case "checkPassword":
2376 $this->
ctrl->getLinkTargetByClass(
2377 [self::class, TestScreenGUI::class],
2378 TestScreenGUI::DEFAULT_CMD
2381 $this->testrequest->getRefId()
2385 case "evalAllUsers":
2386 case "evalUserDetail":
2389 $this->
ctrl->getLinkTarget($this,
'eval_stat'),
2391 $this->testrequest->getRefId()
2396 case "importVerifiedFile":
2397 case "cancelImport":
2402 $this->
ctrl->getLinkTargetByClass(
2403 [self::class, TestScreenGUI::class],
2404 TestScreenGUI::DEFAULT_CMD
2407 $this->testrequest->getRefId()
2422 $this->tabs_manager->activateTab(TabsManager::TAB_ID_SETTINGS);
2427 $output_gui->certificateEditor();
2437 $this->
help->setScreenIdComponent(
"tst");
2439 if ($this->tabs_manager === null) {
2445 $this->tabs_manager->setParentBackLabel($this->
lng->txt(
'back_to_objective_container'));
2446 $this->tabs_manager->setParentBackHref($courseLink);
2449 $this->tabs_manager->perform();
2452 public static function accessViolationRedirect()
2456 $main_tpl = $DIC->ui()->mainTemplate();
2458 $main_tpl->setOnScreenMessage(
'failure', $DIC->language()->txt(
"no_permission"),
true);
2459 $DIC->ctrl()->redirectByClass(TestScreenGUI::class, TestScreenGUI::DEFAULT_CMD);
2471 $main_tpl = $DIC->ui()->mainTemplate();
2472 $ilAccess = $DIC[
'ilAccess'];
2476 if ($ilAccess->checkAccess(
'read',
'', (
int) $target)
2477 || $ilAccess->checkAccess(
'visible',
'', (
int) $target)) {
2478 $DIC->ctrl()->setParameterByClass(self::class,
'ref_id', (
int) $target);
2479 $DIC->ctrl()->redirectByClass(
2481 ilRepositoryGUI::class,
2482 ilObjTestGUI::class,
2483 TestScreenGUI::class
2485 TestScreenGUI::DEFAULT_CMD
2488 $main_tpl->setOnScreenMessage(
'info', sprintf(
2489 $lng->
txt(
'msg_no_perm_read_item'),
2500 $this->
copyQuestionsToPool($this->testrequest->raw(
'q_id'), $this->testrequest->raw(
'sel_qpl'));
2501 $this->
ctrl->redirect($this, self::SHOW_QUESTIONS_CMD);
2512 foreach ($question_ids as $q_id) {
2513 $new_id = $this->
copyQuestionToPool(assQuestion::instantiateQuestionGUI($q_id), $target_pool);
2514 $new_ids[$q_id] = $new_id;
2518 $result->ids = $new_ids;
2519 $result->qpoolid = $qpl_id;
2527 $source_question_gui->
getObject()->getTitle()
2530 return $source_question_gui->
getObject()->createNewOriginalFromThisDuplicate($target_pool->
getId(), $new_title);
2535 array $question_ids = []
2541 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
"questionpool_not_selected"));
2546 $qpl_id = $this->obj_data_cache->lookupObjId(
$ref_id);
2549 if ($question_ids === []) {
2550 $question_ids = $this->testrequest->getQuestionIds();
2551 $question_id = $this->testrequest->getQuestionId();
2552 if ($question_ids === [] && $question_id !== 0) {
2553 $question_ids = [$question_id];
2557 if ($question_ids === []) {
2558 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
"tst_no_question_selected_for_moving_to_qpl"));
2559 $this->
ctrl->redirect($this,
'questions');
2564 foreach ($result->ids as $oldId => $newId) {
2567 $original_question_id = $questionInstance->getOriginalId();
2568 if ($original_question_id !== null
2569 && $this->test_questions_repository->originalQuestionExists($original_question_id)) {
2571 $oldOriginal->delete($oldOriginal->getId());
2576 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
'tst_qst_added_to_pool_' . (count($result->ids) > 1 ?
'p' :
's')),
true);
2577 $this->
ctrl->redirect($this, self::SHOW_QUESTIONS_CMD);
2587 if (!$this->
access->checkAccess(
'write',
'', $this->object->getRefId())
2592 if ($this->testrequest->raw(
'title')) {
2593 $title = $this->testrequest->raw(
'title');
2595 $title = $this->testrequest->raw(
'txt_qpl');
2599 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
'questionpool_not_entered'));
2604 $question_pool = $this->
createQuestionPool($title, $this->testrequest->raw(
'description'));
2605 $_REQUEST[
'sel_qpl'] = $question_pool->getRefId();
2618 $this->tabs_manager->getQuestionsSubTabs();
2619 $this->tabs_manager->activateSubTab(TabsManager::SUBTAB_ID_QST_LIST_VIEW);
2621 $questionpools = $this->
getTestObject()->getAvailableQuestionpools(
2630 if ($questionpools === []) {
2636 case 'copyQuestionsToPool':
2639 case 'copyAndLinkQuestionsToPool':
2641 $hidden->setValue(
'1');
2642 $form->addItem($hidden);
2647 $this->tpl->setContent($form->getHTML());
2653 $form->setFormAction($this->
ctrl->getFormAction($this));
2654 $form->addCommandButton($cmd, $this->
lng->txt(
'submit'));
2655 $form->addCommandButton(
'cancelCreateQuestion', $this->
lng->txt(
'cancel'));
2657 if (count($questionpools) == 0) {
2658 $form->setTitle($this->
lng->txt(
"tst_enter_questionpool"));
2661 $title->setRequired(
true);
2662 $form->addItem($title);
2665 $form->addItem($description);
2667 $form->
setTitle($this->
lng->txt(
"tst_select_questionpool"));
2670 '' => $this->
lng->txt(
'please_select')
2673 foreach ($questionpools as $key => $value) {
2674 $selectOptions[$key] = $value[
"title"];
2679 $select->setOptions($selectOptions);
2681 $form->addItem($select);
2687 } elseif ($this->testrequest->isset(
'q_id') && is_array($this->testrequest->raw(
'q_id'))) {
2688 $question_ids = $this->testrequest->raw(
'q_id');
2691 foreach ($question_ids as
$id) {
2693 $hidden->setValue((
string) $id);
2694 $form->addItem($hidden);
2702 if (!$this->
access->checkAccess(
'write',
'', $this->ref_id)) {
2703 $this->tpl->setOnScreenMessage(
'info', $this->
lng->txt(
'cannot_edit_test'),
true);
2704 $this->
ctrl->redirectByClass([ilRepositoryGUI::class, self::class, ilInfoScreenGUI::class]);
2714 $path = $this->tree->getPathFull($this->ref_id);
2716 while ($parent = array_pop(
$path)) {
2717 if ($parent[
'type'] ===
'crs') {
2718 $container_ref_id = $parent[
'ref_id'];
2725 $this->objective_oriented_container->setObjId($container_obj_id);
2726 $this->objective_oriented_container->setRefId($container_ref_id);
2745 $this->content_style,
2747 $this->tabs_manager,
2757 if ($this->table_query === null) {
2758 $id = $this->
object ? $this->
object->getId() :
'';
2762 $this->data_factory,
2771 if ($this->table_actions === null) {
2780 $this->test_questions_repository,
2781 new QuestionPrinter(
2784 $this->tabs_manager,
2794 $this->
getTestObject()->getGlobalSettings()->isAdjustingQuestionsWithResultsAllowed(),
2797 $this->test_question_set_config_factory
2808 $this->
http->request(),
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.
TaxonomyService $taxonomy
copyToQuestionpoolObject()
static formatDate(ilDateTime $date, bool $a_skip_day=false, bool $a_include_wd=false, bool $include_seconds=false, ilObjUser $user=null,)
ilTestQuestionSetConfigFactory $test_question_set_config_factory
TestAdministrationInteractionTypes
QuestionsTableQuery $table_query
TestTopListRepository $toplist_repository
ilTestSessionFactory $test_session_factory
insertQuestionsObject(array $selected_array=null)
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
buildImportQuestionsSelectionForm(string $form_cmd, string $importdir, string $qtifile, string $path_to_uploaded_file_in_temp_dir=null)
trait TestQuestionsImportTrait
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...
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
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static _getQuestionGUI(string $question_type='', int $question_id=-1)
Creates a question gui representation and returns the alias to the question gui.
redirectAfterMissingWrite()
forwardCommandToQuestionPreview(string $cmd, assQuestionGUI $question_gui=null)
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()
Interface ilCtrlBaseClassInterface describes ilCtrl base classes.
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.
createQuestionFormObject(Form $form=null)
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)
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)
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
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
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()
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
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.
copyAndLinkQuestionsToPoolObject(int $ref_id=null, array $question_ids=[])
TabsManager $tabs_manager
parseDidacticTemplateVar(string $var, string $type)
ILIAS: ilPropertyFormGUI ILIAS: ilConfirmationGUI ILIAS: ilTestSettingsChangeConfirmationGUI ...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
addHeaderAction()
Add header action menu.
static clear(string $a_var)
forwardCommandToQuestion(string $cmd)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
buildInputPoolSelection()
static set(string $a_var, $a_val)
Set a value.
getRowIds(\ilObjTest $obj_test)
showMediaFullscreen(int $a_style_id=0)
show fullscreen view of media object
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