24 include_once 
"./Modules/TestQuestionPool/classes/class.assQuestionGUI.php";
 
   25 include_once 
"./Modules/Test/classes/inc.AssessmentConstants.php";
 
   51                 include_once 
"./Modules/TestQuestionPool/classes/class.assOrderingQuestion.php";
 
   55                         $this->
object->loadFromDb($id);
 
   79                 $position = key(
$_POST[
"cmd"][
"addanswers"]);
 
   80                 $this->
object->addAnswer(
"", $position+1);
 
   87                 $position = key(
$_POST[
'cmd'][
'removeimageanswers']);
 
   89                 $this->
object->removeAnswerImage($position);
 
   96                 $position = key(
$_POST[
"cmd"][
"removeanswers"]);
 
   97                 $this->
object->deleteAnswer($position);
 
  104                 $position = key(
$_POST[
"cmd"][
"upanswers"]);
 
  105                 $this->
object->moveAnswerUp($position);
 
  112                 $position = key(
$_POST[
"cmd"][
"downanswers"]);
 
  113                 $this->
object->moveAnswerDown($position);
 
  131                 $hasErrors = (!$always) ? $this->
editQuestion(
true) : 
false;
 
  134                         $this->
object->setTitle(
$_POST[
"title"]);
 
  135                         $this->
object->setAuthor(
$_POST[
"author"]);
 
  136                         $this->
object->setComment(
$_POST[
"comment"]);
 
  137                         include_once 
"./Services/AdvancedEditing/classes/class.ilObjAdvancedEditing.php";
 
  138                         $questiontext = 
$_POST[
"question"];
 
  139                         $this->
object->setQuestion($questiontext);
 
  140                         $this->
object->setThumbGeometry(
$_POST[
"thumb_geometry"]);
 
  141                         $this->
object->setElementHeight(
$_POST[
"element_height"]);
 
  144                                 $this->
object->setNrOfTries(
$_POST[
'nr_of_tries']);
 
  147                         $this->
