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());
561 if (!$this->test_access->checkOtherParticipantsLearningProgressAccess()
562 && !$this->getTestObject()->canShowTestResults($test_session)) {
563 $this->tpl->setOnScreenMessage(
565 $this->
lng->txt(
'tst_res_tab_msg_no_lp_access'),
571 $this->
ctrl->forwardCommand($new_gui);
575 case "ilcertificategui":
576 if ((!$this->
access->checkAccess(
"read",
"", $this->testrequest->getRefId()))) {
582 $this->tabs_manager->activateTab(TabsManager::TAB_ID_SETTINGS);
587 $this->
ctrl->forwardCommand($output_gui);
590 case strtolower(ConsecutiveScoringGUI::class):
591 if ((!$this->
access->checkAccess(
"read",
"", $this->testrequest->getRefId()))) {
594 $output_gui = $this->gui_factory->get(ConsecutiveScoringGUI::class, $this->
getTestObject());
596 $this->
ctrl->forwardCommand($output_gui);
601 case strtolower(MarkSchemaGUI::class):
602 if ((!$this->
access->checkAccess(
"read",
"", $this->testrequest->getRefId()))) {
616 $this->request_wrapper,
617 $this->response_handler,
622 $this->mark_schema_factory
624 $this->
ctrl->forwardCommand($mark_schema_gui);
628 $this->tabs_manager->activateTab(TabsManager::TAB_ID_SETTINGS);
629 $this->tabs_manager->activateSubTab(TabsManager::SETTINGS_SUBTAB_ID_MARK_SCHEMA);
633 case strtolower(SettingsMainGUI::class):
634 if ((!$this->
access->checkAccess(
"read",
"", $this->testrequest->getRefId()))) {
645 $this->obj_data_cache,
651 $this->component_repository,
655 $this->questionrepository
657 $this->
ctrl->forwardCommand($gui);
659 $this->tabs_manager->activateTab(TabsManager::TAB_ID_SETTINGS);
660 $this->tabs_manager->activateSubTab(TabsManager::SUBTAB_ID_GENERAL_SETTINGS);
664 case strtolower(SettingsScoringGUI::class):
665 if ((!$this->
access->checkAccess(
"read",
"", $this->testrequest->getRefId()))) {
676 $this->component_repository,
690 $this->
ctrl->forwardCommand($gui);
693 case 'iltestrandomquestionsetconfiggui':
694 if ((!$this->
access->checkAccess(
"read",
"", $this->testrequest->getRefId()))) {
718 $this->component_repository,
719 $this->obj_definition,
720 $this->obj_data_cache,
721 $test_process_locker_factory,
723 $this->title_builder,
724 $this->questionrepository
726 $this->
ctrl->forwardCommand($gui);
729 case 'iltestquestionbrowsertablegui':
730 if ((!$this->
access->checkAccess(
"read",
"", $this->testrequest->getRefId()))) {
740 $this->component_repository,
749 $this->questionrepository,
757 $this->
ctrl->forwardCommand($gui);
760 case 'iltestskilladministrationgui':
761 if ((!$this->
access->checkAccess(
"read",
"", $this->testrequest->getRefId()))) {
776 $this->component_repository,
778 $this->questionrepository,
782 $this->skill_usage_service,
788 $this->
ctrl->forwardCommand($gui);
791 case 'ilobjectcopygui':
792 if ((!$this->
access->checkAccess(
"copy",
"", $this->testrequest->getRefId()))) {
799 $this->
ctrl->forwardCommand($cp);
802 case strtolower(ilAssQuestionPreviewGUI::class):
803 if (!$this->
access->checkAccess(
'write',
'', $this->getTestObject()->getRefId())) {
809 case 'ilassquestionpagegui':
810 if ($cmd ===
'finishEditing') {
815 if ((!$this->
access->checkAccess(
"read",
"", $this->testrequest->getRefId()))) {
818 if ($cmd ===
'edit' && !$this->
access->checkAccess(
'write',
'', $this->testrequest->getRefId())) {
827 $this->questionrepository,
830 $forwarder->forward();
833 case 'ilassspecfeedbackpagegui':
834 if ((!$this->
access->checkAccess(
"write",
"", $this->testrequest->getRefId()))) {
838 $this->
ctrl->forwardCommand($pg_gui);
841 case 'ilassgenfeedbackpagegui':
842 if ((!$this->
access->checkAccess(
"write",
"", $this->testrequest->getRefId()))) {
846 $this->
ctrl->forwardCommand($pg_gui);
849 case 'illocalunitconfigurationgui':
850 if ((!$this->
access->checkAccess(
"write",
"", $this->testrequest->getRefId()))) {
857 $question = $question_gui->getObject();
859 $question_gui->setObject($question);
860 $question_gui->setQuestionTabs();
864 $this->
ctrl->forwardCommand($gui);
867 case "ilcommonactiondispatchergui":
868 if (!$this->
access->checkAccess(
"read",
"", $this->testrequest->getRefId()) && !$this->access->checkAccess(
"visible",
"", $this->testrequest->getRefId())) {
873 $this->
ctrl->forwardCommand($gui);
876 case 'ilassquestionfeedbackeditinggui':
877 if (!$this->
access->checkAccess(
'write',
'', $this->getTestObject()->getRefId())) {
883 $this->
ctrl->setReturnByClass(self::class, self::SHOW_QUESTIONS_CMD);
885 $question = $question_gui->getObject();
887 $question_gui->setObject($question);
888 $question_gui->setQuestionTabs();
889 $question_gui->setContextAllowsSyncToPool(
true);
894 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
'question_is_part_of_running_test'),
true);
909 $this->
ctrl->forwardCommand($gui);
912 case 'iltestcorrectionsgui':
913 if ((!$this->
access->checkAccess(
'read',
'', $this->testrequest->getRefId()))) {
930 $this->test_pass_result_repository
932 $this->
ctrl->forwardCommand($gui);
935 case 'iltestpagegui':
936 if ((!$this->
access->checkAccess(
"write",
"", $this->testrequest->getRefId()))) {
940 if ($cmd ===
'downloadFile') {
941 $page_id = $this->
object->getIntroductionPageId();
942 if ($this->testrequest->strVal(
'page_type') ===
'concludingremarkspage') {
943 $page_id = $this->
object->getConcludingRemarksPageId();
952 if (!$this->
access->checkAccess(
'read',
'', $this->testrequest->getRefId())
953 && !$this->access->checkAccess(
'visible',
'', $this->testrequest->getRefId())) {
959 if ($cmd ===
'testScreen') {
964 $local_cmd =
"{$cmd}Object";
966 if (!method_exists($this, $local_cmd)) {
967 $local_cmd = self::SHOW_QUESTIONS_CMD .
'Object';
973 if ((!$this->
access->checkAccess(
'read',
'', $this->testrequest->getRefId()))) {
978 [
'editQuestion',
'previewQuestion',
'save',
'saveReturn',
'uploadImage',
979 'removeImage',
'syncQuestion',
'syncQuestionReturn',
'suggestedsolution']
981 && !$this->
access->checkAccess(
'write',
'', $this->getTestObject()->getRefId())) {
984 if (in_array($cmd, [
'editQuestion',
'save',
'saveReturn',
'suggestedsolution'])
986 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
'question_is_part_of_running_test'),
true);
994 if (!in_array(strtolower($this->testrequest->raw(
'baseClass')), [
'iladministrationgui',
'ilrepositorygui'])
995 && $this->getCreationMode() !==
true) {
996 $this->tpl->printToStdout();
1002 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
'no_permission'),
true);
1003 $target_class = get_class($this->
object) .
'GUI';
1004 $this->
ctrl->setParameterByClass($target_class,
'ref_id', $this->ref_id);
1005 $this->
ctrl->redirectByClass($target_class);
1010 $this->tpl->setOnScreenMessage(
'failure', sprintf(
1011 $this->
lng->txt(
"msg_no_perm_read_item"),
1012 $this->object->getTitle()
1015 $this->
ctrl->redirectByClass(
'ilrepositorygui');
1022 $nr_of_participants_with_results = $this->
getTestObject()->evalTotalPersons();
1024 $this->
ctrl->saveParameterByClass(self::class,
'q_id');
1035 $this->global_screen,
1041 if ($nr_of_participants_with_results > 0) {
1042 $gui->addAdditionalCmd(
1043 $this->
lng->txt(
'tst_corrections_qst_form'),
1044 $this->ctrl->getLinkTargetByClass(ilTestCorrectionsGUI::class,
'showQuestion')
1052 if (!$this->
getTestObject()->isRandomTest() && $nr_of_participants_with_results === 0) {
1053 $gui->setPrimaryCmd(
1054 $this->
lng->txt(
'edit_question'),
1055 $this->ctrl->getLinkTargetByClass(
1056 get_class($question_gui),
1060 $gui->addAdditionalCmd(
1061 $this->
lng->txt(
'edit_page'),
1062 $this->ctrl->getLinkTargetByClass(
1063 ilAssQuestionPageGUI::class,
1071 $gui->initPreviewSession($this->
user->getId(), $this->testrequest->getQuestionId());
1072 $gui->initStyleSheets();
1074 $this->
ctrl->clearParameterByClass(self::class,
'q_id');
1075 $this->tabs_gui->setBackTarget(
1076 $this->
lng->txt(
'backtocallingtest'),
1077 $this->ctrl->getLinkTargetByClass(self::class, self::SHOW_QUESTIONS_CMD)
1079 $this->
ctrl->saveParameterByClass(self::class,
'q_id');
1080 $gui->{$cmd .
'Cmd'}();
1085 $this->tpl->setTitle(
1086 $this->
refinery->encode()->htmlSpecialCharsAsEntities()->transform(
1087 "{$this->getTestObject()->getTitle()}: {$question_title}"
1094 $this->create_question_mode =
true;
1095 $this->prepareOutput();
1098 $qid = $this->fetchAuthoringQuestionIdParameter();
1100 $this->
ctrl->setReturnByClass(self::class, self::SHOW_QUESTIONS_CMD);
1108 $question = $question_gui->getObject();
1109 $question->setObjId($this->getTestObject()->
getId());
1110 $question_gui->setObject($question);
1111 $question_gui->setContextAllowsSyncToPool(
true);
1112 $question_gui->setQuestionTabs();
1114 $this->addQuestionTitleToObjectTitle($question->getTitleForHTMLOutput());
1116 $target = strpos($cmd,
'Return') ===
false ?
'stay' :
'return';
1118 if (in_array($cmd, [
'syncQuestion',
'syncQuestionReturn'])) {
1119 $question_gui->syncQuestion();
1120 $this->showNextViewAfterQuestionSave($question_gui, $target);
1124 if ($question_gui->isSaveCommand()
1125 || $question_gui->cmdNeedsExistingQuestion($cmd)) {
1126 $question_gui = $this->addPostCreationTasksToQuestionGUI($question_gui);
1129 if ($qid === 0 && $question_gui->cmdNeedsExistingQuestion($cmd)) {
1130 $question_gui->getObject()->createNewQuestion();
1131 $question_gui->setQuestionTabs();
1132 $this->executeAfterQuestionCreationTasks($question_gui);
1135 if (!$question_gui->isSaveCommand()) {
1136 $this->
ctrl->forwardCommand($question_gui);
1140 if (!$question_gui->saveQuestion()) {
1144 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
'msg_obj_modified'),
true);
1146 $this->executeAfterQuestionCreationTasks($question_gui);
1148 $this->executeAfterQuestionSaveTasks($question_gui);
1149 $this->showNextViewAfterQuestionSave($question_gui, $target);
1151 $this->showQuestionsObject();
1158 if ($this->testrequest->isset(
'move_after_question_with_id')) {
1160 $this->testrequest->int(
'move_after_question_with_id')
1164 if ($this->testrequest->isset(
'pool_title')) {
1165 $question_gui->setCopyToNewPoolOnSave(
1166 $this->testrequest->strVal(
'pool_title')
1170 if ($this->testrequest->isset(
'pool_ref')) {
1171 $question_gui->setCopyToExistingPoolOnSave(
1172 $this->testrequest->int(
'pool_ref')
1175 return $question_gui;
1180 if ($this->getTestObject()->getTestLogger()->isLoggingEnabled()) {
1181 $this->getTestObject()->getTestLogger()->logQuestionAdministrationInteraction(
1182 $question_gui->
getObject()->toQuestionAdministrationInteraction(
1183 $this->getTestObject()->getTestLogger()->getAdditionalInformationGenerator(),
1184 $this->getTestObject()->getRefId(),
1185 TestQuestionAdministrationInteractionTypes::QUESTION_MODIFIED
1194 && !in_array($question_gui->
getObject()->getId(), $this->getTestObject()->getQuestions())) {
1195 $this->getTestObject()->insertQuestion($question_gui->
getObject()->getId(),
true);
1199 $this->getTestObject()->moveQuestions(
1202 ? $this->getTestObject()->getQuestions()[1]
1210 $original_id = $this->copyQuestionToPool(
1220 $original_id = $this->copyQuestionToPool(
1231 if ($target ===
'return') {
1232 $this->forwardCommandToQuestionPreview(
1238 if ($target ===
'stay') {
1239 $this->
ctrl->setParameterByClass(ilAssQuestionPreviewGUI::class,
'q_id', $question_gui->
getObject()->getId());
1240 $this->tabs_gui->setBackTarget(
1241 $this->
lng->txt(
'backtocallingpage'),
1242 $this->ctrl->getLinkTargetByClass(
1243 ilAssQuestionPreviewGUI::class,
1254 $this->getTestObject()->getType(),
1255 $this->getTestObject()->getRefId(),
1256 $this->getTestObject()->
getId(),
1257 $this->
user->getId()
1267 $this->
ctrl->redirectByClass(
'ilTestExportGUI');
1276 $qid = $this->testrequest->int(
'q_id');
1278 if ($qid === 0 || $this->getTestObject()->checkQuestionParent($qid)) {
1282 throw new ilTestException(
'question id does not relate to parent object!');
1287 if ($this->getTestObject()->isRandomTest()) {
1288 $this->
ctrl->redirectByClass(
'ilTestRandomQuestionSetConfigGUI');
1291 $this->
ctrl->redirectByClass(
'ilObjTestGUI', self::SHOW_QUESTIONS_CMD);
1296 $this->prepareOutput();
1297 $this->tabs_manager->getSettingsSubTabs();
1299 if ($this->request_wrapper->has(
'page_type')
1300 && $this->request_wrapper->retrieve(
1302 $this->refinery->kindlyTo()->string()
1303 ) ===
'introductionpage'
1305 $page_type =
'IntroductionPage';
1306 $this->tabs_manager->activateSubTab(TabsManager::SETTINGS_SUBTAB_ID_EDIT_INTRODUCTION_PAGE);
1307 $page_id = $this->getTestObject()->getIntroductionPageId();
1309 $page_type =
'ConcludingRemarksPage';
1310 $this->tabs_manager->activateSubTab(TabsManager::SETTINGS_SUBTAB_ID_EDIT_CONCLUSION_PAGE);
1311 $page_id = $this->getTestObject()->getConcludingRemarksPageId();
1313 $this->
ctrl->saveParameterByClass(ilTestPageGUI::class,
'page_type');
1316 $this->content_style->gui()->addCss($this->tpl, $this->ref_id);
1317 $this->tpl->setContent($this->
ctrl->forwardCommand($gui));
1319 if ($this->
ctrl->getCmdClass() === strtolower(ilTestPageGUI::class)) {
1320 $this->tabs_manager->activateTab(TabsManager::TAB_ID_SETTINGS);
1326 return $this->test_access;
1331 $this->test_access = $test_access;
1336 $this->prepareOutput();
1337 $this->addHeaderAction();
1339 $gui->setObjectiveOrientedContainer($this->getObjectiveOrientedContainer());
1340 $gui->setTestAccess($this->getTestAccess());
1342 $this->
ctrl->forwardCommand($gui);
1347 $this->
ctrl->redirectByClass(SettingsMainGUI::class, SettingsMainGUI::CMD_SHOW_FORM);
1352 $this->tpl->loadStandardTemplate();
1353 $this->setLocator();
1354 $this->setTitleAndDescription();
1359 $this->
ctrl->redirectByClass([ilRepositoryGUI::class, self::class, ilInfoScreenGUI::class]);
1362 protected function importFile(
string $file_to_import,
string $path_to_uploaded_file_in_temp_dir): void
1369 $unzip = $this->archives->unzip(Streams::ofResource(fopen($file_to_import,
'r')),
$options);
1372 if (!is_file($qtifile)) {
1374 $this->deleteUploadedImportFile($path_to_uploaded_file_in_temp_dir);
1375 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
'tst_import_non_ilias_zip'),
true);
1379 $qtiParser->startParsing();
1381 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
'import_file_not_valid'),
true);
1382 $this->
ctrl->redirect($this,
'create');
1384 $founditems = $qtiParser->getFoundItems();
1388 foreach ($founditems as $item) {
1389 if ($item[
"type"] !==
'') {
1396 if (count($founditems) && $complete == 0) {
1398 $this->deleteUploadedImportFile($path_to_uploaded_file_in_temp_dir);
1399 $this->tpl->setOnScreenMessage(
'info', $this->
lng->txt(
'qpl_import_non_ilias_files'));
1404 ilSession::set(
'path_to_uploaded_file_in_temp_dir', $path_to_uploaded_file_in_temp_dir);
1408 || $founditems === []) {
1409 $this->importVerifiedFileObject(
true);
1414 'importVerifiedFile',
1418 $path_to_uploaded_file_in_temp_dir
1421 if ($form ===
null) {
1425 $panel = $this->ui_factory->panel()->standard(
1426 $this->
lng->txt(
'import_tst'),
1428 $this->ui_factory->legacy()->content($this->lng->txt(
'qpl_import_verify_found_questions')),
1432 $this->tpl->setContent($this->ui_renderer->render($panel));
1433 $this->tpl->printToStdout();
1444 $new_object->saveToDb();
1446 if ($new_object->getTestLogger()->isLoggingEnabled()) {
1447 $new_object->getTestLogger()->logTestAdministrationInteraction(
1448 $new_object->getTestLogger()->getInteractionFactory()->buildTestAdministrationInteraction(
1450 $this->user->getId(),
1451 TestAdministrationInteractionTypes::NEW_TEST_CREATED,
1458 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
'object_added'),
true);
1460 $this->tpl->setOnScreenMessage(
'info', $this->
lng->txt(
$info),
true);
1462 $this->
ctrl->setParameter($this,
'ref_id', $new_object->
getRefId());
1463 $this->
ctrl->redirectByClass(SettingsMainGUI::class);
1469 $path = $this->tree->getPathFull($this->getTestObject()->getRefID());
1470 ilUtil::redirect($this->getReturnLocation(
"cancel",
"./ilias.php?baseClass=ilRepositoryGUI&cmd=frameset&ref_id=" .
$path[count(
$path) - 2][
"child"]));
1475 return $this->object;
1482 bool $skip_retrieve_selected_questions =
false
1484 if (!$this->checkPermissionBool(
'create',
'',
'tst')) {
1485 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
'no_permission'),
true);
1486 $this->
ctrl->returnToParent($this);
1489 $path_to_uploaded_file_in_temp_dir =
ilSession::get(
'path_to_uploaded_file_in_temp_dir');
1493 $new_obj->setTitle(
'dummy');
1494 $new_obj->setDescription(
'test import');
1495 $new_obj->create(
true);
1496 $new_obj->createReference();
1497 $new_obj->putInTree($this->testrequest->getRefId());
1498 $new_obj->setPermissions($this->testrequest->getRefId());
1499 $new_obj->saveToDb();
1501 $selected_questions = [];
1502 if (!$skip_retrieve_selected_questions) {
1504 'importVerifiedFile',
1511 ilSession::set(
'tst_import_selected_questions', $selected_questions);
1513 $imp =
new ilImport($this->testrequest->getRefId());
1514 $map = $imp->getMapping();
1515 $map->addMapping(
'components/ILIAS/Test',
'tst',
'new_id', (
string) $new_obj->getId());
1521 if (is_file($importdir . DIRECTORY_SEPARATOR .
'/manifest.xml')) {
1522 $imp->importObject($new_obj, $file_to_import, basename($file_to_import),
'tst',
'components/ILIAS/Test',
true);
1525 $test_importer->setImport($imp);
1527 $test_importer->setImportDirectory($importdir .
'/' . $subdir);
1528 $test_importer->init();
1530 $test_importer->importXmlRepresentation(
1538 if ($new_obj->getTestLogger()->isLoggingEnabled()) {
1539 $new_obj->getTestLogger()->logTestAdministrationInteraction(
1540 $new_obj->getTestLogger()->getInteractionFactory()->buildTestAdministrationInteraction(
1541 $new_obj->getRefId(),
1542 $this->user->getId(),
1543 TestAdministrationInteractionTypes::NEW_TEST_CREATED,
1550 $this->deleteUploadedImportFile($path_to_uploaded_file_in_temp_dir);
1554 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
"object_imported"),
true);
1557 if ($question_skill_assignments_import_fails->failedImportsRegistered()) {
1558 $this->tpl->setOnScreenMessage(
1560 $question_skill_assignments_import_fails->getFailedImportsMessage($this->lng),
1565 $this->
ctrl->setParameterByClass(ilObjTestGUI::class,
'ref_id', $new_obj->getRefId());
1566 $this->
ctrl->redirectByClass(ilObjTestGUI::class);
1574 $file = explode(
"_", $this->testrequest->raw(
"file_id"));
1575 $fileObj =
new ilObjFile((
int) $file[count($file) - 1],
false);
1576 $fileObj->sendFile();
1586 $page_gui->setFileDownloadLink(
1587 $this->
ctrl->getLinkTargetByClass(ilObjTestGUI::class,
'downloadFile')
1589 $page_gui->showMediaFullscreen();
1598 $pg_obj->sendParagraph($this->testrequest->raw(
"par_id"), $this->testrequest->raw(
"downloadtitle"));
1604 $parent_ref = $this->tree->getParentId($this->getTestObject()->getRefId());
1606 $qpl->setType(
"qpl");
1607 $qpl->setTitle($name);
1608 $qpl->setDescription($description);
1610 $qpl->createReference();
1611 $qpl->putInTree($parent_ref);
1612 $qpl->setPermissions($parent_ref);
1613 $qpl->getObjectProperties()->storePropertyIsOnline($qpl->getObjectProperties()->getPropertyIsOnline()->withOnline());
1618 public function createQuestionObject(): void
1620 $this->protectByWritePermission();
1622 $this->
ctrl->setReturnByClass(self::class, self::SHOW_QUESTIONS_CMD);
1624 $form = $this->buildQuestionCreationForm()->withRequest($this->request);
1625 $data_with_section = $form->getData();
1626 if ($data_with_section ===
null) {
1627 $this->createQuestionFormObject($form);
1630 $data = $data_with_section[0];
1632 $qpl_mode =
$data[
'pool_selection'][
'qpl_type'];
1634 if ($qpl_mode === self::QUESTION_CREATION_POOL_SELECTION_NEW_POOL
1635 && ! $this->userCanCreatePoolAtCurrentLocation()) {
1636 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
'permission_denied'),
true);
1637 $this->showQuestionsObject();
1641 if ($qpl_mode === self::QUESTION_CREATION_POOL_SELECTION_NEW_POOL &&
$data[
'pool_selection'][
'title'] ===
''
1642 || $qpl_mode === self::QUESTION_CREATION_POOL_SELECTION_EXISTING_POOL &&
$data[
'pool_selection'][
'pool_ref_id'] === 0) {
1643 $this->tpl->setOnScreenMessage(
'info', $this->
lng->txt(
"questionpool_not_entered"));
1644 $this->createQuestionFormObject($form);
1653 $question = $question_gui->getObject();
1654 $question->setAdditionalContentEditingMode(
$data[
'editing_type']);
1655 $question->setObjId($this->getTestObject()->
getId());
1656 $question_gui->setObject($question);
1657 $question_gui->setQuestionTabs();
1659 if (array_key_exists(
'position',
$data)) {
1660 $question_gui->setMoveAfterQuestionId(
$data[
'position']);
1663 if ($qpl_mode === self::QUESTION_CREATION_POOL_SELECTION_NEW_POOL) {
1664 $question_gui->setCopyToNewPoolOnSave(
$data[
'pool_selection'][
'title']);
1667 if ($qpl_mode === self::QUESTION_CREATION_POOL_SELECTION_EXISTING_POOL) {
1668 $question_gui->setCopyToExistingPoolOnSave(
$data[
'pool_selection'][
'pool_ref_id']);
1671 $question_gui->editQuestion();
1676 $this->
ctrl->redirect($this, self::SHOW_QUESTIONS_CMD);
1681 $this->protectByWritePermission();
1683 if (($selected_array ?? $this->testrequest->getQuestionIds()) === []) {
1684 $this->tpl->setOnScreenMessage(
'info', $this->
lng->txt(
'tst_insert_missing_question'),
true);
1685 $this->
ctrl->redirect($this,
'browseForQuestions');
1688 $this->getTestObject()->saveCompleteStatus($this->test_question_set_config_factory->getQuestionSetConfig());
1689 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
'tst_questions_inserted'),
true);
1690 $this->
ctrl->redirect($this, self::SHOW_QUESTIONS_CMD);
1696 $this->protectByWritePermission();
1698 $this->tabs_manager->getQuestionsSubTabs();
1699 $this->tabs_manager->activateSubTab(TabsManager::SUBTAB_ID_QST_LIST_VIEW);
1701 $sub_screen_id = [
'createQuestion'];
1703 $this->tabs_manager->activateTab(TabsManager::TAB_ID_QUESTIONS);
1704 $this->
help->setScreenId(
'assQuestions');
1705 $this->
help->setSubScreenId(implode(
'_', $sub_screen_id));
1707 $this->tpl->setContent(
1708 $this->ui_renderer->render(
1709 $form ?? $this->buildQuestionCreationForm()
1716 $inputs[
'question_type'] = $this->buildInputQuestionType();
1717 $questions = $this->getTestObject()->getQuestionTitlesAndIndexes();
1718 if ($questions !== []) {
1719 $inputs[
'position'] = $this->buildInputPosition($questions);
1722 $inputs[
'editing_type'] = $this->buildInputEditingType();
1725 $sub_screen_id[] =
'editMode';
1728 $sub_screen_id[] =
'poolSelect';
1730 $inputs[
'pool_selection'] = $this->buildInputPoolSelection();
1733 $this->ui_factory->input()->field()->section(
$inputs, $this->
lng->txt(
'ass_create_question'))
1736 $form = $this->ui_factory->input()->container()->form()->standard(
1737 $this->
ctrl->getFormAction($this,
'createQuestion'),
1739 )->withSubmitLabel($this->
lng->txt(
'create'));
1746 $question_types = (
new ilObjQuestionPool())->getQuestionTypes(
false,
true,
false);
1748 foreach ($question_types as $label =>
$data) {
1752 return $this->ui_factory->input()->field()->select(
1753 $this->
lng->txt(
'question_type'),
1755 )->withRequired(
true);
1761 foreach ($questions as $key => $title) {
1762 $options[$key] = $this->
lng->txt(
'behind') .
' ' . $title
1763 .
' [' . $this->
lng->txt(
'question_id_short') .
': ' . $key .
']';
1765 return $this->ui_factory->input()->field()->select(
1766 $this->
lng->txt(
'position'),
1768 )->withAdditionalTransformation($this->
refinery->kindlyTo()->int());
1773 if (!$this->getTestObject()->getGlobalSettings()->isPageEditorEnabled()) {
1774 return $this->ui_factory->input()->field()->hidden()->
withValue(
1779 return $this->ui_factory->input()->field()->radio($this->
lng->txt(
'tst_add_quest_cont_edit_mode'))
1782 $this->
lng->txt(
'tst_add_quest_cont_edit_mode_IPE'),
1783 $this->lng->txt(
'tst_add_quest_cont_edit_mode_IPE_info')
1786 $this->
lng->txt(
'tst_add_quest_cont_edit_mode_RTE'),
1787 $this->lng->txt(
'tst_add_quest_cont_edit_mode_RTE_info')
1794 $f = $this->ui_factory->input()->field();
1797 $trafo = $this->
refinery->custom()->transformation(
1798 static function ($values) use ($kt): array {
1799 $return[
'qpl_type'] = $kt->int()->
transform($values[0]);
1800 if ($return[
'qpl_type'] === self::QUESTION_CREATION_POOL_SELECTION_NO_POOL) {
1803 if ($return[
'qpl_type'] === self::QUESTION_CREATION_POOL_SELECTION_NEW_POOL) {
1804 return $return + [
'title' => $kt->string()->
transform($values[1][0])];
1807 'pool_ref_id' => $kt->int()->
transform($values[1][0])
1814 foreach ($questionpools as $key => $p) {
1815 $pools_data[$key] = $p[
'title'];
1819 self::QUESTION_CREATION_POOL_SELECTION_NO_POOL =>
$f->group([], $this->
lng->txt(
'assessment_no_pool')),
1820 self::QUESTION_CREATION_POOL_SELECTION_EXISTING_POOL =>
$f->group(
1823 $this->lng->txt(
'select_questionpool'),
1825 )->withRequired(
true)
1827 $this->lng->txt(
'assessment_existing_pool')
1831 if ($this->userCanCreatePoolAtCurrentLocation()) {
1832 $inputs[self::QUESTION_CREATION_POOL_SELECTION_NEW_POOL] =
$f->group(
1833 [
$f->text($this->lng->txt(
'name'))],
1834 $this->lng->txt(
'assessment_new_pool')
1838 return $f->switchableGroup(
1840 $this->
lng->txt(
'assessment_pool_selection')
1841 )->withAdditionalTransformation($trafo)
1842 ->withRequired(
true)
1848 $this->protectByWritePermission();
1850 if ($this->testrequest->raw(
'add')) {
1851 $this->addQuestion();
1855 $table_query = $this->getQuestionsTableQuery();
1857 if (!$this->getQuestionsTableActions()->handleCommand(
1860 fn() => $this->protectByWritePermission(),
1861 fn() => $this->createQuestionpoolTargetObject(
'copyAndLinkQuestionsToPool'),
1862 fn() => $this->getTable()
1868 $this->tpl->addBlockFile(
'ADM_CONTENT',
'adm_content',
'tpl.il_as_tst_questions.html',
'components/ILIAS/Test');
1870 $this->setupToolBarAndMessage($this->getTestObject()->evalTotalPersons() !== 0);
1872 $this->tabs_manager->getQuestionsSubTabs();
1873 $this->tabs_manager->activateSubTab(TabsManager::SUBTAB_ID_QST_LIST_VIEW);
1875 $this->tpl->setCurrentBlock(
'adm_content');
1876 $this->tpl->setVariable(
'ACTION_QUESTION_FORM', $this->
ctrl->getFormAction($this));
1877 $this->tpl->setVariable(
1879 $this->ui_renderer->render(
1880 $this->getTable()->getTableComponent()
1883 $this->tpl->parseCurrentBlock();
1888 $selected_array = [$this->testrequest->int(
'add')];
1889 $total = $this->getTestObject()->evalTotalPersons();
1892 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
'test_has_datasets_warning_page_view'));
1893 $this->showQuestionsObject();
1896 $this->tpl->setOnScreenMessage(
'info', $this->
lng->txt(
'tst_insert_questions'));
1897 $this->insertQuestionsObject($selected_array);
1902 if (!$this->
access->checkAccess(
'write',
'', $this->ref_id)
1903 || $this->getTestObject()->isRandomTest()) {
1907 if ($has_started_test_runs) {
1908 $link = $this->ui_factory->link()->standard(
1909 $this->
lng->txt(
'test_has_datasets_warning_page_view_link'),
1910 $this->ctrl->getLinkTargetByClass([\ilTestParticipantsGUI::class])
1913 $message = $this->
lng->txt(
'test_has_datasets_warning_page_view');
1914 $massage_box = $this->ui_factory->messageBox()->info($message)->withLinks([$link]);
1915 $this->tpl->setCurrentBlock(
'pax_info_message');
1916 $this->tpl->setVariable(
1918 $this->ui_renderer->render($massage_box)
1920 $this->tpl->parseCurrentBlock();
1924 $this->
toolbar->addButton($this->
lng->txt(
'ass_create_question'), $this->ctrl->getLinkTarget($this,
'createQuestionForm'));
1925 $this->
toolbar->addSeparator();
1926 $this->populateQuestionBrowserToolbarButtons($this->
toolbar);
1931 $this->
ctrl->setParameterByClass(
1932 ilTestQuestionBrowserTableGUI::class,
1938 $this->
lng->txt(
'tst_browse_for_qpl_questions'),
1939 $this->ctrl->getLinkTargetByClass(
1940 ilTestQuestionBrowserTableGUI::class,
1945 $this->
ctrl->setParameterByClass(
1946 ilTestQuestionBrowserTableGUI::class,
1952 $this->
lng->txt(
'tst_browse_for_tst_questions'),
1953 $this->ctrl->getLinkTargetByClass(
1954 ilTestQuestionBrowserTableGUI::class,
1966 if (!$this->getTestObject()->getTestLogger()->isLoggingEnabled()
1967 || !$this->rbac_review->isAssigned($this->user->getId(),
SYSTEM_ROLE_ID)
1968 && !$this->access->checkAccess(
'tst_history_read',
'', $this->getTestObject()->getRefId())) {
1969 $this->redirectAfterMissingWrite();
1972 $here_uri = $this->data_factory->uri(ILIAS_HTTP_PATH
1973 .
'/' . $this->
ctrl->getLinkTargetByClass(self::class, self::SHOW_LOGS_CMD));
1974 list($url_builder, $action_parameter_token, $row_id_token) = (
new URLBuilder($here_uri))->acquireParameters(
1975 LogTable::QUERY_PARAMETER_NAME_SPACE,
1976 LogTable::ACTION_TOKEN_STRING,
1977 LogTable::ENTRY_TOKEN_STRING
1980 if ($this->request_wrapper->has($action_parameter_token->getName())) {
1981 $this->getTestObject()->getTestLogViewer()->executeLogTableAction(
1983 $action_parameter_token,
1985 $this->getTestObject()->getRefId()
1990 $this->ui_factory->button()->standard(
1991 $this->lng->txt(
'export_legacy_logs'),
1992 $this->ctrl->getLinkTargetByClass(self::class,
'exportLegacyLogs')
1995 $this->tabs_manager->activateTab(TabsManager::TAB_ID_HISTORY);
1997 list($filter, $table_gui) = $this->getTestObject()->getTestLogViewer()->getLogTable(
1999 $action_parameter_token,
2001 $this->getTestObject()->getRefId()
2004 $this->tpl->setVariable(
'ADM_CONTENT', $this->ui_renderer->render([$filter, $table_gui]));
2009 $this->protectByWritePermission();
2011 $csv_output = $this->getTestObject()->getTestLogViewer()->getLegacyLogExportForObjId($this->getTestObject()->
getId());
2015 "legacy_logs_for_{$this->getTestObject()->getRefId()}.csv"
2024 $command = $this->testrequest->strVal(
'command');
2025 if ($command ===
'') {
2026 $method = $command .
'Object';
2027 if (method_exists($this, $method)) {
2032 $this->
ctrl->redirect($this,
'participants');
2038 $this->protectByWritePermission();
2040 $this->tabs_manager->activateTab(TabsManager::TAB_ID_SETTINGS);
2042 $create_input = $this->buildPersonalSettingsCreateAction()
2043 ->buildModal($this->
ctrl->getLinkTargetByClass(self::class,
'createTemplate'));
2044 $import_input = $this->buildPersonalSettingsImportAction()
2045 ->buildModal($this->
ctrl->getLinkTargetByClass(self::class,
'importTemplate'));
2048 $this->ui_factory->button()->standard(
2049 $this->lng->txt(
'personal_settings_create'),
2050 $create_input->getShowSignal()
2054 $this->ui_factory->button()->standard(
2055 $this->lng->txt(
'personal_settings_import'),
2056 $import_input->getShowSignal()
2061 $this->buildPersonalSettingsTable()->getComponent(),
2067 $this->tpl->setContent(
2068 $this->ui_renderer->render(array_filter(
$components))
2074 $this->protectByWritePermission();
2077 $this->buildPersonalSettingsCreateAction()
2078 ->perform($this->getTestObject()->getTestId(), $this->request);
2079 }
catch (\InvalidArgumentException
$e) {
2080 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt($e->getMessage()),
true);
2083 $this->
ctrl->redirectByClass(self::class,
'showTemplates');
2088 $this->protectByWritePermission();
2091 $this->buildPersonalSettingsImportAction()
2092 ->perform($this->request);
2094 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
'personal_settings_import_success'),
true);
2095 }
catch (\InvalidArgumentException
$e) {
2096 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt($e->getMessage()),
true);
2099 $this->
ctrl->redirectByClass(self::class,
'showTemplates');
2104 $this->protectByWritePermission();
2106 $modal = $this->buildPersonalSettingsTable()->perform();
2107 if ($modal !==
null) {
2108 $this->showTemplatesObject($modal);
2111 $this->
ctrl->redirectByClass(self::class,
'showTemplates');
2120 $this->personal_settings_templates_repository,
2121 $this->main_settings_repository,
2122 $this->score_settings_repository,
2123 $this->marks_repository
2132 $this->data_factory,
2133 $this->temp_file_system,
2134 $this->personal_settings_templates_repository,
2135 $this->main_settings_repository,
2136 $this->score_settings_repository,
2137 $this->marks_repository
2145 $this->response_handler,
2150 $this->personal_settings_templates_repository,
2156 $this->personal_settings_templates_repository,
2157 $this->main_settings_repository,
2158 $this->score_settings_repository,
2159 $this->marks_repository,
2160 $this->additional_information_generator
2165 $this->test_question_set_config_factory,
2167 $this->getTestObject(),
2168 $this->personal_settings_templates_repository,
2169 $this->main_settings_repository,
2170 $this->score_settings_repository,
2171 $this->marks_repository
2176 $this->personal_settings_exporter
2182 $this->personal_settings_templates_repository,
2183 $this->marks_repository
2188 $uri = $this->
ctrl->getLinkTargetByClass(self::class,
'executeTemplatesAction',
'',
true);
2192 $this->data_factory,
2196 new URLBuilder($this->data_factory->uri(ILIAS_HTTP_PATH .
'/' . $uri)),
2197 $this->personal_settings_templates_repository,
2204 $this->
ctrl->getCmdClass(),
2206 strtolower(PublicProfileGUI::class),
2218 $this->
ctrl->redirectByClass(
2219 [ilRepositoryGUI::class, self::class, ilInfoScreenGUI::class]
2225 if (!$this->
access->checkAccess(
'visible',
'', $this->ref_id)
2226 && !$this->access->checkAccess(
'read',
'', $this->ref_id)) {
2227 $this->redirectAfterMissingRead();
2230 if ($this->getTestObject()->getMainSettings()->getAdditionalSettings()->getHideInfoTab()) {
2231 $this->
ctrl->redirectByClass([self::class, TestScreenGUI::class], TestScreenGUI::DEFAULT_CMD);
2234 $this->tabs_manager->activateTab(TabsManager::TAB_ID_INFOSCREEN);
2236 if ($this->
access->checkAccess(
'read',
'', $this->ref_id)) {
2237 $this->trackTestObjectReadEvent();
2241 if ($this->isCommandClassAnyInfoScreenChild()) {
2246 $this->getTestObject(),
2247 $this->test_player_factory->getPlayerGUI(),
2248 $this->test_question_set_config_factory->getQuestionSetConfig(),
2249 $this->test_session_factory->getSession(),
2260 $toolbar->setCloseFormTag(
false);
2262 $toolbar->setSessionLockString(
'');
2264 $toolbar->sendMessages();
2266 $info->enablePrivateNotes();
2268 $info->addSection($this->
lng->txt(
'tst_general_properties'));
2270 $this->
lng->txt(
'author'),
2271 $this->refinery->encode()->htmlSpecialCharsAsEntities()->transform(
2272 $this->getTestObject()->getAuthor()
2276 $this->
lng->txt(
'title'),
2277 $this->refinery->encode()->htmlSpecialCharsAsEntities()->transform(
2278 $this->getTestObject()->getTitle()
2282 if ($this->type !==
'tst') {
2283 $info->hideFurtherSections(
false);
2286 if ($this->getTestObject()->getEnableProcessingTime()) {
2287 $info->addProperty($this->
lng->txt(
'tst_processing_time'), $this->getTestObject()->getProcessingTime());
2290 $starting_time = $this->getTestObject()->getStartingTime();
2291 if ($this->getTestObject()->isStartingTimeEnabled() && $starting_time !== 0) {
2294 $ending_time = $this->getTestObject()->getEndingTime();
2295 if ($this->getTestObject()->isEndingTimeEnabled() && $ending_time != 0) {
2298 $info->addMetaDataSections($this->getTestObject()->
getId(), 0, $this->getTestObject()->getType());
2306 $qsaImportFails->deleteRegisteredImportFails();
2308 $sltImportFails->deleteRegisteredImportFails();
2310 $this->
ctrl->redirectByClass([ilRepositoryGUI::class, self::class, ilInfoScreenGUI::class]);
2315 switch ($this->
ctrl->getCmd()) {
2318 case "redirectToInfoScreen":
2325 case "outCorrectSolution":
2326 case "showAnswersOfUser":
2327 case "outUserResultsOverview":
2328 case "backFromSummary":
2329 case "show_answers":
2332 case "outTestSummary":
2333 case "outQuestionSummary":
2334 case "gotoQuestion":
2335 case "selectImagemapRegion":
2336 case "confirmSubmitAnswers":
2337 case "finalSubmission":
2339 case "outUserPassDetails":
2340 case "checkPassword":
2342 $this->getTestObject()->
getTitle(),
2343 $this->
ctrl->getLinkTargetByClass(
2344 [self::class, TestScreenGUI::class],
2345 TestScreenGUI::DEFAULT_CMD
2348 $this->testrequest->getRefId()
2352 case "evalAllUsers":
2353 case "evalUserDetail":
2355 $this->getTestObject()->
getTitle(),
2356 $this->
ctrl->getLinkTarget($this,
'eval_stat'),
2358 $this->testrequest->getRefId()
2363 case "importVerifiedFile":
2364 case "cancelImport":
2368 $this->getTestObject()->
getTitle(),
2369 $this->
ctrl->getLinkTargetByClass(
2370 [self::class, TestScreenGUI::class],
2371 TestScreenGUI::DEFAULT_CMD
2374 $this->testrequest->getRefId()
2389 $this->tabs_manager->activateTab(TabsManager::TAB_ID_SETTINGS);
2392 $output_gui = $guiFactory->create($this->getTestObject());
2394 $output_gui->certificateEditor();
2404 $this->
help->setScreenIdComponent(
"tst");
2406 if ($this->tabs_manager ===
null) {
2410 if ($this->getObjectiveOrientedContainer()->isObjectiveOrientedPresentationRequired()) {
2411 $courseLink = ilLink::_getLink($this->getObjectiveOrientedContainer()->getRefId());
2412 $this->tabs_manager->setParentBackLabel($this->
lng->txt(
'back_to_objective_container'));
2413 $this->tabs_manager->setParentBackHref($courseLink);
2416 $this->tabs_manager->perform();
2419 public static function accessViolationRedirect()
2423 $main_tpl =
$DIC->ui()->mainTemplate();
2425 $main_tpl->setOnScreenMessage(
'failure',
$DIC->language()->txt(
"no_permission"),
true);
2426 $DIC->ctrl()->redirectByClass(TestScreenGUI::class, TestScreenGUI::DEFAULT_CMD);
2438 $main_tpl =
$DIC->ui()->mainTemplate();
2439 $ilAccess =
$DIC[
'ilAccess'];
2443 if ($ilAccess->checkAccess(
'read',
'', (
int) $target)
2444 || $ilAccess->checkAccess(
'visible',
'', (
int) $target)) {
2445 $DIC->ctrl()->setParameterByClass(self::class,
'ref_id', (
int) $target);
2446 $DIC->ctrl()->redirectByClass(
2448 ilRepositoryGUI::class,
2449 ilObjTestGUI::class,
2450 TestScreenGUI::class
2452 TestScreenGUI::DEFAULT_CMD
2455 $main_tpl->setOnScreenMessage(
'info', sprintf(
2456 $lng->txt(
'msg_no_perm_read_item'),
2467 $this->copyQuestionsToPool($this->testrequest->raw(
'q_id'), $this->testrequest->raw(
'sel_qpl'));
2468 $this->
ctrl->redirect($this, self::SHOW_QUESTIONS_CMD);
2479 foreach ($question_ids as $q_id) {
2480 $new_id = $this->copyQuestionToPool(assQuestion::instantiateQuestionGUI($q_id), $target_pool);
2481 $new_ids[$q_id] = $new_id;
2484 $result =
new stdClass();
2485 $result->ids = $new_ids;
2486 $result->qpoolid = $qpl_id;
2494 $source_question_gui->
getObject()->getTitle()
2497 return $source_question_gui->
getObject()->createNewOriginalFromThisDuplicate($target_pool->
getId(), $new_title);
2502 array $question_ids = []
2508 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
"questionpool_not_selected"));
2509 $this->showQuestionsObject();
2513 $qpl_id = $this->obj_data_cache->lookupObjId(
$ref_id);
2516 if ($question_ids === []) {
2517 $question_ids = $this->testrequest->getQuestionIds();
2518 $question_id = $this->testrequest->getQuestionId();
2519 if ($question_ids === [] && $question_id !== 0) {
2520 $question_ids = [$question_id];
2524 if ($question_ids === []) {
2525 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
"tst_no_question_selected_for_moving_to_qpl"));
2526 $this->
ctrl->redirect($this,
'questions');
2529 $result = $this->copyQuestionsToPool($question_ids, $qpl_id);
2531 foreach ($result->ids as $oldId => $newId) {
2534 $original_question_id = $questionInstance->getOriginalId();
2535 if ($original_question_id !==
null
2536 && $this->test_questions_repository->originalQuestionExists($original_question_id)) {
2538 $oldOriginal->delete($oldOriginal->getId());
2543 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
'tst_qst_added_to_pool_' . (count($result->ids) > 1 ?
'p' :
's')),
true);
2544 $this->
ctrl->redirect($this, self::SHOW_QUESTIONS_CMD);
2549 $this->createQuestionpoolTargetObject(
'copyQuestionsToPool');
2554 if (!$this->
access->checkAccess(
'write',
'', $this->object->getRefId())
2555 || !$this->checkPermissionBool(
'create',
'',
'qpl')) {
2556 $this->redirectAfterMissingWrite();
2559 if ($this->testrequest->raw(
'title')) {
2560 $title = $this->testrequest->raw(
'title');
2562 $title = $this->testrequest->raw(
'txt_qpl');
2566 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
'questionpool_not_entered'));
2567 $this->createQuestionpoolTargetObject(
'createQuestionPoolAndCopy');
2571 $question_pool = $this->createQuestionPool($title, $this->testrequest->raw(
'description'));
2572 $_REQUEST[
'sel_qpl'] = $question_pool->getRefId();
2574 $this->copyAndLinkQuestionsToPoolObject();
2583 $this->protectByWritePermission();
2585 $this->tabs_manager->getQuestionsSubTabs();
2586 $this->tabs_manager->activateSubTab(TabsManager::SUBTAB_ID_QST_LIST_VIEW);
2588 $questionpools = $this->getTestObject()->getAvailableQuestionpools(
2597 if ($questionpools === []) {
2598 $form = $this->getTargetQuestionpoolForm($questionpools,
'createQuestionPoolAndCopy');
2600 $form = $this->getTargetQuestionpoolForm($questionpools, $cmd);
2603 case 'copyQuestionsToPool':
2606 case 'copyAndLinkQuestionsToPool':
2608 $hidden->setValue(
'1');
2609 $form->addItem($hidden);
2614 $this->tpl->setContent($form->getHTML());
2620 $form->setFormAction($this->
ctrl->getFormAction($this));
2621 $form->addCommandButton($cmd, $this->
lng->txt(
'submit'));
2622 $form->addCommandButton(
'cancelCreateQuestion', $this->
lng->txt(
'cancel'));
2624 if (count($questionpools) == 0) {
2625 $form->setTitle($this->
lng->txt(
"tst_enter_questionpool"));
2628 $title->setRequired(
true);
2629 $form->addItem($title);
2632 $form->addItem($description);
2634 $form->setTitle($this->
lng->txt(
"tst_select_questionpool"));
2637 '' => $this->
lng->txt(
'please_select')
2640 foreach ($questionpools as $key => $value) {
2641 $selectOptions[$key] = $value[
"title"];
2645 $select->setRequired(
true);
2646 $select->setOptions($selectOptions);
2648 $form->addItem($select);
2651 $table_query = $this->getQuestionsTableQuery();
2653 $question_ids = $table_query->
getRowIds($this->
object);
2654 } elseif ($this->testrequest->isset(
'q_id') && is_array($this->testrequest->raw(
'q_id'))) {
2655 $question_ids = $this->testrequest->raw(
'q_id');
2658 foreach ($question_ids as
$id) {
2660 $hidden->setValue((
string)
$id);
2661 $form->addItem($hidden);
2669 if (!$this->
access->checkAccess(
'write',
'', $this->ref_id)) {
2670 $this->tpl->setOnScreenMessage(
'info', $this->
lng->txt(
'cannot_edit_test'),
true);
2671 $this->
ctrl->redirectByClass([ilRepositoryGUI::class, self::class, ilInfoScreenGUI::class]);
2681 $path = $this->tree->getPathFull($this->ref_id);
2683 while ($parent = array_pop(
$path)) {
2684 if ($parent[
'type'] ===
'crs') {
2685 $container_ref_id = $parent[
'ref_id'];
2692 $this->objective_oriented_container->setObjId($container_obj_id);
2693 $this->objective_oriented_container->setRefId($container_ref_id);
2698 return $this->objective_oriented_container;
2704 $this->getTestObject(),
2712 $this->content_style,
2714 $this->tabs_manager,
2724 if ($this->table_query ===
null) {
2725 $id = $this->
object ? $this->
object->getId() :
'';
2729 $this->data_factory,
2733 return $this->table_query;
2738 if ($this->table_actions ===
null) {
2744 $this->getQuestionsTableQuery(),
2747 $this->test_questions_repository,
2748 new QuestionPrinter(
2751 $this->tabs_manager,
2758 $this->getTestObject()
2761 $this->getTestObject()->getGlobalSettings()->isAdjustingQuestionsWithResultsAllowed(),
2762 $this->getTestObject()->evalTotalPersons() !== 0,
2763 $this->getTestObject()->isRandomTest(),
2764 $this->test_question_set_config_factory
2767 return $this->table_actions;
2775 $this->
http->request(),
2776 $this->getQuestionsTableActions(),
2779 $this->test_questions_repository,
2780 $this->title_builder
2786 return $this->
settings->get(
'obj_dis_creation_qpl') !==
'1'
2787 && $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.
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'))