24 include_once
"./Modules/TestQuestionPool/classes/class.assQuestionGUI.php";
25 include_once
"./Modules/Test/classes/inc.AssessmentConstants.php";
52 include_once
"./Modules/TestQuestionPool/classes/class.assJavaApplet.php";
56 $this->
object->loadFromDb($id);
62 if (substr(
$cmd, 0, 6) ==
"delete")
79 $this->tpl->addBlockFile(
"QUESTION_DATA",
"question_data",
"tpl.il_as_qpl_javaapplet_question.html",
"Modules/TestQuestionPool");
87 $this->tpl->setCurrentBlock(
"post_save");
89 $internallinks = array(
90 "lm" => $this->lng->txt(
"obj_lm"),
91 "st" => $this->lng->txt(
"obj_st"),
92 "pg" => $this->lng->txt(
"obj_pg"),
93 "glo" => $this->lng->txt(
"glossary_term")
95 foreach ($internallinks as $key => $value)
97 $this->tpl->setCurrentBlock(
"internallink");
98 $this->tpl->setVariable(
"TYPE_INTERNAL_LINK", $key);
99 $this->tpl->setVariable(
"TEXT_INTERNAL_LINK", $value);
100 $this->tpl->parseCurrentBlock();
103 $this->tpl->setVariable(
"TEXT_SOLUTION_HINT", $this->lng->txt(
"solution_hint"));
104 if (count($this->object->suggested_solutions))
106 $solution_array = $this->
object->getSuggestedSolution(0);
107 include_once
"./Modules/TestQuestionPool/classes/class.assQuestion.php";
109 $this->tpl->setVariable(
"TEXT_VALUE_SOLUTION_HINT",
" <a href=\"$href\" target=\"content\">" . $this->lng->txt(
"solution_hint").
"</a> ");
110 $this->tpl->setVariable(
"BUTTON_REMOVE_SOLUTION", $this->lng->txt(
"remove"));
111 $this->tpl->setVariable(
"BUTTON_ADD_SOLUTION", $this->lng->txt(
"change"));
112 $this->tpl->setVariable(
"VALUE_SOLUTION_HINT", $solution_array[
"internal_link"]);
116 $this->tpl->setVariable(
"BUTTON_ADD_SOLUTION", $this->lng->txt(
"add"));
120 $javaapplet = $this->
object->getJavaAppletFilename();
121 $this->tpl->setVariable(
"TEXT_JAVAAPPLET", $this->lng->txt(
"javaapplet"));
122 if (!empty($javaapplet))
124 $this->tpl->setVariable(
"JAVAAPPLET_FILENAME", $javaapplet);
125 $this->tpl->setVariable(
"VALUE_JAVAAPPLET_UPLOAD", $this->lng->txt(
"change"));
126 $this->tpl->setCurrentBlock(
"javaappletupload");
127 $this->tpl->setVariable(
"UPLOADED_JAVAAPPLET", $javaapplet);
128 $this->tpl->parse(
"javaappletupload");
129 $this->tpl->setCurrentBlock(
"delete_applet");
130 $this->tpl->setVariable(
"VALUE_JAVAAPPLET_DELETE", $this->lng->txt(
"delete"));
131 $this->tpl->parseCurrentBlock();
135 $this->tpl->setVariable(
"VALUE_JAVAAPPLET_UPLOAD", $this->lng->txt(
"upload"));
137 $this->tpl->setVariable(
"TEXT_POINTS", $this->lng->txt(
"available_points"));
138 $this->tpl->setVariable(
"VALUE_APPLET_POINTS", $this->object->getPoints());
139 $this->tpl->parseCurrentBlock();
142 if ((strlen($this->object->getTitle()) > 0) && (strlen($this->object->getAuthor()) > 0) && (strlen($this->object->getQuestion()) > 0) && strlen($this->object->getPoints()))
145 for ($i = 0; $i < $this->
object->getParameterCount(); $i++)
148 $this->tpl->setCurrentBlock(
"delete_parameter");
149 $this->tpl->setVariable(
"VALUE_DELETE_PARAMETER", $this->lng->txt(
"delete"));
150 $this->tpl->setVariable(
"DELETE_PARAMETER_COUNT", $i);
151 $this->tpl->parseCurrentBlock();
152 $this->tpl->setCurrentBlock(
"applet_parameter");
153 $this->tpl->setVariable(
"PARAM_PARAM", $this->lng->txt(
"applet_parameter") .
" " . ($i+1));
154 $this->tpl->setVariable(
"PARAM_NAME", $this->lng->txt(
"name"));
155 $this->tpl->setVariable(
"PARAM_VALUE", $this->lng->txt(
"value"));
156 $param = $this->
object->getParameter($i);
157 $this->tpl->setVariable(
"PARAM_NAME_VALUE", $param[
"name"]);
158 $this->tpl->setVariable(
"PARAM_VALUE_VALUE", $param[
"value"]);
159 $this->tpl->setVariable(
"PARAM_COUNTER", $i);
160 $this->tpl->parseCurrentBlock();
166 if ($this->ctrl->getCmd() ==
"addParameter")
171 $this->tpl->setCurrentBlock(
"applet_parameter");
172 $this->tpl->setVariable(
"PARAM_PARAM", $this->lng->txt(
"applet_new_parameter"));
173 $this->tpl->setVariable(
"PARAM_NAME", $this->lng->txt(
"name"));
174 $this->tpl->setVariable(
"PARAM_VALUE", $this->lng->txt(
"value"));
175 $this->tpl->setVariable(
"PARAM_COUNTER", $this->object->getParameterCount());
176 $this->tpl->parseCurrentBlock();
183 if (!strlen($javaapplet))
185 $this->tpl->setVariable(
"TEXT_ARCHIVE", $this->lng->txt(
"archive"));
186 $this->tpl->setVariable(
"VALUE_ARCHIVE", $this->object->getJavaArchive());
187 $this->tpl->setVariable(
"TEXT_CODEBASE", $this->lng->txt(
"codebase"));
188 $this->tpl->setVariable(
"VALUE_CODEBASE", $this->object->getJavaCodebase());
191 $this->tpl->setCurrentBlock(
"appletcode");
192 $this->tpl->setVariable(
"APPLET_ATTRIBUTES", $this->lng->txt(
"applet_attributes"));
193 $this->tpl->setVariable(
"TEXT_CODE", $this->lng->txt(
"code"));
194 $this->tpl->setVariable(
"TEXT_WIDTH", $this->lng->txt(
"width"));
195 $this->tpl->setVariable(
"TEXT_HEIGHT", $this->lng->txt(
"height"));
196 $this->tpl->setVariable(
"VALUE_CODE", $this->object->getJavaCode());
197 $this->tpl->setVariable(
"VALUE_WIDTH", $this->object->getJavaWidth());
198 $this->tpl->setVariable(
"VALUE_HEIGHT", $this->object->getJavaHeight());
199 $this->tpl->setVariable(
"APPLET_PARAMETERS", $this->lng->txt(
"applet_parameters"));
200 $this->tpl->setVariable(
"VALUE_ADD_PARAMETER", $this->lng->txt(
"add_applet_parameter"));
201 $this->tpl->parseCurrentBlock();
204 $this->tpl->setCurrentBlock(
"HeadContent");
205 $this->tpl->addJavascript(
"./Services/JavaScript/js/Basic.js");
206 $javascript =
"<script type=\"text/javascript\">ilAddOnLoad(initialSelect);\n".
207 "function initialSelect() {\n%s\n}</script>";
208 $this->tpl->setVariable(
"CONTENT_BLOCK", sprintf($javascript,
"document.frm_javaapplet.title.focus();"));
209 $this->tpl->parseCurrentBlock();
210 $this->tpl->setCurrentBlock(
"question_data");
211 $this->tpl->setVariable(
"JAVAAPPLET_ID", $this->object->getId());
215 $questiontext = $this->
object->getQuestion();
216 $this->tpl->setVariable(
"VALUE_QUESTION",
ilUtil::prepareFormOutput($this->object->prepareTextareaOutput($questiontext)));
217 $this->tpl->setVariable(
"TEXT_TITLE", $this->lng->txt(
"title"));
218 $this->tpl->setVariable(
"TEXT_AUTHOR", $this->lng->txt(
"author"));
219 $this->tpl->setVariable(
"TEXT_COMMENT", $this->lng->txt(
"description"));
220 $this->tpl->setVariable(
"TEXT_QUESTION", $this->lng->txt(
"question"));
221 $this->tpl->setVariable(
"TXT_REQUIRED_FLD", $this->lng->txt(
"required_field"));
223 $this->tpl->setVariable(
"SAVE",$this->lng->txt(
"save"));
224 $this->tpl->setVariable(
"SAVE_EDIT", $this->lng->txt(
"save_edit"));
225 $this->tpl->setVariable(
"CANCEL",$this->lng->txt(
"cancel"));
226 $this->ctrl->setParameter($this,
"sel_question_types",
"assJavaApplet");
227 $this->tpl->setVariable(
"TEXT_QUESTION_TYPE", $this->
outQuestionType());
228 $formaction = $this->ctrl->getFormaction($this);
229 if ($this->object->getId() > 0)
231 if (!preg_match(
"/q_id\=\d+/", $formaction))
233 $formaction = str_replace(
"q_id=",
"q_id=" . $this->object->getId(), $formaction);
236 $this->tpl->setVariable(
"ACTION_JAVAAPPLET_QUESTION", $formaction);
237 $this->tpl->parseCurrentBlock();
238 include_once
"./Services/RTE/classes/class.ilRTE.php";
240 include_once
"./Services/RTE/classes/class.$rtestring.php";
241 $rte =
new $rtestring();
242 $rte->addPlugin(
"latex");
243 $rte->addButton(
"latex"); $rte->addButton(
"pastelatex");
244 include_once
"./classes/class.ilObject.php";
245 $obj_id =
$_GET[
"q_id"];
247 $rte->addRTESupport($obj_id, $obj_type,
"assessment");
249 $this->tpl->setCurrentBlock(
"adm_content");
251 $this->tpl->parseCurrentBlock();
264 $this->
object->saveToDb();
265 $this->ctrl->setParameter($this,
"q_id", $this->object->getId());
276 $this->
object->deleteJavaAppletFilename();
277 $this->
object->saveToDb();
319 include_once
"./Services/AdvancedEditing/classes/class.ilObjAdvancedEditing.php";
321 $this->
object->setQuestion($questiontext);
322 $this->
object->setSuggestedSolution($_POST[
"solution_hint"], 0);
323 $this->
object->setShuffle($_POST[
"shuffle"]);
324 $this->
object->setPoints($_POST[
"applet_points"]);
325 if ($_POST[
"applet_points"] < 0)
328 $this->
setErrorMessage($this->lng->txt(
"negative_points_not_allowed"));
336 if (empty($_FILES[
'javaappletName'][
'tmp_name']))
342 if ($this->object->getId() < 1)
345 $this->
object->saveToDb();
347 $this->
object->setJavaAppletFilename($_FILES[
'javaappletName'][
'name'], $_FILES[
'javaappletName'][
'tmp_name']);
349 if ((strlen($this->object->getTitle()) > 0) && (strlen($this->object->getAuthor()) > 0) && (strlen($this->object->getQuestion()) > 0) && ($this->
object->getPoints() > 0) && array_key_exists(
"java_height", $_POST))
351 $this->
object->setJavaCode($_POST[
"java_code"]);
352 $this->
object->setJavaCodebase($_POST[
"java_codebase"]);
353 $this->
object->setJavaArchive($_POST[
"java_archive"]);
354 $this->
object->setJavaWidth($_POST[
"java_width"]);
355 $this->
object->setJavaHeight($_POST[
"java_height"]);
356 if ((!$_POST[
"java_width"]) or (!$_POST[
"java_height"]))
$result = 1;
357 $this->
object->flushParams();
358 foreach ($_POST as $key => $value)
360 if (preg_match(
"/param_name_(\d+)/", $key, $matches))
362 $this->
object->addParameterAtIndex($matches[1], $value, $_POST[
"param_value_$matches[1]"]);
365 if (preg_match(
"/delete_(\d+)/", $this->ctrl->getCmd(), $matches))
367 $this->
object->removeParameter($_POST[
"param_name_$matches[1]"]);
373 $this->
object->saveToDb();
374 $this->ctrl->setParameter($this,
"q_id", $this->object->getId());
375 $this->error .= $this->lng->txt(
"question_saved_for_upload");
382 $test_output = $this->
getTestOutput($active_id,
$pass, $is_postponed, $use_post_solutions);
383 $this->tpl->setVariable(
"QUESTION_OUTPUT", $test_output);
384 $this->tpl->setVariable(
"FORMACTION", $formaction);
387 function getSolutionOutput($active_id,
$pass = NULL, $graphicalOutput = FALSE, $result_output = FALSE, $show_question_only = TRUE, $show_feedback = FALSE, $show_correct_solution = FALSE)
389 $userdata = $this->
object->getActiveUserData($active_id);
392 include_once
"./classes/class.ilTemplate.php";
393 include_once
"./Modules/Test/classes/class.ilObjTest.php";
394 $template =
new ilTemplate(
"tpl.il_as_qpl_javaapplet_question_output_solution.html", TRUE, TRUE,
"Modules/TestQuestionPool");
395 $solutiontemplate =
new ilTemplate(
"tpl.il_as_tst_solution_output.html",TRUE, TRUE,
"Modules/TestQuestionPool");
396 if (strlen($userdata[
"test_id"]))
398 $template->setCurrentBlock(
"appletparam");
399 $template->setVariable(
"PARAM_NAME",
"test_type");
402 $template->setVariable(
"PARAM_VALUE",
"0");
406 $template->setVariable(
"PARAM_VALUE",
"1");
408 $template->parseCurrentBlock();
410 if (strlen($userdata[
"test_id"]))
412 $template->setCurrentBlock(
"appletparam");
413 $template->setVariable(
"PARAM_NAME",
"test_id");
414 $template->setVariable(
"PARAM_VALUE", $userdata[
"test_id"]);
415 $template->parseCurrentBlock();
417 $template->setCurrentBlock(
"appletparam");
418 $template->setVariable(
"PARAM_NAME",
"active_id");
419 $template->setVariable(
"PARAM_VALUE", $active_id);
420 $template->parseCurrentBlock();
421 $template->setCurrentBlock(
"appletparam");
422 $template->setVariable(
"PARAM_NAME",
"question_id");
423 $template->setVariable(
"PARAM_VALUE", $this->object->getId());
424 $template->parseCurrentBlock();
425 if (strlen($userdata[
"user_id"]))
427 $template->setCurrentBlock(
"appletparam");
428 $template->setVariable(
"PARAM_NAME",
"user_id");
429 $template->setVariable(
"PARAM_VALUE", $userdata[
"user_id"]);
430 $template->parseCurrentBlock();
432 $template->setCurrentBlock(
"appletparam");
433 $template->setVariable(
"PARAM_NAME",
"points_max");
434 $template->setVariable(
"PARAM_VALUE", $this->object->getPoints());
435 $template->parseCurrentBlock();
436 $template->setCurrentBlock(
"appletparam");
437 $template->setVariable(
"PARAM_NAME",
"session_id");
438 $template->setVariable(
"PARAM_VALUE",
$_COOKIE[
"PHPSESSID"]);
439 $template->parseCurrentBlock();
440 $template->setCurrentBlock(
"appletparam");
441 $template->setVariable(
"PARAM_NAME",
"client");
442 $template->setVariable(
"PARAM_VALUE", CLIENT_ID);
443 $template->parseCurrentBlock();
444 $template->setCurrentBlock(
"appletparam");
445 $template->setVariable(
"PARAM_NAME",
"pass");
447 $template->setVariable(
"PARAM_VALUE", $actualpass);
448 $template->parseCurrentBlock();
450 for ($i = 0; $i < $this->
object->getParameterCount(); $i++)
452 $parameter = $this->
object->getParameter($i);
453 $template->setCurrentBlock(
"appletparam");
454 $template->setVariable(
"PARAM_NAME", $parameter[
"name"]);
455 $template->setVariable(
"PARAM_VALUE", $parameter[
"value"]);
456 $template->parseCurrentBlock();
459 if (($active_id > 0) && (!$show_correct_solution))
462 include_once
"./Modules/Test/classes/class.ilObjTest.php";
463 $info = $this->
object->getReachedInformation($active_id,
$pass);
464 foreach ($info as $kk => $infodata)
466 $template->setCurrentBlock(
"appletparam");
467 $template->setVariable(
"PARAM_NAME",
"value_" . $infodata[
"order"] .
"_1");
468 $template->setVariable(
"PARAM_VALUE", $infodata[
"value1"]);
469 $template->parseCurrentBlock();
470 $template->setCurrentBlock(
"appletparam");
471 $template->setVariable(
"PARAM_NAME",
"value_" . $infodata[
"order"] .
"_2");
472 $template->setVariable(
"PARAM_VALUE", $infodata[
"value2"]);
473 $template->parseCurrentBlock();
477 $questiontext = $this->
object->getQuestion();
478 $template->setVariable(
"QUESTIONTEXT", $this->object->prepareTextareaOutput($questiontext, TRUE));
479 $template->setVariable(
"APPLET_WIDTH", $this->object->getJavaWidth());
480 $template->setVariable(
"APPLET_HEIGHT", $this->object->getJavaHeight());
481 $template->setVariable(
"APPLET_CODE", $this->object->getJavaCode());
482 if (strlen($this->object->getJavaArchive()) > 0)
484 $template->setVariable(
"APPLET_ARCHIVE",
" archive=\"".$this->object->getJavaArchive().
"\"");
488 if (strpos($this->object->getJavaAppletFilename(),
".jar") !== FALSE)
490 $template->setVariable(
"APPLET_ARCHIVE",
" archive=\"".$this->object->getJavaPathWeb().$this->object->getJavaAppletFilename().
"\"");
493 if (strlen($this->object->getJavaCodebase()) > 0)
495 $template->setVariable(
"APPLET_CODEBASE",
" codebase=\"".$this->object->getJavaCodebase().
"\"");
499 if (strpos($this->object->getJavaAppletFilename(),
".class") !== FALSE)
501 $template->setVariable(
"APPLET_CODEBASE",
" codebase=\"".$this->object->getJavaPathWeb().
"\"");
504 if (($active_id > 0) && (!$show_correct_solution))
506 if ($graphicalOutput)
509 $reached_points = $this->
object->getReachedPoints($active_id,
$pass);
510 if ($reached_points == $this->object->getMaximumPoints())
512 $template->setCurrentBlock(
"icon_ok");
514 $template->setVariable(
"TEXT_OK", $this->lng->txt(
"answer_is_right"));
515 $template->parseCurrentBlock();
519 $template->setCurrentBlock(
"icon_ok");
520 if ($reached_points > 0)
523 $template->setVariable(
"TEXT_NOT_OK", $this->lng->txt(
"answer_is_not_correct_but_positive"));
528 $template->setVariable(
"TEXT_NOT_OK", $this->lng->txt(
"answer_is_wrong"));
530 $template->parseCurrentBlock();
534 $questionoutput = $template->get();
536 if (strlen($feedback)) $solutiontemplate->setVariable(
"FEEDBACK", $feedback);
537 $solutiontemplate->setVariable(
"SOLUTION_OUTPUT", $questionoutput);
539 $solutionoutput = $solutiontemplate->get();
540 if (!$show_question_only)
545 return $solutionoutput;
551 include_once
"./classes/class.ilTemplate.php";
552 $template =
new ilTemplate(
"tpl.il_as_qpl_javaapplet_question_output.html", TRUE, TRUE,
"Modules/TestQuestionPool");
553 $template->setCurrentBlock(
"appletparam");
554 $template->setVariable(
"PARAM_NAME",
"question_id");
555 $template->setVariable(
"PARAM_VALUE", $this->object->getId());
556 $template->parseCurrentBlock();
557 $template->setCurrentBlock(
"appletparam");
558 $template->setVariable(
"PARAM_NAME",
"points_max");
559 $template->setVariable(
"PARAM_VALUE", $this->object->getPoints());
560 $template->parseCurrentBlock();
561 $template->setCurrentBlock(
"appletparam");
562 $template->setVariable(
"PARAM_NAME",
"session_id");
563 $template->setVariable(
"PARAM_VALUE",
$_COOKIE[
"PHPSESSID"]);
564 $template->parseCurrentBlock();
565 $template->setCurrentBlock(
"appletparam");
566 $template->setVariable(
"PARAM_NAME",
"client");
567 $template->setVariable(
"PARAM_VALUE", CLIENT_ID);
568 $template->parseCurrentBlock();
570 for ($i = 0; $i < $this->
object->getParameterCount(); $i++)
572 $parameter = $this->
object->getParameter($i);
573 $template->setCurrentBlock(
"appletparam");
574 $template->setVariable(
"PARAM_NAME", $parameter[
"name"]);
575 $template->setVariable(
"PARAM_VALUE", $parameter[
"value"]);
576 $template->parseCurrentBlock();
579 $questiontext = $this->
object->getQuestion();
580 $template->setVariable(
"QUESTIONTEXT", $this->object->prepareTextareaOutput($questiontext, TRUE));
581 $template->setVariable(
"APPLET_WIDTH", $this->object->getJavaWidth());
582 $template->setVariable(
"APPLET_HEIGHT", $this->object->getJavaHeight());
583 $template->setVariable(
"APPLET_CODE", $this->object->getJavaCode());
584 if (strlen($this->object->getJavaArchive()) > 0)
586 $template->setVariable(
"APPLET_ARCHIVE",
" archive=\"".$this->object->getJavaArchive().
"\"");
590 if (strpos($this->object->getJavaAppletFilename(),
".jar") !== FALSE)
592 $template->setVariable(
"APPLET_ARCHIVE",
" archive=\"".$this->object->getJavaPathWeb().$this->object->getJavaAppletFilename().
"\"");
595 if (strlen($this->object->getJavaCodebase()) > 0)
597 $template->setVariable(
"APPLET_CODEBASE",
" codebase=\"".$this->object->getJavaCodebase().
"\"");
601 if (strpos($this->object->getJavaAppletFilename(),
".class") !== FALSE)
603 $template->setVariable(
"APPLET_CODEBASE",
" codebase=\"".$this->object->getJavaPathWeb().
"\"");
606 $questionoutput = $template->get();
607 if (!$show_question_only)
612 return $questionoutput;
617 $userdata = $this->
object->getActiveUserData($active_id);
619 include_once
"./classes/class.ilTemplate.php";
620 $template =
new ilTemplate(
"tpl.il_as_qpl_javaapplet_question_output.html", TRUE, TRUE,
"Modules/TestQuestionPool");
621 $template->setCurrentBlock(
"appletparam");
622 $template->setVariable(
"PARAM_NAME",
"test_type");
623 include_once
"./Modules/Test/classes/class.ilObjTest.php";
626 $template->setVariable(
"PARAM_VALUE",
"0");
630 $template->setVariable(
"PARAM_VALUE",
"1");
632 $template->parseCurrentBlock();
633 $template->setCurrentBlock(
"appletparam");
634 $template->setVariable(
"PARAM_NAME",
"active_id");
635 $template->setVariable(
"PARAM_VALUE", $active_id);
636 $template->parseCurrentBlock();
637 $template->setCurrentBlock(
"appletparam");
638 $template->setVariable(
"PARAM_NAME",
"test_id");
639 $template->setVariable(
"PARAM_VALUE", $userdata[
"test_id"]);
640 $template->parseCurrentBlock();
641 $template->setCurrentBlock(
"appletparam");
642 $template->setVariable(
"PARAM_NAME",
"question_id");
643 $template->setVariable(
"PARAM_VALUE", $this->object->getId());
644 $template->parseCurrentBlock();
645 $template->setCurrentBlock(
"appletparam");
646 $template->setVariable(
"PARAM_NAME",
"user_id");
647 $template->setVariable(
"PARAM_VALUE", $userdata[
"user_id"]);
648 $template->parseCurrentBlock();
649 $template->setCurrentBlock(
"appletparam");
650 $template->setVariable(
"PARAM_NAME",
"points_max");
651 $template->setVariable(
"PARAM_VALUE", $this->object->getPoints());
652 $template->parseCurrentBlock();
653 $template->setCurrentBlock(
"appletparam");
654 $template->setVariable(
"PARAM_NAME",
"session_id");
655 $template->setVariable(
"PARAM_VALUE",
$_COOKIE[
"PHPSESSID"]);
656 $template->parseCurrentBlock();
657 $template->setCurrentBlock(
"appletparam");
658 $template->setVariable(
"PARAM_NAME",
"client");
659 $template->setVariable(
"PARAM_VALUE", CLIENT_ID);
660 $template->parseCurrentBlock();
661 $template->setCurrentBlock(
"appletparam");
662 $template->setVariable(
"PARAM_NAME",
"pass");
664 $template->setVariable(
"PARAM_VALUE", $actualpass);
665 $template->parseCurrentBlock();
666 $template->setCurrentBlock(
"appletparam");
667 $template->setVariable(
"PARAM_NAME",
"post_url");
669 $template->parseCurrentBlock();
671 for ($i = 0; $i < $this->
object->getParameterCount(); $i++)
673 $parameter = $this->
object->getParameter($i);
674 $template->setCurrentBlock(
"appletparam");
675 $template->setVariable(
"PARAM_NAME", $parameter[
"name"]);
676 $template->setVariable(
"PARAM_VALUE", $parameter[
"value"]);
677 $template->parseCurrentBlock();
683 include_once
"./Modules/Test/classes/class.ilObjTest.php";
688 $info = $this->
object->getReachedInformation($active_id,
$pass);
689 foreach ($info as $kk => $infodata)
691 $template->setCurrentBlock(
"appletparam");
692 $template->setVariable(
"PARAM_NAME",
"value_" . $infodata[
"order"] .
"_1");
693 $template->setVariable(
"PARAM_VALUE", $infodata[
"value1"]);
694 $template->parseCurrentBlock();
695 $template->setCurrentBlock(
"appletparam");
696 $template->setVariable(
"PARAM_NAME",
"value_" . $infodata[
"order"] .
"_2");
697 $template->setVariable(
"PARAM_VALUE", $infodata[
"value2"]);
698 $template->parseCurrentBlock();
700 include_once
'./Services/Administration/classes/class.ilSetting.php';
702 if ($soapSetting->get(
"soap_user_administration") == 1)
704 $template->setCurrentBlock(
"appletparam");
705 $template->setVariable(
"PARAM_NAME",
"server");
710 $questiontext = $this->
object->getQuestion();
711 $template->setVariable(
"QUESTIONTEXT", $this->object->prepareTextareaOutput($questiontext, TRUE));
712 $template->setVariable(
"APPLET_WIDTH", $this->object->getJavaWidth());
713 $template->setVariable(
"APPLET_HEIGHT", $this->object->getJavaHeight());
714 $template->setVariable(
"APPLET_CODE", $this->object->getJavaCode());
715 if (strlen($this->object->getJavaArchive()) > 0)
717 $template->setVariable(
"APPLET_ARCHIVE",
" archive=\"".$this->object->getJavaArchive().
"\"");
721 if (strpos($this->object->getJavaAppletFilename(),
".jar") !== FALSE)
723 $template->setVariable(
"APPLET_ARCHIVE",
" archive=\"".$this->object->getJavaPathWeb().$this->object->getJavaAppletFilename().
"\"");
726 if (strlen($this->object->getJavaCodebase()) > 0)
728 $template->setVariable(
"APPLET_CODEBASE",
" codebase=\"".$this->object->getJavaCodebase().
"\"");
732 if (strpos($this->object->getJavaAppletFilename(),
".class") !== FALSE)
734 $template->setVariable(
"APPLET_CODEBASE",
" codebase=\"".$this->object->getJavaPathWeb().
"\"");
737 $questionoutput = $template->get();
738 $pageoutput = $this->
outQuestionPage(
"", $is_postponed, $active_id, $questionoutput);
747 if ((strlen($_POST[
"title"]) == 0) or (strlen($_POST[
"author"]) == 0) or (strlen($_POST[
"question"]) == 0) or (strlen($_POST[
"applet_points"]) == 0))
749 $this->error .= $this->lng->txt(
"fill_out_all_required_fields");
759 if ($_POST[
"cmd"][
"addSuggestedSolution"])
773 $this->
object->saveToDb();
774 $this->ctrl->setParameter($this,
"q_id", $this->object->getId());
775 $this->tpl->setVariable(
"HEADER", $this->object->getTitle());
789 include_once
"./Services/AdvancedEditing/classes/class.ilObjAdvancedEditing.php";
792 $this->
object->cleanupMediaObjectUsage();
805 $this->tpl->addBlockFile(
"ADM_CONTENT",
"feedback",
"tpl.il_as_qpl_javaapplet_question_feedback.html",
"Modules/TestQuestionPool");
806 $this->tpl->setVariable(
"FEEDBACK_TEXT", $this->lng->txt(
"feedback"));
807 $this->tpl->setVariable(
"FEEDBACK_COMPLETE", $this->lng->txt(
"feedback_complete_solution"));
808 $this->tpl->setVariable(
"VALUE_FEEDBACK_COMPLETE",
ilUtil::prepareFormOutput($this->object->prepareTextareaOutput($this->object->getFeedbackGeneric(1)), FALSE));
809 $this->tpl->setVariable(
"FEEDBACK_INCOMPLETE", $this->lng->txt(
"feedback_incomplete_solution"));
810 $this->tpl->setVariable(
"VALUE_FEEDBACK_INCOMPLETE",
ilUtil::prepareFormOutput($this->object->prepareTextareaOutput($this->object->getFeedbackGeneric(0)), FALSE));
812 if ($rbacsystem->checkAccess(
'write',
$_GET[
"ref_id"]))
814 $this->tpl->setVariable(
"SAVE", $this->lng->txt(
"save"));
816 $this->tpl->setVariable(
"FORMACTION", $this->ctrl->getFormAction($this));
818 include_once
"./Services/RTE/classes/class.ilRTE.php";
820 include_once
"./Services/RTE/classes/class.$rtestring.php";
821 $rte =
new $rtestring();
822 $rte->addPlugin(
"latex");
823 $rte->addButton(
"latex"); $rte->addButton(
"pastelatex");
824 include_once
"./classes/class.ilObject.php";
825 $obj_id =
$_GET[
"q_id"];
827 $rte->addRTESupport($obj_id, $obj_type,
"assessment");
839 global $rbacsystem, $ilTabs;
841 $this->ctrl->setParameterByClass(
"ilpageobjectgui",
"q_id",
$_GET[
"q_id"]);
842 include_once
"./Modules/TestQuestionPool/classes/class.assQuestion.php";
843 $q_type = $this->
object->getQuestionType();
847 $classname = $q_type .
"GUI";
848 $this->ctrl->setParameterByClass(strtolower($classname),
"sel_question_types", $q_type);
849 $this->ctrl->setParameterByClass(strtolower($classname),
"q_id",
$_GET[
"q_id"]);
854 if ($rbacsystem->checkAccess(
'write',
$_GET[
"ref_id"]))
857 $ilTabs->addTarget(
"edit_content",
858 $this->ctrl->getLinkTargetByClass(
"ilPageObjectGUI",
"edit"),
859 array(
"edit",
"insert",
"exec_pg"),
860 "",
"", $force_active);
864 $ilTabs->addTarget(
"preview",
865 $this->ctrl->getLinkTargetByClass(
"ilPageObjectGUI",
"preview"),
867 "ilPageObjectGUI",
"", $force_active);
870 $force_active =
false;
871 if ($rbacsystem->checkAccess(
'write',
$_GET[
"ref_id"]))
874 if ($classname) $url = $this->ctrl->getLinkTargetByClass($classname,
"editQuestion");
875 $commands = $_POST[
"cmd"];
876 if (is_array($commands))
878 foreach ($commands as $key => $value)
880 if (preg_match(
"/^delete_.*/", $key, $matches))
882 $force_active =
true;
887 $ilTabs->addTarget(
"edit_properties",
889 array(
"editQuestion",
"save",
"cancel",
"addSuggestedSolution",
890 "cancelExplorer",
"linkChilds",
"removeSuggestedSolution",
891 "uploadingJavaapplet",
"addParameter",
893 $classname,
"", $force_active);
898 $ilTabs->addTarget(
"feedback",
899 $this->ctrl->getLinkTargetByClass($classname,
"feedback"),
900 array(
"feedback",
"saveFeedback"),
907 $ilTabs->addTarget(
"statistics",
908 $this->ctrl->getLinkTargetByClass($classname,
"assessment"),
913 if ((
$_GET[
"calling_test"] > 0) || (
$_GET[
"test_ref_id"] > 0))
917 $ilTabs->setBackTarget($this->lng->txt(
"backtocallingtest"),
"ilias.php?baseClass=ilObjTestGUI&cmd=questions&ref_id=$ref_id");
921 $ilTabs->setBackTarget($this->lng->txt(
"qpl"), $this->ctrl->getLinkTargetByClass(
"ilobjquestionpoolgui",
"questions"));