ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
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 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 {
41 $this->object->loadFromDb($id);
42 }
43 }
44
45 function getCommand($cmd)
46 {
47 if (substr($cmd, 0, 6) == "delete")
48 {
49 $cmd = "delete";
50 }
51 return $cmd;
52 }
53
57 protected function writePostData($always = false)
58 {
59 $hasErrors = (!$always) ? $this->editQuestion(true) : false;
60 if (!$hasErrors)
61 {
62 require_once 'Services/Form/classes/class.ilPropertyFormGUI.php';
63
65
66 $this->object->setPoints($_POST["points"]);
68
70
71 return 0;
72 }
73 return 1;
74 }
75
77 {
78 if ($_POST['delete_applet'])
79 {
80 // delete the applet file
81 $this->object->deleteJavaAppletFilename();
82 }
83 else
84 {
85 $this->object->setJavaAppletFilename( $_POST['uploaded_javaapplet'] );
86 }
87
88 //setting java applet
89 if (!empty($_FILES['javaappletName']['tmp_name']))
90 {
91 $this->object->setJavaAppletFilename( $_FILES['javaappletName']['name'],
92 $_FILES['javaappletName']['tmp_name']
93 );
94 }
95 $this->object->setJavaCode( $_POST["java_code"] );
96 $this->object->setJavaCodebase( $_POST["java_codebase"] );
97 $this->object->setJavaArchive( $_POST["java_archive"] );
98 $this->object->setJavaWidth( $_POST["java_width"] );
99 $this->object->setJavaHeight( $_POST["java_height"] );
100
101 $this->object->flushParams();
102 if (is_array( $_POST['kvp']['key'] ))
103 {
104 foreach ($_POST['kvp']['key'] as $idx => $val)
105 {
106 if (strlen( $val ) && strlen( $_POST['kvp']['value'][$idx] ))
107 {
108 $this->object->addParameter( $val, $_POST['kvp']['value'][$idx] );
109 }
110 }
111 }
112 }
113
118 public function editQuestion($checkonly = FALSE)
119 {
120 $save = $this->isSaveCommand();
121 $this->getQuestionTemplate();
122
123 include_once("./Services/Form/classes/class.ilPropertyFormGUI.php");
124 $form = new ilPropertyFormGUI();
125 $this->editForm = $form;
126
127 $form->setFormAction($this->ctrl->getFormAction($this));
128 $form->setTitle($this->outQuestionType());
129 $form->setMultipart(true);
130 $form->setTableWidth("100%");
131 $form->setId("assjavaapplet");
132
133 $this->addBasicQuestionFormProperties($form);
134 $this->populateQuestionSpecificFormPart( $form );
135
136 $this->populateTaxonomyFormSection($form);
137
138 $this->addQuestionFormCommandButtons($form);
139
140 $errors = false;
141
142 if ($save)
143 {
144 $form->setValuesByPost();
145 $errors = !$form->checkInput();
146 $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
147 if ($errors) $checkonly = false;
148 }
149
150 if (!$checkonly) $this->tpl->setVariable("QUESTION_DATA", $form->getHTML());
151 return $errors;
152 }
153
155 {
156 // points
157 $points = new ilNumberInputGUI($this->lng->txt( "points" ), "points");
158 $points->setValue( $this->object->getPoints() );
159 $points->setRequired( TRUE );
160 $points->setSize( 3 );
161 $points->setMinValue( 0.0 );
162 $form->addItem( $points );
163
165 $header->setTitle( $this->lng->txt( "applet_attributes" ) );
166 $form->addItem( $header );
167
168 // java applet
169 $javaapplet = $this->object->getJavaAppletFilename();
170 $applet = new ilFileInputGUI($this->lng->txt( 'javaapplet' ), 'javaappletName');
171 $applet->setSuffixes( array( 'jar', 'class' ) );
172 $applet->setRequired( false );
173
174 if (strlen( $javaapplet ))
175 {
176 $filename = new ilNonEditableValueGUI($this->lng->txt( 'filename' ), 'uploaded_javaapplet');
177 $filename->setValue( $javaapplet );
178 $applet->addSubItem( $filename );
179
180 $delete = new ilCheckboxInputGUI('', 'delete_applet');
181 $delete->setOptionTitle( $this->lng->txt( 'delete' ) );
182 $delete->setValue( 1 );
183 $applet->addSubItem( $delete );
184 }
185 $form->addItem( $applet );
186
187 // Code
188 $code = new ilTextInputGUI($this->lng->txt( "code" ), "java_code");
189 $code->setValue( $this->object->getJavaCode() );
190 $code->setRequired( TRUE );
191 $form->addItem( $code );
192
193 if (!strlen( $javaapplet ))
194 {
195 // Archive
196 $archive = new ilTextInputGUI($this->lng->txt( "archive" ), "java_archive");
197 $archive->setValue( $this->object->getJavaArchive() );
198 $archive->setRequired( false );
199 $form->addItem( $archive );
200
201 // Codebase
202 $codebase = new ilTextInputGUI($this->lng->txt( "codebase" ), "java_codebase");
203 $codebase->setValue( $this->object->getJavaCodebase() );
204 $codebase->setRequired( false );
205 $form->addItem( $codebase );
206 }
207
208 // Width
209 $width = new ilNumberInputGUI($this->lng->txt( "width" ), "java_width");
210 $width->setDecimals( 0 );
211 $width->setSize( 6 );
212 $width->setMinValue( 50 );
213 $width->setMaxLength( 6 );
214 $width->setValue( $this->object->getJavaWidth() );
215 $width->setRequired( TRUE );
216 $form->addItem( $width );
217
218 // Height
219 $height = new ilNumberInputGUI($this->lng->txt( "height" ), "java_height");
220 $height->setDecimals( 0 );
221 $height->setSize( 6 );
222 $height->setMinValue( 50 );
223 $height->setMaxLength( 6 );
224 $height->setValue( $this->object->getJavaHeight() );
225 $height->setRequired( TRUE );
226 $form->addItem( $height );
227
229 $header->setTitle( $this->lng->txt( "applet_parameters" ) );
230 $form->addItem( $header );
231
232 include_once "./Modules/TestQuestionPool/classes/class.ilKVPWizardInputGUI.php";
233 $kvp = new ilKVPWizardInputGUI($this->lng->txt( "applet_parameters" ), "kvp");
234 $values = array();
235 for ($i = 0; $i < $this->object->getParameterCount(); $i++)
236 {
237 $param = $this->object->getParameter( $i );
238 array_push( $values, array( $param['name'], $param['value'] ) );
239 }
240 if (count( $values ) == 0)
241 {
242 array_push( $values, array( "", "" ) );
243 }
244 $kvp->setKeyName( $this->lng->txt( 'name' ) );
245 $kvp->setValueName( $this->lng->txt( 'value' ) );
246 $kvp->setValues( $values );
247 $form->addItem( $kvp );
248 }
249
253 public function addkvp()
254 {
255 $this->writePostData(true);
256 $position = key($_POST['cmd']['addkvp']);
257 $this->object->addParameterAtIndex($position+1, "", "");
258 $this->editQuestion();
259 }
260
264 public function removekvp()
265 {
266 $this->writePostData(true);
267 $position = key($_POST['cmd']['removekvp']);
268 $this->object->removeParameter($position);
269 $this->editQuestion();
270 }
271
286 $active_id,
287 $pass = NULL,
288 $graphicalOutput = FALSE,
289 $result_output = FALSE,
290 $show_question_only = TRUE,
291 $show_feedback = FALSE,
292 $show_correct_solution = FALSE,
293 $show_manual_scoring = FALSE,
294 $show_question_text = TRUE
295 )
296 {
297 $userdata = $this->object->getActiveUserData($active_id);
298
299 // generate the question output
300 include_once "./Services/UICore/classes/class.ilTemplate.php";
301 include_once "./Modules/Test/classes/class.ilObjTest.php";
302 $template = new ilTemplate("tpl.il_as_qpl_javaapplet_question_output_solution.html", TRUE, TRUE, "Modules/TestQuestionPool");
303 $solutiontemplate = new ilTemplate("tpl.il_as_tst_solution_output.html",TRUE, TRUE, "Modules/TestQuestionPool");
304 if (strlen($userdata["test_id"]))
305 {
306 $template->setCurrentBlock("appletparam");
307 $template->setVariable("PARAM_NAME", "test_type");
309 {
310 $template->setVariable("PARAM_VALUE", "0");
311 }
312 else
313 {
314 $template->setVariable("PARAM_VALUE", "1");
315 }
316 $template->parseCurrentBlock();
317 }
318 if (strlen($userdata["test_id"]))
319 {
320 $template->setCurrentBlock("appletparam");
321 $template->setVariable("PARAM_NAME", "test_id");
322 $template->setVariable("PARAM_VALUE", $userdata["test_id"]);
323 $template->parseCurrentBlock();
324 }
325 $template->setCurrentBlock("appletparam");
326 $template->setVariable("PARAM_NAME", "active_id");
327 $template->setVariable("PARAM_VALUE", $active_id);
328 $template->parseCurrentBlock();
329 $template->setCurrentBlock("appletparam");
330 $template->setVariable("PARAM_NAME", "question_id");
331 $template->setVariable("PARAM_VALUE", $this->object->getId());
332 $template->parseCurrentBlock();
333 if (strlen($userdata["user_id"]))
334 {
335 $template->setCurrentBlock("appletparam");
336 $template->setVariable("PARAM_NAME", "user_id");
337 $template->setVariable("PARAM_VALUE", $userdata["user_id"]);
338 $template->parseCurrentBlock();
339 }
340 $template->setCurrentBlock("appletparam");
341 $template->setVariable("PARAM_NAME", "points_max");
342 $template->setVariable("PARAM_VALUE", $this->object->getPoints());
343 $template->parseCurrentBlock();
344 $template->setCurrentBlock("appletparam");
345 $template->setVariable("PARAM_NAME", "session_id");
346 $template->setVariable("PARAM_VALUE", $_COOKIE["PHPSESSID"]);
347 $template->parseCurrentBlock();
348 $template->setCurrentBlock("appletparam");
349 $template->setVariable("PARAM_NAME", "client");
350 $template->setVariable("PARAM_VALUE", CLIENT_ID);
351 $template->parseCurrentBlock();
352 $template->setCurrentBlock("appletparam");
353 $template->setVariable("PARAM_NAME", "pass");
354 $actualpass = ilObjTest::_getPass($active_id);
355 $template->setVariable("PARAM_VALUE", $actualpass);
356 $template->parseCurrentBlock();
357 // additional parameters
358 for ($i = 0; $i < $this->object->getParameterCount(); $i++)
359 {
360 $parameter = $this->object->getParameter($i);
361 $template->setCurrentBlock("appletparam");
362 $template->setVariable("PARAM_NAME", $parameter["name"]);
363 $template->setVariable("PARAM_VALUE", $parameter["value"]);
364 $template->parseCurrentBlock();
365 }
366
367 if (($active_id > 0) && (!$show_correct_solution))
368 {
369 $solutions = NULL;
370 include_once "./Modules/Test/classes/class.ilObjTest.php";
371 $info = $this->object->getSolutionValues($active_id, $pass);
372 foreach ($info as $kk => $infodata)
373 {
374 $template->setCurrentBlock("appletparam");
375 $template->setVariable("PARAM_NAME", "value_" . $infodata["order"] . "_1");
376 $template->setVariable("PARAM_VALUE", $infodata["value1"]);
377 $template->parseCurrentBlock();
378 $template->setCurrentBlock("appletparam");
379 $template->setVariable("PARAM_NAME", "value_" . $infodata["order"] . "_2");
380 $template->setVariable("PARAM_VALUE", $infodata["value2"]);
381 $template->parseCurrentBlock();
382 }
383 }
384
385 $questiontext = $this->object->getQuestion();
386 if ($show_question_text==true)
387 {
388 $template->setVariable("QUESTIONTEXT", $this->object->prepareTextareaOutput($questiontext, TRUE));
389 }
390 $template->setVariable("APPLET_WIDTH", $this->object->getJavaWidth());
391 $template->setVariable("APPLET_HEIGHT", $this->object->getJavaHeight());
392 $template->setVariable("APPLET_CODE", $this->object->getJavaCode());
393 if (strlen($this->object->getJavaArchive()) > 0)
394 {
395 $template->setVariable("APPLET_ARCHIVE", " archive=\"".$this->object->getJavaArchive()."\"");
396 }
397 else
398 {
399 if (strpos($this->object->getJavaAppletFilename(), ".jar") !== FALSE)
400 {
401 $template->setVariable("APPLET_ARCHIVE", " archive=\"".$this->object->getJavaPathWeb().$this->object->getJavaAppletFilename()."\"");
402 }
403 }
404 if (strlen($this->object->getJavaCodebase()) > 0)
405 {
406 $template->setVariable("APPLET_CODEBASE", " codebase=\"".$this->object->getJavaCodebase()."\"");
407 }
408 else
409 {
410 if (strpos($this->object->getJavaAppletFilename(), ".class") !== FALSE)
411 {
412 $template->setVariable("APPLET_CODEBASE", " codebase=\"".$this->object->getJavaPathWeb()."\"");
413 }
414 }
415 if (($active_id > 0) && (!$show_correct_solution))
416 {
417 if ($graphicalOutput)
418 {
419 // output of ok/not ok icons for user entered solutions
420 $reached_points = $this->object->getReachedPoints($active_id, $pass);
421 if ($reached_points == $this->object->getPoints())
422 {
423 $template->setCurrentBlock("icon_ok");
424 $template->setVariable("ICON_OK", ilUtil::getImagePath("icon_ok.svg"));
425 $template->setVariable("TEXT_OK", $this->lng->txt("answer_is_right"));
426 $template->parseCurrentBlock();
427 }
428 else
429 {
430 $template->setCurrentBlock("icon_ok");
431 if ($reached_points > 0)
432 {
433 $template->setVariable("ICON_NOT_OK", ilUtil::getImagePath("icon_mostly_ok.svg"));
434 $template->setVariable("TEXT_NOT_OK", $this->lng->txt("answer_is_not_correct_but_positive"));
435 }
436 else
437 {
438 $template->setVariable("ICON_NOT_OK", ilUtil::getImagePath("icon_not_ok.svg"));
439 $template->setVariable("TEXT_NOT_OK", $this->lng->txt("answer_is_wrong"));
440 }
441 $template->parseCurrentBlock();
442 }
443 }
444 }
445 $questionoutput = $template->get();
446 $feedback = ($show_feedback && !$this->isTestPresentationContext()) ? $this->getAnswerFeedbackOutput($active_id, $pass) : "";
447 if (strlen($feedback))
448 {
449 $cssClass = ( $this->hasCorrectSolution($active_id, $pass) ?
451 );
452
453 $solutiontemplate->setVariable("ILC_FB_CSS_CLASS", $cssClass);
454 $solutiontemplate->setVariable("FEEDBACK", $this->object->prepareTextareaOutput( $feedback, true ));
455 }
456 $solutiontemplate->setVariable("SOLUTION_OUTPUT", $questionoutput);
457
458 $solutionoutput = $solutiontemplate->get();
459 if (!$show_question_only)
460 {
461 // get page object output
462 $solutionoutput = $this->getILIASPage($solutionoutput);
463 }
464 return $solutionoutput;
465 }
466
467 function getPreview($show_question_only = FALSE, $showInlineFeedback = false)
468 {
469 // generate the question output
470 include_once "./Services/UICore/classes/class.ilTemplate.php";
471 $template = new ilTemplate("tpl.il_as_qpl_javaapplet_question_output.html", TRUE, TRUE, "Modules/TestQuestionPool");
472 $template->setCurrentBlock("appletparam");
473 $template->setVariable("PARAM_NAME", "question_id");
474 $template->setVariable("PARAM_VALUE", $this->object->getId());
475 $template->parseCurrentBlock();
476 $template->setCurrentBlock("appletparam");
477 $template->setVariable("PARAM_NAME", "points_max");
478 $template->setVariable("PARAM_VALUE", $this->object->getPoints());
479 $template->parseCurrentBlock();
480 $template->setCurrentBlock("appletparam");
481 $template->setVariable("PARAM_NAME", "session_id");
482 $template->setVariable("PARAM_VALUE", $_COOKIE["PHPSESSID"]);
483 $template->parseCurrentBlock();
484 $template->setCurrentBlock("appletparam");
485 $template->setVariable("PARAM_NAME", "client");
486 $template->setVariable("PARAM_VALUE", CLIENT_ID);
487 $template->parseCurrentBlock();
488 // additional parameters
489 for ($i = 0; $i < $this->object->getParameterCount(); $i++)
490 {
491 $parameter = $this->object->getParameter($i);
492 $template->setCurrentBlock("appletparam");
493 $template->setVariable("PARAM_NAME", $parameter["name"]);
494 $template->setVariable("PARAM_VALUE", $parameter["value"]);
495 $template->parseCurrentBlock();
496 }
497
498 $questiontext = $this->object->getQuestion();
499 $template->setVariable("QUESTIONTEXT", $this->object->prepareTextareaOutput($questiontext, TRUE));
500 $template->setVariable("APPLET_WIDTH", $this->object->getJavaWidth());
501 $template->setVariable("APPLET_HEIGHT", $this->object->getJavaHeight());
502 $template->setVariable("APPLET_CODE", $this->object->getJavaCode());
503 if (strlen($this->object->getJavaArchive()) > 0)
504 {
505 $template->setVariable("APPLET_ARCHIVE", " archive=\"".$this->object->getJavaArchive()."\"");
506 }
507 else
508 {
509 if (strpos($this->object->getJavaAppletFilename(), ".jar") !== FALSE)
510 {
511 $template->setVariable("APPLET_ARCHIVE", " archive=\"".$this->object->getJavaPathWeb().$this->object->getJavaAppletFilename()."\"");
512 }
513 }
514 if (strlen($this->object->getJavaCodebase()) > 0)
515 {
516 $template->setVariable("APPLET_CODEBASE", " codebase=\"".$this->object->getJavaCodebase()."\"");
517 }
518 else
519 {
520 if (strpos($this->object->getJavaAppletFilename(), ".class") !== FALSE)
521 {
522 $template->setVariable("APPLET_CODEBASE", " codebase=\"".$this->object->getJavaPathWeb()."\"");
523 }
524 }
525 $questionoutput = $template->get();
526 if (!$show_question_only)
527 {
528 // get page object output
529 $questionoutput = $this->getILIASPage($questionoutput);
530 }
531 return $questionoutput;
532 }
533
534 // hey: prevPassSolutions - pass will be always available from now on
535 function getTestOutput($active_id, $pass, $is_postponed = FALSE, $use_post_solutions = FALSE, $show_feedback = FALSE)
536 // hey.
537 {
538 $userdata = $this->object->getActiveUserData($active_id);
539 // generate the question output
540 include_once "./Services/UICore/classes/class.ilTemplate.php";
541 $template = new ilTemplate("tpl.il_as_qpl_javaapplet_question_output.html", TRUE, TRUE, "Modules/TestQuestionPool");
542 $template->setCurrentBlock("appletparam");
543 $template->setVariable("PARAM_NAME", "test_type");
544 include_once "./Modules/Test/classes/class.ilObjTest.php";
546 {
547 $template->setVariable("PARAM_VALUE", "0");
548 }
549 else
550 {
551 $template->setVariable("PARAM_VALUE", "1");
552 }
553 $template->parseCurrentBlock();
554 $template->setCurrentBlock("appletparam");
555 $template->setVariable("PARAM_NAME", "active_id");
556 $template->setVariable("PARAM_VALUE", $active_id);
557 $template->parseCurrentBlock();
558 $template->setCurrentBlock("appletparam");
559 $template->setVariable("PARAM_NAME", "test_id");
560 $template->setVariable("PARAM_VALUE", $userdata["test_id"]);
561 $template->parseCurrentBlock();
562 $template->setCurrentBlock("appletparam");
563 $template->setVariable("PARAM_NAME", "question_id");
564 $template->setVariable("PARAM_VALUE", $this->object->getId());
565 $template->parseCurrentBlock();
566 $template->setCurrentBlock("appletparam");
567 $template->setVariable("PARAM_NAME", "user_id");
568 $template->setVariable("PARAM_VALUE", $userdata["user_id"]);
569 $template->parseCurrentBlock();
570 $template->setCurrentBlock("appletparam");
571 $template->setVariable("PARAM_NAME", "points_max");
572 $template->setVariable("PARAM_VALUE", $this->object->getPoints());
573 $template->parseCurrentBlock();
574 $template->setCurrentBlock("appletparam");
575 $template->setVariable("PARAM_NAME", "session_id");
576 $template->setVariable("PARAM_VALUE", $_COOKIE["PHPSESSID"]);
577 $template->parseCurrentBlock();
578 $template->setCurrentBlock("appletparam");
579 $template->setVariable("PARAM_NAME", "client");
580 $template->setVariable("PARAM_VALUE", CLIENT_ID);
581 $template->parseCurrentBlock();
582 $template->setCurrentBlock("appletparam");
583 $template->setVariable("PARAM_NAME", "pass");
584 $actualpass = ilObjTest::_getPass($active_id);
585 $template->setVariable("PARAM_VALUE", $actualpass);
586 $template->parseCurrentBlock();
587 $template->setCurrentBlock("appletparam");
588 $template->setVariable("PARAM_NAME", "post_url");
589 $template->setVariable("PARAM_VALUE", ilUtil::removeTrailingPathSeparators(ILIAS_HTTP_PATH) . "/Modules/TestQuestionPool/save_question_post_data.php");
590 $template->parseCurrentBlock();
591 // additional parameters
592 for ($i = 0; $i < $this->object->getParameterCount(); $i++)
593 {
594 $parameter = $this->object->getParameter($i);
595 $template->setCurrentBlock("appletparam");
596 $template->setVariable("PARAM_NAME", $parameter["name"]);
597 $template->setVariable("PARAM_VALUE", $parameter["value"]);
598 $template->parseCurrentBlock();
599 }
600
601 if ($active_id)
602 {
603 // hey: prevPassSolutions - obsolete due to central check
604 #$solutions = NULL;
605 #include_once "./Modules/Test/classes/class.ilObjTest.php";
606 #if (!ilObjTest::_getUsePreviousAnswers($active_id, true))
607 #{
608 # if (is_null($pass)) $pass = ilObjTest::_getPass($active_id);
609 #}
610 $info = $this->object->getTestOutputSolutions($active_id, $pass);
611 // hey.
612 foreach ($info as $kk => $infodata)
613 {
614 $template->setCurrentBlock("appletparam");
615 $template->setVariable("PARAM_NAME", "value_" . $infodata["order"] . "_1");
616 $template->setVariable("PARAM_VALUE", $infodata["value1"]);
617 $template->parseCurrentBlock();
618 $template->setCurrentBlock("appletparam");
619 $template->setVariable("PARAM_NAME", "value_" . $infodata["order"] . "_2");
620 $template->setVariable("PARAM_VALUE", $infodata["value2"]);
621 $template->parseCurrentBlock();
622 }
623 include_once './Services/Administration/classes/class.ilSetting.php';
624 $soapSetting = new ilSetting();
625 if ($soapSetting->get("soap_user_administration") == 1)
626 {
627 $template->setCurrentBlock("appletparam");
628 $template->setVariable("PARAM_NAME", "server");
629 $template->setVariable("PARAM_VALUE", ilUtil::removeTrailingPathSeparators(ILIAS_HTTP_PATH) . "/webservice/soap/server.php");
630 }
631 }
632
633 $questiontext = $this->object->getQuestion();
634 $template->setVariable("QUESTIONTEXT", $this->object->prepareTextareaOutput($questiontext, TRUE));
635 $template->setVariable("APPLET_WIDTH", $this->object->getJavaWidth());
636 $template->setVariable("APPLET_HEIGHT", $this->object->getJavaHeight());
637 $template->setVariable("APPLET_CODE", $this->object->getJavaCode());
638 if (strlen($this->object->getJavaArchive()) > 0)
639 {
640 $template->setVariable("APPLET_ARCHIVE", " archive=\"".$this->object->getJavaArchive()."\"");
641 }
642 else
643 {
644 if (strpos($this->object->getJavaAppletFilename(), ".jar") !== FALSE)
645 {
646 $template->setVariable("APPLET_ARCHIVE", " archive=\"".$this->object->getJavaPathWeb().$this->object->getJavaAppletFilename()."\"");
647 }
648 }
649 if (strlen($this->object->getJavaCodebase()) > 0)
650 {
651 $template->setVariable("APPLET_CODEBASE", " codebase=\"".$this->object->getJavaCodebase()."\"");
652 }
653 else
654 {
655 if (strpos($this->object->getJavaAppletFilename(), ".class") !== FALSE)
656 {
657 $template->setVariable("APPLET_CODEBASE", " codebase=\"".$this->object->getJavaPathWeb()."\"");
658 }
659 }
660 $questionoutput = $template->get();
661 $pageoutput = $this->outQuestionPage("", $is_postponed, $active_id, $questionoutput);
662 return $pageoutput;
663 }
664
673 {
674 global $rbacsystem, $ilTabs;
675
676 $ilTabs->clearTargets();
677
678 $this->ctrl->setParameterByClass("ilAssQuestionPageGUI", "q_id", $_GET["q_id"]);
679 include_once "./Modules/TestQuestionPool/classes/class.assQuestion.php";
680 $q_type = $this->object->getQuestionType();
681
682 if (strlen($q_type))
683 {
684 $classname = $q_type . "GUI";
685 $this->ctrl->setParameterByClass(strtolower($classname), "sel_question_types", $q_type);
686 $this->ctrl->setParameterByClass(strtolower($classname), "q_id", $_GET["q_id"]);
687 }
688
689 if ($_GET["q_id"])
690 {
691 if ($rbacsystem->checkAccess('write', $_GET["ref_id"]))
692 {
693 // edit page
694 $ilTabs->addTarget("edit_page",
695 $this->ctrl->getLinkTargetByClass("ilAssQuestionPageGUI", "edit"),
696 array("edit", "insert", "exec_pg"),
697 "", "", $force_active);
698 }
699
700 $this->addTab_QuestionPreview($ilTabs);
701 }
702
703 $force_active = false;
704 if ($rbacsystem->checkAccess('write', $_GET["ref_id"]))
705 {
706 $url = "";
707 if ($classname) $url = $this->ctrl->getLinkTargetByClass($classname, "editQuestion");
708 $commands = $_POST["cmd"];
709 if (is_array($commands))
710 {
711 foreach ($commands as $key => $value)
712 {
713 if (preg_match("/^delete_.*/", $key, $matches))
714 {
715 $force_active = true;
716 }
717 }
718 }
719 // edit question properties
720 $ilTabs->addTarget("edit_question",
721 $url,
722 array("editQuestion", "save", "saveEdit", "addkvp", "removekvp", "originalSyncForm"),
723 $classname, "", $force_active);
724 }
725
726 // add tab for question feedback within common class assQuestionGUI
727 $this->addTab_QuestionFeedback($ilTabs);
728
729 // add tab for question hint within common class assQuestionGUI
730 $this->addTab_QuestionHints($ilTabs);
731
732 // add tab for question's suggested solution within common class assQuestionGUI
733 $this->addTab_SuggestedSolution($ilTabs, $classname);
734
735 // Assessment of questions sub menu entry
736 if ($_GET["q_id"])
737 {
738 $ilTabs->addTarget("statistics",
739 $this->ctrl->getLinkTargetByClass($classname, "assessment"),
740 array("assessment"),
741 $classname, "");
742 }
743
744 $this->addBackTab($ilTabs);
745 }
746
747 function getSpecificFeedbackOutput($active_id, $pass)
748 {
749 $output = "";
750 return $this->object->prepareTextareaOutput($output, TRUE);
751 }
752
763 {
764 return array();
765 }
766
775 public function getAggregatedAnswersView($relevant_answers)
776 {
777 // Empty implementation here since a feasible way to aggregate answer is not known.
778 return ''; //print_r($relevant_answers,true);
779 }
780}
$_COOKIE['ilClientId']
Definition: BPMN2Parser.php:15
$_GET["client_id"]
$_POST["username"]
An exception for terminatinating execution or to throw for unit testing.
Java applet question GUI representation.
editQuestion($checkonly=FALSE)
Creates an output of the edit form for the question.
__construct($id=-1)
assJavaAppletGUI constructor
getTestOutput($active_id, $pass, $is_postponed=FALSE, $use_post_solutions=FALSE, $show_feedback=FALSE)
removekvp()
Remove an answer.
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.
writeQuestionSpecificPostData(ilPropertyFormGUI $form)
Extracts the question specific values from $_POST and applies them to the data object.
populateQuestionSpecificFormPart(\ilPropertyFormGUI $form)
getPreview($show_question_only=FALSE, $showInlineFeedback=false)
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.
getSpecificFeedbackOutput($active_id, $pass)
Returns the answer specific feedback for the question.
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="")
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.
addItem($a_item)
Add Item (Property, SectionHeader).
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)
$header
$code
Definition: example_050.php:99
$info
Definition: example_052.php:80
if(!is_dir( $entity_dir)) exit("Fatal Error ([A-Za-z0-9]+)\s+" &#(? foreach( $entity_files as $file) $output
Interface ilGuiQuestionScoringAdjustable.
$cmd
Definition: sahs_server.php:35
$url
Definition: shib_logout.php:72
$errors