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';
 
   37                parent::__construct();
 
   38                include_once 
"./Modules/TestQuestionPool/classes/class.assMultipleChoice.php";
 
   42                        $this->
object->loadFromDb($id);
 
   51                $hasErrors = (!$always) ? $this->
editQuestion(
true) : 
false;
 
   55                        $form->setValuesByPost();
 
   56                        require_once 
'Services/Form/classes/class.ilPropertyFormGUI.php';
 
   78                        return (
$_POST[
'types'] == 0) ? true : 
false;
 
   81                $lastChange = $this->
object->getLastChange();
 
   82                if (empty($lastChange) && !isset(
$_POST[
'types']))
 
   85                        return $this->
object->getMultilineAnswerSetting() ? false : 
true;
 
   90                        return $this->
object->isSingleline;
 
  111                        $form->setMultipart(TRUE);
 
  115                        $form->setMultipart(FALSE);
 
  122                        $form->getItemByPostVar(
'selection_limit')->setMaxValue(count((array)
$_POST[
'choice'][
'answer']));
 
  124                        $form->setValuesByPost();
 
  125                        $errors = !$form->checkInput();
 
  126                        $form->setValuesByPost(); 
 
  127                        if (
$errors) $checkonly = 
false;
 
  130                if (!$checkonly) $this->tpl->setVariable(
"QUESTION_DATA", $form->getHTML());
 
  136                parent::addBasicQuestionFormProperties($form);
 
  137                $form->getItemByPostVar(
'question')->setInitialRteWidth(
'100');
 
  146                $position = key(
$_POST[
'cmd'][
'uploadchoice']);
 
  156                $position = key(
$_POST[
'cmd'][
'removeimagechoice']);
 
  158                $this->
object->removeAnswerImage($position);
 
  168                $position = key(
$_POST[
'cmd'][
'addchoice']);
 
  169                $this->
object->addAnswer(
"", 0, 0, $position+1);
 
  179                $position = key(
$_POST[
'cmd'][
'removechoice']);
 
  180                $this->
object->deleteAnswer($position);
 
  202                $graphicalOutput = FALSE,
 
  203                $result_output = FALSE,
 
  204                $show_question_only = TRUE,
 
  205                $show_feedback = FALSE,
 
  206                $show_correct_solution = FALSE,
 
  207                $show_manual_scoring = FALSE,
 
  208                $show_question_text = TRUE
 
  215                $user_solution = array();
 
  216                if (($active_id > 0) && (!$show_correct_solution))
 
  218                        $solutions =& $this->
object->getSolutionValues($active_id, 
$pass);
 
  219                        foreach ($solutions as $idx => $solution_value)
 
  221                                array_push($user_solution, $solution_value[
"value1"]);
 
  227                        foreach ($this->object->answers as $index => $answer)
 
  229                                $points_checked = $answer->getPointsChecked();
 
  230                                $points_unchecked = $answer->getPointsUnchecked();
 
  231                                if ($points_checked > $points_unchecked)
 
  233                                        if ($points_checked > 0)
 
  235                                                array_push($user_solution, $index);
 
  242                include_once 
"./Services/UICore/classes/class.ilTemplate.php";
 
  243                $template = 
new ilTemplate(
"tpl.il_as_qpl_mc_mr_output_solution.html", TRUE, TRUE, 
"Modules/TestQuestionPool");
 
  244                $solutiontemplate = 
new ilTemplate(
"tpl.il_as_tst_solution_output.html",TRUE, TRUE, 
"Modules/TestQuestionPool");
 
  245                foreach ($keys as $answer_id)
 
  247                        $answer = $this->
