4require_once
'./Modules/TestQuestionPool/classes/class.assQuestionGUI.php';
5require_once
'./Modules/TestQuestionPool/interfaces/interface.ilGuiQuestionScoringAdjustable.php';
6require_once
'./Modules/TestQuestionPool/interfaces/interface.ilGuiAnswerScoringAdjustable.php';
7require_once
'./Modules/Test/classes/inc.AssessmentConstants.php';
38 include_once
"./Modules/TestQuestionPool/classes/class.assMultipleChoice.php";
41 $this->
object->loadFromDb($id);
50 return $this->
object->feedbackOBJ->isSpecificAnswerFeedbackAvailable($this->object->getId());
58 $hasErrors = (!$always) ? $this->
editQuestion(
true) :
false;
61 $form->setValuesByPost();
62 require_once
'Services/Form/classes/class.ilPropertyFormGUI.php';
86 $lastChange = $this->
object->getLastChange();
87 if (empty($lastChange) && !isset(
$_POST[
'types'])) {
89 return $this->
object->getMultilineAnswerSetting() ? false :
true;
92 return $this->
object->isSingleline;
112 $form->setMultipart(
true);
114 $form->setMultipart(
false);
120 $form->getItemByPostVar(
'selection_limit')->setMaxValue(count((array)
$_POST[
'choice'][
'answer']));
122 $form->setValuesByPost();
123 $errors = !$form->checkInput();
124 $form->setValuesByPost();
131 $this->tpl->setVariable(
"QUESTION_DATA", $form->getHTML());
138 parent::addBasicQuestionFormProperties($form);
139 $form->getItemByPostVar(
'question')->setInitialRteWidth(
'100');
148 $position = key(
$_POST[
'cmd'][
'uploadchoice']);
158 $position = key(
$_POST[
'cmd'][
'removeimagechoice']);
160 $this->
object->removeAnswerImage($position);
170 $position = key(
$_POST[
'cmd'][
'addchoice']);
171 $this->
object->addAnswer(
"", 0, 0, $position + 1);
181 $position = key(
$_POST[
'cmd'][
'removechoice']);
182 $this->
object->deleteAnswer($position);
214 $graphicalOutput =
false,
215 $result_output =
false,
216 $show_question_only =
true,
217 $show_feedback =
false,
218 $show_correct_solution =
false,
219 $show_manual_scoring =
false,
220 $show_question_text =
true
226 $user_solution = array();
227 if (($active_id > 0) && (!$show_correct_solution)) {
229 foreach ($solutions as $idx => $solution_value) {
230 array_push($user_solution, $solution_value[
"value1"]);
234 foreach ($this->object->answers as
$index => $answer) {
235 $points_checked = $answer->getPointsChecked();
236 $points_unchecked = $answer->getPointsUnchecked();
237 if ($points_checked > $points_unchecked) {
238 if ($points_checked > 0) {
239 array_push($user_solution,
$index);
246 include_once
"./Services/UICore/classes/class.ilTemplate.php";
247 $template =
new ilTemplate(
"tpl.il_as_qpl_mc_mr_output_solution.html",
true,
true,
"Modules/TestQuestionPool");
248 $solutiontemplate =
new ilTemplate(
"tpl.il_as_tst_solution_output.html",
true,
true,
"Modules/TestQuestionPool");
249 foreach (
$keys as $answer_id) {
250 $answer = $this->
object->answers[$answer_id];
251 if (($active_id > 0) && (!$show_correct_solution)) {
252 if ($graphicalOutput) {
256 foreach ($user_solution as $mc_solution) {
257 if (strcmp($mc_solution, $answer_id) == 0) {
262 if ($answer->getPointsChecked() > $answer->getPointsUnchecked()) {
268 if ($answer->getPointsChecked() > $answer->getPointsUnchecked()) {
275 $template->setCurrentBlock(
"icon_ok");
277 $template->setVariable(
"TEXT_OK", $this->lng->txt(
"answer_is_right"));
278 $template->parseCurrentBlock();
280 $template->setCurrentBlock(
"icon_ok");
282 $template->setVariable(
"TEXT_NOT_OK", $this->lng->txt(
"answer_is_wrong"));
283 $template->parseCurrentBlock();
287 if (strlen($answer->getImage())) {
288 $template->setCurrentBlock(
"answer_image");
289 if ($this->object->getThumbSize()) {
290 $template->setVariable(
"ANSWER_IMAGE_URL", $this->object->getImagePathWeb() . $this->object->getThumbPrefix() . $answer->getImage());
292 $template->setVariable(
"ANSWER_IMAGE_URL", $this->object->getImagePathWeb() . $answer->getImage());
294 $alt = $answer->getImage();
295 if (strlen($answer->getAnswertext())) {
296 $alt = $answer->getAnswertext();
298 $alt = preg_replace(
"/<[^>]*?>/",
"", $alt);
301 $template->parseCurrentBlock();
304 if ($show_feedback) {
305 if ($this->object->getSpecificFeedbackSetting() == 2) {
306 foreach ($user_solution as $mc_solution) {
307 if (strcmp($mc_solution, $answer_id) == 0) {
308 $fb = $this->
object->feedbackOBJ->getSpecificAnswerFeedbackTestPresentation(
309 $this->object->getId(),
314 $template->setCurrentBlock(
"feedback");
315 $template->setVariable(
"FEEDBACK", $this->object->prepareTextareaOutput($fb,
true));
316 $template->parseCurrentBlock();
322 if ($this->object->getSpecificFeedbackSetting() == 1) {
323 $fb = $this->
object->feedbackOBJ->getSpecificAnswerFeedbackTestPresentation(
324 $this->object->getId(),
329 $template->setCurrentBlock(
"feedback");
330 $template->setVariable(
"FEEDBACK", $this->object->prepareTextareaOutput($fb,
true));
331 $template->parseCurrentBlock();
335 if ($this->object->getSpecificFeedbackSetting() == 3) {
336 $answer = $this->
object->getAnswer($answer_id);
338 if ($answer->getPoints() > 0) {
339 $fb = $this->
object->feedbackOBJ->getSpecificAnswerFeedbackTestPresentation(
340 $this->object->getId(),
345 $template->setCurrentBlock(
"feedback");
346 $template->setVariable(
"FEEDBACK", $this->object->prepareTextareaOutput($fb,
true));
347 $template->parseCurrentBlock();
352 $template->setCurrentBlock(
"answer_row");
353 $template->setVariable(
"ANSWER_TEXT", $this->object->prepareTextareaOutput($answer->getAnswertext(),
true));
355 if ($result_output) {
356 $pointschecked = $this->
object->answers[$answer_id]->getPointsChecked();
357 $pointsunchecked = $this->
object->answers[$answer_id]->getPointsUnchecked();
358 $resulttextchecked = ($pointschecked == 1) || ($pointschecked == -1) ?
"%s " . $this->lng->txt(
"point") :
"%s " . $this->lng->txt(
"points");
359 $resulttextunchecked = ($pointsunchecked == 1) || ($pointsunchecked == -1) ?
"%s " . $this->lng->txt(
"point") :
"%s " . $this->lng->txt(
"points");
360 $template->setVariable(
"RESULT_OUTPUT", sprintf(
"(" . $this->lng->txt(
"checkbox_checked") .
" = $resulttextchecked, " . $this->lng->txt(
"checkbox_unchecked") .
" = $resulttextunchecked)", $pointschecked, $pointsunchecked));
362 foreach ($user_solution as $mc_solution) {
363 if (strcmp($mc_solution, $answer_id) == 0) {
366 $template->setVariable(
"SOLUTION_ALT", $this->lng->txt(
"checked"));
368 $template->setVariable(
'QID', $this->object->getId());
369 $template->setVariable(
'SUFFIX', $show_correct_solution ?
'bestsolution' :
'usersolution');
370 $template->setVariable(
'SOLUTION_VALUE', $answer_id);
371 $template->setVariable(
'SOLUTION_CHECKED',
'checked');
379 $template->setVariable(
"SOLUTION_ALT", $this->lng->txt(
"unchecked"));
381 $template->setVariable(
'QID', $this->object->getId());
382 $template->setVariable(
'SUFFIX', $show_correct_solution ?
'bestsolution' :
'usersolution');
383 $template->setVariable(
'SOLUTION_VALUE', $answer_id);
386 $template->parseCurrentBlock();
388 $questiontext = $this->
object->getQuestionForHTMLOutput();
392 if ($show_question_text ==
true) {
393 $template->setVariable(
"QUESTIONTEXT", $this->object->prepareTextareaOutput($questiontext,
true));
395 $questionoutput = $template->get();
398 if (strlen($feedback)) {
404 $solutiontemplate->setVariable(
"ILC_FB_CSS_CLASS", $cssClass);
405 $solutiontemplate->setVariable(
"FEEDBACK", $this->object->prepareTextareaOutput($feedback,
true));
407 $solutiontemplate->setVariable(
"SOLUTION_OUTPUT", $questionoutput);
409 $solutionoutput = $solutiontemplate->get();
411 if (!$show_question_only) {
415 return $solutionoutput;
418 public function getPreview($show_question_only =
false, $showInlineFeedback =
false)
425 include_once
"./Services/UICore/classes/class.ilTemplate.php";
426 $template =
new ilTemplate(
"tpl.il_as_qpl_mc_mr_output.html",
true,
true,
"Modules/TestQuestionPool");
427 foreach (
$keys as $answer_id) {
428 $answer = $this->
object->answers[$answer_id];
429 if (strlen($answer->getImage())) {
430 if ($this->object->getThumbSize()) {
431 $template->setCurrentBlock(
"preview");
432 $template->setVariable(
"URL_PREVIEW", $this->object->getImagePathWeb() . $answer->getImage());
433 $template->setVariable(
"TEXT_PREVIEW", $this->lng->txt(
'preview'));
435 $template->setVariable(
"ANSWER_IMAGE_URL", $this->object->getImagePathWeb() . $this->object->getThumbPrefix() . $answer->getImage());
436 list($width, $height,
$type, $attr) = getimagesize($this->object->getImagePath() . $answer->getImage());
437 $alt = $answer->getImage();
438 if (strlen($answer->getAnswertext())) {
439 $alt = $answer->getAnswertext();
441 $alt = preg_replace(
"/<[^>]*?>/",
"", $alt);
444 $template->parseCurrentBlock();
446 $template->setCurrentBlock(
"answer_image");
447 $template->setVariable(
"ANSWER_IMAGE_URL", $this->object->getImagePathWeb() . $answer->getImage());
448 list($width, $height,
$type, $attr) = getimagesize($this->object->getImagePath() . $answer->getImage());
449 $alt = $answer->getImage();
450 if (strlen($answer->getAnswertext())) {
451 $alt = $answer->getAnswertext();
453 $alt = preg_replace(
"/<[^>]*?>/",
"", $alt);
454 $template->setVariable(
"ATTR", $attr);
457 $template->parseCurrentBlock();
461 if ($showInlineFeedback) {
465 $template->setCurrentBlock(
"answer_row");
466 $template->setVariable(
"QID", $this->object->getId());
467 $template->setVariable(
"ANSWER_ID", $answer_id);
468 $template->setVariable(
"ANSWER_TEXT", $this->object->prepareTextareaOutput($answer->getAnswertext(),
true));
469 foreach ($user_solution as $mc_solution) {
470 if (strcmp($mc_solution, $answer_id) == 0) {
471 $template->setVariable(
"CHECKED_ANSWER",
" checked=\"checked\"");
474 $template->parseCurrentBlock();
476 if ($this->object->getSelectionLimit()) {
477 $template->setVariable(
'SELECTION_LIMIT_HINT', sprintf(
478 $this->lng->txt(
'ass_mc_sel_lim_hint'),
479 $this->object->getSelectionLimit(),
480 $this->object->getAnswerCount()
483 $template->setVariable(
'SELECTION_LIMIT_VALUE', $this->object->getSelectionLimit());
485 $template->setVariable(
'SELECTION_LIMIT_VALUE',
'null');
487 $template->setVariable(
"QUESTION_ID", $this->object->getId());
488 $questiontext = $this->
object->getQuestionForHTMLOutput();
492 $template->setVariable(
"QUESTIONTEXT", $this->object->prepareTextareaOutput($questiontext,
true));
493 $questionoutput = $template->get();
494 if (!$show_question_only) {
498 return $questionoutput;
515 $is_postponed =
false,
516 $use_post_solutions =
false,
517 $show_feedback =
false
523 $user_solution = array();
527 #include_once "./Modules/Test/classes/class.ilObjTest.php";
528 #if (!ilObjTest::_getUsePreviousAnswers($active_id, true))
530 # if (is_null($pass)) $pass = ilObjTest::_getPass($active_id);
532 $solutions = $this->
object->getTestOutputSolutions($active_id,
$pass);
534 foreach ($solutions as $idx => $solution_value) {
536 if ($solution_value[
"value1"] ==
'mc_none_above') {
541 $user_solution[] = $solution_value[
"value1"];
545 if (empty($user_solution) && $this->object->getTestPresentationConfig()->isWorkedThrough()) {
550 $this->tpl->addJavaScript(
'Modules/TestQuestionPool/js/ilAssMultipleChoice.js');
551 include_once
"./Services/UICore/classes/class.ilTemplate.php";
552 $template =
new ilTemplate(
"tpl.il_as_qpl_mc_mr_output.html",
true,
true,
"Modules/TestQuestionPool");
553 foreach (
$keys as $answer_id) {
554 $answer = $this->
object->answers[$answer_id];
555 if (strlen($answer->getImage())) {
556 if ($this->object->getThumbSize()) {
557 $template->setCurrentBlock(
"preview");
558 $template->setVariable(
"URL_PREVIEW", $this->object->getImagePathWeb() . $answer->getImage());
559 $template->setVariable(
"TEXT_PREVIEW", $this->lng->txt(
'preview'));
561 $template->setVariable(
"ANSWER_IMAGE_URL", $this->object->getImagePathWeb() . $this->object->getThumbPrefix() . $answer->getImage());
562 list($width, $height,
$type, $attr) = getimagesize($this->object->getImagePath() . $answer->getImage());
563 $alt = $answer->getImage();
564 if (strlen($answer->getAnswertext())) {
565 $alt = $answer->getAnswertext();
567 $alt = preg_replace(
"/<[^>]*?>/",
"", $alt);
570 $template->parseCurrentBlock();
572 $template->setCurrentBlock(
"answer_image");
573 $template->setVariable(
"ANSWER_IMAGE_URL", $this->object->getImagePathWeb() . $answer->getImage());
574 list($width, $height,
$type, $attr) = getimagesize($this->object->getImagePath() . $answer->getImage());
575 $alt = $answer->getImage();
576 if (strlen($answer->getAnswertext())) {
577 $alt = $answer->getAnswertext();
579 $alt = preg_replace(
"/<[^>]*?>/",
"", $alt);
580 $template->setVariable(
"ATTR", $attr);
583 $template->parseCurrentBlock();
587 if ($show_feedback) {
591 $template->setCurrentBlock(
"answer_row");
592 $template->setVariable(
"QID", $this->object->getId());
593 $template->setVariable(
"ANSWER_ID", $answer_id);
594 $template->setVariable(
"ANSWER_TEXT", $this->object->prepareTextareaOutput($answer->getAnswertext(),
true));
595 foreach ($user_solution as $mc_solution) {
596 if (strcmp($mc_solution, $answer_id) == 0) {
597 $template->setVariable(
"CHECKED_ANSWER",
" checked=\"checked\"");
600 $template->parseCurrentBlock();
603 $template->setVariable(
"QUESTIONTEXT", $this->object->getQuestionForHTMLOutput());
604 $template->setVariable(
"QUESTION_ID", $this->object->getId());
605 if ($this->object->getSelectionLimit()) {
606 $template->setVariable(
'SELECTION_LIMIT_HINT', sprintf(
607 $this->lng->txt(
'ass_mc_sel_lim_hint'),
608 $this->object->getSelectionLimit(),
609 $this->object->getAnswerCount()
612 $template->setVariable(
'SELECTION_LIMIT_VALUE', $this->object->getSelectionLimit());
614 $template->setVariable(
'SELECTION_LIMIT_VALUE',
'null');
616 $questionoutput = $template->get();
617 $pageoutput = $this->
outQuestionPage(
"", $is_postponed, $active_id, $questionoutput, $show_feedback);
636 $this->tpl->addJavaScript(
'Modules/TestQuestionPool/js/ilAssMultipleChoice.js');
638 $tpl =
new ilTemplate(
'tpl.tst_question_additional_behaviour_checkbox.html',
true,
true,
'Modules/TestQuestionPool');
643 $tpl->setCurrentBlock(
'checked');
644 $tpl->touchBlock(
'checked');
645 $tpl->parseCurrentBlock();
649 $tpl->setCurrentBlock(
'checkbox');
650 $tpl->setVariable(
'TXT_FORCE_FORM_DIFF_LABEL', $this->object->getTestPresentationConfig()->getUseUnchangedAnswerLabel());
651 $tpl->parseCurrentBlock();
658 return array(
'Modules/TestQuestionPool/js/ilAssMultipleChoice.js');
670 if ($this->object->getShuffle()) {
681 return $this->
object->prepareTextareaOutput($output,
true);
686 $this->
object->setShuffle(
$_POST[
"shuffle"]);
688 $selectionLimit = (int) $form->
getItemByPostVar(
'selection_limit')->getValue();
689 $this->
object->setSelectionLimit($selectionLimit > 0 ? $selectionLimit :
null);
691 $this->
object->setSpecificFeedbackSetting(
$_POST[
'feedback_setting']);
693 $this->
object->setMultilineAnswerSetting(
$_POST[
"types"]);
694 if (is_array(
$_POST[
'choice'][
'imagename']) &&
$_POST[
"types"] == 1) {
695 $this->
object->isSingleline =
true;
698 $this->
object->isSingleline = (
$_POST[
"types"] == 0) ?
true :
false;
700 $this->
object->setThumbSize((strlen(
$_POST[
"thumb_size"])) ?
$_POST[
"thumb_size"] :
"");
706 $this->
object->flushAnswers();
707 if ($this->object->isSingleline) {
708 foreach (
$_POST[
'choice'][
'answer'] as
$index => $answertext) {
711 $file_org_name = $_FILES[
'choice'][
'name'][
'image'][
$index];
712 $file_temp_name = $_FILES[
'choice'][
'tmp_name'][
'image'][
$index];
714 if (strlen($file_temp_name)) {
716 $suffix = strtolower(array_pop(explode(
".", $file_org_name)));
717 if (in_array($suffix, array(
"jpg",
"jpeg",
"png",
"gif" ))) {
719 $filename = $this->
object->buildHashedImageFilename($file_org_name);
720 if ($this->object->setImageFile(
$filename, $file_temp_name) == 0) {
725 $this->
object->addAnswer(
735 foreach (
$_POST[
'choice'][
'answer'] as
$index => $answer) {
736 $answertext = $answer;
737 $this->
object->addAnswer(
753 $shuffle->setValue(1);
754 $shuffle->setChecked($this->object->getShuffle());
755 $shuffle->setRequired(
false);
758 require_once
'Services/Form/classes/class.ilNumberInputGUI.php';
759 $selLim =
new ilNumberInputGUI($this->lng->txt(
'ass_mc_sel_lim_setting'),
'selection_limit');
760 $selLim->setInfo($this->lng->txt(
'ass_mc_sel_lim_setting_desc'));
762 $selLim->setRequired(
false);
763 $selLim->allowDecimals(
false);
764 $selLim->setMinvalueShouldBeGreater(
false);
765 $selLim->setMaxvalueShouldBeLess(
false);
766 $selLim->setMinValue(1);
767 $selLim->setMaxValue($this->object->getAnswerCount());
768 $selLim->setValue($this->object->getSelectionLimit());
771 if ($this->object->getId()) {
773 $hidden->setValue($this->object->getId());
779 if (!$this->object->getSelfAssessmentEditingMode()) {
782 $types->setRequired(
false);
783 $types->setValue(($isSingleline) ? 0 : 1);
786 0 => $this->lng->txt(
'answers_singleline'),
787 1 => $this->lng->txt(
'answers_multiline'),
795 $thumb_size =
new ilNumberInputGUI($this->lng->txt(
"thumb_size"),
"thumb_size");
796 $thumb_size->setSuffix($this->lng->txt(
"thumb_size_unit_pixel"));
797 $thumb_size->setMinValue(20);
798 $thumb_size->setDecimals(0);
799 $thumb_size->setSize(6);
800 $thumb_size->setInfo($this->lng->txt(
'thumb_size_info'));
801 $thumb_size->setValue($this->object->getThumbSize());
802 $thumb_size->setRequired(
false);
804 return $isSingleline;
806 return $isSingleline;
812 include_once
"./Modules/TestQuestionPool/classes/class.ilMultipleChoiceWizardInputGUI.php";
814 $choices->setRequired(
true);
815 $choices->setQuestionObject($this->
object);
817 $choices->setSingleline($isSingleline);
818 $choices->setAllowMove(
false);
819 if ($this->object->getSelfAssessmentEditingMode()) {
820 $choices->setSize(40);
822 $choices->setMaxLength(800);
823 if ($this->object->getAnswerCount() == 0) {
824 $this->
object->addAnswer(
"", 0, 0, 0);
826 $choices->setValues(array_map(
828 $value->setAnswerText(html_entity_decode($value->getAnswerText()));
831 $this->
object->getAnswers()
881 $aggregate = array();
882 foreach ($answers_defined_on_question as $answer) {
883 $aggregated_info_for_answer = array();
884 $aggregated_info_for_answer[
'answertext'] = $answer->getAnswerText();
885 $aggregated_info_for_answer[
'count_checked'] = 0;
887 foreach ($relevant_answers_chosen as $relevant_answer) {
888 if ($relevant_answer[
'value1'] == $answer->getOrder()) {
889 $aggregated_info_for_answer[
'count_checked']++;
892 $aggregated_info_for_answer[
'count_unchecked'] =
893 ceil(count($relevant_answers_chosen) / count($answers_defined_on_question))
894 - $aggregated_info_for_answer[
'count_checked'];
896 $aggregate[] = $aggregated_info_for_answer;
908 $tpl =
new ilTemplate(
'tpl.il_as_aggregated_answers_table.html',
true,
true,
"Modules/TestQuestionPool");
910 $tpl->setCurrentBlock(
'headercell');
911 $tpl->setVariable(
'HEADER', $this->lng->txt(
'tst_answer_aggr_answer_header'));
912 $tpl->parseCurrentBlock();
914 $tpl->setCurrentBlock(
'headercell');
915 $tpl->setVariable(
'HEADER', $this->lng->txt(
'tst_answer_aggr_frequency_header'));
916 $tpl->parseCurrentBlock();
918 foreach ($aggregate as $line_data) {
919 $tpl->setCurrentBlock(
'aggregaterow');
920 $tpl->setVariable(
'OPTION', $line_data[
'answertext']);
921 $tpl->setVariable(
'COUNT', $line_data[
'count_checked']);
922 $tpl->parseCurrentBlock();
935 if ($this->object->getSpecificFeedbackSetting() == 2) {
936 foreach ($user_solution as $mc_solution) {
937 if (strcmp($mc_solution, $answer_id) == 0) {
938 $fb = $this->
object->feedbackOBJ->getSpecificAnswerFeedbackTestPresentation($this->object->getId(), 0, $answer_id);
940 $template->setCurrentBlock(
"feedback");
941 $template->setVariable(
"FEEDBACK", $this->object->prepareTextareaOutput($fb,
true));
942 $template->parseCurrentBlock();
948 if ($this->object->getSpecificFeedbackSetting() == 1) {
949 $fb = $this->
object->feedbackOBJ->getSpecificAnswerFeedbackTestPresentation($this->object->getId(), 0, $answer_id);
951 $template->setCurrentBlock(
"feedback");
952 $template->setVariable(
"FEEDBACK", $this->object->prepareTextareaOutput($fb,
true));
953 $template->parseCurrentBlock();
957 if ($this->object->getSpecificFeedbackSetting() == 3) {
958 $answer = $this->
object->getAnswer($answer_id);
960 if ($answer->getPoints() > 0) {
961 $fb = $this->
object->feedbackOBJ->getSpecificAnswerFeedbackTestPresentation($this->object->getId(), 0, $answer_id);
963 $template->setCurrentBlock(
"feedback");
964 $template->setVariable(
"FEEDBACK", $this->object->prepareTextareaOutput($fb,
true));
965 $template->parseCurrentBlock();
980 include_once(
"./Services/Form/classes/class.ilPropertyFormGUI.php");
982 $form->setFormAction($this->ctrl->getFormAction($this));
984 $form->setTableWidth(
"100%");
985 $form->setId(
"assmultiplechoice");
998 $agg = $this->
aggregateAnswers($relevantAnswers, $this->object->getAnswers());
1002 foreach ($agg as $ans) {
1004 'answer' => $ans[
'answertext'],
1005 'frequency' => $ans[
'count_checked']
1014 require_once
'Modules/TestQuestionPool/classes/forms/class.ilAssMultipleChoiceCorrectionsInputGUI.php';
1016 $choices->setRequired(
true);
1017 $choices->setQuestionObject($this->
object);
1018 $choices->setValues($this->object->getAnswers());
1027 $pointsChecked = $form->
getInput(
'choice')[
'points'];
1028 $pointsUnchecked = $form->
getInput(
'choice')[
'points_unchecked'];
1030 foreach ($this->object->getAnswers() as
$index => $answer) {
1032 $answer->setPointsChecked((
float) $pointsChecked[
$index]);
1033 $answer->setPointsUnchecked((
float) $pointsUnchecked[
$index]);
ASS_AnswerBinaryStateImage is a class for answers with a binary state indicator (checked/unchecked,...
An exception for terminatinating execution or to throw for unit testing.
return true
Flag indicating whether or not HTTP headers will be sent when outputting captcha image/audio.
Multiple choice question GUI representation.
$useEmptySolutionInputChecked
getAggregatedAnswersView($relevant_answers)
Returns an html string containing a question specific representation of the answers so far given in t...
getAfterParticipationSuppressionAnswerPostVars()
Returns a list of postvars which will be suppressed in the form output when used in scoring adjustmen...
setUseEmptySolutionInputChecked($useEmptySolutionInputChecked)
addBasicQuestionFormProperties($form)
Add basic question form properties: assessment: title, author, description, question,...
getTestOutput( $active_id, $pass, $is_postponed=false, $use_post_solutions=false, $show_feedback=false)
uploadchoice()
Upload an image.
getChoiceKeys()
Create the key index numbers for the array of choices.
getAfterParticipationSuppressionQuestionPostVars()
Returns a list of postvars which will be suppressed in the form output when used in scoring adjustmen...
aggregateAnswers($relevant_answers_chosen, $answers_defined_on_question)
getPresentationJavascripts()
populateSpecificFeedbackInline($user_solution, $answer_id, $template)
saveCorrectionsFormProperties(ilPropertyFormGUI $form)
removeimagechoice()
Remove an image.
writeAnswerSpecificPostData(ilPropertyFormGUI $form)
Extracts the answer specific values from $_POST and applies them to the data object.
getPreview($show_question_only=false, $showInlineFeedback=false)
populateQuestionSpecificFormPart(\ilPropertyFormGUI $form)
isUseEmptySolutionInputChecked()
addchoice()
Add a new answer.
renderAggregateView($aggregate)
getSpecificFeedbackOutput($userSolution)
Returns the answer specific feedback for the question.
getEditAnswersSingleLine($checkonly=false)
Get the single/multiline editing of answers.
supportsIntermediateSolutionOutput()
Question type specific support of intermediate solution output The function getSolutionOutput respect...
__construct($id=-1)
assMultipleChoiceGUI constructor
getAnswersFrequency($relevantAnswers, $questionIndex)
populateAnswerSpecificFormPart(\ilPropertyFormGUI $form)
populateCorrectionsFormProperties(ilPropertyFormGUI $form)
editQuestion($checkonly=false)
Creates an output of the edit form for the question.
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.
writeQuestionSpecificPostData(ilPropertyFormGUI $form)
Extracts the question specific values from $_POST and applies them to the data object.
removechoice()
Remove an answer.
writePostData($always=false)
{Evaluates a posted edit form and writes the form data in the question object.integer A positive valu...
getUseUnchangedAnswerCheckboxHtml()
Class for multiple choice tests.
Basic GUI class for assessment questions.
populateTaxonomyFormSection(ilPropertyFormGUI $form)
isRenderPurposePrintPdf()
writeQuestionGenericPostData()
addQuestionFormCommandButtons($form)
Add the command buttons of a question properties form.
getILIASPage($html="")
Returns the ILIAS Page around a question.
getQuestionTemplate()
get question template
outQuestionPage($a_temp_var, $a_postponed=false, $active_id="", $html="", $inlineFeedbackEnabled=false)
output question page
renderPurposeSupportsFormHtml()
getUseIntermediateSolution()
Get if intermediate solution should be used for solution output.
saveTaxonomyAssignments()
isTestPresentationContext()
hasCorrectSolution($activeId, $passIndex)
getAnswerFeedbackOutput($active_id, $pass)
Returns the answer generic feedback depending on the results of the question.
const CSS_CLASS_FEEDBACK_WRONG
const CSS_CLASS_FEEDBACK_CORRECT
special template class to simplify handling of ITX/PEAR
static secureString($a_str, $a_strip_html=true, $a_allow="")
Remove unsecure tags.
static getHtmlPath($relative_path)
get url of path
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
static prepareFormOutput($a_str, $a_strip=false)
prepares string output for html forms @access public
Interface ilGuiAnswerScoringAdjustable.
Interface ilGuiQuestionScoringAdjustable.
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc