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);
63 if (substr(
$cmd, 0, 6) ==
"delete")
67 if (substr(
$cmd, 0, 6) ==
"upload")
85 $multiline_answers = $this->
object->getMultilineAnswerSetting();
87 $this->tpl->addBlockFile(
"QUESTION_DATA",
"question_data",
"tpl.il_as_qpl_ordering.html",
"Modules/TestQuestionPool");
90 for ($i = 0; $i < $this->
object->getAnswerCount(); $i++)
92 $this->tpl->setCurrentBlock(
"deletebutton");
93 $this->tpl->setVariable(
"DELETE", $this->lng->txt(
"delete"));
94 $this->tpl->setVariable(
"ANSWER_ORDER", $i);
95 $this->tpl->parseCurrentBlock();
97 $thisanswer = $this->
object->getAnswer($i);
98 if ($this->object->getOrderingType() ==
OQ_PICTURES)
100 $this->tpl->setCurrentBlock(
"order_pictures");
101 $this->tpl->setVariable(
"ANSWER_ORDER", $i);
102 $this->tpl->setVariable(
"VALUE_ANSWER_COUNTER", $thisanswer->getOrder() + 1);
103 $this->tpl->setVariable(
"TEXT_ANSWER_PICTURE", $this->lng->txt(
"answer_picture"));
105 $filename = $thisanswer->getAnswertext();
107 if (preg_match(
"/.*\.(png|jpg|gif|jpeg)$/",
$filename, $matches))
109 $extension = $matches[1];
113 $imagepath = $this->
object->getImagePathWeb() . $thisanswer->getAnswertext();
114 $this->tpl->setVariable(
"UPLOADED_IMAGE",
"<img src=\"$imagepath.thumb.jpg\" alt=\"" . $thisanswer->getAnswertext() .
"\" border=\"\" />");
116 $this->tpl->setVariable(
"VALUE_ANSWER",
"");
119 $this->tpl->setVariable(
"UPLOAD", $this->lng->txt(
"upload"));
121 elseif ($this->object->getOrderingType() ==
OQ_TERMS)
123 if ($multiline_answers)
125 $this->tpl->setCurrentBlock(
"show_textarea");
126 $this->tpl->setVariable(
"ANSWER_ORDER", $i);
128 $this->tpl->parseCurrentBlock();
132 $this->tpl->setCurrentBlock(
"show_textinput");
133 $this->tpl->setVariable(
"ANSWER_ORDER", $i);
135 $this->tpl->parseCurrentBlock();
138 $this->tpl->parseCurrentBlock();
140 $this->tpl->setCurrentBlock(
"answers");
141 $anchor =
"#answer_" . ($thisanswer->getOrder() + 1);
142 $this->tpl->setVariable(
"ANSWER_ORDER", $thisanswer->getOrder());
143 $this->tpl->setVariable(
"TEXT_ANSWER", $this->lng->txt(
"answer"));
144 $this->tpl->setVariable(
"VALUE_ORDER", $thisanswer->getSolutionOrder());
145 $this->tpl->setVariable(
"VALUE_ORDERING_POINTS", $thisanswer->getPoints());
146 $this->tpl->parseCurrentBlock();
149 if (($this->ctrl->getCmd() ==
"addItem") and (
$ok))
151 $i = $this->
object->getAnswerCount() - 1;
152 for ($j = 1; $j <= $_POST[
"itemcount"]; $j++)
154 if ($this->object->getOrderingType() ==
OQ_PICTURES)
156 $this->tpl->setCurrentBlock(
"order_pictures");
157 $this->tpl->setVariable(
"ANSWER_ORDER", $i+$j);
158 $this->tpl->setVariable(
"VALUE_ANSWER",
"");
159 $this->tpl->setVariable(
"UPLOAD", $this->lng->txt(
"upload"));
161 elseif ($this->object->getOrderingType() ==
OQ_TERMS)
163 if ($multiline_answers)
165 $this->tpl->setCurrentBlock(
"show_textarea");
166 $this->tpl->setVariable(
"ANSWER_ORDER", $i+$j);
167 $this->tpl->parseCurrentBlock();
171 $this->tpl->setCurrentBlock(
"show_textinput");
172 $this->tpl->setVariable(
"ANSWER_ORDER", $i+$j);
173 $this->tpl->parseCurrentBlock();
176 $this->tpl->parseCurrentBlock();
179 $this->tpl->setCurrentBlock(
"answers");
181 $this->tpl->setVariable(
"TEXT_ANSWER", $this->lng->txt(
"answer"));
182 $anchor =
"#answer_" . ($this->
object->getAnswerCount() + $j);
183 $this->tpl->setVariable(
"TEXT_SOLUTION_ORDER", $this->lng->txt(
"solution_order"));
184 $this->tpl->setVariable(
"TEXT_POINTS", $this->lng->txt(
"points"));
185 if ($this->object->getOrderingType() ==
OQ_PICTURES)
187 $this->tpl->setVariable(
"TEXT_ANSWER_PICTURE", $this->lng->txt(
"answer_picture"));
191 $this->tpl->setVariable(
"TEXT_ANSWER_TEXT", $this->lng->txt(
"answer_text"));
193 $this->tpl->setVariable(
"ANSWER_ORDER", $i+$j);
194 $this->tpl->setVariable(
"VALUE_ORDER", $this->object->getMaxSolutionOrder() + $j);
195 $this->tpl->setVariable(
"VALUE_ORDERING_POINTS", sprintf(
"%s", 0));
196 $this->tpl->parseCurrentBlock();
200 if ($this->object->getAnswerCount())
202 $this->tpl->setCurrentBlock(
"answerheader");
203 $this->tpl->setVariable(
"TEXT_POINTS", $this->lng->txt(
"points"));
204 if ($this->object->getOrderingType() ==
OQ_PICTURES)
206 $this->tpl->setVariable(
"TEXT_ANSWER_PICTURE", $this->lng->txt(
"answer_picture"));
210 $this->tpl->setVariable(
"TEXT_ANSWER_TEXT", $this->lng->txt(
"answer_text"));
212 $this->tpl->setVariable(
"TEXT_SOLUTION_ORDER", $this->lng->txt(
"solution_order"));
213 $this->tpl->parseCurrentBlock();
216 if ($this->object->getOrderingType() ==
OQ_TERMS)
218 if ($multiline_answers)
220 $this->tpl->setVariable(
"SELECTED_SHOW_MULTILINE_ANSWERS",
" selected=\"selected\"");
222 $this->tpl->setVariable(
"TEXT_HIDE_MULTILINE_ANSWERS", $this->lng->txt(
"multiline_terms_hide"));
223 $this->tpl->setVariable(
"TEXT_SHOW_MULTILINE_ANSWERS", $this->lng->txt(
"multiline_terms_show"));
228 $internallinks = array(
229 "lm" => $this->lng->txt(
"obj_lm"),
230 "st" => $this->lng->txt(
"obj_st"),
231 "pg" => $this->lng->txt(
"obj_pg"),
232 "glo" => $this->lng->txt(
"glossary_term")
234 foreach ($internallinks as $key => $value)
236 $this->tpl->setCurrentBlock(
"internallink");
237 $this->tpl->setVariable(
"TYPE_INTERNAL_LINK", $key);
238 $this->tpl->setVariable(
"TEXT_INTERNAL_LINK", $value);
239 $this->tpl->parseCurrentBlock();
242 $this->tpl->setCurrentBlock(
"HeadContent");
243 $this->tpl->addJavascript(
"./Services/JavaScript/js/Basic.js");
244 $javascript =
"<script type=\"text/javascript\">ilAddOnLoad(initialSelect);\n".
245 "function initialSelect() {\n%s\n}</script>";
246 switch ($this->ctrl->getCmd())
249 $this->tpl->setVariable(
"CONTENT_BLOCK", sprintf($javascript,
"document.frm_ordering.answer_".($this->object->getAnswerCount()).
".focus(); document.frm_ordering.answer_".($this->object->getAnswerCount()).
".scrollIntoView(\"true\");"));
252 $this->tpl->setVariable(
"CONTENT_BLOCK", sprintf($javascript,
"document.frm_ordering.title.focus();"));
255 $this->tpl->parseCurrentBlock();
256 for ($a = 1; $a < 9; $a++)
258 $this->tpl->setCurrentBlock(
"itemcountvalues");
259 $this->tpl->setVariable(
"ITEMCOUNTVALUE", $a);
262 $this->tpl->setVariable(
"TEXT_ANSWER", $this->lng->txt(
"answers"));
266 $this->tpl->setVariable(
"TEXT_ANSWER", $this->lng->txt(
"answer"));
268 $this->tpl->parseCurrentBlock();
270 $this->tpl->setCurrentBlock(
"question_data");
271 $this->tpl->setVariable(
"VALUE_ADD", $this->lng->txt(
"add"));
272 $this->tpl->setVariable(
"TEXT_TITLE", $this->lng->txt(
"title"));
273 $this->tpl->setVariable(
"TEXT_AUTHOR", $this->lng->txt(
"author"));
274 $this->tpl->setVariable(
"TEXT_COMMENT", $this->lng->txt(
"description"));
275 $this->tpl->setVariable(
"TEXT_QUESTION", $this->lng->txt(
"question"));
276 $this->tpl->setVariable(
"TEXT_SHUFFLE_ANSWERS", $this->lng->txt(
"shuffle_answers"));
277 $this->tpl->setVariable(
"TXT_YES", $this->lng->txt(
"yes"));
278 $this->tpl->setVariable(
"TXT_NO", $this->lng->txt(
"no"));
279 if ($this->object->getShuffle())
281 $this->tpl->setVariable(
"SELECTED_YES",
" selected=\"selected\"");
285 $this->tpl->setVariable(
"SELECTED_NO",
" selected=\"selected\"");
287 $this->tpl->setVariable(
"ORDERING_ID", $this->object->getId());
291 $questiontext = $this->
object->getQuestion();
292 $this->tpl->setVariable(
"VALUE_QUESTION",
ilUtil::prepareFormOutput($this->object->prepareTextareaOutput($questiontext)));
293 $this->tpl->setVariable(
"TEXT_TYPE", $this->lng->txt(
"type"));
294 $this->tpl->setVariable(
"TEXT_TYPE_PICTURES", $this->lng->txt(
"order_pictures"));
295 $this->tpl->setVariable(
"TEXT_TYPE_TERMS", $this->lng->txt(
"order_terms"));
296 if ($this->object->getOrderingType() ==
OQ_TERMS)
298 $this->tpl->setVariable(
"SELECTED_TERMS",
" selected=\"selected\"");
300 elseif ($this->object->getOrderingType() ==
OQ_PICTURES)
302 $this->tpl->setVariable(
"SELECTED_PICTURES",
" selected=\"selected\"");
305 $this->tpl->setVariable(
"TEXT_SOLUTION_HINT", $this->lng->txt(
"solution_hint"));
306 if (count($this->object->suggested_solutions))
308 $solution_array = $this->
object->getSuggestedSolution(0);
309 include_once
"./Modules/TestQuestionPool/classes/class.assQuestion.php";
311 $this->tpl->setVariable(
"TEXT_VALUE_SOLUTION_HINT",
" <a href=\"$href\" target=\"content\">" . $this->lng->txt(
"solution_hint").
"</a> ");
312 $this->tpl->setVariable(
"BUTTON_REMOVE_SOLUTION", $this->lng->txt(
"remove"));
313 $this->tpl->setVariable(
"BUTTON_ADD_SOLUTION", $this->lng->txt(
"change"));
314 $this->tpl->setVariable(
"VALUE_SOLUTION_HINT", $solution_array[
"internal_link"]);
318 $this->tpl->setVariable(
"BUTTON_ADD_SOLUTION", $this->lng->txt(
"add"));
321 $this->tpl->setVariable(
"SAVE", $this->lng->txt(
"save"));
322 $this->tpl->setVariable(
"SAVE_EDIT", $this->lng->txt(
"save_edit"));
323 $this->tpl->setVariable(
"CANCEL", $this->lng->txt(
"cancel"));
324 $this->tpl->setVariable(
"SET_EDIT_MODE", $this->lng->txt(
"set_edit_mode"));
325 $this->ctrl->setParameter($this,
"sel_question_types",
"assOrderingQuestion");
326 $this->tpl->setVariable(
"TEXT_QUESTION_TYPE", $this->
outQuestionType());
327 $this->tpl->setVariable(
"ACTION_ORDERING_QUESTION", $this->ctrl->getFormAction($this));
328 $this->tpl->setVariable(
"TXT_REQUIRED_FLD", $this->lng->txt(
"required_field"));
329 $this->tpl->parseCurrentBlock();
335 include_once
"./Services/RTE/classes/class.ilRTE.php";
337 include_once
"./Services/RTE/classes/class.$rtestring.php";
338 $rte =
new $rtestring();
339 $rte->addPlugin(
"latex");
340 $rte->addButton(
"latex"); $rte->addButton(
"pastelatex");
341 include_once
"./classes/class.ilObject.php";
342 $obj_id =
$_GET[
"q_id"];
344 $rte->addRTESupport($obj_id, $obj_type,
"assessment");
346 $this->tpl->setCurrentBlock(
"adm_content");
348 $this->tpl->parseCurrentBlock();
358 $this->error .= $this->lng->txt(
"fill_out_all_required_fields_add_answer") .
"<br />";
363 foreach ($_POST as $key => $value)
365 if (preg_match(
"/answer_(\d+)/", $key, $matches))
367 if ((!$value) && ($this->object->getOrderingType() ==
OQ_TERMS))
371 if ($this->object->getOrderingType() ==
OQ_PICTURES)
373 if ((!$_FILES[$key][
"tmp_name"]) && (!$value))
383 $this->error .= $this->lng->txt(
"fill_out_all_answer_fields") .
"<br />";
398 foreach ($_POST[cmd] as $key => $value)
400 if (preg_match(
"/delete_(\d+)/", $key, $matches))
402 $this->
object->deleteAnswer($matches[1]);
432 $this->
object->flushAnswers();
437 include_once
"./Services/AdvancedEditing/classes/class.ilObjAdvancedEditing.php";
439 $this->
object->setQuestion($questiontext);
440 $this->
object->setSuggestedSolution($_POST[
"solution_hint"], 0);
441 $this->
object->setShuffle($_POST[
"shuffle"]);
445 $this->
object->setOrderingType($_POST[
"ordering_type"]);
446 if ($this->object->getOrderingType() ==
OQ_TERMS)
448 $this->
object->setMultilineAnswerSetting($_POST[
"multilineAnswers"]);
452 foreach ($_POST as $key => $value)
454 if (preg_match(
"/answer_(\d+)/", $key, $matches))
456 if ($this->object->getOrderingType() ==
OQ_PICTURES)
458 if ($_FILES[$key][
"tmp_name"])
461 if ($this->object->getId() <= 0)
463 $this->
object->saveToDb();
465 $this->error .= $this->lng->txt(
"question_saved_for_upload") .
"<br />";
467 $image_file = $this->
object->createNewImageFileName($_FILES[$key][
"name"]);
468 $upload_result = $this->
object->setImageFile($image_file, $_FILES[$key][
'tmp_name']);
469 switch ($upload_result)
472 $_POST[$key] = $image_file;
475 $this->error .= $this->lng->txt(
"error_image_upload_wrong_format") .
"<br />";
478 $this->error .= $this->lng->txt(
"error_image_upload_copy_file") .
"<br />";
483 $points = $_POST[
"points_$matches[1]"];
487 $this->
setErrorMessage($this->lng->txt(
"negative_points_not_allowed"));
489 $answer = $_POST[
"$key"];
490 include_once
"./Services/AdvancedEditing/classes/class.ilObjAdvancedEditing.php";
492 $this->
object->addAnswer(
506 $this->
object->saveToDb();
507 $this->ctrl->setParameter($this,
"q_id", $this->object->getId());
514 $test_output = $this->
getTestOutput($active_id,
$pass, $is_postponed, $user_post_solution);
515 $this->tpl->setVariable(
"QUESTION_OUTPUT", $test_output);
516 $this->tpl->setVariable(
"FORMACTION", $formaction);
519 function getSolutionOutput($active_id,
$pass = NULL, $graphicalOutput = FALSE, $result_output = FALSE, $show_question_only = TRUE, $show_feedback = FALSE, $show_correct_solution = FALSE)
522 $keys = array_keys($this->object->answers);
525 include_once
"./classes/class.ilTemplate.php";
526 $template =
new ilTemplate(
"tpl.il_as_qpl_ordering_output_solution.html", TRUE, TRUE,
"Modules/TestQuestionPool");
527 $solutiontemplate =
new ilTemplate(
"tpl.il_as_tst_solution_output.html",TRUE, TRUE,
"Modules/TestQuestionPool");
530 $solutions = array();
531 if (($active_id > 0) && (!$show_correct_solution))
533 $solutions =& $this->
object->getSolutionValues($active_id,
$pass);
537 foreach ($this->object->answers as $index => $answer)
539 array_push($solutions, array(
"value1" => $index,
"value2" => $answer->getSolutionOrder()));
542 foreach ($keys as $idx)
544 $answer = $this->
object->answers[$idx];
545 if (($active_id > 0) && (!$show_correct_solution))
547 if ($graphicalOutput)
550 foreach ($solutions as $solution)
552 $sol[$solution[
"value1"]] = $solution[
"value2"];
555 $sol = array_keys($sol);
557 foreach ($this->object->answers as $k => $a)
559 $ans[$k] = $a->getSolutionOrder();
562 $ans = array_keys($ans);
564 foreach ($ans as $arr_idx => $ans_idx)
566 if ($ans_idx == $idx)
568 if ($ans_idx == $sol[$arr_idx])
577 $template->setCurrentBlock(
"icon_ok");
579 $template->setVariable(
"TEXT_OK", $this->lng->txt(
"answer_is_right"));
580 $template->parseCurrentBlock();
584 $template->setCurrentBlock(
"icon_ok");
586 $template->setVariable(
"TEXT_NOT_OK", $this->lng->txt(
"answer_is_wrong"));
587 $template->parseCurrentBlock();
591 if ($this->object->getOrderingType() ==
OQ_PICTURES)
593 $template->setCurrentBlock(
"ordering_row_standard_pictures");
594 $template->setVariable(
"THUMB_HREF", $this->object->getImagePathWeb() . $answer->getAnswertext() .
".thumb.jpg");
595 list($width, $height, $type, $attr) = getimagesize($this->object->getImagePath() . $answer->getAnswertext().
".thumb.jpg");
596 $template->setVariable(
"ATTR", $attr);
597 $template->setVariable(
"THUMB_ALT", $this->lng->txt(
"thumbnail"));
598 $template->setVariable(
"THUMB_TITLE", $this->lng->txt(
"enlarge"));
599 $template->parseCurrentBlock();
603 $template->setCurrentBlock(
"ordering_row_standard_text");
604 $template->setVariable(
"ANSWER_TEXT", $this->object->prepareTextareaOutput($answer->getAnswertext(), TRUE));
605 $template->parseCurrentBlock();
607 $template->setCurrentBlock(
"ordering_row_standard");
610 $answer = $this->
object->answers[$idx];
611 $points = $answer->getPoints();
612 $resulttext = ($points == 1) ?
"(%s " . $this->lng->txt(
"point") .
")" :
"(%s " . $this->lng->txt(
"points") .
")";
613 $template->setVariable(
"RESULT_OUTPUT", sprintf($resulttext, $points));
615 foreach ($solutions as $solution)
617 if (strcmp($solution[
"value1"], $idx) == 0)
619 $template->setVariable(
"ANSWER_ORDER", $solution[
"value2"]);
622 $template->parseCurrentBlock();
624 $questiontext = $this->
object->getQuestion();
625 $template->setVariable(
"QUESTIONTEXT", $this->object->prepareTextareaOutput($questiontext, TRUE));
626 $questionoutput = $template->get();
628 if (strlen($feedback)) $solutiontemplate->setVariable(
"FEEDBACK", $feedback);
629 $solutiontemplate->setVariable(
"SOLUTION_OUTPUT", $questionoutput);
631 $solutionoutput = $solutiontemplate->get();
632 if (!$show_question_only)
637 return $solutionoutput;
643 $keys = array_keys($this->object->answers);
644 if ($this->object->getShuffle())
646 $keys = $this->
object->pcArrayShuffle($keys);
650 include_once
"./classes/class.ilTemplate.php";
651 $template =
new ilTemplate(
"tpl.il_as_qpl_ordering_output.html", TRUE, TRUE,
"Modules/TestQuestionPool");
653 foreach ($keys as $idx)
655 $answer = $this->
object->answers[$idx];
656 if ($this->object->getOrderingType() ==
OQ_PICTURES)
658 $template->setCurrentBlock(
"ordering_row_standard_pictures");
659 $template->setVariable(
"PICTURE_HREF", $this->object->getImagePathWeb() . $answer->getAnswertext());
660 $template->setVariable(
"THUMB_HREF", $this->object->getImagePathWeb() . $answer->getAnswertext() .
".thumb.jpg");
661 $template->setVariable(
"THUMB_ALT", $this->lng->txt(
"thumbnail"));
662 $template->setVariable(
"THUMB_TITLE", $this->lng->txt(
"enlarge"));
663 $template->setVariable(
"ANSWER_ID", $idx);
664 $template->parseCurrentBlock();
668 $template->setCurrentBlock(
"ordering_row_standard_text");
669 $template->setVariable(
"ANSWER_TEXT", $this->object->prepareTextareaOutput($answer->getAnswertext(), TRUE));
670 $template->setVariable(
"ANSWER_ID", $idx);
671 $template->parseCurrentBlock();
673 $template->setCurrentBlock(
"ordering_row_standard");
674 $template->setVariable(
"ANSWER_ID", $idx);
675 $template->parseCurrentBlock();
678 $questiontext = $this->
object->getQuestion();
679 $template->setVariable(
"QUESTIONTEXT", $this->object->prepareTextareaOutput($questiontext, TRUE));
680 $questionoutput = $template->get();
681 if (!$show_question_only)
686 return $questionoutput;
693 if (is_array($user_post_solution))
699 $keys = array_keys($this->object->answers);
700 if ($this->object->getShuffle())
702 $keys = $this->
object->pcArrayShuffle($keys);
708 include_once
"./classes/class.ilTemplate.php";
710 $template =
new ilTemplate(
"tpl.il_as_qpl_ordering_output.html", TRUE, TRUE,
"Modules/TestQuestionPool");
714 $this->tpl->addBlockFile(
"CONTENT_BLOCK",
"head_content",
"tpl.il_as_qpl_ordering_output_javascript.html",
"Modules/TestQuestionPool");
715 $this->tpl->setCurrentBlock(
"head_content");
716 $this->tpl->setVariable(
"JS_LOCATION",
"./Modules/TestQuestionPool/js/toolman/");
717 $this->tpl->parseCurrentBlock();
721 $this->tpl->setCurrentBlock(
"AdditionalStyle");
722 $this->tpl->setVariable(
"LOCATION_ADDITIONAL_STYLESHEET",
ilUtil::getStyleSheetLocation(
"output",
"test_javascript.css",
"Modules/TestQuestionPool"));
723 $this->tpl->parseCurrentBlock();
727 $this->tpl->setVariable(
"ON_SUBMIT",
"return saveOrder('orderlist');");
735 include_once
"./Modules/Test/classes/class.ilObjTest.php";
740 if (is_array($user_post_solution))
742 $solutions = array();
743 foreach ($user_post_solution as $key => $value)
745 if (preg_match(
"/order_(\d+)/", $key, $matches))
747 array_push($solutions, array(
"value1" => $matches[1],
"value2" => $value));
753 $solutions =& $this->
object->getSolutionValues($active_id,
$pass);
758 $solution_script .=
"";
759 $jssolutions = array();
760 foreach ($solutions as $idx => $solution_value)
762 if ((strcmp($solution_value[
"value2"],
"") != 0) && (strcmp($solution_value[
"value1"],
"") != 0))
764 $jssolutions[$solution_value[
"value2"]] = $solution_value[
"value1"];
767 if (count($jssolutions))
771 foreach ($jssolutions as $key => $value)
773 $js .=
"initialorder.push($value);";
775 $js .=
"restoreInitialOrder();";
779 $template->setCurrentBlock(
"javascript_restore_order");
780 $template->setVariable(
"RESTORE_ORDER", $js);
781 $template->parseCurrentBlock();
788 foreach ($keys as $idx)
790 $answer = $this->
object->answers[$idx];
791 if ($this->object->getOrderingType() ==
OQ_PICTURES)
793 $template->setCurrentBlock(
"ordering_row_standard_pictures");
794 $template->setVariable(
"PICTURE_HREF", $this->object->getImagePathWeb() . $answer->getAnswertext());
795 $template->setVariable(
"THUMB_HREF", $this->object->getImagePathWeb() . $answer->getAnswertext() .
".thumb.jpg");
796 $template->setVariable(
"THUMB_ALT", $this->lng->txt(
"thumbnail"));
797 $template->setVariable(
"THUMB_TITLE", $this->lng->txt(
"enlarge"));
798 $template->setVariable(
"ANSWER_ID", $idx);
799 $template->parseCurrentBlock();
803 $template->setCurrentBlock(
"ordering_row_standard_text");
804 $template->setVariable(
"ANSWER_TEXT", $this->object->prepareTextareaOutput($answer->getAnswertext(), TRUE));
805 $template->setVariable(
"ANSWER_ID", $idx);
806 $template->parseCurrentBlock();
808 $template->setCurrentBlock(
"ordering_row_standard");
809 $template->setVariable(
"ANSWER_ID", $idx);
810 if (is_array($solutions))
812 foreach ($solutions as $solution)
814 if (($solution[
"value1"] == $idx) && (strlen($solution[
"value2"])))
816 $template->setVariable(
"ANSWER_ORDER",
" value=\"" . $solution[
"value2"] .
"\"");
820 $template->parseCurrentBlock();
825 foreach ($keys as $idx)
827 $answer = $this->
object->answers[$idx];
828 if ($this->object->getOrderingType() ==
OQ_PICTURES)
830 $template->setCurrentBlock(
"ordering_row_javascript_pictures");
831 $template->setVariable(
"PICTURE_HREF", $this->object->getImagePathWeb() . $answer->getAnswertext());
832 $template->setVariable(
"THUMB_HREF", $this->object->getImagePathWeb() . $answer->getAnswertext() .
".thumb.jpg");
833 $template->setVariable(
"THUMB_ALT", $this->lng->txt(
"thumbnail"));
834 $template->setVariable(
"THUMB_TITLE", $this->lng->txt(
"thumbnail"));
836 $template->setVariable(
"ENLARGE_ALT", $this->lng->txt(
"enlarge"));
837 $template->setVariable(
"ENLARGE_TITLE", $this->lng->txt(
"enlarge"));
838 $template->setVariable(
"ANSWER_ID", $idx);
839 $template->parseCurrentBlock();
843 $template->setCurrentBlock(
"ordering_row_javascript_text");
844 $template->setVariable(
"ANSWER_TEXT", $this->object->prepareTextareaOutput($answer->getAnswertext(), TRUE));
845 $template->setVariable(
"ANSWER_ID", $idx);
846 $template->parseCurrentBlock();
849 $template->setCurrentBlock(
"ordering_with_javascript");
850 if ($this->object->getOrderingType() ==
OQ_PICTURES)
852 $template->setVariable(
"RESET_POSITIONS", $this->lng->txt(
"reset_pictures"));
856 $template->setVariable(
"RESET_POSITIONS", $this->lng->txt(
"reset_definitions"));
858 $template->parseCurrentBlock();
860 $questiontext = $this->
object->getQuestion();
861 $template->setVariable(
"QUESTIONTEXT", $this->object->prepareTextareaOutput($questiontext, TRUE));
862 $questionoutput = $template->get();
863 $pageoutput = $this->
outQuestionPage(
"", $is_postponed, $active_id, $questionoutput);
872 if ((!$_POST[
"title"]) or (!$_POST[
"author"]) or (!$_POST[
"question"]))
882 if ($_POST[
"cmd"][
"addSuggestedSolution"])
892 ilUtil::sendInfo($this->lng->txt(
"fill_out_all_required_fields_add_answer"));
897 $this->
object->saveToDb();
898 $this->ctrl->setParameter($this,
"q_id", $this->object->getId());
899 $this->tpl->setVariable(
"HEADER", $this->object->getTitle());
908 if ($this->object->getOrderingType() ==
OQ_TERMS)
910 $this->
object->setMultilineAnswerSetting($_POST[
"multilineAnswers"]);
912 $this->
object->setOrderingType($_POST[
"ordering_type"]);
926 include_once
"./Services/AdvancedEditing/classes/class.ilObjAdvancedEditing.php";
929 $this->
object->cleanupMediaObjectUsage();
942 $this->tpl->addBlockFile(
"ADM_CONTENT",
"feedback",
"tpl.il_as_qpl_ordering_feedback.html",
"Modules/TestQuestionPool");
943 $this->tpl->setVariable(
"FEEDBACK_TEXT", $this->lng->txt(
"feedback"));
944 $this->tpl->setVariable(
"FEEDBACK_COMPLETE", $this->lng->txt(
"feedback_complete_solution"));
945 $this->tpl->setVariable(
"VALUE_FEEDBACK_COMPLETE",
ilUtil::prepareFormOutput($this->object->prepareTextareaOutput($this->object->getFeedbackGeneric(1)), FALSE));
946 $this->tpl->setVariable(
"FEEDBACK_INCOMPLETE", $this->lng->txt(
"feedback_incomplete_solution"));
947 $this->tpl->setVariable(
"VALUE_FEEDBACK_INCOMPLETE",
ilUtil::prepareFormOutput($this->object->prepareTextareaOutput($this->object->getFeedbackGeneric(0)), FALSE));
949 if ($rbacsystem->checkAccess(
'write',
$_GET[
"ref_id"]))
951 $this->tpl->setVariable(
"SAVE", $this->lng->txt(
"save"));
953 $this->tpl->setVariable(
"FORMACTION", $this->ctrl->getFormAction($this));
955 include_once
"./Services/RTE/classes/class.ilRTE.php";
957 include_once
"./Services/RTE/classes/class.$rtestring.php";
958 $rte =
new $rtestring();
959 $rte->addPlugin(
"latex");
960 $rte->addButton(
"latex"); $rte->addButton(
"pastelatex");
961 include_once
"./classes/class.ilObject.php";
962 $obj_id =
$_GET[
"q_id"];
964 $rte->addRTESupport($obj_id, $obj_type,
"assessment");
976 global $rbacsystem, $ilTabs;
978 $this->ctrl->setParameterByClass(
"ilpageobjectgui",
"q_id",
$_GET[
"q_id"]);
979 include_once
"./Modules/TestQuestionPool/classes/class.assQuestion.php";
980 $q_type = $this->
object->getQuestionType();
984 $classname = $q_type .
"GUI";
985 $this->ctrl->setParameterByClass(strtolower($classname),
"sel_question_types", $q_type);
986 $this->ctrl->setParameterByClass(strtolower($classname),
"q_id",
$_GET[
"q_id"]);
991 if ($rbacsystem->checkAccess(
'write',
$_GET[
"ref_id"]))
994 $ilTabs->addTarget(
"edit_content",
995 $this->ctrl->getLinkTargetByClass(
"ilPageObjectGUI",
"edit"),
996 array(
"edit",
"insert",
"exec_pg"),
997 "",
"", $force_active);
1001 $ilTabs->addTarget(
"preview",
1002 $this->ctrl->getLinkTargetByClass(
"ilPageObjectGUI",
"preview"),
1004 "ilPageObjectGUI",
"", $force_active);
1007 $force_active =
false;
1008 if ($rbacsystem->checkAccess(
'write',
$_GET[
"ref_id"]))
1011 if ($classname) $url = $this->ctrl->getLinkTargetByClass($classname,
"editQuestion");
1012 $commands = $_POST[
"cmd"];
1013 if (is_array($commands))
1015 foreach ($commands as $key => $value)
1017 if (preg_match(
"/^delete_.*/", $key, $matches))
1019 $force_active =
true;
1024 $ilTabs->addTarget(
"edit_properties",
1026 array(
"editQuestion",
"save",
"cancel",
"addSuggestedSolution",
1027 "cancelExplorer",
"linkChilds",
"removeSuggestedSolution",
"editMode",
"addItem",
"upload",
1029 $classname,
"", $force_active);
1034 $ilTabs->addTarget(
"feedback",
1035 $this->ctrl->getLinkTargetByClass($classname,
"feedback"),
1036 array(
"feedback",
"saveFeedback"),
1043 $ilTabs->addTarget(
"statistics",
1044 $this->ctrl->getLinkTargetByClass($classname,
"assessment"),
1045 array(
"assessment"),
1049 if ((
$_GET[
"calling_test"] > 0) || (
$_GET[
"test_ref_id"] > 0))
1053 $ilTabs->setBackTarget($this->lng->txt(
"backtocallingtest"),
"ilias.php?baseClass=ilObjTestGUI&cmd=questions&ref_id=$ref_id");
1057 $ilTabs->setBackTarget($this->lng->txt(
"qpl"), $this->ctrl->getLinkTargetByClass(
"ilobjquestionpoolgui",
"questions"));