ILIAS  Release_5_0_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 
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  {
66  require_once 'Services/Form/classes/class.ilPropertyFormGUI.php';
67 
69 
70  $this->object->setPoints($_POST["points"]);
72 
73  $this->saveTaxonomyAssignments();
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 
166  $header = new ilFormSectionHeaderGUI();
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 
230  $header = new ilFormSectionHeaderGUI();
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->getReachedInformation($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->getAnswerFeedbackOutput($active_id, $pass) : "";
449  if (strlen($feedback)) $solutiontemplate->setVariable("FEEDBACK", $feedback);
450  $solutiontemplate->setVariable("SOLUTION_OUTPUT", $questionoutput);
451 
452  $solutionoutput = $solutiontemplate->get();
453  if (!$show_question_only)
454  {
455  // get page object output
456  $solutionoutput = $this->getILIASPage($solutionoutput);
457  }
458  return $solutionoutput;
459  }
460 
461  function getPreview($show_question_only = FALSE, $showInlineFeedback = false)
462  {
463  // generate the question output
464  include_once "./Services/UICore/classes/class.ilTemplate.php";
465  $template = new ilTemplate("tpl.il_as_qpl_javaapplet_question_output.html", TRUE, TRUE, "Modules/TestQuestionPool");
466  $template->setCurrentBlock("appletparam");
467  $template->setVariable("PARAM_NAME", "question_id");
468  $template->setVariable("PARAM_VALUE", $this->object->getId());
469  $template->parseCurrentBlock();
470  $template->setCurrentBlock("appletparam");
471  $template->setVariable("PARAM_NAME", "points_max");
472  $template->setVariable("PARAM_VALUE", $this->object->getPoints());
473  $template->parseCurrentBlock();
474  $template->setCurrentBlock("appletparam");
475  $template->setVariable("PARAM_NAME", "session_id");
476  $template->setVariable("PARAM_VALUE", $_COOKIE["PHPSESSID"]);
477  $template->parseCurrentBlock();
478  $template->setCurrentBlock("appletparam");
479  $template->setVariable("PARAM_NAME", "client");
480  $template->setVariable("PARAM_VALUE", CLIENT_ID);
481  $template->parseCurrentBlock();
482  // additional parameters
483  for ($i = 0; $i < $this->object->getParameterCount(); $i++)
484  {
485  $parameter = $this->object->getParameter($i);
486  $template->setCurrentBlock("appletparam");
487  $template->setVariable("PARAM_NAME", $parameter["name"]);
488  $template->setVariable("PARAM_VALUE", $parameter["value"]);
489  $template->parseCurrentBlock();
490  }
491 
492  $questiontext = $this->object->getQuestion();
493  $template->setVariable("QUESTIONTEXT", $this->object->prepareTextareaOutput($questiontext, TRUE));
494  $template->setVariable("APPLET_WIDTH", $this->object->getJavaWidth());
495  $template->setVariable("APPLET_HEIGHT", $this->object->getJavaHeight());
496  $template->setVariable("APPLET_CODE", $this->object->getJavaCode());
497  if (strlen($this->object->getJavaArchive()) > 0)
498  {
499  $template->setVariable("APPLET_ARCHIVE", " archive=\"".$this->object->getJavaArchive()."\"");
500  }
501  else
502  {
503  if (strpos($this->object->getJavaAppletFilename(), ".jar") !== FALSE)
504  {
505  $template->setVariable("APPLET_ARCHIVE", " archive=\"".$this->object->getJavaPathWeb().$this->object->getJavaAppletFilename()."\"");
506  }
507  }
508  if (strlen($this->object->getJavaCodebase()) > 0)
509  {
510  $template->setVariable("APPLET_CODEBASE", " codebase=\"".$this->object->getJavaCodebase()."\"");
511  }
512  else
513  {
514  if (strpos($this->object->getJavaAppletFilename(), ".class") !== FALSE)
515  {
516  $template->setVariable("APPLET_CODEBASE", " codebase=\"".$this->object->getJavaPathWeb()."\"");
517  }
518  }
519  $questionoutput = $template->get();
520  if (!$show_question_only)
521  {
522  // get page object output
523  $questionoutput = $this->getILIASPage($questionoutput);
524  }
525  return $questionoutput;
526  }
527 
528  function getTestOutput($active_id, $pass = NULL, $is_postponed = FALSE, $use_post_solutions = FALSE)
529  {
530  $userdata = $this->object->getActiveUserData($active_id);
531  // generate the question output
532  include_once "./Services/UICore/classes/class.ilTemplate.php";
533  $template = new ilTemplate("tpl.il_as_qpl_javaapplet_question_output.html", TRUE, TRUE, "Modules/TestQuestionPool");
534  $template->setCurrentBlock("appletparam");
535  $template->setVariable("PARAM_NAME", "test_type");
536  include_once "./Modules/Test/classes/class.ilObjTest.php";
538  {
539  $template->setVariable("PARAM_VALUE", "0");
540  }
541  else
542  {
543  $template->setVariable("PARAM_VALUE", "1");
544  }
545  $template->parseCurrentBlock();
546  $template->setCurrentBlock("appletparam");
547  $template->setVariable("PARAM_NAME", "active_id");
548  $template->setVariable("PARAM_VALUE", $active_id);
549  $template->parseCurrentBlock();
550  $template->setCurrentBlock("appletparam");
551  $template->setVariable("PARAM_NAME", "test_id");
552  $template->setVariable("PARAM_VALUE", $userdata["test_id"]);
553  $template->parseCurrentBlock();
554  $template->setCurrentBlock("appletparam");
555  $template->setVariable("PARAM_NAME", "question_id");
556  $template->setVariable("PARAM_VALUE", $this->object->getId());
557  $template->parseCurrentBlock();
558  $template->setCurrentBlock("appletparam");
559  $template->setVariable("PARAM_NAME", "user_id");
560  $template->setVariable("PARAM_VALUE", $userdata["user_id"]);
561  $template->parseCurrentBlock();
562  $template->setCurrentBlock("appletparam");
563  $template->setVariable("PARAM_NAME", "points_max");
564  $template->setVariable("PARAM_VALUE", $this->object->getPoints());
565  $template->parseCurrentBlock();
566  $template->setCurrentBlock("appletparam");
567  $template->setVariable("PARAM_NAME", "session_id");
568  $template->setVariable("PARAM_VALUE", $_COOKIE["PHPSESSID"]);
569  $template->parseCurrentBlock();
570  $template->setCurrentBlock("appletparam");
571  $template->setVariable("PARAM_NAME", "client");
572  $template->setVariable("PARAM_VALUE", CLIENT_ID);
573  $template->parseCurrentBlock();
574  $template->setCurrentBlock("appletparam");
575  $template->setVariable("PARAM_NAME", "pass");
576  $actualpass = ilObjTest::_getPass($active_id);
577  $template->setVariable("PARAM_VALUE", $actualpass);
578  $template->parseCurrentBlock();
579  $template->setCurrentBlock("appletparam");
580  $template->setVariable("PARAM_NAME", "post_url");
581  $template->setVariable("PARAM_VALUE", ilUtil::removeTrailingPathSeparators(ILIAS_HTTP_PATH) . "/Modules/TestQuestionPool/save_question_post_data.php");
582  $template->parseCurrentBlock();
583  // additional parameters
584  for ($i = 0; $i < $this->object->getParameterCount(); $i++)
585  {
586  $parameter = $this->object->getParameter($i);
587  $template->setCurrentBlock("appletparam");
588  $template->setVariable("PARAM_NAME", $parameter["name"]);
589  $template->setVariable("PARAM_VALUE", $parameter["value"]);
590  $template->parseCurrentBlock();
591  }
592 
593  if ($active_id)
594  {
595  $solutions = NULL;
596  include_once "./Modules/Test/classes/class.ilObjTest.php";
597  if (!ilObjTest::_getUsePreviousAnswers($active_id, true))
598  {
599  if (is_null($pass)) $pass = ilObjTest::_getPass($active_id);
600  }
601  $info = $this->object->getReachedInformation($active_id, $pass);
602  foreach ($info as $kk => $infodata)
603  {
604  $template->setCurrentBlock("appletparam");
605  $template->setVariable("PARAM_NAME", "value_" . $infodata["order"] . "_1");
606  $template->setVariable("PARAM_VALUE", $infodata["value1"]);
607  $template->parseCurrentBlock();
608  $template->setCurrentBlock("appletparam");
609  $template->setVariable("PARAM_NAME", "value_" . $infodata["order"] . "_2");
610  $template->setVariable("PARAM_VALUE", $infodata["value2"]);
611  $template->parseCurrentBlock();
612  }
613  include_once './Services/Administration/classes/class.ilSetting.php';
614  $soapSetting = new ilSetting();
615  if ($soapSetting->get("soap_user_administration") == 1)
616  {
617  $template->setCurrentBlock("appletparam");
618  $template->setVariable("PARAM_NAME", "server");
619  $template->setVariable("PARAM_VALUE", ilUtil::removeTrailingPathSeparators(ILIAS_HTTP_PATH) . "/webservice/soap/server.php");
620  }
621  }
622 
623  $questiontext = $this->object->getQuestion();
624  $template->setVariable("QUESTIONTEXT", $this->object->prepareTextareaOutput($questiontext, TRUE));
625  $template->setVariable("APPLET_WIDTH", $this->object->getJavaWidth());
626  $template->setVariable("APPLET_HEIGHT", $this->object->getJavaHeight());
627  $template->setVariable("APPLET_CODE", $this->object->getJavaCode());
628  if (strlen($this->object->getJavaArchive()) > 0)
629  {
630  $template->setVariable("APPLET_ARCHIVE", " archive=\"".$this->object->getJavaArchive()."\"");
631  }
632  else
633  {
634  if (strpos($this->object->getJavaAppletFilename(), ".jar") !== FALSE)
635  {
636  $template->setVariable("APPLET_ARCHIVE", " archive=\"".$this->object->getJavaPathWeb().$this->object->getJavaAppletFilename()."\"");
637  }
638  }
639  if (strlen($this->object->getJavaCodebase()) > 0)
640  {
641  $template->setVariable("APPLET_CODEBASE", " codebase=\"".$this->object->getJavaCodebase()."\"");
642  }
643  else
644  {
645  if (strpos($this->object->getJavaAppletFilename(), ".class") !== FALSE)
646  {
647  $template->setVariable("APPLET_CODEBASE", " codebase=\"".$this->object->getJavaPathWeb()."\"");
648  }
649  }
650  $questionoutput = $template->get();
651  $pageoutput = $this->outQuestionPage("", $is_postponed, $active_id, $questionoutput);
652  return $pageoutput;
653  }
654 
662  function setQuestionTabs()
663  {
664  global $rbacsystem, $ilTabs;
665 
666  $ilTabs->clearTargets();
667 
668  $this->ctrl->setParameterByClass("ilAssQuestionPageGUI", "q_id", $_GET["q_id"]);
669  include_once "./Modules/TestQuestionPool/classes/class.assQuestion.php";
670  $q_type = $this->object->getQuestionType();
671 
672  if (strlen($q_type))
673  {
674  $classname = $q_type . "GUI";
675  $this->ctrl->setParameterByClass(strtolower($classname), "sel_question_types", $q_type);
676  $this->ctrl->setParameterByClass(strtolower($classname), "q_id", $_GET["q_id"]);
677  }
678 
679  if ($_GET["q_id"])
680  {
681  if ($rbacsystem->checkAccess('write', $_GET["ref_id"]))
682  {
683  // edit page
684  $ilTabs->addTarget("edit_page",
685  $this->ctrl->getLinkTargetByClass("ilAssQuestionPageGUI", "edit"),
686  array("edit", "insert", "exec_pg"),
687  "", "", $force_active);
688  }
689 
690  $this->addTab_QuestionPreview($ilTabs);
691  }
692 
693  $force_active = false;
694  if ($rbacsystem->checkAccess('write', $_GET["ref_id"]))
695  {
696  $url = "";
697  if ($classname) $url = $this->ctrl->getLinkTargetByClass($classname, "editQuestion");
698  $commands = $_POST["cmd"];
699  if (is_array($commands))
700  {
701  foreach ($commands as $key => $value)
702  {
703  if (preg_match("/^delete_.*/", $key, $matches))
704  {
705  $force_active = true;
706  }
707  }
708  }
709  // edit question properties
710  $ilTabs->addTarget("edit_question",
711  $url,
712  array("editQuestion", "save", "saveEdit", "addkvp", "removekvp", "originalSyncForm"),
713  $classname, "", $force_active);
714  }
715 
716  // add tab for question feedback within common class assQuestionGUI
717  $this->addTab_QuestionFeedback($ilTabs);
718 
719  // add tab for question hint within common class assQuestionGUI
720  $this->addTab_QuestionHints($ilTabs);
721 
722  // add tab for question's suggested solution within common class assQuestionGUI
723  $this->addTab_SuggestedSolution($ilTabs, $classname);
724 
725  // Assessment of questions sub menu entry
726  if ($_GET["q_id"])
727  {
728  $ilTabs->addTarget("statistics",
729  $this->ctrl->getLinkTargetByClass($classname, "assessment"),
730  array("assessment"),
731  $classname, "");
732  }
733 
734  $this->addBackTab($ilTabs);
735  }
736 
737  function getSpecificFeedbackOutput($active_id, $pass)
738  {
739  $output = "";
740  return $this->object->prepareTextareaOutput($output, TRUE);
741  }
742 
753  {
754  return array();
755  }
756 
765  public function getAggregatedAnswersView($relevant_answers)
766  {
767  // Empty implementation here since a feasible way to aggregate answer is not known.
768  return ''; //print_r($relevant_answers,true);
769  }
770 }