object->answers[$answer_id];
 
  248                        if (($active_id > 0) && (!$show_correct_solution))
 
  250                                if ($graphicalOutput)
 
  255                                        foreach ($user_solution as $mc_solution)
 
  257                                                if (strcmp($mc_solution, $answer_id) == 0)
 
  264                                                if ($answer->getPointsChecked() > $answer->getPointsUnchecked())
 
  275                                                if ($answer->getPointsChecked() > $answer->getPointsUnchecked())
 
  286                                                $template->setCurrentBlock(
"icon_ok");
 
  288                                                $template->setVariable(
"TEXT_OK", $this->lng->txt(
"answer_is_right"));
 
  289                                                $template->parseCurrentBlock();
 
  293                                                $template->setCurrentBlock(
"icon_ok");
 
  295                                                $template->setVariable(
"TEXT_NOT_OK", $this->lng->txt(
"answer_is_wrong"));
 
  296                                                $template->parseCurrentBlock();
 
  300                        if (strlen($answer->getImage()))
 
  302                                $template->setCurrentBlock(
"answer_image");
 
  303                                if ($this->object->getThumbSize())
 
  305                                        $template->setVariable(
"ANSWER_IMAGE_URL", $this->object->getImagePathWeb() . $this->object->getThumbPrefix() . $answer->getImage());
 
  309                                        $template->setVariable(
"ANSWER_IMAGE_URL", $this->object->getImagePathWeb() . $answer->getImage());
 
  311                                $alt = $answer->getImage();
 
  312                                if (strlen($answer->getAnswertext()))
 
  314                                        $alt = $answer->getAnswertext();
 
  316                                $alt = preg_replace(
"/<[^>]*?>/", 
"", $alt);
 
  319                                $template->parseCurrentBlock();
 
  325                                if ($this->object->getSpecificFeedbackSetting() == 2)
 
  327                                        foreach ($user_solution as $mc_solution)
 
  329                                                if (strcmp($mc_solution, $answer_id) == 0)
 
  331                                                        $fb = $this->
