24 include_once 
"./Modules/TestQuestionPool/classes/class.assQuestionGUI.php";
 
   25 include_once 
"./Modules/Test/classes/inc.AssessmentConstants.php";
 
   53                 include_once 
"./Modules/TestQuestionPool/classes/class.assOrderingQuestion.php";
 
   57                         $this->
object->loadFromDb($id);
 
   81                 $position = key(
$_POST[
"cmd"][
"addanswers"]);
 
   82                 $this->
object->addAnswer(
"", $position+1);
 
   89                 $position = key(
$_POST[
'cmd'][
'removeimageanswers']);
 
   91                 $this->
object->removeAnswerImage($position);
 
   98                 $position = key(
$_POST[
"cmd"][
"removeanswers"]);
 
   99                 $this->
object->deleteAnswer($position);
 
  106                 $position = key(
$_POST[
"cmd"][
"upanswers"]);
 
  107                 $this->
object->moveAnswerUp($position);
 
  114                 $position = key(
$_POST[
"cmd"][
"downanswers"]);
 
  115                 $this->
object->moveAnswerDown($position);
 
  124                 include_once 
"./Modules/TestQuestionPool/classes/class.ilImageWizardInputGUI.php";
 
  127                 $answers->setQuestionObject($this->
object);
 
  128                 $answers->setInfo($this->lng->txt(
'ordering_answer_sequence_info'));
 
  129                 $answers->setAllowMove(TRUE);
 
  130                 $answervalues = array();
 
  131                 foreach ($this->object->getAnswers() as $index => $answervalue)
 
  133                         $answervalues[$index] = $answervalue->getAnswertext();
 
  135                 $answers->setValues($answervalues);
 
  142                 if( !$inp->checkInput() )
 
  144                         $this->uploadAlert = $inp->getAlert();
 
  153                 return $this->ctrl->getCmd() == 
'uploadanswers';
 
  164                 $hasErrors = (!$always) ? $this->
editQuestion(
true) : 
false;
 
  167                         $this->
object->setTitle(
$_POST[
"title"]);
 
  168                         $this->
object->setAuthor(
$_POST[
"author"]);
 
  169                         $this->
object->setComment(
$_POST[
"comment"]);
 
  170                         include_once 
"./Services/AdvancedEditing/classes/class.ilObjAdvancedEditing.php";
 
  171                         $questiontext = 
$_POST[
"question"];
 
  172                         $this->
object->setQuestion($questiontext);
 
  173                         $this->
object->setThumbGeometry(
$_POST[
"thumb_geometry"]);
 
  174                         $this->
object->setElementHeight(
$_POST[
"element_height"]);
 
  177                                 $this->
object->setNrOfTries(
$_POST[
'nr_of_tries']);
 
  180                         $this->
