19declare(strict_types=1);
195 $this->navigation_history =
$DIC[
'ilNavigationHistory'];
196 $this->component_repository =
$DIC[
'component.repository'];
197 $this->component_factory =
$DIC[
'component.factory'];
198 $this->ui_service =
$DIC->uiService();
199 $this->
error = $DIC[
'ilErr'];
200 $this->db =
$DIC[
'ilDB'];
201 $this->
help = $DIC[
'ilHelp'];
202 $this->global_screen =
$DIC[
'global_screen'];
203 $this->obj_data_cache =
$DIC[
'ilObjDataCache'];
204 $this->irss =
$DIC[
'resource_storage'];
205 $this->skills_service =
$DIC->skills();
206 $this->archives =
$DIC->archives();
208 $this->data_factory =
new DataFactory();
209 $this->taxonomy =
$DIC->taxonomy()->domain();
210 $this->ui_service =
$DIC->uiService();
211 $this->content_style =
$DIC->contentStyle();
212 $this->skill_usage_service =
$DIC->skills()->usage();
214 $local_dic = TestDIC::dic();
215 $this->questionrepository = $local_dic[
'question.general_properties.repository'];
216 $this->test_questions_repository = $local_dic[
'questions.properties.repository'];
217 $this->qplrequest = $local_dic[
'question.request_data_wrapper'];
218 $this->title_builder = $local_dic[
'title_columns_builder'];
219 $this->testrequest = $local_dic[
'request_data_collector'];
220 $this->response_handler = $local_dic[
'response_handler'];
221 $this->participant_repository = $local_dic[
'participant.repository'];
222 $this->results_data_factory = $local_dic[
'results.data.factory'];
223 $this->results_presentation_factory = $local_dic[
'results.presentation.factory'];
224 $this->export_factory = $local_dic[
'exportimport.factory'];
225 $this->export_repository = $local_dic[
'exportimport.repository'];
226 $this->participant_access_filter_factory = $local_dic[
'participant.access_filter.factory'];
227 $this->test_pass_result_repository = $local_dic[
'results.data.repository'];
228 $this->toplist_repository = $local_dic[
'results.toplist.repository'];
229 $this->personal_settings_templates_repository = $local_dic[
'settings.personal_templates.repository'];
230 $this->main_settings_repository = $local_dic[
'settings.main.repository'];
231 $this->score_settings_repository = $local_dic[
'settings.scoring.repository'];
232 $this->marks_repository = $local_dic[
'marks.repository'];
233 $this->settings_factory = $local_dic[
'settings.factory'];
234 $this->mark_schema_factory = $local_dic[
'marks.factory'];
235 $this->additional_information_generator = $local_dic[
'logging.information_generator'];
236 $this->personal_settings_exporter = $local_dic[
'settings.personal_templates.exporter'];
239 if ($this->testrequest->hasRefId() && is_numeric($this->testrequest->getRefId())) {
240 $ref_id = $this->testrequest->getRefId();
246 $this->
object =
null;
249 $this->
ctrl->saveParameter($this, [
'ref_id',
'test_ref_id']);
251 $this->
lng->loadLanguageModule(
'assessment');
255 if (!($this->
object instanceof
ilObjTest)) {
265 $this->component_repository,
267 $this->questionrepository
281 $this->objective_oriented_container,
282 $this->test_session_factory->getSession()
285 $this->gui_factory = $local_dic[
'gui.factory'];
293 if ($this->
object ===
null) {
294 $this->
error->raiseError($this->
lng->txt(
'tst_settings_not_found_msg'), $this->error->MESSAGE);
298 $cmd = $this->
ctrl->getCmd(
'testScreen');
300 $cmds_disabled_due_to_offline_status = [
301 'resumePlayer',
'resumePlayer',
'outUserResultsOverview',
'outUserListOfAnswerPasses'
304 if (!$this->
getCreationMode() && $this->
object->getOfflineStatus() && in_array($cmd, $cmds_disabled_due_to_offline_status)) {
308 $next_class = $this->
ctrl->getNextClass($this);
312 $this->
access->checkAccess(
'read',
'', $this->testrequest->getRefId())
314 $this->navigation_history->addItem(
315 $this->testrequest->getRefId(),
316 ilLink::_getLink($this->testrequest->getRefId(),
'tst'),
323 switch ($next_class) {
324 case 'illtiproviderobjectsettinggui':
325 if ((!$this->
access->checkAccess(
"read",
"", $this->testrequest->getRefId()))) {
330 $this->tabs_manager->getSettingsSubTabs();
331 $this->tabs_manager->activateTab(
'settings');
332 $this->tabs_manager->activateSubTab(
'lti_provider');
334 $lti_gui->setCustomRolesForSelection($this->rbac_review->getLocalRoles($this->getTestObject()->getRefId()));
335 $lti_gui->offerLTIRolesForSelection(
false);
336 $this->
ctrl->forwardCommand($lti_gui);
339 case 'iltestexportgui':
340 if (!$this->
access->checkAccess(
'write',
'', $this->ref_id)) {
346 $this->tabs_manager->activateTab(TabsManager::TAB_ID_EXPORT);
348 $selected_files = [];
349 if ($this->testrequest->isset(
'file') && $this->testrequest->raw(
'file')) {
350 $selected_files = $this->testrequest->raw(
'file');
353 if (is_string($selected_files)) {
354 $selected_files = [$selected_files];
360 $this->obj_data_cache,
366 $this->export_repository,
367 $this->temp_file_system,
368 $this->participant_access_filter_factory,
369 $this->test_pass_result_repository,
372 $this->
ctrl->forwardCommand($export_gui);
375 case strtolower(ilInfoScreenGUI::class):
377 !$this->
access->checkAccess(
'read',
'', $this->testrequest->getRefId())
378 && !$this->access->checkAccess(
'visible',
'', $this->testrequest->getRefId())
388 case strtolower(TestScreenGUI::class):
389 if (!$this->
access->checkAccess(
'read',
'', $this->testrequest->getRefId()) && !$this->access->checkAccess(
'visible',
'', $this->testrequest->getRefId())) {
397 case 'ilobjectmetadatagui':
398 if (!$this->
access->checkAccess(
'write',
'', $this->getTestObject()->getRefId())) {
404 $this->tabs_manager->activateTab(TabsManager::TAB_ID_META_DATA);
406 $this->
ctrl->forwardCommand($md_gui);
409 case strtolower(ilTestParticipantsGUI::class):
410 if ((!$this->
access->checkAccess(
"read",
"", $this->testrequest->getRefId()))) {
418 $this->test_question_set_config_factory->getQuestionSetConfig(),
432 $this->component_factory,
433 $this->export_factory,
435 $this->response_handler,
436 $this->participant_repository,
437 $this->results_data_factory,
438 $this->results_presentation_factory,
439 $this->test_pass_result_repository
442 $this->
ctrl->forwardCommand($gui);
451 $this->tabs_manager->activateTab(TabsManager::TAB_ID_PARTICIPANTS);
455 case 'iltestresultsgui':
456 if ((!$this->
access->checkAccess(
"read",
"", $this->testrequest->getRefId()))) {
471 $this->component_repository,
477 $this->skills_service,
478 $this->questionrepository,
479 $this->toplist_repository,
483 $this->test_session_factory->getSession(),
484 $this->getObjectiveOrientedContainer(),
485 $this->participant_repository
488 $this->
ctrl->forwardCommand($gui);
491 case "iltestplayerfixedquestionsetgui":
493 $cmd !==
'autosave' &&
494 (!$this->
access->checkAccess(
"read",
"", $this->testrequest->getRefId()))
504 $this->
ctrl->forwardCommand($gui);
507 case "iltestplayerrandomquestionsetgui":
509 $cmd !==
'autosave' &&
510 (!$this->
access->checkAccess(
"read",
"", $this->testrequest->getRefId()))
520 $this->
ctrl->forwardCommand($gui);
523 case "iltestevaluationgui":
524 if ((!$this->
access->checkAccess(
"read",
"", $this->testrequest->getRefId()))) {
530 case "iltestservicegui":
531 if ((!$this->
access->checkAccess(
"read",
"", $this->testrequest->getRefId()))) {
537 $this->
ctrl->forwardCommand($serviceGUI);
540 case 'ilpermissiongui':
541 if ((!$this->
access->checkAccess(
"read",
"", $this->testrequest->getRefId()))) {
546 $this->tabs_manager->activateTab(TabsManager::TAB_ID_PERMISSIONS);
548 $ret = $this->
ctrl->forwardCommand($perm_gui);
551 case "illearningprogressgui":
552 if ((!$this->
access->checkAccess(
"read",
"", $this->testrequest->getRefId()))) {
558 $this->tabs_manager->activateTab(TabsManager::TAB_ID_LEARNING_PROGRESS);
560 $test_session = $this->test_session_factory->getSessionByUserId($this->
user->getId());
562 !$this->test_access->checkOtherParticipantsLearningProgressAccess()
563 && !$this->getTestObject()->canShowTestResults($test_session)
566 $this->tpl->setOnScreenMessage(
568 $this->
lng->txt(
'tst_res_tab_msg_no_lp_access'),
574 $this->
ctrl->forwardCommand($new_gui);
578 case "ilcertificategui":
579 if ((!$this->
access->checkAccess(
"read",
"", $this->testrequest->getRefId()))) {
585 $this->tabs_manager->activateTab(TabsManager::TAB_ID_SETTINGS);
590 $this->
ctrl->forwardCommand($output_gui);
593 case strtolower(ConsecutiveScoringGUI::class):
594 if ((!$this->
access->checkAccess(
"read",
"", $this->testrequest->getRefId()))) {
597 $output_gui = $this->gui_factory->get(ConsecutiveScoringGUI::class, $this->
getTestObject());
599 $this->
ctrl->forwardCommand($output_gui);
604 case strtolower(MarkSchemaGUI::class):
605 if ((!$this->
access->checkAccess(
"read",
"", $this->testrequest->getRefId()))) {
619 $this->request_wrapper,
620 $this->response_handler,
625 $this->mark_schema_factory
627 $this->
ctrl->forwardCommand($mark_schema_gui);
631 $this->tabs_manager->activateTab(TabsManager::TAB_ID_SETTINGS);
632 $this->tabs_manager->activateSubTab(TabsManager::SETTINGS_SUBTAB_ID_MARK_SCHEMA);
636 case strtolower(SettingsMainGUI::class):
637 if ((!$this->
access->checkAccess(
"read",
"", $this->testrequest->getRefId()))) {
648 $this->obj_data_cache,
654 $this->component_repository,
658 $this->questionrepository
660 $this->
ctrl->forwardCommand($gui);
662 $this->tabs_manager->activateTab(TabsManager::TAB_ID_SETTINGS);
663 $this->tabs_manager->activateSubTab(TabsManager::SUBTAB_ID_GENERAL_SETTINGS);
667 case strtolower(SettingsScoringGUI::class):
668 if ((!$this->
access->checkAccess(
"read",
"", $this->testrequest->getRefId()))) {
679 $this->component_repository,
693 $this->
ctrl->forwardCommand($gui);
696 case 'iltestrandomquestionsetconfiggui':
697 if ((!$this->
access->checkAccess(
"read",
"", $this->testrequest->getRefId()))) {
721 $this->component_repository,
722 $this->obj_definition,
723 $this->obj_data_cache,
724 $test_process_locker_factory,
726 $this->title_builder,
727 $this->questionrepository
729 $this->
ctrl->forwardCommand($gui);
732 case 'iltestquestionbrowsertablegui':
733 if ((!$this->
access->checkAccess(
"read",
"", $this->testrequest->getRefId()))) {
743 $this->component_repository,
752 $this->questionrepository,
760 $this->
ctrl->forwardCommand($gui);
763 case 'iltestskilladministrationgui':
764 if ((!$this->
access->checkAccess(
"read",
"", $this->testrequest->getRefId()))) {
779 $this->component_repository,
781 $this->questionrepository,
785 $this->skill_usage_service,
791 $this->
ctrl->forwardCommand($gui);
794 case 'ilobjectcopygui':
795 if ((!$this->
access->checkAccess(
"copy",
"", $this->testrequest->getRefId()))) {
802 $this->
ctrl->forwardCommand($cp);
805 case strtolower(ilAssQuestionPreviewGUI::class):
806 if (!$this->
access->checkAccess(
'write',
'', $this->getTestObject()->getRefId())) {
812 case 'ilassquestionpagegui':
813 if ($cmd ===
'finishEditing') {
818 if ((!$this->
access->checkAccess(
"read",
"", $this->testrequest->getRefId()))) {
821 if ($cmd ===
'edit' && !$this->
access->checkAccess(
'write',
'', $this->testrequest->getRefId())) {
830 $this->questionrepository,
833 $forwarder->forward();
836 case 'ilassspecfeedbackpagegui':
837 if ((!$this->
access->checkAccess(
"write",
"", $this->testrequest->getRefId()))) {
841 $this->
ctrl->forwardCommand($pg_gui);
844 case 'ilassgenfeedbackpagegui':
845 if ((!$this->
access->checkAccess(
"write",
"", $this->testrequest->getRefId()))) {
849 $this->
ctrl->forwardCommand($pg_gui);
852 case 'illocalunitconfigurationgui':
853 if ((!$this->
access->checkAccess(
"write",
"", $this->testrequest->getRefId()))) {
860 $question = $question_gui->getObject();
862 $question_gui->setObject($question);
863 $question_gui->setQuestionTabs();
867 $this->
ctrl->forwardCommand($gui);
870 case "ilcommonactiondispatchergui":
871 if (!$this->
access->checkAccess(
"read",
"", $this->testrequest->getRefId()) && !$this->access->checkAccess(
"visible",
"", $this->testrequest->getRefId())) {
876 $this->
ctrl->forwardCommand($gui);
879 case 'ilassquestionfeedbackeditinggui':
880 if (!$this->
access->checkAccess(
'write',
'', $this->getTestObject()->getRefId())) {
886 $this->
ctrl->setReturnByClass(self::class, self::SHOW_QUESTIONS_CMD);
888 $question = $question_gui->getObject();
890 $question_gui->setObject($question);
891 $question_gui->setQuestionTabs();
892 $question_gui->setContextAllowsSyncToPool(
true);
897 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
'question_is_part_of_running_test'),
true);
912 $this->
ctrl->forwardCommand($gui);
915 case 'iltestcorrectionsgui':
916 if ((!$this->
access->checkAccess(
'read',
'', $this->testrequest->getRefId()))) {
933 $this->test_pass_result_repository
935 $this->
ctrl->forwardCommand($gui);
938 case 'iltestpagegui':
939 if ((!$this->
access->checkAccess(
"write",
"", $this->testrequest->getRefId()))) {
943 if ($cmd ===
'downloadFile') {
944 $page_id = $this->
object->getIntroductionPageId();
945 if ($this->testrequest->strVal(
'page_type') ===
'concludingremarkspage') {
946 $page_id = $this->
object->getConcludingRemarksPageId();
955 if (!$this->
access->checkAccess(
'read',
'', $this->testrequest->getRefId())
956 && !$this->access->checkAccess(
'visible',
'', $this->testrequest->getRefId())) {
962 if ($cmd ===
'testScreen') {
967 $local_cmd =
"{$cmd}Object";
969 if (!method_exists($this, $local_cmd)) {
970 $local_cmd = self::SHOW_QUESTIONS_CMD .
'Object';
976 if ((!$this->
access->checkAccess(
'read',
'', $this->testrequest->getRefId()))) {
981 [
'editQuestion',
'previewQuestion',
'save',
'saveReturn',
'uploadImage',
982 'removeImage',
'syncQuestion',
'syncQuestionReturn',
'suggestedsolution']
984 && !$this->
access->checkAccess(
'write',
'', $this->getTestObject()->getRefId())) {
987 if (in_array($cmd, [
'editQuestion',
'save',
'saveReturn',
'suggestedsolution'])
989 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
'question_is_part_of_running_test'),
true);
997 if (!in_array(strtolower($this->testrequest->raw(
'baseClass')), [
'iladministrationgui',
'ilrepositorygui'])
998 && $this->getCreationMode() !==
true) {
999 $this->tpl->printToStdout();
1005 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
'no_permission'),
true);
1006 $target_class = get_class($this->
object) .
'GUI';
1007 $this->
ctrl->setParameterByClass($target_class,
'ref_id', $this->ref_id);
1008 $this->
ctrl->redirectByClass($target_class);
1013 $this->tpl->setOnScreenMessage(
'failure', sprintf(
1014 $this->
lng->txt(
"msg_no_perm_read_item"),
1015 $this->object->getTitle()
1018 $this->
ctrl->redirectByClass(
'ilrepositorygui');
1025 $nr_of_participants_with_results = $this->
getTestObject()->evalTotalPersons();
1027 $this->
ctrl->saveParameterByClass(self::class,
'q_id');
1038 $this->global_screen,
1044 if ($nr_of_participants_with_results > 0
1045 && $this->
getTestObject()->getGlobalSettings()->isAdjustingQuestionsWithResultsAllowed()) {
1046 $gui->addAdditionalCmd(
1047 $this->
lng->txt(
'tst_corrections_qst_form'),
1048 $this->ctrl->getLinkTargetByClass(ilTestCorrectionsGUI::class,
'showQuestion')
1056 if (!$this->
getTestObject()->isRandomTest() && $nr_of_participants_with_results === 0) {
1057 $gui->setPrimaryCmd(
1058 $this->
lng->txt(
'edit_question'),
1059 $this->ctrl->getLinkTargetByClass(
1060 get_class($question_gui),
1064 $gui->addAdditionalCmd(
1065 $this->
lng->txt(
'edit_page'),
1066 $this->ctrl->getLinkTargetByClass(
1067 ilAssQuestionPageGUI::class,
1075 $gui->initPreviewSession($this->
user->getId(), $this->testrequest->getQuestionId());
1076 $gui->initStyleSheets();
1078 $this->
ctrl->clearParameterByClass(self::class,
'q_id');
1079 $this->tabs_gui->setBackTarget(
1080 $this->
lng->txt(
'backtocallingtest'),
1081 $this->ctrl->getLinkTargetByClass(self::class, self::SHOW_QUESTIONS_CMD)
1083 $this->
ctrl->saveParameterByClass(self::class,
'q_id');
1084 $gui->{$cmd .
'Cmd'}();
1089 $this->tpl->setTitle(
1090 $this->
refinery->encode()->htmlSpecialCharsAsEntities()->transform(
1091 "{$this->getTestObject()->getTitle()}: {$question_title}"
1098 $this->create_question_mode =
true;
1099 $this->prepareOutput();
1102 $qid = $this->fetchAuthoringQuestionIdParameter();
1104 $this->
ctrl->setReturnByClass(self::class, self::SHOW_QUESTIONS_CMD);
1112 $question = $question_gui->getObject();
1113 $question->setObjId($this->getTestObject()->
getId());
1114 $question_gui->setObject($question);
1115 $question_gui->setContextAllowsSyncToPool(
true);
1116 $question_gui->setQuestionTabs();
1118 $this->addQuestionTitleToObjectTitle($question->getTitleForHTMLOutput());
1120 $target = strpos($cmd,
'Return') ===
false ?
'stay' :
'return';
1122 if (in_array($cmd, [
'syncQuestion',
'syncQuestionReturn'])) {
1123 $question_gui->syncQuestion();
1124 $this->showNextViewAfterQuestionSave($question_gui, $target);
1128 if ($question_gui->isSaveCommand()
1129 || $question_gui->cmdNeedsExistingQuestion($cmd)) {
1130 $question_gui = $this->addPostCreationTasksToQuestionGUI($question_gui);
1133 if ($qid === 0 && $question_gui->cmdNeedsExistingQuestion($cmd)) {
1134 $question_gui->getObject()->createNewQuestion();
1135 $question_gui->setQuestionTabs();
1136 $this->executeAfterQuestionCreationTasks($question_gui);
1139 if (!$question_gui->isSaveCommand()) {
1140 $this->
ctrl->forwardCommand($question_gui);
1144 if (!$question_gui->saveQuestion()) {
1148 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
'msg_obj_modified'),
true);
1150 $this->executeAfterQuestionCreationTasks($question_gui);
1152 $this->executeAfterQuestionSaveTasks($question_gui);
1153 $this->showNextViewAfterQuestionSave($question_gui, $target);
1155 $this->showQuestionsObject();
1162 if ($this->testrequest->isset(
'move_after_question_with_id')) {
1164 $this->testrequest->int(
'move_after_question_with_id')
1168 if ($this->testrequest->isset(
'pool_title')) {
1169 $question_gui->setCopyToNewPoolOnSave(
1170 $this->testrequest->strVal(
'pool_title')
1174 if ($this->testrequest->isset(
'pool_ref')) {
1175 $question_gui->setCopyToExistingPoolOnSave(
1176 $this->testrequest->int(
'pool_ref')
1179 return $question_gui;
1184 if ($this->getTestObject()->getTestLogger()->isLoggingEnabled()) {
1185 $this->getTestObject()->getTestLogger()->logQuestionAdministrationInteraction(
1186 $question_gui->
getObject()->toQuestionAdministrationInteraction(
1187 $this->getTestObject()->getTestLogger()->getAdditionalInformationGenerator(),
1188 $this->getTestObject()->getRefId(),
1189 TestQuestionAdministrationInteractionTypes::QUESTION_MODIFIED
1198 && !in_array($question_gui->
getObject()->getId(), $this->getTestObject()->getQuestions())) {
1199 $this->getTestObject()->insertQuestion($question_gui->
getObject()->getId(),
true);
1203 $this->getTestObject()->moveQuestions(
1206 ? $this->getTestObject()->getQuestions()[1]
1214 $original_id = $this->copyQuestionToPool(
1224 $original_id = $this->copyQuestionToPool(
1235 if ($target ===
'return') {
1236 $this->forwardCommandToQuestionPreview(
1242 if ($target ===
'stay') {
1243 $this->
ctrl->setParameterByClass(ilAssQuestionPreviewGUI::class,
'q_id', $question_gui->
getObject()->getId());
1244 $this->tabs_gui->setBackTarget(
1245 $this->
lng->txt(
'backtocallingpage'),
1246 $this->ctrl->getLinkTargetByClass(
1247 ilAssQuestionPreviewGUI::class,
1258 $this->getTestObject()->getType(),
1259 $this->getTestObject()->getRefId(),
1260 $this->getTestObject()->
getId(),
1261 $this->
user->getId()
1271 $this->
ctrl->redirectByClass(
'ilTestExportGUI');
1280 $qid = $this->testrequest->int(
'q_id');
1282 if ($qid === 0 || $this->getTestObject()->checkQuestionParent($qid)) {
1286 throw new ilTestException(
'question id does not relate to parent object!');
1291 if ($this->getTestObject()->isRandomTest()) {
1292 $this->
ctrl->redirectByClass(
'ilTestRandomQuestionSetConfigGUI');
1295 $this->
ctrl->redirectByClass(
'ilObjTestGUI', self::SHOW_QUESTIONS_CMD);
1300 $this->prepareOutput();
1301 $this->tabs_manager->getSettingsSubTabs();
1303 if ($this->request_wrapper->has(
'page_type')
1304 && $this->request_wrapper->retrieve(
1306 $this->refinery->kindlyTo()->string()
1307 ) ===
'introductionpage'
1309 $page_type =
'IntroductionPage';
1310 $this->tabs_manager->activateSubTab(TabsManager::SETTINGS_SUBTAB_ID_EDIT_INTRODUCTION_PAGE);
1311 $page_id = $this->getTestObject()->getIntroductionPageId();
1313 $page_type =
'ConcludingRemarksPage';
1314 $this->tabs_manager->activateSubTab(TabsManager::SETTINGS_SUBTAB_ID_EDIT_CONCLUSION_PAGE);
1315 $page_id = $this->getTestObject()->getConcludingRemarksPageId();
1317 $this->
ctrl->saveParameterByClass(ilTestPageGUI::class,
'page_type');
1320 $this->content_style->gui()->addCss($this->tpl, $this->ref_id);
1321 $this->tpl->setContent($this->
ctrl->forwardCommand($gui));
1323 if ($this->
ctrl->getCmdClass() === strtolower(ilTestPageGUI::class)) {
1324 $this->tabs_manager->activateTab(TabsManager::TAB_ID_SETTINGS);
1330 return $this->test_access;
1335 $this->test_access = $test_access;
1340 $this->prepareOutput();
1341 $this->addHeaderAction();
1343 $gui->setObjectiveOrientedContainer($this->getObjectiveOrientedContainer());
1344 $gui->setTestAccess($this->getTestAccess());
1346 $this->
ctrl->forwardCommand($gui);
1351 $this->
ctrl->redirectByClass(SettingsMainGUI::class, SettingsMainGUI::CMD_SHOW_FORM);
1356 $this->tpl->loadStandardTemplate();
1357 $this->setLocator();
1358 $this->setTitleAndDescription();
1363 $this->
ctrl->redirectByClass([ilRepositoryGUI::class, self::class, ilInfoScreenGUI::class]);
1366 protected function importFile(
string $file_to_import,
string $path_to_uploaded_file_in_temp_dir): void
1373 $unzip = $this->archives->unzip(Streams::ofResource(fopen($file_to_import,
'r')),
$options);
1376 if (!is_file($qtifile)) {
1378 $this->deleteUploadedImportFile($path_to_uploaded_file_in_temp_dir);
1379 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
'tst_import_non_ilias_zip'),
true);
1383 $qtiParser->startParsing();
1385 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
'import_file_not_valid'),
true);
1386 $this->
ctrl->redirect($this,
'create');
1388 $founditems = $qtiParser->getFoundItems();
1392 foreach ($founditems as $item) {
1393 if ($item[
"type"] !==
'') {
1400 if (count($founditems) && $complete == 0) {
1402 $this->deleteUploadedImportFile($path_to_uploaded_file_in_temp_dir);
1403 $this->tpl->setOnScreenMessage(
'info', $this->
lng->txt(
'qpl_import_non_ilias_files'));
1408 ilSession::set(
'path_to_uploaded_file_in_temp_dir', $path_to_uploaded_file_in_temp_dir);
1412 || $founditems === []) {
1413 $this->importVerifiedFileObject(
true);
1418 'importVerifiedFile',
1422 $path_to_uploaded_file_in_temp_dir
1425 if ($form ===
null) {
1429 $panel = $this->ui_factory->panel()->standard(
1430 $this->
lng->txt(
'import_tst'),
1432 $this->ui_factory->legacy()->content($this->lng->txt(
'qpl_import_verify_found_questions')),
1436 $this->tpl->setContent($this->ui_renderer->render($panel));
1437 $this->tpl->printToStdout();
1448 $new_object->saveToDb();
1450 if ($new_object->getTestLogger()->isLoggingEnabled()) {
1451 $new_object->getTestLogger()->logTestAdministrationInteraction(
1452 $new_object->getTestLogger()->getInteractionFactory()->buildTestAdministrationInteraction(
1454 $this->user->getId(),
1455 TestAdministrationInteractionTypes::NEW_TEST_CREATED,
1462 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
'object_added'),
true);
1464 $this->tpl->setOnScreenMessage(
'info', $this->
lng->txt(
$info),
true);
1466 $this->
ctrl->setParameter($this,
'ref_id', $new_object->
getRefId());
1467 $this->
ctrl->redirectByClass(SettingsMainGUI::class);
1473 $path = $this->tree->getPathFull($this->getTestObject()->getRefID());
1474 ilUtil::redirect($this->getReturnLocation(
"cancel",
"./ilias.php?baseClass=ilRepositoryGUI&cmd=frameset&ref_id=" .
$path[count(
$path) - 2][
"child"]));
1479 return $this->object;
1486 bool $skip_retrieve_selected_questions =
false
1488 if (!$this->checkPermissionBool(
'create',
'',
'tst')) {
1489 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
'no_permission'),
true);
1490 $this->
ctrl->returnToParent($this);
1493 $path_to_uploaded_file_in_temp_dir =
ilSession::get(
'path_to_uploaded_file_in_temp_dir');
1497 $new_obj->setTitle(
'dummy');
1498 $new_obj->setDescription(
'test import');
1499 $new_obj->create(
true);
1500 $new_obj->createReference();
1501 $new_obj->putInTree($this->testrequest->getRefId());
1502 $new_obj->setPermissions($this->testrequest->getRefId());
1503 $new_obj->saveToDb();
1505 $selected_questions = [];
1506 if (!$skip_retrieve_selected_questions) {
1508 'importVerifiedFile',
1515 ilSession::set(
'tst_import_selected_questions', $selected_questions);
1517 $imp =
new ilImport($this->testrequest->getRefId());
1518 $map = $imp->getMapping();
1519 $map->addMapping(
'components/ILIAS/Test',
'tst',
'new_id', (
string) $new_obj->getId());
1525 if (is_file($importdir . DIRECTORY_SEPARATOR .
'/manifest.xml')) {
1526 $imp->importObject($new_obj, $file_to_import, basename($file_to_import),
'tst',
'components/ILIAS/Test',
true);
1529 $test_importer->setImport($imp);
1531 $test_importer->setImportDirectory($importdir .
'/' . $subdir);
1532 $test_importer->init();
1534 $test_importer->importXmlRepresentation(
1542 if ($new_obj->getTestLogger()->isLoggingEnabled()) {
1543 $new_obj->getTestLogger()->logTestAdministrationInteraction(
1544 $new_obj->getTestLogger()->getInteractionFactory()->buildTestAdministrationInteraction(
1545 $new_obj->getRefId(),
1546 $this->user->getId(),
1547 TestAdministrationInteractionTypes::NEW_TEST_CREATED,
1554 $this->deleteUploadedImportFile($path_to_uploaded_file_in_temp_dir);
1558 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
"object_imported"),
true);
1561 if ($question_skill_assignments_import_fails->failedImportsRegistered()) {
1562 $this->tpl->setOnScreenMessage(
1564 $question_skill_assignments_import_fails->getFailedImportsMessage($this->lng),
1569 $this->
ctrl->setParameterByClass(ilObjTestGUI::class,
'ref_id', $new_obj->getRefId());
1570 $this->
ctrl->redirectByClass(ilObjTestGUI::class);
1578 $file = explode(
"_", $this->testrequest->raw(
"file_id"));
1579 $fileObj =
new ilObjFile((
int) $file[count($file) - 1],
false);
1580 $fileObj->sendFile();
1590 $page_gui->setFileDownloadLink(
1591 $this->
ctrl->getLinkTargetByClass(ilObjTestGUI::class,
'downloadFile')
1593 $page_gui->showMediaFullscreen();
1602 $pg_obj->sendParagraph($this->testrequest->raw(
"par_id"), $this->testrequest->raw(
"downloadtitle"));
1608 $parent_ref = $this->tree->getParentId($this->getTestObject()->getRefId());
1610 $qpl->setType(
"qpl");
1611 $qpl->setTitle($name);
1612 $qpl->setDescription($description);
1614 $qpl->createReference();
1615 $qpl->putInTree($parent_ref);
1616 $qpl->setPermissions($parent_ref);
1617 $qpl->getObjectProperties()->storePropertyIsOnline($qpl->getObjectProperties()->getPropertyIsOnline()->withOnline());
1622 public function createQuestionObject(): void
1624 $this->protectByWritePermission();
1626 $this->
ctrl->setReturnByClass(self::class, self::SHOW_QUESTIONS_CMD);
1628 $form = $this->buildQuestionCreationForm()->withRequest($this->request);
1629 $data_with_section = $form->getData();
1630 if ($data_with_section ===
null) {
1631 $this->createQuestionFormObject($form);
1634 $data = $data_with_section[0];
1636 $qpl_mode =
$data[
'pool_selection'][
'qpl_type'];
1638 if ($qpl_mode === self::QUESTION_CREATION_POOL_SELECTION_NEW_POOL
1639 && ! $this->userCanCreatePoolAtCurrentLocation()) {
1640 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
'permission_denied'),
true);
1641 $this->showQuestionsObject();
1645 if ($qpl_mode === self::QUESTION_CREATION_POOL_SELECTION_NEW_POOL &&
$data[
'pool_selection'][
'title'] ===
''
1646 || $qpl_mode === self::QUESTION_CREATION_POOL_SELECTION_EXISTING_POOL &&
$data[
'pool_selection'][
'pool_ref_id'] === 0) {
1647 $this->tpl->setOnScreenMessage(
'info', $this->
lng->txt(
"questionpool_not_entered"));
1648 $this->createQuestionFormObject($form);
1657 $question = $question_gui->getObject();
1658 $question->setAdditionalContentEditingMode(
$data[
'editing_type']);
1659 $question->setObjId($this->getTestObject()->
getId());
1660 $question_gui->setObject($question);
1661 $question_gui->setQuestionTabs();
1663 if (array_key_exists(
'position',
$data)) {
1664 $question_gui->setMoveAfterQuestionId(
$data[
'position']);
1667 if ($qpl_mode === self::QUESTION_CREATION_POOL_SELECTION_NEW_POOL) {
1668 $question_gui->setCopyToNewPoolOnSave(
$data[
'pool_selection'][
'title']);
1671 if ($qpl_mode === self::QUESTION_CREATION_POOL_SELECTION_EXISTING_POOL) {
1672 $question_gui->setCopyToExistingPoolOnSave(
$data[
'pool_selection'][
'pool_ref_id']);
1675 $question_gui->editQuestion();
1680 $this->
ctrl->redirect($this, self::SHOW_QUESTIONS_CMD);
1685 $this->protectByWritePermission();
1687 if (($selected_array ?? $this->testrequest->getQuestionIds()) === []) {
1688 $this->tpl->setOnScreenMessage(
'info', $this->
lng->txt(
'tst_insert_missing_question'),
true);
1689 $this->
ctrl->redirect($this,
'browseForQuestions');
1692 $this->getTestObject()->saveCompleteStatus($this->test_question_set_config_factory->getQuestionSetConfig());
1693 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
'tst_questions_inserted'),
true);
1694 $this->
ctrl->redirect($this, self::SHOW_QUESTIONS_CMD);
1700 $this->protectByWritePermission();
1702 $this->tabs_manager->getQuestionsSubTabs();
1703 $this->tabs_manager->activateSubTab(TabsManager::SUBTAB_ID_QST_LIST_VIEW);
1705 $sub_screen_id = [
'createQuestion'];
1707 $this->tabs_manager->activateTab(TabsManager::TAB_ID_QUESTIONS);
1708 $this->
help->setScreenId(
'assQuestions');
1709 $this->
help->setSubScreenId(implode(
'_', $sub_screen_id));
1711 $this->tpl->setContent(
1712 $this->ui_renderer->render(
1713 $form ?? $this->buildQuestionCreationForm()
1720 $inputs[
'question_type'] = $this->buildInputQuestionType();
1721 $questions = $this->getTestObject()->getQuestionTitlesAndIndexes();
1722 if ($questions !== []) {
1723 $inputs[
'position'] = $this->buildInputPosition($questions);
1726 $inputs[
'editing_type'] = $this->buildInputEditingType();
1729 $sub_screen_id[] =
'editMode';
1732 $sub_screen_id[] =
'poolSelect';
1734 $inputs[
'pool_selection'] = $this->buildInputPoolSelection();
1737 $this->ui_factory->input()->field()->section(
$inputs, $this->
lng->txt(
'ass_create_question'))
1740 $form = $this->ui_factory->input()->container()->form()->standard(
1741 $this->
ctrl->getFormAction($this,
'createQuestion'),
1743 )->withSubmitLabel($this->
lng->txt(
'create'));
1750 $question_types = (
new ilObjQuestionPool())->getQuestionTypes(
false,
true,
false);
1752 foreach ($question_types as $label =>
$data) {
1756 return $this->ui_factory->input()->field()->select(
1757 $this->
lng->txt(
'question_type'),
1759 )->withRequired(
true);
1765 foreach ($questions as $key => $title) {
1766 $options[$key] = $this->
lng->txt(
'behind') .
' ' . $title
1767 .
' [' . $this->
lng->txt(
'question_id_short') .
': ' . $key .
']';
1769 return $this->ui_factory->input()->field()->select(
1770 $this->
lng->txt(
'position'),
1772 )->withAdditionalTransformation($this->
refinery->kindlyTo()->int());
1777 if (!$this->getTestObject()->getGlobalSettings()->isPageEditorEnabled()) {
1778 return $this->ui_factory->input()->field()->hidden()->
withValue(
1783 return $this->ui_factory->input()->field()->radio($this->
lng->txt(
'tst_add_quest_cont_edit_mode'))
1786 $this->
lng->txt(
'tst_add_quest_cont_edit_mode_IPE'),
1787 $this->lng->txt(
'tst_add_quest_cont_edit_mode_IPE_info')
1790 $this->
lng->txt(
'tst_add_quest_cont_edit_mode_RTE'),
1791 $this->lng->txt(
'tst_add_quest_cont_edit_mode_RTE_info')
1798 $f = $this->ui_factory->input()->field();
1801 $trafo = $this->
refinery->custom()->transformation(
1802 static function ($values) use ($kt): array {
1803 $return[
'qpl_type'] = $kt->int()->
transform($values[0]);
1804 if ($return[
'qpl_type'] === self::QUESTION_CREATION_POOL_SELECTION_NO_POOL) {
1807 if ($return[
'qpl_type'] === self::QUESTION_CREATION_POOL_SELECTION_NEW_POOL) {
1808 return $return + [
'title' => $kt->string()->
transform($values[1][0])];
1811 'pool_ref_id' => $kt->int()->
transform($values[1][0])
1818 foreach ($questionpools as $key => $p) {
1819 $pools_data[$key] = $p[
'title'];
1823 self::QUESTION_CREATION_POOL_SELECTION_NO_POOL =>
$f->group([], $this->
lng->txt(
'assessment_no_pool')),
1824 self::QUESTION_CREATION_POOL_SELECTION_EXISTING_POOL =>
$f->group(
1827 $this->lng->txt(
'select_questionpool'),
1829 )->withRequired(
true)
1831 $this->lng->txt(
'assessment_existing_pool')
1835 if ($this->userCanCreatePoolAtCurrentLocation()) {
1836 $inputs[self::QUESTION_CREATION_POOL_SELECTION_NEW_POOL] =
$f->group(
1837 [
$f->text($this->lng->txt(
'name'))],
1838 $this->lng->txt(
'assessment_new_pool')
1842 return $f->switchableGroup(
1844 $this->
lng->txt(
'assessment_pool_selection')
1845 )->withAdditionalTransformation($trafo)
1846 ->withRequired(
true)
1852 $this->protectByWritePermission();
1854 if ($this->testrequest->raw(
'add')) {
1855 $this->addQuestion();
1859 $table_query = $this->getQuestionsTableQuery();
1861 if (!$this->getQuestionsTableActions()->handleCommand(
1864 fn() => $this->protectByWritePermission(),
1865 fn() => $this->createQuestionpoolTargetObject(
'copyAndLinkQuestionsToPool'),
1866 fn() => $this->getTable()
1872 $this->tpl->addBlockFile(
'ADM_CONTENT',
'adm_content',
'tpl.il_as_tst_questions.html',
'components/ILIAS/Test');
1874 $this->setupToolBarAndMessage($this->getTestObject()->evalTotalPersons() !== 0);
1876 $this->tabs_manager->getQuestionsSubTabs();
1877 $this->tabs_manager->activateSubTab(TabsManager::SUBTAB_ID_QST_LIST_VIEW);
1879 $this->tpl->setCurrentBlock(
'adm_content');
1880 $this->tpl->setVariable(
'ACTION_QUESTION_FORM', $this->
ctrl->getFormAction($this));
1881 $this->tpl->setVariable(
1883 $this->ui_renderer->render(
1884 $this->getTable()->getTableComponent()
1887 $this->tpl->parseCurrentBlock();
1892 $selected_array = [$this->testrequest->int(
'add')];
1893 $total = $this->getTestObject()->evalTotalPersons();
1896 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
'test_has_datasets_warning_page_view'));
1897 $this->showQuestionsObject();
1900 $this->tpl->setOnScreenMessage(
'info', $this->
lng->txt(
'tst_insert_questions'));
1901 $this->insertQuestionsObject($selected_array);
1906 if (!$this->
access->checkAccess(
'write',
'', $this->ref_id)
1907 || $this->getTestObject()->isRandomTest()) {
1911 if ($has_started_test_runs) {
1912 $link = $this->ui_factory->link()->standard(
1913 $this->
lng->txt(
'test_has_datasets_warning_page_view_link'),
1914 $this->ctrl->getLinkTargetByClass([\ilTestParticipantsGUI::class])
1917 $message = $this->
lng->txt(
'test_has_datasets_warning_page_view');
1918 $massage_box = $this->ui_factory->messageBox()->info($message)->withLinks([$link]);
1919 $this->tpl->setCurrentBlock(
'pax_info_message');
1920 $this->tpl->setVariable(
1922 $this->ui_renderer->render($massage_box)
1924 $this->tpl->parseCurrentBlock();
1928 $this->
toolbar->addButton($this->
lng->txt(
'ass_create_question'), $this->ctrl->getLinkTarget($this,
'createQuestionForm'));
1929 $this->
toolbar->addSeparator();
1930 $this->populateQuestionBrowserToolbarButtons($this->
toolbar);
1935 $this->
ctrl->setParameterByClass(
1936 ilTestQuestionBrowserTableGUI::class,
1942 $this->
lng->txt(
'tst_browse_for_qpl_questions'),
1943 $this->ctrl->getLinkTargetByClass(
1944 ilTestQuestionBrowserTableGUI::class,
1949 $this->
ctrl->setParameterByClass(
1950 ilTestQuestionBrowserTableGUI::class,
1956 $this->
lng->txt(
'tst_browse_for_tst_questions'),
1957 $this->ctrl->getLinkTargetByClass(
1958 ilTestQuestionBrowserTableGUI::class,
1970 if (!$this->getTestObject()->getTestLogger()->isLoggingEnabled()
1971 || !$this->rbac_review->isAssigned($this->user->getId(),
SYSTEM_ROLE_ID)
1972 && !$this->access->checkAccess(
'tst_history_read',
'', $this->getTestObject()->getRefId())) {
1973 $this->redirectAfterMissingWrite();
1976 $here_uri = $this->data_factory->uri(ILIAS_HTTP_PATH
1977 .
'/' . $this->
ctrl->getLinkTargetByClass(self::class, self::SHOW_LOGS_CMD));
1978 list($url_builder, $action_parameter_token, $row_id_token) = (
new URLBuilder($here_uri))->acquireParameters(
1979 LogTable::QUERY_PARAMETER_NAME_SPACE,
1980 LogTable::ACTION_TOKEN_STRING,
1981 LogTable::ENTRY_TOKEN_STRING
1984 if ($this->request_wrapper->has($action_parameter_token->getName())) {
1985 $this->getTestObject()->getTestLogViewer()->executeLogTableAction(
1987 $action_parameter_token,
1989 $this->getTestObject()->getRefId()
1994 $this->ui_factory->button()->standard(
1995 $this->lng->txt(
'export_legacy_logs'),
1996 $this->ctrl->getLinkTargetByClass(self::class,
'exportLegacyLogs')
1999 $this->tabs_manager->activateTab(TabsManager::TAB_ID_HISTORY);
2001 list($filter, $table_gui) = $this->getTestObject()->getTestLogViewer()->getLogTable(
2003 $action_parameter_token,
2005 $this->getTestObject()->getRefId()
2008 $this->tpl->setVariable(
'ADM_CONTENT', $this->ui_renderer->render([$filter, $table_gui]));
2013 $this->protectByWritePermission();
2015 $csv_output = $this->getTestObject()->getTestLogViewer()->getLegacyLogExportForObjId($this->getTestObject()->
getId());
2019 "legacy_logs_for_{$this->getTestObject()->getRefId()}.csv"
2028 $command = $this->testrequest->strVal(
'command');
2029 if ($command ===
'') {
2030 $method = $command .
'Object';
2031 if (method_exists($this, $method)) {
2036 $this->
ctrl->redirect($this,
'participants');
2042 $this->protectByWritePermission();
2044 $this->tabs_manager->activateTab(TabsManager::TAB_ID_SETTINGS);
2046 $create_input = $this->buildPersonalSettingsCreateAction()
2047 ->buildModal($this->
ctrl->getLinkTargetByClass(self::class,
'createTemplate'));
2048 $import_input = $this->buildPersonalSettingsImportAction()
2049 ->buildModal($this->
ctrl->getLinkTargetByClass(self::class,
'importTemplate'));
2052 $this->ui_factory->button()->standard(
2053 $this->lng->txt(
'personal_settings_create'),
2054 $create_input->getShowSignal()
2058 $this->ui_factory->button()->standard(
2059 $this->lng->txt(
'personal_settings_import'),
2060 $import_input->getShowSignal()
2065 $this->buildPersonalSettingsTable()->getComponent(),
2071 $this->tpl->setContent(
2072 $this->ui_renderer->render(array_filter(
$components))
2078 $this->protectByWritePermission();
2081 $this->buildPersonalSettingsCreateAction()
2082 ->perform($this->getTestObject()->getTestId(), $this->request);
2083 }
catch (\InvalidArgumentException
$e) {
2084 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt($e->getMessage()),
true);
2087 $this->
ctrl->redirectByClass(self::class,
'showTemplates');
2092 $this->protectByWritePermission();
2095 $this->buildPersonalSettingsImportAction()
2096 ->perform($this->request);
2098 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
'personal_settings_import_success'),
true);
2099 }
catch (\InvalidArgumentException
$e) {
2100 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt($e->getMessage()),
true);
2103 $this->
ctrl->redirectByClass(self::class,
'showTemplates');
2108 $this->protectByWritePermission();
2110 $modal = $this->buildPersonalSettingsTable()->perform();
2111 if ($modal !==
null) {
2112 $this->showTemplatesObject($modal);
2115 $this->
ctrl->redirectByClass(self::class,
'showTemplates');
2124 $this->personal_settings_templates_repository,
2125 $this->main_settings_repository,
2126 $this->score_settings_repository,
2127 $this->marks_repository
2136 $this->data_factory,
2137 $this->temp_file_system,
2138 $this->personal_settings_templates_repository,
2139 $this->main_settings_repository,
2140 $this->score_settings_repository,
2141 $this->marks_repository
2149 $this->response_handler,
2154 $this->personal_settings_templates_repository,
2160 $this->personal_settings_templates_repository,
2161 $this->main_settings_repository,
2162 $this->score_settings_repository,
2163 $this->marks_repository,
2164 $this->additional_information_generator
2169 $this->test_question_set_config_factory,
2171 $this->getTestObject(),
2172 $this->personal_settings_templates_repository,
2173 $this->main_settings_repository,
2174 $this->score_settings_repository,
2175 $this->marks_repository
2180 $this->personal_settings_exporter
2186 $this->personal_settings_templates_repository,
2187 $this->marks_repository
2192 $uri = $this->
ctrl->getLinkTargetByClass(self::class,
'executeTemplatesAction',
'',
true);
2196 $this->data_factory,
2200 new URLBuilder($this->data_factory->uri(ILIAS_HTTP_PATH .
'/' . $uri)),
2201 $this->personal_settings_templates_repository,
2208 $this->
ctrl->getCmdClass(),
2210 strtolower(PublicProfileGUI::class),
2222 $this->
ctrl->redirectByClass(
2223 [ilRepositoryGUI::class, self::class, ilInfoScreenGUI::class]
2229 if (!$this->
access->checkAccess(
'visible',
'', $this->ref_id)
2230 && !$this->access->checkAccess(
'read',
'', $this->ref_id)) {
2231 $this->redirectAfterMissingRead();
2234 if ($this->getTestObject()->getMainSettings()->getAdditionalSettings()->getHideInfoTab()) {
2235 $this->
ctrl->redirectByClass([self::class, TestScreenGUI::class], TestScreenGUI::DEFAULT_CMD);
2238 $this->tabs_manager->activateTab(TabsManager::TAB_ID_INFOSCREEN);
2240 if ($this->
access->checkAccess(
'read',
'', $this->ref_id)) {
2241 $this->trackTestObjectReadEvent();
2245 if ($this->isCommandClassAnyInfoScreenChild()) {
2250 $this->getTestObject(),
2251 $this->test_player_factory->getPlayerGUI(),
2252 $this->test_question_set_config_factory->getQuestionSetConfig(),
2253 $this->test_session_factory->getSession(),
2264 $toolbar->setCloseFormTag(
false);
2266 $toolbar->setSessionLockString(
'');
2268 $toolbar->sendMessages();
2270 $info->enablePrivateNotes();
2272 $info->addSection($this->
lng->txt(
'tst_general_properties'));
2274 $this->
lng->txt(
'author'),
2275 $this->refinery->encode()->htmlSpecialCharsAsEntities()->transform(
2276 $this->getTestObject()->getAuthor()
2280 $this->
lng->txt(
'title'),
2281 $this->refinery->encode()->htmlSpecialCharsAsEntities()->transform(
2282 $this->getTestObject()->getTitle()
2286 if ($this->type !==
'tst') {
2287 $info->hideFurtherSections(
false);
2290 if ($this->getTestObject()->getEnableProcessingTime()) {
2291 $info->addProperty($this->
lng->txt(
'tst_processing_time'), $this->getTestObject()->getProcessingTime());
2294 $starting_time = $this->getTestObject()->getStartingTime();
2295 if ($this->getTestObject()->isStartingTimeEnabled() && $starting_time !== 0) {
2298 $ending_time = $this->getTestObject()->getEndingTime();
2299 if ($this->getTestObject()->isEndingTimeEnabled() && $ending_time != 0) {
2302 $info->addMetaDataSections($this->getTestObject()->
getId(), 0, $this->getTestObject()->getType());
2310 $qsaImportFails->deleteRegisteredImportFails();
2312 $sltImportFails->deleteRegisteredImportFails();
2314 $this->
ctrl->redirectByClass([ilRepositoryGUI::class, self::class, ilInfoScreenGUI::class]);
2319 switch ($this->
ctrl->getCmd()) {
2322 case "redirectToInfoScreen":
2329 case "outCorrectSolution":
2330 case "showAnswersOfUser":
2331 case "outUserResultsOverview":
2332 case "backFromSummary":
2333 case "show_answers":
2336 case "outTestSummary":
2337 case "outQuestionSummary":
2338 case "gotoQuestion":
2339 case "selectImagemapRegion":
2340 case "confirmSubmitAnswers":
2341 case "finalSubmission":
2343 case "outUserPassDetails":
2344 case "checkPassword":
2346 $this->getTestObject()->
getTitle(),
2347 $this->
ctrl->getLinkTargetByClass(
2348 [self::class, TestScreenGUI::class],
2349 TestScreenGUI::DEFAULT_CMD
2352 $this->testrequest->getRefId()
2356 case "evalAllUsers":
2357 case "evalUserDetail":
2359 $this->getTestObject()->
getTitle(),
2360 $this->
ctrl->getLinkTarget($this,
'eval_stat'),
2362 $this->testrequest->getRefId()
2367 case "importVerifiedFile":
2368 case "cancelImport":
2372 $this->getTestObject()->
getTitle(),
2373 $this->
ctrl->getLinkTargetByClass(
2374 [self::class, TestScreenGUI::class],
2375 TestScreenGUI::DEFAULT_CMD
2378 $this->testrequest->getRefId()
2393 $this->tabs_manager->activateTab(TabsManager::TAB_ID_SETTINGS);
2396 $output_gui = $guiFactory->create($this->getTestObject());
2398 $output_gui->certificateEditor();
2408 $this->
help->setScreenIdComponent(
"tst");
2410 if ($this->tabs_manager ===
null) {
2414 if ($this->getObjectiveOrientedContainer()->isObjectiveOrientedPresentationRequired()) {
2415 $courseLink = ilLink::_getLink($this->getObjectiveOrientedContainer()->getRefId());
2416 $this->tabs_manager->setParentBackLabel($this->
lng->txt(
'back_to_objective_container'));
2417 $this->tabs_manager->setParentBackHref($courseLink);
2420 $this->tabs_manager->perform();
2423 public static function accessViolationRedirect()
2427 $main_tpl =
$DIC->ui()->mainTemplate();
2429 $main_tpl->setOnScreenMessage(
'failure',
$DIC->language()->txt(
"no_permission"),
true);
2430 $DIC->ctrl()->redirectByClass(TestScreenGUI::class, TestScreenGUI::DEFAULT_CMD);
2442 $main_tpl =
$DIC->ui()->mainTemplate();
2443 $ilAccess =
$DIC[
'ilAccess'];
2447 if ($ilAccess->checkAccess(
'read',
'', (
int) $target)
2448 || $ilAccess->checkAccess(
'visible',
'', (
int) $target)) {
2449 $DIC->ctrl()->setParameterByClass(self::class,
'ref_id', (
int) $target);
2450 $DIC->ctrl()->redirectByClass(
2452 ilRepositoryGUI::class,
2453 ilObjTestGUI::class,
2454 TestScreenGUI::class
2456 TestScreenGUI::DEFAULT_CMD
2459 $main_tpl->setOnScreenMessage(
'info', sprintf(
2460 $lng->txt(
'msg_no_perm_read_item'),
2471 $this->copyQuestionsToPool($this->testrequest->raw(
'q_id'), $this->testrequest->raw(
'sel_qpl'));
2472 $this->
ctrl->redirect($this, self::SHOW_QUESTIONS_CMD);
2483 foreach ($question_ids as $q_id) {
2484 $new_id = $this->copyQuestionToPool(assQuestion::instantiateQuestionGUI($q_id), $target_pool);
2485 $new_ids[$q_id] = $new_id;
2488 $result =
new stdClass();
2489 $result->ids = $new_ids;
2490 $result->qpoolid = $qpl_id;
2498 $source_question_gui->
getObject()->getTitle()
2501 return $source_question_gui->
getObject()->createNewOriginalFromThisDuplicate($target_pool->
getId(), $new_title);
2506 array $question_ids = []
2512 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
"questionpool_not_selected"));
2513 $this->showQuestionsObject();
2517 $qpl_id = $this->obj_data_cache->lookupObjId(
$ref_id);
2520 if ($question_ids === []) {
2521 $question_ids = $this->testrequest->getQuestionIds();
2522 $question_id = $this->testrequest->getQuestionId();
2523 if ($question_ids === [] && $question_id !== 0) {
2524 $question_ids = [$question_id];
2528 if ($question_ids === []) {
2529 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
"tst_no_question_selected_for_moving_to_qpl"));
2530 $this->
ctrl->redirect($this,
'questions');
2533 $result = $this->copyQuestionsToPool($question_ids, $qpl_id);
2535 foreach ($result->ids as $oldId => $newId) {
2538 $original_question_id = $questionInstance->getOriginalId();
2539 if ($original_question_id !==
null
2540 && $this->test_questions_repository->originalQuestionExists($original_question_id)) {
2542 $oldOriginal->delete($oldOriginal->getId());
2547 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
'tst_qst_added_to_pool_' . (count($result->ids) > 1 ?
'p' :
's')),
true);
2548 $this->
ctrl->redirect($this, self::SHOW_QUESTIONS_CMD);
2553 $this->createQuestionpoolTargetObject(
'copyQuestionsToPool');
2558 if (!$this->
access->checkAccess(
'write',
'', $this->object->getRefId())
2559 || !$this->checkPermissionBool(
'create',
'',
'qpl')) {
2560 $this->redirectAfterMissingWrite();
2563 if ($this->testrequest->raw(
'title')) {
2564 $title = $this->testrequest->raw(
'title');
2566 $title = $this->testrequest->raw(
'txt_qpl');
2570 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
'questionpool_not_entered'));
2571 $this->createQuestionpoolTargetObject(
'createQuestionPoolAndCopy');
2575 $question_pool = $this->createQuestionPool($title, $this->testrequest->raw(
'description'));
2576 $_REQUEST[
'sel_qpl'] = $question_pool->getRefId();
2578 $this->copyAndLinkQuestionsToPoolObject();
2587 $this->protectByWritePermission();
2589 $this->tabs_manager->getQuestionsSubTabs();
2590 $this->tabs_manager->activateSubTab(TabsManager::SUBTAB_ID_QST_LIST_VIEW);
2592 $questionpools = $this->getTestObject()->getAvailableQuestionpools(
2601 if ($questionpools === []) {
2602 $form = $this->getTargetQuestionpoolForm($questionpools,
'createQuestionPoolAndCopy');
2604 $form = $this->getTargetQuestionpoolForm($questionpools, $cmd);
2607 case 'copyQuestionsToPool':
2610 case 'copyAndLinkQuestionsToPool':
2612 $hidden->setValue(
'1');
2613 $form->addItem($hidden);
2618 $this->tpl->setContent($form->getHTML());
2624 $form->setFormAction($this->
ctrl->getFormAction($this));
2625 $form->addCommandButton($cmd, $this->
lng->txt(
'submit'));
2626 $form->addCommandButton(
'cancelCreateQuestion', $this->
lng->txt(
'cancel'));
2628 if (count($questionpools) == 0) {
2629 $form->setTitle($this->
lng->txt(
"tst_enter_questionpool"));
2632 $title->setRequired(
true);
2633 $form->addItem($title);
2636 $form->addItem($description);
2638 $form->setTitle($this->
lng->txt(
"tst_select_questionpool"));
2641 '' => $this->
lng->txt(
'please_select')
2644 foreach ($questionpools as $key => $value) {
2645 $selectOptions[$key] = $value[
"title"];
2649 $select->setRequired(
true);
2650 $select->setOptions($selectOptions);
2652 $form->addItem($select);
2655 $table_query = $this->getQuestionsTableQuery();
2657 $question_ids = $table_query->
getRowIds($this->
object);
2658 } elseif ($this->testrequest->isset(
'q_id') && is_array($this->testrequest->raw(
'q_id'))) {
2659 $question_ids = $this->testrequest->raw(
'q_id');
2662 foreach ($question_ids as
$id) {
2664 $hidden->setValue((
string)
$id);
2665 $form->addItem($hidden);
2673 if (!$this->
access->checkAccess(
'write',
'', $this->ref_id)) {
2674 $this->tpl->setOnScreenMessage(
'info', $this->
lng->txt(
'cannot_edit_test'),
true);
2675 $this->
ctrl->redirectByClass([ilRepositoryGUI::class, self::class, ilInfoScreenGUI::class]);
2685 $path = $this->tree->getPathFull($this->ref_id);
2687 while ($parent = array_pop(
$path)) {
2688 if ($parent[
'type'] ===
'crs') {
2689 $container_ref_id = $parent[
'ref_id'];
2696 $this->objective_oriented_container->setObjId($container_obj_id);
2697 $this->objective_oriented_container->setRefId($container_ref_id);
2702 return $this->objective_oriented_container;
2708 $this->getTestObject(),
2716 $this->content_style,
2718 $this->tabs_manager,
2728 if ($this->table_query ===
null) {
2729 $id = $this->
object ? $this->
object->getId() :
'';
2733 $this->data_factory,
2737 return $this->table_query;
2742 if ($this->table_actions ===
null) {
2748 $this->getQuestionsTableQuery(),
2751 $this->test_questions_repository,
2752 new QuestionPrinter(
2755 $this->tabs_manager,
2762 $this->getTestObject()
2765 $this->getTestObject()->getGlobalSettings()->isAdjustingQuestionsWithResultsAllowed(),
2766 $this->getTestObject()->evalTotalPersons() !== 0,
2767 $this->getTestObject()->isRandomTest(),
2768 $this->test_question_set_config_factory
2771 return $this->table_actions;
2779 $this->
http->request(),
2780 $this->getQuestionsTableActions(),
2783 $this->test_questions_repository,
2784 $this->title_builder
2790 return $this->
settings->get(
'obj_dis_creation_qpl') !==
'1'
2791 && $this->checkPermissionBool(
'create',
'',
'qpl', $this->tree->getParentId($this->ref_id));
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Stream factory which enables the user to create streams without the knowledge of the concrete class.
getRowIds(\ilObjTest $obj_test)
@ilCtrl_Calls ILIAS\Test\Settings\MainSettings\SettingsMainGUI: ilPropertyFormGUI @ilCtrl_Calls ILIAS...
@depracated This is only a temporary exception to identify missing migrations and will be removed in ...
GUI class for public user profile presentation.
setMoveAfterQuestionId(?int $question_id)
setCopyToNewPoolOnSave(?string $pool_title)
static _getQuestionGUI(string $question_type='', int $question_id=-1)
Creates a question gui representation and returns the alias to the question gui.
editQuestion(bool $checkonly=false, ?bool $is_save_cmd=null)
const EDIT_CONTEXT_AUTHORING
setCopyToExistingPoolOnSave(?int $pool_ref_id)
getCopyToExistingPoolOnSave()
const ADDITIONAL_CONTENT_EDITING_MODE_RTE
const ADDITIONAL_CONTENT_EDITING_MODE_IPE
static saveOriginalId(int $questionId, int $originalId)
static instantiateQuestion(int $question_id)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static _recordReadEvent(string $a_type, int $a_ref_id, int $obj_id, int $usr_id, $a_ext_rc=null, $a_ext_time=null)
static getInstanceFromAjaxCall()
(Re-)Build instance from ajax call
static formatDate(ilDateTime $date, bool $a_skip_day=false, bool $a_include_wd=false, bool $include_seconds=false, ?ilObjUser $user=null,)
@classDescription Date and time handling
static delDir(string $a_dir, bool $a_clean_only=false)
removes a dir and all its content (subdirs and files) recursively
static isObjectiveTest(int $a_trst_ref_id)
Check if test ref_id is used in an objective course.
GUI class for LTI provider object settings.
static checkAccess(int $a_ref_id, bool $a_allow_only_read=true)
check access to learning progress
const LP_CONTEXT_REPOSITORY
Class ilObjUserTrackingGUI.
Class ilLocalUnitConfigurationGUI.
Last visited history for repository items.
static _getAvailableQuestionpools(bool $use_object_id=false, bool $equal_points=false, bool $could_be_offline=false, bool $showPath=false, bool $with_questioncount=false, string $permission='read', int $usr_id=0)
Returns the available question pools for the active user.
static getQuestionTypeByTypeId($type_id)
appendCounterToQuestionTitleIfNecessary(string $title)
buildPersonalSettingsImportAction()
RequestDataCollector $testrequest
SkillService $skills_service
trackTestObjectReadEvent()
addQuestionTitleToObjectTitle(string $question_title)
createQuestionpoolTargetObject(string $cmd)
Called when a new question should be created from a test Important: $cmd may be overwritten if no que...
addPostCreationTasksToQuestionGUI(assQuestionGUI $question_gui)
executeAfterQuestionCreationTasks(assQuestionGUI $question_gui)
redirectAfterMissingRead()
download_paragraphObject()
download source code paragraph
GeneralQuestionPropertiesRepository $questionrepository
TestTopListRepository $toplist_repository
addLocatorItems()
should be overwritten to add object specific items (repository items are preloaded)
ilTestPlayerFactory $test_player_factory
static _goto($target)
Redirect script to call a test with the test reference id.
ResponseHandler $response_handler
ExportRepository $export_repository
TestResultRepository $test_pass_result_repository
userCanCreatePoolAtCurrentLocation()
ParticipantRepository $participant_repository
showNextViewAfterQuestionSave(assQuestionGUI $question_gui, string $target)
ilComponentRepository $component_repository
MarksRepository $marks_repository
createQuestionPool($name="dummy", $description="")
MainSettingsRepository $main_settings_repository
buildInputPoolSelection()
PersonalSettingsRepository $personal_settings_templates_repository
createQuestionPoolAndCopyObject()
SettingsFactory $settings_factory
ilNavigationHistory $navigation_history
insertQuestionsObject(?array $selected_array=null)
ExportImportFactory $export_factory
TitleColumnsBuilder $title_builder
getTargetQuestionpoolForm($questionpools, string $cmd)
QuestionsTableActions $table_actions
importFile(string $file_to_import, string $path_to_uploaded_file_in_temp_dir)
participantsActionObject()
Evaluates the actions on the participants page.
isCommandClassAnyInfoScreenChild()
TaxonomyService $taxonomy
protectByWritePermission()
executeCommand()
execute command
QPLRequestDataCollector $qplrequest
bool $create_question_mode
fetchAuthoringQuestionIdParameter()
getObjectiveOrientedContainer()
ilTestObjectiveOrientedContainer $objective_oriented_container
determineObjectiveOrientedContainer()
getTestScreenGUIInstance()
ilTestQuestionSetConfigFactory $test_question_set_config_factory
SkillUsageService $skill_usage_service
getQuestionsTableActions()
forwardCommandToQuestionPreview(string $cmd, ?assQuestionGUI $question_gui=null)
ResultsDataFactory $results_data_factory
ilTestParticipantAccessFilterFactory $participant_access_filter_factory
forwardCommandToQuestion(string $cmd)
MarkSchemaFactory $mark_schema_factory
afterSave(ilObject $new_object)
save object @access public
populateQuestionBrowserToolbarButtons(ilToolbarGUI $toolbar)
TestQuestionsRepository $test_questions_repository
AdditionalInformationGenerator $additional_information_generator
ilTestSessionFactory $test_session_factory
showTemplatesObject(?Modal $modal=null)
downloadFileObject()
download file
const QUESTION_CREATION_POOL_SELECTION_NO_POOL
copyAndLinkQuestionsToPoolObject(?int $ref_id=null, array $question_ids=[])
copyQuestionsToPoolObject()
copyToQuestionpoolObject()
buildQuestionCreationForm()
executeTemplatesActionObject()
setupToolBarAndMessage(bool $has_started_test_runs)
copyQuestionsToPool(array $question_ids, int $qpl_id)
getTabs()
adds tabs to tab gui object
questionsTabGatewayObject()
const QUESTION_CREATION_POOL_SELECTION_EXISTING_POOL
fullscreenObject()
show fullscreen view
GlobalScreen $global_screen
buildPersonalSettingsTable()
cancelCreateQuestionObject()
ContentStyle $content_style
copyQuestionToPool(assQuestionGUI $source_question_gui, ilObjQuestionPool $target_pool)
createQuestionFormObject(?Form $form=null)
executeAfterQuestionSaveTasks(assQuestionGUI $question_gui)
exportObject()
Gateway for exports initiated from workspace, as there is a generic forward to {objTypeMainGUI}::expo...
redirectAfterMissingWrite()
buildInputPosition(array $questions)
setTestAccess(ilTestAccess $test_access)
buildPersonalSettingsCreateAction()
ilObjectDataCache $obj_data_cache
ScoreSettingsRepository $score_settings_repository
removeImportFailsObject()
DataFactory $data_factory
const QUESTION_CREATION_POOL_SELECTION_NEW_POOL
ilComponentFactory $component_factory
redirectTo_SettingsMainGUI_showForm_Object()
PersonalSettingsExporter $personal_settings_exporter
QuestionsTableQuery $table_query
importVerifiedFileObject(bool $skip_retrieve_selected_questions=false)
imports question(s) into the questionpool (after verification)
ilTestAccess $test_access
ResultsPresentationFactory $results_presentation_factory
certificateObject()
Shows the certificate editor.
TabsManager $tabs_manager
const QUESTION_SET_TYPE_FIXED
GUI class for the workflow of copying objects.
Class ilObjectGUI Basic methods of all Output classes.
static _gotoRepositoryRoot(bool $raise_error=false)
Goto repository root.
setCreationMode(bool $mode=true)
If true, a creation screen is displayed the current [ref_id] does belong to the parent class The mode...
addHeaderAction()
Add header action menu.
prepareOutput(bool $show_sub_objects=true)
Class ilObject Basic functions for all objects.
static _lookupObjId(int $ref_id)
static _lookupTitle(int $obj_id)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static get(string $a_var)
static clear(string $a_var)
static set(string $a_var, $a_val)
Set a value.
Output class for assessment test evaluation.
Base Exception for all Exceptions relating to Modules/Test.
Export User Interface Class.
Class that handles PDF generation for test and assessment.
Importer class for files.
@ilCtrl_Calls ilTestPageGUI: ilPageEditorGUI, ilEditClipboardGUI, ilMDEditorGUI @ilCtrl_Calls ilTestP...
Class ilTestParticipantsGUI.
@ilCtrl_Calls ilTestQuestionBrowserTableGUI: ilFormPropertyDispatchGUI
const CMD_BROWSE_QUESTIONS
Service GUI class for tests.
This class represents a text area property in a property form.
This class represents a text property in a property form.
Class ilUnitConfigurationRepository.
static stripSlashes(string $a_str, bool $a_strip_html=true, string $a_allow="")
static redirect(string $a_script)
static deliverData(string $a_data, string $a_filename, string $mime="application/octet-stream")
This describes commonalities between the different modals.
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...
static http()
Fetches the global http state from ILIAS.
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
trait TestQuestionsImportTrait
buildImportQuestionsSelectionForm(string $form_cmd, string $importdir, string $qtifile, ?string $path_to_uploaded_file_in_temp_dir=null)
buildImportDirectoriesFromImportFile(string $file_to_import)
buildResultsFilePath(string $importdir, string $subdir)
retrieveSelectedQuestionsFromImportQuestionsSelectionForm(string $form_cmd, string $importdir, string $qtifile, ServerRequestInterface $request)
TestAdministrationInteractionTypes
TestQuestionAdministrationInteractionTypes
if(!file_exists('../ilias.ini.php'))