object->feedbackOBJ->getSpecificAnswerFeedbackTestPresentation(
 
  332                                                                        $this->object->getId(), $answer_id
 
  336                                                                $template->setCurrentBlock(
"feedback");
 
  337                                                                $template->setVariable(
"FEEDBACK", $this->object->prepareTextareaOutput( $fb, 
true ));
 
  338                                                                $template->parseCurrentBlock();
 
  344                                if ($this->object->getSpecificFeedbackSetting() == 1)
 
  346                                        $fb = $this->
object->feedbackOBJ->getSpecificAnswerFeedbackTestPresentation(
 
  347                                                        $this->object->getId(), $answer_id
 
  351                                                $template->setCurrentBlock(
"feedback");
 
  352                                                $template->setVariable(
"FEEDBACK", $this->object->prepareTextareaOutput( $fb, 
true ));
 
  353                                                $template->parseCurrentBlock();
 
  357                                if ($this->object->getSpecificFeedbackSetting() == 3)
 
  359                                        $answer = $this->
object->getAnswer($answer_id);
 
  361                                        if ($answer->getPoints() > 0)
 
  363                                                $fb = $this->
object->feedbackOBJ->getSpecificAnswerFeedbackTestPresentation(
 
  364                                                                $this->object->getId(), $answer_id
 
  368                                                        $template->setCurrentBlock(
"feedback");
 
  369                                                        $template->setVariable(
"FEEDBACK", $this->object->prepareTextareaOutput( $fb, 
true ));
 
  370                                                        $template->parseCurrentBlock();
 
  376                        $template->setCurrentBlock(
"answer_row");
 
  377                        $template->setVariable(
"ANSWER_TEXT", $this->object->prepareTextareaOutput($answer->getAnswertext(), TRUE));
 
  381                                $pointschecked = $this->
object->answers[$answer_id]->getPointsChecked();
 
  382                                $pointsunchecked = $this->
object->answers[$answer_id]->getPointsUnchecked();
 
  383                                $resulttextchecked = ($pointschecked == 1) || ($pointschecked == -1) ? 
"%s " . $this->lng->txt(
"point") : 
"%s " . $this->lng->txt(
"points");
 
  384                                $resulttextunchecked = ($pointsunchecked == 1) || ($pointsunchecked == -1) ? 
"%s " . $this->lng->txt(
"point") : 
"%s " . $this->lng->txt(
"points"); 
 
  385                                $template->setVariable(
"RESULT_OUTPUT", 
sprintf(
"(" . $this->lng->txt(
"checkbox_checked") . 
" = $resulttextchecked, " . $this->lng->txt(
"checkbox_unchecked") . 
" = $resulttextunchecked)", $pointschecked, $pointsunchecked));
 
  387                        foreach ($user_solution as $mc_solution)
 
  389                                if (strcmp($mc_solution, $answer_id) == 0)
 
  394                                                $template->setVariable(
"SOLUTION_ALT", $this->lng->txt(
"checked"));
 
  398                                                $template->setVariable(
'QID', $this->object->getId());
 
  399                                                $template->setVariable(
'SUFFIX', $show_correct_solution ? 
'bestsolution' : 
'usersolution');
 
  400                                                $template->setVariable(
'SOLUTION_VALUE', $answer_id);
 
  401                                                $template->setVariable(
'SOLUTION_CHECKED', 
'checked');
 
  411                                        $template->setVariable(
"SOLUTION_ALT", $this->lng->txt(
"unchecked"));
 
  415                                        $template->setVariable(
'QID', $this->object->getId());
 
  416                                        $template->setVariable(
'SUFFIX', $show_correct_solution ? 
'bestsolution' : 
'usersolution');
 
  417                                        $template->setVariable(
'SOLUTION_VALUE', $answer_id);
 
  420                        $template->parseCurrentBlock();
 
  422                $questiontext = $this->
object->getQuestion();
 
  423                if ($show_question_text==
true)
 
  425                        $template->setVariable(
"QUESTIONTEXT", $this->object->prepareTextareaOutput($questiontext, TRUE));
 
  427                $questionoutput = $template->get();
 
  430                if (strlen($feedback))
 
  436                        $solutiontemplate->setVariable(
"ILC_FB_CSS_CLASS", $cssClass);
 
  437                        $solutiontemplate->setVariable(
"FEEDBACK", $this->object->prepareTextareaOutput( $feedback , 
true ));
 
  439                $solutiontemplate->setVariable(
"SOLUTION_OUTPUT", $questionoutput);
 
  441                $solutionoutput = $solutiontemplate->get(); 
 
  442                if (!$show_question_only)
 
  447                return $solutionoutput;
 
  450        function getPreview($show_question_only = FALSE, $showInlineFeedback = 
false)
 
  457                include_once 
"./Services/UICore/classes/class.ilTemplate.php";
 
  458                $template = 
new ilTemplate(
"tpl.il_as_qpl_mc_mr_output.html", TRUE, TRUE, 
"Modules/TestQuestionPool");
 
  459                foreach ($keys as $answer_id)
 
  461                        $answer = $this->
object->answers[$answer_id];
 
  462                        if (strlen($answer->getImage()))
 
  464                                if ($this->object->getThumbSize())
 
  466                                        $template->setCurrentBlock(
"preview");
 
  467                                        $template->setVariable(
"URL_PREVIEW", $this->object->getImagePathWeb() . $answer->getImage());
 
  468                                        $template->setVariable(
"TEXT_PREVIEW", $this->lng->txt(
'preview'));
 
  470                                        $template->setVariable(
"ANSWER_IMAGE_URL", $this->object->getImagePathWeb() . $this->object->getThumbPrefix() . $answer->getImage());
 
  471                                        list($width, $height, $type, $attr) = getimagesize($this->object->getImagePath() . $answer->getImage());
 
  472                                        $alt = $answer->getImage();
 
  473                                        if (strlen($answer->getAnswertext()))
 
  475                                                $alt = $answer->getAnswertext();
 
  477                                        $alt = preg_replace(
"/<[^>]*?>/", 
"", $alt);
 
  480                                        $template->parseCurrentBlock();
 
  484                                        $template->setCurrentBlock(
"answer_image");
 
  485                                        $template->setVariable(
"ANSWER_IMAGE_URL", $this->object->getImagePathWeb() . $answer->getImage());
 
  486                                        list($width, $height, $type, $attr) = getimagesize($this->object->getImagePath() . $answer->getImage());
 
  487                                        $alt = $answer->getImage();
 
  488                                        if (strlen($answer->getAnswertext()))
 
  490                                                $alt = $answer->getAnswertext();
 
  492                                        $alt = preg_replace(
"/<[^>]*?>/", 
"", $alt);
 
  493                                        $template->setVariable(
"ATTR", $attr);
 
  496                                        $template->parseCurrentBlock();
 
  500                        if( $showInlineFeedback )
 
  505                        $template->setCurrentBlock(
"answer_row");
 
  506                        $template->setVariable(
"QID", $this->object->getId());
 
  507                        $template->setVariable(
"ANSWER_ID", $answer_id);
 
  508                        $template->setVariable(
"ANSWER_TEXT", $this->object->prepareTextareaOutput($answer->getAnswertext(), TRUE));
 
  509                        foreach ($user_solution as $mc_solution)
 
  511                                if (strcmp($mc_solution, $answer_id) == 0)
 
  513                                        $template->setVariable(
"CHECKED_ANSWER", 
" checked=\"checked\"");
 
  516                        $template->parseCurrentBlock();
 
  518                if($this->object->getSelectionLimit())
 
  520                        $template->setVariable(
'SELECTION_LIMIT_HINT', 
sprintf(
 
  521                                $this->lng->txt(
'ass_mc_sel_lim_hint'),
 
  522                                $this->object->getSelectionLimit(),
 
  523                                $this->object->getAnswerCount()
 
  526                        $template->setVariable(
'SELECTION_LIMIT_VALUE', $this->object->getSelectionLimit());
 
  530                        $template->setVariable(
'SELECTION_LIMIT_VALUE', 
'null');
 
  532                $template->setVariable(
"QUESTION_ID", $this->object->getId());
 
  533                $questiontext = $this->
object->getQuestion();
 
  534                $template->setVariable(
"QUESTIONTEXT", $this->object->prepareTextareaOutput($questiontext, TRUE));
 
  535                $questionoutput = $template->get();
 
  536                if (!$show_question_only)
 
  541                return $questionoutput;
 
  558                $is_postponed = FALSE, 
 
  559                $use_post_solutions = FALSE, 
 
  560                $show_feedback = FALSE
 
  567                $user_solution = array();
 
  572                        #include_once "./Modules/Test/classes/class.ilObjTest.php";
 
  573                        #if (!ilObjTest::_getUsePreviousAnswers($active_id, true)) 
  575                        #       if (is_null($pass)) $pass = ilObjTest::_getPass($active_id); 
  577                        $solutions = $this->
object->getTestOutputSolutions($active_id, 
$pass);
 
  579                        foreach ($solutions as $idx => $solution_value)
 
  582                                if ( $solution_value[
"value1"] != 
'mc_none_above')
 
  584                                        array_push($user_solution, $solution_value[
"value1"]);
 
  590                include_once 
"./Services/UICore/classes/class.ilTemplate.php";
 
  591                $template = 
new ilTemplate(
"tpl.il_as_qpl_mc_mr_output.html", TRUE, TRUE, 
"Modules/TestQuestionPool");
 
  592                foreach ($keys as $answer_id)
 
  594                        $answer = $this->
object->answers[$answer_id];
 
  595                        if (strlen($answer->getImage()))
 
  597                                if ($this->object->getThumbSize())
 
  599                                        $template->setCurrentBlock(
"preview");
 
  600                                        $template->setVariable(
"URL_PREVIEW", $this->object->getImagePathWeb() . $answer->getImage());
 
  601                                        $template->setVariable(
"TEXT_PREVIEW", $this->lng->txt(
'preview'));
 
  603                                        $template->setVariable(
"ANSWER_IMAGE_URL", $this->object->getImagePathWeb() . $this->object->getThumbPrefix() . $answer->getImage());
 
  604                                        list($width, $height, $type, $attr) = getimagesize($this->object->getImagePath() . $answer->getImage());
 
  605                                        $alt = $answer->getImage();
 
  606                                        if (strlen($answer->getAnswertext()))
 
  608                                                $alt = $answer->getAnswertext();
 
  610                                        $alt = preg_replace(
"/<[^>]*?>/", 
"", $alt);
 
  613                                        $template->parseCurrentBlock();
 
  617                                        $template->setCurrentBlock(
"answer_image");
 
  618                                        $template->setVariable(
"ANSWER_IMAGE_URL", $this->object->getImagePathWeb() . $answer->getImage());
 
  619                                        list($width, $height, $type, $attr) = getimagesize($this->object->getImagePath() . $answer->getImage());
 
  620                                        $alt = $answer->getImage();
 
  621                                        if (strlen($answer->getAnswertext()))
 
  623                                                $alt = $answer->getAnswertext();
 
  625                                        $alt = preg_replace(
"/<[^>]*?>/", 
"", $alt);
 
  626                                        $template->setVariable(
"ATTR", $attr);
 
  629                                        $template->parseCurrentBlock();
 
  638                        $template->setCurrentBlock(
"answer_row");
 
  639                        $template->setVariable(
"QID", $this->object->getId());
 
  640                        $template->setVariable(
"ANSWER_ID", $answer_id);
 
  641                        $template->setVariable(
"ANSWER_TEXT", $this->object->prepareTextareaOutput($answer->getAnswertext(), TRUE));
 
  642                        foreach ($user_solution as $mc_solution)
 
  644                                if (strcmp($mc_solution, $answer_id) == 0)
 
  646                                        $template->setVariable(
"CHECKED_ANSWER", 
" checked=\"checked\"");
 
  649                        $template->parseCurrentBlock();
 
  653                if ($this->withNoneAbove)
 
  655                        $this->tpl->addJavaScript(
'Modules/TestQuestionPool/js/ilAssMultipleChoice.js');
 
  656                        $template->setCurrentBlock(
'none_above');
 
  657                        $template->setVariable(
'LABEL_NONE_ABOVE', $this->lng->txt(
'tst_mc_label_none_above'));
 
  658                        if ($this->isAnswered && empty($user_solution))
 
  660                                $template->setVariable(
'CHECKED_NONE_ABOVE', 
" checked=\"checked\"");
 
  662                        $template->parseCurrentBlock();
 
  666                $questiontext = $this->
object->getQuestion();
 
  667                $template->setVariable(
"QUESTIONTEXT", $this->object->prepareTextareaOutput($questiontext, TRUE));
 
  668                $template->setVariable(
"QUESTION_ID", $this->object->getId());
 
  669                if($this->object->getSelectionLimit())
 
  671                        $template->setVariable(
'SELECTION_LIMIT_HINT', 
sprintf(
 
  672                                $this->lng->txt(
'ass_mc_sel_lim_hint'),
 
  673                                $this->object->getSelectionLimit(),
 
  674                                $this->object->getAnswerCount()
 
  677                        $template->setVariable(
'SELECTION_LIMIT_VALUE', $this->object->getSelectionLimit());
 
  681                        $template->setVariable(
'SELECTION_LIMIT_VALUE', 
'null');
 
  683                $questionoutput = $template->get();
 
  684                $pageoutput = $this->
outQuestionPage(
"", $is_postponed, $active_id, $questionoutput);
 
  690                $tpl->addJavaScript(
'Modules/TestQuestionPool/js/ilAssMultipleChoice.js');
 
  700                global $rbacsystem, $ilTabs;
 
  702                $ilTabs->clearTargets();
 
  704                $this->ctrl->setParameterByClass(
"ilAssQuestionPageGUI", 
"q_id", 
$_GET[
"q_id"]);
 
  705                include_once 
"./Modules/TestQuestionPool/classes/class.assQuestion.php";
 
  706                $q_type = $this->
object->getQuestionType();
 
  710                        $classname = $q_type . 
"GUI";
 
  711                        $this->ctrl->setParameterByClass(strtolower($classname), 
"sel_question_types", $q_type);
 
  712                        $this->ctrl->setParameterByClass(strtolower($classname), 
"q_id", 
$_GET[
"q_id"]);
 
  717                        if ($rbacsystem->checkAccess(
'write', 
$_GET[
"ref_id"]))
 
  720                                $ilTabs->addTarget(
"edit_page",
 
  721                                        $this->ctrl->getLinkTargetByClass(
"ilAssQuestionPageGUI", 
"edit"),
 
  722                                        array(
"edit", 
"insert", 
"exec_pg"),
 
  723                                        "", 
"", $force_active);
 
  728                $force_active = 
false;
 
  729                if ($rbacsystem->checkAccess(
'write', 
$_GET[
"ref_id"]))
 
  732                        if ($classname) 
$url = $this->ctrl->getLinkTargetByClass($classname, 
"editQuestion");
 
  733                        $force_active = 
false;
 
  735                        $ilTabs->addTarget(
"edit_question",
 
  737                                array(
"editQuestion", 
"save", 
"saveEdit", 
"addchoice", 
"removechoice", 
"removeimagechoice", 
"uploadchoice", 
"originalSyncForm"),
 
  738                                $classname, 
"", $force_active);
 
  753                        $ilTabs->addTarget(
"statistics",
 
  754                                $this->ctrl->getLinkTargetByClass($classname, 
"assessment"),
 
  771                if( $this->object->getShuffle() )
 
  773                        $choiceKeys = $this->
object->getShuffler()->shuffle($choiceKeys);
 
  783                return $this->
object->prepareTextareaOutput(
$output, TRUE);
 
  788                $this->
object->setShuffle( 
$_POST[
"shuffle"] );
 
  790                $selectionLimit = (int)$form->
getItemByPostVar(
'selection_limit')->getValue();
 
  791                $this->
object->setSelectionLimit($selectionLimit > 0 ? $selectionLimit : 
null);
 
  793                $this->
object->setMultilineAnswerSetting( 
$_POST[
"types"] );
 
  794                if (is_array( 
$_POST[
'choice'][
'imagename'] ) && 
$_POST[
"types"] == 1)
 
  796                        $this->
object->isSingleline = 
true;
 
  801                        $this->
object->isSingleline = (
$_POST[
"types"] == 0) ? 
true : 
false;
 
  803                $this->
object->setThumbSize( (strlen( 
$_POST[
"thumb_size"] )) ? 
$_POST[
"thumb_size"] : 
"" );
 
  809                $this->
object->flushAnswers();
 
  810                if ($this->object->isSingleline)
 
  812                        foreach (
$_POST[
'choice'][
'answer'] as $index => $answertext)
 
  816                                $picturefile    = 
$_POST[
'choice'][
'imagename'][$index];
 
  817                                $file_org_name  = $_FILES[
'choice'][
'name'][
'image'][$index];
 
  818                                $file_temp_name = $_FILES[
'choice'][
'tmp_name'][
'image'][$index];
 
  820                                if (strlen( $file_temp_name ))
 
  823                                        $suffix = strtolower( array_pop( explode( 
".", $file_org_name ) ) );
 
  824                                        if (in_array( $suffix, array( 
"jpg", 
"jpeg", 
"png", 
"gif" ) ))
 
  827                                                $filename = $this->
object->buildHashedImageFilename( $file_org_name );
 
  828                                                if ($this->object->setImageFile( 
$filename, $file_temp_name ) == 0)
 
  834                                $this->
object->addAnswer( $answertext,
 
  835                                                                                  $_POST[
'choice'][
'points'][$index],
 
  836                                                                                  $_POST[
'choice'][
'points_unchecked'][$index],
 
  844                        foreach (
$_POST[
'choice'][
'answer'] as $index => $answer)
 
  846                                $answertext = $answer;
 
  847                                $this->
object->addAnswer( $answertext,
 
  848                                                                                  $_POST[
'choice'][
'points'][$index],
 
  849                                                                                  $_POST[
'choice'][
'points_unchecked'][$index],
 
  860                $shuffle->setValue( 1 );
 
  861                $shuffle->setChecked( $this->object->getShuffle() );
 
  862                $shuffle->setRequired( FALSE );
 
  865                require_once 
'Services/Form/classes/class.ilNumberInputGUI.php';
 
  866                $selLim = 
new ilNumberInputGUI($this->lng->txt(
'ass_mc_sel_lim_setting'), 
'selection_limit');
 
  867                $selLim->setInfo($this->lng->txt(
'ass_mc_sel_lim_setting_desc'));
 
  869                $selLim->setRequired(
false);
 
  870                $selLim->allowDecimals(
false);
 
  871                $selLim->setMinvalueShouldBeGreater(
false);
 
  872                $selLim->setMaxvalueShouldBeLess(
false);
 
  873                $selLim->setMinValue(1);
 
  874                $selLim->setMaxValue($this->object->getAnswerCount());
 
  875                $selLim->setValue($this->object->getSelectionLimit());
 
  878                if ($this->object->getId())
 
  881                        $hidden->setValue( $this->object->getId() );
 
  887                if (!$this->object->getSelfAssessmentEditingMode())
 
  891                        $types->setRequired( 
false );
 
  892                        $types->setValue( ($isSingleline) ? 0 : 1 );
 
  893                        $types->setOptions( array(
 
  894                                                                        0 => $this->lng->txt( 
'answers_singleline' ),
 
  895                                                                        1 => $this->lng->txt( 
'answers_multiline' ),
 
  904                        $thumb_size = 
new ilNumberInputGUI($this->lng->txt( 
"thumb_size" ), 
"thumb_size");
 
  905                        $thumb_size->setSuffix($this->lng->txt(
"thumb_size_unit_pixel"));
 
  906                        $thumb_size->setMinValue( 20 );
 
  907                        $thumb_size->setDecimals( 0 );
 
  908                        $thumb_size->setSize( 6 );
 
  909                        $thumb_size->setInfo( $this->lng->txt( 
'thumb_size_info' ) );
 
  910                        $thumb_size->setValue( $this->object->getThumbSize() );
 
  911                        $thumb_size->setRequired( 
false );
 
  913                        return $isSingleline;
 
  915                return $isSingleline;
 
  921                include_once 
"./Modules/TestQuestionPool/classes/class.ilMultipleChoiceWizardInputGUI.php";
 
  923                $choices->setRequired( 
true );
 
  924                $choices->setQuestionObject( $this->
object );
 
  926                $choices->setSingleline( $isSingleline );
 
  927                $choices->setAllowMove( 
false );
 
  928                if ($this->object->getSelfAssessmentEditingMode())
 
  930                        $choices->setSize( 40 );
 
  932                $choices->setMaxLength( 800 );
 
  933                if ($this->object->getAnswerCount() == 0)
 
  934                        $this->
object->addAnswer( 
"", 0, 0, 0 );
 
  935                $choices->setValues( $this->object->getAnswers() );
 
  978                        $this->
aggregateAnswers( $relevant_answers, $this->object->getAnswers() ) )->get();
 
  983                $aggregate = array();
 
  984                foreach ($answers_defined_on_question as $answer)
 
  986                        $aggregated_info_for_answer                                     = array();
 
  987                        $aggregated_info_for_answer[
'answertext']               = $answer->getAnswerText();
 
  988                        $aggregated_info_for_answer[
'count_checked']    = 0;
 
  990                        foreach ($relevant_answers_chosen as $relevant_answer)
 
  992                                if ($relevant_answer[
'value1'] == $answer->getOrder())
 
  994                                        $aggregated_info_for_answer[
'count_checked']++;
 
  997                        $aggregated_info_for_answer[
'count_unchecked'] = 
 
  998                                ceil(count($relevant_answers_chosen) / count($answers_defined_on_question))
 
  999                                - $aggregated_info_for_answer[
'count_checked'];
 
 1001                        $aggregate[] = $aggregated_info_for_answer;
 
 1013                $tpl = 
new ilTemplate(
'tpl.il_as_aggregated_answers_table.html', 
true, 
true, 
"Modules/TestQuestionPool");
 
 1015                $tpl->setCurrentBlock(
'headercell');
 
 1016                $tpl->setVariable(
'HEADER', $this->lng->txt(
'tst_answer_aggr_answer_header'));
 
 1017                $tpl->parseCurrentBlock();
 
 1019                $tpl->setCurrentBlock(
'headercell');
 
 1020                $tpl->setVariable(
'HEADER', $this->lng->txt(
'tst_answer_aggr_frequency_header'));
 
 1021                $tpl->parseCurrentBlock();
 
 1023                foreach ($aggregate as $line_data)
 
 1025                        $tpl->setCurrentBlock( 
'aggregaterow' );
 
 1026                        $tpl->setVariable( 
'OPTION', $line_data[
'answertext'] );
 
 1027                        $tpl->setVariable( 
'COUNT', $line_data[
'count_checked'] );
 
 1028                        $tpl->parseCurrentBlock();
 
 1041                if($this->object->getSpecificFeedbackSetting() == 2)
 
 1043                        foreach($user_solution as $mc_solution)
 
 1045                                if(strcmp($mc_solution, $answer_id) == 0)
 
 1047                                        $fb = $this->
object->feedbackOBJ->getSpecificAnswerFeedbackTestPresentation($this->object->getId(), $answer_id);
 
 1050                                                $template->setCurrentBlock(
"feedback");
 
 1051                                                $template->setVariable(
"FEEDBACK", $this->object->prepareTextareaOutput($fb, 
true));
 
 1052                                                $template->parseCurrentBlock();
 
 1058                if($this->object->getSpecificFeedbackSetting() == 1)
 
 1060                        $fb = $this->
object->feedbackOBJ->getSpecificAnswerFeedbackTestPresentation($this->object->getId(), $answer_id);
 
 1063                                $template->setCurrentBlock(
"feedback");
 
 1064                                $template->setVariable(
"FEEDBACK", $this->object->prepareTextareaOutput($fb, 
true));
 
 1065                                $template->parseCurrentBlock();
 
 1069                if($this->object->getSpecificFeedbackSetting() == 3)
 
 1071                        $answer = $this->
object->getAnswer($answer_id);
 
 1073                        if($answer->getPoints() > 0)
 
 1075                                $fb = $this->
object->feedbackOBJ->getSpecificAnswerFeedbackTestPresentation($this->object->getId(), $answer_id);
 
 1078                                        $template->setCurrentBlock(
"feedback");
 
 1079                                        $template->setVariable(
"FEEDBACK", $this->object->prepareTextareaOutput($fb, 
true));
 
 1080                                        $template->parseCurrentBlock();
 
 1094                $this->withNoneAbove = (bool) $a_with_none_above;
 
 1103                $this->isAnswered = (bool) $a_is_answered;
 
 1112                include_once(
"./Services/Form/classes/class.ilPropertyFormGUI.php");
 
 1114                $form->setFormAction($this->ctrl->getFormAction($this));
 
 1116                $form->setTableWidth(
"100%");
 
 1117                $form->setId(
"assmultiplechoice");
 
sprintf('%.4f', $callTime)
An exception for terminatinating execution or to throw for unit testing.
Multiple choice question GUI representation.
setIsAnswered($a_is_answered)
Show the question as answered in a test run.
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...
addBasicQuestionFormProperties($form)
Add basic question form properties: assessment: title, author, description, question,...
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)
populateSpecificFeedbackInline($user_solution, $answer_id, $template)
removeimagechoice()
Remove an image.
editQuestion($checkonly=FALSE)
Creates an output of the edit form for the question.
writeAnswerSpecificPostData(ilPropertyFormGUI $form)
Extracts the answer specific values from $_POST and applies them to the data object.
populateQuestionSpecificFormPart(\ilPropertyFormGUI $form)
addchoice()
Add a new answer.
renderAggregateView($aggregate)
getEditAnswersSingleLine($checkonly=false)
Get the single/multiline editing of answers.
populateJavascriptFilesRequiredForWorkForm(ilTemplate $tpl)
__construct($id=-1)
assMultipleChoiceGUI constructor
getSpecificFeedbackOutput($active_id, $pass)
Returns the answer specific feedback for the question.
getPreview($show_question_only=FALSE, $showInlineFeedback=false)
populateAnswerSpecificFormPart(\ilPropertyFormGUI $form)
getTestOutput( $active_id, $pass, $is_postponed=FALSE, $use_post_solutions=FALSE, $show_feedback=FALSE)
setQuestionTabs()
Sets the ILIAS tabs for this question type.
setWithNoneAbove($a_with_none_above)
Enable the 'None above' addition in a test run.
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...
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.
Class for multiple choice tests.
Basic GUI class for assessment questions.
populateTaxonomyFormSection(ilPropertyFormGUI $form)
addTab_QuestionHints(ilTabsGUI $tabs)
adds the hints tab to ilTabsGUI
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
addTab_SuggestedSolution(ilTabsGUI $tabs, $classname)
renderPurposeSupportsFormHtml()
saveTaxonomyAssignments()
outQuestionPage($a_temp_var, $a_postponed=false, $active_id="", $html="")
output question page
addBackTab(ilTabsGUI $ilTabs)
isTestPresentationContext()
hasCorrectSolution($activeId, $passIndex)
addTab_QuestionFeedback(ilTabsGUI $tabs)
adds the feedback tab to ilTabsGUI
addTab_QuestionPreview(ilTabsGUI $tabsGUI)
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
if(!is_dir( $entity_dir)) exit("Fatal Error ([A-Za-z0-9]+)\s+" &#(? foreach( $entity_files as $file) $output
Interface ilGuiAnswerScoringAdjustable.
Interface ilGuiQuestionScoringAdjustable.