object->setEstimatedWorkingTime(
 
  148                                 $_POST[
"Estimated"][
"hh"],
 
  149                                 $_POST[
"Estimated"][
"mm"],
 
  152                         $ordering_type = 
$_POST[
"ordering_type"];
 
  153                         $this->
object->setOrderingType($ordering_type);
 
  156                         $this->
object->flushAnswers();
 
  162                                 $answers = 
$_POST[
"answers"];
 
  163                                 if (is_array($answers))
 
  165                                         foreach ($answers as $index => $answer)
 
  167                                                 $this->
object->addAnswer($answer);
 
  173                                 foreach (
$_POST[
'answers'][
'count'] as $index => $dummy)
 
  176                                         if (strlen($_FILES[
'answers'][
'name'][
'image'][$index]))
 
  179                                                 $filename = $this->
object->createNewImageFileName($_FILES[
'answers'][
'name'][
'image'][$index]);
 
  180                                                 if ($this->object->setImageFile($_FILES[
'answers'][
'tmp_name'][
'image'][$index], $this->object->getEncryptedFilename(
$filename), 
$_POST[
'answers'][
'']))
 
  182                                                         $picturefile = $this->
object->getEncryptedFilename(
$filename);
 
  188                                                 $this->
object->addAnswer($picturefile);
 
  192                                                 $this->
object->addAnswer(
$_POST[
'answers'][
'imagename'][$index]);
 
  196                         $this->
object->setPoints(
$_POST[
"points"]);
 
  212                 $save = ((strcmp($this->ctrl->getCmd(), 
"save") == 0) || (strcmp($this->ctrl->getCmd(), 
"saveEdit") == 0)) ? TRUE : FALSE;
 
  215                 include_once(
"./Services/Form/classes/class.ilPropertyFormGUI.php");
 
  216                 $orderingtype = (array_key_exists(
'ordering_type', 
$_POST)) ? 
$_POST[
'ordering_type'] : $this->object->getOrderingType();
 
  217                 if (strcmp($this->ctrl->getCmd(), 
'changeToText') == 0) $orderingtype = 
OQ_TERMS;
 
  218                 if (strcmp($this->ctrl->getCmd(), 
'changeToPictures') == 0) $orderingtype = 
OQ_PICTURES;
 
  220                 $form->setFormAction($this->ctrl->getFormAction($this));
 
  222                 $form->setMultipart(($orderingtype == 
OQ_PICTURES) ? TRUE : FALSE);
 
  223                 $form->setTableWidth(
"100%");
 
  224                 $form->setId(
"ordering");
 
  228                 $hidden->setValue($orderingtype);
 
  229                 $form->addItem($hidden);
 
  236                         $element_height = 
new ilNumberInputGUI($this->lng->txt(
"element_height"), 
"element_height");
 
  237                         $element_height->
setValue($this->object->getElementHeight());
 
  238                         $element_height->setRequired(
false);
 
  239                         $element_height->setMaxLength(6);
 
  240                         $element_height->setMinValue(20);
 
  241                         $element_height->setSize(6);
 
  242                         $element_height->setInfo($this->lng->txt(
"element_height_info"));
 
  243                         $form->addItem($element_height);
 
  248                         $geometry = 
new ilNumberInputGUI($this->lng->txt(
"thumb_geometry"), 
"thumb_geometry");
 
  249                         $geometry->
setValue($this->object->getThumbGeometry());
 
  250                         $geometry->setRequired(
true);
 
  251                         $geometry->setMaxLength(6);
 
  252                         $geometry->setMinValue(20);
 
  253                         $geometry->setSize(6);
 
  254                         $geometry->setInfo($this->lng->txt(
"thumb_geometry_info"));
 
  255                         $form->addItem($geometry);
 
  257                 if (count($this->object->getAnswers()) == 0)
 
  259                         $this->
object->addAnswer();
 
  264                         include_once 
"./Modules/TestQuestionPool/classes/class.ilImageWizardInputGUI.php";
 
  267                         $answers->setQuestionObject($this->
object);
 
  268                         $answers->setInfo($this->lng->txt(
'ordering_answer_sequence_info'));
 
  269                         $answers->setAllowMove(TRUE);
 
  270                         $answervalues = array();
 
  271                         foreach ($this->object->getAnswers() as $index => $answervalue)
 
  273                                 $answervalues[$index] = $answervalue->getAnswertext();
 
  275                         $answers->setValues($answervalues);
 
  276                         $form->addItem($answers);
 
  282                         $answers->setInfo($this->lng->txt(
'ordering_answer_sequence_info'));
 
  283                         $answers->setAllowMove(TRUE);
 
  284                         $answervalues = array();
 
  285                         foreach ($this->object->getAnswers() as $index => $answervalue)
 
  287                                 $answervalues[$index] = $answervalue->getAnswertext();
 
  289                         ksort($answervalues);
 
  290                         $answers->setValues($answervalues);
 
  291                         $form->addItem($answers);
 
  295                 $points->
setValue($this->object->getPoints());
 
  296                 $points->setRequired(TRUE);
 
  298                 $points->setMinValue(0);
 
  299                 $points->setMinvalueShouldBeGreater(
true);
 
  300                 $form->addItem($points);
 
  307                                 $form->addCommandButton(
"changeToText", $this->lng->txt(
"order_terms"));
 
  311                                 $form->addCommandButton(
"changeToPictures", $this->lng->txt(
"order_pictures"));
 
  319                         $form->setValuesByPost();
 
  320                         $errors = !$form->checkInput();
 
  321                         $form->setValuesByPost(); 
 
  322                         if (
$errors) $checkonly = 
false;
 
  325                 if (!$checkonly) $this->tpl->setVariable(
"QUESTION_DATA", $form->getHTML());
 
  331                 $test_output = $this->
getTestOutput($active_id, 
$pass, $is_postponed, $user_post_solution);
 
  332                 $this->tpl->setVariable(
"QUESTION_OUTPUT", $test_output);
 
  333                 $this->tpl->setVariable(
"FORMACTION", $formaction);
 
  352                 $graphicalOutput = FALSE,
 
  353                 $result_output = FALSE,
 
  354                 $show_question_only = TRUE,
 
  355                 $show_feedback = FALSE,
 
  356                 $show_correct_solution = FALSE,
 
  357                 $show_manual_scoring = FALSE
 
  361                 $keys = array_keys($this->object->answers);
 
  364                 include_once 
"./classes/class.ilTemplate.php";
 
  365                 $template = 
new ilTemplate(
"tpl.il_as_qpl_ordering_output_solution.html", TRUE, TRUE, 
"Modules/TestQuestionPool");
 
  366                 $solutiontemplate = 
new ilTemplate(
"tpl.il_as_tst_solution_output.html",TRUE, TRUE, 
"Modules/TestQuestionPool");
 
  369                 $solutions = array();
 
  370                 if (($active_id > 0) && (!$show_correct_solution))
 
  372                         $solutions =& $this->
object->getSolutionValues($active_id, 
$pass);
 
  376                         foreach ($this->object->answers as $index => $answer)
 
  378                                 array_push($solutions, array(
"value1" => $index, 
"value2" => $index+1));
 
  381                 foreach ($keys as $idx)
 
  383                         $answer = $this->
object->answers[$idx];
 
  384                         if (($active_id > 0) && (!$show_correct_solution))
 
  386                                 if ($graphicalOutput)
 
  389                                         foreach ($solutions as $solution)
 
  391                                                 $sol[$solution[
"value1"]] = $solution[
"value2"];
 
  394                                         $sol = array_keys($sol);
 
  396                                         foreach ($this->object->answers as $k => $a)
 
  401                                         $ans = array_keys($ans);
 
  403                                         foreach ($ans as $arr_idx => $ans_idx)
 
  405                                                 if ($ans_idx == $idx)
 
  407                                                         if ($ans_idx == $sol[$arr_idx])
 
  416                                                 $template->setCurrentBlock(
"icon_ok");
 
  418                                                 $template->setVariable(
"TEXT_OK", $this->lng->txt(
"answer_is_right"));
 
  419                                                 $template->parseCurrentBlock();
 
  423                                                 $template->setCurrentBlock(
"icon_ok");
 
  425                                                 $template->setVariable(
"TEXT_NOT_OK", $this->lng->txt(
"answer_is_wrong"));
 
  426                                                 $template->parseCurrentBlock();
 
  430                         if ($this->object->getOrderingType() == 
OQ_PICTURES)
 
  432                                 $template->setCurrentBlock(
"ordering_row_standard_pictures");
 
  433                                 $thumbweb = $this->
object->getImagePathWeb() . $this->
object->getThumbPrefix() . $answer->getAnswertext();
 
  434                                 $thumb = $this->
object->getImagePath() . $this->
object->getThumbPrefix() . $answer->getAnswertext();
 
  435                                 if (!@file_exists($thumb)) $this->
object->rebuildThumbnails();
 
  436                                 $template->setVariable(
"THUMB_HREF", $thumbweb);
 
  437                                 list($width, $height, $type, $attr) = getimagesize($thumb);
 
  438                                 $template->setVariable(
"ATTR", $attr);
 
  439                                 $template->setVariable(
"THUMB_ALT", $this->lng->txt(
"thumbnail"));
 
  440                                 $template->setVariable(
"THUMB_TITLE", $this->lng->txt(
"enlarge"));
 
  441                                 $template->parseCurrentBlock();
 
  445                                 $template->setCurrentBlock(
"ordering_row_standard_text");
 
  446                                 $template->setVariable(
"ANSWER_TEXT", $this->object->prepareTextareaOutput($answer->getAnswertext(), TRUE));
 
  447                                 $template->parseCurrentBlock();
 
  449                         $template->setCurrentBlock(
"ordering_row_standard");
 
  452                                 $answer = $this->
object->answers[$idx];
 
  453                                 $points = $answer->getPoints();
 
  454                                 $resulttext = ($points == 1) ? 
"(%s " . $this->lng->txt(
"point") . 
")" : 
"(%s " . $this->lng->txt(
"points") . 
")"; 
 
  455                                 $template->setVariable(
"RESULT_OUTPUT", sprintf($resulttext, $points));
 
  457                         foreach ($solutions as $solution)
 
  459                                 if (strcmp($solution[
"value1"], $idx) == 0)
 
  461                                         $template->setVariable(
"ANSWER_ORDER", $solution[
"value2"]);
 
  464                         $template->parseCurrentBlock();
 
  466                 $questiontext = $this->
object->getQuestion();
 
  467                 $template->setVariable(
"QUESTIONTEXT", $this->object->prepareTextareaOutput($questiontext, TRUE));
 
  468                 $questionoutput = $template->get();
 
  470                 if (strlen($feedback)) $solutiontemplate->setVariable(
"FEEDBACK", $feedback);
 
  471                 $solutiontemplate->setVariable(
"SOLUTION_OUTPUT", $questionoutput);
 
  473                 $solutionoutput = $solutiontemplate->get(); 
 
  474                 if (!$show_question_only)
 
  479                 return $solutionoutput;
 
  487                 $keys = array_keys($this->object->answers);
 
  491                 include_once 
"./classes/class.ilTemplate.php";
 
  492                 $template = 
new ilTemplate(
"tpl.il_as_qpl_ordering_output.html", TRUE, TRUE, 
"Modules/TestQuestionPool");
 
  495                 if (strcmp($this->ctrl->getCmd(), 
'preview') == 0)
 
  497                         if (array_key_exists(
'js', 
$_GET))
 
  499                                 $ilUser->writePref(
'tst_javascript', 
$_GET[
'js']);
 
  501                         $jstemplate = 
new ilTemplate(
"tpl.il_as_qpl_javascript_switch.html", TRUE, TRUE, 
"Modules/TestQuestionPool");
 
  502                         if ($ilUser->getPref(
"tst_javascript") == 1)
 
  505                                 $jstemplate->setVariable(
"JAVASCRIPT_IMAGE_ALT", $this->lng->txt(
"disable_javascript"));
 
  506                                 $jstemplate->setVariable(
"JAVASCRIPT_IMAGE_TITLE", $this->lng->txt(
"disable_javascript"));
 
  507                                 $this->ctrl->setParameterByClass($this->ctrl->getCmdClass(), 
"js", 
"0");
 
  508                                 $jstemplate->setVariable(
"JAVASCRIPT_URL", $this->ctrl->getLinkTargetByClass($this->ctrl->getCmdClass(), $this->ctrl->getCmd()));
 
  513                                 $jstemplate->setVariable(
"JAVASCRIPT_IMAGE_ALT", $this->lng->txt(
"enable_javascript"));
 
  514                                 $jstemplate->setVariable(
"JAVASCRIPT_IMAGE_TITLE", $this->lng->txt(
"enable_javascript"));
 
  515                                 $this->ctrl->setParameterByClass($this->ctrl->getCmdClass(), 
"js", 
"1");
 
  516                                 $jstemplate->setVariable(
"JAVASCRIPT_URL", $this->ctrl->getLinkTargetByClass($this->ctrl->getCmdClass(), $this->ctrl->getCmd()));
 
  518                         $jsswitch = $jstemplate->get();
 
  519                         if ($ilUser->getPref(
'tst_javascript')) $this->object->setOutputType(
OUTPUT_JAVASCRIPT);
 
  525                         $this->tpl->addBlockFile(
"CONTENT_BLOCK", 
"head_content", 
"tpl.il_as_qpl_ordering_output_javascript.html", 
"Modules/TestQuestionPool");
 
  526                         $this->tpl->setCurrentBlock(
"head_content");
 
  527                         $this->tpl->setVariable(
"JS_LOCATION", 
"./Modules/TestQuestionPool/js/toolman/");
 
  528                         $this->tpl->parseCurrentBlock();
 
  532                         $this->tpl->setCurrentBlock(
"AdditionalStyle");
 
  533                         $this->tpl->setVariable(
"LOCATION_ADDITIONAL_STYLESHEET", 
ilUtil::getStyleSheetLocation(
"output", 
"test_javascript.css", 
"Modules/TestQuestionPool"));
 
  534                         $this->tpl->parseCurrentBlock();
 
  540                         foreach ($keys as $idx)
 
  542                                 $answer = $this->
object->answers[$idx];
 
  543                                 if ($this->object->getOrderingType() == 
OQ_PICTURES)
 
  545                                         $template->setCurrentBlock(
"ordering_row_standard_pictures");
 
  546                                         $template->setVariable(
"PICTURE_HREF", $this->object->getImagePathWeb() . $answer->getAnswertext());
 
  547                                         $thumbweb = $this->
object->getImagePathWeb() . $this->
object->getThumbPrefix() . $answer->getAnswertext();
 
  548                                         $thumb = $this->
object->getImagePath() . $this->
object->getThumbPrefix() . $answer->getAnswertext();
 
  549                                         if (!@file_exists($thumb)) $this->
object->rebuildThumbnails();
 
  550                                         $template->setVariable(
"THUMB_HREF", $thumbweb);
 
  551                                         $template->setVariable(
"THUMB_ALT", $this->lng->txt(
"thumbnail"));
 
  552                                         $template->setVariable(
"THUMB_TITLE", $this->lng->txt(
"enlarge"));
 
  553                                         $template->setVariable(
"ANSWER_ID", $answer->getRandomID());
 
  554                                         $template->parseCurrentBlock();
 
  558                                         $template->setCurrentBlock(
"ordering_row_standard_text");
 
  559                                         $template->setVariable(
"ANSWER_TEXT", $this->object->prepareTextareaOutput($answer->getAnswertext(), TRUE));
 
  560                                         $template->setVariable(
"ANSWER_ID", $answer->getRandomID());
 
  561                                         $template->parseCurrentBlock();
 
  563                                 $template->setCurrentBlock(
"ordering_row_standard");
 
  564                                 $template->setVariable(
"ANSWER_ID", $answer->getRandomID());
 
  565                                 $template->parseCurrentBlock();
 
  570                         foreach ($keys as $idx)
 
  572                                 $answer = $this->
object->answers[$idx];
 
  573                                 if ($this->object->getOrderingType() == 
OQ_PICTURES)
 
  575                                         $template->setCurrentBlock(
"ordering_row_javascript_pictures");
 
  576                                         $template->setVariable(
"PICTURE_HREF", $this->object->getImagePathWeb() . $answer->getAnswertext());
 
  577                                         $thumbweb = $this->
object->getImagePathWeb() . $this->
object->getThumbPrefix() . $answer->getAnswertext();
 
  578                                         $thumb = $this->
object->getImagePath() . $this->
object->getThumbPrefix() . $answer->getAnswertext();
 
  579                                         if (!@file_exists($thumb)) $this->
object->rebuildThumbnails();
 
  580                                         $template->setVariable(
"THUMB_HREF", $thumbweb);
 
  581                                         $template->setVariable(
"THUMB_ALT", $this->lng->txt(
"thumbnail"));
 
  582                                         $template->setVariable(
"THUMB_TITLE", $this->lng->txt(
"thumbnail"));
 
  584                                         $template->setVariable(
"ENLARGE_ALT", $this->lng->txt(
"enlarge"));
 
  585                                         $template->setVariable(
"ENLARGE_TITLE", $this->lng->txt(
"enlarge"));
 
  586                                         $template->setVariable(
"ANSWER_ID", $answer->getRandomID());
 
  587                                         $template->parseCurrentBlock();
 
  591                                         $template->setCurrentBlock(
"ordering_row_javascript_text");
 
  592                                         $template->setVariable(
"ANSWER_TEXT", $this->object->prepareTextareaOutput($answer->getAnswertext(), TRUE));
 
  593                                         $template->setVariable(
"ANSWER_ID", $answer->getRandomID());
 
  594                                         $template->parseCurrentBlock();
 
  597                         $template->setCurrentBlock(
"ordering_with_javascript");
 
  598                         if ($this->object->getOrderingType() == 
OQ_PICTURES)
 
  600                                 $template->setVariable(
"RESET_POSITIONS", $this->lng->txt(
"reset_pictures"));
 
  604                                 $template->setVariable(
"RESET_POSITIONS", $this->lng->txt(
"reset_definitions"));
 
  606                         $template->parseCurrentBlock();
 
  608                 $questiontext = $this->
object->getQuestion();
 
  609                 $template->setVariable(
"QUESTIONTEXT", $this->object->prepareTextareaOutput($questiontext, TRUE));
 
  610                 $questionoutput = $jsswitch . $template->get();
 
  611                 if (!$show_question_only)
 
  616                 return $questionoutput;
 
  623                 if (is_array($user_post_solution))
 
  629                         $keys = array_keys($this->object->answers);
 
  635                 include_once 
"./classes/class.ilTemplate.php";
 
  637                 $template = 
new ilTemplate(
"tpl.il_as_qpl_ordering_output.html", TRUE, TRUE, 
"Modules/TestQuestionPool");
 
  641                         $this->tpl->addBlockFile(
"CONTENT_BLOCK", 
"head_content", 
"tpl.il_as_qpl_ordering_output_javascript.html", 
"Modules/TestQuestionPool");
 
  642                         $this->tpl->setCurrentBlock(
"head_content");
 
  643                         $this->tpl->setVariable(
"JS_LOCATION", 
"./Modules/TestQuestionPool/js/toolman/");
 
  644                         $this->tpl->parseCurrentBlock();
 
  648                         $this->tpl->setCurrentBlock(
"AdditionalStyle");
 
  649                         $this->tpl->setVariable(
"LOCATION_ADDITIONAL_STYLESHEET", 
ilUtil::getStyleSheetLocation(
"output", 
"test_javascript.css", 
"Modules/TestQuestionPool"));
 
  650                         $this->tpl->parseCurrentBlock();
 
  654                         $this->tpl->setVariable(
"ON_SUBMIT", 
"return saveOrder('orderlist');");
 
  662                         include_once 
"./Modules/Test/classes/class.ilObjTest.php";
 
  667                         if (is_array($user_post_solution)) 
 
  669                                 $solutions = array();
 
  670                                 foreach ($user_post_solution as $key => $value)
 
  672                                         if (preg_match(
"/order_(\d+)/", $key, $matches))
 
  674                                                 foreach ($this->object->getAnswers() as $answeridx => $answer)
 
  676                                                         if ($answer->getRandomID() == $matches[1])
 
  678                                                                 array_push($solutions, array(
"value1" => $answeridx, 
"value2" => $value));
 
  686                                 $solutions =& $this->
object->getSolutionValues($active_id, 
$pass);
 
  691                                 $solution_script .= 
"";
 
  692                                 $jssolutions = array();
 
  693                                 foreach ($solutions as $idx => $solution_value)
 
  695                                         if ((strcmp($solution_value[
"value2"], 
"") != 0) && (strcmp($solution_value[
"value1"], 
"") != 0))
 
  697                                                 $jssolutions[$solution_value[
"value2"]] = $solution_value[
"value1"];
 
  700                                 if (count($jssolutions))
 
  704                                         foreach ($jssolutions as $key => $value)
 
  706                                                 if (is_object($this->object->getAnswer($value)))
 
  708                                                         $js .= 
"initialorder.push('id_" . $this->
object->getAnswer($value)->getRandomID() . 
"');";
 
  711                                         $js .= 
"restoreInitialOrder();";
 
  715                                         $template->setCurrentBlock(
"javascript_restore_order");
 
  716                                         $template->setVariable(
"RESTORE_ORDER", $js);
 
  717                                         $template->parseCurrentBlock();
 
  724                         foreach ($keys as $idx)
 
  726                                 $answer = $this->
object->answers[$idx];
 
  727                                 if ($this->object->getOrderingType() == 
OQ_PICTURES)
 
  729                                         $template->setCurrentBlock(
"ordering_row_standard_pictures");
 
  730                                         $template->setVariable(
"PICTURE_HREF", $this->object->getImagePathWeb() . $answer->getAnswertext());
 
  731                                         $thumbweb = $this->
object->getImagePathWeb() . $this->
object->getThumbPrefix() . $answer->getAnswertext();
 
  732                                         $thumb = $this->
object->getImagePath() . $this->
object->getThumbPrefix() . $answer->getAnswertext();
 
  733                                         if (!@file_exists($thumb)) $this->
object->rebuildThumbnails();
 
  734                                         $template->setVariable(
"THUMB_HREF", $thumbweb);
 
  735                                         $template->setVariable(
"THUMB_ALT", $this->lng->txt(
"thumbnail"));
 
  736                                         $template->setVariable(
"THUMB_TITLE", $this->lng->txt(
"enlarge"));
 
  737                                         $template->setVariable(
"ANSWER_ID", $answer->getRandomID());
 
  738                                         $template->parseCurrentBlock();
 
  742                                         $template->setCurrentBlock(
"ordering_row_standard_text");
 
  743                                         $template->setVariable(
"ANSWER_TEXT", $this->object->prepareTextareaOutput($answer->getAnswertext(), TRUE));
 
  744                                         $template->setVariable(
"ANSWER_ID", $answer->getRandomID());
 
  745                                         $template->parseCurrentBlock();
 
  747                                 $template->setCurrentBlock(
"ordering_row_standard");
 
  748                                 $template->setVariable(
"ANSWER_ID", $answer->getRandomID());
 
  749                                 if (is_array($solutions))
 
  751                                         foreach ($solutions as $solution)
 
  753                                                 if (($solution[
"value1"] == $idx) && (strlen($solution[
"value2"])))
 
  755                                                         $template->setVariable(
"ANSWER_ORDER", 
" value=\"" . $solution[
"value2"] . 
"\"");
 
  759                                 $template->parseCurrentBlock();
 
  764                         foreach ($keys as $idx)
 
  766                                 $answer = $this->
object->answers[$idx];
 
  767                                 if ($this->object->getOrderingType() == 
OQ_PICTURES)
 
  769                                         $template->setCurrentBlock(
"ordering_row_javascript_pictures");
 
  770                                         $template->setVariable(
"PICTURE_HREF", $this->object->getImagePathWeb() . $answer->getAnswertext());
 
  771                                         $thumbweb = $this->
object->getImagePathWeb() . $this->
object->getThumbPrefix() . $answer->getAnswertext();
 
  772                                         $thumb = $this->
object->getImagePath() . $this->
object->getThumbPrefix() . $answer->getAnswertext();
 
  773                                         if (!@file_exists($thumb)) $this->
object->rebuildThumbnails();
 
  774                                         $template->setVariable(
"THUMB_HREF", $thumbweb);
 
  775                                         $template->setVariable(
"THUMB_ALT", $this->lng->txt(
"thumbnail"));
 
  776                                         $template->setVariable(
"THUMB_TITLE", $this->lng->txt(
"thumbnail"));
 
  778                                         $template->setVariable(
"ENLARGE_ALT", $this->lng->txt(
"enlarge"));
 
  779                                         $template->setVariable(
"ENLARGE_TITLE", $this->lng->txt(
"enlarge"));
 
  780                                         $template->setVariable(
"ANSWER_ID", $answer->getRandomID());
 
  781                                         $template->parseCurrentBlock();
 
  785                                         $template->setCurrentBlock(
"ordering_row_javascript_text");
 
  786                                         $template->setVariable(
"ANSWER_TEXT", $this->object->prepareTextareaOutput($answer->getAnswertext(), TRUE));
 
  787                                         $template->setVariable(
"ANSWER_ID", $answer->getRandomID());
 
  788                                         $template->parseCurrentBlock();
 
  791                         $template->setCurrentBlock(
"ordering_with_javascript");
 
  792                         if ($this->object->getOrderingType() == 
OQ_PICTURES)
 
  794                                 $template->setVariable(
"RESET_POSITIONS", $this->lng->txt(
"reset_pictures"));
 
  798                                 $template->setVariable(
"RESET_POSITIONS", $this->lng->txt(
"reset_definitions"));
 
  800                         $template->parseCurrentBlock();
 
  802                 $questiontext = $this->
object->getQuestion();
 
  803                 $template->setVariable(
"QUESTIONTEXT", $this->object->prepareTextareaOutput($questiontext, TRUE));
 
  804                 $questionoutput = $template->get();
 
  805                 $pageoutput = $this->
outQuestionPage(
"", $is_postponed, $active_id, $questionoutput);
 
  816                 include_once 
"./Services/AdvancedEditing/classes/class.ilObjAdvancedEditing.php";
 
  818                 $this->
object->saveFeedbackGeneric(0, 
$_POST[
"feedback_incomplete"]);
 
  819                 $this->
object->saveFeedbackGeneric(1, 
$_POST[
"feedback_complete"]);
 
  820                 $this->
object->cleanupMediaObjectUsage();
 
  831                 global $rbacsystem, $ilTabs;
 
  833                 $this->ctrl->setParameterByClass(
"ilpageobjectgui", 
"q_id", 
$_GET[
"q_id"]);
 
  834                 include_once 
"./Modules/TestQuestionPool/classes/class.assQuestion.php";
 
  835                 $q_type = $this->
object->getQuestionType();
 
  839                         $classname = $q_type . 
"GUI";
 
  840                         $this->ctrl->setParameterByClass(strtolower($classname), 
"sel_question_types", $q_type);
 
  841                         $this->ctrl->setParameterByClass(strtolower($classname), 
"q_id", 
$_GET[
"q_id"]);
 
  846                         if ($rbacsystem->checkAccess(
'write', 
$_GET[
"ref_id"]))
 
  849                                 $ilTabs->addTarget(
"edit_content",
 
  850                                         $this->ctrl->getLinkTargetByClass(
"ilPageObjectGUI", 
"edit"),
 
  851                                         array(
"edit", 
"insert", 
"exec_pg"),
 
  852                                         "", 
"", $force_active);
 
  856                         $ilTabs->addTarget(
"preview",
 
  857                                 $this->ctrl->getLinkTargetByClass(
"ilPageObjectGUI", 
"preview"),
 
  859                                 "ilPageObjectGUI", 
"", $force_active);
 
  862                 $force_active = 
false;
 
  863                 if ($rbacsystem->checkAccess(
'write', 
$_GET[
"ref_id"]))
 
  866                         if ($classname) $url = $this->ctrl->getLinkTargetByClass($classname, 
"editQuestion");
 
  867                         $commands = 
$_POST[
"cmd"];
 
  868                         if (is_array($commands))
 
  870                                 foreach ($commands as $key => $value)
 
  872                                         if (preg_match(
"/^delete_.*/", $key, $matches))
 
  874                                                 $force_active = 
true;
 
  879                         $ilTabs->addTarget(
"edit_properties",
 
  881                                 array(
"editQuestion", 
"save", 
"saveEdit", 
"addanswers", 
"removeanswers", 
"changeToPictures", 
"uploadanswers", 
"changeToText", 
"upanswers", 
"downanswers", 
"originalSyncForm"),
 
  882                                 $classname, 
"", $force_active);
 
  887                         $ilTabs->addTarget(
"feedback",
 
  888                                 $this->ctrl->getLinkTargetByClass($classname, 
"feedback"),
 
  889                                 array(
"feedback", 
"saveFeedback"),
 
  895                         $ilTabs->addTarget(
"solution_hint",
 
  896                                 $this->ctrl->getLinkTargetByClass($classname, 
"suggestedsolution"),
 
  897                                 array(
"suggestedsolution", 
"saveSuggestedSolution", 
"outSolutionExplorer", 
"cancel", 
 
  898                                 "addSuggestedSolution",
"cancelExplorer", 
"linkChilds", 
"removeSuggestedSolution" 
  908                         $ilTabs->addTarget(
"statistics",
 
  909                                 $this->ctrl->getLinkTargetByClass($classname, 
"assessment"),
 
  914                 if ((
$_GET[
"calling_test"] > 0) || (
$_GET[
"test_ref_id"] > 0))
 
  918                         $ilTabs->setBackTarget($this->lng->txt(
"backtocallingtest"), 
"ilias.php?baseClass=ilObjTestGUI&cmd=questions&ref_id=$ref_id");
 
  922                         $ilTabs->setBackTarget($this->lng->txt(
"qpl"), $this->ctrl->getLinkTargetByClass(
"ilobjquestionpoolgui", 
"questions"));