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 $cloze_text = $this->
object->getHtmlQuestionContentPurifier()->purify(
$_POST[
'cloze_text']);
68 $_POST[
'cloze_text'] = $cloze_text;
69 $this->
object->setQuestion(
$_POST[
'question']);
72 $this->
object->setClozeText(
$_POST[
"cloze_text"]);
80 $cloze_text =
$_POST[
'cloze_text'];
82 $_POST[
'cloze_text'] = $cloze_text;
88 if (is_array(
$_POST[
'gap'])) {
89 if ($this->ctrl->getCmd() !=
'createGaps') {
90 $this->
object->clearGapAnswers();
93 foreach (
$_POST[
'gap'] as $idx => $hidden) {
94 $clozetype =
$_POST[
'clozetype_' . $idx];
96 $this->
object->setGapType($idx, $clozetype);
101 $this->
object->setGapShuffle($idx, 0);
103 if ($this->ctrl->getCmd() !=
'createGaps') {
104 if (is_array(
$_POST[
'gap_' . $idx][
'answer'])) {
105 foreach (
$_POST[
'gap_' . $idx][
'answer'] as $order => $value) {
106 $this->
object->addGapAnswer($idx, $order, $value);
109 $this->
object->addGapAnswer($idx, 0,
'');
113 if (is_array(
$_POST[
'gap_' . $idx][
'points'])) {
114 foreach (
$_POST[
'gap_' . $idx][
'points'] as $order => $value) {
115 $this->
object->setGapAnswerPoints($idx, $order, $value);
119 if (array_key_exists(
'gap_' . $idx .
'_gapsize',
$_POST)) {
120 $this->
object->setGapSize($idx, $order,
$_POST[
'gap_' . $idx .
'_gapsize']);
127 $this->
object->setGapShuffle($idx, (
int) (isset(
$_POST[
"shuffle_$idx"]) &&
$_POST[
"shuffle_$idx"]));
129 if ($this->ctrl->getCmd() !=
'createGaps') {
130 if (is_array(
$_POST[
'gap_' . $idx][
'answer'])) {
131 foreach (
$_POST[
'gap_' . $idx][
'answer'] as $order => $value) {
132 $this->
object->addGapAnswer($idx, $order, $value);
135 $this->
object->addGapAnswer($idx, 0,
'');
139 if (is_array(
$_POST[
'gap_' . $idx][
'points'])) {
140 foreach (
$_POST[
'gap_' . $idx][
'points'] as $order => $value) {
141 $this->
object->setGapAnswerPoints($idx, $order, $value);
148 $this->
object->setGapShuffle($idx, 0);
150 $gap = $this->
object->getGap($idx);
155 $this->
object->getGap($idx)->clearItems();
157 if (array_key_exists(
'gap_' . $idx .
'_numeric',
$_POST)) {
158 if ($this->ctrl->getCmd() !=
'createGaps') {
159 $this->
object->addGapAnswer(
162 str_replace(
",",
".",
$_POST[
'gap_' . $idx .
'_numeric'])
166 $this->
object->setGapAnswerLowerBound(
169 str_replace(
",",
".",
$_POST[
'gap_' . $idx .
'_numeric_lower'])
172 $this->
object->setGapAnswerUpperBound(
175 str_replace(
",",
".",
$_POST[
'gap_' . $idx .
'_numeric_upper'])
178 $this->
object->setGapAnswerPoints($idx, 0,
$_POST[
'gap_' . $idx .
'_numeric_points']);
180 if ($this->ctrl->getCmd() !=
'createGaps') {
181 $this->
object->addGapAnswer($idx, 0,
'');
184 $this->
object->setGapAnswerLowerBound($idx, 0,
'');
186 $this->
object->setGapAnswerUpperBound($idx, 0,
'');
189 if (array_key_exists(
'gap_' . $idx .
'_gapsize',
$_POST)) {
190 $this->
object->setGapSize($idx, $order,
$_POST[
'gap_' . $idx .
'_gapsize']);
195 $assClozeGapCombinationObject->clearGapCombinationsFromDb($this->object->getId());
197 isset(
$_POST[
'gap_combination']) &&
198 is_array(
$_POST[
'gap_combination']) &&
199 count(
$_POST[
'gap_combination']) > 0
201 $assClozeGapCombinationObject->saveGapCombinationToDb(
202 $this->object->getId(),
208 if ($this->ctrl->getCmd() !=
'createGaps') {
209 $this->
object->updateClozeTextFromGaps();
216 $this->
object->setClozeText(
$_POST[
'cloze_text']);
217 $this->
object->setTextgapRating(
$_POST[
"textgap_rating"]);
218 $this->
object->setIdenticalScoring(
$_POST[
"identical_scoring"]);
219 $this->
object->setFixedTextLength(
$_POST[
"fixedTextLength"]);
232 include_once(
"./Services/Form/classes/class.ilPropertyFormGUI.php");
234 $this->editForm = $form;
236 $form->setFormAction($this->ctrl->getFormAction($this));
238 $form->setMultipart(
false);
239 $form->setTableWidth(
"100%");
240 $form->setId(
"assclozetest");
253 $form->setValuesByPost();
254 $errors = !$form->checkInput();
255 $form->setValuesByPost();
263 $this->tpl->setVariable(
"QUESTION_DATA", $form->getHTML());
272 $title->setMaxLength(100);
273 $title->setValue($this->object->getTitle());
274 $title->setRequired(
true);
275 $form->addItem($title);
277 if (!$this->object->getSelfAssessmentEditingMode()) {
279 $author =
new ilTextInputGUI($this->lng->txt(
"author"),
"author");
280 $author->setValue($this->object->getAuthor());
281 $author->setRequired(
true);
282 $form->addItem($author);
285 $description =
new ilTextInputGUI($this->lng->txt(
"description"),
"comment");
286 $description->setValue($this->object->getComment());
287 $description->setRequired(
false);
288 $form->addItem($description);
293 if (trim($author) ==
"") {
296 $hi->setValue($author);
301 $lifecycle =
new ilSelectInputGUI($this->lng->txt(
'qst_lifecycle'),
'lifecycle');
302 $lifecycle->setOptions($this->object->getLifecycle()->getSelectOptions($this->lng));
303 $lifecycle->setValue($this->object->getLifecycle()->getIdentifier());
304 $form->addItem($lifecycle);
308 $question->
setValue($this->object->prepareTextareaOutput($this->object->getQuestion()));
309 $question->setRequired(
true);
310 $question->setRows(10);
311 $question->setCols(80);
312 if (!$this->object->getSelfAssessmentEditingMode()) {
314 $question->setUseRte(
true);
315 include_once
"./Services/AdvancedEditing/classes/class.ilObjAdvancedEditing.php";
317 $question->addPlugin(
"latex");
318 $question->addButton(
"latex");
319 $question->addButton(
"pastelatex");
320 $question->setRTESupport($this->object->getId(),
"qpl",
"assessment");
323 require_once
'Modules/TestQuestionPool/classes/questions/class.ilAssSelfAssessmentQuestionFormatter.php';
325 $question->setUseTagsForRteOnly(
false);
327 $form->addItem($question);
337 if (!$this->object->getSelfAssessmentEditingMode()) {
341 $duration->setShowMinutes(
true);
342 $duration->setShowSeconds(
true);
343 $ewt = $this->
object->getEstimatedWorkingTime();
344 $duration->setHours($ewt[
"h"]);
345 $duration->setMinutes($ewt[
"m"]);
346 $duration->setSeconds($ewt[
"s"]);
347 $duration->setRequired(
false);
348 $form->addItem($duration);
351 if (strlen($this->object->getNrOfTries())) {
352 $nr_tries = $this->
object->getNrOfTries();
354 $nr_tries = $this->
object->getDefaultNrOfTries();
365 $ni =
new ilNumberInputGUI($this->lng->txt(
"qst_nr_of_tries"),
"nr_of_tries");
370 $ni->setMaxLength(5);
371 $ni->setRequired(
true);
382 $cloze_text->setInfo($this->lng->txt(
"close_text_hint"));
383 $cloze_text->setRows(10);
384 $cloze_text->setCols(80);
385 if (!$this->object->getSelfAssessmentEditingMode()) {
387 $cloze_text->setUseRte(
true);
388 include_once
"./Services/AdvancedEditing/classes/class.ilObjAdvancedEditing.php";
390 $cloze_text->addPlugin(
"latex");
391 $cloze_text->addButton(
"latex");
392 $cloze_text->addButton(
"pastelatex");
395 require_once
'Modules/TestQuestionPool/classes/questions/class.ilAssSelfAssessmentQuestionFormatter.php';
397 $cloze_text->setUseTagsForRteOnly(
false);
399 $cloze_text->setRTESupport($this->object->getId(),
"qpl",
"assessment");
402 $tpl =
new ilTemplate(
"tpl.il_as_qpl_cloze_gap_button_code.html",
true,
true,
"Modules/TestQuestionPool");
405 require_once
'Services/UIComponent/SplitButton/classes/class.ilSplitButtonGUI.php';
406 require_once
'Services/UIComponent/Button/classes/class.ilJsLinkButton.php';
410 $sb_text_gap->setCaption(
'text_gap');
411 $sb_text_gap->setName(
'gapbutton');
412 $sb_text_gap->setId(
'gaptrigger_text');
413 $action_button->setDefaultButton($sb_text_gap);
416 $sb_sel_gap->setCaption(
'select_gap');
417 $sb_sel_gap->setName(
'gapbutton_select');
418 $sb_sel_gap->setId(
'gaptrigger_select');
422 $sb_num_gap->setCaption(
'numeric_gap');
423 $sb_num_gap->setName(
'gapbutton_numeric');
424 $sb_num_gap->setId(
'gaptrigger_numeric');
427 $tpl->setVariable(
'BUTTON', $action_button->render());
428 $tpl->parseCurrentBlock();
430 $button->setHtml(
$tpl->get());
434 if (!$this->object->getSelfAssessmentEditingMode()) {
435 $textrating =
new ilSelectInputGUI($this->lng->txt(
"text_rating"),
"textgap_rating");
436 $text_options = array(
437 "ci" => $this->lng->txt(
"cloze_textgap_case_insensitive"),
438 "cs" => $this->lng->txt(
"cloze_textgap_case_sensitive"),
439 "l1" => sprintf($this->lng->txt(
"cloze_textgap_levenshtein_of"),
"1"),
440 "l2" => sprintf($this->lng->txt(
"cloze_textgap_levenshtein_of"),
"2"),
441 "l3" => sprintf($this->lng->txt(
"cloze_textgap_levenshtein_of"),
"3"),
442 "l4" => sprintf($this->lng->txt(
"cloze_textgap_levenshtein_of"),
"4"),
443 "l5" => sprintf($this->lng->txt(
"cloze_textgap_levenshtein_of"),
"5")
445 $textrating->setOptions($text_options);
446 $textrating->setValue($this->object->getTextgapRating());
450 $fixedTextLength =
new ilNumberInputGUI($this->lng->txt(
"cloze_fixed_textlength"),
"fixedTextLength");
451 $ftl = $this->
object->getFixedTextLength();
453 $fixedTextLength->
setValue($ftl > 0 ? $ftl :
'');
454 $fixedTextLength->setMinValue(0);
455 $fixedTextLength->setSize(3);
456 $fixedTextLength->setMaxLength(6);
457 $fixedTextLength->setInfo($this->lng->txt(
'cloze_fixed_textlength_description'));
458 $fixedTextLength->setRequired(
false);
459 $form->
addItem($fixedTextLength);
462 $identical_scoring =
new ilCheckboxInputGUI($this->lng->txt(
"identical_scoring"),
"identical_scoring");
464 $identical_scoring->setChecked($this->object->getIdenticalScoring());
465 $identical_scoring->setInfo($this->lng->txt(
'identical_scoring_desc'));
466 $identical_scoring->setRequired(
false);
467 $form->
addItem($identical_scoring);
474 if (self::OLD_CLOZE_TEST_UI) {
475 for ($gapCounter = 0; $gapCounter < $this->
object->getGapCount(); $gapCounter++) {
480 require_once
'Modules/TestQuestionPool/classes/Form/class.ilClozeGapInputBuilderGUI.php';
483 $combination_exists = $assClozeGapCombinationObject->combinationExistsForQid($this->object->id);
484 if ($combination_exists) {
485 $combinations = $assClozeGapCombinationObject->loadFromDb($this->object->id);
490 $new_builder->setValueByArray($json);
491 $new_builder->setValueCombinationFromDb($combinations);
499 $gap = $this->
object->getGaps();
504 $translate_type = array(
'text',
'select',
'numeric');
506 foreach ($gap as $content) {
508 $value = $content->getItemsRaw();
510 for ($j = 0;$j < count($value);$j++) {
511 if ($content->getType() == 2) {
513 'answer' => $value[$j]->getAnswerText(),
514 'lower' => $value[$j]->getLowerBound(),
515 'upper' => $value[$j]->getUpperBound(),
516 'points' => $value[$j]->getPoints(),
521 'answer' => $value[$j]->getAnswerText(),
522 'points' => $value[$j]->getPoints(),
526 if ($content->getType() == 1) {
527 $shuffle = $content->getShuffle();
531 $answers[
$i] = array(
532 'type' => $translate_type[$content->getType()] ,
534 'shuffle' => $shuffle,
535 'text_field_length' => $content->getGapSize() > 0 ? $content->getGapSize() :
'',
536 'used_in_gap_combination' =>
true);
554 $gap = $this->
object->getGap($gapCounter);
561 $header->setTitle($this->lng->txt(
"gap") .
" " . ($gapCounter + 1));
562 $form->addItem($header);
565 $gapcounter->setValue($gapCounter);
566 $form->addItem($gapcounter);
568 $gaptype =
new ilSelectInputGUI($this->lng->txt(
'type'),
"clozetype_$gapCounter");
570 0 => $this->lng->txt(
"text_gap"),
571 1 => $this->lng->txt(
"select_gap"),
572 2 => $this->lng->txt(
"numeric_gap")
574 $gaptype->setOptions($options);
575 $gaptype->setValue($gap->getType());
576 $form->addItem($gaptype);
581 if (count($gap->getItemsRaw()) == 0) {
586 if (count($gap->getItemsRaw()) == 0) {
593 if (count($gap->getItemsRaw()) == 0) {
596 foreach ($gap->getItemsRaw() as $item) {
610 $gapSizeFormItem =
new ilNumberInputGUI($this->lng->txt(
'cloze_fixed_textlength'),
"gap_" . $gapCounter .
'_gapsize');
613 $gapSizeFormItem->setMinValue(0);
614 $gapSizeFormItem->setSize(3);
615 $gapSizeFormItem->setMaxLength(6);
616 $gapSizeFormItem->setInfo($this->lng->txt(
'cloze_gap_size_info'));
617 $gapSizeFormItem->setValue($gap->getGapSize());
618 $form->addItem($gapSizeFormItem);
637 include_once
"./Modules/TestQuestionPool/classes/class.ilAnswerWizardInputGUI.php";
638 include_once
"./Modules/TestQuestionPool/classes/class.assAnswerCloze.php";
641 $values->setQuestionObject($this->
object);
642 $values->setSingleline(
true);
643 $values->setAllowMove(
false);
645 $values->setValues($gap->getItemsRaw());
646 $form->addItem($values);
649 $shuffle =
new ilCheckboxInputGUI($this->lng->txt(
"shuffle_answers"),
"shuffle_" . $gapCounter .
"");
651 $shuffle->setChecked($gap->getShuffle());
652 $shuffle->setRequired(
false);
653 $form->addItem($shuffle);
671 include_once
"./Modules/TestQuestionPool/classes/class.ilAnswerWizardInputGUI.php";
672 include_once
"./Modules/TestQuestionPool/classes/class.assAnswerCloze.php";
675 $values->setQuestionObject($this->
object);
676 $values->setSingleline(
true);
677 $values->setAllowMove(
false);
678 $values->setValues($gap->getItemsRaw());
679 $form->addItem($values);
681 if ($this->object->getFixedTextLength() > 0) {
682 $values->setSize($this->object->getFixedTextLength());
683 $values->setMaxLength($this->object->getFixedTextLength());
703 if (!$this->object->getSelfAssessmentEditingMode()) {
704 $value =
new ilFormulaInputGUI($this->lng->txt(
'value'),
"gap_" . $gapCounter .
"_numeric");
707 $lowerbound =
new ilFormulaInputGUI($this->lng->txt(
'range_lower_limit'),
"gap_" . $gapCounter .
"_numeric_lower");
710 $upperbound =
new ilFormulaInputGUI($this->lng->txt(
'range_upper_limit'),
"gap_" . $gapCounter .
"_numeric_upper");
713 $value =
new ilNumberInputGUI($this->lng->txt(
'value'),
"gap_" . $gapCounter .
"_numeric");
716 $lowerbound =
new ilNumberInputGUI($this->lng->txt(
'range_lower_limit'),
"gap_" . $gapCounter .
"_numeric_lower");
719 $upperbound =
new ilNumberInputGUI($this->lng->txt(
'range_upper_limit'),
"gap_" . $gapCounter .
"_numeric_upper");
725 $value->setRequired(
true);
726 $form->addItem($value);
728 $lowerbound->setSize(10);
729 $lowerbound->setRequired(
true);
731 $form->addItem($lowerbound);
733 $upperbound->setSize(10);
734 $upperbound->setRequired(
true);
736 $form->addItem($upperbound);
738 if ($this->object->getFixedTextLength() > 0) {
739 $value->setSize($this->object->getFixedTextLength());
740 $value->setMaxLength($this->object->getFixedTextLength());
741 $lowerbound->setSize($this->object->getFixedTextLength());
742 $lowerbound->setMaxLength($this->object->getFixedTextLength());
743 $upperbound->setSize($this->object->getFixedTextLength());
744 $upperbound->setMaxLength($this->object->getFixedTextLength());
747 $points =
new ilNumberInputGUI($this->lng->txt(
'points'),
"gap_" . $gapCounter .
"_numeric_points");
750 $points->setRequired(
true);
752 $form->addItem($points);
762 $this->
object->saveToDb();
772 $this->
object->deleteAnswerText($this->gapIndex, key(
$_POST[
'cmd'][
'removegap_' . $this->gapIndex]));
782 $this->
object->addGapAnswer($this->gapIndex, key(
$_POST[
'cmd'][
'addgap_' . $this->gapIndex]) + 1,
"");
794 public function getPreview($show_question_only =
false, $showInlineFeedback =
false)
799 include_once
"./Services/UICore/classes/class.ilTemplate.php";
800 $template =
new ilTemplate(
"tpl.il_as_qpl_cloze_question_output.html",
true,
true,
"Modules/TestQuestionPool");
801 $output = $this->
object->getClozeText();
802 foreach ($this->object->getGaps() as $gap_index => $gap) {
803 switch ($gap->getType()) {
805 $gaptemplate =
new ilTemplate(
"tpl.il_as_qpl_cloze_question_gap_text.html",
true,
true,
"Modules/TestQuestionPool");
807 $gap_size = $gap->getGapSize() > 0 ? $gap->getGapSize() : $this->
object->getFixedTextLength();
809 $gaptemplate->setCurrentBlock(
'size_and_maxlength');
810 $gaptemplate->setVariable(
"TEXT_GAP_SIZE", $gap_size);
811 $gaptemplate->parseCurrentBlock();
813 $gaptemplate->setVariable(
"GAP_COUNTER", $gap_index);
814 foreach ($user_solution as $val1 => $val2) {
815 if (strcmp($val1, $gap_index) == 0) {
820 $output = $this->
object->replaceFirstGap($output, $gaptemplate->get());
824 $gaptemplate =
new ilTemplate(
"tpl.il_as_qpl_cloze_question_gap_select.html",
true,
true,
"Modules/TestQuestionPool");
825 foreach ($gap->getItems($this->object->getShuffler()) as $item) {
826 $gaptemplate->setCurrentBlock(
"select_gap_option");
827 $gaptemplate->setVariable(
"SELECT_GAP_VALUE", $item->getOrder());
829 foreach ($user_solution as $val1 => $val2) {
830 if (strcmp($val1, $gap_index) == 0) {
831 if (strcmp($val2, $item->getOrder()) == 0) {
832 $gaptemplate->setVariable(
"SELECT_GAP_SELECTED",
" selected=\"selected\"");
836 $gaptemplate->parseCurrentBlock();
838 $gaptemplate->setVariable(
"PLEASE_SELECT", $this->lng->txt(
"please_select"));
839 $gaptemplate->setVariable(
"GAP_COUNTER", $gap_index);
840 $output = $this->
object->replaceFirstGap($output, $gaptemplate->get());
844 $gaptemplate =
new ilTemplate(
"tpl.il_as_qpl_cloze_question_gap_numeric.html",
true,
true,
"Modules/TestQuestionPool");
845 $gap_size = $gap->getGapSize() > 0 ? $gap->getGapSize() : $this->
object->getFixedTextLength();
847 $gaptemplate->setCurrentBlock(
'size_and_maxlength');
848 $gaptemplate->setVariable(
"TEXT_GAP_SIZE", $gap_size);
849 $gaptemplate->parseCurrentBlock();
851 $gaptemplate->setVariable(
"GAP_COUNTER", $gap_index);
852 foreach ($user_solution as $val1 => $val2) {
853 if (strcmp($val1, $gap_index) == 0) {
858 $output = $this->
object->replaceFirstGap($output, $gaptemplate->get());
863 $template->setVariable(
"QUESTIONTEXT", $this->object->prepareTextareaOutput($this->object->getQuestion(),
true));
864 $template->setVariable(
"CLOZETEXT", $this->object->prepareTextareaOutput($output,
true));
865 $questionoutput = $template->get();
866 if (!$show_question_only) {
870 return $questionoutput;
901 $graphicalOutput =
false,
902 $result_output =
false,
903 $show_question_only =
true,
904 $show_feedback =
false,
905 $show_correct_solution =
false,
906 $show_manual_scoring =
false,
907 $show_question_text =
true 910 $user_solution = array();
911 if (($active_id > 0) && (!$show_correct_solution)) {
914 if (!is_array($user_solution)) {
915 $user_solution = array();
919 include_once
"./Services/UICore/classes/class.ilTemplate.php";
920 $template =
new ilTemplate(
"tpl.il_as_qpl_cloze_question_output_solution.html",
true,
true,
"Modules/TestQuestionPool");
921 $output = $this->
object->getClozeText();
923 $check_for_gap_combinations = $assClozeGapCombinationObject->loadFromDb($this->object->getId());
925 foreach ($this->object->getGaps() as $gap_index => $gap) {
926 $gaptemplate =
new ilTemplate(
"tpl.il_as_qpl_cloze_question_output_solution_gap.html",
true,
true,
"Modules/TestQuestionPool");
928 foreach ($user_solution as $solutionarray) {
929 if ($solutionarray[
"value1"] == $gap_index) {
930 $found = $solutionarray;
935 if ($graphicalOutput) {
937 $details = $this->
object->calculateReachedPoints($active_id,
$pass,
true,
true);
938 $check = $details[$gap_index];
940 if (count($check_for_gap_combinations) != 0) {
941 $gaps_used_in_combination = $assClozeGapCombinationObject->getGapsWhichAreUsedInCombination($this->object->getId());
942 $custom_user_solution = array();
943 if (array_key_exists($gap_index, $gaps_used_in_combination)) {
944 $combination_id = $gaps_used_in_combination[$gap_index];
945 foreach ($gaps_used_in_combination as $key => $value) {
947 if ($value == $combination_id) {
948 foreach ($user_solution as $solution_key => $solution_value) {
949 if ($solution_value[
'value1'] == $key) {
950 $result_row = array();
951 $result_row[
'gap_id'] = $solution_value[
'value1'];
952 $result_row[
'value'] = $solution_value[
'value2'];
953 array_push($custom_user_solution, $result_row);
958 $points_array = $this->
object->calculateCombinationResult($custom_user_solution);
959 $max_combination_points = $assClozeGapCombinationObject->getMaxPointsForCombination($this->object->getId(), $combination_id);
960 if ($points_array[0] == $max_combination_points) {
962 $gaptemplate->setVariable(
"TEXT_OK", $this->lng->txt(
"answer_is_right"));
963 } elseif ($points_array[0] > 0) {
965 $gaptemplate->setVariable(
"TEXT_NOT_OK", $this->lng->txt(
"answer_is_not_correct_but_positive"));
968 $gaptemplate->setVariable(
"TEXT_NOT_OK", $this->lng->txt(
"answer_is_wrong"));
971 if ($check[
"best"]) {
972 $gaptemplate->setCurrentBlock(
"icon_ok");
974 $gaptemplate->setVariable(
"TEXT_OK", $this->lng->txt(
"answer_is_right"));
975 $gaptemplate->parseCurrentBlock();
977 $gaptemplate->setCurrentBlock(
"icon_not_ok");
978 if ($check[
"positive"]) {
980 $gaptemplate->setVariable(
"TEXT_NOT_OK", $this->lng->txt(
"answer_is_not_correct_but_positive"));
983 $gaptemplate->setVariable(
"TEXT_NOT_OK", $this->lng->txt(
"answer_is_wrong"));
985 $gaptemplate->parseCurrentBlock();
989 if ($check[
"best"]) {
990 $gaptemplate->setCurrentBlock(
"icon_ok");
992 $gaptemplate->setVariable(
"TEXT_OK", $this->lng->txt(
"answer_is_right"));
993 $gaptemplate->parseCurrentBlock();
995 $gaptemplate->setCurrentBlock(
"icon_not_ok");
996 if ($check[
"positive"]) {
998 $gaptemplate->setVariable(
"TEXT_NOT_OK", $this->lng->txt(
"answer_is_not_correct_but_positive"));
1001 $gaptemplate->setVariable(
"TEXT_NOT_OK", $this->lng->txt(
"answer_is_wrong"));
1003 $gaptemplate->parseCurrentBlock();
1008 if ($result_output) {
1009 $points = $this->
object->getMaximumGapPoints($gap_index);
1010 $resulttext = ($points == 1) ?
"(%s " . $this->lng->txt(
"point") .
")" :
"(%s " . $this->lng->txt(
"points") .
")";
1011 $gaptemplate->setCurrentBlock(
"result_output");
1012 $gaptemplate->setVariable(
"RESULT_OUTPUT", sprintf($resulttext, $points));
1013 $gaptemplate->parseCurrentBlock();
1015 $combination = null;
1016 switch ($gap->getType()) {
1019 if (($active_id > 0) && (!$show_correct_solution)) {
1020 if ((count($found) == 0) || (strlen(trim($found[
"value2"])) == 0)) {
1021 for ($chars = 0; $chars < $gap->getMaxWidth(); $chars++) {
1022 $solutiontext .=
" ";
1028 $solutiontext = $this->
getBestSolutionText($gap, $gap_index, $check_for_gap_combinations);
1032 $output = $this->
object->replaceFirstGap($output, $gaptemplate->get());
1037 if (($active_id > 0) && (!$show_correct_solution)) {
1038 if ((count($found) == 0) || (strlen(trim($found[
"value2"])) == 0)) {
1039 for ($chars = 0; $chars < $gap->getMaxWidth(); $chars++) {
1040 $solutiontext .=
" ";
1043 $item = $gap->getItem($found[
"value2"]);
1044 if (is_object($item)) {
1047 for ($chars = 0; $chars < $gap->getMaxWidth(); $chars++) {
1048 $solutiontext .=
" ";
1053 $solutiontext = $this->
getBestSolutionText($gap, $gap_index, $check_for_gap_combinations);
1057 $output = $this->
object->replaceFirstGap($output, $gaptemplate->get());
1062 if (($active_id > 0) && (!$show_correct_solution)) {
1063 if ((count($found) == 0) || (strlen(trim($found[
"value2"])) == 0)) {
1064 for ($chars = 0; $chars < $gap->getMaxWidth(); $chars++) {
1065 $solutiontext .=
" ";
1071 $solutiontext = $this->
getBestSolutionText($gap, $gap_index, $check_for_gap_combinations);
1075 $output = $this->
object->replaceFirstGap($output, $gaptemplate->get());
1081 if ($show_question_text) {
1082 $template->setVariable(
1084 $this->object->prepareTextareaOutput($this->object->getQuestion(),
true)
1088 $template->setVariable(
"CLOZETEXT", $this->object->prepareTextareaOutput($output,
true));
1090 $solutiontemplate =
new ilTemplate(
"tpl.il_as_tst_solution_output.html",
true,
true,
"Modules/TestQuestionPool");
1091 $questionoutput = $template->get();
1094 if ($show_feedback) {
1097 $feedback .= strlen($fb) ? $fb :
'';
1101 $this->object->fetchIndexedValuesFromValuePairs($user_solution)
1103 $feedback .= strlen($fb) ? $fb :
'';
1105 if (strlen($feedback)) {
1111 $solutiontemplate->setVariable(
"ILC_FB_CSS_CLASS", $cssClass);
1112 $solutiontemplate->setVariable(
"FEEDBACK", $this->object->prepareTextareaOutput($feedback,
true));
1115 $solutiontemplate->setVariable(
"SOLUTION_OUTPUT", $questionoutput);
1117 $solutionoutput = $solutiontemplate->get();
1119 if (!$show_question_only) {
1121 $solutionoutput = $this->
getILIASPage($solutionoutput);
1124 return $solutionoutput;
1135 $combination = null;
1136 foreach ((array) $gap_combinations as $combiGapSolRow) {
1137 if ($combiGapSolRow[
'gap_fi'] == $gap_index && $combiGapSolRow[
'best_solution']) {
1138 $combination = $combiGapSolRow;
1143 $this->object->getShuffler(),
1146 return $best_solution_text;
1151 include_once
"./Modules/Test/classes/class.ilObjTest.php";
1153 if (strlen($manual_feedback)) {
1154 return $manual_feedback;
1156 $correct_feedback = $this->
object->feedbackOBJ->getGenericFeedbackTestPresentation($this->object->getId(),
true);
1157 $incorrect_feedback = $this->
object->feedbackOBJ->getGenericFeedbackTestPresentation($this->object->getId(),
false);
1158 if (strlen($correct_feedback . $incorrect_feedback)) {
1159 $reached_points = $this->
object->calculateReachedPoints($active_id,
$pass);
1160 $max_points = $this->
object->getMaximumPoints();
1161 if ($reached_points == $max_points) {
1162 $output .= $correct_feedback;
1164 $output .= $incorrect_feedback;
1168 return $this->
object->prepareTextareaOutput($output,
true);
1176 $is_postponed =
false,
1177 $use_post_solutions =
false,
1178 $show_feedback =
false 1181 $user_solution = array();
1182 if ($use_post_solutions !==
false) {
1183 $indexedSolution = $this->
object->fetchSolutionSubmit($use_post_solutions);
1184 $user_solution = $this->
object->fetchValuePairsFromIndexedValues($indexedSolution);
1185 } elseif ($active_id) {
1187 #include_once "./Modules/Test/classes/class.ilObjTest.php"; 1188 #if (!ilObjTest::_getUsePreviousAnswers($active_id, true)) 1190 # if (is_null($pass)) $pass = ilObjTest::_getPass($active_id); 1192 $user_solution = $this->
object->getTestOutputSolutions($active_id,
$pass);
1194 if (!is_array($user_solution)) {
1195 $user_solution = array();
1200 include_once
"./Services/UICore/classes/class.ilTemplate.php";
1201 $template =
new ilTemplate(
"tpl.il_as_qpl_cloze_question_output.html",
true,
true,
"Modules/TestQuestionPool");
1202 $output = $this->
object->getClozeText();
1203 foreach ($this->object->getGaps() as $gap_index => $gap) {
1204 switch ($gap->getType()) {
1206 $gaptemplate =
new ilTemplate(
"tpl.il_as_qpl_cloze_question_gap_text.html",
true,
true,
"Modules/TestQuestionPool");
1207 $gap_size = $gap->getGapSize() > 0 ? $gap->getGapSize() : $this->
object->getFixedTextLength();
1209 if ($gap_size > 0) {
1210 $gaptemplate->setCurrentBlock(
'size_and_maxlength');
1211 $gaptemplate->setVariable(
"TEXT_GAP_SIZE", $gap_size);
1212 $gaptemplate->parseCurrentBlock();
1215 $gaptemplate->setVariable(
"GAP_COUNTER", $gap_index);
1216 foreach ($user_solution as $solution) {
1217 if (strcmp($solution[
"value1"], $gap_index) == 0) {
1222 $output = $this->
object->replaceFirstGap($output, $gaptemplate->get());
1226 $gaptemplate =
new ilTemplate(
"tpl.il_as_qpl_cloze_question_gap_select.html",
true,
true,
"Modules/TestQuestionPool");
1227 foreach ($gap->getItems($this->object->getShuffler()) as $item) {
1228 $gaptemplate->setCurrentBlock(
"select_gap_option");
1229 $gaptemplate->setVariable(
"SELECT_GAP_VALUE", $item->getOrder());
1231 foreach ($user_solution as $solution) {
1232 if (strcmp($solution[
"value1"], $gap_index) == 0) {
1233 if (strcmp($solution[
"value2"], $item->getOrder()) == 0) {
1234 $gaptemplate->setVariable(
"SELECT_GAP_SELECTED",
" selected=\"selected\"");
1238 $gaptemplate->parseCurrentBlock();
1240 $gaptemplate->setVariable(
"PLEASE_SELECT", $this->lng->txt(
"please_select"));
1241 $gaptemplate->setVariable(
"GAP_COUNTER", $gap_index);
1242 $output = $this->
object->replaceFirstGap($output, $gaptemplate->get());
1246 $gaptemplate =
new ilTemplate(
"tpl.il_as_qpl_cloze_question_gap_numeric.html",
true,
true,
"Modules/TestQuestionPool");
1247 $gap_size = $gap->getGapSize() > 0 ? $gap->getGapSize() : $this->
object->getFixedTextLength();
1248 if ($gap_size > 0) {
1249 $gaptemplate->setCurrentBlock(
'size_and_maxlength');
1250 $gaptemplate->setVariable(
"TEXT_GAP_SIZE", $gap_size);
1251 $gaptemplate->parseCurrentBlock();
1254 $gaptemplate->setVariable(
"GAP_COUNTER", $gap_index);
1255 foreach ($user_solution as $solution) {
1256 if (strcmp($solution[
"value1"], $gap_index) == 0) {
1261 $output = $this->
object->replaceFirstGap($output, $gaptemplate->get());
1267 $template->setVariable(
"QUESTIONTEXT", $this->object->prepareTextareaOutput($this->object->getQuestion(),
true));
1268 $template->setVariable(
"CLOZETEXT", $this->object->prepareTextareaOutput($output,
true));
1269 $questionoutput = $template->get();
1270 $pageoutput = $this->
outQuestionPage(
"", $is_postponed, $active_id, $questionoutput);
1284 $rbacsystem = $DIC[
'rbacsystem'];
1285 $ilTabs = $DIC[
'ilTabs'];
1287 $ilTabs->clearTargets();
1289 $this->ctrl->setParameterByClass(
"ilAssQuestionPageGUI",
"q_id",
$_GET[
"q_id"]);
1290 include_once
"./Modules/TestQuestionPool/classes/class.assQuestion.php";
1291 $q_type = $this->
object->getQuestionType();
1293 if (strlen($q_type)) {
1294 $classname = $q_type .
"GUI";
1295 $this->ctrl->setParameterByClass(strtolower($classname),
"sel_question_types", $q_type);
1296 $this->ctrl->setParameterByClass(strtolower($classname),
"q_id",
$_GET[
"q_id"]);
1297 # $this->ctrl->setParameterByClass(strtolower($classname), 'prev_qid', $_REQUEST['prev_qid']); 1300 if (
$_GET[
"q_id"]) {
1301 if ($rbacsystem->checkAccess(
'write',
$_GET[
"ref_id"])) {
1305 $this->ctrl->getLinkTargetByClass(
"ilAssQuestionPageGUI",
"edit"),
1306 array(
"edit",
"insert",
"exec_pg"),
1316 $force_active =
false;
1317 $commands =
$_POST[
"cmd"];
1318 if (is_array($commands)) {
1319 foreach ($commands as $key => $value) {
1320 if (preg_match(
"/^removegap_.*/", $key, $matches) ||
1321 preg_match(
"/^addgap_.*/", $key, $matches)
1323 $force_active =
true;
1327 if ($rbacsystem->checkAccess(
'write',
$_GET[
"ref_id"])) {
1330 $url = $this->ctrl->getLinkTargetByClass($classname,
"editQuestion");
1336 array(
"editQuestion",
"originalSyncForm",
"save",
"createGaps",
"saveEdit"),
1353 if (
$_GET[
"q_id"]) {
1356 $this->ctrl->getLinkTargetByClass($classname,
"assessment"),
1357 array(
"assessment"),
1368 if (!$this->object->feedbackOBJ->specificAnswerFeedbackExists()) {
1375 $feedback =
'<table class="test_specific_feedback"><tbody>';
1377 foreach ($this->object->gaps as
$gapIndex => $gap) {
1378 $answerValue = $this->
object->fetchAnswerValueForGap($userSolution,
$gapIndex);
1379 $answerIndex = $this->
object->feedbackOBJ->determineAnswerIndexForAnswerValue($gap, $answerValue);
1380 $fb = $this->
object->feedbackOBJ->determineTestOutputGapFeedback(
$gapIndex, $answerIndex);
1383 $feedback .=
'<tr><td>';
1384 $feedback .= $caption .
'</td><td>';
1385 $feedback .= $fb .
'</td> </tr>';
1387 $feedback .=
'</tbody></table>';
1389 return $this->
object->prepareTextareaOutput($feedback,
true);
1430 $overview = array();
1431 $aggregation = array();
1432 foreach ($relevant_answers as $answer) {
1433 $overview[$answer[
'active_fi']][$answer[
'pass']][$answer[
'value1']] = $answer[
'value2'];
1436 foreach ($overview as $active) {
1437 foreach ($active as $answer) {
1438 foreach ($answer as $option => $value) {
1439 $aggregation[$option][$value] = $aggregation[$option][$value] + 1;
1446 foreach ($this->object->getGaps() as $gap) {
1448 $html .=
'<p>Gap ' . (
$i + 1) .
' - SELECT</p>';
1451 foreach ($gap->getItems($this->object->getShuffler()) as $gap_item) {
1452 $aggregate = $aggregation[
$i];
1453 $html .=
'<li>' . $gap_item->getAnswerText() .
' - ' . ($aggregate[$j] ? $aggregate[$j] : 0) .
'</li>';
1460 $present_elements = array();
1463 $present_elements[] = $item->getAnswertext();
1466 $html .=
'<p>Gap ' . (
$i + 1) .
' - TEXT</p>';
1468 $aggregate = (array) $aggregation[
$i];
1469 foreach ($aggregate as $answer => $count) {
1471 if (in_array($answer, $present_elements)) {
1472 $show_mover =
' style="display: none;" ';
1475 $html .=
'<li>' . $answer .
' - ' . $count
1476 .
' <button class="clone_fields_add btn btn-link" ' . $show_mover .
' data-answer="' . $answer .
'" name="add_gap_' .
$i .
'_0"> 1477 <span class="sr-only"></span><span class="glyphicon glyphicon-plus"></span></button> 1484 $html .=
'<p>Gap ' . (
$i + 1) .
' - NUMERIC</p>';
1487 foreach ($gap->getItems($this->object->getShuffler()) as $gap_item) {
1488 $aggregate = (array) $aggregation[
$i];
1489 foreach ($aggregate as $answer => $count) {
1490 $html .=
'<li>' . $answer .
' - ' . $count .
'</li>';
1506 $parts = explode(
'[gap', $question_text);
1508 $question_text =
'';
1509 foreach ($parts as $part) {
1511 $question_text .= $part;
1513 $question_text .=
'[gap ' .
$i . $part;
1517 return $question_text;
1522 $parts = preg_split(
'/\[gap \d*\]/', $question_text);
1523 $question_text = implode(
'[gap]', $parts);
1524 return $question_text;
1534 $gaptemplate->setCurrentBlock(
'gap_span');
1535 $gaptemplate->setVariable(
'SPAN_SOLUTION', $solutiontext);
1537 $gaptemplate->setCurrentBlock(
'gap_select');
1538 $gaptemplate->setVariable(
'SELECT_SOLUTION', $solutiontext);
1540 $gap_size = $gap->getGapSize() > 0 ? $gap->getGapSize() : $this->
object->getFixedTextLength();
1542 if ($gap_size > 0) {
1543 $gaptemplate->setCurrentBlock(
'gap_size');
1544 $gaptemplate->setVariable(
"GAP_SIZE", $gap_size);
1545 $gaptemplate->parseCurrentBlock();
1548 $gaptemplate->setCurrentBlock(
'gap_input');
1549 $gaptemplate->setVariable(
'INPUT_SOLUTION', $solutiontext);
1553 $gaptemplate->parseCurrentBlock();
1559 if (isset($answer[
'actions'])) {
1571 $table = parent::getAnswerFrequencyTableGUI(
1578 $table->setTitle(sprintf(
1579 $DIC->language()->txt(
'tst_corrections_answers_tbl_subindex'),
1580 $DIC->language()->txt(
'gap') .
' ' . ($questionIndex + 1)
1584 $table->addColumn(
'',
'',
'200');
1592 return array_keys($this->object->getGaps());
1597 $gap = $this->
object->getGap(
$gapIndex);
1599 switch ($gap->type) {
1607 return $items[$answer]->getAnswertext();
1613 $gap = $this->
object->getGap($questionIndex);
1619 foreach ($answers as $key => $ans) {
1623 if ($ans[
'answer'] !== $item->getAnswerText()) {
1632 $answers[$key][
'addable'] =
true;
1643 foreach ($relevant_answers as $row) {
1644 if ($row[
'value1'] != $questionIndex) {
1648 if (!isset($answers[$row[
'value2']])) {
1651 $answers[$row[
'value2']] = array(
1652 'answer' => $label,
'frequency' => 0
1656 $answers[$row[
'value2']][
'frequency']++;
1666 foreach ($this->object->getGapCombinations() as $combination) {
1667 if ($combination[
'gap_fi'] !=
$gapIndex) {
1679 $combinations = array();
1681 foreach ($this->object->getGapCombinations() as
$c) {
1682 if (!isset($combinations[
$c[
'cid']])) {
1683 $combinations[$c[
'cid']] = array();
1686 if (!isset($combinations[$c[
'cid']][$c[
'row_id']])) {
1687 $combinations[$c[
'cid']][$c[
'row_id']] = array(
1688 'gaps' => array(),
'points' => $c[
'points'],
1692 if (!isset($combinations[$c[
'cid']][$c[
'row_id']][
'gaps'][$c[
'gap_fi']])) {
1693 $combinations[$c[
'cid']][$c[
'row_id']][
'gaps'][$c[
'gap_fi']] = array();
1696 $combinations[$c[
'cid']][$c[
'row_id']][
'gaps'][$c[
'gap_fi']] = $c[
'answer'];
1699 return $combinations;
1704 foreach ($this->object->getGaps() as
$gapIndex => $gap) {
1713 if ($this->object->getGapCombinationsExists()) {
1723 $header->setTitle(
"Gap Combination " . ($combiIndex + 1));
1726 require_once
'Modules/TestQuestionPool/classes/forms/class.ilAssClozeTestCombinationVariantsInputGUI.php';
1728 $inp->setValues($gapCombi);
1740 $header->setTitle($this->lng->txt(
"gap") .
" " . (
$gapIndex + 1));
1741 $form->addItem($header);
1746 foreach ($gap->getItemsRaw() as $item) {
1754 require_once
"Modules/TestQuestionPool/classes/forms/class.ilAssAnswerCorrectionsInputGUI.php";
1757 $values->setRequired(
true);
1758 $values->setQuestionObject($this->
object);
1759 $values->setValues($gap->getItemsRaw());
1760 $form->addItem($values);
1767 $value->setSize(10);
1769 $value->setRequired(
true);
1770 $form->addItem($value);
1774 $lowerbound->setSize(10);
1775 $lowerbound->setRequired(
true);
1777 $form->addItem($lowerbound);
1781 $upperbound->setSize(10);
1782 $upperbound->setRequired(
true);
1784 $form->addItem($upperbound);
1789 $points->setSize(3);
1790 $points->setRequired(
true);
1792 $form->addItem($points);
1801 foreach ($this->object->getGaps() as
$gapIndex => $gap) {
1809 if ($this->object->getGapCombinationsExists()) {
1830 $item->setPoints((
float) $answers[$index]->getPoints());
1846 $combinationPoints = array(
'points' => array(),
'select' => array());
1847 $combinationValues = array();
1852 if (!isset($combinationPoints[
'points'][$combiId])) {
1853 $combinationPoints[
'points'][$combiId] = array();
1854 $combinationPoints[
'select'][$combiId] = array();
1855 $combinationValues[$combiId] = array();
1858 foreach ($combi as $varId => $variant) {
1859 $combinationPoints[
'points'][$combiId][$varId] = (float) $values[$varId][
'points'];
1860 $combinationPoints[
'select'][$combiId] = array_keys($values[$varId][
'gaps']);
1861 $combinationValues[$combiId][$varId] = array_values($values[$varId][
'gaps']);
1869 $assClozeGapCombinationObject->clearGapCombinationsFromDb($this->object->getId());
1871 $assClozeGapCombinationObject->saveGapCombinationToDb(
1872 $this->object->getId(),
isTestPresentationContext()
getSpecificFeedbackOutput($userSolution)
static prepareFormOutput($a_str, $a_strip=false)
prepares string output for html forms public
hasCorrectSolution($activeId, $passIndex)
addTab_QuestionPreview(ilTabsGUI $tabsGUI)
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.
addTab_QuestionHints(ilTabsGUI $tabs)
adds the hints tab to ilTabsGUI
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.
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.
setQuestionTabs()
Sets the ILIAS tabs for this question type.
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)
static stripSlashesRecursive($a_data, $a_strip_html=true, $a_allow="")
Strip slashes from array and sub-arrays.
saveTextOrSelectGapCorrectionFormProperty(ilPropertyFormGUI $form, assClozeGap $gap, $gapIndex)
populateGapSizeFormPart($form, $gap, $gapCounter)
addTab_QuestionFeedback(ilTabsGUI $tabs)
adds the feedback tab to ilTabsGUI
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.
const ADDITIONAL_CONTENT_EDITING_MODE_DEFAULT
constant for additional content editing mode "default"
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.
setAnswertext($answertext="")
Sets the answer text.
addBackTab(ilTabsGUI $ilTabs)
$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)
addTab_SuggestedSolution(ilTabsGUI $tabs, $classname)
getAnswerTextLabel($gapIndex, $answer)
addQuestionFormCommandButtons($form)
Add the command buttons of a question properties form.
renderPurposeSupportsFormHtml()