24 include_once
"./Modules/TestQuestionPool/classes/class.assQuestionGUI.php";
52 include_once
"./Modules/TestQuestionPool/classes/class.assClozeTest.php";
56 $this->
object->loadFromDb($id);
62 if (preg_match(
"/^(removegap|addgap)_(\d+)$/",
$cmd, $matches))
65 $this->gapIndex = $matches[2];
78 $hasErrors = (!$always) ? $this->
editQuestion(
true) :
false;
81 $this->
object->flushGaps();
82 $this->
object->setTitle(
$_POST[
"title"]);
83 $this->
object->setAuthor(
$_POST[
"author"]);
84 $this->
object->setComment(
$_POST[
"comment"]);
85 $this->
object->setTextgapRating(
$_POST[
"textgap_rating"]);
86 $this->
object->setIdenticalScoring(
$_POST[
"identical_scoring"]);
89 $this->
object->setNrOfTries(
$_POST[
'nr_of_tries']);
91 $this->
object->setFixedTextLength(
$_POST[
"fixedTextLength"]);
92 include_once
"./Services/AdvancedEditing/classes/class.ilObjAdvancedEditing.php";
93 $cloze_text =
$_POST[
"question"];
94 $this->
object->setClozeText($cloze_text);
95 $this->
object->setEstimatedWorkingTime(
101 if (is_array(
$_POST[
'gap']))
103 if (strcmp($this->ctrl->getCmd(),
'createGaps') != 0) $this->
object->clearGapAnswers();
104 foreach (
$_POST[
'gap'] as $idx => $hidden)
106 $clozetype =
$_POST[
'clozetype_' . $idx];
107 $this->
object->setGapType($idx, $clozetype);
108 if (array_key_exists(
'shuffle_' . $idx,
$_POST))
110 $this->
object->setGapShuffle($idx,
$_POST[
'shuffle_' . $idx]);
113 if (strcmp($this->ctrl->getCmd(),
'createGaps') != 0)
115 if (is_array(
$_POST[
'gap_' . $idx][
'answer']))
117 foreach (
$_POST[
'gap_' . $idx][
'answer'] as $order => $value)
119 $this->
object->addGapAnswer($idx, $order, $value);
123 if (array_key_exists(
'gap_' . $idx .
'_numeric',
$_POST))
125 if (strcmp($this->ctrl->getCmd(),
'createGaps') != 0) $this->
object->addGapAnswer($idx, 0, str_replace(
",",
".",
$_POST[
'gap_' . $idx .
'_numeric']));
126 $this->
object->setGapAnswerLowerBound($idx, 0, str_replace(
",",
".",
$_POST[
'gap_' . $idx .
'_numeric_lower']));
127 $this->
object->setGapAnswerUpperBound($idx, 0, str_replace(
",",
".",
$_POST[
'gap_' . $idx .
'_numeric_upper']));
128 $this->
object->setGapAnswerPoints($idx, 0,
$_POST[
'gap_' . $idx .
'_numeric_points']);
130 if (is_array(
$_POST[
'gap_' . $idx][
'points']))
132 foreach (
$_POST[
'gap_' . $idx][
'points'] as $order => $value)
134 $this->
object->setGapAnswerPoints($idx, $order, $value);
138 if (strcmp($this->ctrl->getCmd(),
'createGaps') != 0) $this->
object->updateClozeTextFromGaps();
158 # if ($_REQUEST['prev_qid']) {
159 # $this->ctrl->setParameter($this, 'prev_qid', $_REQUEST['prev_qid']);
162 include_once(
"./Services/Form/classes/class.ilPropertyFormGUI.php");
164 $form->setFormAction($this->ctrl->getFormAction($this));
166 $form->setMultipart(FALSE);
167 $form->setTableWidth(
"100%");
168 $form->setId(
"assclozetest");
172 $q_item = $form->getItemByPostVar(
"question");
173 $q_item->setInfo($this->lng->txt(
"close_text_hint"));
174 $q_item->setTitle($this->lng->txt(
"cloze_text"));
179 $textrating =
new ilSelectInputGUI($this->lng->txt(
"text_rating"),
"textgap_rating");
180 $text_options = array(
181 "ci" => $this->lng->txt(
"cloze_textgap_case_insensitive"),
182 "cs" => $this->lng->txt(
"cloze_textgap_case_sensitive"),
183 "l1" => sprintf($this->lng->txt(
"cloze_textgap_levenshtein_of"),
"1"),
184 "l2" => sprintf($this->lng->txt(
"cloze_textgap_levenshtein_of"),
"2"),
185 "l3" => sprintf($this->lng->txt(
"cloze_textgap_levenshtein_of"),
"3"),
186 "l4" => sprintf($this->lng->txt(
"cloze_textgap_levenshtein_of"),
"4"),
187 "l5" => sprintf($this->lng->txt(
"cloze_textgap_levenshtein_of"),
"5")
189 $textrating->setOptions($text_options);
190 $textrating->setValue($this->object->getTextgapRating());
191 $form->addItem($textrating);
194 $fixedTextLength =
new ilNumberInputGUI($this->lng->txt(
"cloze_fixed_textlength"),
"fixedTextLength");
196 $fixedTextLength->setMinValue(0);
197 $fixedTextLength->setSize(3);
198 $fixedTextLength->setMaxLength(6);
199 $fixedTextLength->setInfo($this->lng->txt(
'cloze_fixed_textlength_description'));
200 $fixedTextLength->setRequired(
false);
201 $form->addItem($fixedTextLength);
204 $identical_scoring =
new ilCheckboxInputGUI($this->lng->txt(
"identical_scoring"),
"identical_scoring");
206 $identical_scoring->setChecked($this->object->getIdenticalScoring());
207 $identical_scoring->setInfo($this->lng->txt(
'identical_scoring_desc'));
208 $identical_scoring->setRequired(FALSE);
209 $form->addItem($identical_scoring);
212 for ($i = 0; $i < $this->
object->getGapCount(); $i++)
214 $gap = $this->
object->getGap($i);
216 $header->setTitle($this->lng->txt(
"gap") .
" " . ($i+1));
217 $form->addItem($header);
220 $gapcounter->setValue($i);
221 $form->addItem($gapcounter);
225 0 => $this->lng->txt(
"text_gap"),
226 1 => $this->lng->txt(
"select_gap"),
227 2 => $this->lng->txt(
"numeric_gap")
230 $gaptype->setValue($gap->getType());
231 $form->addItem($gaptype);
236 include_once
"./Modules/TestQuestionPool/classes/class.ilAnswerWizardInputGUI.php";
237 include_once
"./Modules/TestQuestionPool/classes/class.assAnswerCloze.php";
240 $values->setQuestionObject($this->
object);
241 $values->setSingleline(
true);
242 $values->setAllowMove(
false);
243 if (count($gap->getItemsRaw()) == 0) $gap->addItem(
new assAnswerCloze(
"", 0, 0));
244 $values->setValues($gap->getItemsRaw());
245 $form->addItem($values);
247 if( $this->object->getFixedTextLength() > 0 )
249 $values->setSize($this->object->getFixedTextLength());
250 $values->setMaxLength($this->object->getFixedTextLength());
255 include_once
"./Modules/TestQuestionPool/classes/class.ilAnswerWizardInputGUI.php";
256 include_once
"./Modules/TestQuestionPool/classes/class.assAnswerCloze.php";
259 $values->setQuestionObject($this->
object);
260 $values->setSingleline(
true);
261 $values->setAllowMove(
false);
262 if (count($gap->getItemsRaw()) == 0) $gap->addItem(
new assAnswerCloze(
"", 0, 0));
263 $values->setValues($gap->getItemsRaw());
264 $form->addItem($values);
267 $shuffle =
new ilCheckboxInputGUI($this->lng->txt(
"shuffle_answers"),
"shuffle_" . $i .
"");
269 $shuffle->setChecked($gap->getShuffle());
270 $shuffle->setRequired(FALSE);
271 $form->addItem($shuffle);
275 if (count($gap->getItemsRaw()) == 0) $gap->addItem(
new assAnswerCloze(
"", 0, 0));
276 foreach ($gap->getItemsRaw() as $item)
281 $value =
new ilFormulaInputGUI($this->lng->txt(
'value'),
"gap_" . $i .
"_numeric");
284 $lowerbound =
new ilFormulaInputGUI($this->lng->txt(
'range_lower_limit'),
"gap_" . $i .
"_numeric_lower");
287 $upperbound =
new ilFormulaInputGUI($this->lng->txt(
'range_upper_limit'),
"gap_" . $i .
"_numeric_upper");
292 $value =
new ilNumberInputGUI($this->lng->txt(
'value'),
"gap_" . $i .
"_numeric");
295 $lowerbound =
new ilNumberInputGUI($this->lng->txt(
'range_lower_limit'),
"gap_" . $i .
"_numeric_lower");
298 $upperbound =
new ilNumberInputGUI($this->lng->txt(
'range_upper_limit'),
"gap_" . $i .
"_numeric_upper");
304 $value->setRequired(
true);
305 $form->addItem($value);
307 $lowerbound->setSize(10);
308 $lowerbound->setRequired(
true);
310 $form->addItem($lowerbound);
312 $upperbound->setSize(10);
313 $upperbound->setRequired(
true);
315 $form->addItem($upperbound);
317 if( $this->object->getFixedTextLength() > 0 )
319 $value->setSize($this->object->getFixedTextLength());
320 $value->setMaxLength($this->object->getFixedTextLength());
321 $lowerbound->setSize($this->object->getFixedTextLength());
322 $lowerbound->setMaxLength($this->object->getFixedTextLength());
323 $upperbound->setSize($this->object->getFixedTextLength());
324 $upperbound->setMaxLength($this->object->getFixedTextLength());
327 $points =
new ilNumberInputGUI($this->lng->txt(
'points'),
"gap_" . $i .
"_numeric_points");
330 $points->setRequired(
true);
332 $form->addItem($points);
337 $form->addCommandButton(
'createGaps', $this->lng->txt(
'create_gaps'));
344 $form->setValuesByPost();
345 $errors = !$form->checkInput();
346 $form->setValuesByPost();
347 if (
$errors) $checkonly =
false;
350 if (!$checkonly) $this->tpl->setVariable(
"QUESTION_DATA", $form->getHTML());
360 $this->
object->saveToDb();
370 $this->
object->deleteAnswerText($this->gapIndex, key(
$_POST[
'cmd'][
'removegap_' . $this->gapIndex]));
380 $this->
object->addGapAnswer($this->gapIndex, key(
$_POST[
'cmd'][
'addgap_' . $this->gapIndex])+1,
"");
398 $test_output = $this->
getTestOutput($active_id,
$pass, $is_postponed, $use_post_solutions);
399 $this->tpl->setVariable(
"QUESTION_OUTPUT", $test_output);
400 $this->tpl->setVariable(
"FORMACTION", $formaction);
414 include_once
"./Services/UICore/classes/class.ilTemplate.php";
415 $template =
new ilTemplate(
"tpl.il_as_qpl_cloze_question_output.html", TRUE, TRUE,
"Modules/TestQuestionPool");
416 $output = $this->
object->getClozeText();
417 foreach ($this->object->getGaps() as $gap_index => $gap)
419 switch ($gap->getType())
422 $gaptemplate =
new ilTemplate(
"tpl.il_as_qpl_cloze_question_gap_text.html", TRUE, TRUE,
"Modules/TestQuestionPool");
423 $gaptemplate->setVariable(
"TEXT_GAP_SIZE", $this->object->getFixedTextLength() ? $this->
object->getFixedTextLength() : $gap->getMaxWidth());
424 $gaptemplate->setVariable(
"GAP_COUNTER", $gap_index);
425 $output = preg_replace(
"/\[gap\].*?\[\/gap\]/", $gaptemplate->get(), $output, 1);
428 $gaptemplate =
new ilTemplate(
"tpl.il_as_qpl_cloze_question_gap_select.html", TRUE, TRUE,
"Modules/TestQuestionPool");
429 foreach ($gap->getItems() as $item)
431 $gaptemplate->setCurrentBlock(
"select_gap_option");
432 $gaptemplate->setVariable(
"SELECT_GAP_VALUE", $item->getOrder());
434 $gaptemplate->parseCurrentBlock();
436 $gaptemplate->setVariable(
"PLEASE_SELECT", $this->lng->txt(
"please_select"));
437 $gaptemplate->setVariable(
"GAP_COUNTER", $gap_index);
438 $output = preg_replace(
"/\[gap\].*?\[\/gap\]/", $gaptemplate->get(), $output, 1);
441 $gaptemplate =
new ilTemplate(
"tpl.il_as_qpl_cloze_question_gap_numeric.html", TRUE, TRUE,
"Modules/TestQuestionPool");
442 $gaptemplate->setVariable(
"TEXT_GAP_SIZE", $this->object->getFixedTextLength() ? $this->
object->getFixedTextLength() : $gap->getMaxWidth());
443 $gaptemplate->setVariable(
"GAP_COUNTER", $gap_index);
444 $output = preg_replace(
"/\[gap\].*?\[\/gap\]/", $gaptemplate->get(), $output, 1);
448 $template->setVariable(
"QUESTIONTEXT", $this->object->prepareTextareaOutput($output, TRUE));
449 $questionoutput = $template->get();
450 if (!$show_question_only)
455 return $questionoutput;
474 $graphicalOutput = FALSE,
475 $result_output = FALSE,
476 $show_question_only = TRUE,
477 $show_feedback = FALSE,
478 $show_correct_solution = FALSE,
479 $show_manual_scoring = FALSE,
480 $show_question_text = TRUE
484 $user_solution = array();
485 if (($active_id > 0) && (!$show_correct_solution))
488 $user_solution =& $this->
object->getSolutionValues($active_id,
$pass);
489 if (!is_array($user_solution))
491 $user_solution = array();
494 foreach ($this->object->gaps as $index => $gap)
496 $user_solution = array();
501 include_once
"./Services/UICore/classes/class.ilTemplate.php";
502 $template =
new ilTemplate(
"tpl.il_as_qpl_cloze_question_output_solution.html", TRUE, TRUE,
"Modules/TestQuestionPool");
503 $output = $this->
object->getClozeText();
504 foreach ($this->object->getGaps() as $gap_index => $gap)
506 $gaptemplate =
new ilTemplate(
"tpl.il_as_qpl_cloze_question_output_solution_gap.html", TRUE, TRUE,
"Modules/TestQuestionPool");
508 foreach ($user_solution as $solutionarray)
510 if ($solutionarray[
"value1"] == $gap_index) $found = $solutionarray;
515 if ($graphicalOutput)
518 $details = $this->
object->calculateReachedPoints($active_id,
$pass, TRUE);
519 $check = $details[$gap_index];
522 $gaptemplate->setCurrentBlock(
"icon_ok");
524 $gaptemplate->setVariable(
"TEXT_OK", $this->lng->txt(
"answer_is_right"));
525 $gaptemplate->parseCurrentBlock();
529 $gaptemplate->setCurrentBlock(
"icon_not_ok");
530 if ($check[
"positive"])
533 $gaptemplate->setVariable(
"TEXT_NOT_OK", $this->lng->txt(
"answer_is_not_correct_but_positive"));
538 $gaptemplate->setVariable(
"TEXT_NOT_OK", $this->lng->txt(
"answer_is_wrong"));
540 $gaptemplate->parseCurrentBlock();
546 $points = $this->
object->getMaximumGapPoints($gap_index);
547 $resulttext = ($points == 1) ?
"(%s " . $this->lng->txt(
"point") .
")" :
"(%s " . $this->lng->txt(
"points") .
")";
548 $gaptemplate->setCurrentBlock(
"result_output");
549 $gaptemplate->setVariable(
"RESULT_OUTPUT", sprintf($resulttext, $points));
550 $gaptemplate->parseCurrentBlock();
552 switch ($gap->getType())
556 if (($active_id > 0) && (!$show_correct_solution))
558 if ((count($found) == 0) || (strlen(trim($found[
"value2"])) == 0))
560 for ($chars = 0; $chars < $gap->getMaxWidth(); $chars++)
562 $solutiontext .=
" ";
574 $gaptemplate->setVariable(
"SOLUTION", $solutiontext);
575 $output = preg_replace(
"/\[gap\].*?\[\/gap\]/", $gaptemplate->get(), $output, 1);
579 if (($active_id > 0) && (!$show_correct_solution))
581 if ((count($found) == 0) || (strlen(trim($found[
"value2"])) == 0))
583 for ($chars = 0; $chars < $gap->getMaxWidth(); $chars++)
585 $solutiontext .=
" ";
590 $item = $gap->getItem($found[
"value2"]);
591 if (is_object($item))
597 for ($chars = 0; $chars < $gap->getMaxWidth(); $chars++)
599 $solutiontext .=
" ";
608 $gaptemplate->setVariable(
"SOLUTION", $solutiontext);
609 $output = preg_replace(
"/\[gap\].*?\[\/gap\]/", $gaptemplate->get(), $output, 1);
613 if (($active_id > 0) && (!$show_correct_solution))
615 if ((count($found) == 0) || (strlen(trim($found[
"value2"])) == 0))
617 for ($chars = 0; $chars < $gap->getMaxWidth(); $chars++)
619 $solutiontext .=
" ";
631 $gaptemplate->setVariable(
"SOLUTION", $solutiontext);
632 $output = preg_replace(
"/\[gap\].*?\[\/gap\]/", $gaptemplate->get(), $output, 1);
637 $template->setVariable(
"QUESTIONTEXT", $this->object->prepareTextareaOutput($output, TRUE));
639 $solutiontemplate =
new ilTemplate(
"tpl.il_as_tst_solution_output.html",TRUE, TRUE,
"Modules/TestQuestionPool");
640 $questionoutput = $template->get();
646 $feedback .= strlen($fb) ? $fb :
'';
649 $feedback .= strlen($fb) ? $fb :
'';
651 if (strlen($feedback)) $solutiontemplate->setVariable(
"FEEDBACK", $this->object->prepareTextareaOutput($feedback,
true));
653 $solutiontemplate->setVariable(
"SOLUTION_OUTPUT", $questionoutput);
655 $solutionoutput = $solutiontemplate->get();
657 if (!$show_question_only)
660 $solutionoutput =
'<div class="ilc_question_Standard">'.$solutionoutput.
"</div>";
663 return $solutionoutput;
668 include_once
"./Modules/Test/classes/class.ilObjTest.php";
670 if (strlen($manual_feedback))
672 return $manual_feedback;
674 $correct_feedback = $this->
object->getFeedbackGeneric(1);
675 $incorrect_feedback = $this->
object->getFeedbackGeneric(0);
676 if (strlen($correct_feedback.$incorrect_feedback))
678 $reached_points = $this->
object->calculateReachedPoints($active_id,
$pass);
679 $max_points = $this->
object->getMaximumPoints();
680 if ($reached_points == $max_points)
682 $output .= $correct_feedback;
686 $output .= $incorrect_feedback;
690 return $this->
object->prepareTextareaOutput($output, TRUE);
693 function getTestOutput($active_id,
$pass = NULL, $is_postponed = FALSE, $use_post_solutions = FALSE, $show_feedback = FALSE)
696 $user_solution = array();
699 include_once
"./Modules/Test/classes/class.ilObjTest.php";
704 $user_solution =& $this->
object->getSolutionValues($active_id,
$pass);
705 if (!is_array($user_solution))
707 $user_solution = array();
712 include_once
"./Services/UICore/classes/class.ilTemplate.php";
713 $template =
new ilTemplate(
"tpl.il_as_qpl_cloze_question_output.html", TRUE, TRUE,
"Modules/TestQuestionPool");
714 $output = $this->
object->getClozeText();
715 foreach ($this->object->getGaps() as $gap_index => $gap)
717 switch ($gap->getType())
720 $gaptemplate =
new ilTemplate(
"tpl.il_as_qpl_cloze_question_gap_text.html", TRUE, TRUE,
"Modules/TestQuestionPool");
721 $gaptemplate->setVariable(
"TEXT_GAP_SIZE", $this->object->getFixedTextLength() ? $this->
object->getFixedTextLength() : $gap->getMaxWidth());
722 $gaptemplate->setVariable(
"GAP_COUNTER", $gap_index);
723 foreach ($user_solution as $solution)
725 if (strcmp($solution[
"value1"], $gap_index) == 0)
730 $output = preg_replace(
"/\[gap\].*?\[\/gap\]/", $gaptemplate->get(), $output, 1);
733 $gaptemplate =
new ilTemplate(
"tpl.il_as_qpl_cloze_question_gap_select.html", TRUE, TRUE,
"Modules/TestQuestionPool");
734 foreach ($gap->getItems() as $item)
736 $gaptemplate->setCurrentBlock(
"select_gap_option");
737 $gaptemplate->setVariable(
"SELECT_GAP_VALUE", $item->getOrder());
739 foreach ($user_solution as $solution)
741 if (strcmp($solution[
"value1"], $gap_index) == 0)
743 if (strcmp($solution[
"value2"], $item->getOrder()) == 0)
745 $gaptemplate->setVariable(
"SELECT_GAP_SELECTED",
" selected=\"selected\"");
749 $gaptemplate->parseCurrentBlock();
751 $gaptemplate->setVariable(
"PLEASE_SELECT", $this->lng->txt(
"please_select"));
752 $gaptemplate->setVariable(
"GAP_COUNTER", $gap_index);
753 $output = preg_replace(
"/\[gap\].*?\[\/gap\]/", $gaptemplate->get(), $output, 1);
756 $gaptemplate =
new ilTemplate(
"tpl.il_as_qpl_cloze_question_gap_numeric.html", TRUE, TRUE,
"Modules/TestQuestionPool");
757 $gaptemplate->setVariable(
"TEXT_GAP_SIZE", $this->object->getFixedTextLength() ? $this->
object->getFixedTextLength() : $gap->getMaxWidth());
758 $gaptemplate->setVariable(
"GAP_COUNTER", $gap_index);
759 foreach ($user_solution as $solution)
761 if (strcmp($solution[
"value1"], $gap_index) == 0)
766 $output = preg_replace(
"/\[gap\].*?\[\/gap\]/", $gaptemplate->get(), $output, 1);
771 $template->setVariable(
"QUESTIONTEXT", $this->object->prepareTextareaOutput($output, TRUE));
772 $questionoutput = $template->get();
773 $pageoutput = $this->
outQuestionPage(
"", $is_postponed, $active_id, $questionoutput);
784 include_once
"./Services/AdvancedEditing/classes/class.ilObjAdvancedEditing.php";
786 $this->
object->saveFeedbackGeneric(0,
$_POST[
"feedback_incomplete"]);
787 $this->
object->saveFeedbackGeneric(1,
$_POST[
"feedback_complete"]);
788 foreach ($this->object->gaps as $index => $answer)
790 $this->
object->saveFeedbackSingleAnswer($index,
$_POST[
"feedback_answer_$index"]);
792 $this->
object->cleanupMediaObjectUsage();
805 global $rbacsystem, $ilTabs;
807 $this->ctrl->setParameterByClass(
"ilpageobjectgui",
"q_id",
$_GET[
"q_id"]);
808 include_once
"./Modules/TestQuestionPool/classes/class.assQuestion.php";
809 $q_type = $this->
object->getQuestionType();
813 $classname = $q_type .
"GUI";
814 $this->ctrl->setParameterByClass(strtolower($classname),
"sel_question_types", $q_type);
815 $this->ctrl->setParameterByClass(strtolower($classname),
"q_id",
$_GET[
"q_id"]);
816 # $this->ctrl->setParameterByClass(strtolower($classname), 'prev_qid', $_REQUEST['prev_qid']);
821 if ($rbacsystem->checkAccess(
'write',
$_GET[
"ref_id"]))
824 $ilTabs->addTarget(
"edit_page",
825 $this->ctrl->getLinkTargetByClass(
"ilPageObjectGUI",
"edit"),
826 array(
"edit",
"insert",
"exec_pg"),
827 "",
"", $force_active);
831 $ilTabs->addTarget(
"preview",
832 $this->ctrl->getLinkTargetByClass(
"ilPageObjectGUI",
"preview"),
834 "ilPageObjectGUI",
"", $force_active);
837 $force_active =
false;
838 $commands =
$_POST[
"cmd"];
839 if (is_array($commands))
841 foreach ($commands as $key => $value)
843 if (preg_match(
"/^removegap_.*/", $key, $matches) ||
844 preg_match(
"/^addgap_.*/", $key, $matches)
847 $force_active =
true;
851 if ($rbacsystem->checkAccess(
'write',
$_GET[
"ref_id"]))
854 if ($classname) $url = $this->ctrl->getLinkTargetByClass($classname,
"editQuestion");
856 $ilTabs->addTarget(
"edit_question",
858 array(
"editQuestion",
"originalSyncForm",
"save",
"createGaps",
"saveEdit"),
859 $classname,
"", $force_active);
864 $ilTabs->addTarget(
"feedback",
865 $this->ctrl->getLinkTargetByClass($classname,
"feedback"),
866 array(
"feedback",
"saveFeedback"),
875 $ilTabs->addTarget(
"solution_hint",
876 $this->ctrl->getLinkTargetByClass($classname,
"suggestedsolution"),
877 array(
"suggestedsolution",
"saveSuggestedSolution",
"outSolutionExplorer",
"cancel",
878 "addSuggestedSolution",
"cancelExplorer",
"linkChilds",
"removeSuggestedSolution"
888 $ilTabs->addTarget(
"statistics",
889 $this->ctrl->getLinkTargetByClass($classname,
"assessment"),
894 if ((
$_GET[
"calling_test"] > 0) || (
$_GET[
"test_ref_id"] > 0))
899 global $___test_express_mode;
901 if (!
$_GET[
'test_express_mode'] && !$___test_express_mode) {
902 $ilTabs->setBackTarget($this->lng->txt(
"backtocallingtest"),
"ilias.php?baseClass=ilObjTestGUI&cmd=questions&ref_id=$ref_id");
906 $ilTabs->setBackTarget($this->lng->txt(
"backtocallingtest"), $link);
911 $ilTabs->setBackTarget($this->lng->txt(
"qpl"), $this->ctrl->getLinkTargetByClass(
"ilobjquestionpoolgui",
"questions"));
922 $save = (strcmp($this->ctrl->getCmd(),
"saveFeedback") == 0) ? TRUE : FALSE;
923 include_once(
"./Services/Form/classes/class.ilPropertyFormGUI.php");
925 $form->setFormAction($this->ctrl->getFormAction($this));
926 $form->setTitle($this->lng->txt(
'feedback_answers'));
927 $form->setTableWidth(
"100%");
928 $form->setId(
"feedback");
930 $complete =
new ilTextAreaInputGUI($this->lng->txt(
"feedback_complete_solution"),
"feedback_complete");
931 $complete->
setValue($this->object->prepareTextareaOutput($this->object->getFeedbackGeneric(1)));
932 $complete->setRequired(
false);
933 $complete->setRows(10);
934 $complete->setCols(80);
937 $complete->setUseRte(
true);
939 include_once
"./Services/AdvancedEditing/classes/class.ilObjAdvancedEditing.php";
941 $complete->addPlugin(
"latex");
942 $complete->addButton(
"latex");
943 $complete->addButton(
"pastelatex");
944 $complete->setRTESupport($this->object->getId(),
"qpl",
"assessment", null,
false,
'3.4.7');
945 $form->addItem($complete);
947 $incomplete =
new ilTextAreaInputGUI($this->lng->txt(
"feedback_incomplete_solution"),
"feedback_incomplete");
948 $incomplete->
setValue($this->object->prepareTextareaOutput($this->object->getFeedbackGeneric(0)));
949 $incomplete->setRequired(
false);
950 $incomplete->setRows(10);
951 $incomplete->setCols(80);
954 $incomplete->setUseRte(
true);
956 include_once
"./Services/AdvancedEditing/classes/class.ilObjAdvancedEditing.php";
958 $incomplete->addPlugin(
"latex");
959 $incomplete->addButton(
"latex");
960 $incomplete->addButton(
"pastelatex");
961 $incomplete->setRTESupport($this->object->getId(),
"qpl",
"assessment", null,
false,
'3.4.7');
962 $form->addItem($incomplete);
966 foreach ($this->object->gaps as $index => $answer)
968 $caption =
'Gap '.$ordinal = $index+1 .
':<i> ';
969 foreach ($answer->items as $item)
971 $caption .=
'"' . $item->answertext.
'" / ';
973 $caption = substr($caption, 0, strlen($caption)-3);
976 $answerobj =
new ilTextAreaInputGUI($this->object->prepareTextareaOutput($caption,
true),
"feedback_answer_$index");
977 $answerobj->
setValue($this->object->prepareTextareaOutput($this->object->getFeedbackSingleAnswer($index)));
978 $answerobj->setRequired(
false);
979 $answerobj->setRows(10);
980 $answerobj->setCols(80);
981 $answerobj->setUseRte(
true);
982 include_once
"./Services/AdvancedEditing/classes/class.ilObjAdvancedEditing.php";
984 $answerobj->addPlugin(
"latex");
985 $answerobj->addButton(
"latex");
986 $answerobj->addButton(
"pastelatex");
987 $answerobj->setRTESupport($this->object->getId(),
"qpl",
"assessment", null,
false,
'3.4.7');
988 $form->addItem($answerobj);
995 $form->addCommandButton(
"saveFeedback", $this->lng->txt(
"save"));
999 $form->setValuesByPost();
1000 $errors = !$form->checkInput();
1001 $form->setValuesByPost();
1003 if (!$checkonly) $this->tpl->setVariable(
"ADM_CONTENT", $form->getHTML());
1009 $feedback =
'<table><tbody>';
1011 foreach ($this->object->gaps as $index => $answer)
1013 $caption = $ordinal = $index+1 .
':<i> ';
1014 foreach ($answer->items as $item)
1016 $caption .=
'"' . $item->answertext.
'" / ';
1018 $caption = substr($caption, 0, strlen($caption)-3);
1021 $feedback .=
'<tr><td>';
1023 $feedback .= $caption .
'</td><td>';
1024 $feedback .= $this->
object->getFeedbackSingleAnswer($index) .
'</td> </tr>';
1026 $feedback .=
'</tbody></table>';
1028 return $this->
object->prepareTextareaOutput($feedback, TRUE);