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';
7 require_once
'./Modules/Test/classes/inc.AssessmentConstants.php';
37 parent::__construct();
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';
83 return (
$_POST[
'types'] == 0) ? true :
false;
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();
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()) {
277 $template->setVariable(
"TEXT_OK", $this->lng->txt(
"answer_is_right"));
282 $template->setVariable(
"TEXT_NOT_OK", $this->lng->txt(
"answer_is_wrong"));
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);
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(),
315 $template->setVariable(
"FEEDBACK", $this->object->prepareTextareaOutput($fb,
true));
322 if ($this->object->getSpecificFeedbackSetting() == 1) {
323 $fb = $this->
object->feedbackOBJ->getSpecificAnswerFeedbackTestPresentation(
324 $this->object->getId(),
330 $template->setVariable(
"FEEDBACK", $this->object->prepareTextareaOutput($fb,
true));
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(),
346 $template->setVariable(
"FEEDBACK", $this->object->prepareTextareaOutput($fb,
true));
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);
388 $questiontext = $this->
object->getQuestion();
389 if ($show_question_text ==
true) {
390 $template->setVariable(
"QUESTIONTEXT", $this->object->prepareTextareaOutput($questiontext,
true));
395 if (strlen($feedback)) {
401 $solutiontemplate->setVariable(
"ILC_FB_CSS_CLASS", $cssClass);
402 $solutiontemplate->setVariable(
"FEEDBACK", $this->object->prepareTextareaOutput($feedback,
true));
404 $solutiontemplate->setVariable(
"SOLUTION_OUTPUT", $questionoutput);
406 $solutionoutput = $solutiontemplate->get();
412 if (!$show_question_only) {
416 return $solutionoutput;
419 public function getPreview($show_question_only =
false, $showInlineFeedback =
false)
426 include_once
"./Services/UICore/classes/class.ilTemplate.php";
427 $template =
new ilTemplate(
"tpl.il_as_qpl_mc_mr_output.html",
true,
true,
"Modules/TestQuestionPool");
428 foreach (
$keys as $answer_id) {
429 $answer = $this->
object->answers[$answer_id];
430 if (strlen($answer->getImage())) {
431 if ($this->object->getThumbSize()) {
433 $template->setVariable(
"URL_PREVIEW", $this->object->getImagePathWeb() . $answer->getImage());
434 $template->setVariable(
"TEXT_PREVIEW", $this->lng->txt(
'preview'));
436 $template->setVariable(
"ANSWER_IMAGE_URL", $this->object->getImagePathWeb() . $this->
object->getThumbPrefix() . $answer->getImage());
437 list($width, $height,
$type, $attr) = getimagesize($this->object->getImagePath() . $answer->getImage());
438 $alt = $answer->getImage();
439 if (strlen($answer->getAnswertext())) {
440 $alt = $answer->getAnswertext();
442 $alt = preg_replace(
"/<[^>]*?>/",
"", $alt);
447 $template->setCurrentBlock(
"answer_image");
448 $template->setVariable(
"ANSWER_IMAGE_URL", $this->object->getImagePathWeb() . $answer->getImage());
449 list($width, $height,
$type, $attr) = getimagesize($this->object->getImagePath() . $answer->getImage());
450 $alt = $answer->getImage();
451 if (strlen($answer->getAnswertext())) {
452 $alt = $answer->getAnswertext();
454 $alt = preg_replace(
"/<[^>]*?>/",
"", $alt);
462 if ($showInlineFeedback) {
466 $template->setCurrentBlock(
"answer_row");
467 $template->setVariable(
"QID", $this->object->getId());
468 $template->setVariable(
"ANSWER_ID", $answer_id);
469 $template->setVariable(
"ANSWER_TEXT", $this->object->prepareTextareaOutput($answer->getAnswertext(),
true));
470 foreach ($user_solution as $mc_solution) {
471 if (strcmp($mc_solution, $answer_id) == 0) {
472 $template->setVariable(
"CHECKED_ANSWER",
" checked=\"checked\"");
477 if ($this->object->getSelectionLimit()) {
478 $template->setVariable(
'SELECTION_LIMIT_HINT', sprintf(
479 $this->lng->txt(
'ass_mc_sel_lim_hint'),
480 $this->
object->getSelectionLimit(),
481 $this->
object->getAnswerCount()
484 $template->setVariable(
'SELECTION_LIMIT_VALUE', $this->object->getSelectionLimit());
486 $template->setVariable(
'SELECTION_LIMIT_VALUE',
'null');
488 $template->setVariable(
"QUESTION_ID", $this->object->getId());
489 $questiontext = $this->
object->getQuestion();
490 $template->setVariable(
"QUESTIONTEXT", $this->object->prepareTextareaOutput($questiontext,
true));
492 if (!$show_question_only) {
496 return $questionoutput;
513 $is_postponed =
false,
514 $use_post_solutions =
false,
515 $show_feedback =
false 521 $user_solution = array();
525 #include_once "./Modules/Test/classes/class.ilObjTest.php"; 526 #if (!ilObjTest::_getUsePreviousAnswers($active_id, true)) 528 # if (is_null($pass)) $pass = ilObjTest::_getPass($active_id); 530 $solutions = $this->
object->getTestOutputSolutions($active_id,
$pass);
532 foreach ($solutions as $idx => $solution_value) {
534 if ($solution_value[
"value1"] ==
'mc_none_above') {
539 $user_solution[] = $solution_value[
"value1"];
543 if (empty($user_solution) && $this->object->getTestPresentationConfig()->isWorkedThrough()) {
548 $this->tpl->addJavaScript(
'Modules/TestQuestionPool/js/ilAssMultipleChoice.js');
549 include_once
"./Services/UICore/classes/class.ilTemplate.php";
550 $template =
new ilTemplate(
"tpl.il_as_qpl_mc_mr_output.html",
true,
true,
"Modules/TestQuestionPool");
551 foreach (
$keys as $answer_id) {
552 $answer = $this->
object->answers[$answer_id];
553 if (strlen($answer->getImage())) {
554 if ($this->object->getThumbSize()) {
556 $template->setVariable(
"URL_PREVIEW", $this->object->getImagePathWeb() . $answer->getImage());
557 $template->setVariable(
"TEXT_PREVIEW", $this->lng->txt(
'preview'));
559 $template->setVariable(
"ANSWER_IMAGE_URL", $this->object->getImagePathWeb() . $this->
object->getThumbPrefix() . $answer->getImage());
560 list($width, $height,
$type, $attr) = getimagesize($this->object->getImagePath() . $answer->getImage());
561 $alt = $answer->getImage();
562 if (strlen($answer->getAnswertext())) {
563 $alt = $answer->getAnswertext();
565 $alt = preg_replace(
"/<[^>]*?>/",
"", $alt);
570 $template->setCurrentBlock(
"answer_image");
571 $template->setVariable(
"ANSWER_IMAGE_URL", $this->object->getImagePathWeb() . $answer->getImage());
572 list($width, $height,
$type, $attr) = getimagesize($this->object->getImagePath() . $answer->getImage());
573 $alt = $answer->getImage();
574 if (strlen($answer->getAnswertext())) {
575 $alt = $answer->getAnswertext();
577 $alt = preg_replace(
"/<[^>]*?>/",
"", $alt);
585 if ($show_feedback) {
589 $template->setCurrentBlock(
"answer_row");
590 $template->setVariable(
"QID", $this->object->getId());
591 $template->setVariable(
"ANSWER_ID", $answer_id);
592 $template->setVariable(
"ANSWER_TEXT", $this->object->prepareTextareaOutput($answer->getAnswertext(),
true));
593 foreach ($user_solution as $mc_solution) {
594 if (strcmp($mc_solution, $answer_id) == 0) {
595 $template->setVariable(
"CHECKED_ANSWER",
" checked=\"checked\"");
601 $questiontext = $this->
object->getQuestion();
602 $template->setVariable(
"QUESTIONTEXT", $this->object->prepareTextareaOutput($questiontext,
true));
603 $template->setVariable(
"QUESTION_ID", $this->object->getId());
604 if ($this->object->getSelectionLimit()) {
605 $template->setVariable(
'SELECTION_LIMIT_HINT', sprintf(
606 $this->lng->txt(
'ass_mc_sel_lim_hint'),
607 $this->
object->getSelectionLimit(),
608 $this->
object->getAnswerCount()
611 $template->setVariable(
'SELECTION_LIMIT_VALUE', $this->object->getSelectionLimit());
613 $template->setVariable(
'SELECTION_LIMIT_VALUE',
'null');
616 $pageoutput = $this->
outQuestionPage(
"", $is_postponed, $active_id, $questionoutput, $show_feedback);
635 $this->tpl->addJavaScript(
'Modules/TestQuestionPool/js/ilAssMultipleChoice.js');
637 $tpl =
new ilTemplate(
'tpl.tst_question_additional_behaviour_checkbox.html',
true,
true,
'Modules/TestQuestionPool');
642 $tpl->setCurrentBlock(
'checked');
643 $tpl->touchBlock(
'checked');
644 $tpl->parseCurrentBlock();
648 $tpl->setCurrentBlock(
'checkbox');
649 $tpl->setVariable(
'TXT_FORCE_FORM_DIFF_LABEL', $this->object->getTestPresentationConfig()->getUseUnchangedAnswerLabel());
650 $tpl->parseCurrentBlock();
657 $tpl->
addJavaScript(
'Modules/TestQuestionPool/js/ilAssMultipleChoice.js');
668 $rbacsystem = $DIC[
'rbacsystem'];
669 $ilTabs = $DIC[
'ilTabs'];
671 $ilTabs->clearTargets();
673 $this->ctrl->setParameterByClass(
"ilAssQuestionPageGUI",
"q_id",
$_GET[
"q_id"]);
674 include_once
"./Modules/TestQuestionPool/classes/class.assQuestion.php";
675 $q_type = $this->
object->getQuestionType();
677 if (strlen($q_type)) {
678 $classname = $q_type .
"GUI";
679 $this->ctrl->setParameterByClass(strtolower($classname),
"sel_question_types", $q_type);
680 $this->ctrl->setParameterByClass(strtolower($classname),
"q_id",
$_GET[
"q_id"]);
684 if ($rbacsystem->checkAccess(
'write',
$_GET[
"ref_id"])) {
688 $this->ctrl->getLinkTargetByClass(
"ilAssQuestionPageGUI",
"edit"),
689 array(
"edit",
"insert",
"exec_pg"),
698 $force_active =
false;
699 if ($rbacsystem->checkAccess(
'write',
$_GET[
"ref_id"])) {
702 $url = $this->ctrl->getLinkTargetByClass($classname,
"editQuestion");
704 $force_active =
false;
709 array(
"editQuestion",
"save",
"saveEdit",
"addchoice",
"removechoice",
"removeimagechoice",
"uploadchoice",
"originalSyncForm"),
729 $this->ctrl->getLinkTargetByClass($classname,
"assessment"),
748 if ($this->object->getShuffle()) {
759 return $this->
object->prepareTextareaOutput(
$output,
true);
764 $this->
object->setShuffle(
$_POST[
"shuffle"]);
766 $selectionLimit = (int) $form->
getItemByPostVar(
'selection_limit')->getValue();
767 $this->
object->setSelectionLimit($selectionLimit > 0 ? $selectionLimit : null);
769 $this->
object->setMultilineAnswerSetting(
$_POST[
"types"]);
770 if (is_array(
$_POST[
'choice'][
'imagename']) &&
$_POST[
"types"] == 1) {
771 $this->
object->isSingleline =
true;
774 $this->
object->isSingleline = (
$_POST[
"types"] == 0) ?
true :
false;
776 $this->
object->setThumbSize((strlen(
$_POST[
"thumb_size"])) ?
$_POST[
"thumb_size"] :
"");
782 $this->
object->flushAnswers();
783 if ($this->object->isSingleline) {
784 foreach (
$_POST[
'choice'][
'answer'] as
$index => $answertext) {
788 $file_org_name = $_FILES[
'choice'][
'name'][
'image'][
$index];
789 $file_temp_name = $_FILES[
'choice'][
'tmp_name'][
'image'][
$index];
791 if (strlen($file_temp_name)) {
793 $suffix = strtolower(array_pop(explode(
".", $file_org_name)));
794 if (in_array($suffix, array(
"jpg",
"jpeg",
"png",
"gif" ))) {
796 $filename = $this->
object->buildHashedImageFilename($file_org_name);
797 if ($this->object->setImageFile(
$filename, $file_temp_name) == 0) {
802 $this->
object->addAnswer(
805 $_POST[
'choice'][
'points_unchecked'][$index],
811 foreach (
$_POST[
'choice'][
'answer'] as
$index => $answer) {
812 $answertext = $answer;
813 $this->
object->addAnswer(
816 $_POST[
'choice'][
'points_unchecked'][$index],
828 $shuffle->setChecked($this->object->getShuffle());
829 $shuffle->setRequired(
false);
832 require_once
'Services/Form/classes/class.ilNumberInputGUI.php';
833 $selLim =
new ilNumberInputGUI($this->lng->txt(
'ass_mc_sel_lim_setting'),
'selection_limit');
834 $selLim->
setInfo($this->lng->txt(
'ass_mc_sel_lim_setting_desc'));
836 $selLim->setRequired(
false);
837 $selLim->allowDecimals(
false);
838 $selLim->setMinvalueShouldBeGreater(
false);
839 $selLim->setMaxvalueShouldBeLess(
false);
840 $selLim->setMinValue(1);
841 $selLim->setMaxValue($this->object->getAnswerCount());
842 $selLim->setValue($this->object->getSelectionLimit());
845 if ($this->object->getId()) {
847 $hidden->setValue($this->object->getId());
853 if (!$this->object->getSelfAssessmentEditingMode()) {
857 $types->setValue(($isSingleline) ? 0 : 1);
860 0 => $this->lng->txt(
'answers_singleline'),
861 1 => $this->lng->txt(
'answers_multiline'),
869 $thumb_size =
new ilNumberInputGUI($this->lng->txt(
"thumb_size"),
"thumb_size");
870 $thumb_size->
setSuffix($this->lng->txt(
"thumb_size_unit_pixel"));
871 $thumb_size->setMinValue(20);
872 $thumb_size->setDecimals(0);
873 $thumb_size->setSize(6);
874 $thumb_size->setInfo($this->lng->txt(
'thumb_size_info'));
875 $thumb_size->setValue($this->object->getThumbSize());
876 $thumb_size->setRequired(
false);
878 return $isSingleline;
880 return $isSingleline;
886 include_once
"./Modules/TestQuestionPool/classes/class.ilMultipleChoiceWizardInputGUI.php";
889 $choices->setQuestionObject($this->
object);
891 $choices->setSingleline($isSingleline);
892 $choices->setAllowMove(
false);
893 if ($this->object->getSelfAssessmentEditingMode()) {
894 $choices->setSize(40);
896 $choices->setMaxLength(800);
897 if ($this->object->getAnswerCount() == 0) {
898 $this->
object->addAnswer(
"", 0, 0, 0);
900 $choices->setValues($this->object->getAnswers());
949 $aggregate = array();
950 foreach ($answers_defined_on_question as $answer) {
951 $aggregated_info_for_answer = array();
952 $aggregated_info_for_answer[
'answertext'] = $answer->getAnswerText();
953 $aggregated_info_for_answer[
'count_checked'] = 0;
955 foreach ($relevant_answers_chosen as $relevant_answer) {
956 if ($relevant_answer[
'value1'] == $answer->getOrder()) {
957 $aggregated_info_for_answer[
'count_checked']++;
960 $aggregated_info_for_answer[
'count_unchecked'] =
961 ceil(count($relevant_answers_chosen) / count($answers_defined_on_question))
962 - $aggregated_info_for_answer[
'count_checked'];
964 $aggregate[] = $aggregated_info_for_answer;
976 $tpl =
new ilTemplate(
'tpl.il_as_aggregated_answers_table.html',
true,
true,
"Modules/TestQuestionPool");
978 $tpl->setCurrentBlock(
'headercell');
979 $tpl->setVariable(
'HEADER', $this->lng->txt(
'tst_answer_aggr_answer_header'));
980 $tpl->parseCurrentBlock();
982 $tpl->setCurrentBlock(
'headercell');
983 $tpl->setVariable(
'HEADER', $this->lng->txt(
'tst_answer_aggr_frequency_header'));
984 $tpl->parseCurrentBlock();
986 foreach ($aggregate as $line_data) {
987 $tpl->setCurrentBlock(
'aggregaterow');
988 $tpl->setVariable(
'OPTION', $line_data[
'answertext']);
989 $tpl->setVariable(
'COUNT', $line_data[
'count_checked']);
990 $tpl->parseCurrentBlock();
1003 if ($this->object->getSpecificFeedbackSetting() == 2) {
1004 foreach ($user_solution as $mc_solution) {
1005 if (strcmp($mc_solution, $answer_id) == 0) {
1006 $fb = $this->
object->feedbackOBJ->getSpecificAnswerFeedbackTestPresentation($this->object->getId(), 0, $answer_id);
1009 $template->setVariable(
"FEEDBACK", $this->object->prepareTextareaOutput($fb,
true));
1016 if ($this->object->getSpecificFeedbackSetting() == 1) {
1017 $fb = $this->
object->feedbackOBJ->getSpecificAnswerFeedbackTestPresentation($this->object->getId(), 0, $answer_id);
1020 $template->setVariable(
"FEEDBACK", $this->object->prepareTextareaOutput($fb,
true));
1025 if ($this->object->getSpecificFeedbackSetting() == 3) {
1026 $answer = $this->
object->getAnswer($answer_id);
1028 if ($answer->getPoints() > 0) {
1029 $fb = $this->
object->feedbackOBJ->getSpecificAnswerFeedbackTestPresentation($this->object->getId(), 0, $answer_id);
1032 $template->setVariable(
"FEEDBACK", $this->object->prepareTextareaOutput($fb,
true));
1048 include_once(
"./Services/Form/classes/class.ilPropertyFormGUI.php");
1050 $form->setFormAction($this->ctrl->getFormAction($this));
1052 $form->setTableWidth(
"100%");
1053 $form->setId(
"assmultiplechoice");
1066 $agg = $this->
aggregateAnswers($relevantAnswers, $this->object->getAnswers());
1070 foreach ($agg as $ans) {
1072 'answer' => $ans[
'answertext'],
1073 'frequency' => $ans[
'count_checked']
1082 require_once
'Modules/TestQuestionPool/classes/forms/class.ilAssMultipleChoiceCorrectionsInputGUI.php';
1085 $choices->setQuestionObject($this->
object);
1086 $choices->setValues($this->object->getAnswers());
1095 $pointsChecked = $form->
getInput(
'choice')[
'points'];
1096 $pointsUnchecked = $form->
getInput(
'choice')[
'points_unchecked'];
1098 foreach ($this->object->getAnswers() as
$index => $answer) {
1100 $answer->setPointsChecked((
float) $pointsChecked[$index]);
1101 $answer->setPointsUnchecked((
float) $pointsUnchecked[$index]);
isTestPresentationContext()
static prepareFormOutput($a_str, $a_strip=false)
prepares string output for html forms public
hasCorrectSolution($activeId, $passIndex)
addTab_QuestionPreview(ilTabsGUI $tabsGUI)
getAnswersFrequency($relevantAnswers, $questionIndex)
addTab_QuestionHints(ilTabsGUI $tabs)
adds the hints tab to ilTabsGUI
setUseEmptySolutionInputChecked($useEmptySolutionInputChecked)
getAfterParticipationSuppressionAnswerPostVars()
Returns a list of postvars which will be suppressed in the form output when used in scoring adjustmen...
getChoiceKeys()
Create the key index numbers for the array of choices.
populateJavascriptFilesRequiredForWorkForm(ilTemplate $tpl)
removechoice()
Remove an answer.
if(!array_key_exists('StateId', $_REQUEST)) $id
getAggregatedAnswersView($relevant_answers)
Returns an html string containing a question specific representation of the answers so far given in t...
saveCorrectionsFormProperties(ilPropertyFormGUI $form)
addBasicQuestionFormProperties($form)
getQuestionTemplate()
get question template
const CSS_CLASS_FEEDBACK_CORRECT
Class for multiple choice tests.
populateTaxonomyFormSection(ilPropertyFormGUI $form)
getUseIntermediateSolution()
Get if intermediate solution should be used for solution output.
removeimagechoice()
Remove an image.
addchoice()
Add a new answer.
editQuestion($checkonly=false)
Creates an output of the edit form for the question.
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
populateCorrectionsFormProperties(ilPropertyFormGUI $form)
populateAnswerSpecificFormPart(\ilPropertyFormGUI $form)
setQuestionTabs()
Sets the ILIAS tabs for this question type.
writeQuestionGenericPostData()
getUseUnchangedAnswerCheckboxHtml()
if(isset($_POST['submit'])) $form
addJavaScript($a_js_file, $a_add_version_parameter=true, $a_batch=2)
Add a javascript file that should be included in the header.
getILIASPage($html="")
Returns the ILIAS Page around a question.
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
writeAnswerSpecificPostData(ilPropertyFormGUI $form)
Extracts the answer specific values from $_POST and applies them to the data object.
populateQuestionSpecificFormPart(\ilPropertyFormGUI $form)
writePostData($always=false)
{}
special template class to simplify handling of ITX/PEAR
getPreview($show_question_only=false, $showInlineFeedback=false)
addTab_QuestionFeedback(ilTabsGUI $tabs)
adds the feedback tab to ilTabsGUI
writeQuestionSpecificPostData(ilPropertyFormGUI $form)
Extracts the question specific values from $_POST and applies them to the data object.
const CSS_CLASS_FEEDBACK_WRONG
Basic GUI class for assessment questions.
static getHtmlPath($relative_path)
get url of path
aggregateAnswers($relevant_answers_chosen, $answers_defined_on_question)
getAfterParticipationSuppressionQuestionPostVars()
Returns a list of postvars which will be suppressed in the form output when used in scoring adjustmen...
getAnswerFeedbackOutput($active_id, $pass)
Returns the answer generic feedback depending on the results of the question.
Multiple choice question GUI representation.
isUseEmptySolutionInputChecked()
getEditAnswersSingleLine($checkonly=false)
Get the single/multiline editing of answers.
__construct($id=-1)
assMultipleChoiceGUI constructor
saveTaxonomyAssignments()
$useEmptySolutionInputChecked
outQuestionPage($a_temp_var, $a_postponed=false, $active_id="", $html="", $inlineFeedbackEnabled=false)
output question page
renderAggregateView($aggregate)
addBackTab(ilTabsGUI $ilTabs)
uploadchoice()
Upload an image.
supportsIntermediateSolutionOutput()
Question type specific support of intermediate solution output The function getSolutionOutput respect...
static secureString($a_str, $a_strip_html=true, $a_allow="")
Remove unsecure tags.
isRenderPurposePrintPdf()
getTestOutput( $active_id, $pass, $is_postponed=false, $use_post_solutions=false, $show_feedback=false)
Interface ilGuiAnswerScoringAdjustable.
Interface ilGuiQuestionScoringAdjustable.
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.
populateSpecificFeedbackInline($user_solution, $answer_id, $template)
getSpecificFeedbackOutput($userSolution)
addTab_SuggestedSolution(ilTabsGUI $tabs, $classname)
addQuestionFormCommandButtons($form)
Add the command buttons of a question properties form.
renderPurposeSupportsFormHtml()