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";
 
   41            $this->
object->loadFromDb(
$id);
 
   50        $hasErrors = (!$always) ? $this->
editQuestion(
true) : 
false;
 
   53            $form->setValuesByPost();
 
   54            require_once 
'Services/Form/classes/class.ilPropertyFormGUI.php';
 
   75            return (
$_POST[
'types'] == 0) ? true : 
false;
 
   78        $lastChange = $this->
object->getLastChange();
 
   79        if (empty($lastChange) && !isset(
$_POST[
'types'])) {
 
   81            return $this->
object->getMultilineAnswerSetting() ? false : 
true;
 
   84            return $this->
object->isSingleline;
 
  104            $form->setMultipart(
true);
 
  106            $form->setMultipart(
false);
 
  112            $form->getItemByPostVar(
'selection_limit')->setMaxValue(count((array) 
$_POST[
'choice'][
'answer']));
 
  114            $form->setValuesByPost();
 
  116            $form->setValuesByPost(); 
 
  123            $this->tpl->setVariable(
"QUESTION_DATA", 
$form->getHTML());
 
  130        parent::addBasicQuestionFormProperties(
$form);
 
  131        $form->getItemByPostVar(
'question')->setInitialRteWidth(
'100');
 
  140        $position = key(
$_POST[
'cmd'][
'uploadchoice']);
 
  150        $position = key(
$_POST[
'cmd'][
'removeimagechoice']);
 
  152        $this->
object->removeAnswerImage($position);
 
  162        $position = key(
$_POST[
'cmd'][
'addchoice']);
 
  163        $this->
object->addAnswer(
"", 0, 0, $position+1);
 
  173        $position = key(
$_POST[
'cmd'][
'removechoice']);
 
  174        $this->
object->deleteAnswer($position);
 
  196        $graphicalOutput = 
false,
 
  197        $result_output = 
false,
 
  198        $show_question_only = 
true,
 
  199        $show_feedback = 
false,
 
  200        $show_correct_solution = 
false,
 
  201        $show_manual_scoring = 
false,
 
  202        $show_question_text = 
true 
  208        $user_solution = array();
 
  209        if (($active_id > 0) && (!$show_correct_solution)) {
 
  210            $solutions =&$this->
object->getSolutionValues($active_id, 
$pass);
 
  211            foreach ($solutions as $idx => $solution_value) {
 
  212                array_push($user_solution, $solution_value[
"value1"]);
 
  216            foreach ($this->object->answers as 
$index => $answer) {
 
  217                $points_checked = $answer->getPointsChecked();
 
  218                $points_unchecked = $answer->getPointsUnchecked();
 
  219                if ($points_checked > $points_unchecked) {
 
  220                    if ($points_checked > 0) {
 
  221                        array_push($user_solution, 
$index);
 
  228        include_once 
"./Services/UICore/classes/class.ilTemplate.php";
 
  229        $template = 
new ilTemplate(
"tpl.il_as_qpl_mc_mr_output_solution.html", 
true, 
true, 
"Modules/TestQuestionPool");
 
  230        $solutiontemplate = 
new ilTemplate(
"tpl.il_as_tst_solution_output.html", 
true, 
true, 
"Modules/TestQuestionPool");
 
  231        foreach (
$keys as $answer_id) {
 
  232            $answer = $this->
object->answers[$answer_id];
 
  233            if (($active_id > 0) && (!$show_correct_solution)) {
 
  234                if ($graphicalOutput) {
 
  238                    foreach ($user_solution as $mc_solution) {
 
  239                        if (strcmp($mc_solution, $answer_id) == 0) {
 
  244                        if ($answer->getPointsChecked() > $answer->getPointsUnchecked()) {
 
  250                        if ($answer->getPointsChecked() > $answer->getPointsUnchecked()) {
 
  259                        $template->setVariable(
"TEXT_OK", $this->lng->txt(
"answer_is_right"));
 
  264                        $template->setVariable(
"TEXT_NOT_OK", $this->lng->txt(
"answer_is_wrong"));
 
  269            if (strlen($answer->getImage())) {
 
  270                $template->setCurrentBlock(
"answer_image");
 
  271                if ($this->object->getThumbSize()) {
 
  272                    $template->setVariable(
"ANSWER_IMAGE_URL", $this->object->getImagePathWeb() . $this->object->getThumbPrefix() . $answer->getImage());
 
  274                    $template->setVariable(
"ANSWER_IMAGE_URL", $this->object->getImagePathWeb() . $answer->getImage());
 
  276                $alt = $answer->getImage();
 
  277                if (strlen($answer->getAnswertext())) {
 
  278                    $alt = $answer->getAnswertext();
 
  280                $alt = preg_replace(
"/<[^>]*?>/", 
"", $alt);
 
  286            if ($show_feedback) {
 
  287                if ($this->object->getSpecificFeedbackSetting() == 2) {
 
  288                    foreach ($user_solution as $mc_solution) {
 
  289                        if (strcmp($mc_solution, $answer_id) == 0) {
 
  290                            $fb = $this->
object->feedbackOBJ->getSpecificAnswerFeedbackTestPresentation(
 
  291                                $this->object->getId(),
 
  296                                $template->setVariable(
"FEEDBACK", $this->object->prepareTextareaOutput($fb, 
true));
 
  303                if ($this->object->getSpecificFeedbackSetting() == 1) {
 
  304                    $fb = $this->
object->feedbackOBJ->getSpecificAnswerFeedbackTestPresentation(
 
  305                        $this->object->getId(),
 
  310                        $template->setVariable(
"FEEDBACK", $this->object->prepareTextareaOutput($fb, 
true));
 
  315                if ($this->object->getSpecificFeedbackSetting() == 3) {
 
  316                    $answer = $this->
object->getAnswer($answer_id);
 
  318                    if ($answer->getPoints() > 0) {
 
  319                        $fb = $this->
object->feedbackOBJ->getSpecificAnswerFeedbackTestPresentation(
 
  320                            $this->object->getId(),
 
  325                            $template->setVariable(
"FEEDBACK", $this->object->prepareTextareaOutput($fb, 
true));
 
  331            $template->setCurrentBlock(
"answer_row");
 
  332            $template->setVariable(
"ANSWER_TEXT", $this->object->prepareTextareaOutput($answer->getAnswertext(), 
true));
 
  334            if ($result_output) {
 
  335                $pointschecked = $this->
object->answers[$answer_id]->getPointsChecked();
 
  336                $pointsunchecked = $this->
object->answers[$answer_id]->getPointsUnchecked();
 
  337                $resulttextchecked = ($pointschecked == 1) || ($pointschecked == -1) ? 
"%s " . $this->lng->txt(
"point") : 
"%s " . $this->lng->txt(
"points");
 
  338                $resulttextunchecked = ($pointsunchecked == 1) || ($pointsunchecked == -1) ? 
"%s " . $this->lng->txt(
"point") : 
"%s " . $this->lng->txt(
"points");
 
  339                $template->setVariable(
"RESULT_OUTPUT", 
sprintf(
"(" . $this->lng->txt(
"checkbox_checked") . 
" = $resulttextchecked, " . $this->lng->txt(
"checkbox_unchecked") . 
" = $resulttextunchecked)", $pointschecked, $pointsunchecked));
 
  341            foreach ($user_solution as $mc_solution) {
 
  342                if (strcmp($mc_solution, $answer_id) == 0) {
 
  345                        $template->setVariable(
"SOLUTION_ALT", $this->lng->txt(
"checked"));
 
  347                        $template->setVariable(
'QID', $this->object->getId());
 
  348                        $template->setVariable(
'SUFFIX', $show_correct_solution ? 
'bestsolution' : 
'usersolution');
 
  349                        $template->setVariable(
'SOLUTION_VALUE', $answer_id);
 
  350                        $template->setVariable(
'SOLUTION_CHECKED', 
'checked');
 
  358                    $template->setVariable(
"SOLUTION_ALT", $this->lng->txt(
"unchecked"));
 
  360                    $template->setVariable(
'QID', $this->object->getId());
 
  361                    $template->setVariable(
'SUFFIX', $show_correct_solution ? 
'bestsolution' : 
'usersolution');
 
  362                    $template->setVariable(
'SOLUTION_VALUE', $answer_id);
 
  367        $questiontext = $this->
object->getQuestion();
 
  368        if ($show_question_text==
true) {
 
  369            $template->setVariable(
"QUESTIONTEXT", $this->object->prepareTextareaOutput($questiontext, 
true));
 
  374        if (strlen($feedback)) {
 
  380            $solutiontemplate->setVariable(
"ILC_FB_CSS_CLASS", $cssClass);
 
  381            $solutiontemplate->setVariable(
"FEEDBACK", $this->object->prepareTextareaOutput($feedback, 
true));
 
  383        $solutiontemplate->setVariable(
"SOLUTION_OUTPUT", $questionoutput);
 
  385        $solutionoutput = $solutiontemplate->get();
 
  386        if (!$show_question_only) {
 
  390        return $solutionoutput;
 
  393    public function getPreview($show_question_only = 
false, $showInlineFeedback = 
false)
 
  400        include_once 
"./Services/UICore/classes/class.ilTemplate.php";
 
  401        $template = 
new ilTemplate(
"tpl.il_as_qpl_mc_mr_output.html", 
true, 
true, 
"Modules/TestQuestionPool");
 
  402        foreach (
$keys as $answer_id) {
 
  403            $answer = $this->
object->answers[$answer_id];
 
  404            if (strlen($answer->getImage())) {
 
  405                if ($this->object->getThumbSize()) {
 
  407                    $template->setVariable(
"URL_PREVIEW", $this->object->getImagePathWeb() . $answer->getImage());
 
  408                    $template->setVariable(
"TEXT_PREVIEW", $this->lng->txt(
'preview'));
 
  410                    $template->setVariable(
"ANSWER_IMAGE_URL", $this->object->getImagePathWeb() . $this->object->getThumbPrefix() . $answer->getImage());
 
  411                    list($width, $height, 
$type, $attr) = getimagesize($this->object->getImagePath() . $answer->getImage());
 
  412                    $alt = $answer->getImage();
 
  413                    if (strlen($answer->getAnswertext())) {
 
  414                        $alt = $answer->getAnswertext();
 
  416                    $alt = preg_replace(
"/<[^>]*?>/", 
"", $alt);
 
  421                    $template->setCurrentBlock(
"answer_image");
 
  422                    $template->setVariable(
"ANSWER_IMAGE_URL", $this->object->getImagePathWeb() . $answer->getImage());
 
  423                    list($width, $height, 
$type, $attr) = getimagesize($this->object->getImagePath() . $answer->getImage());
 
  424                    $alt = $answer->getImage();
 
  425                    if (strlen($answer->getAnswertext())) {
 
  426                        $alt = $answer->getAnswertext();
 
  428                    $alt = preg_replace(
"/<[^>]*?>/", 
"", $alt);
 
  436            if ($showInlineFeedback) {
 
  440            $template->setCurrentBlock(
"answer_row");
 
  441            $template->setVariable(
"QID", $this->object->getId());
 
  442            $template->setVariable(
"ANSWER_ID", $answer_id);
 
  443            $template->setVariable(
"ANSWER_TEXT", $this->object->prepareTextareaOutput($answer->getAnswertext(), 
true));
 
  444            foreach ($user_solution as $mc_solution) {
 
  445                if (strcmp($mc_solution, $answer_id) == 0) {
 
  446                    $template->setVariable(
"CHECKED_ANSWER", 
" checked=\"checked\"");
 
  451        if ($this->object->getSelectionLimit()) {
 
  453                $this->lng->txt(
'ass_mc_sel_lim_hint'),
 
  454                $this->object->getSelectionLimit(),
 
  455                $this->object->getAnswerCount()
 
  458            $template->setVariable(
'SELECTION_LIMIT_VALUE', $this->object->getSelectionLimit());
 
  460            $template->setVariable(
'SELECTION_LIMIT_VALUE', 
'null');
 
  462        $template->setVariable(
"QUESTION_ID", $this->object->getId());
 
  463        $questiontext = $this->
object->getQuestion();
 
  464        $template->setVariable(
"QUESTIONTEXT", $this->object->prepareTextareaOutput($questiontext, 
true));
 
  466        if (!$show_question_only) {
 
  470        return $questionoutput;
 
  487        $is_postponed = 
false,
 
  488        $use_post_solutions = 
false,
 
  489        $show_feedback = 
false 
  495        $user_solution = array();
 
  499            #include_once "./Modules/Test/classes/class.ilObjTest.php";
 
  500            #if (!ilObjTest::_getUsePreviousAnswers($active_id, true)) 
  502            #   if (is_null($pass)) $pass = ilObjTest::_getPass($active_id); 
  504            $solutions = $this->
object->getTestOutputSolutions($active_id, 
$pass);
 
  506            foreach ($solutions as $idx => $solution_value) {
 
  508                if ($solution_value[
"value1"] == 
'mc_none_above') {
 
  513                $user_solution[] = $solution_value[
"value1"];
 
  517            if (empty($user_solution) && $this->object->getTestPresentationConfig()->isWorkedThrough()) {
 
  522        $this->tpl->addJavaScript(
'Modules/TestQuestionPool/js/ilAssMultipleChoice.js');
 
  523        include_once 
"./Services/UICore/classes/class.ilTemplate.php";
 
  524        $template = 
new ilTemplate(
"tpl.il_as_qpl_mc_mr_output.html", 
true, 
true, 
"Modules/TestQuestionPool");
 
  525        foreach (
$keys as $answer_id) {
 
  526            $answer = $this->
object->answers[$answer_id];
 
  527            if (strlen($answer->getImage())) {
 
  528                if ($this->object->getThumbSize()) {
 
  530                    $template->setVariable(
"URL_PREVIEW", $this->object->getImagePathWeb() . $answer->getImage());
 
  531                    $template->setVariable(
"TEXT_PREVIEW", $this->lng->txt(
'preview'));
 
  533                    $template->setVariable(
"ANSWER_IMAGE_URL", $this->object->getImagePathWeb() . $this->object->getThumbPrefix() . $answer->getImage());
 
  534                    list($width, $height, 
$type, $attr) = getimagesize($this->object->getImagePath() . $answer->getImage());
 
  535                    $alt = $answer->getImage();
 
  536                    if (strlen($answer->getAnswertext())) {
 
  537                        $alt = $answer->getAnswertext();
 
  539                    $alt = preg_replace(
"/<[^>]*?>/", 
"", $alt);
 
  544                    $template->setCurrentBlock(
"answer_image");
 
  545                    $template->setVariable(
"ANSWER_IMAGE_URL", $this->object->getImagePathWeb() . $answer->getImage());
 
  546                    list($width, $height, 
$type, $attr) = getimagesize($this->object->getImagePath() . $answer->getImage());
 
  547                    $alt = $answer->getImage();
 
  548                    if (strlen($answer->getAnswertext())) {
 
  549                        $alt = $answer->getAnswertext();
 
  551                    $alt = preg_replace(
"/<[^>]*?>/", 
"", $alt);
 
  559            if ($show_feedback) {
 
  563            $template->setCurrentBlock(
"answer_row");
 
  564            $template->setVariable(
"QID", $this->object->getId());
 
  565            $template->setVariable(
"ANSWER_ID", $answer_id);
 
  566            $template->setVariable(
"ANSWER_TEXT", $this->object->prepareTextareaOutput($answer->getAnswertext(), 
true));
 
  567            foreach ($user_solution as $mc_solution) {
 
  568                if (strcmp($mc_solution, $answer_id) == 0) {
 
  569                    $template->setVariable(
"CHECKED_ANSWER", 
" checked=\"checked\"");
 
  575        $questiontext = $this->
object->getQuestion();
 
  576        $template->setVariable(
"QUESTIONTEXT", $this->object->prepareTextareaOutput($questiontext, 
true));
 
  577        $template->setVariable(
"QUESTION_ID", $this->object->getId());
 
  578        if ($this->object->getSelectionLimit()) {
 
  580                $this->lng->txt(
'ass_mc_sel_lim_hint'),
 
  581                $this->object->getSelectionLimit(),
 
  582                $this->object->getAnswerCount()
 
  585            $template->setVariable(
'SELECTION_LIMIT_VALUE', $this->object->getSelectionLimit());
 
  587            $template->setVariable(
'SELECTION_LIMIT_VALUE', 
'null');
 
  590        $pageoutput = $this->
outQuestionPage(
"", $is_postponed, $active_id, $questionoutput);
 
  609        $this->tpl->addJavaScript(
'Modules/TestQuestionPool/js/ilAssMultipleChoice.js');
 
  611        $tpl = 
new ilTemplate(
'tpl.tst_question_additional_behaviour_checkbox.html', 
true, 
true, 
'Modules/TestQuestionPool');
 
  616            $tpl->setCurrentBlock(
'checked');
 
  617            $tpl->touchBlock(
'checked');
 
  618            $tpl->parseCurrentBlock();
 
  622        $tpl->setCurrentBlock(
'checkbox');
 
  623        $tpl->setVariable(
'TXT_FORCE_FORM_DIFF_LABEL', $this->object->getTestPresentationConfig()->getUseUnchangedAnswerLabel());
 
  624        $tpl->parseCurrentBlock();
 
  631        $tpl->addJavaScript(
'Modules/TestQuestionPool/js/ilAssMultipleChoice.js');
 
  641        global $rbacsystem, $ilTabs;
 
  643        $ilTabs->clearTargets();
 
  645        $this->ctrl->setParameterByClass(
"ilAssQuestionPageGUI", 
"q_id", 
$_GET[
"q_id"]);
 
  646        include_once 
"./Modules/TestQuestionPool/classes/class.assQuestion.php";
 
  647        $q_type = $this->
object->getQuestionType();
 
  649        if (strlen($q_type)) {
 
  650            $classname = $q_type . 
"GUI";
 
  651            $this->ctrl->setParameterByClass(strtolower($classname), 
"sel_question_types", $q_type);
 
  652            $this->ctrl->setParameterByClass(strtolower($classname), 
"q_id", 
$_GET[
"q_id"]);
 
  656            if ($rbacsystem->checkAccess(
'write', 
$_GET[
"ref_id"])) {
 
  660                    $this->ctrl->getLinkTargetByClass(
"ilAssQuestionPageGUI", 
"edit"),
 
  661                    array(
"edit", 
"insert", 
"exec_pg"),
 
  670        $force_active = 
false;
 
  671        if ($rbacsystem->checkAccess(
'write', 
$_GET[
"ref_id"])) {
 
  674                $url = $this->ctrl->getLinkTargetByClass($classname, 
"editQuestion");
 
  676            $force_active = 
false;
 
  681                array(
"editQuestion", 
"save", 
"saveEdit", 
"addchoice", 
"removechoice", 
"removeimagechoice", 
"uploadchoice", 
"originalSyncForm"),
 
  701                $this->ctrl->getLinkTargetByClass($classname, 
"assessment"),
 
  720        if ($this->object->getShuffle()) {
 
  731        return $this->
object->prepareTextareaOutput(
$output, 
true);
 
  736        $this->
object->setShuffle(
$_POST[
"shuffle"]);
 
  738        $selectionLimit = (int) 
$form->getItemByPostVar(
'selection_limit')->getValue();
 
  739        $this->
object->setSelectionLimit($selectionLimit > 0 ? $selectionLimit : 
null);
 
  741        $this->
object->setMultilineAnswerSetting(
$_POST[
"types"]);
 
  742        if (is_array(
$_POST[
'choice'][
'imagename']) && 
$_POST[
"types"] == 1) {
 
  743            $this->
object->isSingleline = 
true;
 
  746            $this->
object->isSingleline = (
$_POST[
"types"] == 0) ? 
true : 
false;
 
  748        $this->
object->setThumbSize((strlen(
$_POST[
"thumb_size"])) ? 
$_POST[
"thumb_size"] : 
"");
 
  754        $this->
object->flushAnswers();
 
  755        if ($this->object->isSingleline) {
 
  756            foreach (
$_POST[
'choice'][
'answer'] as 
$index => $answertext) {
 
  760                $file_org_name  = $_FILES[
'choice'][
'name'][
'image'][
$index];
 
  761                $file_temp_name = $_FILES[
'choice'][
'tmp_name'][
'image'][
$index];
 
  763                if (strlen($file_temp_name)) {
 
  765                    $suffix = strtolower(array_pop(explode(
".", $file_org_name)));
 
  766                    if (in_array($suffix, array( 
"jpg", 
"jpeg", 
"png", 
"gif" ))) {
 
  768                        $filename = $this->
object->buildHashedImageFilename($file_org_name);
 
  769                        if ($this->object->setImageFile(
$filename, $file_temp_name) == 0) {
 
  774                $this->
object->addAnswer(
 
  783            foreach (
$_POST[
'choice'][
'answer'] as 
$index => $answer) {
 
  784                $answertext = $answer;
 
  785                $this->
object->addAnswer(
 
  799        $shuffle->setValue(1);
 
  800        $shuffle->setChecked($this->object->getShuffle());
 
  801        $shuffle->setRequired(
false);
 
  802        $form->addItem($shuffle);
 
  804        require_once 
'Services/Form/classes/class.ilNumberInputGUI.php';
 
  805        $selLim = 
new ilNumberInputGUI($this->lng->txt(
'ass_mc_sel_lim_setting'), 
'selection_limit');
 
  806        $selLim->setInfo($this->lng->txt(
'ass_mc_sel_lim_setting_desc'));
 
  808        $selLim->setRequired(
false);
 
  809        $selLim->allowDecimals(
false);
 
  810        $selLim->setMinvalueShouldBeGreater(
false);
 
  811        $selLim->setMaxvalueShouldBeLess(
false);
 
  812        $selLim->setMinValue(1);
 
  813        $selLim->setMaxValue($this->object->getAnswerCount());
 
  814        $selLim->setValue($this->object->getSelectionLimit());
 
  815        $form->addItem($selLim);
 
  817        if ($this->object->getId()) {
 
  819            $hidden->setValue($this->object->getId());
 
  820            $form->addItem($hidden);
 
  825        if (!$this->object->getSelfAssessmentEditingMode()) {
 
  828            $types->setRequired(
false);
 
  829            $types->setValue(($isSingleline) ? 0 : 1);
 
  832                                    0 => $this->lng->txt(
'answers_singleline'),
 
  833                                    1 => $this->lng->txt(
'answers_multiline'),
 
  836            $form->addItem($types);
 
  841            $thumb_size = 
new ilNumberInputGUI($this->lng->txt(
"thumb_size"), 
"thumb_size");
 
  842            $thumb_size->setSuffix($this->lng->txt(
"thumb_size_unit_pixel"));
 
  843            $thumb_size->setMinValue(20);
 
  844            $thumb_size->setDecimals(0);
 
  845            $thumb_size->setSize(6);
 
  846            $thumb_size->setInfo($this->lng->txt(
'thumb_size_info'));
 
  847            $thumb_size->setValue($this->object->getThumbSize());
 
  848            $thumb_size->setRequired(
false);
 
  849            $form->addItem($thumb_size);
 
  850            return $isSingleline;
 
  852        return $isSingleline;
 
  858        include_once 
"./Modules/TestQuestionPool/classes/class.ilMultipleChoiceWizardInputGUI.php";
 
  860        $choices->setRequired(
true);
 
  861        $choices->setQuestionObject($this->
object);
 
  863        $choices->setSingleline($isSingleline);
 
  864        $choices->setAllowMove(
false);
 
  865        if ($this->object->getSelfAssessmentEditingMode()) {
 
  866            $choices->setSize(40);
 
  868        $choices->setMaxLength(800);
 
  869        if ($this->object->getAnswerCount() == 0) {
 
  870            $this->
object->addAnswer(
"", 0, 0, 0);
 
  872        $choices->setValues($this->object->getAnswers());
 
  873        $form->addItem($choices);
 
  921        $aggregate = array();
 
  922        foreach ($answers_defined_on_question as $answer) {
 
  923            $aggregated_info_for_answer                                         = array();
 
  924            $aggregated_info_for_answer[
'answertext']           = $answer->getAnswerText();
 
  925            $aggregated_info_for_answer[
'count_checked']        = 0;
 
  927            foreach ($relevant_answers_chosen as $relevant_answer) {
 
  928                if ($relevant_answer[
'value1'] == $answer->getOrder()) {
 
  929                    $aggregated_info_for_answer[
'count_checked']++;
 
  932            $aggregated_info_for_answer[
'count_unchecked'] =
 
  933                ceil(count($relevant_answers_chosen) / count($answers_defined_on_question))
 
  934                - $aggregated_info_for_answer[
'count_checked'];
 
  936            $aggregate[] = $aggregated_info_for_answer;
 
  948        $tpl = 
new ilTemplate(
'tpl.il_as_aggregated_answers_table.html', 
true, 
true, 
"Modules/TestQuestionPool");
 
  950        $tpl->setCurrentBlock(
'headercell');
 
  951        $tpl->setVariable(
'HEADER', $this->lng->txt(
'tst_answer_aggr_answer_header'));
 
  952        $tpl->parseCurrentBlock();
 
  954        $tpl->setCurrentBlock(
'headercell');
 
  955        $tpl->setVariable(
'HEADER', $this->lng->txt(
'tst_answer_aggr_frequency_header'));
 
  956        $tpl->parseCurrentBlock();
 
  958        foreach ($aggregate as $line_data) {
 
  959            $tpl->setCurrentBlock(
'aggregaterow');
 
  960            $tpl->setVariable(
'OPTION', $line_data[
'answertext']);
 
  961            $tpl->setVariable(
'COUNT', $line_data[
'count_checked']);
 
  962            $tpl->parseCurrentBlock();
 
  975        if ($this->object->getSpecificFeedbackSetting() == 2) {
 
  976            foreach ($user_solution as $mc_solution) {
 
  977                if (strcmp($mc_solution, $answer_id) == 0) {
 
  978                    $fb = $this->
object->feedbackOBJ->getSpecificAnswerFeedbackTestPresentation($this->object->getId(), $answer_id);
 
  981                        $template->setVariable(
"FEEDBACK", $this->object->prepareTextareaOutput($fb, 
true));
 
  988        if ($this->object->getSpecificFeedbackSetting() == 1) {
 
  989            $fb = $this->
object->feedbackOBJ->getSpecificAnswerFeedbackTestPresentation($this->object->getId(), $answer_id);
 
  992                $template->setVariable(
"FEEDBACK", $this->object->prepareTextareaOutput($fb, 
true));
 
  997        if ($this->object->getSpecificFeedbackSetting() == 3) {
 
  998            $answer = $this->
object->getAnswer($answer_id);
 
 1000            if ($answer->getPoints() > 0) {
 
 1001                $fb = $this->
object->feedbackOBJ->getSpecificAnswerFeedbackTestPresentation($this->object->getId(), $answer_id);
 
 1004                    $template->setVariable(
"FEEDBACK", $this->object->prepareTextareaOutput($fb, 
true));
 
 1020        include_once(
"./Services/Form/classes/class.ilPropertyFormGUI.php");
 
 1022        $form->setFormAction($this->ctrl->getFormAction($this));
 
 1024        $form->setTableWidth(
"100%");
 
 1025        $form->setId(
"assmultiplechoice");
 
sprintf('%.4f', $callTime)
An exception for terminatinating execution or to throw for unit testing.
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)
populateSpecificFeedbackInline($user_solution, $answer_id, $template)
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)
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.
populateAnswerSpecificFormPart(\ilPropertyFormGUI $form)
editQuestion($checkonly=false)
Creates an output of the edit form for the question.
setQuestionTabs()
Sets the ILIAS tabs for this question type.
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)
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(!array_key_exists('StateId', $_REQUEST)) $id
if(!is_dir( $entity_dir)) exit("Fatal Error ([A-Za-z0-9]+)\s+" &#(? foreach( $entity_files as $file) $output
Interface ilGuiAnswerScoringAdjustable.
Interface ilGuiQuestionScoringAdjustable.
if(isset($_POST['submit'])) $form