21 require_once
'./Modules/Test/classes/inc.AssessmentConstants.php';
65 'ilpublicuserprofilegui',
'ilobjportfoliogui' 106 $ilCtrl = $DIC[
'ilCtrl'];
107 $ilDB = $DIC[
'ilDB'];
108 $component_repository = $DIC[
'component.repository'];
109 $tree = $DIC[
'tree'];
116 $DIC[
'http']->request()
120 $this->error = $DIC[
'ilErr'];
121 $this->
ctrl = $ilCtrl;
122 $this->
ctrl->saveParameter($this, array(
"ref_id",
"test_ref_id",
"calling_test",
"test_express_mode",
"q_id"));
123 $this->testrequest = $DIC->test()->internal()->request();
124 if ($this->testrequest->hasRefId() && is_numeric($this->testrequest->getRefId())) {
125 $refId = $this->testrequest->getRefId();
129 if ($this->
object instanceof
ilObjTest) {
138 if ($this->
object instanceof ilObjTest) {
141 $tabsManager->setTestSession($this->testSessionFactory->getSession());
142 $tabsManager->setTestQuestionSetConfig($this->testQuestionSetConfigFactory->getQuestionSetConfig());
144 if ($this->
object->isDynamicTest()) {
146 $tabsManager->setHiddenTabs(array_merge($hidden_tabs, [
'manscoring',
'scoringadjust']));
158 $ilAccess = $DIC[
'ilAccess'];
159 $ilNavigationHistory = $DIC[
'ilNavigationHistory'];
160 $ilCtrl = $DIC[
'ilCtrl'];
163 $ilTabs = $DIC[
'ilTabs'];
164 $component_repository = $DIC[
'component.repository'];
165 $ilDB = $DIC[
'ilDB'];
166 $tree = $DIC[
'tree'];
169 $randomGroup = $DIC->refinery()->random();
171 $cmd = $this->
ctrl->getCmd(
"infoScreen");
173 $cmdsDisabledDueToOfflineStatus = array(
174 'resumePlayer',
'resumePlayer',
'outUserResultsOverview',
'outUserListOfAnswerPasses' 177 if (!$this->
getCreationMode() && $this->
object->getOfflineStatus() && in_array($cmd, $cmdsDisabledDueToOfflineStatus)) {
181 $next_class = $this->
ctrl->getNextClass($this);
185 $ilAccess->checkAccess(
"read",
"", $this->testrequest->getRefId())
187 $ilNavigationHistory->addItem(
188 $this->testrequest->getRefId(),
189 "ilias.php?baseClass=ilObjTestGUI&cmd=infoScreen&ref_id=" . $this->testrequest->getRefId(),
195 if ($this->testrequest->raw(
'prev_qid')) {
196 global $___prev_question_id;
197 $___prev_question_id = $this->testrequest->raw(
'prev_qid');
198 $this->
ctrl->setParameter($this,
'prev_qid', $this->testrequest->raw(
'prev_qid'));
201 if (!$this->
getCreationMode() && isset($this->testQuestionSetConfigFactory) && $this->testQuestionSetConfigFactory->getQuestionSetConfig()->areDepenciesBroken()) {
202 if (!$this->testQuestionSetConfigFactory->getQuestionSetConfig()->isValidRequestOnBrokenQuestionSetDepencies($next_class, $cmd)) {
203 $this->
ctrl->redirectByClass(
'ilObjTestGUI',
'infoScreen');
209 switch ($next_class) {
210 case 'illtiproviderobjectsettinggui':
211 if ((!$ilAccess->checkAccess(
"read",
"", $this->testrequest->getRefId()))) {
216 $this->tabsManager->getSettingsSubTabs();
217 $GLOBALS[
'DIC']->tabs()->activateTab(
'settings');
218 $GLOBALS[
'DIC']->tabs()->activateSubTab(
'lti_provider');
221 $lti_gui->offerLTIRolesForSelection(
false);
222 $this->
ctrl->forwardCommand($lti_gui);
226 case 'iltestexportgui':
227 if (!$ilAccess->checkAccess(
'write',
'', $this->ref_id)) {
237 case "ilinfoscreengui":
238 if (!$ilAccess->checkAccess(
"read",
"", $this->testrequest->getRefId()) && !$ilAccess->checkAccess(
"visible",
"", $this->testrequest->getRefId())) {
245 case 'ilobjectmetadatagui':
246 if (!$ilAccess->checkAccess(
'write',
'', $this->object->getRefId())) {
254 $this->
ctrl->forwardCommand($md_gui);
257 case 'iltestdashboardgui':
258 if ((!$ilAccess->checkAccess(
"read",
"", $this->testrequest->getRefId()))) {
265 $this->getTestObject(),
266 $this->testQuestionSetConfigFactory->getQuestionSetConfig()
273 $this->
ctrl->forwardCommand($gui);
276 case 'iltestresultsgui':
277 if ((!$ilAccess->checkAccess(
"read",
"", $this->testrequest->getRefId()))) {
284 $this->getTestObject(),
285 $this->testQuestionSetConfigFactory->getQuestionSetConfig()
289 $gui->setTestSession($this->testSessionFactory->getSession());
293 $this->
ctrl->forwardCommand($gui);
296 case "iltestplayerfixedquestionsetgui":
297 if ((!$ilAccess->checkAccess(
"read",
"", $this->testrequest->getRefId()))) {
301 if (!$this->
object->getKioskMode()) {
306 $this->
ctrl->forwardCommand($gui);
309 case "iltestplayerrandomquestionsetgui":
310 if ((!$ilAccess->checkAccess(
"read",
"", $this->testrequest->getRefId()))) {
314 if (!$this->
object->getKioskMode()) {
319 $this->
ctrl->forwardCommand($gui);
322 case "iltestevaluationgui":
323 if ((!$ilAccess->checkAccess(
"read",
"", $this->testrequest->getRefId()))) {
329 case "iltestevalobjectiveorientedgui":
330 if ((!$ilAccess->checkAccess(
"read",
"", $this->testrequest->getRefId()))) {
335 $this->forwardToEvalObjectiveOrientedGUI();
338 case "iltestservicegui":
339 if ((!$ilAccess->checkAccess(
"read",
"", $this->testrequest->getRefId()))) {
345 $this->
ctrl->forwardCommand($serviceGUI);
348 case 'ilpermissiongui':
349 if ((!$ilAccess->checkAccess(
"read",
"", $this->testrequest->getRefId()))) {
356 $ret = $this->
ctrl->forwardCommand($perm_gui);
359 case "illearningprogressgui":
360 if ((!$ilAccess->checkAccess(
"read",
"", $this->testrequest->getRefId()))) {
367 $this->
ctrl->forwardCommand($new_gui);
371 case "ilcertificategui":
372 if ((!$ilAccess->checkAccess(
"read",
"", $this->testrequest->getRefId()))) {
381 $output_gui = $guiFactory->create($this->
object);
383 $this->
ctrl->forwardCommand($output_gui);
386 case "iltestscoringgui":
387 if ((!$ilAccess->checkAccess(
"read",
"", $this->testrequest->getRefId()))) {
394 $this->
ctrl->forwardCommand($output_gui);
397 case 'ilmarkschemagui':
398 if ((!$ilAccess->checkAccess(
"read",
"", $this->testrequest->getRefId()))) {
401 if (!$ilAccess->checkAccess(
'write',
'', $this->object->getRefId())) {
402 $this->tpl->setOnScreenMessage(
'info', $this->
lng->txt(
'cannot_edit_test'),
true);
403 $this->
ctrl->redirect($this,
'infoScreen');
408 $this->
ctrl->forwardCommand($mark_schema_gui);
411 case 'iltestscoringbyquestionsgui':
412 if ((!$ilAccess->checkAccess(
"read",
"", $this->testrequest->getRefId()))) {
419 $this->
ctrl->forwardCommand($output_gui);
422 case 'ilobjtestsettingsgeneralgui':
423 if ((!$ilAccess->checkAccess(
"read",
"", $this->testrequest->getRefId()))) {
434 $component_repository,
438 $this->
ctrl->forwardCommand($gui);
441 case 'ilobjtestsettingsscoringresultsgui':
442 if ((!$ilAccess->checkAccess(
"read",
"", $this->testrequest->getRefId()))) {
453 $component_repository,
455 $DIC->ui()->mainTemplate(),
457 $this->getTestObject()->getScoreSettingsRepository(),
458 $this->getTestObject()->getTestId(),
466 $this->
ctrl->forwardCommand($gui);
469 case 'ilobjtestfixedquestionsetconfiggui':
470 if ((!$ilAccess->checkAccess(
"read",
"", $this->testrequest->getRefId()))) {
476 $this->
ctrl->forwardCommand($gui);
479 case 'iltestrandomquestionsetconfiggui':
480 if ((!$ilAccess->checkAccess(
"read",
"", $this->testrequest->getRefId()))) {
493 $component_repository,
494 $this->getTestObject(),
498 ))->withContextId($this->
object->getId())
500 $this->
ctrl->forwardCommand($gui);
503 case 'ilobjtestdynamicquestionsetconfiggui':
504 if ((!$ilAccess->checkAccess(
"read",
"", $this->testrequest->getRefId()))) {
510 $this->
ctrl->forwardCommand($gui);
513 case 'iltestquestionbrowsertablegui':
514 if ((!$ilAccess->checkAccess(
"read",
"", $this->testrequest->getRefId()))) {
526 $component_repository,
527 $this->getTestObject(),
534 $gui->
setWriteAccess($ilAccess->checkAccess(
"write",
"", $this->ref_id));
536 $this->
ctrl->forwardCommand($gui);
539 case 'iltestskilladministrationgui':
540 if ((!$ilAccess->checkAccess(
"read",
"", $this->testrequest->getRefId()))) {
545 $gui =
new ilTestSkillAdministrationGUI(
$ilias, $this->
ctrl, $ilAccess, $ilTabs, $this->tpl, $this->
lng, $this->
refinery,
$ilDB,
$tree, $component_repository, $this->getTestObject(), $this->ref_id);
546 $this->
ctrl->forwardCommand($gui);
549 case 'ilobjectcopygui':
550 if ((!$ilAccess->checkAccess(
"read",
"", $this->testrequest->getRefId()))) {
557 $this->
ctrl->forwardCommand($cp);
560 case 'ilpageeditorgui':
561 case 'iltestexpresspageobjectgui':
562 if ((!$ilAccess->checkAccess(
"read",
"", $this->testrequest->getRefId()))) {
568 $incompleteQuestionPurger->setOwnerId(
$ilUser->getId());
569 $incompleteQuestionPurger->purge();
578 if (!in_array($cmd, array(
'addQuestion',
'browseForQuestions'))) {
582 if (!$qid || in_array($cmd, array(
'insertQuestions',
'browseForQuestions'))) {
585 $ret = $this->
ctrl->forwardCommand($pageObject);
586 $this->tpl->setContent($ret);
589 $this->tpl->setCurrentBlock(
"ContentStyle");
590 $this->tpl->setVariable(
591 "LOCATION_CONTENT_STYLESHEET",
594 $this->tpl->parseCurrentBlock();
597 $this->tpl->setCurrentBlock(
"SyntaxStyle");
598 $this->tpl->setVariable(
599 "LOCATION_SYNTAX_STYLESHEET",
602 $this->tpl->parseCurrentBlock();
606 $this->
ctrl->setParameterByClass(
'iltestexpresspageobjectgui',
'q_id',
'');
607 $this->
ctrl->redirectByClass(
'iltestexpresspageobjectgui', $this->
ctrl->getCmd());
612 $q_gui->outAdditionalOutput();
613 $q_gui->object->setObjId($this->
object->getId());
615 $q_gui->setTargetGuiClass(null);
616 $q_gui->setQuestionActionCmd(null);
618 $question = $q_gui->object;
619 $this->
ctrl->saveParameter($this,
"q_id");
621 #$this->lng->loadLanguageModule("content"); 622 $this->
ctrl->setReturnByClass(
"ilTestExpressPageObjectGUI",
"view");
623 $this->
ctrl->setReturn($this,
"questions");
627 $page_gui->setEditPreview(
true);
628 $page_gui->setEnabledTabs(
false);
629 if (strlen($this->
ctrl->getCmd()) == 0) {
630 $this->
ctrl->setCmdClass(get_class($page_gui));
631 $this->
ctrl->setCmd(
"preview");
634 $page_gui->setQuestionHTML(array($q_gui->object->getId() => $q_gui->getPreview(
true)));
635 $page_gui->setTemplateTargetVar(
"ADM_CONTENT");
637 $page_gui->setOutputMode($this->
object->evalTotalPersons() == 0 ?
"edit" :
'preview');
639 $page_gui->setHeader($question->getTitleForHTMLOutput());
640 $page_gui->setFileDownloadLink($this->
ctrl->getLinkTarget($this,
"downloadFile"));
641 $page_gui->setFullscreenLink($this->
ctrl->getLinkTarget($this,
"fullscreen"));
642 $page_gui->setSourcecodeDownloadScript($this->
ctrl->getLinkTarget($this));
643 $page_gui->setPresentationTitle($question->getTitleForHTMLOutput() .
' [' . $this->
lng->txt(
'question_id_short') .
': ' . $question->getId() .
']');
644 $ret = $this->
ctrl->forwardCommand($page_gui);
650 $ilTabs = $DIC[
'ilTabs'];
651 $ilTabs->activateTab(
'assQuestions');
655 case 'ilassquestionpreviewgui':
656 if (!$ilAccess->checkAccess(
'write',
'', $this->object->getRefId())) {
661 $this->
ctrl->saveParameter($this,
"q_id");
677 $gui->initPreviewSettings($this->
object->getRefId());
678 $gui->initPreviewSession(
$ilUser->getId(), $this->testrequest->getQuestionId());
679 $gui->initHintTracking();
680 $gui->initStyleSheets();
682 $this->
ctrl->forwardCommand($gui);
686 case 'ilassquestionpagegui':
687 if ($cmd ==
'finishEditing') {
688 $this->
ctrl->redirectByClass(
'ilassquestionpreviewgui',
'show');
691 if ((!$ilAccess->checkAccess(
"read",
"", $this->testrequest->getRefId()))) {
694 if ($cmd ===
'edit' && !$ilAccess->checkAccess(
'write',
'', $this->testrequest->getRefId())) {
699 $forwarder->setTestObj($this->getTestObject());
700 $forwarder->forward();
703 case 'ilassspecfeedbackpagegui':
704 if ((!$ilAccess->checkAccess(
"read",
"", $this->testrequest->getRefId()))) {
708 $this->
ctrl->forwardCommand($pg_gui);
711 case 'ilassgenfeedbackpagegui':
712 if ((!$ilAccess->checkAccess(
"read",
"", $this->testrequest->getRefId()))) {
716 $this->
ctrl->forwardCommand($pg_gui);
719 case 'illocalunitconfigurationgui':
720 if ((!$ilAccess->checkAccess(
"read",
"", $this->testrequest->getRefId()))) {
726 $this->
ctrl->setReturn($this,
"questions");
728 $questionGUI->object->setObjId($this->
object->getId());
729 $questionGUI->setQuestionTabs();
733 $this->
ctrl->forwardCommand($gui);
736 case "ilcommonactiondispatchergui":
737 if (!$ilAccess->checkAccess(
"read",
"", $this->testrequest->getRefId()) && !$ilAccess->checkAccess(
"visible",
"", $this->testrequest->getRefId())) {
742 $this->
ctrl->forwardCommand($gui);
745 case 'ilassquestionhintsgui':
746 if (!$ilAccess->checkAccess(
'write',
'', $this->object->getRefId())) {
752 $this->
ctrl->setReturn($this,
"questions");
754 $questionGUI->object->setObjId($this->
object->getId());
755 $questionGUI->setQuestionTabs();
757 if ($questionGUI->object->isInActiveTest()) {
758 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
"question_is_part_of_running_test"),
true);
763 $gui->setEditingEnabled(
764 $DIC->access()->checkAccess(
'write',
'', $this->
object->getRefId())
767 $ilCtrl->forwardCommand($gui);
771 case 'ilassquestionfeedbackeditinggui':
772 if (!$ilAccess->checkAccess(
'write',
'', $this->object->getRefId())) {
778 $this->
ctrl->setReturn($this,
"questions");
780 $questionGUI->object->setObjId($this->
object->getId());
781 $questionGUI->setQuestionTabs();
783 if ($questionGUI->object->isInActiveTest()) {
784 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
"question_is_part_of_running_test"),
true);
788 $ilCtrl->forwardCommand($gui);
792 case 'iltestcorrectionsgui':
793 if ((!$ilAccess->checkAccess(
"read",
"", $this->testrequest->getRefId()))) {
798 $this->
ctrl->forwardCommand($gui);
803 if ((!$ilAccess->checkAccess(
"read",
"", $this->testrequest->getRefId()) && !$ilAccess->checkAccess(
"visible",
"", $this->testrequest->getRefId()))) {
808 if ((strcmp($cmd,
"properties") == 0) && ($this->testrequest->raw(
"browse"))) {
812 if ((strcmp($cmd,
"properties") == 0) && ($this->testrequest->raw(
"up") || $this->testrequest->raw(
"down"))) {
817 $ret = $this->$cmd();
820 if ((!$ilAccess->checkAccess(
"read",
"", $this->testrequest->getRefId()))) {
823 if (in_array($cmd, [
'editQuestion',
'save',
'suggestedsolution']) && !$ilAccess->checkAccess(
'write',
'', $this->object->getRefId())) {
827 if ($this->testrequest->raw(
'prev_qid')) {
828 global $___prev_question_id;
829 $___prev_question_id = $this->testrequest->raw(
'prev_qid');
830 $this->
ctrl->setParameterByClass(
'ilassquestionpagegui',
'prev_qid', $this->testrequest->raw(
'prev_qid'));
831 $this->
ctrl->setParameterByClass($this->testrequest->raw(
'sel_question_types') .
'gui',
'prev_qid', $this->testrequest->raw(
'prev_qid'));
833 $this->create_question_mode =
true;
836 $this->
ctrl->setReturn($this,
"questions");
847 $questionGui->object->setObjId($this->
object->getId());
849 if (in_array($cmd, [
'editQuestion',
'save',
'suggestedsolution']) && $questionGui->object->isInActiveTest()) {
850 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
"question_is_part_of_running_test"),
true);
854 $questionGuiClass = get_class($questionGui);
855 $this->
ctrl->setParameterByClass($questionGuiClass,
'prev_qid', $this->testrequest->raw(
'prev_qid'));
856 $this->
ctrl->setParameterByClass($questionGuiClass,
'test_ref_id', $this->testrequest->getRefId());
857 $this->
ctrl->setParameterByClass($questionGuiClass,
'q_id', $qid);
859 if ($this->testrequest->isset(
'test_express_mode')) {
860 $this->
ctrl->setParameterByClass($questionGuiClass,
'test_express_mode', 1);
863 $questionGui->setQuestionTabs();
865 $this->
ctrl->forwardCommand($questionGui);
867 if ($this->testrequest->isset(
'test_express_mode')) {
868 $this->
ctrl->redirect($this,
'showPage');
870 $this->
ctrl->redirect($this,
'questions');
875 if (!in_array(strtolower($this->testrequest->raw(
"baseClass")), array(
'iladministrationgui',
'ilrepositorygui')) &&
877 $this->tpl->printToStdout();
883 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
"no_permission"),
true);
884 $target_class = get_class($this->
object) .
"GUI";
885 $this->
ctrl->setParameterByClass($target_class,
'ref_id', $this->ref_id);
886 $this->
ctrl->redirectByClass($target_class);
891 $this->tpl->setOnScreenMessage(
'failure', sprintf(
892 $this->
lng->txt(
"msg_no_perm_read_item"),
893 $this->
object->getTitle()
896 $this->
ctrl->redirectByClass(
'ilrepositorygui');
905 $this->
object->getRefId(),
906 $this->
object->getId(),
907 $DIC->user()->getId()
918 $DIC->ctrl()->redirectByClass(
'ilTestExportGUI');
927 $qid = $this->testrequest->raw(
'q_id');
929 if (!$qid || $qid ==
'Array') {
930 $questions = $this->
object->getQuestionTitlesAndIndexes();
932 $keys = array_keys($questions);
935 $_REQUEST[
'q_id'] = $qid;
936 $_GET[
'q_id'] = $qid;
937 $_POST[
'q_id'] = $qid;
940 if ($this->
object->checkQuestionParent($qid)) {
944 throw new ilTestException(
'question id does not relate to parent object!');
949 if ($this->
object->isRandomTest()) {
950 $this->
ctrl->redirectByClass(
'ilTestRandomQuestionSetConfigGUI');
953 $this->
ctrl->redirectByClass(
'ilObjTestGUI',
'questions');
958 $this->
ctrl->setCmdClass(
'ilTestEvaluationGUI');
959 $this->
ctrl->setCmd(
'outUserResultsOverview');
960 $this->tabs_gui->clearTargets();
967 $this->
ctrl->redirectByClass(
969 ilRepositoryGUI::class,
971 ilTestResultsGUI::class,
972 ilParticipantsTestResultsGUI::class
1018 $this->
ctrl->forwardCommand($gui);
1031 $this->tpl->loadStandardTemplate();
1042 $this->
ctrl->redirect($this,
"infoScreen");
1047 $this->
ctrl->redirectByClass(
"iltestevaluationgui",
"outEvaluation");
1059 $form = $this->
initImportForm($this->testrequest->raw(
"new_type"));
1060 if ($form->checkInput()) {
1061 $this->
ctrl->setParameter($this,
"new_type", $this->type);
1067 $form->setValuesByPost();
1068 $this->tpl->setContent($form->getHTML());
1074 $defaults = $tst->getAvailableDefaults();
1075 if (count($defaults)) {
1076 foreach ($defaults as $row) {
1077 $options[
"tstdef_" . $row[
"test_defaults_id"]] = array($row[
"name"],
1078 $this->
lng->txt(
"tst_default_settings"));
1083 foreach ($templates as $item) {
1084 $options[
"tsttpl_" . $item[
"id"]] = array($item[
"title"],
1085 nl2br(trim($item[
"description"])));
1096 $new_object->saveToDb();
1100 $testDefaultsId = $tstdef;
1102 $new_object->applyDefaults($testDefaults);
1109 $template_settings = $template->getSettings();
1110 if ($template_settings) {
1116 $new_object->setTemplate($template_id);
1119 $new_object->saveToDb();
1122 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
"object_added"),
true);
1123 $this->
ctrl->setParameter($this,
'ref_id', $new_object->
getRefId());
1124 $this->
ctrl->redirectByClass(
'ilObjTestSettingsGeneralGUI');
1129 $path = $this->tree->getPathFull($this->
object->getRefID());
1138 if ($_FILES[
"xmldoc"][
"error"] > UPLOAD_ERR_OK) {
1139 $this->
lng->loadLanguageModule(
'file');
1140 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
'general_upload_error_occured'));
1141 $this->
ctrl->redirect($this,
'create');
1145 $file = pathinfo($_FILES[
"xmldoc"][
"name"]);
1146 $subdir = basename($file[
"basename"],
"." . $file[
"extension"]);
1148 if (strpos($subdir,
'tst') ===
false) {
1149 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
'import_file_not_valid'),
true);
1150 $this->
ctrl->redirect($this,
'create');
1156 $full_path = $basedir .
"/" . $_FILES[
"xmldoc"][
"name"];
1160 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
'import_file_not_valid'),
true);
1161 $this->
ctrl->redirect($this,
'create');
1172 if (!is_file($qti_file)) {
1174 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
"tst_import_non_ilias_zip"),
true);
1175 $this->
ctrl->redirect($this,
'create');
1179 $qtiParser->startParsing();
1180 $founditems = $qtiParser->getFoundItems();
1184 foreach ($founditems as $item) {
1185 if (strlen($item[
"type"])) {
1192 if (count($founditems) && $complete == 0) {
1195 $this->tpl->setOnScreenMessage(
'info', $this->
lng->txt(
"qpl_import_non_ilias_files"));
1206 || file_exists($results_file)) {
1211 $importVerificationTpl =
new ilTemplate(
'tpl.tst_import_verification.html',
true,
true,
'Modules/Test');
1215 $QplOrTstID = isset($_POST[
"qpl"]) && (
int) $_POST[
"qpl"] != 0 ? $_POST[
"qpl"] : -1;
1217 $importVerificationTpl->setVariable(
"TEXT_TYPE", $this->
lng->txt(
"question_type"));
1218 $importVerificationTpl->setVariable(
"TEXT_TITLE", $this->
lng->txt(
"question_title"));
1219 $importVerificationTpl->setVariable(
"FOUND_QUESTIONS_INTRODUCTION", $this->
lng->txt(
"tst_import_verify_found_questions"));
1220 $importVerificationTpl->setVariable(
"VERIFICATION_HEADING", $this->
lng->txt(
"import_tst"));
1221 $importVerificationTpl->setVariable(
"FORMACTION", $this->
ctrl->getFormAction($this));
1223 $importVerificationTpl->setVariable(
"QUESTIONPOOL_ID", $QplOrTstID);
1224 $importVerificationTpl->setVariable(
"VALUE_IMPORT", $this->
lng->txt(
"import"));
1225 $importVerificationTpl->setVariable(
"VALUE_CANCEL", $this->
lng->txt(
"cancel"));
1227 $row_class = [
"tblrow1",
"tblrow2"];
1229 foreach ($founditems as $item) {
1230 $importVerificationTpl->setCurrentBlock(
"verification_row");
1231 $importVerificationTpl->setVariable(
"ROW_CLASS", $row_class[$counter++ % 2]);
1232 $importVerificationTpl->setVariable(
"QUESTION_TITLE", $item[
"title"]);
1233 $importVerificationTpl->setVariable(
"QUESTION_IDENT", $item[
"ident"]);
1235 switch ($item[
"type"]) {
1238 $importVerificationTpl->setVariable(
"QUESTION_TYPE", $this->
lng->txt(
"assMultipleChoice"));
1242 $importVerificationTpl->setVariable(
"QUESTION_TYPE", $this->
lng->txt(
"assSingleChoice"));
1246 $importVerificationTpl->setVariable(
"QUESTION_TYPE", $this->
lng->txt(
"assKprimChoice"));
1250 $importVerificationTpl->setVariable(
"QUESTION_TYPE", $this->
lng->txt(
"assLongMenu"));
1254 $importVerificationTpl->setVariable(
"QUESTION_TYPE", $this->
lng->txt(
"assNumeric"));
1258 $importVerificationTpl->setVariable(
"QUESTION_TYPE", $this->
lng->txt(
"assFormulaQuestion"));
1262 $importVerificationTpl->setVariable(
"QUESTION_TYPE", $this->
lng->txt(
"assTextSubset"));
1266 $importVerificationTpl->setVariable(
"QUESTION_TYPE", $this->
lng->txt(
"assClozeTest"));
1270 $importVerificationTpl->setVariable(
"QUESTION_TYPE", $this->
lng->txt(
"assErrorText"));
1274 $importVerificationTpl->setVariable(
"QUESTION_TYPE", $this->
lng->txt(
"assImagemapQuestion"));
1278 $importVerificationTpl->setVariable(
"QUESTION_TYPE", $this->
lng->txt(
"assMatchingQuestion"));
1282 $importVerificationTpl->setVariable(
"QUESTION_TYPE", $this->
lng->txt(
"assOrderingQuestion"));
1286 $importVerificationTpl->setVariable(
"QUESTION_TYPE", $this->
lng->txt(
"assOrderingHorizontal"));
1290 $importVerificationTpl->setVariable(
"QUESTION_TYPE", $this->
lng->txt(
"assTextQuestion"));
1294 $importVerificationTpl->setVariable(
"QUESTION_TYPE", $this->
lng->txt(
"assFileUpload"));
1297 $importVerificationTpl->parseCurrentBlock();
1300 $this->tpl->setContent($importVerificationTpl->get());
1303 public function getTestObject(): ?
ilObjTest 1322 $newObj->setType($this->testrequest->raw(
"new_type"));
1324 $newObj->setTitle(
"dummy");
1326 $newObj->setDescription(
"test import");
1328 $newObj->create(
true);
1330 $newObj->createReference();
1332 $newObj->putInTree($this->testrequest->getRefId());
1334 $newObj->setPermissions($this->testrequest->getRefId());
1336 $newObj->mark_schema->flush();
1340 if (!isset($_POST[
"qpl"]) ||
"-1" === (
string) $_POST[
"qpl"]) {
1341 $questionParentObjId = $newObj->getId();
1343 $questionParentObjId = $_POST[
"qpl"];
1346 $imp =
new ilImport($this->testrequest->getRefId());
1348 $map->addMapping(
'Modules/Test',
'tst',
'new_id', $newObj->getId());
1354 $newObj->saveToDb();
1359 $imp->importObject($newObj, $fullPath, $fileName,
'tst',
'Modules/Test',
true);
1362 $test_importer->setImport($imp);
1365 $test_importer->init();
1367 $test_importer->importXmlRepresentation(
1382 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
"object_imported"),
true);
1383 ilUtil::redirect(
"ilias.php?ref_id=" . $newObj->getRefId() .
"&baseClass=ilObjTestGUI");
1405 $file = explode(
"_", $this->testrequest->raw(
"file_id"));
1406 $fileObj =
new ilObjFile($file[count($file) - 1],
false);
1407 $fileObj->sendFile();
1426 $pg_obj->
send_paragraph($this->testrequest->raw(
"par_id"), $this->testrequest->raw(
"downloadtitle"));
1455 $this->
ctrl->redirect($this,
"questions");
1469 $tree = $DIC[
'tree'];
1472 $qpl->setType(
"qpl");
1473 $qpl->setTitle(
$name);
1474 $qpl->setDescription($description);
1476 $qpl->createReference();
1477 $qpl->putInTree($parent_ref);
1478 $qpl->setPermissions($parent_ref);
1481 return $qpl->getRefId();
1486 if (!$this->
access->checkAccess(
'write',
'', $this->object->getRefId())) {
1493 $form->setTitle($this->
lng->txt(
'random_selection'));
1494 $form->setFormAction($this->
ctrl->getFormAction($this,
'cancelRandomSelect'));
1496 $form->addCommandButton(
'createRandomSelection', $this->
lng->txt(
'submit'));
1497 $form->addCommandButton(
'cancelRandomSelect', $this->
lng->txt(
'cancel'));
1499 $amount =
new ilNumberInputGUI($this->
lng->txt(
'tst_random_nr_of_questions'),
'nr_of_questions');
1501 $amount->setSize(5);
1502 $amount->setMinValue(1);
1503 $amount->setValue(5);
1504 $form->addItem($amount);
1506 $poolSelection =
new ilSelectInputGUI($this->
lng->txt(
'tst_source_question_pool'),
'sel_qpl');
1507 $poolSelection->setInfo($this->
lng->txt(
'tst_random_select_questionpool'));
1508 $poolSelection->setRequired(
true);
1510 $questionpools = $this->
object->getAvailableQuestionpools(
false,
false,
false,
true);
1511 foreach ($questionpools as
$key => $value) {
1512 $poolOptions[
$key] = $value[
'title'];
1514 $poolSelection->setOptions(
1515 [
'0' => $this->
lng->txt(
'all_available_question_pools')] + $poolOptions
1517 $form->addItem($poolSelection);
1521 $form->addItem($questionType);
1523 $this->tpl->setContent($form->getHTML());
1528 $this->
ctrl->redirect($this,
"questions");
1533 if (!$this->
access->checkAccess(
'write',
'', $this->object->getRefId())) {
1541 $this->tpl->setContent(
1542 $randomQuestionSelectionTable
1543 ->build((
int) $_POST[
'nr_of_questions'], (
int) $_POST[
'sel_qpl'])
1557 if (!$this->
access->checkAccess(
'write',
'', $this->object->getRefId())) {
1560 $selected_array = explode(
",", $_POST[
"chosen_questions"]);
1561 if (!count($selected_array)) {
1562 $this->tpl->setOnScreenMessage(
'info', $this->
lng->txt(
"tst_insert_missing_question"));
1564 $total = $this->
object->evalTotalPersons();
1567 $this->tpl->setOnScreenMessage(
'info', sprintf($this->
lng->txt(
"tst_insert_questions_and_results"), $total));
1569 $this->tpl->setOnScreenMessage(
'info', $this->
lng->txt(
"tst_insert_questions"));
1571 foreach ($selected_array as
$key => $value) {
1572 $this->
object->insertQuestion($this->testQuestionSetConfigFactory->getQuestionSetConfig(), $value);
1574 $this->
object->saveCompleteStatus($this->testQuestionSetConfigFactory->getQuestionSetConfig());
1575 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
"tst_questions_inserted"),
true);
1576 $this->
ctrl->redirect($this,
"questions");
1594 if (!$this->
access->checkAccess(
'write',
'', $this->object->getRefId())) {
1597 $qpl_ref_id = $this->testrequest->raw(
"sel_qpl");
1600 $qpl_mode = $this->testrequest->int(
'usage');
1605 if ($this->testrequest->isset(
'qtype')) {
1607 } elseif ($this->testrequest->isset(
'sel_question_types')) {
1608 $sel_question_types = $this->testrequest->raw(
"sel_question_types");
1611 if (($qpl_mode == 2 && strcmp($this->testrequest->raw(
"txt_qpl"),
"") == 0) || ($qpl_mode == 3 && strcmp($qpl_ref_id,
"") == 0)) {
1612 $this->tpl->setOnScreenMessage(
'info', $this->
lng->txt(
"questionpool_not_entered"));
1617 if ($qpl_mode == 2 && strcmp($this->testrequest->raw(
"txt_qpl"),
"") != 0) {
1620 } elseif ($qpl_mode == 1) {
1621 $qpl_ref_id = $this->testrequest->getRefId();
1623 $baselink =
"ilias.php?baseClass=ilObjQuestionPoolGUI&ref_id=" . $qpl_ref_id .
"&cmd=createQuestionForTest&test_ref_id=" . $this->testrequest->getRefId() .
"&calling_test=" . $this->testrequest->getRefId() .
"&sel_question_types=" . $sel_question_types;
1625 if ($this->testrequest->isset(
'prev_qid')) {
1626 $baselink .=
'&prev_qid=' . $this->testrequest->raw(
'prev_qid');
1627 } elseif ($this->testrequest->isset(
'position')) {
1628 $baselink .=
'&prev_qid=' . $this->testrequest->raw(
'position');
1631 if ($this->testrequest->raw(
'test_express_mode')) {
1632 $baselink .=
'&test_express_mode=1';
1635 if ($this->testrequest->isset(
'add_quest_cont_edit_mode')) {
1638 "add_quest_cont_edit_mode={$this->testrequest->raw('add_quest_cont_edit_mode')}",
1658 $this->
ctrl->redirect($this,
"questions");
1673 if (!$this->
access->checkAccess(
'write',
'', $this->object->getRefId())) {
1680 $questionpools = $this->
object->getAvailableQuestionpools(
false,
false,
false,
true,
false,
"write");
1683 $form->setFormAction($this->
ctrl->getFormAction($this,
"executeCreateQuestion"));
1684 $form->setTitle(
$lng->
txt(
"ass_create_question"));
1686 if ($this->testrequest->isset(
'qtype')) {
1688 } elseif ($this->testrequest->isset(
'sel_question_types')) {
1689 $sel_question_types = $this->testrequest->raw(
"sel_question_types");
1694 $hidden->setValue($sel_question_types);
1695 $form->addItem($hidden);
1702 $lng->
txt(
'tst_add_quest_cont_edit_mode_IPE'),
1705 $option_ipe->
setInfo(
$lng->
txt(
'tst_add_quest_cont_edit_mode_IPE_info'));
1706 $ri->addOption($option_ipe);
1709 $lng->
txt(
'tst_add_quest_cont_edit_mode_RTE'),
1712 $option_rte->
setInfo(
$lng->
txt(
'tst_add_quest_cont_edit_mode_RTE_info'));
1713 $ri->addOption($option_rte);
1717 $form->addItem($ri,
true);
1721 $form->addItem($hi,
true);
1728 $usage->addOption($no_pool);
1729 $existing_pool =
new ilRadioOption($this->
lng->txt(
"assessment_existing_pool"), 3);
1730 $usage->addOption($existing_pool);
1732 $usage->addOption($new_pool);
1733 $form->addItem($usage);
1738 $pools_data = array();
1739 foreach ($questionpools as
$key => $p) {
1740 $pools_data[
$key] = $p[
'title'];
1743 $pools->setOptions($pools_data);
1744 $existing_pool->addSubItem($pools);
1747 $this->
lng->loadLanguageModule(
'rbac');
1750 $name->setMaxLength(50);
1751 $new_pool->addSubItem(
$name);
1753 $form->addCommandButton(
"executeCreateQuestion",
$lng->
txt(
"submit"));
1754 $form->addCommandButton(
"cancelCreateQuestion",
$lng->
txt(
"cancel"));
1756 $this->tpl->setVariable(
'ADM_CONTENT', $form->getHTML());
1764 if (!$this->
access->checkAccess(
'write',
'', $this->object->getRefId())) {
1768 $removeQuestionIds = (array) $_POST[
"q_id"];
1770 $questions = $this->
object->getQuestionTitlesAndIndexes();
1772 $this->
object->removeQuestions($removeQuestionIds);
1774 $this->
object->saveCompleteStatus($this->testQuestionSetConfigFactory->getQuestionSetConfig());
1776 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
"tst_questions_removed"));
1778 if ($this->testrequest->raw(
'test_express_mode')) {
1781 $deleted_tmp = $removeQuestionIds;
1782 $first = array_shift($deleted_tmp);
1783 foreach ($questions as
$key => $value) {
1784 if (!in_array(
$key, $removeQuestionIds)) {
1792 } elseif (
$key == $first) {
1797 $first = array_shift($deleted_tmp);
1802 count($questions) == count($removeQuestionIds) ||
1805 $this->
ctrl->setParameter($this,
'q_id',
'');
1806 $this->
ctrl->redirect($this,
'showPage');
1809 $this->
ctrl->setParameter($this,
'q_id', $return_to);
1810 $this->
ctrl->redirect($this,
"showPage");
1812 $this->
ctrl->setParameter($this,
'q_id',
'');
1813 $this->
ctrl->redirect($this,
'questions');
1826 if ($this->testrequest->raw(
'test_express_mode')) {
1827 $this->
ctrl->setParameter($this,
'q_id', $this->testrequest->raw(
'q_id'));
1828 $this->
ctrl->redirect($this,
"showPage");
1830 $this->
ctrl->redirect($this,
"questions");
1843 if (!$this->
access->checkAccess(
'write',
'', $this->object->getRefId())) {
1847 $total = $this->
object->evalTotalPersons();
1850 $question = sprintf($this->
lng->txt(
"tst_remove_questions_and_results"), $total);
1852 if (count($checked_questions) == 1) {
1853 $question = $this->
lng->txt(
"tst_remove_question");
1855 $question = $this->
lng->txt(
"tst_remove_questions");
1860 $cgui->setHeaderText($question);
1862 $this->
ctrl->saveParameter($this,
'test_express_mode');
1863 $this->
ctrl->saveParameter($this,
'q_id');
1865 $cgui->setFormAction($this->
ctrl->getFormAction($this));
1866 $cgui->setCancel($this->
lng->txt(
"cancel"),
"cancelRemoveQuestions");
1867 $cgui->setConfirm($this->
lng->txt(
"confirm"),
"confirmRemoveQuestions");
1868 $removablequestions = $this->
object->getTestQuestions();
1869 if (count($removablequestions)) {
1870 foreach ($removablequestions as
$data) {
1871 if (in_array($data[
"question_id"], $checked_questions)) {
1873 $txt .=
' [' . $this->
lng->txt(
'question_id_short') .
': ' . $data[
'question_id'] .
']';
1875 if ($data[
"description"]) {
1876 $txt .=
"<div class=\"small\">" . $data[
"description"] .
"</div>";
1879 $cgui->addItem(
"q_id[]", $data[
"question_id"],
$txt);
1884 $this->tpl->setContent($cgui->getHTML());
1892 if (!$this->
access->checkAccess(
'write',
'', $this->object->getRefId())) {
1899 $checked_questions = $this->testrequest->raw(
'q_id');
1901 if (!is_array($checked_questions) && $checked_questions) {
1902 $checked_questions = array($checked_questions);
1905 if (!is_array($checked_questions)) {
1906 $checked_questions = [];
1909 if (count($checked_questions) > 0) {
1911 } elseif (0 === count($checked_questions)) {
1912 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
"tst_no_question_selected_for_removal"),
true);
1913 $this->
ctrl->redirect($this,
"questions");
1922 if (!$this->
access->checkAccess(
'write',
'', $this->object->getRefId())) {
1926 $selected_questions = $this->testrequest->getQuestionIds()
1927 ? $this->testrequest->getQuestionIds()
1928 : [$this->testrequest->getQuestionId()];
1929 if (count($selected_questions) > 0) {
1931 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
'msg_selected_for_move'),
true);
1933 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
'no_selection_for_move'),
true);
1935 $this->
ctrl->redirect($this,
'questions');
1943 if (!$this->
access->checkAccess(
'write',
'', $this->object->getRefId())) {
1955 if (!$this->
access->checkAccess(
'write',
'', $this->object->getRefId())) {
1967 $target_questions = $this->testrequest->getQuestionIds()
1968 ? $this->testrequest->getQuestionIds()
1969 : [$this->testrequest->getQuestionId()];
1971 if (count($target_questions) === 0) {
1972 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
'no_target_selected_for_move'),
true);
1973 $this->
ctrl->redirect($this,
'questions');
1974 } elseif (count($target_questions) > 1) {
1975 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
'too_many_targets_selected_for_move'),
true);
1976 $this->
ctrl->redirect($this,
'questions');
1979 $this->
object->moveQuestions(
ilSession::get(
'tst_qst_move_' . $this->
object->getTestId()), $target_questions[0], $insert_mode);
1980 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
'msg_questions_moved'),
true);
1982 $this->
ctrl->redirect($this,
'questions');
1992 if (!$this->
access->checkAccess(
'write',
'', $this->object->getRefId())) {
1996 $selected_questions = $this->testrequest->getQuestionIds()
1997 ? $this->testrequest->getQuestionIds()
1998 : [$this->testrequest->getQuestionId()];
2000 if (count($selected_questions) === 0) {
2001 $this->tpl->setOnScreenMessage(
'info', $this->
lng->txt(
'tst_insert_missing_question'),
true);
2002 $this->
ctrl->redirect($this,
'browseForQuestions');
2005 $man_scoring =
false;
2006 foreach ($selected_questions as
$key => $value) {
2007 $this->
object->insertQuestion($this->testQuestionSetConfigFactory->getQuestionSetConfig(), $value);
2011 $this->
object->saveCompleteStatus($this->testQuestionSetConfigFactory->getQuestionSetConfig());
2013 $this->tpl->setOnScreenMessage(
'info', $this->
lng->txt(
'manscoring_hint'),
true);
2015 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
'tst_questions_inserted'),
true);
2017 $this->
ctrl->redirect($this,
'questions');
2024 $ilCtrl = $DIC[
'ilCtrl'];
2027 $ilHelp = $DIC[
'ilHelp'];
2029 if (!$this->
access->checkAccess(
'write',
'', $this->object->getRefId())) {
2036 $subScreenId = array(
'createQuestion');
2038 $ilCtrl->setParameter($this,
'qtype', $this->testrequest->raw(
'qtype'));
2042 $form->setFormAction($ilCtrl->getFormAction($this,
"executeCreateQuestion"));
2043 $form->setTitle(
$lng->
txt(
"ass_create_question"));
2046 $questionTypes = $pool->getQuestionTypes(
false,
true,
false);
2050 foreach ($questionTypes as $label =>
$data) {
2051 $options[
$data[
'question_type_id']] = $label;
2054 $si->setOptions($options);
2055 $form->addItem($si,
true);
2058 $questions = $this->
object->getQuestionTitlesAndIndexes();
2061 $options = array(
'0' =>
$lng->
txt(
'first'));
2062 foreach ($questions as
$key => $title) {
2063 $options[
$key] =
$lng->
txt(
'behind') .
' ' . $title .
' [' . $this->
lng->txt(
'question_id_short') .
': ' .
$key .
']';
2065 $si->setOptions($options);
2066 $si->setValue($this->testrequest->raw(
'q_id'));
2067 $form->addItem($si,
true);
2072 $subScreenId[] =
'editMode';
2077 $lng->
txt(
'tst_add_quest_cont_edit_mode_IPE'),
2080 $option_ipe->
setInfo(
$lng->
txt(
'tst_add_quest_cont_edit_mode_IPE_info'));
2081 $ri->addOption($option_ipe);
2084 $lng->
txt(
'tst_add_quest_cont_edit_mode_RTE'),
2087 $option_rte->
setInfo(
$lng->
txt(
'tst_add_quest_cont_edit_mode_RTE_info'));
2088 $ri->addOption($option_rte);
2092 $form->addItem($ri,
true);
2096 $form->addItem($hi,
true);
2099 $subScreenId[] =
'poolSelect';
2105 $usage->addOption($no_pool);
2106 $existing_pool =
new ilRadioOption($this->
lng->txt(
"assessment_existing_pool"), 3);
2107 $usage->addOption($existing_pool);
2109 $usage->addOption($new_pool);
2110 $form->addItem($usage);
2115 $pools_data = array();
2116 foreach ($questionpools as
$key => $p) {
2117 $pools_data[
$key] = $p[
'title'];
2120 $pools->setOptions($pools_data);
2121 $existing_pool->addSubItem($pools);
2125 $name->setMaxLength(50);
2126 $new_pool->addSubItem(
$name);
2128 $form->addCommandButton(
"executeCreateQuestion",
$lng->
txt(
"create"));
2129 $form->addCommandButton(
"questions",
$lng->
txt(
"cancel"));
2131 $DIC->tabs()->activateTab(
'assQuestions');
2132 $ilHelp->setScreenId(
'assQuestions');
2133 $ilHelp->setSubScreenId(implode(
'_', $subScreenId));
2141 $ilAccess = $DIC[
'ilAccess'];
2142 $ilTabs = $DIC[
'ilTabs'];
2145 $this->
ctrl->setParameter($this,
'test_express_mode',
'');
2147 if (!$ilAccess->checkAccess(
"write",
"", $this->ref_id)) {
2149 $this->tpl->setOnScreenMessage(
'info', $this->
lng->txt(
"cannot_edit_test"),
true);
2150 $this->
ctrl->redirect($this,
"infoScreen");
2165 $this->
ctrl->setParameter($this,
'q_id',
'');
2167 if ($this->testrequest->raw(
"eqid") && $this->testrequest->raw(
"eqpl")) {
2168 ilUtil::redirect(
"ilias.php?baseClass=ilObjQuestionPoolGUI&ref_id=" . $this->testrequest->raw(
"eqpl") .
"&cmd=editQuestionForTest&calling_test=" . $this->testrequest->getRefId() .
"&q_id=" . $this->testrequest->raw(
"eqid"));
2171 if ($this->testrequest->raw(
"up") > 0) {
2172 $this->
object->questionMoveUp($this->testrequest->raw(
"up"));
2174 if ($this->testrequest->raw(
"down") > 0) {
2175 $this->
object->questionMoveDown($this->testrequest->raw(
"down"));
2178 if ($this->testrequest->raw(
"add")) {
2179 $selected_array = array();
2180 array_push($selected_array, $this->testrequest->raw(
"add"));
2181 $total = $this->
object->evalTotalPersons();
2184 $this->tpl->setOnScreenMessage(
'info', sprintf($this->
lng->txt(
"tst_insert_questions_and_results"), $total));
2186 $this->tpl->setOnScreenMessage(
'info', $this->
lng->txt(
"tst_insert_questions"));
2190 $this->insertQuestions($selected_array);
2194 $this->tpl->addBlockFile(
"ADM_CONTENT",
"adm_content",
"tpl.il_as_tst_questions.html",
"Modules/Test");
2196 $total = $this->
object->evalTotalPersons();
2197 if ($ilAccess->checkAccess(
"write",
"", $this->ref_id)) {
2199 $link = $DIC->ui()->factory()->link()->standard(
2200 $DIC->language()->txt(
"test_has_datasets_warning_page_view_link"),
2201 $DIC->ctrl()->getLinkTargetByClass(array(
'ilTestResultsGUI',
'ilParticipantsTestResultsGUI'))
2204 $message = $DIC->language()->txt(
"test_has_datasets_warning_page_view");
2206 $msgBox = $DIC->ui()->factory()->messageBox()->info(
$message)->withLinks(array($link));
2208 $DIC->ui()->mainTemplate()->setCurrentBlock(
'mess');
2209 $DIC->ui()->mainTemplate()->setVariable(
2211 $DIC->ui()->renderer()->render($msgBox)
2213 $DIC->ui()->mainTemplate()->parseCurrentBlock();
2215 $ilToolbar = $DIC[
'ilToolbar'];
2217 $ilToolbar->addButton($this->
lng->txt(
"ass_create_question"), $this->
ctrl->getLinkTarget($this,
"addQuestion"));
2219 $ilToolbar->addSeparator();
2227 $this->
object->getRefId()
2231 $table_gui->setPositionInsertCommandsEnabled(
2237 $table_gui->setQuestionPositioningEnabled(!$total);
2238 $table_gui->setQuestionManagingEnabled(!$total);
2239 $table_gui->setObligatoryQuestionsHandlingEnabled($this->
object->areObligationsEnabled());
2241 $table_gui->setTotalPoints($this->
object->getFixedQuestionSetTotalPoints());
2245 $table_gui->setData($this->
object->getTestQuestions());
2247 $this->tpl->setPermanentLink($this->
object->getType(), $this->
object->getRefId(),
'_qst');
2249 $this->tpl->setCurrentBlock(
"adm_content");
2250 $this->tpl->setVariable(
"ACTION_QUESTION_FORM", $this->
ctrl->getFormAction($this));
2251 $this->tpl->setVariable(
'QUESTIONBROWSER', $table_gui->getHTML());
2252 $this->tpl->parseCurrentBlock();
2257 $this->
ctrl->setParameterByClass(
2258 ilTestQuestionBrowserTableGUI::class,
2262 $this->
ctrl->setParameterByClass(
2263 ilTestQuestionBrowserTableGUI::class,
2269 $this->
lng->txt(
"tst_browse_for_qpl_questions"),
2270 $this->
ctrl->getLinkTargetByClass(
2271 ilTestQuestionBrowserTableGUI::class,
2276 $this->
ctrl->setParameterByClass(
2277 ilTestQuestionBrowserTableGUI::class,
2283 $this->
lng->txt(
"tst_browse_for_tst_questions"),
2284 $this->
ctrl->getLinkTargetByClass(
2285 ilTestQuestionBrowserTableGUI::class,
2306 if (!$this->
access->checkAccess(
'write',
'', $this->object->getRefId())) {
2312 $table_gui->setTestObject($this->
object);
2314 $table_gui->setData(
$log);
2315 $this->tpl->setVariable(
'ADM_CONTENT', $table_gui->getHTML());
2321 $form->setTarget(
"_top");
2322 $n_type = $this->testrequest->raw(
"new_type");
2323 $this->
ctrl->setParameter($this,
"new_type", $n_type);
2324 $form->setFormAction($this->
ctrl->getFormAction($this));
2325 $form->setTitle($this->
lng->txt(
"import_tst"));
2328 $fi->setRequired(
true);
2329 $form->addItem($fi);
2331 $questionpools = $tst->getAvailableQuestionpools(
true,
false,
true,
true);
2332 if (count($questionpools)) {
2333 $options = array(
"-1" => $this->
lng->txt(
"dont_use_questionpool"));
2334 foreach ($questionpools as
$key => $value) {
2335 $options[
$key] = $value[
"title"];
2339 $pool->setInfo($this->
lng->txt(
'select_question_pool_info'));
2340 $pool->setOptions($options);
2341 $form->addItem($pool);
2344 $form->addCommandButton(
"importFile", $this->
lng->txt(
"import"));
2345 $form->addCommandButton(
"cancel", $this->
lng->txt(
"cancel"));
2357 $command = $_POST[
"command"];
2358 if (strlen($command)) {
2359 $method = $command .
"Object";
2360 if (method_exists($this, $method)) {
2365 $this->
ctrl->redirect($this,
"participants");
2378 $ilAccess = $DIC[
'ilAccess'];
2379 if (!$ilAccess->checkAccess(
"write",
"", $this->ref_id)) {
2381 $this->tpl->setOnScreenMessage(
'info', $this->
lng->txt(
"cannot_edit_test"),
true);
2382 $this->
ctrl->redirect($this,
"infoScreen");
2385 $isPdfDeliveryRequest = $DIC->test()->internal()->request()->isset(
'pdf') &&
2386 $DIC->test()->internal()->request()->raw(
'pdf');
2389 $template =
new ilTemplate(
"tpl.il_as_tst_print_test_confirm.html",
true,
true,
"Modules/Test");
2391 if (!$isPdfDeliveryRequest) {
2392 $this->
ctrl->setParameter($this,
"pdf",
"1");
2393 $template->setCurrentBlock(
"pdf_export");
2394 $template->setVariable(
"PDF_URL", $this->
ctrl->getLinkTarget($this,
"print"));
2395 $this->
ctrl->setParameter($this,
"pdf",
"");
2396 $template->setVariable(
"PDF_TEXT", $this->
lng->txt(
"pdf_export"));
2397 $template->parseCurrentBlock();
2399 $template->setCurrentBlock(
"navigation_buttons");
2400 $template->setVariable(
"BUTTON_PRINT", $this->
lng->txt(
"print"));
2401 $template->parseCurrentBlock();
2412 $print_date = mktime(date(
"H"), date(
"i"), date(
"s"), date(
"m"), date(
"d"), date(
"Y"));
2416 $questionHeaderBlockBuilder->setHeaderMode($this->
object->getTitleOutput());
2418 if ($isPdfDeliveryRequest) {
2422 foreach ($this->
object->questions as $question) {
2423 $template->setCurrentBlock(
"question");
2424 $question_gui = $this->
object->createQuestionGUI(
"", $question);
2427 if ($isPdfDeliveryRequest) {
2431 $questionHeaderBlockBuilder->setQuestionTitle($question_gui->object->getTitleForHTMLOutput());
2432 $questionHeaderBlockBuilder->setQuestionPoints($question_gui->object->getMaximumPoints());
2433 $questionHeaderBlockBuilder->setQuestionPosition($counter);
2434 $template->setVariable(
"QUESTION_HEADER", $questionHeaderBlockBuilder->getHTML());
2436 $template->setVariable(
"TXT_QUESTION_ID", $this->
lng->txt(
'question_id_short'));
2437 $template->setVariable(
"QUESTION_ID", $question_gui->object->getId());
2438 $result_output = $question_gui->getSolutionOutput(0, null,
false,
true,
false,
false);
2439 $template->setVariable(
"SOLUTION_OUTPUT", $result_output);
2440 $template->parseCurrentBlock(
"question");
2442 $max_points += $question_gui->object->getMaximumPoints();
2449 $template->setVariable(
2454 $template->setVariable(
2455 "TXT_MAXIMUM_POINTS",
2460 if ($isPdfDeliveryRequest) {
2463 $this->tpl->setVariable(
"PRINT_CONTENT", $template->get());
2477 $ilAccess = $DIC[
'ilAccess'];
2479 if (!$ilAccess->checkAccess(
"write",
"", $this->ref_id)) {
2481 $this->tpl->setOnScreenMessage(
'info', $this->
lng->txt(
"cannot_edit_test"),
true);
2482 $this->
ctrl->redirect($this,
"infoScreen");
2485 $template =
new ilTemplate(
"tpl.il_as_tst_print_test_confirm.html",
true,
true,
"Modules/Test");
2489 $isPdfDeliveryRequest = $DIC->test()->internal()->request()->isset(
'pdf') &&
2490 $DIC->test()->internal()->request()->raw(
'pdf');
2495 $questionHeaderBlockBuilder->setHeaderMode($this->
object->getTitleOutput());
2497 if ($isPdfDeliveryRequest) {
2504 foreach ($this->
object->questions as $question) {
2505 $template->setCurrentBlock(
"question");
2506 $question_gui = $this->
object->createQuestionGUI(
"", $question);
2509 $questionHeaderBlockBuilder->setQuestionTitle($question_gui->object->getTitleForHTMLOutput());
2510 $questionHeaderBlockBuilder->setQuestionPoints($question_gui->object->getMaximumPoints());
2511 $questionHeaderBlockBuilder->setQuestionPosition($counter);
2512 $template->setVariable(
"QUESTION_HEADER", $questionHeaderBlockBuilder->getHTML());
2514 $template->setVariable(
"SOLUTION_OUTPUT", $question_gui->getPreview(
false));
2515 $template->parseCurrentBlock(
"question");
2517 $max_points += $question_gui->object->getMaximumPoints();
2521 $template->setVariable(
2528 $template->setVariable(
2533 $template->setVariable(
2534 "TXT_MAXIMUM_POINTS",
2539 if ($isPdfDeliveryRequest) {
2542 $this->
ctrl->setParameter($this,
"pdf",
"1");
2543 $template->setCurrentBlock(
"pdf_export");
2544 $template->setVariable(
"PDF_URL", $this->
ctrl->getLinkTarget($this,
"review"));
2545 $this->
ctrl->setParameter($this,
"pdf",
"");
2546 $template->setVariable(
"PDF_TEXT", $this->
lng->txt(
"pdf_export"));
2547 $template->parseCurrentBlock();
2549 $template->setCurrentBlock(
"navigation_buttons");
2550 $template->setVariable(
"BUTTON_PRINT", $this->
lng->txt(
"print"));
2551 $template->parseCurrentBlock();
2554 $this->tpl->setVariable(
"PRINT_CONTENT", $template->get());
2561 public function defaultsObject()
2569 $ilAccess = $DIC[
'ilAccess'];
2570 $ilToolbar = $DIC[
'ilToolbar'];
2573 if (!$ilAccess->checkAccess(
"write",
"", $this->ref_id)) {
2575 $this->
ctrl->redirect($this,
"infoScreen");
2582 $ilToolbar->setFormAction($this->
ctrl->getFormAction($this,
'addDefaults'));
2583 $ilToolbar->addFormButton($this->
lng->txt(
'add'),
'addDefaults');
2584 $ilToolbar->addInputItem(
new ilTextInputGUI($this->
lng->txt(
'tst_defaults_defaults_of_test'),
'name'),
true);
2586 $defaults = $this->
object->getAvailableDefaults();
2587 $table->setData($defaults);
2596 if (!$this->
access->checkAccess(
'write',
'', $this->object->getRefId())) {
2600 if (isset($_POST[
'chb_defaults']) && is_array($_POST[
'chb_defaults']) && count($_POST[
'chb_defaults'])) {
2601 foreach ($_POST[
'chb_defaults'] as $test_default_id) {
2602 $this->
object->deleteDefaults($test_default_id);
2605 $this->tpl->setOnScreenMessage(
'info', $this->
lng->txt(
'select_one'));
2607 $this->defaultsObject();
2615 if (!$this->
access->checkAccess(
'write',
'', $this->object->getRefId())) {
2628 if (!isset($_POST[
'chb_defaults']) || !is_array($_POST[
"chb_defaults"]) || 1 !== count($_POST[
"chb_defaults"])) {
2629 $this->tpl->setOnScreenMessage(
'info', $this->
lng->txt(
"tst_defaults_apply_select_one"));
2631 $this->defaultsObject();
2636 if ($this->
object->evalTotalPersons() > 0) {
2637 $this->tpl->setOnScreenMessage(
'info', $this->
lng->txt(
"tst_defaults_apply_not_possible"));
2639 $this->defaultsObject();
2643 $defaults = $this->
object->getTestDefaults($_POST[
"chb_defaults"][0]);
2644 $defaultSettings = unserialize($defaults[
"defaults"]);
2646 if (isset($defaultSettings[
'isRandomTest'])) {
2647 if ($defaultSettings[
'isRandomTest']) {
2654 } elseif (isset($defaultSettings[
'questionSetType'])) {
2655 $newQuestionSetType = $defaultSettings[
'questionSetType'];
2657 $oldQuestionSetType = $this->
object->getQuestionSetType();
2658 $questionSetTypeSettingSwitched = ($oldQuestionSetType != $newQuestionSetType);
2660 $oldQuestionSetConfig = $this->testQuestionSetConfigFactory->getQuestionSetConfigByType();
2663 case !$questionSetTypeSettingSwitched:
2664 case !$oldQuestionSetConfig->doesQuestionSetRelatedDataExist():
2673 $confirmation->setFormAction($this->
ctrl->getFormAction($this));
2674 $confirmation->setCancel($this->
lng->txt(
'cancel'),
'defaults');
2675 $confirmation->setConfirm($this->
lng->txt(
'confirm'),
'confirmedApplyDefaults');
2677 $confirmation->setOldQuestionSetType($this->
object->getQuestionSetType());
2678 $confirmation->setNewQuestionSetType($newQuestionSetType);
2679 $confirmation->setQuestionLossInfoEnabled(
false);
2680 $confirmation->build();
2682 $confirmation->populateParametersFromPost();
2684 $this->tpl->setContent($this->
ctrl->getHTML($confirmation));
2689 if ($questionSetTypeSettingSwitched && !$this->
object->getOfflineStatus()) {
2690 $this->
object->setOfflineStatus(
true);
2692 $info = $this->
lng->txt(
"tst_set_offline_due_to_switched_question_set_type_setting");
2694 $this->tpl->setOnScreenMessage(
'info', $info,
true);
2697 $this->
object->applyDefaults($defaults);
2699 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
"tst_defaults_applied"),
true);
2701 if ($questionSetTypeSettingSwitched && $oldQuestionSetConfig->doesQuestionSetRelatedDataExist()) {
2702 $oldQuestionSetConfig->removeQuestionSetRelatedData();
2705 $this->
ctrl->redirect($this,
'defaults');
2713 if (!$this->
access->checkAccess(
'write',
'', $this->object->getRefId())) {
2717 if (strlen($_POST[
"name"]) > 0) {
2718 $this->
object->addDefaults($_POST[
'name']);
2720 $this->tpl->setOnScreenMessage(
'info', $this->
lng->txt(
"tst_defaults_enter_name"));
2722 $this->defaultsObject();
2727 if (in_array($this->
ctrl->getCmdClass(), self::$infoScreenChildClasses)) {
2741 $this->
ctrl->setCmd(
"showSummary");
2742 $this->
ctrl->setCmdClass(
"ilinfoscreengui");
2748 $this->
ctrl->setCmd(
"showSummary");
2749 $this->
ctrl->setCmdClass(
"ilinfoscreengui");
2750 $this->
infoScreen($this->testrequest->raw(
'lock'));
2760 $ilAccess = $DIC[
'ilAccess'];
2762 $ilToolbar = $DIC[
'ilToolbar'];
2764 if (!$ilAccess->checkAccess(
"visible",
"", $this->ref_id) && !$ilAccess->checkAccess(
"read",
"",
$_GET[
"ref_id"])) {
2771 if ($ilAccess->checkAccess(
"read",
"", $this->testrequest->getRefId())) {
2777 return $this->
ctrl->forwardCommand($info);
2780 $toolbarFactory->setTestOBJ($this->getTestObject());
2781 $toolbar = $toolbarFactory->getToolbarInstance();
2786 $toolbar->setSessionLockString($session_lock);
2790 if ($this->
object->getShowInfo()) {
2791 $info->enablePrivateNotes();
2794 if ($this->
object->getIntroduction() !==
'') {
2795 $info->addSection($this->
lng->txt(
"tst_introduction"));
2796 $info->addProperty(
"", $this->
object->prepareTextareaOutput($this->object->getIntroduction(),
true) .
2797 "<br />" . $info->getHiddenToggleButton());
2799 $info->addSection($this->
lng->txt(
"show_details"));
2800 $info->addProperty(
"", $info->getHiddenToggleButton());
2803 $info->addSection($this->
lng->txt(
"tst_general_properties"));
2804 if ($this->
object->getShowInfo()) {
2806 $this->
lng->txt(
"author"),
2808 $this->
object->getAuthor(),
2813 $this->
lng->txt(
"title"),
2815 $this->
object->getTitle(),
2820 if (!$this->
object->getOfflineStatus() &&
2821 $this->
object->isComplete($this->testQuestionSetConfigFactory->getQuestionSetConfig()) &&
2822 $ilAccess->checkAccess(
"read",
"", $this->ref_id) &&
2823 !$this->
object->isRandomTest() &&
2825 $this->
object->getNrOfTries() != 1) {
2826 if ($this->
object->getUsePreviousAnswers() == 0) {
2827 if ($this->
object->getShowInfo()) {
2828 $info->addProperty($this->
lng->txt(
"tst_use_previous_answers"), $this->
lng->txt(
"tst_dont_use_previous_answers"));
2831 $checked_previous_answers =
false;
2832 if (
$ilUser->getPref(
"tst_use_previous_answers")) {
2833 $checked_previous_answers =
true;
2835 $info->addPropertyCheckbox($this->
lng->txt(
"tst_use_previous_answers"),
"chb_use_previous_answers", 1, $this->
lng->txt(
"tst_use_previous_answers_user"), $checked_previous_answers);
2839 $info->hideFurtherSections(
false);
2841 if ($this->
object->getShowInfo()) {
2842 $info->addSection($this->
lng->txt(
"tst_sequence_properties"));
2843 $info->addProperty($this->
lng->txt(
"tst_sequence"), $this->
lng->txt(($this->
object->getSequenceSettings() ==
TEST_FIXED_SEQUENCE) ?
"tst_sequence_fixed" :
"tst_sequence_postpone"));
2845 $info->addSection($this->
lng->txt(
"tst_heading_scoring"));
2846 $info->addProperty($this->
lng->txt(
"tst_text_count_system"), $this->
lng->txt(($this->
object->getCountSystem() ==
COUNT_PARTIAL_SOLUTIONS) ?
"tst_count_partial_solutions" :
"tst_count_correct_solutions"));
2847 if ($this->
object->isRandomTest()) {
2848 $info->addProperty($this->
lng->txt(
"tst_pass_scoring"), $this->
lng->txt(($this->
object->getPassScoring() ==
SCORE_BEST_PASS) ?
"tst_pass_best_pass" :
"tst_pass_last_pass"));
2851 $info->addSection($this->
lng->txt(
"tst_score_reporting"));
2852 $score_reporting_text =
"";
2853 switch ($this->
object->getScoreReporting()) {
2855 $score_reporting_text = $this->
lng->txt(
"tst_report_after_test");
2858 $score_reporting_text = $this->
lng->txt(
"tst_report_after_first_question");
2861 $score_reporting_text = $this->
lng->txt(
"tst_report_after_date");
2864 $score_reporting_text = $this->
lng->txt(
"tst_report_after_passed");
2867 $score_reporting_text = $this->
lng->txt(
"tst_report_never");
2870 $info->addProperty($this->
lng->txt(
"tst_score_reporting"), $score_reporting_text);
2871 $reporting_date = $this->getTestObject()
2872 ->getScoreSettings()
2873 ->getResultSummarySettings()
2874 ->getReportingDate();
2875 if ($reporting_date !== null) {
2877 $this->
lng->txt(
'tst_score_reporting_date'),
2879 $reporting_date->format(
'YmdHis'),
2881 $reporting_date->getTimezone()->getName()
2886 $info->addSection($this->
lng->txt(
"tst_session_settings"));
2887 $info->addProperty($this->
lng->txt(
"tst_nr_of_tries"), ($this->
object->getNrOfTries() == 0) ? $this->
lng->txt(
"unlimited") : $this->
object->getNrOfTries());
2888 if ($this->
object->getNrOfTries() != 1) {
2889 $info->addProperty($this->
lng->txt(
"tst_nr_of_tries_of_user"), (
$toolbar->getTestSession()->getPass() ==
false) ? $this->
lng->txt(
"tst_no_tries") :
$toolbar->getTestSequence()->getPass());
2892 if ($this->
object->getEnableProcessingTime()) {
2893 $info->addProperty($this->
lng->txt(
"tst_processing_time"), $this->
object->getProcessingTime());
2895 if (strlen($this->
object->getAllowedUsers()) && ($this->
object->getAllowedUsersTimeGap())) {
2896 $info->addProperty($this->
lng->txt(
"tst_allowed_users"), $this->
object->getAllowedUsers());
2899 $starting_time = $this->
object->getStartingTime();
2900 if ($this->
object->isStartingTimeEnabled() && $starting_time != 0) {
2903 $ending_time = $this->
object->getEndingTime();
2904 if ($this->
object->isEndingTimeEnabled() && $ending_time != 0) {
2907 $info->addMetaDataSections($this->
object->getId(), 0, $this->
object->getType());
2911 $this->
ctrl->forwardCommand($info);
2917 if (!$this->
access->checkAccess(
'write',
'', $this->object->getRefId())) {
2926 $this->
ctrl->redirect($this,
'infoScreen');
2932 $ilLocator = $DIC[
'ilLocator'];
2933 switch ($this->
ctrl->getCmd()) {
2936 case "redirectToInfoScreen":
2943 case "outCorrectSolution":
2945 case "showAnswersOfUser":
2946 case "outUserResultsOverview":
2947 case "backFromSummary":
2948 case "show_answers":
2951 case "outTestSummary":
2952 case "outQuestionSummary":
2953 case "gotoQuestion":
2954 case "selectImagemapRegion":
2955 case "confirmSubmitAnswers":
2956 case "finalSubmission":
2958 case "outUserPassDetails":
2959 case "checkPassword":
2960 $ilLocator->addItem($this->
object->getTitle(), $this->
ctrl->getLinkTarget($this,
"infoScreen"),
"", $this->testrequest->getRefId());
2963 case "evalAllUsers":
2964 case "evalUserDetail":
2965 $ilLocator->addItem($this->
object->getTitle(), $this->
ctrl->getLinkTarget($this,
"eval_stat"),
"", $this->testrequest->getRefId());
2972 case "importVerifiedFile":
2973 case "cancelImport":
2976 $ilLocator->addItem($this->
object->getTitle(), $this->
ctrl->getLinkTarget($this,
""),
"", $this->testrequest->getRefId());
2992 if (!$this->
access->checkAccess(
'write',
'', $this->object->getRefId())) {
2999 $output_gui = $guiFactory->create($this->
object);
3001 $output_gui->certificateEditor();
3012 $help = $DIC[
'ilHelp'];
3013 $help->setScreenIdComponent(
"tst");
3017 $this->
getTabsManager()->setParentBackLabel($this->
lng->txt(
'back_to_objective_container'));
3027 $main_tpl = $DIC->ui()->mainTemplate();
3029 $main_tpl->setOnScreenMessage(
'info', $DIC->language()->txt(
"no_permission"),
true);
3030 $DIC->ctrl()->redirectByClass(
'ilObjTestGUI',
"infoScreen");
3041 public static function _goto($a_target, array $target_parts)
3044 $main_tpl = $DIC->ui()->mainTemplate();
3045 $ilAccess = $DIC[
'ilAccess'];
3049 if (isset($target_parts[2]) && $target_parts[2] ===
'qst' &&
3050 $ilAccess->checkAccess(
'write',
'', (
int) $a_target)) {
3053 if ($tst->isFixedTest()) {
3054 $DIC->ctrl()->setParameterByClass(__CLASS__,
'ref_id', $a_target);
3055 $DIC->ctrl()->redirectByClass(
3059 $DIC->ctrl()->redirectByClass(
'ilObjTestGUI',
'questions');
3060 } elseif ($tst->isRandomTest()) {
3061 $DIC->ctrl()->setParameterByClass(ilTestRandomQuestionSetConfigGUI::class,
'ref_id', $a_target);
3062 $DIC->ctrl()->redirectByClass([
3064 ilTestRandomQuestionSetConfigGUI::class
3066 } elseif ($tst->isDynamicTest()) {
3067 $target = $DIC->ctrl()->getLinkTargetByClass(
'ilObjTestDynamicQuestionSetConfigGUI');
3068 $DIC->ctrl()->setParameterByClass(ilObjTestDynamicQuestionSetConfigGUI::class,
'ref_id', $a_target);
3069 $DIC->ctrl()->redirectByClass([
3071 ilObjTestDynamicQuestionSetConfigGUI::class
3076 if ($ilAccess->checkAccess(
"read",
"", $a_target) || $ilAccess->checkAccess(
"visible",
"", $a_target)) {
3077 $DIC->ctrl()->setParameterByClass(
'ilObjTestGUI',
'ref_id', $a_target);
3078 $DIC->ctrl()->redirectByClass(
'ilObjTestGUI',
'infoScreen');
3080 $main_tpl->setOnScreenMessage(
'info', sprintf(
3081 $lng->
txt(
"msg_no_perm_read_item"),
3092 if ($this->create_question_mode) {
3097 $ilToolbar = $DIC[
'ilToolbar'];
3098 $ilCtrl = $DIC[
'ilCtrl'];
3101 $ilCtrl->saveParameter($this,
'q_mode');
3103 $ilCtrl->setParameterByClass(
'iltestexpresspageobjectgui',
'test_express_mode', 1);
3104 $ilCtrl->setParameter($this,
'test_express_mode', 1);
3105 $ilCtrl->setParameterByClass(
'iltestexpresspageobjectgui',
'q_id', $this->testrequest->raw(
'q_id'));
3106 $ilCtrl->setParameter($this,
'q_id', $this->testrequest->raw(
'q_id'));
3107 $ilToolbar->setFormAction($ilCtrl->getFormActionByClass(
'iltestexpresspageobjectgui',
'edit'));
3109 if ($this->
object->evalTotalPersons() == 0) {
3110 $ilToolbar->addFormButton(
$lng->
txt(
"ass_create_question"),
"addQuestion");
3112 $ilToolbar->addSeparator();
3116 $show_separator =
true;
3119 $questions = $this->
object->getQuestionTitlesAndIndexes();
3123 foreach ($questions as
$id => $label) {
3124 $options[
$id] = $label .
' [' . $this->
lng->txt(
'question_id_short') .
': ' .
$id .
']';
3127 $optionKeys = array_keys($options);
3130 $options[] =
$lng->
txt(
'none');
3133 if (count($questions)) {
3134 if (isset($show_separator) && $show_separator) {
3135 $ilToolbar->addSeparator();
3139 $btn->setCaption(
"test_prev_question");
3140 $btn->setUrl($ilCtrl->getLinkTargetByClass(
'iltestexpresspageobjectgui',
'prevQuestion'));
3141 $ilToolbar->addButtonInstance($btn);
3143 if (count($options) <= 1 || $optionKeys[0] == $qid) {
3144 $btn->setDisabled(
true);
3148 $btn->setCaption(
"test_next_question");
3149 $btn->setUrl($ilCtrl->getLinkTargetByClass(
'iltestexpresspageobjectgui',
'nextQuestion'));
3150 $ilToolbar->addButtonInstance($btn);
3152 if (count($options) <= 1 || $optionKeys[count($optionKeys) - 1] == $qid) {
3153 $btn->setDisabled(
true);
3157 if (count($questions) > 1) {
3158 $ilToolbar->addSeparator();
3160 $si->addCustomAttribute(
"onChange=\"forms['ilToolbar'].submit();\"");
3161 $si->setOptions($options);
3164 $si->setValue($qid);
3167 $ilToolbar->addInputItem($si,
true);
3170 $total = $this->
object->evalTotalPersons();
3172 if (count($questions) && !$total) {
3173 $ilCtrl->setParameter($this,
'q_id', $this->testrequest->raw(
'q_id'));
3174 $ilToolbar->addSeparator();
3175 $ilToolbar->addButton(
$lng->
txt(
"test_delete_page"), $ilCtrl->getLinkTarget($this,
"removeQuestions"));
3178 if (count($questions) > 1 && !$total) {
3179 $ilToolbar->addSeparator();
3180 $ilToolbar->addButton(
$lng->
txt(
"test_move_page"), $ilCtrl->getLinkTarget($this,
"movePageForm"));
3184 $ilAccess = $DIC[
'ilAccess'];
3187 $online_access =
false;
3188 if ($this->
object->getFixedParticipants()) {
3190 if ($online_access_result ===
true) {
3191 $online_access =
true;
3195 if (!$this->
object->getOfflineStatus() && $this->
object->isComplete($this->testQuestionSetConfigFactory->getQuestionSetConfig())) {
3196 if ((!$this->
object->getFixedParticipants() || $online_access) && $ilAccess->checkAccess(
"read",
"", $this->ref_id)) {
3197 $testSession = $this->testSessionFactory->getSession();
3199 $executable = $this->
object->isExecutable($testSession,
$ilUser->getId(), $allowPassIncrease =
true);
3201 if ($executable[
"executable"]) {
3203 $player_instance = $player_factory->getPlayerGUI();
3205 $ilToolbar->addSeparator();
3206 if ($testSession->getActiveId() > 0) {
3207 $ilToolbar->addButton(
$lng->
txt(
'tst_resume_test'), $ilCtrl->getLinkTarget($player_instance,
'resumePlayer'));
3209 $ilToolbar->addButton(
$lng->
txt(
'tst_start_test'), $ilCtrl->getLinkTarget($player_instance,
'startTest'));
3218 if (!$this->
access->checkAccess(
'write',
'', $this->object->getRefId())) {
3222 $this->
copyQuestionsToPool($this->testrequest->raw(
'q_id'), $this->testrequest->raw(
'sel_qpl'));
3223 $this->
ctrl->redirect($this,
'questions');
3229 foreach ($questionIds as $q_id) {
3231 $newIds[$q_id] = $newId;
3235 $result->ids = $newIds;
3236 $result->qpoolid = $qplId;
3245 $newtitle = $question_gui->object->getTitle();
3246 if ($question_gui->object->questionTitleExists($targetParentId, $question_gui->object->getTitle())) {
3248 while ($question_gui->object->questionTitleExists($targetParentId, $question_gui->object->getTitle() .
" ($counter)")) {
3251 $newtitle = $question_gui->object->getTitle() .
" ($counter)";
3254 return $question_gui->object->createNewOriginalFromThisDuplicate($targetParentId, $newtitle);
3263 $ilObjDataCache = $DIC[
'ilObjDataCache'];
3265 if (!$this->
access->checkAccess(
'write',
'', $this->object->getRefId())) {
3269 if (!(
int) $this->testrequest->raw(
'sel_qpl')) {
3270 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
"questionpool_not_selected"));
3275 $qplId = $ilObjDataCache->lookupObjId((
int) $this->testrequest->raw(
'sel_qpl'));
3278 foreach ($result->ids as $oldId => $newId) {
3281 $original_question_id = $questionInstance->getOriginalId();
3282 if ($original_question_id !== null
3285 $oldOriginal->delete($oldOriginal->getId());
3288 $questionInstance->setNewOriginalId($newId);
3291 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
'tst_qst_added_to_pool_' . (count($result->ids) > 1 ?
'p' :
's')),
true);
3292 $this->
ctrl->redirect($this,
'questions');
3302 $title->setRequired(
true);
3303 $form->addItem($title);
3306 $form->addItem($description);
3308 $form->addCommandButton(
'createQuestionPoolAndCopy',
$lng->
txt(
'create'));
3310 if ($this->testrequest->isset(
'q_id') && is_array($this->testrequest->raw(
'q_id'))) {
3311 foreach ($this->testrequest->raw(
'q_id') as
$id) {
3313 $hidden->setValue(
$id);
3314 $form->addItem($hidden);
3323 if (!$this->
access->checkAccess(
'write',
'', $this->object->getRefId())) {
3335 if (!$this->
access->checkAccess(
'write',
'', $this->object->getRefId())) {
3341 'copyAndLinkToQuestionpool' == $this->
ctrl->getCmd() &&
3342 (!$this->testrequest->isset(
'q_id') || !is_array($this->testrequest->raw(
'q_id')))
3344 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
'tst_no_question_selected_for_moving_to_qpl'),
true);
3345 $this->
ctrl->redirect($this,
'questions');
3348 if ($this->testrequest->isset(
'q_id') && is_array($this->testrequest->raw(
'q_id'))) {
3349 foreach ($this->testrequest->raw(
'q_id') as $q_id) {
3356 if (
$type !==
'tst') {
3357 $this->tpl->setOnScreenMessage(
'failure',
$lng->
txt(
'tst_link_only_unassigned'),
true);
3358 $this->
ctrl->redirect($this,
'questions');
3369 if (!$this->
access->checkAccess(
'write',
'', $this->object->getRefId())
3374 if ($this->testrequest->raw(
'title')) {
3375 $title = $this->testrequest->raw(
'title');
3377 $title = $this->testrequest->raw(
'txt_qpl');
3381 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
"questionpool_not_entered"));
3387 $_REQUEST[
'sel_qpl'] =
$ref_id;
3409 if (!$this->
access->checkAccess(
'write',
'', $this->object->getRefId())) {
3416 $questionpools = $this->
object->getAvailableQuestionpools(
3425 if (count($questionpools) == 0) {
3431 case 'copyQuestionsToPool':
3434 case 'copyAndLinkQuestionsToPool':
3436 $hidden->setValue(1);
3437 $form->addItem($hidden);
3442 $DIC->ui()->mainTemplate()->setContent($form->getHTML());
3450 $form->setFormAction($DIC->ctrl()->getFormAction($this));
3451 $form->addCommandButton($cmd, $DIC->language()->txt(
'submit'));
3452 $form->addCommandButton(
'cancelCreateQuestion', $DIC->language()->txt(
'cancel'));
3454 if (count($questionpools) == 0) {
3455 $form->setTitle($this->
lng->txt(
"tst_enter_questionpool"));
3457 $title =
new ilTextInputGUI($DIC->language()->txt(
'title'),
'title');
3458 $title->setRequired(
true);
3459 $form->addItem($title);
3461 $description =
new ilTextAreaInputGUI($DIC->language()->txt(
'description'),
'description');
3462 $form->addItem($description);
3464 $form->
setTitle($this->
lng->txt(
"tst_select_questionpool"));
3467 '' => $DIC->language()->txt(
'please_select')
3470 foreach ($questionpools as
$key => $value) {
3471 $selectOptions[
$key] = $value[
"title"];
3474 $select =
new ilSelectInputGUI($DIC->language()->txt(
'tst_source_question_pool'),
'sel_qpl');
3475 $select->setRequired(
true);
3476 $select->setOptions($selectOptions);
3478 $form->addItem($select);
3481 if ($this->testrequest->isset(
'q_id') && is_array($this->testrequest->raw(
'q_id'))) {
3482 foreach ($this->testrequest->raw(
'q_id') as
$id) {
3484 $hidden->setValue(
$id);
3485 $form->addItem($hidden);
3495 $simpleSetters = array(
3498 'use_pool' =>
'setPoolUsage',
3499 'question_set_type' =>
'setQuestionSetType',
3502 'intro_enabled' =>
'setIntroductionEnabled',
3503 'showinfo' =>
'setShowInfo',
3506 'chb_starting_time' =>
'setStartingTimeEnabled',
3507 'chb_ending_time' =>
'setEndingTimeEnabled',
3508 'password_enabled' =>
'setPasswordEnabled',
3509 'fixedparticipants' =>
'setFixedParticipants',
3510 'limitUsers' =>
'setLimitUsersEnabled',
3513 'nr_of_tries' =>
'setNrOfTries',
3514 'chb_processing_time' =>
'setEnableProcessingTime',
3515 'kiosk' =>
'setKiosk',
3516 'examid_in_test_pass' =>
'setShowExamIdInTestPassEnabled',
3519 'title_output' =>
'setTitleOutput',
3521 'chb_shuffle_questions' =>
'setShuffleQuestions',
3522 'offer_hints' =>
'setOfferingQuestionHintsEnabled',
3523 'instant_feedback_contents' =>
'setInstantFeedbackOptionsByArray',
3524 'instant_feedback_trigger' =>
'setForceInstantFeedbackEnabled',
3525 'answer_fixation_handling' => null,
3526 'obligations_enabled' =>
'setObligationsEnabled',
3529 'chb_use_previous_answers' =>
'setUsePreviousAnswers',
3530 'chb_show_cancel' =>
'setShowCancel',
3531 'chb_postpone' =>
'setPostponingEnabled',
3532 'list_of_questions' =>
'setListOfQuestionsSettings',
3533 'chb_show_marker' =>
'setShowMarker',
3536 'enable_examview' =>
'setEnableExamview',
3537 'showfinalstatement' =>
'setShowFinalStatement',
3538 'redirection_enabled' => null,
3539 'sign_submission' =>
'setSignSubmission',
3540 'mailnotification' =>
'setMailNotification',
3543 'count_system' =>
'withCountSystem',
3544 'score_cutting' =>
'withScoreCutting',
3545 'pass_scoring' =>
'withPassScoring',
3548 'grading_status' =>
'withShowGradingStatusEnabled',
3549 'grading_mark' =>
'withShowGradingMarkEnabled',
3550 'pass_deletion_allowed' =>
'withPassDeletionAllowed',
3551 'results_access_enabled' =>
'withScoreReporting',
3554 'solution_details' =>
'withShowSolutionDetails',
3555 'solution_feedback' =>
'withShowSolutionFeedback',
3556 'solution_suggested' =>
'withShowSolutionSuggested',
3557 'solution_printview' =>
'setShowSolutionPrintview',
3558 'solution_signature' =>
'withShowSolutionSignature',
3559 'examid_in_test_res' =>
'withShowExamIdInTestResults',
3560 'exp_sc_short' =>
'withExportSettingsSingleChoiceShort',
3564 'highscore_enabled' =>
'withHighscoreEnabled',
3567 'anonymity' =>
'setAnonymity',
3568 'enable_archiving' =>
'setEnableArchiving' 3571 if (isset($templateData[
'results_presentation'][
'value'])) {
3572 $templateData[
'results_presentation'][
'value'] = array();
3578 foreach ($simpleSetters as $field => $setter) {
3579 if (!array_key_exists($field, $templateData)) {
3585 case 'count_system':
3586 case 'count_system':
3587 case 'pass_scoring':
3588 case 'score_cutting':
3589 $score_settings = $score_settings->withScoringSettings(
3590 $score_settings->getScoringSettings()->$setter(
3591 (
int) $templateData[$field][
'value']
3596 case 'pass_deletion_allowed':
3597 case 'grading_status':
3598 case 'grading_mark':
3599 $score_settings = $score_settings->withResultSummarySettings(
3600 $score_settings->getResultSummarySettings()->$setter(
3601 (
bool) $templateData[$field][
'value']
3605 case 'results_access_enabled':
3606 $score_settings = $score_settings->withResultSummarySettings(
3607 $score_settings->getResultSummarySettings()->$setter(
3608 (
int) $templateData[$field][
'value']
3613 case 'solution_details':
3614 case 'solution_feedback':
3615 case 'solution_suggested':
3616 case 'solution_printview':
3617 case 'solution_signature':
3618 case 'examid_in_test_res':
3619 case 'exp_sc_short':
3620 $score_settings = $score_settings->withResultDetailsSettings(
3621 $score_settings->getResultDetailsSettings()->$setter(
3622 (
bool) $templateData[$field][
'value']
3627 case 'highscore_enabled':
3628 $score_settings = $score_settings->withGamificationSettings(
3629 $score_settings->getGamificationSettings()->$setter(
3630 (
bool) $templateData[$field][
'value']
3636 if ($templateData[$field][
'value'] > 0) {
3644 case 'redirection_enabled':
3653 if (strlen($templateData[$field][
'value'])) {
3662 case 'answer_fixation_handling':
3663 switch ($templateData[$field][
'value']) {
3687 if (strlen($setter)) {
3688 $object->$setter($templateData[$field][
'value']);
3698 $ilAccess = $DIC[
'ilAccess'];
3699 if (!$ilAccess->checkAccess(
"write",
"", $this->ref_id)) {
3701 $this->tpl->setOnScreenMessage(
'info', $this->
lng->txt(
"cannot_edit_test"),
true);
3702 $this->
ctrl->redirect($this,
"infoScreen");
3706 $ilCtrl = $DIC[
'ilCtrl'];
3708 $orders = $obligations = array();
3710 foreach ((array) $this->testrequest->raw(
'order') as $qId => $order) {
3711 $id = (
int) str_replace(
'q_',
'', $qId);
3713 $orders[
$id] = $order;
3716 if ($this->
object->areObligationsEnabled() && $this->testrequest->isset(
'obligatory') && is_array($this->testrequest->raw(
'obligatory'))) {
3717 foreach ($this->testrequest->raw(
'obligatory') as $qId => $obligation) {
3718 $id = (
int) str_replace(
'q_',
'', $qId);
3721 $obligations[
$id] = $obligation;
3726 $this->
object->setQuestionOrderAndObligations(
3731 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
'saved_successfully'),
true);
3732 $ilCtrl->redirect($this,
'questions');
3742 $ilCtrl = $DIC[
'ilCtrl'];
3745 if (!$this->
access->checkAccess(
'write',
'', $this->object->getRefId())) {
3750 $form->setFormAction($ilCtrl->getFormAction($this,
"movePage"));
3751 $form->setTitle(
$lng->
txt(
"test_move_page"));
3754 $old_pos->setValue($this->testrequest->raw(
'q_id'));
3755 $form->addItem($old_pos);
3757 $questions = $this->
object->getQuestionTitlesAndIndexes();
3758 if (!is_array($questions)) {
3759 $questions = array();
3762 foreach ($questions as $k => $q) {
3763 if ($k == $this->testrequest->raw(
'q_id')) {
3764 unset($questions[$k]);
3767 $questions[$k] =
$lng->
txt(
'behind') .
' ' . $q;
3769 #$questions['0'] = $lng->txt('first'); 3774 foreach ($questions as $k => $q) {
3775 $options[$k] = $q .
' [' . $this->
lng->txt(
'question_id_short') .
': ' . $k .
']';
3779 $pos->setOptions($options);
3780 $form->addItem($pos);
3782 $form->addCommandButton(
"movePage",
$lng->
txt(
"submit"));
3783 $form->addCommandButton(
"showPage",
$lng->
txt(
"cancel"));
3791 $ilAccess = $DIC[
'ilAccess'];
3792 if (!$ilAccess->checkAccess(
"write",
"", $this->ref_id)) {
3794 $this->tpl->setOnScreenMessage(
'info', $this->
lng->txt(
"cannot_edit_test"),
true);
3795 $this->
ctrl->redirect($this,
"infoScreen");
3798 $this->
object->moveQuestionAfter($this->testrequest->raw(
'q_id'), $this->testrequest->raw(
'position_after'));
3805 $ilCtrl = $DIC[
'ilCtrl'];
3807 $ilCtrl->setParameterByClass(
'iltestexpresspageobjectgui',
'q_id', $this->testrequest->raw(
'q_id'));
3808 $ilCtrl->redirectByClass(
'iltestexpresspageobjectgui',
'showPage');
3814 $ilAccess = $DIC[
'ilAccess'];
3815 if (!$ilAccess->checkAccess(
"write",
"", $this->ref_id)) {
3817 $this->tpl->setOnScreenMessage(
'info', $this->
lng->txt(
"cannot_edit_test"),
true);
3818 $this->
ctrl->redirect($this,
"infoScreen");
3821 if ($this->testrequest->hasQuestionId() && !is_array($this->testrequest->raw(
'q_id'))) {
3822 $ids = [$this->testrequest->getQuestionId()];
3823 } elseif ($this->testrequest->getQuestionIds()) {
3824 $ids = $this->testrequest->getQuestionIds();
3826 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
'copy_no_questions_selected'),
true);
3827 $this->
ctrl->redirect($this,
'questions');
3832 $questionTitles = $this->
object->getQuestionTitles();
3834 foreach ($ids as
$id) {
3837 $title = $question->object->getTitle();
3839 while (in_array($title .
' (' .
$i .
')', $questionTitles)) {
3843 $title .=
' (' . $i .
')';
3845 $questionTitles[] = $title;
3847 $new_id = $question->object->duplicate(
false, $title);
3850 $clone->object->setObjId($this->
object->getId());
3851 $clone->object->saveToDb();
3853 $this->
object->insertQuestion($this->testQuestionSetConfigFactory->getQuestionSetConfig(), $new_id,
true);
3859 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
'copy_questions_success'),
true);
3861 $this->
ctrl->redirect($this,
'questions');
3870 $path = $this->tree->getPathFull($this->ref_id);
3872 while ($parent = array_pop(
$path)) {
3873 if ($parent[
'type'] ===
'crs') {
3874 $container_ref_id = $parent[
'ref_id'];
3881 $this->objectiveOrientedContainer->setObjId($container_obj_id);
3882 $this->objectiveOrientedContainer->setRefId($container_ref_id);
const MATCHING_QUESTION_IDENTIFIER
initImportForm(string $new_type)
const MULTIPLE_CHOICE_QUESTION_IDENTIFIER
const ADDITIONAL_CONTENT_EDITING_MODE_IPE
copyQuestionsToPoolObject()
static getSettingsTemplateConfig()
getQuestionpoolCreationForm()
setTestAccess($testAccess)
static get(string $a_var)
const PDF_PRINT_VIEW_QUESTIONS
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static _getAvailableQuestionpools($use_object_id=false, $equal_points=false, $could_be_offline=false, $showPath=false, $with_questioncount=false, $permission="read", $usr_id="")
Returns the available question pools for the active user.
populateQuestionBrowserToolbarButtons(ilToolbarGUI $toolbar, string $context)
copyToQuestionpoolObject()
static appendUrlParameterString(string $a_url, string $a_par, bool $xml_style=false)
userResultsGatewayObject()
const ERROR_TEXT_IDENTIFIER
createQuestionObject()
Called when a new question should be created from a test.
setRedirectionMode($redirection_mode=0)
getTabs()
adds tabs to tab gui object
confirmedApplyDefaultsObject()
setTestAccess($testAccess)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static _getLog(int $ts_from, int $ts_to, int $test_id, bool $test_only=false)
Retrieve assessment log datasets from the database.
trackTestObjectReadEvent()
txt(string $a_topic, string $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
reviewobject()
Review tab to create a print of all questions without points and solutions.
fullscreenObject()
show fullscreen view
GUI class for the workflow of copying objects.
const QUESTION_SET_TYPE_RANDOM
copyQuestionToPool($sourceQuestionId, $targetParentId)
$testQuestionSetConfigFactory
uploadObject($redirect=true)
display status information or report errors messages in case of error
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
setOnScreenMessage(string $type, string $a_txt, bool $a_keep=false)
Set a message to be displayed to the user.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
prepareOutput(bool $show_sub_objects=true)
cancelCreateQuestionObject()
Called when the creation of a new question is cancelled.
buildPageViewToolbar($qid=0)
static stripSlashes(string $a_str, bool $a_strip_html=true, string $a_allow="")
static getQuestionTypeByTypeId($type_id)
const SCORE_REPORTING_AFTER_PASSED
static getImagePath(string $img, string $module_path="", string $mode="output", bool $offline=false)
get image path (for images located in a template directory)
determineObjectiveOrientedContainer()
setTestAccess($testAccess)
insertQuestionsBeforeObject()
Insert checked questions before the actual selection.
const ANSWER_FIXATION_NONE
const KPRIM_CHOICE_QUESTION_IDENTIFIER
static formatDate(ilDateTime $date, bool $a_skip_day=false, bool $a_include_wd=false, bool $include_seconds=false)
getDidacticTemplateVar(string $type)
Get didactic template setting from creation screen.
static _getQuestionTypeName($type_tag)
const LONG_MENU_QUESTION_IDENTIFIER
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
const TEXTSUBSET_QUESTION_IDENTIFIER
static lookupParentObjId(int $questionId)
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 _getOriginalId(int $question_id)
const REDIRECT_NONE
Redirect after finishing test constants.
historyObject()
Creates the change history for a test.
downloadFileObject()
download file
loadLanguageModule(string $a_module)
Load language module.
createQuestionpoolTargetObject($cmd)
Called when a new question should be created from a test Important: $cmd may be overwritten if no que...
createObject()
create new object form
insertRandomSelectionObject()
Inserts a random selection into the test.
redirectTo_ilObjTestSettingsGeneralGUI_showForm_Object()
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
const CMD_BROWSE_QUESTIONS
confirmRemoveQuestionsObject()
Remove questions from the test after confirmation.
static setTokenMaxLifetimeInSeconds(int $token_max_lifetime_in_seconds)
static getStyleSheetLocation(string $mode="output", string $a_css_name="", string $a_css_location="")
get full style sheet file name (path inclusive) of current user
static accessViolationRedirect()
infoScreen($session_lock="")
show information screen
redirectAfterMissingRead()
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static $infoScreenChildClasses
setRedirectionUrl($redirection_url=null)
static _getQuestionGUI(string $question_type='', int $question_id=-1)
Creates a question gui representation and returns the alias to the question gui.
redirectAfterMissingWrite()
addDefaultsObject()
Adds the defaults of this test to the defaults.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
participantsActionObject()
Evaluates the actions on the participants page.
static useRelativeDates()
const FILE_UPLOAD_IDENTIFIER
static unzip(string $path_to_zip_file, bool $overwrite_existing=false, bool $unpack_flat=false)
uploadTst()
imports test and question(s)
static _lookupObjId(int $ref_id)
static instantiateQuestionGUI(int $a_question_id)
setCreationMode(bool $mode=true)
if true, a creation screen is displayed the current [ref_id] don't belong to the current class! The m...
cancelRemoveQuestionsObject()
Cancels the removal of questions from the test.
Interface ilCtrlBaseClassInterface describes ilCtrl base classes.
setWriteAccess(bool $value)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
isCommandClassAnyInfoScreenChild()
saveOrderAndObligationsObject()
copyAndLinkQuestionsToPoolObject()
ilObjectDataCache $ilObjDataCache
const SCORE_REPORTING_IMMIDIATLY
static _lookupOnlineTestAccess($a_test_id, $a_user_id)
Checks if a user is allowd to run an online exam.
removeImportFailsObject()
questionsTabGatewayObject()
static instantiateQuestion(int $question_id)
const ALLOWED_TAGS_IN_TITLE_AND_DESCRIPTION
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
const ANSWER_FIXATION_ON_INSTANT_FEEDBACK
static _needsManualScoring(int $question_id)
copyAndLinkToQuestionpoolObject()
setAutosaveIval($autosave_ival)
ilGlobalTemplateInterface $tpl
deleteRegisteredImportFails()
static _lookupTitle(int $obj_id)
const NUMERIC_QUESTION_IDENTIFIER
setContent(string $a_html)
Sets content for standard template.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
removeQuestionsObject()
Called when a selection of questions should be removed from the test.
$objectiveOrientedContainer
const ORDERING_HORIZONTAL_IDENTIFIER
const COUNT_PARTIAL_SOLUTIONS
applyDefaultsObject($confirmed=false)
Applies the selected test defaults.
download_paragraphObject()
download source code paragraph
const QT_MULTIPLE_CHOICE_SR
fetchAuthoringQuestionIdParameter()
Class ilObjectGUI Basic methods of all Output classes.
static delDir(string $a_dir, bool $a_clean_only=false)
removes a dir and all its content (subdirs and files) recursively
setValue(string $a_value)
const ORDERING_QUESTION_IDENTIFIER
insertQuestionsAfterObject()
Insert checked questions after the actual selection.
static _recordReadEvent(string $a_type, int $a_ref_id, int $obj_id, int $usr_id, bool $isCatchupWriteEvents=true, $a_ext_rc=null, $a_ext_time=null)
static getInstanceByRefId(int $ref_id, bool $stop_on_error=true)
get an instance of an Ilias object by reference id
createQuestionPool($name="dummy", $description="")
Creates a new questionpool and returns the reference id.
__construct($refId=null)
Constructor public.
if(!defined('PATH_SEPARATOR')) $GLOBALS['_PEAR_default_error_mode']
static originalQuestionExists(int $questionId)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
afterSave(ilObject $new_object)
Post (successful) object creation hook.
static moveUploadedFile(string $a_file, string $a_name, string $a_target, bool $a_raise_errors=true, string $a_mode="move_uploaded")
move uploaded file
getParentId(int $a_node_id)
get parent id of given node
static _getLink(?int $a_ref_id, string $a_type='', array $a_params=array(), string $append="")
static getSyntaxStylePath()
infoScreenObject()
this one is called from the info button in the repository not very nice to set cmdClass/Cmd manually...
insertQuestionsBeforeOrAfter(int $insert_mode)
const TEXT_QUESTION_IDENTIFIER
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
addDidacticTemplateOptions(array &$options)
static isQuestionObligationPossible($questionId)
checks wether the obligation for question with given id is possible or not
static getContentStylePath(int $a_style_id, bool $add_random=true, bool $add_token=true)
get content style path static (to avoid full reading)
const EDIT_CONTEXT_AUTHORING
const TAB_ID_LEARNING_PROGRESS
setCustomRolesForSelection(array $a_roles)
Set custom roles for mapping to LTI roles.
const PRESENTATION_CONTEXT_TEST
getTargetQuestionpoolForm($questionpools, $cmd)
setTabsManager($tabsManager)
const QT_MULTIPLE_CHOICE_MR
static getAllSettingsTemplates(string $a_type, bool $a_include_auto_generated=false)
Get all settings templates of type.
checkPermissionBool(string $perm, string $cmd="", string $type="", ?int $ref_id=null)
const SCORE_REPORTING_FINISHED
static isObjectiveTest(int $a_trst_ref_id)
Check if test ref_id is used in an objective course.
importFileObject(int $parent_id=null)
form for new test object import
static redirect(string $a_script)
static _createImportDirectory()
creates data directory for import files (data_dir/tst_data/tst_<id>/import, depending on data directo...
const TEST_FIXED_SEQUENCE
Test constants.
executeCommand()
execute command
exportObject()
Gateway for exports initiated from workspace, as there is a generic forward to {objTypeMainGUI}::expo...
redirectToInfoScreenObject()
const SCORE_REPORTING_DATE
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...
createQuestionPoolAndCopyObject()
importVerifiedFileObject()
imports question(s) into the questionpool (after verification)
createRandomSelectionObject()
certificateObject()
Shows the certificate editor.
cancelRandomSelectObject()
__construct(Container $dic, ilPlugin $plugin)
applyTemplate($templateData, ilObjTest $object)
getReturnLocation(string $cmd, string $default_location="")
Get return location for command (command is method name without "Object", e.g.
const LP_CONTEXT_REPOSITORY
This class represents a text area property in a property form.
const ADDITIONAL_CONTENT_EDITING_MODE_RTE
executeCreateQuestionObject()
Called when a new question should be created from a test after confirmation.
initQuestion($questionId, $parentObjId)
static isAdditionalQuestionContentEditingModePageObjectEnabled()
Returns the fact wether content editing with ilias page editor is enabled for questions or not...
const QUESTION_SET_TYPE_FIXED
setFollowupQuestionAnswerFixationEnabled($followupQuestionAnswerFixationEnabled)
movePageFormObject()
Move current page.
const RENDER_PURPOSE_PRINT_PDF
testResultsGatewayObject()
getObjectiveOrientedContainer()
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
moveQuestionsObject()
Marks selected questions for moving.
New PermissionGUI (extends from old ilPermission2GUI) RBAC related output.
Service GUI class for tests.
insertQuestionsObject()
Insert questions from the questionbrowser into the test.
printobject()
Print tab to create a print of all questions with points and solutions.
static generatePDF($pdf_output, $output_mode, $filename=null, $purpose=null)
static prepareGenerationRequest(string $service, string $purpose)
Prepare the content processing for a PDF generation request This function should be called as in a re...
deleteDefaultsObject()
Deletes selected test defaults.
const PDF_OUTPUT_DOWNLOAD
const ANSWER_FIXATION_ON_IFB_OR_FUQST
static _lookupType(int $id, bool $reference=false)
setInstantFeedbackAnswerFixationEnabled($instantFeedbackAnswerFixationEnabled)
static setUseRelativeDates(bool $a_status)
set use relative dates
getScoreSettingsRepository()
backObject()
Called when the back button in the question browser was pressed.
const SINGLE_CHOICE_QUESTION_IDENTIFIER
addHeaderAction()
Add header action menu.
static clear(string $a_var)
copyQuestionsToPool($questionIds, $qplId)
const RENDER_PURPOSE_PREVIEW
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...
const SUBTAB_ID_QST_PAGE_VIEW
ILIAS Test InternalRequestService $testrequest
static set(string $a_var, $a_val)
Set a value.
showMediaFullscreen(int $a_style_id=0)
show fullscreen view of media object
Settings template application class.
const CLOZE_TEST_IDENTIFIER
Question identifier constants.
static _setImportDirectory($a_import_dir=null)
send_paragraph(string $par_id, string $filename)
static getInstanceFromAjaxCall()
(Re-)Build instance from ajax call
static _getTestDefaults($test_defaults_id)
const ANSWER_FIXATION_ON_FOLLOWUP_QUESTION
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static _gotoRepositoryRoot(bool $raise_error=false)
Goto repository root.
static _getImportDirectory()
Get the import directory location of the test.
const CMD_SHOW_FORM
command constants
const QT_ORDERING_HORIZONTAL
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
const IMAGEMAP_QUESTION_IDENTIFIER
deleteRegisteredImportFails()
const SUBTAB_ID_QST_LIST_VIEW
const FORMULA_QUESTION_IDENTIFIER
removeQuestionsForm($checked_questions)
Displays a form to confirm the removal of questions from the test.