4require_once 
'./Modules/TestQuestionPool/classes/class.assQuestionGUI.php';
 
    5require_once 
'./Modules/TestQuestionPool/interfaces/interface.ilGuiQuestionScoringAdjustable.php';
 
    6require_once 
'./Modules/TestQuestionPool/interfaces/interface.ilGuiAnswerScoringAdjustable.php';
 
    7include_once 
'./Modules/Test/classes/inc.AssessmentConstants.php';
 
    8require_once  
'Services/WebAccessChecker/classes/class.ilWACSignedPath.php';
 
   39        parent::__construct();
 
   40        include_once 
'./Modules/TestQuestionPool/classes/class.assImagemapQuestion.php';
 
   43            $this->
object->loadFromDb(
$id);
 
   45        $assessmentSetting = 
new ilSetting(
"assessment");
 
   46        $this->linecolor = (strlen($assessmentSetting->get(
"imap_line_color"))) ? 
"#" . $assessmentSetting->get(
"imap_line_color") : 
"#FF0000";
 
   51        if (isset(
$_POST[
"imagemap"]) ||
 
   52        isset(
$_POST[
"imagemap_x"]) ||
 
   53        isset(
$_POST[
"imagemap_y"])) {
 
   54            $this->ctrl->setCmd(
"getCoords");
 
   63        $this->
object->deleteImage();
 
   64        $this->
object->saveToDb();
 
   66        $this->ctrl->redirect($this, 
'editQuestion');
 
   75        $form->setValuesByPost();
 
   77        if (!$always && !
$form->checkInput()) {
 
   92        if ($this->ctrl->getCmd() != 
'deleteImage') {
 
   93            $this->
object->flushAnswers();
 
   94            if (is_array(
$_POST[
'image'][
'coords'][
'name'])) {
 
   95                foreach (
$_POST[
'image'][
'coords'][
'name'] as $idx => 
$name) {
 
   96                    if ($this->object->getIsMultipleChoice() && isset(
$_POST[
'image'][
'coords'][
'points_unchecked'])) {
 
   97                        $pointsUnchecked = 
$_POST[
'image'][
'coords'][
'points_unchecked'][$idx];
 
   99                        $pointsUnchecked = 0.0;
 
  102                    $this->
object->addAnswer(
 
  104                        $_POST[
'image'][
'coords'][
'points'][$idx],
 
  106                        $_POST[
'image'][
'coords'][
'coords'][$idx],
 
  107                        $_POST[
'image'][
'coords'][
'shape'][$idx],
 
  113            if (strlen($_FILES[
'imagemapfile'][
'tmp_name'])) {
 
  114                if ($this->object->getSelfAssessmentEditingMode() && $this->object->getId() < 1) {
 
  115                    $this->
object->createNewQuestion();
 
  118                $this->
object->uploadImagemap($form->
getItemByPostVar(
'imagemapfile')->getShapes());
 
  125        if ($this->ctrl->getCmd() != 
'deleteImage') {
 
  126            if (strlen($_FILES[
'image'][
'tmp_name']) == 0) {
 
  127                $this->
object->setImageFilename(
$_POST[
"image_name"]);
 
  130        if (strlen($_FILES[
'image'][
'tmp_name'])) {
 
  131            if ($this->object->getSelfAssessmentEditingMode() && $this->object->getId() < 1) {
 
  132                $this->
object->createNewQuestion();
 
  134            $this->
object->setImageFilename($_FILES[
'image'][
'name'], $_FILES[
'image'][
'tmp_name']);
 
  161        if (
null === 
$form) {
 
  166        $this->tpl->addCss(
'Modules/Test/templates/default/ta.css');
 
  168        $this->tpl->setVariable(
'QUESTION_DATA', $this->ctrl->getHTML(
$form));
 
  180        $radioGroup = 
new ilRadioGroupInputGUI($this->lng->txt(
'tst_imap_qst_mode'), 
'is_multiple_choice');
 
  181        $radioGroup->setValue($this->object->getIsMultipleChoice());
 
  183            $this->lng->txt(
'tst_imap_qst_mode_sc'),
 
  187            $this->lng->txt(
'tst_imap_qst_mode_mc'),
 
  190        $radioGroup->addOption($modeSingleChoice);
 
  191        $radioGroup->addOption($modeMultipleChoice);
 
  192        $form->addItem($radioGroup);
 
  194        require_once 
'Modules/TestQuestionPool/classes/forms/class.ilImagemapFileInputGUI.php';
 
  196        $image->setPointsUncheckedFieldEnabled($this->object->getIsMultipleChoice());
 
  197        $image->setRequired(
true);
 
  199        if (strlen($this->object->getImageFilename())) {
 
  200            $image->setImage($this->object->getImagePathWeb() . $this->object->getImageFilename());
 
  201            $image->setValue($this->object->getImageFilename());
 
  202            $image->setAreas($this->object->getAnswers());
 
  203            $assessmentSetting = 
new ilSetting(
"assessment");
 
  205                $assessmentSetting->get(
"imap_line_color")
 
  206            )) ? 
"\"#" . $assessmentSetting->get(
"imap_line_color") . 
"\"" : 
"\"#FF0000\"";
 
  208            $image->setImagePath($this->object->getImagePath());
 
  209            $image->setImagePathWeb($this->object->getImagePathWeb());
 
  211        $form->addItem($image);
 
  213        require_once 
'Modules/TestQuestionPool/classes/forms/class.ilHtmlImageMapFileInputGUI.php';
 
  215        $imagemapfile->setRequired(
false);
 
  216        $form->addItem($imagemapfile);
 
  241        switch (
$_POST[
"shape"]) {
 
  247                if (preg_match(
"/(\d+)\s*,\s*(\d+)\s+(\d+)\s*,\s*(\d+)/", 
$_POST[
'image'][
'mapcoords'][0] . 
" " . 
$_POST[
'image'][
'mapcoords'][1], $matches)) {
 
  248                    $coords = 
"$matches[1],$matches[2]," . (int) sqrt((($matches[3]-$matches[1])*($matches[3]-$matches[1]))+(($matches[4]-$matches[2])*($matches[4]-$matches[2])));
 
  257        $this->
object->addAnswer(
$_POST[
"shapetitle"], 0, count($this->object->getAnswers()), 
$coords, 
$_POST[
"shape"]);
 
  258        $this->
object->saveToDb();
 
  259        $this->ctrl->redirect($this, 
'editQuestion');
 
  264        $shape = (strlen($shape)) ? $shape : 
$_POST[
'shape'];
 
  265        include_once 
"./Modules/TestQuestionPool/classes/class.ilImagemapPreview.php";
 
  267        $this->tpl->addBlockFile(
"QUESTION_DATA", 
"question_data", 
"tpl.il_as_qpl_imagemap_question.html", 
"Modules/TestQuestionPool");
 
  269        if (is_array(
$_POST[
'image'][
'mapcoords'])) {
 
  270            foreach (
$_POST[
'image'][
'mapcoords'] as $value) {
 
  274        if (is_array(
$_POST[
'cmd'][
'areaEditor'][
'image'])) {
 
  275            array_push(
$coords, 
$_POST[
'cmd'][
'areaEditor'][
'image'][0] . 
"," . 
$_POST[
'cmd'][
'areaEditor'][
'image'][1]);
 
  278            $this->tpl->setCurrentBlock(
"hidden");
 
  279            $this->tpl->setVariable(
"HIDDEN_NAME", 
'image[mapcoords][]');
 
  280            $this->tpl->setVariable(
"HIDDEN_VALUE", $value);
 
  281            $this->tpl->parseCurrentBlock();
 
  284        $this->tpl->setCurrentBlock(
"hidden");
 
  285        $this->tpl->setVariable(
"HIDDEN_NAME", 
'shape');
 
  286        $this->tpl->setVariable(
"HIDDEN_VALUE", $shape);
 
  287        $this->tpl->parseCurrentBlock();
 
  290        foreach ($this->object->answers as 
$index => $answer) {
 
  291            $preview->addArea(
$index, $answer->getArea(), $answer->getCoords(), $answer->getAnswertext(), 
"", 
"", 
true, $this->linecolor);
 
  294        $disabled_save = 
" disabled=\"disabled\"";
 
  300                } elseif (count(
$coords) == 1) {
 
  303                } elseif (count(
$coords) == 2) {
 
  312                } elseif (count(
$coords) == 1) {
 
  315                } elseif (count(
$coords) == 2) {
 
  316                    if (preg_match(
"/(\d+)\s*,\s*(\d+)\s+(\d+)\s*,\s*(\d+)/", 
$coords[0] . 
" " . 
$coords[1], $matches)) {
 
  317                        $c = 
"$matches[1],$matches[2]," . (int) sqrt((($matches[3]-$matches[1])*($matches[3]-$matches[1]))+(($matches[4]-$matches[2])*($matches[4]-$matches[2])));
 
  326                } elseif (count(
$coords) == 1) {
 
  329                } elseif (count(
$coords) > 1) {
 
  340        $imagepath = $this->
object->getImagePathWeb() . 
$preview->getPreviewFilename($this->object->getImagePath(), $this->object->getImageFilename()) . 
"?img=" . time();
 
  342            $this->tpl->setCurrentBlock(
"maparea");
 
  343            $this->tpl->setVariable(
"IMAGE_SOURCE", 
"$imagepath");
 
  344            $this->tpl->setVariable(
"IMAGEMAP_NAME", 
"image");
 
  345            $this->tpl->parseCurrentBlock();
 
  347            $this->tpl->setCurrentBlock(
"imagearea");
 
  348            $this->tpl->setVariable(
"IMAGE_SOURCE", 
"$imagepath");
 
  349            $this->tpl->setVariable(
"ALT_IMAGE", $this->lng->txt(
"imagemap"));
 
  350            $this->tpl->parseCurrentBlock();
 
  353        if (strlen(
$_POST[
'shapetitle'])) {
 
  354            $this->tpl->setCurrentBlock(
"shapetitle");
 
  355            $this->tpl->setVariable(
"VALUE_SHAPETITLE", 
$_POST[
"shapetitle"]);
 
  356            $this->tpl->parseCurrentBlock();
 
  359        $this->tpl->setVariable(
"TEXT_IMAGEMAP", $this->lng->txt(
"imagemap"));
 
  360        $this->tpl->setVariable(
"TEXT_SHAPETITLE", $this->lng->txt(
"ass_imap_hint"));
 
  361        $this->tpl->setVariable(
"CANCEL", $this->lng->txt(
"cancel"));
 
  362        $this->tpl->setVariable(
"SAVE", $this->lng->txt(
"save"));
 
  363        $this->tpl->setVariable(
"DISABLED_SAVE", $disabled_save);
 
  366                $this->tpl->setVariable(
"FORMACTION", $this->ctrl->getFormaction($this, 
'addRect'));
 
  369                $this->tpl->setVariable(
"FORMACTION", $this->ctrl->getFormaction($this, 
'addCircle'));
 
  372                $this->tpl->setVariable(
"FORMACTION", $this->ctrl->getFormaction($this, 
'addPoly'));
 
  380        $this->ctrl->redirect($this, 
'editQuestion');
 
  387        #require_once './Modules/Test/classes/class.ilObjTest.php'; 
  388        #if (!ilObjTest::_getUsePreviousAnswers($active_id, true)) 
  390        #       $pass = ilObjTest::_getPass($active_id); 
  391        #       $info = $this->object->getUserSolutionPreferingIntermediate($active_id, $pass); 
  395        #       $info = $this->object->getUserSolutionPreferingIntermediate($active_id, NULL); 
  398        $info = $this->
object->getTestOutputSolutions($active_id, 
$pass);
 
  401            if (strcmp(
$info[0][
"value1"], 
"") != 0) {
 
  402                $formAction .= 
"&selImage=" . 
$info[0][
"value1"];
 
  427        $graphicalOutput = 
false,
 
  428        $result_output = 
false,
 
  429        $show_question_only = 
true,
 
  430        $show_feedback = 
false,
 
  431        $show_correct_solution = 
false,
 
  432        $show_manual_scoring = 
false,
 
  433        $show_question_text = 
true 
  435        $imagepath = $this->
object->getImagePathWeb() . $this->
object->getImageFilename();
 
  436        $solutions = array();
 
  437        if (($active_id > 0) && (!$show_correct_solution)) {
 
  438            include_once 
"./Modules/Test/classes/class.ilObjTest.php";
 
  440                if (is_null(
$pass)) {
 
  444            $solutions =&$this->
object->getSolutionValues($active_id, 
$pass);
 
  446            if (!$this->object->getIsMultipleChoice()) {
 
  449                foreach ($this->object->answers as 
$index => $answer) {
 
  450                    if ($answer->getPoints() > $max_points) {
 
  451                        $max_points = $answer->getPoints();
 
  455                array_push($solutions, array(
"value1" => $found_index));
 
  458                foreach ($this->object->answers as 
$index => $answer) {
 
  459                    $points_checked   = $answer->getPoints();
 
  460                    $points_unchecked = $answer->getPointsUnchecked();
 
  461                    if ($points_checked > $points_unchecked) {
 
  462                        if ($points_checked > 0) {
 
  463                            array_push($solutions, array(
"value1" => 
$index));
 
  470        if (is_array($solutions)) {
 
  471            include_once 
"./Modules/TestQuestionPool/classes/class.ilImagemapPreview.php";
 
  473            foreach ($solutions as $idx => $solution_value) {
 
  474                if (strcmp($solution_value[
"value1"], 
"") != 0) {
 
  475                    $preview->addArea($solution_value[
"value1"], $this->object->answers[$solution_value[
"value1"]]->getArea(), $this->object->answers[$solution_value[
"value1"]]->getCoords(), $this->object->answers[$solution_value[
"value1"]]->getAnswertext(), 
"", 
"", 
true, $this->linecolor);
 
  476                    $solution_id = $solution_value[
"value1"];
 
  480            $imagepath = $this->
object->getImagePathWeb() . 
$preview->getPreviewFilename($this->object->getImagePath(), $this->object->getImageFilename());
 
  484        include_once 
"./Services/UICore/classes/class.ilTemplate.php";
 
  485        $template = 
new ilTemplate(
"tpl.il_as_qpl_imagemap_question_output_solution.html", 
true, 
true, 
"Modules/TestQuestionPool");
 
  486        $solutiontemplate = 
new ilTemplate(
"tpl.il_as_tst_solution_output.html", 
true, 
true, 
"Modules/TestQuestionPool");
 
  487        $questiontext = $this->
object->getQuestion();
 
  488        if ($show_question_text==
true) {
 
  489            $template->setVariable(
"QUESTIONTEXT", $this->object->prepareTextareaOutput($questiontext, 
true));
 
  493        $template->setVariable(
"IMG_ALT", $this->lng->txt(
"imagemap"));
 
  494        $template->setVariable(
"IMG_TITLE", $this->lng->txt(
"imagemap"));
 
  495        if (($active_id > 0) && (!$show_correct_solution)) {
 
  496            if ($graphicalOutput) {
 
  498                $reached_points = $this->
object->getReachedPoints($active_id, 
$pass);
 
  499                if ($reached_points == $this->object->getMaximumPoints()) {
 
  502                    $template->setVariable(
"TEXT_OK", $this->lng->txt(
"answer_is_right"));
 
  506                    if ($reached_points > 0) {
 
  508                        $template->setVariable(
"TEXT_NOT_OK", $this->lng->txt(
"answer_is_not_correct_but_positive"));
 
  511                        $template->setVariable(
"TEXT_NOT_OK", $this->lng->txt(
"answer_is_wrong"));
 
  518        if ($show_feedback) {
 
  519            $fb = $this->
object->feedbackOBJ->getSpecificAnswerFeedbackTestPresentation(
 
  520                $this->object->getId(),
 
  533        if (strlen($feedback)) {
 
  539            $solutiontemplate->setVariable(
"ILC_FB_CSS_CLASS", $cssClass);
 
  540            $solutiontemplate->setVariable(
"FEEDBACK", $this->object->prepareTextareaOutput($feedback, 
true));
 
  542        $solutiontemplate->setVariable(
"SOLUTION_OUTPUT", $questionoutput);
 
  544        $solutionoutput = $solutiontemplate->get();
 
  545        if (!$show_question_only) {
 
  549        return $solutionoutput;
 
  552    public function getPreview($show_question_only = 
false, $showInlineFeedback = 
false)
 
  555            $user_solution = array();
 
  558                $user_solution = array_values($this->
getPreviewSession()->getParticipantsSolution());
 
  561            include_once 
"./Modules/TestQuestionPool/classes/class.ilImagemapPreview.php";
 
  563            foreach ($user_solution as $idx => $solution_value) {
 
  564                if (strcmp($solution_value, 
"") != 0) {
 
  565                    $preview->addArea($solution_value, $this->object->answers[$solution_value]->getArea(), $this->object->answers[$solution_value]->getCoords(), $this->object->answers[$solution_value]->getAnswertext(), 
"", 
"", 
true, $this->linecolor);
 
  569            $imagepath = $this->
object->getImagePathWeb() . 
$preview->getPreviewFilename($this->object->getImagePath(), $this->object->getImageFilename());
 
  571            $user_solution = array();
 
  572            $imagepath = $this->
object->getImagePathWeb() . $this->
object->getImageFilename();
 
  576        include_once 
"./Services/UICore/classes/class.ilTemplate.php";
 
  577        $template = 
new ilTemplate(
"tpl.il_as_qpl_imagemap_question_output.html", 
true, 
true, 
"Modules/TestQuestionPool");
 
  585        foreach ($this->object->answers as $answer_id => $answer) {
 
  586            $parameter = 
"&selImage=$answer_id";
 
  587            if (is_array($user_solution) && in_array($answer_id, $user_solution)) {
 
  588                $parameter = 
"&remImage=$answer_id";
 
  592                $template->setCurrentBlock(
"imagemap_area_href");
 
  593                $template->setVariable(
"HREF_AREA", $hrefArea . $parameter);
 
  597            $template->setCurrentBlock(
"imagemap_area");
 
  598            $template->setVariable(
"SHAPE", $answer->getArea());
 
  599            $template->setVariable(
"COORDS", $answer->getCoords());
 
  604        $questiontext = $this->
object->getQuestion();
 
  605        $template->setVariable(
"QUESTIONTEXT", $this->object->prepareTextareaOutput($questiontext, 
true));
 
  607        $template->setVariable(
"IMG_ALT", $this->lng->txt(
"imagemap"));
 
  608        $template->setVariable(
"IMG_TITLE", $this->lng->txt(
"imagemap"));
 
  610        if (!$show_question_only) {
 
  614        return $questionoutput;
 
  618    public function getTestOutput($active_id, 
$pass, $is_postponed = 
false, $use_post_solutions = 
false, $show_feedback = 
false)
 
  624            #include_once "./Modules/Test/classes/class.ilObjTest.php";
 
  625            #if (!ilObjTest::_getUsePreviousAnswers($active_id, true)) 
  627            #   if (is_null($pass)) $pass = ilObjTest::_getPass($active_id); 
  629            $solutions = $this->
object->getTestOutputSolutions($active_id, 
$pass);
 
  632            $userSelection = array();
 
  635            include_once 
"./Modules/TestQuestionPool/classes/class.ilImagemapPreview.php";
 
  638            foreach ($solutions as $idx => $solution_value) {
 
  639                if (strlen($solution_value[
"value1"])) {
 
  640                    $preview->addArea($solution_value[
"value1"], $this->object->answers[$solution_value[
"value1"]]->getArea(), $this->object->answers[$solution_value[
"value1"]]->getCoords(), $this->object->answers[$solution_value[
"value1"]]->getAnswertext(), 
"", 
"", 
true, $this->linecolor);
 
  641                    $userSelection[$selectionIndex] = $solution_value[
"value1"];
 
  643                    $selectionIndex = $this->
object->getIsMultipleChoice() ? ++$selectionIndex : $selectionIndex;
 
  649            $imagepath = $this->
object->getImagePathWeb() . 
$preview->getPreviewFilename($this->object->getImagePath(), $this->object->getImageFilename());
 
  651            $imagepath = $this->
object->getImagePathWeb() . $this->
object->getImageFilename();
 
  655        include_once 
"./Services/UICore/classes/class.ilTemplate.php";
 
  656        $template = 
new ilTemplate(
"tpl.il_as_qpl_imagemap_question_output.html", 
true, 
true, 
"Modules/TestQuestionPool");
 
  657        $this->ctrl->setParameterByClass($this->
getTargetGuiClass(), 
"formtimestamp", time());
 
  659        foreach ($this->object->answers as $answer_id => $answer) {
 
  660            $template->setCurrentBlock(
"imagemap_area");
 
  662            $template->setVariable(
"SHAPE", $answer->getArea());
 
  663            $template->setVariable(
"COORDS", $answer->getCoords());
 
  667            if ($show_feedback) {
 
  668                if (!$this->object->getIsMultipleChoice() && count($userSelection) && current($userSelection) == $answer_id) {
 
  669                    $feedback = $this->
object->feedbackOBJ->getSpecificAnswerFeedbackTestPresentation(
 
  670                        $this->object->getId(),
 
  673                    if (strlen($feedback)) {
 
  675                        $template->setVariable(
"FEEDBACK", $feedback);
 
  681        $questiontext = $this->
object->getQuestion();
 
  682        $template->setVariable(
"QUESTIONTEXT", $this->object->prepareTextareaOutput($questiontext, 
true));
 
  684        $template->setVariable(
"IMG_ALT", $this->lng->txt(
"imagemap"));
 
  685        $template->setVariable(
"IMG_TITLE", $this->lng->txt(
"imagemap"));
 
  687        $pageoutput = $this->
outQuestionPage(
"", $is_postponed, $active_id, $questionoutput);
 
  694        $href = $this->ctrl->getLinkTargetByClass(
 
  709        if ($this->object->getTestPresentationConfig()->isSolutionInitiallyPrefilled()) {
 
  710            $reuseSelection = array();
 
  712            if ($areaIndex === 
null) {
 
  713                $reuseSelection = $currentSelection;
 
  714            } elseif ($this->object->getIsMultipleChoice()) {
 
  715                if (!in_array($areaIndex, $currentSelection)) {
 
  716                    $reuseSelection[] = $areaIndex;
 
  719                foreach (array_diff($currentSelection, array($areaIndex)) as $otherSelectedArea) {
 
  720                    $reuseSelection[] = $otherSelectedArea;
 
  723                $reuseSelection[] = $areaIndex;
 
  728        } elseif ($areaIndex !== 
null) {
 
  729            if (!$this->object->getIsMultipleChoice() || !in_array($areaIndex, $currentSelection)) {
 
  730                $areaAction = 
'selImage';
 
  732                $areaAction = 
'remImage';
 
  735            $selection = $areaIndex;
 
  741        return "{$action}={$selection}";
 
  754        global $rbacsystem, $ilTabs;
 
  756        $ilTabs->clearTargets();
 
  758        $this->ctrl->setParameterByClass(
"ilAssQuestionPageGUI", 
"q_id", 
$_GET[
"q_id"]);
 
  759        include_once 
"./Modules/TestQuestionPool/classes/class.assQuestion.php";
 
  760        $q_type = $this->
object->getQuestionType();
 
  762        if (strlen($q_type)) {
 
  763            $classname = $q_type . 
"GUI";
 
  764            $this->ctrl->setParameterByClass(strtolower($classname), 
"sel_question_types", $q_type);
 
  765            $this->ctrl->setParameterByClass(strtolower($classname), 
"q_id", 
$_GET[
"q_id"]);
 
  769            if ($rbacsystem->checkAccess(
'write', 
$_GET[
"ref_id"])) {
 
  773                    $this->ctrl->getLinkTargetByClass(
"ilAssQuestionPageGUI", 
"edit"),
 
  774                    array(
"edit", 
"insert", 
"exec_pg"),
 
  784        $force_active = 
false;
 
  785        if ($rbacsystem->checkAccess(
'write', 
$_GET[
"ref_id"])) {
 
  788                $url = $this->ctrl->getLinkTargetByClass($classname, 
"editQuestion");
 
  790            if (array_key_exists(
"imagemap_x", 
$_POST)) {
 
  791                $force_active = 
true;
 
  797                array(
"editQuestion", 
"save", 
"addArea", 
"addRect", 
"addCircle", 
"addPoly",
 
  798                     "uploadingImage", 
"uploadingImagemap", 
"areaEditor",
 
  799                     "saveShape", 
"saveEdit", 
"originalSyncForm"),
 
  819                $this->ctrl->getLinkTargetByClass($classname, 
"assessment"),
 
  831        if (!$this->object->feedbackOBJ->specificAnswerFeedbackExists(array_values($this->object->getAnswers()))) {
 
  835        $output = 
'<table class="test_specific_feedback"><tbody>';
 
  837        foreach ($this->object->getAnswers() as $idx => $answer) {
 
  838            $feedback = $this->
object->feedbackOBJ->getSpecificAnswerFeedbackTestPresentation(
 
  839                $this->object->getId(),
 
  843            $output .= 
"<tr><td>{$answer->getAnswerText()}</td><td>{$feedback}</td></tr>";
 
  848        return $this->
object->prepareTextareaOutput(
$output, 
true);
 
  881        $tpl = 
new ilTemplate(
'tpl.il_as_aggregated_answers_table.html', 
true, 
true, 
"Modules/TestQuestionPool");
 
  883        $tpl->setCurrentBlock(
'headercell');
 
  884        $tpl->setVariable(
'HEADER', $this->lng->txt(
'tst_answer_aggr_answer_header'));
 
  885        $tpl->parseCurrentBlock();
 
  887        $tpl->setCurrentBlock(
'headercell');
 
  888        $tpl->setVariable(
'HEADER', $this->lng->txt(
'tst_answer_aggr_frequency_header'));
 
  889        $tpl->parseCurrentBlock();
 
  891        foreach ($answeringFequencies as $answerIndex => $answeringFrequency) {
 
  892            $tpl->setCurrentBlock(
'aggregaterow');
 
  893            $tpl->setVariable(
'OPTION', $this->object->getAnswer($answerIndex)->getAnswerText());
 
  894            $tpl->setVariable(
'COUNT', $answeringFrequency);
 
  895            $tpl->parseCurrentBlock();
 
  903        $answeringFequencies = array();
 
  905        foreach ($existingAnswerOptions as $answerIndex => $answerOption) {
 
  906            $answeringFequencies[$answerIndex] = 0;
 
  909        foreach ($givenSolutionRows as $solutionRow) {
 
  910            $answeringFequencies[$solutionRow[
'value1']]++;
 
  913        return $answeringFequencies;
 
  933        if (!count($this->object->currentSolution)) {
 
  938        $button->setCaption(
'use_previous_solution');
 
  941            $this->ctrl->getLinkTargetByClass($this->getTargetGuiClass(), $this->getQuestionActionCmd()),
 
  942            $this->buildSelectionParameter($this->object->currentSolution, 
null)
 
  945        $tpl = 
new ilTemplate(
'tpl.tst_question_additional_behaviour_checkbox.html', 
true, 
true, 
'Modules/TestQuestionPool');
 
  946        $tpl->setVariable(
'BUTTON', $button->render());
 
An exception for terminatinating execution or to throw for unit testing.
Image map question GUI representation.
editQuestion(ilPropertyFormGUI $form=null)
populateQuestionSpecificFormPart(\ilPropertyFormGUI $form)
getSpecificFeedbackOutput($active_id, $pass)
Returns the answer specific feedback for the question.
getPreviousSolutionConfirmationCheckboxHtml()
saveShape()
Saves a shape of the area editor.
getAfterParticipationSuppressionAnswerPostVars()
Returns a list of postvars which will be suppressed in the form output when used in scoring adjustmen...
aggregateAnswers($givenSolutionRows, $existingAnswerOptions)
buildSelectionParameter($currentSelection, $areaIndex=null)
populateAnswerSpecificFormPart(\ilPropertyFormGUI $form)
writeAnswerSpecificPostData(ilPropertyFormGUI $form)
Extracts the answer specific values from $_POST and applies them to the data object.
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.
setQuestionTabs()
Sets the ILIAS tabs for this question type.
buildAreaLinkTarget($currentSelection, $areaIndex)
renderAggregateView($answeringFequencies)
__construct($id=-1)
assImagemapQuestionGUI constructor
writePostData($always=false)
{Evaluates a posted edit form and writes the form data in the question object.integer A positive valu...
getTestOutput($active_id, $pass, $is_postponed=false, $use_post_solutions=false, $show_feedback=false)
getAfterParticipationSuppressionQuestionPostVars()
Returns a list of postvars which will be suppressed in the form output when used in scoring adjustmen...
getPreview($show_question_only=false, $showInlineFeedback=false)
completeTestOutputFormAction($formAction, $active_id, $pass)
getAggregatedAnswersView($relevant_answers)
Returns an html string containing a question specific representation of the answers so far given in t...
writeQuestionSpecificPostData(ilPropertyFormGUI $form)
Extracts the question specific values from $_POST and applies them to the data object.
Class for image map questions.
const MODE_MULTIPLE_CHOICE
Basic GUI class for assessment questions.
populateTaxonomyFormSection(ilPropertyFormGUI $form)
addTab_QuestionHints(ilTabsGUI $tabs)
adds the hints tab to ilTabsGUI
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)
saveTaxonomyAssignments()
outQuestionPage($a_temp_var, $a_postponed=false, $active_id="", $html="")
output question page
buildBasicEditFormObject()
addBackTab(ilTabsGUI $ilTabs)
isTestPresentationContext()
hasCorrectSolution($activeId, $passIndex)
addTab_QuestionFeedback(ilTabsGUI $tabs)
adds the feedback tab to ilTabsGUI
addBasicQuestionFormProperties($form)
Add basic question form properties: assessment: title, author, description, question,...
addTab_QuestionPreview(ilTabsGUI $tabsGUI)
getAnswerFeedbackOutput($active_id, $pass)
Returns the answer generic feedback depending on the results of the question.
static implodeKeyValues($keyValues)
const CSS_CLASS_FEEDBACK_WRONG
const CSS_CLASS_FEEDBACK_CORRECT
Image map image preview creator.
static _getUsePreviousAnswers($active_id, $user_active_user_setting=false)
Returns if the previous results should be hidden for a learner.
static _getPass($active_id)
Retrieves the actual pass of a given user for a given test.
This class represents an option in a radio group.
special template class to simplify handling of ITX/PEAR
static appendUrlParameterString($a_url, $a_par, $xml_style=false)
append URL parameter string ("par1=value1&par2=value2...") to given URL string
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
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
static signFile($path_to_file)
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