4 require_once
'./Modules/TestQuestionPool/classes/class.assQuestionGUI.php';
5 require_once
'./Modules/TestQuestionPool/interfaces/interface.ilGuiQuestionScoringAdjustable.php';
6 require_once
'./Modules/TestQuestionPool/interfaces/interface.ilGuiAnswerScoringAdjustable.php';
40 include_once
"./Modules/TestQuestionPool/classes/class.assClozeTest.php";
43 $this->
object->loadFromDb($id);
49 if (preg_match(
"/^(removegap|addgap)_(\d+)$/", $cmd, $matches)) {
51 $this->gapIndex = $matches[2];
61 $hasErrors = (!$always) ? $this->
editQuestion(
true) :
false;
63 require_once
'Services/Form/classes/class.ilPropertyFormGUI.php';
65 $this->
object->setQuestion(
$_POST[
'question']);
68 $this->
object->setClozeText(
$_POST[
"cloze_text"]);
82 if (is_array(
$_POST[
'gap'])) {
83 if ($this->ctrl->getCmd() !=
'createGaps') {
84 $this->
object->clearGapAnswers();
87 foreach (
$_POST[
'gap'] as $idx => $hidden) {
88 $clozetype =
$_POST[
'clozetype_' . $idx];
90 $this->
object->setGapType($idx, $clozetype);
95 $this->
object->setGapShuffle($idx, 0);
97 if ($this->ctrl->getCmd() !=
'createGaps') {
98 if (is_array(
$_POST[
'gap_' . $idx][
'answer'])) {
99 foreach (
$_POST[
'gap_' . $idx][
'answer'] as $order => $value) {
100 $this->
object->addGapAnswer($idx, $order, $value);
103 $this->
object->addGapAnswer($idx, 0,
'');
107 if (is_array(
$_POST[
'gap_' . $idx][
'points'])) {
108 foreach (
$_POST[
'gap_' . $idx][
'points'] as $order => $value) {
109 $this->
object->setGapAnswerPoints($idx, $order, $value);
113 if (array_key_exists(
'gap_' . $idx .
'_gapsize',
$_POST)) {
114 $this->
object->setGapSize($idx, $order,
$_POST[
'gap_' . $idx .
'_gapsize']);
121 $this->
object->setGapShuffle($idx, (
int) (isset(
$_POST[
"shuffle_$idx"]) &&
$_POST[
"shuffle_$idx"]));
123 if ($this->ctrl->getCmd() !=
'createGaps') {
124 if (is_array(
$_POST[
'gap_' . $idx][
'answer'])) {
125 foreach (
$_POST[
'gap_' . $idx][
'answer'] as $order => $value) {
126 $this->
object->addGapAnswer($idx, $order, $value);
129 $this->
object->addGapAnswer($idx, 0,
'');
133 if (is_array(
$_POST[
'gap_' . $idx][
'points'])) {
134 foreach (
$_POST[
'gap_' . $idx][
'points'] as $order => $value) {
135 $this->
object->setGapAnswerPoints($idx, $order, $value);
142 $this->
object->setGapShuffle($idx, 0);
144 $gap = $this->
object->getGap($idx);
149 $this->
object->getGap($idx)->clearItems();
151 if (array_key_exists(
'gap_' . $idx .
'_numeric',
$_POST)) {
152 if ($this->ctrl->getCmd() !=
'createGaps') {
153 $this->
object->addGapAnswer(
156 str_replace(
",",
".",
$_POST[
'gap_' . $idx .
'_numeric'])
160 $this->
object->setGapAnswerLowerBound(
163 str_replace(
",",
".",
$_POST[
'gap_' . $idx .
'_numeric_lower'])
166 $this->
object->setGapAnswerUpperBound(
169 str_replace(
",",
".",
$_POST[
'gap_' . $idx .
'_numeric_upper'])
172 $this->
object->setGapAnswerPoints($idx, 0,
$_POST[
'gap_' . $idx .
'_numeric_points']);
174 if ($this->ctrl->getCmd() !=
'createGaps') {
175 $this->
object->addGapAnswer($idx, 0,
'');
178 $this->
object->setGapAnswerLowerBound($idx, 0,
'');
180 $this->
object->setGapAnswerUpperBound($idx, 0,
'');
183 if (array_key_exists(
'gap_' . $idx .
'_gapsize',
$_POST)) {
184 $this->
object->setGapSize($idx, $order,
$_POST[
'gap_' . $idx .
'_gapsize']);
189 $assClozeGapCombinationObject->clearGapCombinationsFromDb($this->object->getId());
191 isset(
$_POST[
'gap_combination']) &&
192 is_array(
$_POST[
'gap_combination']) &&
193 count(
$_POST[
'gap_combination']) > 0
195 $assClozeGapCombinationObject->saveGapCombinationToDb(
196 $this->object->getId(),
197 $_POST[
'gap_combination'],
198 $_POST[
'gap_combination_values']
202 if ($this->ctrl->getCmd() !=
'createGaps') {
203 $this->
object->updateClozeTextFromGaps();
210 $this->
object->setClozeText(
$_POST[
'cloze_text']);
211 $this->
object->setTextgapRating(
$_POST[
"textgap_rating"]);
212 $this->
object->setIdenticalScoring(
$_POST[
"identical_scoring"]);
213 $this->
object->setFixedTextLength(
$_POST[
"fixedTextLength"]);
226 include_once(
"./Services/Form/classes/class.ilPropertyFormGUI.php");
228 $this->editForm = $form;
230 $form->setFormAction($this->ctrl->getFormAction($this));
232 $form->setMultipart(
false);
233 $form->setTableWidth(
"100%");
234 $form->setId(
"assclozetest");
247 $form->setValuesByPost();
248 $errors = !$form->checkInput();
249 $form->setValuesByPost();
257 $this->tpl->setVariable(
"QUESTION_DATA", $form->getHTML());
266 $title->setMaxLength(100);
267 $title->setValue($this->object->getTitle());
268 $title->setRequired(
true);
269 $form->addItem($title);
271 if (!$this->object->getSelfAssessmentEditingMode()) {
273 $author =
new ilTextInputGUI($this->lng->txt(
"author"),
"author");
274 $author->setValue($this->object->getAuthor());
275 $author->setRequired(
true);
276 $form->addItem($author);
279 $description =
new ilTextInputGUI($this->lng->txt(
"description"),
"comment");
280 $description->setValue($this->object->getComment());
281 $description->setRequired(
false);
282 $form->addItem($description);
287 if (trim($author) ==
"") {
290 $hi->setValue($author);
295 $lifecycle =
new ilSelectInputGUI($this->lng->txt(
'qst_lifecycle'),
'lifecycle');
296 $lifecycle->setOptions($this->object->getLifecycle()->getSelectOptions($this->lng));
297 $lifecycle->setValue($this->object->getLifecycle()->getIdentifier());
298 $form->addItem($lifecycle);
302 $question->
setValue($this->object->getQuestion());
303 $question->setRequired(
true);
304 $question->setRows(10);
305 $question->setCols(80);
306 if (!$this->object->getSelfAssessmentEditingMode()) {
308 $question->setUseRte(
true);
309 include_once
"./Services/AdvancedEditing/classes/class.ilObjAdvancedEditing.php";
311 $question->addPlugin(
"latex");
312 $question->addButton(
"latex");
313 $question->addButton(
"pastelatex");
314 $question->setRTESupport($this->object->getId(),
"qpl",
"assessment");
317 require_once
'Modules/TestQuestionPool/classes/questions/class.ilAssSelfAssessmentQuestionFormatter.php';
319 $question->setUseTagsForRteOnly(
false);
321 $form->addItem($question);
323 if (!$this->object->getSelfAssessmentEditingMode()) {
327 $duration->setShowMinutes(
true);
328 $duration->setShowSeconds(
true);
329 $ewt = $this->
object->getEstimatedWorkingTime();
330 $duration->setHours($ewt[
"h"]);
331 $duration->setMinutes($ewt[
"m"]);
332 $duration->setSeconds($ewt[
"s"]);
333 $duration->setRequired(
false);
334 $form->addItem($duration);
337 if (strlen($this->object->getNrOfTries())) {
338 $nr_tries = $this->
object->getNrOfTries();
340 $nr_tries = $this->
object->getDefaultNrOfTries();
351 $ni =
new ilNumberInputGUI($this->lng->txt(
"qst_nr_of_tries"),
"nr_of_tries");
356 $ni->setMaxLength(5);
357 $ni->setRequired(
true);
368 $cloze_text->setInfo($this->lng->txt(
"close_text_hint"));
369 $cloze_text->setRows(10);
370 $cloze_text->setCols(80);
371 if (!$this->object->getSelfAssessmentEditingMode()) {
373 $cloze_text->setUseRte(
true);
374 include_once
"./Services/AdvancedEditing/classes/class.ilObjAdvancedEditing.php";
376 $cloze_text->addPlugin(
"latex");
377 $cloze_text->addButton(
"latex");
378 $cloze_text->addButton(
"pastelatex");
381 require_once
'Modules/TestQuestionPool/classes/questions/class.ilAssSelfAssessmentQuestionFormatter.php';
383 $cloze_text->setUseTagsForRteOnly(
false);
385 $cloze_text->setRTESupport($this->object->getId(),
"qpl",
"assessment");
388 $tpl =
new ilTemplate(
"tpl.il_as_qpl_cloze_gap_button_code.html",
true,
true,
"Modules/TestQuestionPool");
391 require_once
'Services/UIComponent/SplitButton/classes/class.ilSplitButtonGUI.php';
392 require_once
'Services/UIComponent/Button/classes/class.ilJsLinkButton.php';
396 $sb_text_gap->setCaption(
'text_gap');
397 $sb_text_gap->setName(
'gapbutton');
398 $sb_text_gap->setId(
'gaptrigger_text');
399 $action_button->setDefaultButton($sb_text_gap);
402 $sb_sel_gap->setCaption(
'select_gap');
403 $sb_sel_gap->setName(
'gapbutton_select');
404 $sb_sel_gap->setId(
'gaptrigger_select');
408 $sb_num_gap->setCaption(
'numeric_gap');
409 $sb_num_gap->setName(
'gapbutton_numeric');
410 $sb_num_gap->setId(
'gaptrigger_numeric');
413 $tpl->setVariable(
'BUTTON', $action_button->render());
414 $tpl->parseCurrentBlock();
416 $button->setHtml(
$tpl->get());
420 if (!$this->object->getSelfAssessmentEditingMode()) {
421 $textrating =
new ilSelectInputGUI($this->lng->txt(
"text_rating"),
"textgap_rating");
422 $text_options = array(
423 "ci" => $this->lng->txt(
"cloze_textgap_case_insensitive"),
424 "cs" => $this->lng->txt(
"cloze_textgap_case_sensitive"),
425 "l1" => sprintf($this->lng->txt(
"cloze_textgap_levenshtein_of"),
"1"),
426 "l2" => sprintf($this->lng->txt(
"cloze_textgap_levenshtein_of"),
"2"),
427 "l3" => sprintf($this->lng->txt(
"cloze_textgap_levenshtein_of"),
"3"),
428 "l4" => sprintf($this->lng->txt(
"cloze_textgap_levenshtein_of"),
"4"),
429 "l5" => sprintf($this->lng->txt(
"cloze_textgap_levenshtein_of"),
"5")
431 $textrating->setOptions($text_options);
432 $textrating->setValue($this->object->getTextgapRating());
436 $fixedTextLength =
new ilNumberInputGUI($this->lng->txt(
"cloze_fixed_textlength"),
"fixedTextLength");
437 $ftl = $this->
object->getFixedTextLength();
439 $fixedTextLength->
setValue($ftl > 0 ? $ftl :
'');
440 $fixedTextLength->setMinValue(0);
441 $fixedTextLength->setSize(3);
442 $fixedTextLength->setMaxLength(6);
443 $fixedTextLength->setInfo($this->lng->txt(
'cloze_fixed_textlength_description'));
444 $fixedTextLength->setRequired(
false);
445 $form->
addItem($fixedTextLength);
448 $identical_scoring =
new ilCheckboxInputGUI($this->lng->txt(
"identical_scoring"),
"identical_scoring");
450 $identical_scoring->setChecked($this->object->getIdenticalScoring());
451 $identical_scoring->setInfo($this->lng->txt(
'identical_scoring_desc'));
452 $identical_scoring->setRequired(
false);
453 $form->
addItem($identical_scoring);
460 if (self::OLD_CLOZE_TEST_UI) {
461 for ($gapCounter = 0; $gapCounter < $this->
object->getGapCount(); $gapCounter++) {
466 require_once
'Modules/TestQuestionPool/classes/Form/class.ilClozeGapInputBuilderGUI.php';
469 $combination_exists = $assClozeGapCombinationObject->combinationExistsForQid($this->object->id);
470 if ($combination_exists) {
471 $combinations = $assClozeGapCombinationObject->loadFromDb($this->object->id);
476 $new_builder->setValueByArray($json);
477 $new_builder->setValueCombinationFromDb($combinations);
485 $gap = $this->
object->getGaps();
490 $translate_type = array(
'text',
'select',
'numeric');
492 foreach ($gap as $content) {
494 $value = $content->getItemsRaw();
496 for ($j = 0;$j < count($value);$j++) {
497 if ($content->isNumericGap()) {
499 'answer' => $value[$j]->getAnswerText(),
500 'lower' => $value[$j]->getLowerBound(),
501 'upper' => $value[$j]->getUpperBound(),
502 'points' => $value[$j]->getPoints(),
508 'points' => $value[$j]->getPoints(),
512 if ($content->isSelectGap()) {
513 $shuffle = $content->getShuffle();
517 $answers[
$i] = array(
518 'type' => $translate_type[$content->getType()] ,
520 'shuffle' => $shuffle,
521 'text_field_length' => $content->getGapSize() > 0 ? $content->getGapSize() :
'',
522 'used_in_gap_combination' =>
true);
540 $gap = $this->
object->getGap($gapCounter);
547 $header->setTitle($this->lng->txt(
"gap") .
" " . ($gapCounter + 1));
548 $form->addItem($header);
551 $gapcounter->setValue($gapCounter);
552 $form->addItem($gapcounter);
554 $gaptype =
new ilSelectInputGUI($this->lng->txt(
'type'),
"clozetype_$gapCounter");
556 0 => $this->lng->txt(
"text_gap"),
557 1 => $this->lng->txt(
"select_gap"),
558 2 => $this->lng->txt(
"numeric_gap")
560 $gaptype->setOptions($options);
561 $gaptype->setValue($gap->getType());
562 $form->addItem($gaptype);
567 if (count($gap->getItemsRaw()) == 0) {
572 if (count($gap->getItemsRaw()) == 0) {
579 if (count($gap->getItemsRaw()) == 0) {
582 foreach ($gap->getItemsRaw() as $item) {
596 $gapSizeFormItem =
new ilNumberInputGUI($this->lng->txt(
'cloze_fixed_textlength'),
"gap_" . $gapCounter .
'_gapsize');
599 $gapSizeFormItem->setMinValue(0);
600 $gapSizeFormItem->setSize(3);
601 $gapSizeFormItem->setMaxLength(6);
602 $gapSizeFormItem->setInfo($this->lng->txt(
'cloze_gap_size_info'));
603 $gapSizeFormItem->setValue($gap->getGapSize());
604 $form->addItem($gapSizeFormItem);
623 include_once
"./Modules/TestQuestionPool/classes/class.ilAnswerWizardInputGUI.php";
624 include_once
"./Modules/TestQuestionPool/classes/class.assAnswerCloze.php";
627 $values->setQuestionObject($this->
object);
628 $values->setSingleline(
true);
629 $values->setAllowMove(
false);
631 $values->setValues($gap->getItemsRaw());
632 $form->addItem($values);
635 $shuffle =
new ilCheckboxInputGUI($this->lng->txt(
"shuffle_answers"),
"shuffle_" . $gapCounter .
"");
637 $shuffle->setChecked($gap->getShuffle());
638 $shuffle->setRequired(
false);
639 $form->addItem($shuffle);
657 include_once
"./Modules/TestQuestionPool/classes/class.ilAnswerWizardInputGUI.php";
658 include_once
"./Modules/TestQuestionPool/classes/class.assAnswerCloze.php";
661 $values->setQuestionObject($this->
object);
662 $values->setSingleline(
true);
663 $values->setAllowMove(
false);
664 $values->setValues($gap->getItemsRaw());
665 $form->addItem($values);
667 if ($this->object->getFixedTextLength() > 0) {
668 $values->setSize($this->object->getFixedTextLength());
669 $values->setMaxLength($this->object->getFixedTextLength());
689 if (!$this->object->getSelfAssessmentEditingMode()) {
690 $value =
new ilFormulaInputGUI($this->lng->txt(
'value'),
"gap_" . $gapCounter .
"_numeric");
693 $lowerbound =
new ilFormulaInputGUI($this->lng->txt(
'range_lower_limit'),
"gap_" . $gapCounter .
"_numeric_lower");
696 $upperbound =
new ilFormulaInputGUI($this->lng->txt(
'range_upper_limit'),
"gap_" . $gapCounter .
"_numeric_upper");
699 $value =
new ilNumberInputGUI($this->lng->txt(
'value'),
"gap_" . $gapCounter .
"_numeric");
702 $lowerbound =
new ilNumberInputGUI($this->lng->txt(
'range_lower_limit'),
"gap_" . $gapCounter .
"_numeric_lower");
705 $upperbound =
new ilNumberInputGUI($this->lng->txt(
'range_upper_limit'),
"gap_" . $gapCounter .
"_numeric_upper");
711 $value->setRequired(
true);
712 $form->addItem($value);
714 $lowerbound->setSize(10);
715 $lowerbound->setRequired(
true);
717 $form->addItem($lowerbound);
719 $upperbound->setSize(10);
720 $upperbound->setRequired(
true);
722 $form->addItem($upperbound);
724 if ($this->object->getFixedTextLength() > 0) {
725 $value->setSize($this->object->getFixedTextLength());
726 $value->setMaxLength($this->object->getFixedTextLength());
727 $lowerbound->setSize($this->object->getFixedTextLength());
728 $lowerbound->setMaxLength($this->object->getFixedTextLength());
729 $upperbound->setSize($this->object->getFixedTextLength());
730 $upperbound->setMaxLength($this->object->getFixedTextLength());
733 $points =
new ilNumberInputGUI($this->lng->txt(
'points'),
"gap_" . $gapCounter .
"_numeric_points");
736 $points->setRequired(
true);
738 $form->addItem($points);
748 $this->
object->saveToDb();
758 $this->
object->deleteAnswerText($this->gapIndex, key(
$_POST[
'cmd'][
'removegap_' . $this->gapIndex]));
768 $this->
object->addGapAnswer($this->gapIndex, key(
$_POST[
'cmd'][
'addgap_' . $this->gapIndex]) + 1,
"");
780 public function getPreview($show_question_only =
false, $showInlineFeedback =
false)
785 include_once
"./Services/UICore/classes/class.ilTemplate.php";
786 $template =
new ilTemplate(
"tpl.il_as_qpl_cloze_question_output.html",
true,
true,
"Modules/TestQuestionPool");
787 $output = $this->
object->getClozeTextForHTMLOutput();
788 foreach ($this->object->getGaps() as $gap_index => $gap) {
789 switch ($gap->getType()) {
791 $gaptemplate =
new ilTemplate(
"tpl.il_as_qpl_cloze_question_gap_text.html",
true,
true,
"Modules/TestQuestionPool");
793 $gap_size = $gap->getGapSize() > 0 ? $gap->getGapSize() : $this->
object->getFixedTextLength();
795 $gaptemplate->setCurrentBlock(
'size_and_maxlength');
796 $gaptemplate->setVariable(
"TEXT_GAP_SIZE", $gap_size);
797 $gaptemplate->parseCurrentBlock();
799 $gaptemplate->setVariable(
"GAP_COUNTER", $gap_index);
800 foreach ($user_solution as $val1 => $val2) {
801 if (strcmp($val1, $gap_index) == 0) {
806 $output = $this->
object->replaceFirstGap($output, $gaptemplate->get());
810 $gaptemplate =
new ilTemplate(
"tpl.il_as_qpl_cloze_question_gap_select.html",
true,
true,
"Modules/TestQuestionPool");
811 foreach ($gap->getItems($this->object->getShuffler(), $gap_index) as $item) {
812 $gaptemplate->setCurrentBlock(
"select_gap_option");
813 $gaptemplate->setVariable(
"SELECT_GAP_VALUE", $item->getOrder());
815 foreach ($user_solution as $val1 => $val2) {
816 if (strcmp($val1, $gap_index) == 0) {
817 if (strcmp($val2, $item->getOrder()) == 0) {
818 $gaptemplate->setVariable(
"SELECT_GAP_SELECTED",
" selected=\"selected\"");
822 $gaptemplate->parseCurrentBlock();
824 $gaptemplate->setVariable(
"PLEASE_SELECT", $this->lng->txt(
"please_select"));
825 $gaptemplate->setVariable(
"GAP_COUNTER", $gap_index);
826 $output = $this->
object->replaceFirstGap($output, $gaptemplate->get());
830 $gaptemplate =
new ilTemplate(
"tpl.il_as_qpl_cloze_question_gap_numeric.html",
true,
true,
"Modules/TestQuestionPool");
831 $gap_size = $gap->getGapSize() > 0 ? $gap->getGapSize() : $this->
object->getFixedTextLength();
833 $gaptemplate->setCurrentBlock(
'size_and_maxlength');
834 $gaptemplate->setVariable(
"TEXT_GAP_SIZE", $gap_size);
835 $gaptemplate->parseCurrentBlock();
837 $gaptemplate->setVariable(
"GAP_COUNTER", $gap_index);
838 foreach ($user_solution as $val1 => $val2) {
839 if (strcmp($val1, $gap_index) == 0) {
844 $output = $this->
object->replaceFirstGap($output, $gaptemplate->get());
849 $template->setVariable(
"QUESTIONTEXT", $this->object->getQuestionForHTMLOutput());
850 $template->setVariable(
"CLOZETEXT", $this->object->prepareTextareaOutput($output,
true));
851 $questionoutput = $template->get();
852 if (!$show_question_only) {
856 return $questionoutput;
887 $graphicalOutput =
false,
888 $result_output =
false,
889 $show_question_only =
true,
890 $show_feedback =
false,
891 $show_correct_solution =
false,
892 $show_manual_scoring =
false,
893 $show_question_text =
true 896 $user_solution = array();
897 if (($active_id > 0) && (!$show_correct_solution)) {
900 if (!is_array($user_solution)) {
901 $user_solution = array();
905 include_once
"./Services/UICore/classes/class.ilTemplate.php";
906 $template =
new ilTemplate(
"tpl.il_as_qpl_cloze_question_output_solution.html",
true,
true,
"Modules/TestQuestionPool");
907 $output = $this->
object->getClozeTextForHTMLOutput();
909 $check_for_gap_combinations = $assClozeGapCombinationObject->loadFromDb($this->object->getId());
911 foreach ($this->object->getGaps() as $gap_index => $gap) {
912 $gaptemplate =
new ilTemplate(
"tpl.il_as_qpl_cloze_question_output_solution_gap.html",
true,
true,
"Modules/TestQuestionPool");
914 foreach ($user_solution as $solutionarray) {
915 if ($solutionarray[
"value1"] == $gap_index) {
916 $found = $solutionarray;
921 if ($graphicalOutput) {
923 $details = $this->
object->calculateReachedPoints($active_id,
$pass,
true,
true);
924 $check = $details[$gap_index];
926 if (count($check_for_gap_combinations) != 0) {
927 $gaps_used_in_combination = $assClozeGapCombinationObject->getGapsWhichAreUsedInCombination($this->object->getId());
928 $custom_user_solution = array();
929 if (array_key_exists($gap_index, $gaps_used_in_combination)) {
930 $combination_id = $gaps_used_in_combination[$gap_index];
931 foreach ($gaps_used_in_combination as $key => $value) {
933 if ($value == $combination_id) {
934 foreach ($user_solution as $solution_key => $solution_value) {
935 if ($solution_value[
'value1'] == $key) {
936 $result_row = array();
937 $result_row[
'gap_id'] = $solution_value[
'value1'];
938 $result_row[
'value'] = $solution_value[
'value2'];
939 array_push($custom_user_solution, $result_row);
944 $points_array = $this->
object->calculateCombinationResult($custom_user_solution);
945 $max_combination_points = $assClozeGapCombinationObject->getMaxPointsForCombination($this->object->getId(), $combination_id);
946 if ($points_array[0] == $max_combination_points) {
948 $gaptemplate->setVariable(
"TEXT_OK", $this->lng->txt(
"answer_is_right"));
949 } elseif ($points_array[0] > 0) {
951 $gaptemplate->setVariable(
"TEXT_NOT_OK", $this->lng->txt(
"answer_is_not_correct_but_positive"));
954 $gaptemplate->setVariable(
"TEXT_NOT_OK", $this->lng->txt(
"answer_is_wrong"));
957 if ($check[
"best"]) {
958 $gaptemplate->setCurrentBlock(
"icon_ok");
960 $gaptemplate->setVariable(
"TEXT_OK", $this->lng->txt(
"answer_is_right"));
961 $gaptemplate->parseCurrentBlock();
963 $gaptemplate->setCurrentBlock(
"icon_not_ok");
964 if ($check[
"positive"]) {
966 $gaptemplate->setVariable(
"TEXT_NOT_OK", $this->lng->txt(
"answer_is_not_correct_but_positive"));
969 $gaptemplate->setVariable(
"TEXT_NOT_OK", $this->lng->txt(
"answer_is_wrong"));
971 $gaptemplate->parseCurrentBlock();
975 if ($check[
"best"]) {
976 $gaptemplate->setCurrentBlock(
"icon_ok");
978 $gaptemplate->setVariable(
"TEXT_OK", $this->lng->txt(
"answer_is_right"));
979 $gaptemplate->parseCurrentBlock();
981 $gaptemplate->setCurrentBlock(
"icon_not_ok");
982 if ($check[
"positive"]) {
984 $gaptemplate->setVariable(
"TEXT_NOT_OK", $this->lng->txt(
"answer_is_not_correct_but_positive"));
987 $gaptemplate->setVariable(
"TEXT_NOT_OK", $this->lng->txt(
"answer_is_wrong"));
989 $gaptemplate->parseCurrentBlock();
995 switch ($gap->getType()) {
998 if (($active_id > 0) && (!$show_correct_solution)) {
999 if ((count($found) == 0) || (strlen(trim($found[
"value2"])) == 0)) {
1000 for ($chars = 0; $chars < $gap->getMaxWidth(); $chars++) {
1001 $solutiontext .=
" ";
1007 $solutiontext = $this->
getBestSolutionText($gap, $gap_index, $check_for_gap_combinations);
1011 $output = $this->
object->replaceFirstGap($output, $gaptemplate->get());
1016 if (($active_id > 0) && (!$show_correct_solution)) {
1017 if ((count($found) == 0) || (strlen(trim($found[
"value2"])) == 0)) {
1018 for ($chars = 0; $chars < $gap->getMaxWidth(); $chars++) {
1019 $solutiontext .=
" ";
1022 $item = $gap->getItem($found[
"value2"]);
1023 if (is_object($item)) {
1026 for ($chars = 0; $chars < $gap->getMaxWidth(); $chars++) {
1027 $solutiontext .=
" ";
1032 $solutiontext = $this->
getBestSolutionText($gap, $gap_index, $check_for_gap_combinations);
1036 $output = $this->
object->replaceFirstGap($output, $gaptemplate->get());
1041 if (($active_id > 0) && (!$show_correct_solution)) {
1042 if ((count($found) == 0) || (strlen(trim($found[
"value2"])) == 0)) {
1043 for ($chars = 0; $chars < $gap->getMaxWidth(); $chars++) {
1044 $solutiontext .=
" ";
1050 $solutiontext = $this->
getBestSolutionText($gap, $gap_index, $check_for_gap_combinations);
1054 $output = $this->
object->replaceFirstGap($output, $gaptemplate->get());
1060 if ($show_question_text) {
1061 $template->setVariable(
1063 $this->object->getQuestionForHTMLOutput()
1067 $template->setVariable(
"CLOZETEXT", $this->object->prepareTextareaOutput($output,
true));
1069 $solutiontemplate =
new ilTemplate(
"tpl.il_as_tst_solution_output.html",
true,
true,
"Modules/TestQuestionPool");
1070 $questionoutput = $template->get();
1073 if ($show_feedback) {
1076 $feedback .= strlen($fb) ? $fb :
'';
1080 $this->object->fetchIndexedValuesFromValuePairs($user_solution)
1082 $feedback .= strlen($fb) ? $fb :
'';
1084 if (strlen($feedback)) {
1090 $solutiontemplate->setVariable(
"ILC_FB_CSS_CLASS", $cssClass);
1091 $solutiontemplate->setVariable(
"FEEDBACK", $this->object->prepareTextareaOutput($feedback,
true));
1094 $solutiontemplate->setVariable(
"SOLUTION_OUTPUT", $questionoutput);
1096 $solutionoutput = $solutiontemplate->get();
1098 if (!$show_question_only) {
1100 $solutionoutput = $this->
getILIASPage($solutionoutput);
1103 return $solutionoutput;
1114 $combination = null;
1115 foreach ((array) $gap_combinations as $combiGapSolRow) {
1116 if ($combiGapSolRow[
'gap_fi'] == $gap_index && $combiGapSolRow[
'best_solution']) {
1117 $combination = $combiGapSolRow;
1122 $this->object->getShuffler(),
1125 return $best_solution_text;
1130 include_once
"./Modules/Test/classes/class.ilObjTest.php";
1132 if (strlen($manual_feedback)) {
1133 return $manual_feedback;
1135 $correct_feedback = $this->
object->feedbackOBJ->getGenericFeedbackTestPresentation($this->object->getId(),
true);
1136 $incorrect_feedback = $this->
object->feedbackOBJ->getGenericFeedbackTestPresentation($this->object->getId(),
false);
1137 if (strlen($correct_feedback . $incorrect_feedback)) {
1138 $reached_points = $this->
object->calculateReachedPoints($active_id,
$pass);
1139 $max_points = $this->
object->getMaximumPoints();
1140 if ($reached_points == $max_points) {
1141 $output .= $correct_feedback;
1143 $output .= $incorrect_feedback;
1147 return $this->
object->prepareTextareaOutput($output,
true);
1155 $is_postponed =
false,
1156 $use_post_solutions =
false,
1157 $show_feedback =
false 1160 $user_solution = array();
1161 if ($use_post_solutions !==
false) {
1162 $indexedSolution = $this->
object->fetchSolutionSubmit($use_post_solutions);
1163 $user_solution = $this->
object->fetchValuePairsFromIndexedValues($indexedSolution);
1164 } elseif ($active_id) {
1166 #include_once "./Modules/Test/classes/class.ilObjTest.php"; 1167 #if (!ilObjTest::_getUsePreviousAnswers($active_id, true)) 1169 # if (is_null($pass)) $pass = ilObjTest::_getPass($active_id); 1171 $user_solution = $this->
object->getTestOutputSolutions($active_id,
$pass);
1173 if (!is_array($user_solution)) {
1174 $user_solution = array();
1179 include_once
"./Services/UICore/classes/class.ilTemplate.php";
1180 $template =
new ilTemplate(
"tpl.il_as_qpl_cloze_question_output.html",
true,
true,
"Modules/TestQuestionPool");
1181 $output = $this->
object->getClozeTextForHTMLOutput();
1182 foreach ($this->object->getGaps() as $gap_index => $gap) {
1183 switch ($gap->getType()) {
1185 $gaptemplate =
new ilTemplate(
"tpl.il_as_qpl_cloze_question_gap_text.html",
true,
true,
"Modules/TestQuestionPool");
1186 $gap_size = $gap->getGapSize() > 0 ? $gap->getGapSize() : $this->
object->getFixedTextLength();
1188 if ($gap_size > 0) {
1189 $gaptemplate->setCurrentBlock(
'size_and_maxlength');
1190 $gaptemplate->setVariable(
"TEXT_GAP_SIZE", $gap_size);
1191 $gaptemplate->parseCurrentBlock();
1194 $gaptemplate->setVariable(
"GAP_COUNTER", $gap_index);
1195 foreach ($user_solution as $solution) {
1196 if (strcmp($solution[
"value1"], $gap_index) == 0) {
1201 $output = $this->
object->replaceFirstGap($output, $gaptemplate->get());
1205 $gaptemplate =
new ilTemplate(
"tpl.il_as_qpl_cloze_question_gap_select.html",
true,
true,
"Modules/TestQuestionPool");
1206 foreach ($gap->getItems($this->object->getShuffler(), $gap_index) as $item) {
1207 $gaptemplate->setCurrentBlock(
"select_gap_option");
1208 $gaptemplate->setVariable(
"SELECT_GAP_VALUE", $item->getOrder());
1210 foreach ($user_solution as $solution) {
1211 if (strcmp($solution[
"value1"], $gap_index) == 0) {
1212 if (strcmp($solution[
"value2"], $item->getOrder()) == 0) {
1213 $gaptemplate->setVariable(
"SELECT_GAP_SELECTED",
" selected=\"selected\"");
1217 $gaptemplate->parseCurrentBlock();
1219 $gaptemplate->setVariable(
"PLEASE_SELECT", $this->lng->txt(
"please_select"));
1220 $gaptemplate->setVariable(
"GAP_COUNTER", $gap_index);
1221 $output = $this->
object->replaceFirstGap($output, $gaptemplate->get());
1225 $gaptemplate =
new ilTemplate(
"tpl.il_as_qpl_cloze_question_gap_numeric.html",
true,
true,
"Modules/TestQuestionPool");
1226 $gap_size = $gap->getGapSize() > 0 ? $gap->getGapSize() : $this->
object->getFixedTextLength();
1227 if ($gap_size > 0) {
1228 $gaptemplate->setCurrentBlock(
'size_and_maxlength');
1229 $gaptemplate->setVariable(
"TEXT_GAP_SIZE", $gap_size);
1230 $gaptemplate->parseCurrentBlock();
1233 $gaptemplate->setVariable(
"GAP_COUNTER", $gap_index);
1234 foreach ($user_solution as $solution) {
1235 if (strcmp($solution[
"value1"], $gap_index) == 0) {
1240 $output = $this->
object->replaceFirstGap($output, $gaptemplate->get());
1246 $template->setVariable(
"QUESTIONTEXT", $this->object->getQuestionForHTMLOutput());
1247 $template->setVariable(
"CLOZETEXT", $this->object->prepareTextareaOutput($output,
true));
1248 $questionoutput = $template->get();
1249 $pageoutput = $this->
outQuestionPage(
"", $is_postponed, $active_id, $questionoutput);
1255 if (!$this->object->feedbackOBJ->specificAnswerFeedbackExists()) {
1262 $feedback =
'<table class="test_specific_feedback"><tbody>';
1264 foreach ($this->object->gaps as
$gapIndex => $gap) {
1265 $answerValue = $this->
object->fetchAnswerValueForGap($userSolution,
$gapIndex);
1266 $answerIndex = $this->
object->feedbackOBJ->determineAnswerIndexForAnswerValue($gap, $answerValue);
1267 $fb = $this->
object->feedbackOBJ->determineTestOutputGapFeedback(
$gapIndex, $answerIndex);
1270 $feedback .=
'<tr><td>';
1271 $feedback .= $caption .
'</td><td>';
1272 $feedback .= $fb .
'</td> </tr>';
1274 $feedback .=
'</tbody></table>';
1276 return $this->
object->prepareTextareaOutput($feedback,
true);
1317 $overview = array();
1318 $aggregation = array();
1319 foreach ($relevant_answers as $answer) {
1320 $overview[$answer[
'active_fi']][$answer[
'pass']][$answer[
'value1']] = $answer[
'value2'];
1323 foreach ($overview as $active) {
1324 foreach ($active as $answer) {
1325 foreach ($answer as $option => $value) {
1326 $aggregation[$option][$value] = $aggregation[$option][$value] + 1;
1333 foreach ($this->object->getGaps() as $gap_index => $gap) {
1335 $html .=
'<p>Gap ' . (
$i + 1) .
' - SELECT</p>';
1338 foreach ($gap->getItems($this->object->getShuffler(), $gap_index) as $gap_item) {
1339 $aggregate = $aggregation[
$i];
1340 $html .=
'<li>' . $gap_item->getAnswerText() .
' - ' . ($aggregate[$j] ? $aggregate[$j] : 0) .
'</li>';
1347 $present_elements = array();
1350 $present_elements[] = $item->getAnswertext();
1353 $html .=
'<p>Gap ' . (
$i + 1) .
' - TEXT</p>';
1355 $aggregate = (array) $aggregation[
$i];
1356 foreach ($aggregate as $answer => $count) {
1358 if (in_array($answer, $present_elements)) {
1359 $show_mover =
' style="display: none;" ';
1362 $html .=
'<li>' . $answer .
' - ' . $count
1363 .
' <button class="clone_fields_add btn btn-link" ' . $show_mover .
' data-answer="' . $answer .
'" name="add_gap_' .
$i .
'_0"> 1364 <span class="sr-only"></span><span class="glyphicon glyphicon-plus"></span></button> 1371 $html .=
'<p>Gap ' . (
$i + 1) .
' - NUMERIC</p>';
1374 foreach ($gap->getItems($this->object->getShuffler(), $gap_index) as $gap_item) {
1375 $aggregate = (array) $aggregation[
$i];
1376 foreach ($aggregate as $answer => $count) {
1377 $html .=
'<li>' . $answer .
' - ' . $count .
'</li>';
1393 $parts = explode(
'[gap', $question_text);
1395 $question_text =
'';
1396 foreach ($parts as $part) {
1398 $question_text .= $part;
1400 $question_text .=
'[gap ' .
$i . $part;
1404 return $question_text;
1409 $parts = preg_split(
'/\[gap \d*\]/', $question_text);
1410 $question_text = implode(
'[gap]', $parts);
1411 return $question_text;
1421 $gaptemplate->setCurrentBlock(
'gap_span');
1422 $gaptemplate->setVariable(
'SPAN_SOLUTION', $solutiontext);
1424 $gaptemplate->setCurrentBlock(
'gap_select');
1425 $gaptemplate->setVariable(
'SELECT_SOLUTION', $solutiontext);
1427 $gap_size = $gap->getGapSize() > 0 ? $gap->getGapSize() : $this->
object->getFixedTextLength();
1429 if ($gap_size > 0) {
1430 $gaptemplate->setCurrentBlock(
'gap_size');
1431 $gaptemplate->setVariable(
"GAP_SIZE", $gap_size);
1432 $gaptemplate->parseCurrentBlock();
1435 $gaptemplate->setCurrentBlock(
'gap_input');
1436 $gaptemplate->setVariable(
'INPUT_SOLUTION', $solutiontext);
1440 $gaptemplate->parseCurrentBlock();
1446 if (isset($answer[
'actions'])) {
1458 $table = parent::getAnswerFrequencyTableGUI(
1465 $table->setTitle(sprintf(
1466 $DIC->language()->txt(
'tst_corrections_answers_tbl_subindex'),
1467 $DIC->language()->txt(
'gap') .
' ' . ($questionIndex + 1)
1471 $table->addColumn(
'',
'',
'200');
1479 return array_keys($this->object->getGaps());
1484 $gap = $this->
object->getGap(
$gapIndex);
1486 switch ($gap->type) {
1494 return $items[$answer]->getAnswertext();
1500 $gap = $this->
object->getGap($questionIndex);
1506 foreach ($answers as $key => $ans) {
1510 if ($ans[
'answer'] !== $item->getAnswerText()) {
1519 $answers[$key][
'addable'] =
true;
1530 foreach ($relevant_answers as $row) {
1531 if ($row[
'value1'] != $questionIndex) {
1535 if (!isset($answers[$row[
'value2']])) {
1538 $answers[$row[
'value2']] = array(
1539 'answer' => $label,
'frequency' => 0
1543 $answers[$row[
'value2']][
'frequency']++;
1553 foreach ($this->object->getGapCombinations() as $combination) {
1554 if ($combination[
'gap_fi'] !=
$gapIndex) {
1566 $combinations = array();
1568 foreach ($this->object->getGapCombinations() as
$c) {
1569 if (!isset($combinations[
$c[
'cid']])) {
1570 $combinations[$c[
'cid']] = array();
1573 if (!isset($combinations[$c[
'cid']][$c[
'row_id']])) {
1574 $combinations[$c[
'cid']][$c[
'row_id']] = array(
1575 'gaps' => array(),
'points' => $c[
'points'],
1579 if (!isset($combinations[$c[
'cid']][$c[
'row_id']][
'gaps'][$c[
'gap_fi']])) {
1580 $combinations[$c[
'cid']][$c[
'row_id']][
'gaps'][$c[
'gap_fi']] = array();
1583 $combinations[$c[
'cid']][$c[
'row_id']][
'gaps'][$c[
'gap_fi']] = $c[
'answer'];
1586 return $combinations;
1591 foreach ($this->object->getGaps() as
$gapIndex => $gap) {
1600 if ($this->object->getGapCombinationsExists()) {
1610 $header->setTitle(
"Gap Combination " . ($combiIndex + 1));
1613 require_once
'Modules/TestQuestionPool/classes/forms/class.ilAssClozeTestCombinationVariantsInputGUI.php';
1615 $inp->setValues($gapCombi);
1627 $header->setTitle($this->lng->txt(
"gap") .
" " . (
$gapIndex + 1));
1628 $form->addItem($header);
1633 foreach ($gap->getItemsRaw() as $item) {
1641 require_once
"Modules/TestQuestionPool/classes/forms/class.ilAssAnswerCorrectionsInputGUI.php";
1644 $values->setRequired(
true);
1645 $values->setQuestionObject($this->
object);
1646 $values->setValues($gap->getItemsRaw());
1647 $form->addItem($values);
1654 $value->setSize(10);
1656 $value->setRequired(
true);
1657 $form->addItem($value);
1661 $lowerbound->setSize(10);
1662 $lowerbound->setRequired(
true);
1664 $form->addItem($lowerbound);
1668 $upperbound->setSize(10);
1669 $upperbound->setRequired(
true);
1671 $form->addItem($upperbound);
1676 $points->setSize(3);
1677 $points->setRequired(
true);
1679 $form->addItem($points);
1688 foreach ($this->object->getGaps() as
$gapIndex => $gap) {
1696 if ($this->object->getGapCombinationsExists()) {
1717 $item->setPoints((
float) $answers[$index]->getPoints());
1733 $combinationPoints = array(
'points' => array(),
'select' => array());
1734 $combinationValues = array();
1739 if (!isset($combinationPoints[
'points'][$combiId])) {
1740 $combinationPoints[
'points'][$combiId] = array();
1741 $combinationPoints[
'select'][$combiId] = array();
1742 $combinationValues[$combiId] = array();
1745 foreach ($combi as $varId => $variant) {
1746 $combinationPoints[
'points'][$combiId][$varId] = (float) $values[$varId][
'points'];
1747 $combinationPoints[
'select'][$combiId] = array_keys($values[$varId][
'gaps']);
1748 $combinationValues[$combiId][$varId] = array_values($values[$varId][
'gaps']);
1752 $combinationPoints = $combinationPoints;
1753 $combinationValues = $combinationValues;
1756 $assClozeGapCombinationObject->clearGapCombinationsFromDb($this->object->getId());
1758 $assClozeGapCombinationObject->saveGapCombinationToDb(
1759 $this->object->getId(),
isTestPresentationContext()
getSpecificFeedbackOutput($userSolution)
static prepareFormOutput($a_str, $a_strip=false)
prepares string output for html forms public
hasCorrectSolution($activeId, $passIndex)
populateNumericGapCorrectionFormProperty($form, $item, $gapIndex, $hidePoints)
Class for cloze question numeric answers.
getAfterParticipationSuppressionAnswerPostVars()
Returns a list of postvars which will be suppressed in the form output when used in scoring adjustmen...
setUpperBound($bound)
Sets the upper bound.
populateCorrectionsFormProperties(ilPropertyFormGUI $form)
getAnswerFeedbackOutput($active_id, $pass)
const CLOZE_TEXT
Cloze question constants.
saveCorrectionsFormProperties(ilPropertyFormGUI $form)
saveGapCorrectionFormProperty(ilPropertyFormGUI $form, assClozeGap $gap, $gapIndex)
setPoints($points=0.0)
Sets the points.
getTestOutput( $active_id, $pass, $is_postponed=false, $use_post_solutions=false, $show_feedback=false)
static _getUsedHTMLTags($a_module="")
Returns an array of all allowed HTML tags for text editing.
setValue($a_value)
Set Value.
escapeTemplatePlaceholders(string $text)
setLowerBound($bound)
Sets the lower boind.
getAnswerFrequencyTableGUI($parentGui, $parentCmd, $relevantAnswers, $questionIndex)
saveGapCombinationCorrectionFormProperties(ilPropertyFormGUI $form)
Class for cloze question gaps.
populateTextGapFormPart($form, $gap, $gapCounter)
Populates the form-part for a text gap.
populateSolutiontextToGapTpl($gaptemplate, $gap, $solutiontext)
getQuestionTemplate()
get question template
const CSS_CLASS_FEEDBACK_CORRECT
writeQuestionSpecificPostData(ilPropertyFormGUI $form)
Extracts the question specific values from $_POST and applies them to the data object.
populateTaxonomyFormSection(ilPropertyFormGUI $form)
getUseIntermediateSolution()
Get if intermediate solution should be used for solution output.
getBestSolutionText($gap, $gap_index, $gap_combinations)
getAnswersFrequency($relevant_answers, $questionIndex)
getAfterParticipationSuppressionQuestionPostVars()
Returns a list of postvars which will be suppressed in the form output when used in scoring adjustmen...
populateGapCombinationCorrectionFormProperty(ilPropertyFormGUI $form, $gapCombi, $combiIndex)
getItemsRaw()
Gets the items of a cloze gap.
Cloze test question GUI representation.
writeAnswerSpecificPostData(ilPropertyFormGUI $form)
Extracts the answer specific values from $_POST and applies them to the data object.
populateQuestionSpecificFormPart(ilPropertyFormGUI $form)
Adds the question specific forms parts to a question property form gui.
createGaps()
Create gaps from cloze text.
completeAddAnswerAction($answers, $questionIndex)
writeQuestionGenericPostData()
hasAddAnswerAction($relevantAnswers, $questionIndex)
getILIASPage($html="")
Returns the ILIAS Page around a question.
getAggregatedAnswersView($relevant_answers)
Returns an html string containing a question specific representation of the answers so far given in t...
populateGapFormPart($form, $gapCounter)
Populates a gap form-part.
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
populateAnswerSpecificFormPart(ilPropertyFormGUI $form)
Adds the answer specific form parts to a question property form gui.
supportsIntermediateSolutionOutput()
Question type specific support of intermediate solution output The function getSolutionOutput respect...
static getManualFeedback($active_id, $question_id, $pass)
Retrieves the feedback comment for a question in a test if it is finalized.
writePostData($always=false)
{}
populateTextOrSelectGapCorrectionFormProperty($form, $gap, $gapIndex, $hidePoints)
saveTextOrSelectGapCorrectionFormProperty(ilPropertyFormGUI $form, assClozeGap $gap, $gapIndex)
populateGapSizeFormPart($form, $gap, $gapCounter)
const CSS_CLASS_FEEDBACK_WRONG
Basic GUI class for assessment questions.
saveNumericGapCorrectionFormProperty(ilPropertyFormGUI $form, assAnswerCloze $item, $gapIndex)
removegap()
Remove a gap answer.
populateGapCorrectionFormProperties($form, $gap, $gapIndex, $hidePoints)
addgap()
Add a gap answer.
isUsedInCombinations($gapIndex)
populateNumericGapFormPart($form, $gap, $gapCounter)
Populates the form-part for a numeric gap.
populateSelectGapFormPart($form, $gap, $gapCounter)
Populates the form-part for a select gap.
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)
Get the question solution output.
saveTaxonomyAssignments()
__construct($id=-1)
assClozeTestGUI constructor
outQuestionPage($a_temp_var, $a_postponed=false, $active_id="", $html="", $inlineFeedbackEnabled=false)
output question page
applyIndizesToGapText($question_text)
__construct(Container $dic, ilPlugin $plugin)
This class represents a text area property in a property form.
const ADDITIONAL_CONTENT_EDITING_MODE_RTE
constant for additional content editing mode "default"
setAnswertext($answertext="")
Sets the answer text.
$a
thx to https://mlocati.github.io/php-cs-fixer-configurator for the examples
getType()
Gets the cloze gap type.
setInlineStyle($a_style)
Set inline style.
isRenderPurposePrintPdf()
Interface ilGuiAnswerScoringAdjustable.
addBasicQuestionFormProperties($form)
$gapIndex
A temporary variable to store gap indexes of ilCtrl commands in the getCommand method.
getGenericFeedbackOutput($active_id, $pass)
Returns the answer specific feedback for the question.
Interface ilGuiQuestionScoringAdjustable.
getPreview($show_question_only=false, $showInlineFeedback=false)
Creates a preview output of the question.
editQuestion($checkonly=false)
Creates an output of the edit form for the question.
removeIndizesFromGapText($question_text)
getAnswerTextLabel($gapIndex, $answer)
addQuestionFormCommandButtons($form)
Add the command buttons of a question properties form.
renderPurposeSupportsFormHtml()