ILIAS  Release_4_4_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
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 
4 require_once './Modules/TestQuestionPool/classes/class.assQuestionGUI.php';
5 require_once './Modules/TestQuestionPool/interfaces/interface.ilGuiQuestionScoringAdjustable.php';
6 include_once './Modules/Test/classes/inc.AssessmentConstants.php';
7 
22 class assJavaAppletGUI extends assQuestionGUI //implements ilGuiQuestionScoringAdjustable
23 {
33  function __construct($id = -1)
34  {
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  {
67 
68  $this->object->setPoints($_POST["points"]);
70 
71  $this->saveTaxonomyAssignments();
72 
73  return 0;
74  }
75  return 1;
76  }
77 
78  public function writeQuestionSpecificPostData($always = true)
79  {
80  if ($_POST['delete_applet'])
81  {
82  // delete the applet file
83  $this->object->deleteJavaAppletFilename();
84  }
85  else
86  {
87  $this->object->setJavaAppletFilename( $_POST['uploaded_javaapplet'] );
88  }
89 
90  //setting java applet
91  if (!empty($_FILES['javaappletName']['tmp_name']))
92  {
93  $this->object->setJavaAppletFilename( $_FILES['javaappletName']['name'],
94  $_FILES['javaappletName']['tmp_name']
95  );
96  }
97  $this->object->setJavaCode( $_POST["java_code"] );
98  $this->object->setJavaCodebase( $_POST["java_codebase"] );
99  $this->object->setJavaArchive( $_POST["java_archive"] );
100  $this->object->setJavaWidth( $_POST["java_width"] );
101  $this->object->setJavaHeight( $_POST["java_height"] );
102 
103  $this->object->flushParams();
104  if (is_array( $_POST['kvp']['key'] ))
105  {
106  foreach ($_POST['kvp']['key'] as $idx => $val)
107  {
108  if (strlen( $val ) && strlen( $_POST['kvp']['value'][$idx] ))
109  {
110  $this->object->addParameter( $val, $_POST['kvp']['value'][$idx] );
111  }
112  }
113  }
114  }
115 
120  public function editQuestion($checkonly = FALSE)
121  {
122  $save = $this->isSaveCommand();
123  $this->getQuestionTemplate();
124 
125  include_once("./Services/Form/classes/class.ilPropertyFormGUI.php");
126  $form = new ilPropertyFormGUI();
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 
164  $header = new ilFormSectionHeaderGUI();
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 
228  $header = new ilFormSectionHeaderGUI();
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 
272  function outQuestionForTest($formaction, $active_id, $pass = NULL, $is_postponed = FALSE, $use_post_solutions = FALSE)
273  {
274  $test_output = $this->getTestOutput($active_id, $pass, $is_postponed, $use_post_solutions);
275  $this->tpl->setVariable("QUESTION_OUTPUT", $test_output);
276  $this->tpl->setVariable("FORMACTION", $formaction);
277  }
278 
293  $active_id,
294  $pass = NULL,
295  $graphicalOutput = FALSE,
296  $result_output = FALSE,
297  $show_question_only = TRUE,
298  $show_feedback = FALSE,
299  $show_correct_solution = FALSE,
300  $show_manual_scoring = FALSE,
301  $show_question_text = TRUE
302  )
303  {
304  $userdata = $this->object->getActiveUserData($active_id);
305 
306  // generate the question output
307  include_once "./Services/UICore/classes/class.ilTemplate.php";
308  include_once "./Modules/Test/classes/class.ilObjTest.php";
309  $template = new ilTemplate("tpl.il_as_qpl_javaapplet_question_output_solution.html", TRUE, TRUE, "Modules/TestQuestionPool");
310  $solutiontemplate = new ilTemplate("tpl.il_as_tst_solution_output.html",TRUE, TRUE, "Modules/TestQuestionPool");
311  if (strlen($userdata["test_id"]))
312  {
313  $template->setCurrentBlock("appletparam");
314  $template->setVariable("PARAM_NAME", "test_type");
316  {
317  $template->setVariable("PARAM_VALUE", "0");
318  }
319  else
320  {
321  $template->setVariable("PARAM_VALUE", "1");
322  }
323  $template->parseCurrentBlock();
324  }
325  if (strlen($userdata["test_id"]))
326  {
327  $template->setCurrentBlock("appletparam");
328  $template->setVariable("PARAM_NAME", "test_id");
329  $template->setVariable("PARAM_VALUE", $userdata["test_id"]);
330  $template->parseCurrentBlock();
331  }
332  $template->setCurrentBlock("appletparam");
333  $template->setVariable("PARAM_NAME", "active_id");
334  $template->setVariable("PARAM_VALUE", $active_id);
335  $template->parseCurrentBlock();
336  $template->setCurrentBlock("appletparam");
337  $template->setVariable("PARAM_NAME", "question_id");
338  $template->setVariable("PARAM_VALUE", $this->object->getId());
339  $template->parseCurrentBlock();
340  if (strlen($userdata["user_id"]))
341  {
342  $template->setCurrentBlock("appletparam");
343  $template->setVariable("PARAM_NAME", "user_id");
344  $template->setVariable("PARAM_VALUE", $userdata["user_id"]);
345  $template->parseCurrentBlock();
346  }
347  $template->setCurrentBlock("appletparam");
348  $template->setVariable("PARAM_NAME", "points_max");
349  $template->setVariable("PARAM_VALUE", $this->object->getPoints());
350  $template->parseCurrentBlock();
351  $template->setCurrentBlock("appletparam");
352  $template->setVariable("PARAM_NAME", "session_id");
353  $template->setVariable("PARAM_VALUE", $_COOKIE["PHPSESSID"]);
354  $template->parseCurrentBlock();
355  $template->setCurrentBlock("appletparam");
356  $template->setVariable("PARAM_NAME", "client");
357  $template->setVariable("PARAM_VALUE", CLIENT_ID);
358  $template->parseCurrentBlock();
359  $template->setCurrentBlock("appletparam");
360  $template->setVariable("PARAM_NAME", "pass");
361  $actualpass = ilObjTest::_getPass($active_id);
362  $template->setVariable("PARAM_VALUE", $actualpass);
363  $template->parseCurrentBlock();
364  // additional parameters
365  for ($i = 0; $i < $this->object->getParameterCount(); $i++)
366  {
367  $parameter = $this->object->getParameter($i);
368  $template->setCurrentBlock("appletparam");
369  $template->setVariable("PARAM_NAME", $parameter["name"]);
370  $template->setVariable("PARAM_VALUE", $parameter["value"]);
371  $template->parseCurrentBlock();
372  }
373 
374  if (($active_id > 0) && (!$show_correct_solution))
375  {
376  $solutions = NULL;
377  include_once "./Modules/Test/classes/class.ilObjTest.php";
378  $info = $this->object->getReachedInformation($active_id, $pass);
379  foreach ($info as $kk => $infodata)
380  {
381  $template->setCurrentBlock("appletparam");
382  $template->setVariable("PARAM_NAME", "value_" . $infodata["order"] . "_1");
383  $template->setVariable("PARAM_VALUE", $infodata["value1"]);
384  $template->parseCurrentBlock();
385  $template->setCurrentBlock("appletparam");
386  $template->setVariable("PARAM_NAME", "value_" . $infodata["order"] . "_2");
387  $template->setVariable("PARAM_VALUE", $infodata["value2"]);
388  $template->parseCurrentBlock();
389  }
390  }
391 
392  $questiontext = $this->object->getQuestion();
393  if ($show_question_text==true)
394  {
395  $template->setVariable("QUESTIONTEXT", $this->object->prepareTextareaOutput($questiontext, TRUE));
396  }
397  $template->setVariable("APPLET_WIDTH", $this->object->getJavaWidth());
398  $template->setVariable("APPLET_HEIGHT", $this->object->getJavaHeight());
399  $template->setVariable("APPLET_CODE", $this->object->getJavaCode());
400  if (strlen($this->object->getJavaArchive()) > 0)
401  {
402  $template->setVariable("APPLET_ARCHIVE", " archive=\"".$this->object->getJavaArchive()."\"");
403  }
404  else
405  {
406  if (strpos($this->object->getJavaAppletFilename(), ".jar") !== FALSE)
407  {
408  $template->setVariable("APPLET_ARCHIVE", " archive=\"".$this->object->getJavaPathWeb().$this->object->getJavaAppletFilename()."\"");
409  }
410  }
411  if (strlen($this->object->getJavaCodebase()) > 0)
412  {
413  $template->setVariable("APPLET_CODEBASE", " codebase=\"".$this->object->getJavaCodebase()."\"");
414  }
415  else
416  {
417  if (strpos($this->object->getJavaAppletFilename(), ".class") !== FALSE)
418  {
419  $template->setVariable("APPLET_CODEBASE", " codebase=\"".$this->object->getJavaPathWeb()."\"");
420  }
421  }
422  if (($active_id > 0) && (!$show_correct_solution))
423  {
424  if ($graphicalOutput)
425  {
426  // output of ok/not ok icons for user entered solutions
427  $reached_points = $this->object->getReachedPoints($active_id, $pass);
428  if ($reached_points == $this->object->getPoints())
429  {
430  $template->setCurrentBlock("icon_ok");
431  $template->setVariable("ICON_OK", ilUtil::getImagePath("icon_ok.png"));
432  $template->setVariable("TEXT_OK", $this->lng->txt("answer_is_right"));
433  $template->parseCurrentBlock();
434  }
435  else
436  {
437  $template->setCurrentBlock("icon_ok");
438  if ($reached_points > 0)
439  {
440  $template->setVariable("ICON_NOT_OK", ilUtil::getImagePath("icon_mostly_ok.png"));
441  $template->setVariable("TEXT_NOT_OK", $this->lng->txt("answer_is_not_correct_but_positive"));
442  }
443  else
444  {
445  $template->setVariable("ICON_NOT_OK", ilUtil::getImagePath("icon_not_ok.png"));
446  $template->setVariable("TEXT_NOT_OK", $this->lng->txt("answer_is_wrong"));
447  }
448  $template->parseCurrentBlock();
449  }
450  }
451  }
452  $questionoutput = $template->get();
453  $feedback = ($show_feedback) ? $this->getAnswerFeedbackOutput($active_id, $pass) : "";
454  if (strlen($feedback)) $solutiontemplate->setVariable("FEEDBACK", $feedback);
455  $solutiontemplate->setVariable("SOLUTION_OUTPUT", $questionoutput);
456 
457  $solutionoutput = $solutiontemplate->get();
458  if (!$show_question_only)
459  {
460  // get page object output
461  $solutionoutput = '<div class="ilc_question_Standard">'.$solutionoutput."</div>";
462  }
463  return $solutionoutput;
464  }
465 
466  function getPreview($show_question_only = FALSE)
467  {
468  // generate the question output
469  include_once "./Services/UICore/classes/class.ilTemplate.php";
470  $template = new ilTemplate("tpl.il_as_qpl_javaapplet_question_output.html", TRUE, TRUE, "Modules/TestQuestionPool");
471  $template->setCurrentBlock("appletparam");
472  $template->setVariable("PARAM_NAME", "question_id");
473  $template->setVariable("PARAM_VALUE", $this->object->getId());
474  $template->parseCurrentBlock();
475  $template->setCurrentBlock("appletparam");
476  $template->setVariable("PARAM_NAME", "points_max");
477  $template->setVariable("PARAM_VALUE", $this->object->getPoints());
478  $template->parseCurrentBlock();
479  $template->setCurrentBlock("appletparam");
480  $template->setVariable("PARAM_NAME", "session_id");
481  $template->setVariable("PARAM_VALUE", $_COOKIE["PHPSESSID"]);
482  $template->parseCurrentBlock();
483  $template->setCurrentBlock("appletparam");
484  $template->setVariable("PARAM_NAME", "client");
485  $template->setVariable("PARAM_VALUE", CLIENT_ID);
486  $template->parseCurrentBlock();
487  // additional parameters
488  for ($i = 0; $i < $this->object->getParameterCount(); $i++)
489  {
490  $parameter = $this->object->getParameter($i);
491  $template->setCurrentBlock("appletparam");
492  $template->setVariable("PARAM_NAME", $parameter["name"]);
493  $template->setVariable("PARAM_VALUE", $parameter["value"]);
494  $template->parseCurrentBlock();
495  }
496 
497  $questiontext = $this->object->getQuestion();
498  $template->setVariable("QUESTIONTEXT", $this->object->prepareTextareaOutput($questiontext, TRUE));
499  $template->setVariable("APPLET_WIDTH", $this->object->getJavaWidth());
500  $template->setVariable("APPLET_HEIGHT", $this->object->getJavaHeight());
501  $template->setVariable("APPLET_CODE", $this->object->getJavaCode());
502  if (strlen($this->object->getJavaArchive()) > 0)
503  {
504  $template->setVariable("APPLET_ARCHIVE", " archive=\"".$this->object->getJavaArchive()."\"");
505  }
506  else
507  {
508  if (strpos($this->object->getJavaAppletFilename(), ".jar") !== FALSE)
509  {
510  $template->setVariable("APPLET_ARCHIVE", " archive=\"".$this->object->getJavaPathWeb().$this->object->getJavaAppletFilename()."\"");
511  }
512  }
513  if (strlen($this->object->getJavaCodebase()) > 0)
514  {
515  $template->setVariable("APPLET_CODEBASE", " codebase=\"".$this->object->getJavaCodebase()."\"");
516  }
517  else
518  {
519  if (strpos($this->object->getJavaAppletFilename(), ".class") !== FALSE)
520  {
521  $template->setVariable("APPLET_CODEBASE", " codebase=\"".$this->object->getJavaPathWeb()."\"");
522  }
523  }
524  $questionoutput = $template->get();
525  if (!$show_question_only)
526  {
527  // get page object output
528  $questionoutput = $this->getILIASPage($questionoutput);
529  }
530  return $questionoutput;
531  }
532 
533  function getTestOutput($active_id, $pass = NULL, $is_postponed = FALSE, $use_post_solutions = FALSE)
534  {
535  $userdata = $this->object->getActiveUserData($active_id);
536  // generate the question output
537  include_once "./Services/UICore/classes/class.ilTemplate.php";
538  $template = new ilTemplate("tpl.il_as_qpl_javaapplet_question_output.html", TRUE, TRUE, "Modules/TestQuestionPool");
539  $template->setCurrentBlock("appletparam");
540  $template->setVariable("PARAM_NAME", "test_type");
541  include_once "./Modules/Test/classes/class.ilObjTest.php";
543  {
544  $template->setVariable("PARAM_VALUE", "0");
545  }
546  else
547  {
548  $template->setVariable("PARAM_VALUE", "1");
549  }
550  $template->parseCurrentBlock();
551  $template->setCurrentBlock("appletparam");
552  $template->setVariable("PARAM_NAME", "active_id");
553  $template->setVariable("PARAM_VALUE", $active_id);
554  $template->parseCurrentBlock();
555  $template->setCurrentBlock("appletparam");
556  $template->setVariable("PARAM_NAME", "test_id");
557  $template->setVariable("PARAM_VALUE", $userdata["test_id"]);
558  $template->parseCurrentBlock();
559  $template->setCurrentBlock("appletparam");
560  $template->setVariable("PARAM_NAME", "question_id");
561  $template->setVariable("PARAM_VALUE", $this->object->getId());
562  $template->parseCurrentBlock();
563  $template->setCurrentBlock("appletparam");
564  $template->setVariable("PARAM_NAME", "user_id");
565  $template->setVariable("PARAM_VALUE", $userdata["user_id"]);
566  $template->parseCurrentBlock();
567  $template->setCurrentBlock("appletparam");
568  $template->setVariable("PARAM_NAME", "points_max");
569  $template->setVariable("PARAM_VALUE", $this->object->getPoints());
570  $template->parseCurrentBlock();
571  $template->setCurrentBlock("appletparam");
572  $template->setVariable("PARAM_NAME", "session_id");
573  $template->setVariable("PARAM_VALUE", $_COOKIE["PHPSESSID"]);
574  $template->parseCurrentBlock();
575  $template->setCurrentBlock("appletparam");
576  $template->setVariable("PARAM_NAME", "client");
577  $template->setVariable("PARAM_VALUE", CLIENT_ID);
578  $template->parseCurrentBlock();
579  $template->setCurrentBlock("appletparam");
580  $template->setVariable("PARAM_NAME", "pass");
581  $actualpass = ilObjTest::_getPass($active_id);
582  $template->setVariable("PARAM_VALUE", $actualpass);
583  $template->parseCurrentBlock();
584  $template->setCurrentBlock("appletparam");
585  $template->setVariable("PARAM_NAME", "post_url");
586  $template->setVariable("PARAM_VALUE", ilUtil::removeTrailingPathSeparators(ILIAS_HTTP_PATH) . "/Modules/TestQuestionPool/save_question_post_data.php");
587  $template->parseCurrentBlock();
588  // additional parameters
589  for ($i = 0; $i < $this->object->getParameterCount(); $i++)
590  {
591  $parameter = $this->object->getParameter($i);
592  $template->setCurrentBlock("appletparam");
593  $template->setVariable("PARAM_NAME", $parameter["name"]);
594  $template->setVariable("PARAM_VALUE", $parameter["value"]);
595  $template->parseCurrentBlock();
596  }
597 
598  if ($active_id)
599  {
600  $solutions = NULL;
601  include_once "./Modules/Test/classes/class.ilObjTest.php";
602  if (!ilObjTest::_getUsePreviousAnswers($active_id, true))
603  {
604  if (is_null($pass)) $pass = ilObjTest::_getPass($active_id);
605  }
606  $info = $this->object->getReachedInformation($active_id, $pass);
607  foreach ($info as $kk => $infodata)
608  {
609  $template->setCurrentBlock("appletparam");
610  $template->setVariable("PARAM_NAME", "value_" . $infodata["order"] . "_1");
611  $template->setVariable("PARAM_VALUE", $infodata["value1"]);
612  $template->parseCurrentBlock();
613  $template->setCurrentBlock("appletparam");
614  $template->setVariable("PARAM_NAME", "value_" . $infodata["order"] . "_2");
615  $template->setVariable("PARAM_VALUE", $infodata["value2"]);
616  $template->parseCurrentBlock();
617  }
618  include_once './Services/Administration/classes/class.ilSetting.php';
619  $soapSetting = new ilSetting();
620  if ($soapSetting->get("soap_user_administration") == 1)
621  {
622  $template->setCurrentBlock("appletparam");
623  $template->setVariable("PARAM_NAME", "server");
624  $template->setVariable("PARAM_VALUE", ilUtil::removeTrailingPathSeparators(ILIAS_HTTP_PATH) . "/webservice/soap/server.php");
625  }
626  }
627 
628  $questiontext = $this->object->getQuestion();
629  $template->setVariable("QUESTIONTEXT", $this->object->prepareTextareaOutput($questiontext, TRUE));
630  $template->setVariable("APPLET_WIDTH", $this->object->getJavaWidth());
631  $template->setVariable("APPLET_HEIGHT", $this->object->getJavaHeight());
632  $template->setVariable("APPLET_CODE", $this->object->getJavaCode());
633  if (strlen($this->object->getJavaArchive()) > 0)
634  {
635  $template->setVariable("APPLET_ARCHIVE", " archive=\"".$this->object->getJavaArchive()."\"");
636  }
637  else
638  {
639  if (strpos($this->object->getJavaAppletFilename(), ".jar") !== FALSE)
640  {
641  $template->setVariable("APPLET_ARCHIVE", " archive=\"".$this->object->getJavaPathWeb().$this->object->getJavaAppletFilename()."\"");
642  }
643  }
644  if (strlen($this->object->getJavaCodebase()) > 0)
645  {
646  $template->setVariable("APPLET_CODEBASE", " codebase=\"".$this->object->getJavaCodebase()."\"");
647  }
648  else
649  {
650  if (strpos($this->object->getJavaAppletFilename(), ".class") !== FALSE)
651  {
652  $template->setVariable("APPLET_CODEBASE", " codebase=\"".$this->object->getJavaPathWeb()."\"");
653  }
654  }
655  $questionoutput = $template->get();
656  $pageoutput = $this->outQuestionPage("", $is_postponed, $active_id, $questionoutput);
657  return $pageoutput;
658  }
659 
667  function setQuestionTabs()
668  {
669  global $rbacsystem, $ilTabs;
670 
671  $this->ctrl->setParameterByClass("ilAssQuestionPageGUI", "q_id", $_GET["q_id"]);
672  include_once "./Modules/TestQuestionPool/classes/class.assQuestion.php";
673  $q_type = $this->object->getQuestionType();
674 
675  if (strlen($q_type))
676  {
677  $classname = $q_type . "GUI";
678  $this->ctrl->setParameterByClass(strtolower($classname), "sel_question_types", $q_type);
679  $this->ctrl->setParameterByClass(strtolower($classname), "q_id", $_GET["q_id"]);
680  }
681 
682  if ($_GET["q_id"])
683  {
684  if ($rbacsystem->checkAccess('write', $_GET["ref_id"]))
685  {
686  // edit page
687  $ilTabs->addTarget("edit_page",
688  $this->ctrl->getLinkTargetByClass("ilAssQuestionPageGUI", "edit"),
689  array("edit", "insert", "exec_pg"),
690  "", "", $force_active);
691  }
692 
693  // edit page
694  $ilTabs->addTarget("preview",
695  $this->ctrl->getLinkTargetByClass("ilAssQuestionPageGUI", "preview"),
696  array("preview"),
697  "ilAssQuestionPageGUI", "", $force_active);
698  }
699 
700  $force_active = false;
701  if ($rbacsystem->checkAccess('write', $_GET["ref_id"]))
702  {
703  $url = "";
704  if ($classname) $url = $this->ctrl->getLinkTargetByClass($classname, "editQuestion");
705  $commands = $_POST["cmd"];
706  if (is_array($commands))
707  {
708  foreach ($commands as $key => $value)
709  {
710  if (preg_match("/^delete_.*/", $key, $matches))
711  {
712  $force_active = true;
713  }
714  }
715  }
716  // edit question properties
717  $ilTabs->addTarget("edit_question",
718  $url,
719  array("editQuestion", "save", "saveEdit", "addkvp", "removekvp", "originalSyncForm"),
720  $classname, "", $force_active);
721  }
722 
723  // add tab for question feedback within common class assQuestionGUI
724  $this->addTab_QuestionFeedback($ilTabs);
725 
726  // add tab for question hint within common class assQuestionGUI
727  $this->addTab_QuestionHints($ilTabs);
728 
729  if ($_GET["q_id"])
730  {
731  $ilTabs->addTarget("solution_hint",
732  $this->ctrl->getLinkTargetByClass($classname, "suggestedsolution"),
733  array("suggestedsolution", "saveSuggestedSolution", "outSolutionExplorer", "cancel",
734  "addSuggestedSolution","cancelExplorer", "linkChilds", "removeSuggestedSolution"
735  ),
736  $classname,
737  ""
738  );
739  }
740 
741  // Assessment of questions sub menu entry
742  if ($_GET["q_id"])
743  {
744  $ilTabs->addTarget("statistics",
745  $this->ctrl->getLinkTargetByClass($classname, "assessment"),
746  array("assessment"),
747  $classname, "");
748  }
749 
750  if (($_GET["calling_test"] > 0) || ($_GET["test_ref_id"] > 0))
751  {
752  $ref_id = $_GET["calling_test"];
753  if (strlen($ref_id) == 0) $ref_id = $_GET["test_ref_id"];
754 
755  global $___test_express_mode;
756 
757  if (!$_GET['test_express_mode'] && !$___test_express_mode) {
758  $ilTabs->setBackTarget($this->lng->txt("backtocallingtest"), "ilias.php?baseClass=ilObjTestGUI&cmd=questions&ref_id=$ref_id");
759  }
760  else {
762  $ilTabs->setBackTarget($this->lng->txt("backtocallingtest"), $link);
763  }
764  }
765  else
766  {
767  $ilTabs->setBackTarget($this->lng->txt("qpl"), $this->ctrl->getLinkTargetByClass("ilobjquestionpoolgui", "questions"));
768  }
769  }
770 
771  function getSpecificFeedbackOutput($active_id, $pass)
772  {
773  $output = "";
774  return $this->object->prepareTextareaOutput($output, TRUE);
775  }
776 
787  {
788  return array();
789  }
790 
799  public function getAggregatedAnswersView($relevant_answers)
800  {
801  // Empty implementation here since a feasible way to aggregate answer is not known.
802  return ''; //print_r($relevant_answers,true);
803  }
804 }