ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
class.assJavaAppletGUI.php
Go to the documentation of this file.
1<?php
2/* Copyright (c) 1998-2013 ILIAS open source, Extended GPL, see docs/LICENSE */
3
4require_once './Modules/TestQuestionPool/classes/class.assQuestionGUI.php';
5require_once './Modules/TestQuestionPool/interfaces/interface.ilGuiQuestionScoringAdjustable.php';
6include_once './Modules/Test/classes/inc.AssessmentConstants.php';
7
24{
34 public function __construct($id = -1)
35 {
36 parent::__construct();
37 include_once './Modules/TestQuestionPool/classes/class.assJavaApplet.php';
38 $this->object = new assJavaApplet();
39 if ($id >= 0) {
40 $this->object->loadFromDb($id);
41 }
42 }
43
44 public function getCommand($cmd)
45 {
46 if (substr($cmd, 0, 6) == "delete") {
47 $cmd = "delete";
48 }
49 return $cmd;
50 }
51
55 protected function writePostData($always = false)
56 {
57 $hasErrors = (!$always) ? $this->editQuestion(true) : false;
58 if (!$hasErrors) {
59 require_once 'Services/Form/classes/class.ilPropertyFormGUI.php';
60
62
63 $this->object->setPoints($_POST["points"]);
65
67
68 return 0;
69 }
70 return 1;
71 }
72
74 {
75 if ($_POST['delete_applet']) {
76 // delete the applet file
77 $this->object->deleteJavaAppletFilename();
78 } else {
79 $this->object->setJavaAppletFilename($_POST['uploaded_javaapplet']);
80 }
81
82 //setting java applet
83 if (!empty($_FILES['javaappletName']['tmp_name'])) {
84 $this->object->setJavaAppletFilename(
85 $_FILES['javaappletName']['name'],
86 $_FILES['javaappletName']['tmp_name']
87 );
88 }
89 $this->object->setJavaCode($_POST["java_code"]);
90 $this->object->setJavaCodebase($_POST["java_codebase"]);
91 $this->object->setJavaArchive($_POST["java_archive"]);
92 $this->object->setJavaWidth($_POST["java_width"]);
93 $this->object->setJavaHeight($_POST["java_height"]);
94
95 $this->object->flushParams();
96 if (is_array($_POST['kvp']['key'])) {
97 foreach ($_POST['kvp']['key'] as $idx => $val) {
98 if (strlen($val) && strlen($_POST['kvp']['value'][$idx])) {
99 $this->object->addParameter($val, $_POST['kvp']['value'][$idx]);
100 }
101 }
102 }
103 }
104
109 public function editQuestion($checkonly = false)
110 {
111 $save = $this->isSaveCommand();
112 $this->getQuestionTemplate();
113
114 include_once("./Services/Form/classes/class.ilPropertyFormGUI.php");
115 $form = new ilPropertyFormGUI();
116 $this->editForm = $form;
117
118 $form->setFormAction($this->ctrl->getFormAction($this));
119 $form->setTitle($this->outQuestionType());
120 $form->setMultipart(true);
121 $form->setTableWidth("100%");
122 $form->setId("assjavaapplet");
123
126
128
130
131 $errors = false;
132
133 if ($save) {
134 $form->setValuesByPost();
135 $errors = !$form->checkInput();
136 $form->setValuesByPost(); // again, because checkInput now performs the whole stripSlashes handling and we need this if we don't want to have duplication of backslashes
137 if ($errors) {
138 $checkonly = false;
139 }
140 }
141
142 if (!$checkonly) {
143 $this->tpl->setVariable("QUESTION_DATA", $form->getHTML());
144 }
145 return $errors;
146 }
147
149 {
150 // points
151 $points = new ilNumberInputGUI($this->lng->txt("points"), "points");
152 $points->setValue($this->object->getPoints());
153 $points->setRequired(true);
154 $points->setSize(3);
155 $points->setMinValue(0.0);
156 $form->addItem($points);
157
159 $header->setTitle($this->lng->txt("applet_attributes"));
160 $form->addItem($header);
161
162 // java applet
163 $javaapplet = $this->object->getJavaAppletFilename();
164 $applet = new ilFileInputGUI($this->lng->txt('javaapplet'), 'javaappletName');
165 $applet->setSuffixes(array( 'jar', 'class' ));
166 $applet->setRequired(false);
167
168 if (strlen($javaapplet)) {
169 $filename = new ilNonEditableValueGUI($this->lng->txt('filename'), 'uploaded_javaapplet');
170 $filename->setValue($javaapplet);
171 $applet->addSubItem($filename);
172
173 $delete = new ilCheckboxInputGUI('', 'delete_applet');
174 $delete->setOptionTitle($this->lng->txt('delete'));
175 $delete->setValue(1);
176 $applet->addSubItem($delete);
177 }
178 $form->addItem($applet);
179
180 // Code
181 $code = new ilTextInputGUI($this->lng->txt("code"), "java_code");
182 $code->setValue($this->object->getJavaCode());
183 $code->setRequired(true);
184 $form->addItem($code);
185
186 if (!strlen($javaapplet)) {
187 // Archive
188 $archive = new ilTextInputGUI($this->lng->txt("archive"), "java_archive");
189 $archive->setValue($this->object->getJavaArchive());
190 $archive->setRequired(false);
191 $form->addItem($archive);
192
193 // Codebase
194 $codebase = new ilTextInputGUI($this->lng->txt("codebase"), "java_codebase");
195 $codebase->setValue($this->object->getJavaCodebase());
196 $codebase->setRequired(false);
197 $form->addItem($codebase);
198 }
199
200 // Width
201 $width = new ilNumberInputGUI($this->lng->txt("width"), "java_width");
202 $width->setDecimals(0);
203 $width->setSize(6);
204 $width->setMinValue(50);
205 $width->setMaxLength(6);
206 $width->setValue($this->object->getJavaWidth());
207 $width->setRequired(true);
208 $form->addItem($width);
209
210 // Height
211 $height = new ilNumberInputGUI($this->lng->txt("height"), "java_height");
212 $height->setDecimals(0);
213 $height->setSize(6);
214 $height->setMinValue(50);
215 $height->setMaxLength(6);
216 $height->setValue($this->object->getJavaHeight());
217 $height->setRequired(true);
218 $form->addItem($height);
219
221 $header->setTitle($this->lng->txt("applet_parameters"));
222 $form->addItem($header);
223
224 include_once "./Modules/TestQuestionPool/classes/class.ilKVPWizardInputGUI.php";
225 $kvp = new ilKVPWizardInputGUI($this->lng->txt("applet_parameters"), "kvp");
226 $values = array();
227 for ($i = 0; $i < $this->object->getParameterCount(); $i++) {
228 $param = $this->object->getParameter($i);
229 array_push($values, array( $param['name'], $param['value'] ));
230 }
231 if (count($values) == 0) {
232 array_push($values, array( "", "" ));
233 }
234 $kvp->setKeyName($this->lng->txt('name'));
235 $kvp->setValueName($this->lng->txt('value'));
236 $kvp->setValues($values);
237 $form->addItem($kvp);
238 }
239
243 public function addkvp()
244 {
245 $this->writePostData(true);
246 $position = key($_POST['cmd']['addkvp']);
247 $this->object->addParameterAtIndex($position + 1, "", "");
248 $this->editQuestion();
249 }
250
254 public function removekvp()
255 {
256 $this->writePostData(true);
257 $position = key($_POST['cmd']['removekvp']);
258 $this->object->removeParameter($position);
259 $this->editQuestion();
260 }
261
275 public function getSolutionOutput(
276 $active_id,
277 $pass = null,
278 $graphicalOutput = false,
279 $result_output = false,
280 $show_question_only = true,
281 $show_feedback = false,
282 $show_correct_solution = false,
283 $show_manual_scoring = false,
284 $show_question_text = true
285 ) {
286 $userdata = $this->object->getActiveUserData($active_id);
287
288 // generate the question output
289 include_once "./Services/UICore/classes/class.ilTemplate.php";
290 include_once "./Modules/Test/classes/class.ilObjTest.php";
291 $template = new ilTemplate("tpl.il_as_qpl_javaapplet_question_output_solution.html", true, true, "Modules/TestQuestionPool");
292 $solutiontemplate = new ilTemplate("tpl.il_as_tst_solution_output.html", true, true, "Modules/TestQuestionPool");
293 if (strlen($userdata["test_id"])) {
294 $template->setCurrentBlock("appletparam");
295 $template->setVariable("PARAM_NAME", "test_type");
297 $template->setVariable("PARAM_VALUE", "0");
298 } else {
299 $template->setVariable("PARAM_VALUE", "1");
300 }
301 $template->parseCurrentBlock();
302 }
303 if (strlen($userdata["test_id"])) {
304 $template->setCurrentBlock("appletparam");
305 $template->setVariable("PARAM_NAME", "test_id");
306 $template->setVariable("PARAM_VALUE", $userdata["test_id"]);
307 $template->parseCurrentBlock();
308 }
309 $template->setCurrentBlock("appletparam");
310 $template->setVariable("PARAM_NAME", "active_id");
311 $template->setVariable("PARAM_VALUE", $active_id);
312 $template->parseCurrentBlock();
313 $template->setCurrentBlock("appletparam");
314 $template->setVariable("PARAM_NAME", "question_id");
315 $template->setVariable("PARAM_VALUE", $this->object->getId());
316 $template->parseCurrentBlock();
317 if (strlen($userdata["user_id"])) {
318 $template->setCurrentBlock("appletparam");
319 $template->setVariable("PARAM_NAME", "user_id");
320 $template->setVariable("PARAM_VALUE", $userdata["user_id"]);
321 $template->parseCurrentBlock();
322 }
323 $template->setCurrentBlock("appletparam");
324 $template->setVariable("PARAM_NAME", "points_max");
325 $template->setVariable("PARAM_VALUE", $this->object->getPoints());
326 $template->parseCurrentBlock();
327 $template->setCurrentBlock("appletparam");
328 $template->setVariable("PARAM_NAME", "session_id");
329 $template->setVariable("PARAM_VALUE", $_COOKIE[session_name()]);
330 $template->parseCurrentBlock();
331 $template->setCurrentBlock("appletparam");
332 $template->setVariable("PARAM_NAME", "client");
333 $template->setVariable("PARAM_VALUE", CLIENT_ID);
334 $template->parseCurrentBlock();
335 $template->setCurrentBlock("appletparam");
336 $template->setVariable("PARAM_NAME", "pass");
337 $actualpass = ilObjTest::_getPass($active_id);
338 $template->setVariable("PARAM_VALUE", $actualpass);
339 $template->parseCurrentBlock();
340 // additional parameters
341 for ($i = 0; $i < $this->object->getParameterCount(); $i++) {
342 $parameter = $this->object->getParameter($i);
343 $template->setCurrentBlock("appletparam");
344 $template->setVariable("PARAM_NAME", $parameter["name"]);
345 $template->setVariable("PARAM_VALUE", $parameter["value"]);
346 $template->parseCurrentBlock();
347 }
348
349 if (($active_id > 0) && (!$show_correct_solution)) {
350 $solutions = null;
351 include_once "./Modules/Test/classes/class.ilObjTest.php";
352 $info = $this->object->getSolutionValues($active_id, $pass);
353 foreach ($info as $kk => $infodata) {
354 $template->setCurrentBlock("appletparam");
355 $template->setVariable("PARAM_NAME", "value_" . $infodata["order"] . "_1");
356 $template->setVariable("PARAM_VALUE", $infodata["value1"]);
357 $template->parseCurrentBlock();
358 $template->setCurrentBlock("appletparam");
359 $template->setVariable("PARAM_NAME", "value_" . $infodata["order"] . "_2");
360 $template->setVariable("PARAM_VALUE", $infodata["value2"]);
361 $template->parseCurrentBlock();
362 }
363 }
364
365 $questiontext = $this->object->getQuestion();
366 if ($show_question_text == true) {
367 $template->setVariable("QUESTIONTEXT", $this->object->prepareTextareaOutput($questiontext, true));
368 }
369 $template->setVariable("APPLET_WIDTH", $this->object->getJavaWidth());
370 $template->setVariable("APPLET_HEIGHT", $this->object->getJavaHeight());
371 $template->setVariable("APPLET_CODE", $this->object->getJavaCode());
372 if (strlen($this->object->getJavaArchive()) > 0) {
373 $template->setVariable("APPLET_ARCHIVE", " archive=\"" . $this->object->getJavaArchive() . "\"");
374 } else {
375 if (strpos($this->object->getJavaAppletFilename(), ".jar") !== false) {
376 $template->setVariable("APPLET_ARCHIVE", " archive=\"" . $this->object->getJavaPathWeb() . $this->object->getJavaAppletFilename() . "\"");
377 }
378 }
379 if (strlen($this->object->getJavaCodebase()) > 0) {
380 $template->setVariable("APPLET_CODEBASE", " codebase=\"" . $this->object->getJavaCodebase() . "\"");
381 } else {
382 if (strpos($this->object->getJavaAppletFilename(), ".class") !== false) {
383 $template->setVariable("APPLET_CODEBASE", " codebase=\"" . $this->object->getJavaPathWeb() . "\"");
384 }
385 }
386 if (($active_id > 0) && (!$show_correct_solution)) {
387 if ($graphicalOutput) {
388 // output of ok/not ok icons for user entered solutions
389 $reached_points = $this->object->getReachedPoints($active_id, $pass);
390 if ($reached_points == $this->object->getPoints()) {
391 $template->setCurrentBlock("icon_ok");
392 $template->setVariable("ICON_OK", ilUtil::getImagePath("icon_ok.svg"));
393 $template->setVariable("TEXT_OK", $this->lng->txt("answer_is_right"));
394 $template->parseCurrentBlock();
395 } else {
396 $template->setCurrentBlock("icon_ok");
397 if ($reached_points > 0) {
398 $template->setVariable("ICON_NOT_OK", ilUtil::getImagePath("icon_mostly_ok.svg"));
399 $template->setVariable("TEXT_NOT_OK", $this->lng->txt("answer_is_not_correct_but_positive"));
400 } else {
401 $template->setVariable("ICON_NOT_OK", ilUtil::getImagePath("icon_not_ok.svg"));
402 $template->setVariable("TEXT_NOT_OK", $this->lng->txt("answer_is_wrong"));
403 }
404 $template->parseCurrentBlock();
405 }
406 }
407 }
408 $questionoutput = $template->get();
409 $feedback = ($show_feedback && !$this->isTestPresentationContext()) ? $this->getAnswerFeedbackOutput($active_id, $pass) : "";
410 if (strlen($feedback)) {
411 $cssClass = (
412 $this->hasCorrectSolution($active_id, $pass) ?
414 );
415
416 $solutiontemplate->setVariable("ILC_FB_CSS_CLASS", $cssClass);
417 $solutiontemplate->setVariable("FEEDBACK", $this->object->prepareTextareaOutput($feedback, true));
418 }
419 $solutiontemplate->setVariable("SOLUTION_OUTPUT", $questionoutput);
420
421 $solutionoutput = $solutiontemplate->get();
422 if (!$show_question_only) {
423 // get page object output
424 $solutionoutput = $this->getILIASPage($solutionoutput);
425 }
426 return $solutionoutput;
427 }
428
429 public function getPreview($show_question_only = false, $showInlineFeedback = false)
430 {
431 // generate the question output
432 include_once "./Services/UICore/classes/class.ilTemplate.php";
433 $template = new ilTemplate("tpl.il_as_qpl_javaapplet_question_output.html", true, true, "Modules/TestQuestionPool");
434 $template->setCurrentBlock("appletparam");
435 $template->setVariable("PARAM_NAME", "question_id");
436 $template->setVariable("PARAM_VALUE", $this->object->getId());
437 $template->parseCurrentBlock();
438 $template->setCurrentBlock("appletparam");
439 $template->setVariable("PARAM_NAME", "points_max");
440 $template->setVariable("PARAM_VALUE", $this->object->getPoints());
441 $template->parseCurrentBlock();
442 $template->setCurrentBlock("appletparam");
443 $template->setVariable("PARAM_NAME", "session_id");
444 $template->setVariable("PARAM_VALUE", $_COOKIE[session_name()]);
445 $template->parseCurrentBlock();
446 $template->setCurrentBlock("appletparam");
447 $template->setVariable("PARAM_NAME", "client");
448 $template->setVariable("PARAM_VALUE", CLIENT_ID);
449 $template->parseCurrentBlock();
450 // additional parameters
451 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();
457 }
458
459 $questiontext = $this->object->getQuestion();
460 $template->setVariable("QUESTIONTEXT", $this->object->prepareTextareaOutput($questiontext, true));
461 $template->setVariable("APPLET_WIDTH", $this->object->getJavaWidth());
462 $template->setVariable("APPLET_HEIGHT", $this->object->getJavaHeight());
463 $template->setVariable("APPLET_CODE", $this->object->getJavaCode());
464 if (strlen($this->object->getJavaArchive()) > 0) {
465 $template->setVariable("APPLET_ARCHIVE", " archive=\"" . $this->object->getJavaArchive() . "\"");
466 } else {
467 if (strpos($this->object->getJavaAppletFilename(), ".jar") !== false) {
468 $template->setVariable("APPLET_ARCHIVE", " archive=\"" . $this->object->getJavaPathWeb() . $this->object->getJavaAppletFilename() . "\"");
469 }
470 }
471 if (strlen($this->object->getJavaCodebase()) > 0) {
472 $template->setVariable("APPLET_CODEBASE", " codebase=\"" . $this->object->getJavaCodebase() . "\"");
473 } else {
474 if (strpos($this->object->getJavaAppletFilename(), ".class") !== false) {
475 $template->setVariable("APPLET_CODEBASE", " codebase=\"" . $this->object->getJavaPathWeb() . "\"");
476 }
477 }
478 $questionoutput = $template->get();
479 if (!$show_question_only) {
480 // get page object output
481 $questionoutput = $this->getILIASPage($questionoutput);
482 }
483 return $questionoutput;
484 }
485
486 // hey: prevPassSolutions - pass will be always available from now on
487 public function getTestOutput($active_id, $pass, $is_postponed = false, $use_post_solutions = false, $show_feedback = false)
488 // hey.
489 {
490 $userdata = $this->object->getActiveUserData($active_id);
491 // generate the question output
492 include_once "./Services/UICore/classes/class.ilTemplate.php";
493 $template = new ilTemplate("tpl.il_as_qpl_javaapplet_question_output.html", true, true, "Modules/TestQuestionPool");
494 $template->setCurrentBlock("appletparam");
495 $template->setVariable("PARAM_NAME", "test_type");
496 include_once "./Modules/Test/classes/class.ilObjTest.php";
498 $template->setVariable("PARAM_VALUE", "0");
499 } else {
500 $template->setVariable("PARAM_VALUE", "1");
501 }
502 $template->parseCurrentBlock();
503 $template->setCurrentBlock("appletparam");
504 $template->setVariable("PARAM_NAME", "active_id");
505 $template->setVariable("PARAM_VALUE", $active_id);
506 $template->parseCurrentBlock();
507 $template->setCurrentBlock("appletparam");
508 $template->setVariable("PARAM_NAME", "test_id");
509 $template->setVariable("PARAM_VALUE", $userdata["test_id"]);
510 $template->parseCurrentBlock();
511 $template->setCurrentBlock("appletparam");
512 $template->setVariable("PARAM_NAME", "question_id");
513 $template->setVariable("PARAM_VALUE", $this->object->getId());
514 $template->parseCurrentBlock();
515 $template->setCurrentBlock("appletparam");
516 $template->setVariable("PARAM_NAME", "user_id");
517 $template->setVariable("PARAM_VALUE", $userdata["user_id"]);
518 $template->parseCurrentBlock();
519 $template->setCurrentBlock("appletparam");
520 $template->setVariable("PARAM_NAME", "points_max");
521 $template->setVariable("PARAM_VALUE", $this->object->getPoints());
522 $template->parseCurrentBlock();
523 $template->setCurrentBlock("appletparam");
524 $template->setVariable("PARAM_NAME", "session_id");
525 $template->setVariable("PARAM_VALUE", $_COOKIE[session_name()]);
526 $template->parseCurrentBlock();
527 $template->setCurrentBlock("appletparam");
528 $template->setVariable("PARAM_NAME", "client");
529 $template->setVariable("PARAM_VALUE", CLIENT_ID);
530 $template->parseCurrentBlock();
531 $template->setCurrentBlock("appletparam");
532 $template->setVariable("PARAM_NAME", "pass");
533 $actualpass = ilObjTest::_getPass($active_id);
534 $template->setVariable("PARAM_VALUE", $actualpass);
535 $template->parseCurrentBlock();
536 $template->setCurrentBlock("appletparam");
537 $template->setVariable("PARAM_NAME", "post_url");
538 $template->setVariable("PARAM_VALUE", ilUtil::removeTrailingPathSeparators(ILIAS_HTTP_PATH) . "/Modules/TestQuestionPool/save_question_post_data.php");
539 $template->parseCurrentBlock();
540 // additional parameters
541 for ($i = 0; $i < $this->object->getParameterCount(); $i++) {
542 $parameter = $this->object->getParameter($i);
543 $template->setCurrentBlock("appletparam");
544 $template->setVariable("PARAM_NAME", $parameter["name"]);
545 $template->setVariable("PARAM_VALUE", $parameter["value"]);
546 $template->parseCurrentBlock();
547 }
548
549 if ($active_id) {
550 // hey: prevPassSolutions - obsolete due to central check
551 #$solutions = NULL;
552 #include_once "./Modules/Test/classes/class.ilObjTest.php";
553 #if (!ilObjTest::_getUsePreviousAnswers($active_id, true))
554 #{
555 # if (is_null($pass)) $pass = ilObjTest::_getPass($active_id);
556 #}
557 $info = $this->object->getTestOutputSolutions($active_id, $pass);
558 // hey.
559 foreach ($info as $kk => $infodata) {
560 $template->setCurrentBlock("appletparam");
561 $template->setVariable("PARAM_NAME", "value_" . $infodata["order"] . "_1");
562 $template->setVariable("PARAM_VALUE", $infodata["value1"]);
563 $template->parseCurrentBlock();
564 $template->setCurrentBlock("appletparam");
565 $template->setVariable("PARAM_NAME", "value_" . $infodata["order"] . "_2");
566 $template->setVariable("PARAM_VALUE", $infodata["value2"]);
567 $template->parseCurrentBlock();
568 }
569 include_once './Services/Administration/classes/class.ilSetting.php';
570 $soapSetting = new ilSetting();
571 if ($soapSetting->get("soap_user_administration") == 1) {
572 $template->setCurrentBlock("appletparam");
573 $template->setVariable("PARAM_NAME", "server");
574 $template->setVariable("PARAM_VALUE", ilUtil::removeTrailingPathSeparators(ILIAS_HTTP_PATH) . "/webservice/soap/server.php");
575 }
576 }
577
578 $questiontext = $this->object->getQuestion();
579 $template->setVariable("QUESTIONTEXT", $this->object->prepareTextareaOutput($questiontext, true));
580 $template->setVariable("APPLET_WIDTH", $this->object->getJavaWidth());
581 $template->setVariable("APPLET_HEIGHT", $this->object->getJavaHeight());
582 $template->setVariable("APPLET_CODE", $this->object->getJavaCode());
583 if (strlen($this->object->getJavaArchive()) > 0) {
584 $template->setVariable("APPLET_ARCHIVE", " archive=\"" . $this->object->getJavaArchive() . "\"");
585 } else {
586 if (strpos($this->object->getJavaAppletFilename(), ".jar") !== false) {
587 $template->setVariable("APPLET_ARCHIVE", " archive=\"" . $this->object->getJavaPathWeb() . $this->object->getJavaAppletFilename() . "\"");
588 }
589 }
590 if (strlen($this->object->getJavaCodebase()) > 0) {
591 $template->setVariable("APPLET_CODEBASE", " codebase=\"" . $this->object->getJavaCodebase() . "\"");
592 } else {
593 if (strpos($this->object->getJavaAppletFilename(), ".class") !== false) {
594 $template->setVariable("APPLET_CODEBASE", " codebase=\"" . $this->object->getJavaPathWeb() . "\"");
595 }
596 }
597 $questionoutput = $template->get();
598 $pageoutput = $this->outQuestionPage("", $is_postponed, $active_id, $questionoutput);
599 return $pageoutput;
600 }
601
609 public function setQuestionTabs()
610 {
611 global $DIC;
612 $rbacsystem = $DIC['rbacsystem'];
613 $ilTabs = $DIC['ilTabs'];
614
615 $ilTabs->clearTargets();
616
617 $this->ctrl->setParameterByClass("ilAssQuestionPageGUI", "q_id", $_GET["q_id"]);
618 include_once "./Modules/TestQuestionPool/classes/class.assQuestion.php";
619 $q_type = $this->object->getQuestionType();
620
621 if (strlen($q_type)) {
622 $classname = $q_type . "GUI";
623 $this->ctrl->setParameterByClass(strtolower($classname), "sel_question_types", $q_type);
624 $this->ctrl->setParameterByClass(strtolower($classname), "q_id", $_GET["q_id"]);
625 }
626
627 if ($_GET["q_id"]) {
628 if ($rbacsystem->checkAccess('write', $_GET["ref_id"])) {
629 // edit page
630 $ilTabs->addTarget(
631 "edit_page",
632 $this->ctrl->getLinkTargetByClass("ilAssQuestionPageGUI", "edit"),
633 array("edit", "insert", "exec_pg"),
634 "",
635 "",
636 $force_active
637 );
638 }
639
640 $this->addTab_QuestionPreview($ilTabs);
641 }
642
643 $force_active = false;
644 if ($rbacsystem->checkAccess('write', $_GET["ref_id"])) {
645 $url = "";
646 if ($classname) {
647 $url = $this->ctrl->getLinkTargetByClass($classname, "editQuestion");
648 }
649 $commands = $_POST["cmd"];
650 if (is_array($commands)) {
651 foreach ($commands as $key => $value) {
652 if (preg_match("/^delete_.*/", $key, $matches)) {
653 $force_active = true;
654 }
655 }
656 }
657 // edit question properties
658 $ilTabs->addTarget(
659 "edit_question",
660 $url,
661 array("editQuestion", "save", "saveEdit", "addkvp", "removekvp", "originalSyncForm"),
662 $classname,
663 "",
664 $force_active
665 );
666 }
667
668 // add tab for question feedback within common class assQuestionGUI
669 $this->addTab_QuestionFeedback($ilTabs);
670
671 // add tab for question hint within common class assQuestionGUI
672 $this->addTab_QuestionHints($ilTabs);
673
674 // add tab for question's suggested solution within common class assQuestionGUI
675 $this->addTab_SuggestedSolution($ilTabs, $classname);
676
677 // Assessment of questions sub menu entry
678 if ($_GET["q_id"]) {
679 $ilTabs->addTarget(
680 "statistics",
681 $this->ctrl->getLinkTargetByClass($classname, "assessment"),
682 array("assessment"),
683 $classname,
684 ""
685 );
686 }
687
688 $this->addBackTab($ilTabs);
689 }
690
691 public function getSpecificFeedbackOutput($userSolution)
692 {
693 $output = "";
694 return $this->object->prepareTextareaOutput($output, true);
695 }
696
707 {
708 return array();
709 }
710
719 public function getAggregatedAnswersView($relevant_answers)
720 {
721 // Empty implementation here since a feasible way to aggregate answer is not known.
722 return ''; //print_r($relevant_answers,true);
723 }
724}
$_COOKIE['client_id']
Definition: server.php:9
$filename
Definition: buildRTE.php:89
$_GET["client_id"]
$_POST["username"]
An exception for terminatinating execution or to throw for unit testing.
Java applet question GUI representation.
__construct($id=-1)
assJavaAppletGUI constructor
getSolutionOutput( $active_id, $pass=null, $graphicalOutput=false, $result_output=false, $show_question_only=true, $show_feedback=false, $show_correct_solution=false, $show_manual_scoring=false, $show_question_text=true)
Get the question solution output.
removekvp()
Remove an answer.
getPreview($show_question_only=false, $showInlineFeedback=false)
editQuestion($checkonly=false)
Creates an output of the edit form for the question.
writeQuestionSpecificPostData(ilPropertyFormGUI $form)
Extracts the question specific values from $_POST and applies them to the data object.
getTestOutput($active_id, $pass, $is_postponed=false, $use_post_solutions=false, $show_feedback=false)
populateQuestionSpecificFormPart(\ilPropertyFormGUI $form)
getSpecificFeedbackOutput($userSolution)
Returns the answer specific feedback for the question.
setQuestionTabs()
Sets the ILIAS tabs for this question type.
getAfterParticipationSuppressionQuestionPostVars()
Returns a list of postvars which will be suppressed in the form output when used in scoring adjustmen...
writePostData($always=false)
{Evaluates a posted edit form and writes the form data in the question object.integer A positive valu...
addkvp()
Add a new answer.
getAggregatedAnswersView($relevant_answers)
Returns an html string containing a question specific representation of the answers so far given in t...
Class for Java Applet Questions.
Basic GUI class for assessment questions.
populateTaxonomyFormSection(ilPropertyFormGUI $form)
addTab_QuestionHints(ilTabsGUI $tabs)
adds the hints tab to ilTabsGUI
addQuestionFormCommandButtons($form)
Add the command buttons of a question properties form.
getILIASPage($html="")
Returns the ILIAS Page around a question.
getQuestionTemplate()
get question template
addTab_SuggestedSolution(ilTabsGUI $tabs, $classname)
outQuestionPage($a_temp_var, $a_postponed=false, $active_id="", $html="", $inlineFeedbackEnabled=false)
output question page
addBackTab(ilTabsGUI $ilTabs)
hasCorrectSolution($activeId, $passIndex)
addTab_QuestionFeedback(ilTabsGUI $tabs)
adds the feedback tab to ilTabsGUI
addBasicQuestionFormProperties($form)
Add basic question form properties: assessment: title, author, description, question,...
addTab_QuestionPreview(ilTabsGUI $tabsGUI)
getAnswerFeedbackOutput($active_id, $pass)
Returns the answer generic feedback depending on the results of the question.
This class represents a checkbox property in a property form.
This class represents a file property in a property form.
This class represents a section header in a property form.
This class represents a key value pair wizard property in a property form.
This class represents a non editable value in a property form.
This class represents a number property in a property form.
static _getPass($active_id)
Retrieves the actual pass of a given user for a given test.
static _getObjectIDFromTestID($test_id)
Returns the ILIAS test object id for a given test id.
static _lookupAnonymity($a_obj_id)
Returns the anonymity status of a test with a given object id.
This class represents a property form user interface.
ILIAS Setting Class.
special template class to simplify handling of ITX/PEAR
This class represents a text property in a property form.
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
static removeTrailingPathSeparators($path)
$template
$key
Definition: croninfo.php:18
$i
Definition: disco.tpl.php:19
$code
Definition: example_050.php:99
if(!array_key_exists('StateId', $_REQUEST)) $id
Interface ilGuiQuestionScoringAdjustable.
$errors
Definition: index.php:6
$info
Definition: index.php:5
$url
if(isset($_POST['submit'])) $form
global $DIC
Definition: saml.php:7
$values