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