object->setEstimatedWorkingTime(
 
  181                                 $_POST[
"Estimated"][
"hh"],
 
  182                                 $_POST[
"Estimated"][
"mm"],
 
  185                         $ordering_type = 
$_POST[
"ordering_type"];
 
  186                         $this->
object->setOrderingType($ordering_type);
 
  189                         $this->
object->flushAnswers();
 
  195                                 $answers = 
$_POST[
"answers"];
 
  196                                 if (is_array($answers))
 
  198                                         foreach ($answers as $index => $answer)
 
  204                                                 $this->
object->addAnswer($answer);
 
  210                                 foreach (array_keys(
$_POST[
'answers'][
'count']) as $index)
 
  214                                                 $this->
object->addAnswer(
"");
 
  218                                         $picturefile = 
$_POST[
'answers'][
'imagename'][$index];
 
  219                                         $file_org_name = $_FILES[
'answers'][
'name'][
'image'][$index];
 
  220                                         $file_temp_name = $_FILES[
'answers'][
'tmp_name'][
'image'][$index];                      
 
  223                                         if (strlen($file_temp_name))
 
  226                                                 $suffix = strtolower(array_pop(explode(
".", $file_org_name)));                                          
 
  227                                                 if(in_array($suffix, array(
"jpg", 
"jpeg", 
"png", 
"gif")))
 
  230                                                         $filename = $this->
object->createNewImageFileName($file_org_name);
 
  232                                                         if ($this->object->setImageFile($file_temp_name, 
$filename, $picturefile))
 
  239                                         $this->
object->addAnswer($picturefile);
 
  242                         $this->
object->setPoints(
$_POST[
"points"]);
 
  261                 include_once(
"./Services/Form/classes/class.ilPropertyFormGUI.php");
 
  262                 $orderingtype = (array_key_exists(
'ordering_type', 
$_POST)) ? 
$_POST[
'ordering_type'] : $this->object->getOrderingType();
 
  263                 if (strcmp($this->ctrl->getCmd(), 
'changeToText') == 0) $orderingtype = 
OQ_TERMS;
 
  264                 if (strcmp($this->ctrl->getCmd(), 
'changeToPictures') == 0) $orderingtype = 
OQ_PICTURES;
 
  266                 $form->setFormAction($this->ctrl->getFormAction($this));
 
  268                 $form->setMultipart(($orderingtype == 
OQ_PICTURES) ? TRUE : FALSE);
 
  269                 $form->setTableWidth(
"100%");
 
  270                 $form->setId(
"ordering");
 
  274                 $hidden->setValue($orderingtype);
 
  275                 $form->addItem($hidden);
 
  282                         $element_height = 
new ilNumberInputGUI($this->lng->txt(
"element_height"), 
"element_height");
 
  283                         $element_height->
setValue($this->object->getElementHeight());
 
  284                         $element_height->setRequired(
false);
 
  285                         $element_height->setMaxLength(6);
 
  286                         $element_height->setMinValue(20);
 
  287                         $element_height->setSize(6);
 
  288                         $element_height->setInfo($this->lng->txt(
"element_height_info"));
 
  289                         $form->addItem($element_height);
 
  294                         $geometry = 
new ilNumberInputGUI($this->lng->txt(
"thumb_geometry"), 
"thumb_geometry");
 
  295                         $geometry->
setValue($this->object->getThumbGeometry());
 
  296                         $geometry->setRequired(
true);
 
  297                         $geometry->setMaxLength(6);
 
  298                         $geometry->setMinValue(20);
 
  299                         $geometry->setSize(6);
 
  300                         $geometry->setInfo($this->lng->txt(
"thumb_geometry_info"));
 
  301                         $form->addItem($geometry);
 
  303                 if (count($this->object->getAnswers()) == 0)
 
  305                         $this->
object->addAnswer();
 
  311                         if( $this->uploadAlert !== null )
 
  313                                 $answerImageUpload->setAlert($this->uploadAlert);
 
  315                         $form->addItem($answerImageUpload);
 
  321                         $answers->setInfo($this->lng->txt(
'ordering_answer_sequence_info'));
 
  322                         $answers->setAllowMove(TRUE);
 
  323                         $answervalues = array();
 
  324                         foreach ($this->object->getAnswers() as $index => $answervalue)
 
  326                                 $answervalues[$index] = $answervalue->getAnswertext();
 
  328                         ksort($answervalues);
 
  329                         $answers->setValues($answervalues);
 
  330                         $form->addItem($answers);
 
  335                 $points->setValue($this->object->getPoints());
 
  336                 $points->setRequired(TRUE);
 
  338                 $points->setMinValue(0);
 
  339                 $points->setMinvalueShouldBeGreater(
true);
 
  340                 $form->addItem($points);
 
  346                                 $form->addCommandButton(
"changeToText", $this->lng->txt(
"order_terms"));
 
  350                                 $form->addCommandButton(
"changeToPictures", $this->lng->txt(
"order_pictures"));
 
  360                         $form->setValuesByPost();
 
  361                         $errors = !$form->checkInput();
 
  362                         $form->setValuesByPost(); 
 
  363                         if (
$errors) $checkonly = 
false;
 
  366                 if (!$checkonly) $this->tpl->setVariable(
"QUESTION_DATA", $form->getHTML());
 
  372                 $test_output = $this->
getTestOutput($active_id, 
$pass, $is_postponed, $user_post_solution);
 
  373                 $this->tpl->setVariable(
"QUESTION_OUTPUT", $test_output);
 
  374                 $this->tpl->setVariable(
"FORMACTION", $formaction);
 
  393                 $graphicalOutput = FALSE,
 
  394                 $result_output = FALSE,
 
  395                 $show_question_only = TRUE,
 
  396                 $show_feedback = FALSE,
 
  397                 $show_correct_solution = FALSE,
 
  398                 $show_manual_scoring = FALSE,
 
  399                 $show_question_text = TRUE
 
  403                 $keys = array_keys($this->object->answers);
 
  406                 include_once 
"./Services/UICore/classes/class.ilTemplate.php";
 
  407                 $template = 
new ilTemplate(
"tpl.il_as_qpl_ordering_output_solution.html", TRUE, TRUE, 
"Modules/TestQuestionPool");
 
  408                 $solutiontemplate = 
new ilTemplate(
"tpl.il_as_tst_solution_output.html",TRUE, TRUE, 
"Modules/TestQuestionPool");
 
  411                 $solutions = array();
 
  412                 if (($active_id > 0) && (!$show_correct_solution))
 
  414                         $solutions =& $this->
object->getSolutionValues($active_id, 
$pass);
 
  418                         foreach ($this->object->answers as $index => $answer)
 
  420                                 array_push($solutions, array(
"value1" => $index, 
"value2" => $index+1));
 
  423                 foreach ($keys as $idx)
 
  425                         $answer = $this->
object->answers[$idx];
 
  426                         if (($active_id > 0) && (!$show_correct_solution))
 
  428                                 if ($graphicalOutput)
 
  431                                         foreach ($solutions as $solution)
 
  433                                                 $sol[$solution[
"value1"]] = $solution[
"value2"];
 
  436                                         $sol = array_keys($sol);
 
  438                                         foreach ($this->object->answers as $k => $a)
 
  443                                         $ans = array_keys($ans);
 
  445                                         foreach ($ans as $arr_idx => $ans_idx)
 
  447                                                 if ($ans_idx == $idx)
 
  449                                                         if ($ans_idx == $sol[$arr_idx])
 
  458                                                 $template->setCurrentBlock(
"icon_ok");
 
  460                                                 $template->setVariable(
"TEXT_OK", $this->lng->txt(
"answer_is_right"));
 
  461                                                 $template->parseCurrentBlock();
 
  465                                                 $template->setCurrentBlock(
"icon_ok");
 
  467                                                 $template->setVariable(
"TEXT_NOT_OK", $this->lng->txt(
"answer_is_wrong"));
 
  468                                                 $template->parseCurrentBlock();
 
  472                         if ($this->object->getOrderingType() == 
OQ_PICTURES)
 
  474                                 $template->setCurrentBlock(
"ordering_row_standard_pictures");
 
  475                                 $thumbweb = $this->
object->getImagePathWeb() . $this->
object->getThumbPrefix() . $answer->getAnswertext();
 
  476                                 $thumb = $this->
object->getImagePath() . $this->
object->getThumbPrefix() . $answer->getAnswertext();
 
  477                                 if (!@file_exists($thumb)) $this->
object->rebuildThumbnails();
 
  478                                 $template->setVariable(
"THUMB_HREF", $thumbweb);
 
  479                                 list($width, $height, $type, $attr) = getimagesize($thumb);
 
  480                                 $template->setVariable(
"ATTR", $attr);
 
  481                                 $template->setVariable(
"THUMB_ALT", $this->lng->txt(
"thumbnail"));
 
  482                                 $template->setVariable(
"THUMB_TITLE", $this->lng->txt(
"enlarge"));
 
  483                                 $template->parseCurrentBlock();
 
  487                                 $template->setCurrentBlock(
"ordering_row_standard_text");
 
  488                                 $template->setVariable(
"ANSWER_TEXT", $this->object->prepareTextareaOutput($answer->getAnswertext(), TRUE));
 
  489                                 $template->parseCurrentBlock();
 
  491                         $template->setCurrentBlock(
"ordering_row_standard");
 
  494                                 $answer = $this->
object->answers[$idx];
 
  495                                 $points = $answer->getPoints();
 
  496                                 $resulttext = ($points == 1) ? 
"(%s " . $this->lng->txt(
"point") . 
")" : 
"(%s " . $this->lng->txt(
"points") . 
")"; 
 
  497                                 $template->setVariable(
"RESULT_OUTPUT", sprintf($resulttext, $points));
 
  499                         foreach ($solutions as $solution)
 
  501                                 if (strcmp($solution[
"value1"], $idx) == 0)
 
  503                                         $template->setVariable(
"ANSWER_ORDER", $solution[
"value2"]);
 
  506                         $template->parseCurrentBlock();
 
  508                 $questiontext = $this->
object->getQuestion();
 
  509                 if ($show_question_text==
true)
 
  511                         $template->setVariable(
"QUESTIONTEXT", $this->object->prepareTextareaOutput($questiontext, TRUE));
 
  513                 $questionoutput = $template->get();
 
  515                 if (strlen($feedback)) $solutiontemplate->setVariable(
"FEEDBACK", $this->object->prepareTextareaOutput($feedback, 
true));
 
  516                 $solutiontemplate->setVariable(
"SOLUTION_OUTPUT", $questionoutput);
 
  518                 $solutionoutput = $solutiontemplate->get(); 
 
  519                 if (!$show_question_only)
 
  522                         $solutionoutput = 
'<div class="ilc_question_Standard">'.$solutionoutput.
"</div>";
 
  524                 return $solutionoutput;
 
  532                 $keys = array_keys($this->object->answers);
 
  536                 include_once 
"./Services/UICore/classes/class.ilTemplate.php";
 
  537                 $template = 
new ilTemplate(
"tpl.il_as_qpl_ordering_output.html", TRUE, TRUE, 
"Modules/TestQuestionPool");
 
  540                 if (strcmp($this->ctrl->getCmd(), 
'preview') == 0)
 
  542                         if (array_key_exists(
'js', 
$_GET))
 
  544                                 $ilUser->writePref(
'tst_javascript', 
$_GET[
'js']);
 
  546                         $jstemplate = 
new ilTemplate(
"tpl.il_as_qpl_javascript_switch.html", TRUE, TRUE, 
"Modules/TestQuestionPool");
 
  547                         if ($ilUser->getPref(
"tst_javascript") == 1)
 
  550                                 $jstemplate->setVariable(
"JAVASCRIPT_IMAGE_ALT", $this->lng->txt(
"disable_javascript"));
 
  551                                 $jstemplate->setVariable(
"JAVASCRIPT_IMAGE_TITLE", $this->lng->txt(
"disable_javascript"));
 
  552                                 $this->ctrl->setParameterByClass($this->ctrl->getCmdClass(), 
"js", 
"0");
 
  553                                 $jstemplate->setVariable(
"JAVASCRIPT_URL", $this->ctrl->getLinkTargetByClass($this->ctrl->getCmdClass(), $this->ctrl->getCmd()));
 
  558                                 $jstemplate->setVariable(
"JAVASCRIPT_IMAGE_ALT", $this->lng->txt(
"enable_javascript"));
 
  559                                 $jstemplate->setVariable(
"JAVASCRIPT_IMAGE_TITLE", $this->lng->txt(
"enable_javascript"));
 
  560                                 $this->ctrl->setParameterByClass($this->ctrl->getCmdClass(), 
"js", 
"1");
 
  561                                 $jstemplate->setVariable(
"JAVASCRIPT_URL", $this->ctrl->getLinkTargetByClass($this->ctrl->getCmdClass(), $this->ctrl->getCmd()));
 
  563                         $jsswitch = $jstemplate->get();
 
  564                         if ($ilUser->getPref(
'tst_javascript')) $this->object->setOutputType(
OUTPUT_JAVASCRIPT);
 
  570                         $this->tpl->addBlockFile(
"CONTENT_BLOCK", 
"head_content", 
"tpl.il_as_qpl_ordering_output_javascript.html", 
"Modules/TestQuestionPool");
 
  571                         $this->tpl->setCurrentBlock(
"head_content");
 
  572                         $this->tpl->setVariable(
"JS_LOCATION", 
"./Modules/TestQuestionPool/js/toolman/");
 
  573                         $this->tpl->parseCurrentBlock();
 
  577                         $this->tpl->setCurrentBlock(
"AdditionalStyle");
 
  578                         $this->tpl->setVariable(
"LOCATION_ADDITIONAL_STYLESHEET", 
ilUtil::getStyleSheetLocation(
"output", 
"test_javascript.css", 
"Modules/TestQuestionPool"));
 
  579                         $this->tpl->parseCurrentBlock();
 
  585                         foreach ($keys as $idx)
 
  587                                 $answer = $this->
object->answers[$idx];
 
  588                                 if ($this->object->getOrderingType() == 
OQ_PICTURES)
 
  590                                         $template->setCurrentBlock(
"ordering_row_standard_pictures");
 
  591                                         $template->setVariable(
"PICTURE_HREF", $this->object->getImagePathWeb() . $answer->getAnswertext());
 
  592                                         $thumbweb = $this->
object->getImagePathWeb() . $this->
object->getThumbPrefix() . $answer->getAnswertext();
 
  593                                         $thumb = $this->
object->getImagePath() . $this->
object->getThumbPrefix() . $answer->getAnswertext();
 
  594                                         if (!@file_exists($thumb)) $this->
object->rebuildThumbnails();
 
  595                                         $template->setVariable(
"THUMB_HREF", $thumbweb);
 
  596                                         $template->setVariable(
"THUMB_ALT", $this->lng->txt(
"thumbnail"));
 
  597                                         $template->setVariable(
"THUMB_TITLE", $this->lng->txt(
"enlarge"));
 
  598                                         $template->setVariable(
"ANSWER_ID", $answer->getRandomID());
 
  599                                         $template->parseCurrentBlock();
 
  603                                         $template->setCurrentBlock(
"ordering_row_standard_text");
 
  604                                         $template->setVariable(
"ANSWER_TEXT", $this->object->prepareTextareaOutput($answer->getAnswertext(), TRUE));
 
  605                                         $template->setVariable(
"ANSWER_ID", $answer->getRandomID());
 
  606                                         $template->parseCurrentBlock();
 
  608                                 $template->setCurrentBlock(
"ordering_row_standard");
 
  609                                 $template->setVariable(
"ANSWER_ID", $answer->getRandomID());
 
  610                                 $template->parseCurrentBlock();
 
  615                         foreach ($keys as $idx)
 
  617                                 $answer = $this->
object->answers[$idx];
 
  618                                 if ($this->object->getOrderingType() == 
OQ_PICTURES)
 
  620                                         $template->setCurrentBlock(
"ordering_row_javascript_pictures");
 
  621                                         $template->setVariable(
"PICTURE_HREF", $this->object->getImagePathWeb() . $answer->getAnswertext());
 
  622                                         $thumbweb = $this->
object->getImagePathWeb() . $this->
object->getThumbPrefix() . $answer->getAnswertext();
 
  623                                         $thumb = $this->
object->getImagePath() . $this->
object->getThumbPrefix() . $answer->getAnswertext();
 
  624                                         if (!@file_exists($thumb)) $this->
object->rebuildThumbnails();
 
  625                                         $template->setVariable(
"THUMB_HREF", $thumbweb);
 
  626                                         $template->setVariable(
"THUMB_ALT", $this->lng->txt(
"thumbnail"));
 
  627                                         $template->setVariable(
"THUMB_TITLE", $this->lng->txt(
"thumbnail"));
 
  629                                         $template->setVariable(
"ENLARGE_ALT", $this->lng->txt(
"enlarge"));
 
  630                                         $template->setVariable(
"ENLARGE_TITLE", $this->lng->txt(
"enlarge"));
 
  631                                         $template->setVariable(
"ANSWER_ID", $answer->getRandomID());
 
  632                                         $template->parseCurrentBlock();
 
  636                                         $template->setCurrentBlock(
"ordering_row_javascript_text");
 
  637                                         $template->setVariable(
"ANSWER_TEXT", $this->object->prepareTextareaOutput($answer->getAnswertext(), TRUE));
 
  638                                         $template->setVariable(
"ANSWER_ID", $answer->getRandomID());
 
  639                                         $template->parseCurrentBlock();
 
  642                         $template->setCurrentBlock(
"ordering_with_javascript");
 
  643                         if ($this->object->getOrderingType() == 
OQ_PICTURES)
 
  645                                 $template->setVariable(
"RESET_POSITIONS", $this->lng->txt(
"reset_pictures"));
 
  649                                 $template->setVariable(
"RESET_POSITIONS", $this->lng->txt(
"reset_definitions"));
 
  651                         $template->parseCurrentBlock();
 
  653                 $questiontext = $this->
object->getQuestion();
 
  654                 $template->setVariable(
"QUESTIONTEXT", $this->object->prepareTextareaOutput($questiontext, TRUE));
 
  655                 $questionoutput = $jsswitch . $template->get();
 
  656                 if (!$show_question_only)
 
  661                 return $questionoutput;
 
  668                 if (is_array($user_post_solution))
 
  674                         $keys = array_keys($this->object->answers);
 
  680                 include_once 
"./Services/UICore/classes/class.ilTemplate.php";
 
  682                 $template = 
new ilTemplate(
"tpl.il_as_qpl_ordering_output.html", TRUE, TRUE, 
"Modules/TestQuestionPool");
 
  686                         $this->tpl->addBlockFile(
"CONTENT_BLOCK", 
"head_content", 
"tpl.il_as_qpl_ordering_output_javascript.html", 
"Modules/TestQuestionPool");
 
  687                         $this->tpl->setCurrentBlock(
"head_content");
 
  688                         $this->tpl->setVariable(
"JS_LOCATION", 
"./Modules/TestQuestionPool/js/toolman/");
 
  689                         $this->tpl->parseCurrentBlock();
 
  693                         $this->tpl->setCurrentBlock(
"AdditionalStyle");
 
  694                         $this->tpl->setVariable(
"LOCATION_ADDITIONAL_STYLESHEET", 
ilUtil::getStyleSheetLocation(
"output", 
"test_javascript.css", 
"Modules/TestQuestionPool"));
 
  695                         $this->tpl->parseCurrentBlock();
 
  699                         $this->tpl->setVariable(
"ON_SUBMIT", 
"return saveOrder('orderlist');");
 
  707                         include_once 
"./Modules/Test/classes/class.ilObjTest.php";
 
  712                         if (is_array($user_post_solution)) 
 
  714                                 $solutions = array();
 
  715                                 foreach ($user_post_solution as $key => $value)
 
  717                                         if (preg_match(
"/order_(\d+)/", $key, $matches))
 
  719                                                 foreach ($this->object->getAnswers() as $answeridx => $answer)
 
  721                                                         if ($answer->getRandomID() == $matches[1])
 
  723                                                                 array_push($solutions, array(
"value1" => $answeridx, 
"value2" => $value));
 
  731                                 $solutions =& $this->
object->getSolutionValues($active_id, 
$pass);
 
  736                                 $solution_script .= 
"";
 
  737                                 $jssolutions = array();
 
  738                                 foreach ($solutions as $idx => $solution_value)
 
  740                                         if ((strcmp($solution_value[
"value2"], 
"") != 0) && (strcmp($solution_value[
"value1"], 
"") != 0))
 
  742                                                 $jssolutions[$solution_value[
"value2"]] = $solution_value[
"value1"];
 
  745                                 if (count($jssolutions))
 
  749                                         foreach ($jssolutions as $key => $value)
 
  751                                                 if (is_object($this->object->getAnswer($value)))
 
  753                                                         $js .= 
"initialorder.push('id_" . $this->
object->getAnswer($value)->getRandomID() . 
"');";
 
  756                                         $js .= 
"restoreInitialOrder();";
 
  760                                         $template->setCurrentBlock(
"javascript_restore_order");
 
  761                                         $template->setVariable(
"RESTORE_ORDER", $js);
 
  762                                         $template->parseCurrentBlock();
 
  769                         foreach ($keys as $idx)
 
  771                                 $answer = $this->
object->answers[$idx];
 
  772                                 if ($this->object->getOrderingType() == 
OQ_PICTURES)
 
  774                                         $template->setCurrentBlock(
"ordering_row_standard_pictures");
 
  775                                         $template->setVariable(
"PICTURE_HREF", $this->object->getImagePathWeb() . $answer->getAnswertext());
 
  776                                         $thumbweb = $this->
object->getImagePathWeb() . $this->
object->getThumbPrefix() . $answer->getAnswertext();
 
  777                                         $thumb = $this->
object->getImagePath() . $this->
object->getThumbPrefix() . $answer->getAnswertext();
 
  778                                         if (!@file_exists($thumb)) $this->
object->rebuildThumbnails();
 
  779                                         $template->setVariable(
"THUMB_HREF", $thumbweb);
 
  780                                         $template->setVariable(
"THUMB_ALT", $this->lng->txt(
"thumbnail"));
 
  781                                         $template->setVariable(
"THUMB_TITLE", $this->lng->txt(
"enlarge"));
 
  782                                         $template->setVariable(
"ANSWER_ID", $answer->getRandomID());
 
  783                                         $template->parseCurrentBlock();
 
  787                                         $template->setCurrentBlock(
"ordering_row_standard_text");
 
  788                                         $template->setVariable(
"ANSWER_TEXT", $this->object->prepareTextareaOutput($answer->getAnswertext(), TRUE));
 
  789                                         $template->setVariable(
"ANSWER_ID", $answer->getRandomID());
 
  790                                         $template->parseCurrentBlock();
 
  792                                 $template->setCurrentBlock(
"ordering_row_standard");
 
  793                                 $template->setVariable(
"ANSWER_ID", $answer->getRandomID());
 
  794                                 if (is_array($solutions))
 
  796                                         foreach ($solutions as $solution)
 
  798                                                 if (($solution[
"value1"] == $idx) && (strlen($solution[
"value2"])))
 
  800                                                         $template->setVariable(
"ANSWER_ORDER", 
" value=\"" . $solution[
"value2"] . 
"\"");
 
  804                                 $template->parseCurrentBlock();
 
  809                         foreach ($keys as $idx)
 
  811                                 $answer = $this->
object->answers[$idx];
 
  812                                 if ($this->object->getOrderingType() == 
OQ_PICTURES)
 
  814                                         $template->setCurrentBlock(
"ordering_row_javascript_pictures");
 
  815                                         $template->setVariable(
"PICTURE_HREF", $this->object->getImagePathWeb() . $answer->getAnswertext());
 
  816                                         $thumbweb = $this->
object->getImagePathWeb() . $this->
object->getThumbPrefix() . $answer->getAnswertext();
 
  817                                         $thumb = $this->
object->getImagePath() . $this->
object->getThumbPrefix() . $answer->getAnswertext();
 
  818                                         if (!@file_exists($thumb)) $this->
object->rebuildThumbnails();
 
  819                                         $template->setVariable(
"THUMB_HREF", $thumbweb);
 
  820                                         $template->setVariable(
"THUMB_ALT", $this->lng->txt(
"thumbnail"));
 
  821                                         $template->setVariable(
"THUMB_TITLE", $this->lng->txt(
"thumbnail"));
 
  823                                         $template->setVariable(
"ENLARGE_ALT", $this->lng->txt(
"enlarge"));
 
  824                                         $template->setVariable(
"ENLARGE_TITLE", $this->lng->txt(
"enlarge"));
 
  825                                         $template->setVariable(
"ANSWER_ID", $answer->getRandomID());
 
  826                                         $template->parseCurrentBlock();
 
  830                                         $template->setCurrentBlock(
"ordering_row_javascript_text");
 
  831                                         $template->setVariable(
"ANSWER_TEXT", $this->object->prepareTextareaOutput($answer->getAnswertext(), TRUE));
 
  832                                         $template->setVariable(
"ANSWER_ID", $answer->getRandomID());
 
  833                                         $template->parseCurrentBlock();
 
  836                         $template->setCurrentBlock(
"ordering_with_javascript");
 
  837                         if ($this->object->getOrderingType() == 
OQ_PICTURES)
 
  839                                 $template->setVariable(
"RESET_POSITIONS", $this->lng->txt(
"reset_pictures"));
 
  843                                 $template->setVariable(
"RESET_POSITIONS", $this->lng->txt(
"reset_definitions"));
 
  845                         $template->parseCurrentBlock();
 
  847                 $questiontext = $this->
object->getQuestion();
 
  848                 $template->setVariable(
"QUESTIONTEXT", $this->object->prepareTextareaOutput($questiontext, TRUE));
 
  849                 $questionoutput = $template->get();
 
  850                 $pageoutput = $this->
outQuestionPage(
"", $is_postponed, $active_id, $questionoutput);
 
  861                 include_once 
"./Services/AdvancedEditing/classes/class.ilObjAdvancedEditing.php";
 
  863                 $this->
object->saveFeedbackGeneric(0, 
$_POST[
"feedback_incomplete"]);
 
  864                 $this->
object->saveFeedbackGeneric(1, 
$_POST[
"feedback_complete"]);
 
  865                 $this->
object->cleanupMediaObjectUsage();
 
  878                 global $rbacsystem, $ilTabs;
 
  880                 $this->ctrl->setParameterByClass(
"ilpageobjectgui", 
"q_id", 
$_GET[
"q_id"]);
 
  881                 include_once 
"./Modules/TestQuestionPool/classes/class.assQuestion.php";
 
  882                 $q_type = $this->
object->getQuestionType();
 
  886                         $classname = $q_type . 
"GUI";
 
  887                         $this->ctrl->setParameterByClass(strtolower($classname), 
"sel_question_types", $q_type);
 
  888                         $this->ctrl->setParameterByClass(strtolower($classname), 
"q_id", 
$_GET[
"q_id"]);
 
  893                         if ($rbacsystem->checkAccess(
'write', 
$_GET[
"ref_id"]))
 
  896                                 $ilTabs->addTarget(
"edit_page",
 
  897                                         $this->ctrl->getLinkTargetByClass(
"ilPageObjectGUI", 
"edit"),
 
  898                                         array(
"edit", 
"insert", 
"exec_pg"),
 
  899                                         "", 
"", $force_active);
 
  903                         $ilTabs->addTarget(
"preview",
 
  904                                 $this->ctrl->getLinkTargetByClass(
"ilPageObjectGUI", 
"preview"),
 
  906                                 "ilPageObjectGUI", 
"", $force_active);
 
  909                 $force_active = 
false;
 
  910                 if ($rbacsystem->checkAccess(
'write', 
$_GET[
"ref_id"]))
 
  913                         if ($classname) $url = $this->ctrl->getLinkTargetByClass($classname, 
"editQuestion");
 
  914                         $commands = 
$_POST[
"cmd"];
 
  915                         if (is_array($commands))
 
  917                                 foreach ($commands as $key => $value)
 
  919                                         if (preg_match(
"/^delete_.*/", $key, $matches))
 
  921                                                 $force_active = 
true;
 
  926                         $ilTabs->addTarget(
"edit_question",
 
  928                                 array(
"editQuestion", 
"save", 
"saveEdit", 
"addanswers", 
"removeanswers", 
"changeToPictures", 
"uploadanswers", 
"changeToText", 
"upanswers", 
"downanswers", 
"originalSyncForm"),
 
  929                                 $classname, 
"", $force_active);
 
  934                         $ilTabs->addTarget(
"feedback",
 
  935                                 $this->ctrl->getLinkTargetByClass($classname, 
"feedback"),
 
  936                                 array(
"feedback", 
"saveFeedback"),
 
  945                         $ilTabs->addTarget(
"solution_hint",
 
  946                                 $this->ctrl->getLinkTargetByClass($classname, 
"suggestedsolution"),
 
  947                                 array(
"suggestedsolution", 
"saveSuggestedSolution", 
"outSolutionExplorer", 
"cancel", 
 
  948                                 "addSuggestedSolution",
"cancelExplorer", 
"linkChilds", 
"removeSuggestedSolution" 
  958                         $ilTabs->addTarget(
"statistics",
 
  959                                 $this->ctrl->getLinkTargetByClass($classname, 
"assessment"),
 
  964                 if ((
$_GET[
"calling_test"] > 0) || (
$_GET[
"test_ref_id"] > 0))
 
  969                         global $___test_express_mode;
 
  971                         if (!
$_GET[
'test_express_mode'] && !$___test_express_mode) {
 
  972                             $ilTabs->setBackTarget($this->lng->txt(
"backtocallingtest"), 
"ilias.php?baseClass=ilObjTestGUI&cmd=questions&ref_id=$ref_id");
 
  976                             $ilTabs->setBackTarget($this->lng->txt(
"backtocallingtest"), $link);
 
  981                         $ilTabs->setBackTarget($this->lng->txt(
"qpl"), $this->ctrl->getLinkTargetByClass(
"ilobjquestionpoolgui", 
"questions"));
 
  988                 return $this->
object->prepareTextareaOutput($output, TRUE);