38 'cancelSuggestedSolution',
39 'saveSuggestedSolution',
121 protected \ILIAS\TestQuestionPool\InternalRequestService
$request;
127 $this->
lng = $DIC[
'lng'];
128 $this->tpl = $DIC[
'tpl'];
129 $this->
ctrl = $DIC[
'ilCtrl'];
130 $this->
ui = $DIC->ui();
131 $this->ilObjDataCache = $DIC[
'ilObjDataCache'];
132 $this->
access = $DIC->access();
133 $this->
ilHelp = $DIC[
'ilHelp'];
134 $this->ilUser = $DIC[
'ilUser'];
135 $this->ilTabs = $DIC[
'ilTabs'];
136 $this->rbacsystem = $DIC[
'rbacsystem'];
137 $this->request = $DIC->testQuestionPool()->internal()->request();
138 $this->tree = $DIC[
'tree'];
139 $this->ilDB = $DIC->database();
140 $this->component_repository = $DIC[
'component.repository'];
141 $this->
ctrl->saveParameter($this,
"q_id");
142 $this->
ctrl->saveParameter($this,
"prev_qid");
143 $this->
ctrl->saveParameter($this,
"calling_test");
144 $this->
ctrl->saveParameter($this,
"calling_consumer");
145 $this->
ctrl->saveParameter($this,
"consumer_context");
146 $this->
ctrl->saveParameterByClass(
'ilAssQuestionPageGUI',
'test_express_mode');
147 $this->
ctrl->saveParameterByClass(
'ilAssQuestionPageGUI',
'calling_consumer');
148 $this->
ctrl->saveParameterByClass(
'ilAssQuestionPageGUI',
'consumer_context');
149 $this->
ctrl->saveParameterByClass(
'ilobjquestionpoolgui',
'test_express_mode');
150 $this->
ctrl->saveParameterByClass(
'ilobjquestionpoolgui',
'calling_consumer');
151 $this->
ctrl->saveParameterByClass(
'ilobjquestionpoolgui',
'consumer_context');
153 $this->errormessage = $this->
lng->txt(
"fill_out_all_required_fields");
154 $this->notes_gui = $DIC->notes()->gui();
168 echo $this->
getHeaderAction() . $this->
ui->mainTemplate()->getOnLoadCodeForAsynch();
174 $parentObjType = $this->ilObjDataCache->lookupType($this->
object->getObjId());
180 $this->request->getRefId(),
181 $this->
object->getObjId()
186 $ha = $dispatcher->initHeaderAction();
187 $ha->enableComments(
true,
false);
189 return $ha->getHeaderAction($this->
ui->mainTemplate());
194 $notesGUI =
new ilNoteGUI($this->
object->getObjId(), $this->
object->getId(),
'quest');
196 $notesGUI->enablePublicNotesDeletion(
true);
198 return $notesGUI->getCommentsHTML();
203 $this->
ilHelp->setScreenIdComponent(
'qpl');
205 $next_class = $this->
ctrl->getNextClass($this);
207 switch ($next_class) {
208 case 'ilformpropertydispatchgui':
211 $form_prop_dispatch->setItem($form->getItemByPostVar(
ilUtil::stripSlashes($this->request->raw(
'postvar'))));
212 $this->
ctrl->forwardCommand($form_prop_dispatch);
216 $cmd = $this->
ctrl->getCmd(
'editQuestion');
218 if (in_array($cmd, self::SUGGESTED_SOLUTION_COMMANDS)) {
222 if (in_array($cmd, [
'save',
'saveReturn',
'editQuestion'])) {
227 if (method_exists($this, $cmd)) {
233 $this->callSpecialQuestionCommands($cmd);
240 return static::HAS_SPECIAL_QUESTION_COMMANDS;
400 if (is_object($this->
object)) {
424 $this->tpl->setContent(implode(
'<br />', array(
425 $stats_table->getHTML(),
426 $usage_table->getHTML()
436 $ilCtrl = $DIC[
'ilCtrl'];
437 $ilDB = $DIC[
'ilDB'];
440 if (($question_type ===
'') && ($question_id > 0)) {
444 if ($question_type ===
'') {
450 $question_type_gui = $question_type .
'GUI';
451 $question =
new $question_type_gui();
454 $question->object->feedbackOBJ =
new $feedbackObjectClassname($question->object, $ilCtrl, $ilDB, $lng);
456 if ($question_id > 0) {
457 $question->object->loadFromDb($question_id);
478 return $q_type .
"GUI";
496 if (!$this->tpl->blockExists(
'content')) {
497 $this->tpl->addBlockFile(
"CONTENT",
"content",
"tpl.il_as_qpl_content.html",
"Modules/TestQuestionPool");
500 if (!$this->tpl->blockExists(
'statusline')) {
501 $this->tpl->addBlockFile(
"STATUSLINE",
"statusline",
"tpl.statusline.html");
504 if (!$this->tpl->blockExists(
'adm_content')) {
505 $this->tpl->addBlockFile(
"ADM_CONTENT",
"adm_content",
"tpl.il_as_question.html",
"Modules/TestQuestionPool");
512 $this->tpl->setVariable(
"QUESTION_DATA", $form->
getHTML());
522 [$this->
object->getId() => $html]
524 $presentation = $page_gui->presentation();
525 $presentation = preg_replace(
"/src=\"\\.\\//ims",
"src=\"" . ILIAS_HTTP_PATH .
"/", $presentation);
526 return $presentation;
529 public function outQuestionPage($a_temp_var, $a_postponed =
false, $active_id =
"", $html =
"", $inlineFeedbackEnabled =
false): string
531 if ($this->
object->getTestPresentationConfig()->isSolutionInitiallyPrefilled()) {
535 } elseif ($this->
object->getTestPresentationConfig()->isUnchangedAnswerPossible()) {
539 $this->
lng->loadLanguageModule(
"content");
543 $page_gui->setTemplateTargetVar($a_temp_var);
547 $page_gui->setQuestionActionsHTML($this->
getNavigationGUI()->getActionsHTML());
551 $page_gui->setQuestionHTML(array($this->
object->getId() => $html));
554 $page_gui->setPresentationTitle($this->questionHeaderBlockBuilder->getPresentationTitle());
555 $page_gui->setQuestionInfoHTML($this->questionHeaderBlockBuilder->getQuestionInfoHTML());
557 return $page_gui->presentation();
562 $tpl =
new ilTemplate(
'tpl.tst_question_additional_behaviour_checkbox.html',
true,
true,
'Modules/TestQuestionPool');
563 $tpl->
setVariable(
'TXT_FORCE_FORM_DIFF_LABEL', $this->
object->getTestPresentationConfig()->getUseUnchangedAnswerLabel());
569 return $this->
lng->txt(
'use_previous_solution_advice');
574 $tpl =
new ilTemplate(
'tpl.tst_question_additional_behaviour_checkbox.html',
true,
true,
'Modules/TestQuestionPool');
575 $tpl->
setVariable(
'TXT_FORCE_FORM_DIFF_LABEL', $this->
lng->txt(
'use_previous_solution'));
581 if ($this->request->raw(
"calling_test")) {
582 $_GET[
"ref_id"] = $this->request->raw(
"calling_test");
583 ilUtil::redirect(
"ilias.php?baseClass=ilObjTestGUI&cmd=questions&ref_id=" . $this->request->raw(
"calling_test"));
584 } elseif ($this->request->raw(
"test_ref_id")) {
585 $_GET[
"ref_id"] = $this->request->raw(
"test_ref_id");
586 ilUtil::redirect(
"ilias.php?baseClass=ilObjTestGUI&cmd=questions&ref_id=" . $this->request->raw(
"test_ref_id"));
588 if ($this->request->raw(
"q_id") > 0) {
589 $this->
ctrl->setParameterByClass(
"ilAssQuestionPageGUI",
"q_id", $this->request->getQuestionId());
590 $this->
ctrl->redirectByClass(
"ilAssQuestionPageGUI",
"edit");
592 $this->
ctrl->redirectByClass(
"ilobjquestionpoolgui",
"questions");
597 public function originalSyncForm(
string $return_to =
"",
string $return_to_feedback =
''): void
599 if (strlen($return_to)) {
600 $this->
ctrl->setParameter($this,
"return_to", $return_to);
601 } elseif ($this->request->raw(
'return_to')) {
602 $this->
ctrl->setParameter($this,
"return_to", $this->request->raw(
'return_to'));
604 if (strlen($return_to_feedback)) {
605 $this->
ctrl->setParameter($this,
'return_to_fb',
'true');
608 $this->
ctrl->saveParameter($this,
'test_express_mode');
610 $template =
new ilTemplate(
"tpl.il_as_qpl_sync_original.html",
true,
true,
"Modules/TestQuestionPool");
611 $template->setVariable(
"BUTTON_YES", $this->
lng->txt(
"yes"));
612 $template->setVariable(
"BUTTON_NO", $this->
lng->txt(
"no"));
613 $template->setVariable(
"FORM_ACTION", $this->
ctrl->getFormAction($this));
614 $template->setVariable(
"TEXT_SYNC", $this->
lng->txt(
"confirm_sync_questions"));
615 $this->tpl->setVariable(
"ADM_CONTENT", $template->get());
620 $original_id = $this->
object->getOriginalId();
622 $this->
object->syncWithOriginal();
623 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
"msg_obj_modified"),
true);
625 if (strlen($this->request->raw(
"return_to"))) {
626 $this->
ctrl->redirect($this, $this->request->raw(
"return_to"));
628 if (strlen($this->request->raw(
"return_to_fb"))) {
629 $this->
ctrl->redirectByClass(
'ilAssQuestionFeedbackEditingGUI',
'showFeedbackForm');
631 if ($this->request->isset(
'calling_consumer') && (
int) $this->request->raw(
'calling_consumer')) {
632 $ref_id = (
int) $this->request->raw(
'calling_consumer');
635 $this->
ctrl->redirectToURL($consumer->getQuestionEditingFormBackTarget($this->request->raw(
'consumer_context')));
640 if ($this->request->raw(
'test_express_mode')) {
650 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
"msg_obj_modified"),
true);
652 if (strlen($this->request->raw(
"return_to"))) {
653 $this->
ctrl->redirect($this, $this->request->raw(
"return_to"));
655 if (strlen($this->request->raw(
'return_to_fb'))) {
656 $this->
ctrl->redirectByClass(
'ilAssQuestionFeedbackEditingGUI',
'showFeedbackForm');
658 if ($this->request->isset(
'calling_consumer') && (
int) $this->request->raw(
'calling_consumer')) {
659 $ref_id = (
int) $this->request->raw(
'calling_consumer');
662 $this->
ctrl->redirectToURL($consumer->getQuestionEditingFormBackTarget($this->request->raw(
'consumer_context')));
667 if ($this->request->raw(
'test_express_mode')) {
680 $ilUser->
setPref(
"tst_lastquestiontype", $this->
object->getQuestionType());
681 $ilUser->
writePref(
"tst_lastquestiontype", $this->
object->getQuestionType());
682 $this->
object->saveToDb();
683 $originalexists = $this->
object->_questionExists($this->
object->getOriginalId());
686 $this->
ctrl->redirect($this,
"originalSyncForm");
687 } elseif ($this->request->raw(
"calling_test")) {
688 $_GET[
"ref_id"] = $this->request->raw(
"calling_test");
689 ilUtil::redirect(
"ilias.php?baseClass=ilObjTestGUI&cmd=questions&ref_id=" . $this->request->raw(
"calling_test"));
691 } elseif ($this->request->raw(
"test_ref_id")) {
693 $tree = $DIC[
'tree'];
694 $ilDB = $DIC[
'ilDB'];
695 $component_repository = $DIC[
'component.repository'];
697 $_GET[
"ref_id"] = $this->request->raw(
"test_ref_id");
698 $test =
new ilObjTest($this->request->raw(
"test_ref_id"),
true);
702 $test->insertQuestion($testQuestionSetConfigFactory->getQuestionSetConfig(), $this->
object->
getId());
704 ilUtil::redirect(
"ilias.php?baseClass=ilObjTestGUI&cmd=questions&ref_id=" . $this->request->raw(
"test_ref_id"));
706 $this->
ctrl->setParameter($this,
"q_id", $this->
object->getId());
707 $this->editQuestion();
709 $this->tpl->setOnScreenMessage(
'success',
ilSession::get(
"info") .
"<br />" . $this->
lng->txt(
"msg_obj_modified"),
false);
711 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
"msg_obj_modified"),
false);
713 $this->
ctrl->setParameterByClass(
"ilAssQuestionPageGUI",
"q_id", $this->
object->getId());
714 $this->
ctrl->redirectByClass(
"ilAssQuestionPageGUI",
"edit");
722 $old_id = $this->request->raw(
"q_id");
726 $ilUser->
setPref(
"tst_lastquestiontype", $this->
object->getQuestionType());
727 $ilUser->
writePref(
"tst_lastquestiontype", $this->
object->getQuestionType());
728 $this->
object->saveToDb();
729 if ($this->
object->getOriginalId() == null) {
730 $originalexists =
false;
732 $originalexists = $this->
object->_questionExistsInPool($this->
object->getOriginalId());
735 if (($this->request->raw(
"calling_test") ||
736 ($this->request->isset(
'calling_consumer')
737 && (
int) $this->request->raw(
'calling_consumer')))
739 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
"msg_obj_modified"),
true);
740 $this->
ctrl->setParameter($this,
'return_to',
'editQuestion');
741 $this->
ctrl->redirect($this,
"originalSyncForm");
745 if ($this->request->raw(
"calling_test")) {
746 $test =
new ilObjTest($this->request->raw(
"calling_test"));
751 $component_repository = $DIC[
'component.repository'];
753 $test =
new ilObjTest($this->request->raw(
"calling_test"),
true);
756 $new_q_id = $this->
object->getId();
757 if ($test->getRefId() !== $this->request->int(
'ref_id')) {
758 $new_q_id = $this->
object->duplicate(
true, $this->
object->getTitle(), $this->
object->getAuthor(), $this->
object->getOwner(), $test->getId());
761 $test->insertQuestion(
762 $testQuestionSetConfigFactory->getQuestionSetConfig(),
767 if ($this->request->isset(
'prev_qid')) {
768 $test->moveQuestionAfter($new_q_id, $this->request->raw(
'prev_qid'));
771 $this->
ctrl->setParameter($this,
'q_id', $new_q_id);
772 $this->
ctrl->setParameter($this,
'ref_id', $this->request->raw(
'calling_test'));
773 $this->
ctrl->setParameter($this,
'calling_test', $this->request->raw(
"calling_test"));
775 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
"msg_obj_modified"),
true);
776 $this->
ctrl->redirect($this,
'editQuestion');
780 if ($this->
object->getId() != $old_id) {
782 $this->
ctrl->setParameterByClass($this->request->raw(
"cmdClass"),
"q_id", $this->
object->getId());
783 $this->
ctrl->setParameterByClass($this->request->raw(
"cmdClass"),
"sel_question_types", $this->request->raw(
"sel_question_types"));
784 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
"msg_obj_modified"),
true);
785 if ($this->request->raw(
'prev_qid')) {
787 $test =
new ilObjTest($this->request->getRefId(),
true);
788 $test->moveQuestionAfter($this->request->raw(
'prev_qid'), $this->
object->getId());
790 if ($this->request->raw(
'express_mode')) {
796 $test =
new ilObjTest($this->request->getRefId(),
true);
798 $test->insertQuestion(
799 $testQuestionSetConfigFactory->getQuestionSetConfig(),
800 $this->
object->
getId()
802 $_REQUEST[
'q_id'] = $this->
object->getId();
806 $this->
ctrl->redirectByClass($this->request->raw(
"cmdClass"),
"editQuestion");
809 $this->tpl->setOnScreenMessage(
'success',
ilSession::get(
"info") .
"<br />" . $this->
lng->txt(
"msg_obj_modified"),
true);
811 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
"msg_obj_modified"),
true);
813 $this->
ctrl->redirect($this,
'editQuestion');
823 $old_id = $this->request->getQuestionId();
826 $ilUser->
setPref(
"tst_lastquestiontype", $this->
object->getQuestionType());
827 $ilUser->
writePref(
"tst_lastquestiontype", $this->
object->getQuestionType());
828 $this->
object->saveToDb($old_id);
829 if ($this->
object->getOriginalId() == null) {
830 $originalexists =
false;
832 $originalexists = $this->
object->_questionExistsInPool($this->
object->getOriginalId());
834 if (($this->request->raw(
"calling_test") || ($this->request->isset(
'calling_consumer')
835 && (
int) $this->request->raw(
'calling_consumer')))
837 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
"msg_obj_modified"),
true);
838 $this->
ctrl->setParameter($this,
'test_express_mode', $this->request->raw(
'test_express_mode'));
839 $this->
ctrl->redirect($this,
"originalSyncForm");
841 } elseif ($this->request->raw(
"calling_test")) {
842 $test =
new ilObjTest($this->request->raw(
"calling_test"));
847 $test =
new ilObjTest($this->request->raw(
"calling_test"),
true);
851 $new_q_id = $this->
object->getId();
852 if ($test->getRefId() !== $this->request->int(
'ref_id')) {
853 $new_q_id = $this->
object->duplicate(
true, $this->
object->getTitle(), $this->
object->getAuthor(), $this->
object->getOwner(), $test->getId());
856 $test->insertQuestion(
857 $testQuestionSetConfigFactory->getQuestionSetConfig(),
862 if ($this->request->isset(
'prev_qid')) {
863 $test->moveQuestionAfter($new_q_id, $this->request->raw(
'prev_qid'));
866 $this->
ctrl->setParameter($this,
'q_id', $new_q_id);
867 $this->
ctrl->setParameter($this,
'ref_id', $this->request->raw(
'calling_test'));
868 $this->
ctrl->setParameter($this,
'calling_test', $this->request->raw(
"calling_test"));
870 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
"msg_obj_modified"),
true);
873 if ($this->
object->getId() != $old_id) {
875 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
"msg_obj_modified"),
true);
876 $this->
ctrl->redirectByClass(
"ilobjquestionpoolgui",
"questions");
879 $this->tpl->setOnScreenMessage(
'success',
ilSession::get(
"info") .
"<br />" . $this->
lng->txt(
"msg_obj_modified"),
true);
881 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
"msg_obj_modified"),
true);
893 $this->
object->saveToDb();
894 $this->
ctrl->setParameter($this,
"q_id", $this->
object->getId());
895 $this->editQuestion();
901 public function getContextPath($cont_obj,
int $a_endnode_id,
int $a_startnode_id = 1): string
905 $tmpPath = $cont_obj->getLMTree()->getPathFull($a_endnode_id, $a_startnode_id);
908 for (
$i = 1;
$i < (count($tmpPath) - 1);
$i++) {
913 $path .= $tmpPath[
$i][
"title"];
921 $this->sequence_no = $nr;
931 $this->question_count = $a_question_count;
951 $this->errormessage .= ((strlen($this->errormessage)) ?
"<br />" :
"") .
$errormessage;
961 return $this->
object->getQuestionType();
967 if (strlen($a_value)) {
968 $result =
" value=\"$a_value\" ";
978 public function addNewIdListener($a_object,
string $a_method,
string $a_parameters =
""): void
981 $this->new_id_listeners[$cnt][
"object"] = &$a_object;
982 $this->new_id_listeners[$cnt][
"method"] = $a_method;
983 $this->new_id_listeners[$cnt][
"parameters"] = $a_parameters;
984 $this->new_id_listener_cnt++;
990 $this->new_id_listeners[
$i][
"parameters"][
"new_id"] = $a_new_id;
991 $object = &$this->new_id_listeners[
$i][
"object"];
992 $method = $this->new_id_listeners[
$i][
"method"];
993 $parameters = $this->new_id_listeners[
$i][
"parameters"];
994 $object->$method($parameters);
1000 if (!$this->
object->getSelfAssessmentEditingMode()) {
1010 $title->setMaxLength(100);
1011 $title->setValue($this->
object->getTitle());
1012 $title->setRequired(
true);
1015 if (!$this->
object->getSelfAssessmentEditingMode()) {
1018 $author->setValue($this->
object->getAuthor());
1019 $author->setMaxLength(512);
1020 $author->setRequired(
true);
1025 $description->setValue($this->
object->getComment());
1026 $description->setRequired(
false);
1032 if (trim($author) ==
"") {
1035 $hi->setValue($author);
1041 $lifecycle->setOptions($this->
object->getLifecycle()->getSelectOptions($this->
lng));
1042 $lifecycle->setValue($this->
object->getLifecycle()->getIdentifier());
1048 $question->setRequired(
true);
1049 $question->setRows(10);
1050 $question->setCols(80);
1052 if (!$this->
object->getSelfAssessmentEditingMode()) {
1054 $question->setUseRte(
true);
1056 $question->addPlugin(
"latex");
1057 $question->addButton(
"latex");
1058 $question->addButton(
"pastelatex");
1059 $question->setRTESupport($this->
object->getId(),
"qpl",
"assessment");
1063 $question->setUseTagsForRteOnly(
false);
1071 if (!$this->
object->getSelfAssessmentEditingMode()) {
1075 $nr_tries = $this->
object->getNrOfTries() ?? $this->
object->getDefaultNrOfTries();
1077 if ($nr_tries < 1) {
1083 $ni->setMinValue(0);
1085 $ni->setMaxLength(5);
1093 $postvar =
"tax_node_assign_$taxonomyId";
1097 $tax_node_assign->saveInput(
"qpl", $this->
object->getObjId(),
"quest", $this->
object->getId());
1106 ilOverlayGUI::initJavaScript();
1109 $sectHeader->setTitle($this->
lng->txt(
'qpl_qst_edit_form_taxonomy_section'));
1114 $label = sprintf($this->
lng->txt(
'qpl_qst_edit_form_taxonomy'), $taxonomy->getTitle());
1115 $postvar =
"tax_node_assign_$taxonomyId";
1124 $taxSelect->setValue(array_map(
function ($assignedNode) {
1125 return $assignedNode[
'node_id'];
1126 }, $assignedNodes));
1139 if ($manual_feedback !==
'') {
1140 return $manual_feedback;
1143 $correct_feedback = $this->
object->feedbackOBJ->getGenericFeedbackTestPresentation($this->
object->getId(),
true);
1144 $incorrect_feedback = $this->
object->feedbackOBJ->getGenericFeedbackTestPresentation($this->
object->getId(),
false);
1145 if ($correct_feedback . $incorrect_feedback !==
'') {
1149 if ($this->
object->isAdditionalContentEditingModePageObject()) {
1152 return $this->
object->prepareTextareaOutput($output,
true);
1156 string $feedback_correct,
1157 string $feedback_incorrect,
1161 if ($pass === null) {
1164 $reached_points = $this->
object->calculateReachedPoints($active_id, $pass);
1165 $max_points = $this->
object->getMaximumPoints();
1166 if ($reached_points == $max_points) {
1167 return $feedback_correct;
1170 return $feedback_incorrect;
1175 return $this->
object->prepareTextareaOutput(
1176 $this->
object->feedbackOBJ->getGenericFeedbackTestPresentation($this->object->getId(),
true),
1183 return $this->
object->prepareTextareaOutput(
1184 $this->
object->feedbackOBJ->getGenericFeedbackTestPresentation($this->object->getId(),
false),
1197 $count = $this->
object->usageNumber();
1199 if ($this->
object->_questionExistsInPool($this->object->getId()) && $count) {
1201 $rbacsystem = $DIC[
'rbacsystem'];
1202 if ($rbacsystem->checkAccess(
"write", $this->request->getRefId())) {
1203 $this->tpl->setOnScreenMessage(
'info', sprintf($this->
lng->txt(
"qpl_question_is_in_use"), $count));
1215 $cmd = $this->request->raw(
'cmd');
1216 $save = is_array($cmd) && array_key_exists(
'saveSuggestedSolution', $cmd);
1217 if ($save && $this->request->int(
'deleteSuggestedSolution') === 1) {
1218 $this->
object->deleteSuggestedSolutions();
1219 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
"msg_obj_modified"),
true);
1220 $this->
ctrl->redirect($this,
"suggestedsolution");
1224 $solution_array = $this->
object->getSuggestedSolution(0);
1226 "lm" => $this->
lng->txt(
"obj_lm"),
1227 "st" => $this->
lng->txt(
"obj_st"),
1228 "pg" => $this->
lng->txt(
"obj_pg"),
1229 "git" => $this->
lng->txt(
"glossary_term"),
1230 "file" => $this->
lng->txt(
"fileDownload"),
1231 "text" => $this->
lng->txt(
"solutionText")
1234 if (!array_key_exists(
'type', $solution_array)) {
1235 $solution_array[
'type'] =
'';
1238 $solution_type = $this->
ctrl->getCmd() ===
'cancelSuggestedSolution' 1239 ? $solution_array[
"type"]
1240 : $this->request->raw(
'solutiontype');
1241 if (is_string($solution_type) &&
1242 strcmp($solution_type,
"file") == 0 &&
1243 strcmp($solution_array[
"type"],
"file") != 0) {
1244 $solution_array = array(
1247 } elseif (is_string($solution_type) &&
1248 strcmp($solution_type,
"text") == 0 &&
1249 strcmp($solution_array[
"type"],
"text") != 0) {
1253 $solution_array = array(
1260 $solution_filename = $this->request->raw(
'filename');
1262 is_string($solution_filename) &&
1263 strlen($solution_filename)) {
1264 $solution_array[
"value"][
"filename"] = $solution_filename;
1267 $solution_text = $this->request->raw(
'solutiontext');
1269 is_string($solution_text) &&
1270 strlen($solution_text)) {
1271 $solution_array[
"value"] = $solution_text;
1273 if (isset($solution_array[
'type']) && $solution_array[
'type'] !==
"") {
1275 $form->setFormAction($this->
ctrl->getFormAction($this));
1276 $form->setTitle($this->
lng->txt(
"solution_hint"));
1277 $form->setMultipart(
true);
1278 $form->setTableWidth(
"100%");
1279 $form->setId(
"suggestedsolutiondisplay");
1283 $template =
new ilTemplate(
"tpl.il_as_qpl_suggested_solution_input_presentation.html",
true,
true,
"Modules/TestQuestionPool");
1284 if (array_key_exists(
"internal_link", $solution_array) &&
1285 strlen($solution_array[
"internal_link"])) {
1287 $template->setCurrentBlock(
"preview");
1288 $template->setVariable(
"TEXT_SOLUTION", $this->
lng->txt(
"suggested_solution"));
1289 $template->setVariable(
"VALUE_SOLUTION",
" <a href=\"$href\" target=\"content\">" . $this->
lng->txt(
"view") .
"</a> ");
1290 $template->parseCurrentBlock();
1291 } elseif ((strcmp($solution_array[
"type"],
"file") == 0) &&
1292 array_key_exists(
'value', $solution_array) && is_array($solution_array[
"value"])) {
1293 $href = $this->
object->getSuggestedSolutionPathWeb() . ($solution_array[
"value"][
"name"] ??
"");
1294 $template->setCurrentBlock(
"preview");
1295 $template->setVariable(
"TEXT_SOLUTION", $this->
lng->txt(
"suggested_solution"));
1298 $solution_array[
"value"][
"filename"]
1299 )) ? $solution_array[
"value"][
"filename"] : $solution_array[
"value"][
"name"]
1301 $template->parseCurrentBlock();
1303 $template->setVariable(
"TEXT_TYPE", $this->
lng->txt(
"type"));
1304 $template->setVariable(
"VALUE_TYPE", $options[$solution_array[
"type"]]);
1305 $title->
setHtml($template->get());
1307 $deletesolution->setOptionTitle($this->
lng->txt(
"deleteSuggestedSolution"));
1308 $title->addSubItem($deletesolution);
1309 $form->addItem($title);
1311 if (strcmp($solution_array[
"type"],
"file") == 0) {
1315 $file->enableFileNameSelection(
"filename");
1317 if ($save && array_key_exists(
"file", $_FILES) &&
1318 array_key_exists(
"tmp_name", $_FILES[
"file"]) &&
1319 $_FILES[
"file"][
"tmp_name"] && $file->checkInput()) {
1320 if (!file_exists($this->
object->getSuggestedSolutionPath())) {
1325 $_FILES[
"file"][
"tmp_name"],
1326 $_FILES[
"file"][
"name"],
1327 $this->
object->getSuggestedSolutionPath() . $_FILES[
"file"][
"name"]
1333 if (array_key_exists(
'value', $solution_array) && is_array($solution_array[
"value"])) {
1334 @unlink($this->
object->getSuggestedSolutionPath() . $solution_array[
"value"][
"name"]);
1336 $file->setValue($_FILES[
"file"][
"name"]);
1337 $this->
object->saveSuggestedSolution(
"file",
"", 0, array(
"name" => $_FILES[
"file"][
"name"],
"type" => $_FILES[
"file"][
"type"],
"size" => $_FILES[
"file"][
"size"],
"filename" => $_POST[
"filename"]));
1339 if (($this->request->raw(
"calling_test") ||
1340 ($this->request->isset(
'calling_consumer') && (
int) $this->request->raw(
'calling_consumer'))) &&
1341 $this->
object->_questionExistsInPool($this->
object->getOriginalId()) &&
1346 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
"suggested_solution_added_successfully"),
true);
1347 $this->
ctrl->redirect($this,
"suggestedsolution");
1351 $this->tpl->setOnScreenMessage(
'info', $res);
1354 if (array_key_exists(
'value', $solution_array) && is_array($solution_array[
"value"])) {
1355 $file->setValue($solution_array[
"value"][
"name"]);
1356 $file->setFilename((strlen($solution_array[
"value"][
"filename"])) ? $solution_array[
"value"][
"filename"] : $solution_array[
"value"][
"name"]);
1359 $form->addItem($file);
1361 $hidden->setValue(
"file");
1362 $form->addItem($hidden);
1363 } elseif (strcmp($solution_array[
"type"],
"text") == 0) {
1364 $solutionContent = $solution_array[
'value'];
1365 $solutionContent = $this->
object->fixSvgToPng($solutionContent);
1366 $solutionContent = $this->
object->fixUnavailableSkinImageSources($solutionContent);
1368 $question->
setValue($this->
object->prepareTextareaOutput($solutionContent));
1369 $question->setRequired(
true);
1370 $question->setRows(10);
1371 $question->setCols(80);
1372 $question->setUseRte(
true);
1373 $question->addPlugin(
"latex");
1374 $question->addButton(
"latex");
1375 $question->setRTESupport($this->
object->getId(),
"qpl",
"assessment");
1377 $hidden->setValue(
"text");
1378 $form->addItem($hidden);
1379 $form->addItem($question);
1381 if ($ilAccess->checkAccess(
"write",
"", $this->request->getRefId())) {
1382 $form->addCommandButton(
'cancelSuggestedSolution', $this->
lng->txt(
'cancel'));
1383 $form->addCommandButton(
'saveSuggestedSolution', $this->
lng->txt(
'save'));
1387 if ($form->checkInput()) {
1388 switch ($solution_array[
"type"]) {
1390 $this->
object->saveSuggestedSolution(
"file",
"", 0, array(
1391 "name" => $solution_array[
"value"][
"name"],
1392 "type" => $solution_array[
"value"][
"type"],
1393 "size" => $solution_array[
"value"][
"size"],
1394 "filename" => $_POST[
"filename"]
1398 $this->
object->saveSuggestedSolution(
"text",
"", 0, $solution_array[
"value"]);
1401 $originalexists = !is_null($this->
object->getOriginalId()) &&
1402 $this->
object->_questionExistsInPool($this->object->getOriginalId());
1403 if (($this->request->raw(
"calling_test") || ($this->request->isset(
'calling_consumer')
1404 && (
int) $this->request->raw(
'calling_consumer'))) && $originalexists
1409 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
"msg_obj_modified"),
true);
1410 $this->
ctrl->redirect($this,
"suggestedsolution");
1415 $output = $form->getHTML();
1418 $savechange = (strcmp($this->
ctrl->getCmd(),
"saveSuggestedSolutionType") == 0) ? true :
false;
1421 if ($ilAccess->checkAccess(
"write",
"", $this->request->getRefId())) {
1423 $formchange->setFormAction($this->
ctrl->getFormAction($this));
1424 $formchange->setTitle((count($solution_array)) ? $this->
lng->txt(
"changeSuggestedSolution") : $this->
lng->txt(
"addSuggestedSolution"));
1425 $formchange->setMultipart(
false);
1426 $formchange->setTableWidth(
"100%");
1427 $formchange->setId(
"suggestedsolution");
1430 foreach ($options as $opt_value => $opt_caption) {
1433 if (count($solution_array)) {
1434 $solutiontype->setValue($solution_array[
"type"]);
1436 $solutiontype->setRequired(
true);
1437 $formchange->addItem($solutiontype);
1439 $formchange->addCommandButton(
"saveSuggestedSolutionType", $this->
lng->txt(
"select"));
1442 $formchange->checkInput();
1444 $changeoutput = $formchange->getHTML();
1447 $this->tpl->setVariable(
"ADM_CONTENT", $changeoutput . $output);
1453 $tree = $DIC[
'tree'];
1455 $type = $this->request->raw(
"link_new_type");
1456 $search = $this->request->raw(
"search_link_type");
1457 $this->
ctrl->setParameter($this,
"link_new_type",
$type);
1458 $this->
ctrl->setParameter($this,
"search_link_type", $search);
1459 $this->
ctrl->saveParameter($this, array(
"subquestion_index",
"link_new_type",
"search_link_type"));
1461 $this->tpl->setOnScreenMessage(
'info', $this->
lng->txt(
"select_object_to_link"));
1463 $parent_ref_id =
$tree->getParentId($this->request->getRefId());
1465 $exp->
setExpand($this->request->raw(
'expand_sol') ? $this->request->raw(
'expand_sol') : $parent_ref_id);
1466 $exp->setExpandTarget($this->
ctrl->getLinkTarget($this,
'outSolutionExplorer'));
1467 $exp->setTargetGet(
"ref_id");
1468 $exp->setRefId($this->request->getRefId());
1469 $exp->addFilter(
$type);
1470 $exp->setSelectableType(
$type);
1471 if ($this->request->isset(
'expandCurrentPath') && $this->request->raw(
'expandCurrentPath')) {
1472 $exp->expandPathByRefId($parent_ref_id);
1478 $template =
new ilTemplate(
"tpl.il_as_qpl_explorer.html",
true,
true,
"Modules/TestQuestionPool");
1479 $template->setVariable(
"EXPLORER_TREE", $exp->getOutput());
1480 $template->setVariable(
"BUTTON_CANCEL", $this->
lng->txt(
"cancel"));
1481 $template->setVariable(
"FORMACTION", $this->
ctrl->getFormAction($this,
"suggestedsolution"));
1482 $this->tpl->setVariable(
"ADM_CONTENT", $template->get());
1488 $tree = $DIC[
'tree'];
1490 switch ($_POST[
"solutiontype"]) {
1513 if (isset($_POST[
'solutiontype'])) {
1514 $this->
ctrl->setParameter($this,
'expandCurrentPath', 1);
1516 $this->
ctrl->setParameter($this,
"link_new_type",
$type);
1517 $this->
ctrl->setParameter($this,
"search_link_type", $search);
1518 $this->
ctrl->redirect($this,
"outSolutionExplorer");
1523 $this->
ctrl->redirect($this,
"suggestedsolution");
1528 $this->
ctrl->setParameter($this,
'q_id', $this->
object->getId());
1533 $shownpages = array();
1534 $tree = $cont_obj->getLMTree();
1535 $chapters =
$tree->getSubtree(
$tree->getNodeData(
$tree->getRootId()));
1539 foreach ($chapters as $chapter) {
1540 $chapterpages =
$tree->getChildsByType($chapter[
'obj_id'],
'pg');
1541 foreach ($chapterpages as $page) {
1542 if ($page[
'type'] == $this->request->raw(
'search_link_type')) {
1543 array_push($shownpages, $page[
'obj_id']);
1545 if (
$tree->isInTree($page[
'obj_id'])) {
1551 $this->
ctrl->setParameter($this, $page[
'type'], $page[
'obj_id']);
1553 'title' => $page[
'title'],
1555 'text_add' => $this->
lng->txt(
'add'),
1556 'href_add' => $this->
ctrl->getLinkTarget($this,
'add' . strtoupper($page[
'type']))
1561 foreach ($pages as $page) {
1562 if (!in_array($page[
'obj_id'], $shownpages)) {
1563 $this->
ctrl->setParameter($this, $page[
'type'], $page[
'obj_id']);
1565 'title' => $page[
'title'],
1566 'description' =>
'---',
1567 'text_add' => $this->
lng->txt(
'add'),
1568 'href_add' => $this->
ctrl->getLinkTarget($this,
'add' . strtoupper($page[
'type']))
1575 $table->setData(
$rows);
1577 $this->tpl->setContent($table->getHTML());
1582 $this->
ctrl->setParameter($this,
'q_id', $this->
object->getId());
1586 $ctree = $cont_obj->getLMTree();
1587 $nodes = $ctree->getSubtree($ctree->getNodeData($ctree->getRootId()));
1591 foreach ($nodes as $node) {
1592 if ($node[
'type'] == $this->request->raw(
'search_link_type')) {
1593 $this->
ctrl->setParameter($this, $node[
'type'], $node[
'obj_id']);
1595 'title' => $node[
'title'],
1596 'description' =>
'',
1597 'text_add' => $this->
lng->txt(
'add'),
1598 'href_add' => $this->
ctrl->getLinkTarget($this,
'add' . strtoupper($node[
'type']))
1605 $table->setData(
$rows);
1607 $this->tpl->setContent($table->getHTML());
1612 $this->
ctrl->setParameter($this,
'q_id', $this->
object->getId());
1614 $glossary =
new ilObjGlossary($this->request->raw(
'source_id'),
true);
1619 foreach ($terms as $term) {
1620 $this->
ctrl->setParameter($this,
'git', $term[
'id']);
1622 'title' => $term[
'term'],
1623 'description' =>
'',
1624 'text_add' => $this->
lng->txt(
'add'),
1625 'href_add' => $this->
ctrl->getLinkTarget($this,
'addGIT')
1630 $table->setTitle($this->
lng->txt(
'glossary_term'));
1631 $table->setData(
$rows);
1633 $this->tpl->setContent($table->getHTML());
1638 $this->
ctrl->saveParameter($this, array(
"subquestion_index",
"link_new_type",
"search_link_type"));
1639 switch ($this->request->raw(
"search_link_type")) {
1650 $subquestion_index = ($this->request->raw(
"subquestion_index") > 0) ? $this->request->raw(
"subquestion_index") : 0;
1651 $this->
object->saveSuggestedSolution(
"lm",
"il__lm_" . $this->request->raw(
"source_id"), $subquestion_index);
1652 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
"suggested_solution_added_successfully"),
true);
1653 $this->
ctrl->redirect($this,
"suggestedsolution");
1660 $subquestion_index = 0;
1661 if (strlen($this->request->raw(
"subquestion_index")) && $this->request->raw(
"subquestion_index") >= 0) {
1662 $subquestion_index = $this->request->raw(
"subquestion_index");
1664 $this->
object->saveSuggestedSolution(
"pg",
"il__pg_" . $this->request->raw(
"pg"), $subquestion_index);
1665 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
"suggested_solution_added_successfully"),
true);
1666 $this->
ctrl->redirect($this,
"suggestedsolution");
1671 $subquestion_index = 0;
1672 if (strlen($this->request->raw(
"subquestion_index")) && $this->request->raw(
"subquestion_index") >= 0) {
1673 $subquestion_index = $this->request->raw(
"subquestion_index");
1675 $this->
object->saveSuggestedSolution(
"st",
"il__st_" . $this->request->raw(
"st"), $subquestion_index);
1676 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
"suggested_solution_added_successfully"),
true);
1677 $this->
ctrl->redirect($this,
"suggestedsolution");
1682 $subquestion_index = 0;
1683 if (strlen($this->request->raw(
"subquestion_index")) && $this->request->raw(
"subquestion_index") >= 0) {
1684 $subquestion_index = $this->request->raw(
"subquestion_index");
1686 $this->
object->saveSuggestedSolution(
"git",
"il__git_" . $this->request->raw(
"git"), $subquestion_index);
1687 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
"suggested_solution_added_successfully"),
true);
1688 $this->
ctrl->redirect($this,
"suggestedsolution");
1693 return in_array($this->
ctrl->getCmd(), array(
'save',
'saveEdit',
'saveReturn'));
1697 string $guiClassName,
1698 string $cmdConstantNameBegin =
'CMD_' 1705 $commands = array();
1707 foreach ($reflectionClass->getConstants() as $constName => $constValue) {
1708 if (substr($constName, 0, strlen($cmdConstantNameBegin)) == $cmdConstantNameBegin) {
1709 $commands[] = $constValue;
1719 $this->ilTabs->clearTargets();
1728 $this->
ctrl->setParameterByClass(
"ilAssQuestionPageGUI",
"q_id", $this->request->getQuestionId());
1729 $q_type = $this->
object->getQuestionType();
1731 if (strlen($q_type)) {
1732 $classname = $q_type .
"GUI";
1733 $this->
ctrl->setParameterByClass(strtolower($classname),
"sel_question_types", $q_type);
1734 $this->
ctrl->setParameterByClass(strtolower($classname),
"q_id", $this->request->getQuestionId());
1737 if ($this->request->isset(
"q_id")) {
1759 if ($this->request->getQuestionId()) {
1761 "suggested_solution",
1762 $this->
ctrl->getLinkTargetByClass($classname,
"suggestedsolution"),
1763 array(
"suggestedsolution",
"saveSuggestedSolution",
"outSolutionExplorer",
"cancel",
1764 "addSuggestedSolution",
"cancelExplorer",
"linkChilds",
"removeSuggestedSolution" 1779 return array(
'editQuestion',
'save',
'saveEdit',
'originalSyncForm');
1789 $tabCommands = self::getCommandsFromClassConstants(
'ilAssQuestionFeedbackEditingGUI');
1793 $tabs->
addTarget(
'tst_feedback', $tabLink, $tabCommands, $this->
ctrl->getCmdClass(),
'');
1798 switch ($this->
ctrl->getCmdClass()) {
1799 case 'ilassquestionhintsgui':
1800 $tabCommands = self::getCommandsFromClassConstants(
'ilAssQuestionHintsGUI');
1803 case 'ilassquestionhintgui':
1804 $tabCommands = self::getCommandsFromClassConstants(
'ilAssQuestionHintGUI');
1809 $tabCommands = array();
1814 $tabs->
addTarget(
'tst_question_hints_tab', $tabLink, $tabCommands, $this->
ctrl->getCmdClass(),
'');
1821 $this->
ctrl->getLinkTargetByClass(
1822 array(
'ilrepositorygui',
'ilobjquestionpoolgui', get_class($this)),
1836 $graphicalOutput =
false,
1837 $result_output =
false,
1838 $show_question_only =
true,
1839 $show_feedback =
false,
1840 $show_correct_solution =
false,
1841 $show_manual_scoring =
false,
1842 $show_question_text =
true 1847 $reachedPoints = $this->
object->getAdjustedReachedPoints((
int) $activeId, (
int) $passIndex,
true);
1848 $maximumPoints = $this->
object->getMaximumPoints();
1850 return $reachedPoints == $maximumPoints;
1855 return $this->
object->isAutosaveable();
1860 $this->
object->setTitle($_POST[
"title"]);
1861 $this->
object->setAuthor($_POST[
"author"]);
1862 $this->
object->setComment($_POST[
"comment"] ??
'');
1863 if ($this->
object->getSelfAssessmentEditingMode()) {
1864 $this->
object->setNrOfTries((
int) ($_POST[
'nr_of_tries'] ?? 0));
1869 $this->
object->setLifecycle($lifecycle);
1877 abstract public function getPreview($show_question_only =
false, $showInlineFeedback =
false);
1883 bool $is_question_postponed =
false,
1884 $user_post_solutions =
false,
1885 bool $show_specific_inline_feedback =
false 1892 $is_question_postponed,
1893 $user_post_solutions,
1894 $show_specific_inline_feedback
1899 $this->tpl->setVariable(
"QUESTION_OUTPUT", $test_output);
1900 $this->tpl->setVariable(
"FORMACTION", $formaction);
1902 $this->tpl->setVariable(
"FORM_TIMESTAMP", (
string) time());
1921 $is_question_postponed,
1922 $user_post_solutions,
1923 $show_specific_inline_feedback
1928 return self::FORM_ENCODING_URLENCODE;
1933 $this->
ctrl->saveParameterByClass(ilAssQuestionPreviewGUI::class,
'prev_qid');
1935 $this->
lng->txt(
'backtocallingpage'),
1956 $form->setFormAction($this->
ctrl->getFormAction($this));
1957 $form->setId($this->
getType());
1959 $form->setTableWidth(
'100%');
1960 $form->setMultipart(
true);
1971 return str_replace([
'{',
'}'], [
'{',
'}'], $text);
1976 $this->editQuestion(
true);
1982 return '<div id="focus"></div>';
2003 $table->setQuestionIndex($questionIndex);
2005 $table->initColumns();
2024 switch ($correctness) {
2025 case self::CORRECTNESS_NOT_OK:
2026 $icon_name =
'icon_not_ok.svg';
2027 $label = $this->
lng->txt(
"answer_is_wrong");
2029 case self::CORRECTNESS_MOSTLY_OK:
2030 $icon_name =
'icon_ok.svg';
2031 $label = $this->
lng->txt(
"answer_is_not_correct_but_positive");
2033 case self::CORRECTNESS_OK:
2034 $icon_name =
'icon_ok.svg';
2035 $label = $this->
lng->txt(
"answer_is_right");
2041 $icon = $this->
ui->factory()->symbol()->icon()->custom(
2045 return $this->
ui->renderer()->render($icon);
2056 public static function prepareTextareaOutput($txt_output, $prepare_for_latex_output =
false, $omitNl2BrWhenTextArea =
false)
2058 $result = $txt_output;
2060 if (strlen(strip_tags($result)) < strlen($result)) {
2066 if (!$omitNl2BrWhenTextArea) {
2068 $result = preg_replace(
"/[\n]/",
"<br />", $result);
2072 if (preg_match_all(
"/(<pre>.*?<\/pre>)/ims", $result, $matches)) {
2073 foreach ($matches[0] as $found) {
2075 if (strpos(
"\n", $found) ===
false) {
2076 $replacement =
"\n";
2078 $removed = preg_replace(
"/<br\s*?\/>/ims", $replacement, $found);
2079 $result = str_replace($found, $removed, $result);
2086 if ($prepare_for_latex_output) {
2091 if ($prepare_for_latex_output) {
2094 $result = str_replace(
"{",
"{", $result);
2095 $result = str_replace(
"}",
"}", $result);
2096 $result = str_replace(
"\\",
"\", $result);
2108 if (!is_array($answer_text)) {
2123 self::ALLOWED_PLAIN_TEXT_TAGS
2129 $this->tpl->addOnloadCode(
" 2130 let form = document.querySelector('#ilContentContainer form'); 2131 let button = form.querySelector('input[name=\"cmd[save]\"]'); 2132 if (button === null) { 2133 button = form.querySelector('input[name=\"cmd[saveFQ]\"]'); 2135 if (form && button) { 2136 form.addEventListener('keydown', function (e) { 2137 if (e.key === 'Enter' 2138 && e.target.type !== 'textarea' 2139 && e.target.type !== 'submit' 2140 && e.target.type !== 'file' 2143 form.requestSubmit(button); isTestPresentationContext()
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
const ADDITIONAL_CONTENT_EDITING_MODE_IPE
static get(string $a_var)
setDefaultTabs(ilTabsGUI $ilTabs)
hasCorrectSolution($activeId, $passIndex)
saveCorrectionsFormProperties(ilPropertyFormGUI $form)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static getInstance($identifier)
Readable part of repository interface to ilComponentDataDB.
genericFeedbackOutputBuilder(string $feedback_correct, string $feedback_incorrect, int $active_id, ?int $pass)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
getTestOutput( $active_id, $pass, $is_question_postponed, $user_post_solutions, $show_specific_inline_feedback)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
generateCorrectnessIconsForCorrectness(int $correctness)
getAnswersFrequency($relevantAnswers, $questionIndex)
static stripSlashesRecursive($a_data, bool $a_strip_html=true, string $a_allow="")
getPreview($show_question_only=false, $showInlineFeedback=false)
int $sequence_no
sequence number in test
getPreviousSolutionConfirmationCheckboxHtml()
addTab_SuggestedSolution(ilTabsGUI $tabs, string $classname)
writePref(string $a_keyword, string $a_value)
addTab_QuestionHints(ilTabsGUI $tabs)
ilTestQuestionNavigationGUI $navigationGUI
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static _getGUIClassNameForId($a_q_id)
setTaxonomyIds(array $taxonomyIds)
addTarget(string $a_text, string $a_link, $a_cmd="", $a_cmdClass="", string $a_frame="", bool $a_activate=false, bool $a_dir_text=false)
setOutputMode(string $a_mode=self::PRESENTATION)
int $question_count
question count in test
getEditQuestionTabCommands()
Abstract basic class which is to be extended by the concrete assessment question type classes...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
ilPropertyFormGUI $editForm
const SESSION_PREVIEW_DATA_BASE_INDEX
buildBasicEditFormObject()
static stripSlashes(string $a_str, bool $a_strip_html=true, string $a_allow="")
static getImagePath(string $img, string $module_path="", string $mode="output", bool $offline=false)
get image path (for images located in a template directory)
addBasicQuestionFormProperties(ilPropertyFormGUI $form)
getBasicEditQuestionTabCommands()
static _getInternalLinkHref(string $target="")
static _getQuestionTypeName($type_tag)
setQuestionHeaderBlockBuilder(\ilQuestionHeaderBlockBuilder $questionHeaderBlockBuilder)
getAsValueAttribute(string $a_value)
const CORRECTNESS_MOSTLY_OK
escapeTemplatePlaceholders(string $text)
getPresentationJavascripts()
string $questionActionCmd
getGenericFeedbackOutputForCorrectSolution()
writePostData(bool $always=false)
Evaluates a posted edit form and writes the form data in the question object.
bool $previousSolutionPrefilled
getUseUnchangedAnswerCheckboxHtml()
ilGlobalPageTemplate $tpl
originalSyncForm(string $return_to="", string $return_to_feedback='')
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static makeDirParents(string $a_dir)
Create a new directory and all parent directories.
isRenderPurposePlayback()
setQuestionCount(int $a_question_count)
static _questionExistsInTest(int $question_id, int $test_id)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
populateTaxonomyFormSection(ilPropertyFormGUI $form)
static _getQuestionGUI(string $question_type='', int $question_id=-1)
Creates a question gui representation and returns the alias to the question gui.
const CMD_SHOW_LIST
command constants
const CMD_SHOW
command constants
setTabActive(string $a_id)
addNewIdListener($a_object, string $a_method, string $a_parameters="")
Add a listener that is notified with the new question ID, when a new question is saved.
addQuestionFormCommandButtons(ilPropertyFormGUI $form)
setPreviewSession(ilAssQuestionPreviewSession $previewSession)
isAnswerFrequencyStatisticSupported()
getContextPath($cont_obj, int $a_endnode_id, int $a_startnode_id=1)
get context path in content object tree
prepareReprintableCorrectionsForm(ilPropertyFormGUI $form)
ILIAS Notes GUIService $notes_gui
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
populateJavascriptFilesRequiredForWorkForm(ilGlobalTemplateInterface $tpl)
setValue(string $a_value)
static renameExecutables(string $a_dir)
getType()
needed for page editor compliance
setPresentationContext(string $presentationContext)
populateCorrectionsFormProperties(ilPropertyFormGUI $form)
hasSpecialQuestionCommands()
setErrorMessage(string $errormessage)
writeQuestionGenericPostData()
get(string $part=self::DEFAULT_BLOCK)
Renders the given block and returns the html string.
setQuestionActionCmd(string $questionActionCmd)
const PRESENTATION_CONTEXT_RESULTS
static getReturnToPageLink($q_id=null)
isRenderPurposeDemoplay()
getTermList(string $searchterm="", string $a_letter="", string $a_def="", int $a_tax_node=0, bool $a_include_offline_childs=false, bool $a_add_amet_fields=false, array $a_amet_filter=null, bool $a_omit_virtual=false, bool $a_include_references=false)
const SUGGESTED_SOLUTION_COMMANDS
setAdjustmentEditContext()
static getManualFeedback($active_id, $question_id, $pass)
Retrieves the feedback comment for a question in a test if it is finalized.
const FORM_ENCODING_MULTIPART
static getInstanceByRefId(int $ref_id, bool $stop_on_error=true)
get an instance of an Ilias object by reference id
setBackTarget(string $a_title, string $a_target, string $a_frame="")
isAdjustmentEditContext()
addTab_Question(ilTabsGUI $tabsGUI)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
const EDIT_CONTEXT_ADJUSTMENT
static _getUsedHTMLTagsAsString(string $a_module="")
Returns a string of all allowed HTML tags for text editing.
addTab_QuestionFeedback(ilTabsGUI $tabs)
isRenderPurposeInputValue()
addJavaScript(string $a_js_file, bool $a_add_version_parameter=true, int $a_batch=2)
Add a javascript file that should be included in the header.
const RENDER_PURPOSE_DEMOPLAY
setTargetGui($linkTargetGui)
static moveUploadedFile(string $a_file, string $a_name, string $a_target, bool $a_raise_errors=true, string $a_mode="move_uploaded")
move uploaded file
static _getLink(?int $a_ref_id, string $a_type='', array $a_params=array(), string $append="")
setTargetGuiClass($targetGuiClass)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
callNewIdListeners(int $a_new_id)
setPref(string $a_keyword, ?string $a_value)
const EDIT_CONTEXT_AUTHORING
const PRESENTATION_CONTEXT_TEST
setSequenceNumber(int $nr)
getAssignmentsOfItem(int $a_item_id)
Get assignments for item.
static _getClassNameForQType($q_type)
ILIAS TestQuestionPool InternalRequestService $request
setRenderPurpose(string $renderPurpose)
completeTestOutputFormAction($formAction, $active_id, $pass)
static redirect(string $a_script)
getPreviousSolutionProvidedMessage()
const FORM_ENCODING_URLENCODE
const RENDER_PURPOSE_PLAYBACK
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
setEditContext(string $editContext)
getGenericFeedbackOutputForIncorrectSolution()
setQuestionHTML(array $question_html)
saveTaxonomyAssignments()
getSpecificFeedbackOutput(array $userSolution)
Returns the answer specific feedback for the question.
const ALLOWED_PLAIN_TEXT_TAGS
sk - 12.05.2023: This const is also used in ilKprimChoiceWizardInputGUI.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
getILIASPage(string $html="")
Returns the ILIAS Page around a question.
const HAS_SPECIAL_QUESTION_COMMANDS
addSaveOnEnterOnLoadCode()
outQuestionPage($a_temp_var, $a_postponed=false, $active_id="", $html="", $inlineFeedbackEnabled=false)
static getInstance()
Singleton: get instance for use in ILIAS requests with a config loaded from the settings.
getSolutionOutput( $active_id, $pass=null, $graphicalOutput=false, $result_output=false, $show_question_only=true, $show_feedback=false, $show_correct_solution=false, $show_manual_scoring=false, $show_question_text=true)
static getPageList(int $lm_id)
static getQuestionTypeFromDb(int $question_id)
__construct(Container $dic, ilPlugin $plugin)
getAdditionalEditQuestionCommands()
This class represents a text area property in a property form.
addBackTab(ilTabsGUI $ilTabs)
ilComponentRepository $component_repository
getQuestionHeaderBlockBuilder()
Class ilObjContentObjectGUI.
setQuestionSpecificTabs(ilTabsGUI $ilTabs)
cleanupAnswerText(array $answer_text, bool $is_rte)
sk - 12.05.2023: This is one more of those that we need, but don't want.
const RENDER_PURPOSE_PRINT_PDF
addErrorMessage(string $errormessage)
string $presentationContext
static _includeClass(string $question_type, int $gui=0)
enablePublicNotes(bool $a_enable=true)
isRenderPurposePrintPdf()
saveSuggestedSolutionType()
static _isWriteable(int $question_id, int $user_id)
setPreviousSolutionPrefilled(bool $previousSolutionPrefilled)
isPreviousSolutionPrefilled()
addNumberOfTriesToFormIfNecessary(ilPropertyFormGUI $form)
setSubObject(?string $sub_obj_type, ?int $sub_obj_id)
Set sub object attributes.
static _lookupType(int $id, bool $reference=false)
ilObjectDataCache $ilObjDataCache
outAdditionalOutput()
Why are you here? Some magic for plugins?
const RENDER_PURPOSE_INPUT_VALUE
const RENDER_PURPOSE_PREVIEW
setVariable(string $variable, $value='')
Sets the given variable to the given value.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
getAnswerFrequencyTableGUI($parentGui, $parentCmd, $relevantAnswers, $questionIndex)
ilQuestionHeaderBlockBuilder $questionHeaderBlockBuilder
outQuestionForTest(string $formaction, int $active_id, ?int $pass, bool $is_question_postponed=false, $user_post_solutions=false, bool $show_specific_inline_feedback=false)
setExpand($a_node_id)
set the expand option this value is stored in a SESSION variable to save it different view (lo view...
static getCommandsFromClassConstants(string $guiClassName, string $cmdConstantNameBegin='CMD_')
static _getUsedHTMLTags(string $a_module="")
Returns an array of all allowed HTML tags for text editing.
static prepareTextareaOutput($txt_output, $prepare_for_latex_output=false, $omitNl2BrWhenTextArea=false)
Prepares a string for a text area output where latex code may be in it If the text is HTML-free...
setNavigationGUI(?ilTestQuestionNavigationGUI $navigationGUI)
renderEditForm(ilPropertyFormGUI $form)
static getFeedbackClassNameByQuestionType(string $questionType)
static stripOnlySlashes(string $a_str)
renderPurposeSupportsFormHtml()
getGenericFeedbackOutput(int $active_id, ?int $pass)