ILIAS  release_4-4 Revision
All Data Structures Namespaces Files Functions Variables Modules Pages
assJavaAppletGUI Class Reference

Java applet question GUI representation. More...

+ Inheritance diagram for assJavaAppletGUI:
+ Collaboration diagram for assJavaAppletGUI:

Public Member Functions

 __construct ($id=-1)
 assJavaAppletGUI constructor More...
 
 getCommand ($cmd)
 
 writePostData ($always=false)
 Evaluates a posted edit form and writes the form data in the question object. More...
 
 writeQuestionSpecificPostData ($always=true)
 
 editQuestion ($checkonly=FALSE)
 Creates an output of the edit form for the question. More...
 
 populateQuestionSpecificFormPart (\ilPropertyFormGUI $form)
 
 addkvp ()
 Add a new answer. More...
 
 removekvp ()
 Remove an answer. More...
 
 outQuestionForTest ($formaction, $active_id, $pass=NULL, $is_postponed=FALSE, $use_post_solutions=FALSE)
 
 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. More...
 
 getPreview ($show_question_only=FALSE)
 
 getTestOutput ($active_id, $pass=NULL, $is_postponed=FALSE, $use_post_solutions=FALSE)
 
 setQuestionTabs ()
 Sets the ILIAS tabs for this question type. More...
 
 getSpecificFeedbackOutput ($active_id, $pass)
 
 getAfterParticipationSuppressionQuestionPostVars ()
 Returns a list of postvars which will be suppressed in the form output when used in scoring adjustment. More...
 
 getAggregatedAnswersView ($relevant_answers)
 Returns an html string containing a question specific representation of the answers so far given in the test for use in the right column in the scoring adjustment user interface. More...
 
- Public Member Functions inherited from assQuestionGUI
 __construct ()
 assQuestionGUI constructor More...
 
executeCommand ()
 execute command More...
 
 getCommand ($cmd)
 
 getType ()
 needed for page editor compliance More...
 
 setTaxonomyIds ($taxonomyIds)
 
 getTaxonomyIds ()
 
 setTargetGui (ilTestPlayerAbstractGUI $linkTargetGui)
 
 setTargetGuiClass ($targetGuiClass)
 
 getTargetGuiClass ()
 
 writePostData ()
 Evaluates a posted edit form and writes the form data in the question object. More...
 
 assessment ()
 output assessment More...
 
_getQuestionGUI ($question_type, $question_id=-1)
 Creates a question gui representation and returns the alias to the question gui note: please do not use $this inside this method to allow static calls. More...
 
 _getGUIClassNameForId ($a_q_id)
 
 _getClassNameForQType ($q_type)
 
createQuestionGUI ($question_type, $question_id=-1)
 Creates a question gui representation. More...
 
 getQuestionTemplate ()
 get question template More...
 
 getILIASPage ($html="")
 Returns the ILIAS Page around a question. More...
 
 outQuestionPage ($a_temp_var, $a_postponed=false, $active_id="", $html="")
 output question page More...
 
 cancel ()
 cancel action More...
 
 originalSyncForm ($return_to="", $return_to_feedback='')
 
 sync ()
 
 cancelSync ()
 
 saveEdit ()
 save question More...
 
 save ()
 save question More...
 
 saveReturn ()
 save question More...
 
 apply ()
 apply changes More...
 
 getContextPath ($cont_obj, $a_endnode_id, $a_startnode_id=1)
 get context path in content object tree More...
 
 setSequenceNumber ($nr)
 
 getSequenceNumber ()
 
 setQuestionCount ($a_question_count)
 
 getQuestionCount ()
 
 getErrorMessage ()
 
 setErrorMessage ($errormessage)
 
 addErrorMessage ($errormessage)
 
 outAdditionalOutput ()
 
 getQuestionType ()
 Returns the question type string. More...
 
 getAsValueAttribute ($a_value)
 Returns a HTML value attribute. More...
 
 addNewIdListener (&$a_object, $a_method, $a_parameters="")
 Add a listener that is notified with the new question ID, when a new question is saved. More...
 
 callNewIdListeners ($a_new_id)
 Call the new id listeners. More...
 
 addQuestionFormCommandButtons ($form)
 Add the command buttons of a question properties form. More...
 
 addBasicQuestionFormProperties ($form)
 Add basic question form properties: assessment: title, author, description, question, working time. More...
 
 getSelfAssessmentTags ()
 Get tags allowed in question tags in self assessment mode. More...
 
 getAnswerFeedbackOutput ($active_id, $pass)
 Returns the answer generic feedback depending on the results of the question. More...
 
 getGenericFeedbackOutput ($active_id, $pass)
 Returns the answer specific feedback for the question. More...
 
 getSpecificFeedbackOutput ($active_id, $pass)
 Returns the answer specific feedback for the question. More...
 
 outQuestionType ()
 
 showSuggestedSolution ()
 
 suggestedsolution ()
 Allows to add suggested solutions for questions. More...
 
 outSolutionExplorer ()
 
 saveSuggestedSolution ()
 
 cancelExplorer ()
 
 outPageSelector ()
 
 outChapterSelector ()
 
 outGlossarySelector ()
 
 linkChilds ()
 
 addPG ()
 
 addST ()
 
 addGIT ()
 
 isSaveCommand ()
 
 setQuestionTabs ()
 
 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)
 
 isAutosaveable ()
 
 showHints ()
 

Additional Inherited Members

- Static Public Member Functions inherited from assQuestionGUI
static getCommandsFromClassConstants ($guiClassName, $cmdConstantNameBegin='CMD_')
 extracts values of all constants of given class with given prefix as array can be used to get all possible commands in case of these commands are defined as constants More...
 
- Data Fields inherited from assQuestionGUI
const FORM_MODE_EDIT = 'edit'
 
const FORM_MODE_ADJUST = 'adjust'
 
 $object
 
 $tpl
 
 $lng
 
 $error
 
 $errormessage
 
 $sequence_no
 sequence number in test More...
 
 $question_count
 question count in test More...
 
- Protected Member Functions inherited from assQuestionGUI
 saveTaxonomyAssignments ()
 
 populateTaxonomyFormSection (ilPropertyFormGUI $form)
 
 addTab_QuestionFeedback (ilTabsGUI $tabs)
 adds the feedback tab to ilTabsGUI More...
 
 addTab_QuestionHints (ilTabsGUI $tabs)
 adds the hints tab to ilTabsGUI More...
 
 writeQuestionGenericPostData ()
 

Detailed Description

Java applet question GUI representation.

The assJavaAppletGUI class encapsulates the GUI representation for java applet questions.

Author
Helmut Schottmüller helmu.nosp@m.t.sc.nosp@m.hottm.nosp@m.uell.nosp@m.er@ma.nosp@m.c.co.nosp@m.m
Björn Heyser bheys.nosp@m.er@d.nosp@m.ataba.nosp@m.y.de
Maximilian Becker mbeck.nosp@m.er@d.nosp@m.ataba.nosp@m.y.de
Version
$Id$

Definition at line 22 of file class.assJavaAppletGUI.php.

Constructor & Destructor Documentation

◆ __construct()

assJavaAppletGUI::__construct (   $id = -1)

assJavaAppletGUI constructor

The constructor takes possible arguments an creates an instance of the assJavaAppletGUI object.

Parameters
integer$idThe database id of a image map question object
Returns

Definition at line 33 of file class.assJavaAppletGUI.php.

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  }
Class for Java Applet Questions.

Member Function Documentation

◆ addkvp()

assJavaAppletGUI::addkvp ( )

Add a new answer.

Definition at line 253 of file class.assJavaAppletGUI.php.

References $_POST, editQuestion(), and assQuestionGUI\writePostData().

254  {
255  $this->writePostData(true);
256  $position = key($_POST['cmd']['addkvp']);
257  $this->object->addParameterAtIndex($position+1, "", "");
258  $this->editQuestion();
259  }
editQuestion($checkonly=FALSE)
Creates an output of the edit form for the question.
writePostData()
Evaluates a posted edit form and writes the form data in the question object.
$_POST['username']
Definition: cron.php:12
+ Here is the call graph for this function:

◆ editQuestion()

assJavaAppletGUI::editQuestion (   $checkonly = FALSE)

Creates an output of the edit form for the question.

Definition at line 120 of file class.assJavaAppletGUI.php.

References $errors, assQuestionGUI\addBasicQuestionFormProperties(), assQuestionGUI\addQuestionFormCommandButtons(), assQuestionGUI\getQuestionTemplate(), assQuestionGUI\isSaveCommand(), assQuestionGUI\outQuestionType(), populateQuestionSpecificFormPart(), and assQuestionGUI\populateTaxonomyFormSection().

Referenced by addkvp(), removekvp(), and writePostData().

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  }
addBasicQuestionFormProperties($form)
Add basic question form properties: assessment: title, author, description, question, working time.
This class represents a property form user interface.
$errors
getQuestionTemplate()
get question template
populateTaxonomyFormSection(ilPropertyFormGUI $form)
populateQuestionSpecificFormPart(\ilPropertyFormGUI $form)
addQuestionFormCommandButtons($form)
Add the command buttons of a question properties form.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getAfterParticipationSuppressionQuestionPostVars()

assJavaAppletGUI::getAfterParticipationSuppressionQuestionPostVars ( )

Returns a list of postvars which will be suppressed in the form output when used in scoring adjustment.

The form elements will be shown disabled, so the users see the usual form but can only edit the settings, which make sense in the given context.

E.g. array('cloze_type', 'image_filename')

Returns
string[]

Definition at line 786 of file class.assJavaAppletGUI.php.

787  {
788  return array();
789  }

◆ getAggregatedAnswersView()

assJavaAppletGUI::getAggregatedAnswersView (   $relevant_answers)

Returns an html string containing a question specific representation of the answers so far given in the test for use in the right column in the scoring adjustment user interface.

Parameters
array$relevant_answers
Returns
string

Definition at line 799 of file class.assJavaAppletGUI.php.

800  {
801  // Empty implementation here since a feasible way to aggregate answer is not known.
802  return ''; //print_r($relevant_answers,true);
803  }

◆ getCommand()

assJavaAppletGUI::getCommand (   $cmd)

Definition at line 44 of file class.assJavaAppletGUI.php.

References $cmd.

45  {
46  if (substr($cmd, 0, 6) == "delete")
47  {
48  $cmd = "delete";
49  }
50  return $cmd;
51  }
$cmd
Definition: sahs_server.php:35

◆ getPreview()

assJavaAppletGUI::getPreview (   $show_question_only = FALSE)

Definition at line 466 of file class.assJavaAppletGUI.php.

References $_COOKIE, and assQuestionGUI\getILIASPage().

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  }
$_COOKIE["ilClientId"]
Definition: cron.php:11
getILIASPage($html="")
Returns the ILIAS Page around a question.
special template class to simplify handling of ITX/PEAR
+ Here is the call graph for this function:

◆ getSolutionOutput()

assJavaAppletGUI::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.

Parameters
integer$active_idThe active user id
integer$passThe test pass
boolean$graphicalOutputShow visual feedback for right/wrong answers
boolean$result_outputShow the reached points for parts of the question
boolean$show_question_onlyShow the question without the ILIAS content around
boolean$show_feedbackShow the question feedback
boolean$show_correct_solutionShow the correct solution instead of the user solution
boolean$show_manual_scoringShow specific information for the manual scoring output
Returns
The solution output of the question as HTML code

Definition at line 292 of file class.assJavaAppletGUI.php.

References $_COOKIE, $pass, ilObjTest\_getObjectIDFromTestID(), ilObjTest\_getPass(), ilObjTest\_lookupAnonymity(), assQuestionGUI\getAnswerFeedbackOutput(), and ilUtil\getImagePath().

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  }
_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.
$_COOKIE["ilClientId"]
Definition: cron.php:11
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
special template class to simplify handling of ITX/PEAR
getAnswerFeedbackOutput($active_id, $pass)
Returns the answer generic feedback depending on the results of the question.
_getObjectIDFromTestID($test_id)
Returns the ILIAS test object id for a given test id.
+ Here is the call graph for this function:

◆ getSpecificFeedbackOutput()

assJavaAppletGUI::getSpecificFeedbackOutput (   $active_id,
  $pass 
)

Definition at line 771 of file class.assJavaAppletGUI.php.

772  {
773  $output = "";
774  return $this->object->prepareTextareaOutput($output, TRUE);
775  }

◆ getTestOutput()

assJavaAppletGUI::getTestOutput (   $active_id,
  $pass = NULL,
  $is_postponed = FALSE,
  $use_post_solutions = FALSE 
)

Definition at line 533 of file class.assJavaAppletGUI.php.

References $_COOKIE, $pass, ilObjTest\_getObjectIDFromTestID(), ilObjTest\_getPass(), ilObjTest\_getUsePreviousAnswers(), ilObjTest\_lookupAnonymity(), assQuestionGUI\outQuestionPage(), and ilUtil\removeTrailingPathSeparators().

Referenced by outQuestionForTest().

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  }
ILIAS Setting Class.
_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.
$_COOKIE["ilClientId"]
Definition: cron.php:11
special template class to simplify handling of ITX/PEAR
static removeTrailingPathSeparators($path)
_getUsePreviousAnswers($active_id, $user_active_user_setting=false)
Returns if the previous results should be hidden for a learner.
_getObjectIDFromTestID($test_id)
Returns the ILIAS test object id for a given test id.
outQuestionPage($a_temp_var, $a_postponed=false, $active_id="", $html="")
output question page
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ outQuestionForTest()

assJavaAppletGUI::outQuestionForTest (   $formaction,
  $active_id,
  $pass = NULL,
  $is_postponed = FALSE,
  $use_post_solutions = FALSE 
)

Definition at line 272 of file class.assJavaAppletGUI.php.

References $pass, and getTestOutput().

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  }
getTestOutput($active_id, $pass=NULL, $is_postponed=FALSE, $use_post_solutions=FALSE)
+ Here is the call graph for this function:

◆ populateQuestionSpecificFormPart()

assJavaAppletGUI::populateQuestionSpecificFormPart ( \ilPropertyFormGUI  $form)

Definition at line 154 of file class.assJavaAppletGUI.php.

References $filename, ilPropertyFormGUI\addItem(), ilNumberInputGUI\setDecimals(), ilFileInputGUI\setSuffixes(), ilTextInputGUI\setValue(), and ilNumberInputGUI\setValue().

Referenced by editQuestion().

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  }
setValue($a_value)
Set Value.
This class represents a section header in a property form.
This class represents a file property in a property form.
This class represents a checkbox property in a property form.
setDecimals($a_decimals)
Set Decimal Places.
This class represents a number property in a property form.
This class represents a text property in a property form.
$filename
Definition: buildRTE.php:89
This class represents a non editable value in a property form.
This class represents a key value pair wizard property in a property form.
setValue($a_value)
Set Value.
setSuffixes($a_suffixes)
Set Accepted Suffixes.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ removekvp()

assJavaAppletGUI::removekvp ( )

Remove an answer.

Definition at line 264 of file class.assJavaAppletGUI.php.

References $_POST, editQuestion(), and assQuestionGUI\writePostData().

265  {
266  $this->writePostData(true);
267  $position = key($_POST['cmd']['removekvp']);
268  $this->object->removeParameter($position);
269  $this->editQuestion();
270  }
editQuestion($checkonly=FALSE)
Creates an output of the edit form for the question.
writePostData()
Evaluates a posted edit form and writes the form data in the question object.
$_POST['username']
Definition: cron.php:12
+ Here is the call graph for this function:

◆ setQuestionTabs()

assJavaAppletGUI::setQuestionTabs ( )

Sets the ILIAS tabs for this question type.

public

Todo:
: MOVE THIS STEPS TO COMMON QUESTION CLASS assQuestionGUI

Definition at line 667 of file class.assJavaAppletGUI.php.

References $_GET, $_POST, $ref_id, assQuestionGUI\addTab_QuestionFeedback(), assQuestionGUI\addTab_QuestionHints(), and ilTestExpressPage\getReturnToPageLink().

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  }
$_POST['username']
Definition: cron.php:12
addTab_QuestionHints(ilTabsGUI $tabs)
adds the hints tab to ilTabsGUI
$_GET["client_id"]
static getReturnToPageLink($q_id=null)
addTab_QuestionFeedback(ilTabsGUI $tabs)
adds the feedback tab to ilTabsGUI
$ref_id
Definition: sahs_server.php:39
+ Here is the call graph for this function:

◆ writePostData()

assJavaAppletGUI::writePostData (   $always = false)

Evaluates a posted edit form and writes the form data in the question object.

Parameters
bool$always
Returns
integer A positive value, if one of the required fields wasn't set, else 0

Definition at line 61 of file class.assJavaAppletGUI.php.

References $_POST, editQuestion(), assQuestionGUI\saveTaxonomyAssignments(), assQuestionGUI\writeQuestionGenericPostData(), and writeQuestionSpecificPostData().

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  }
editQuestion($checkonly=FALSE)
Creates an output of the edit form for the question.
$_POST['username']
Definition: cron.php:12
writeQuestionSpecificPostData($always=true)
+ Here is the call graph for this function:

◆ writeQuestionSpecificPostData()

assJavaAppletGUI::writeQuestionSpecificPostData (   $always = true)

Definition at line 78 of file class.assJavaAppletGUI.php.

References $_POST.

Referenced by writePostData().

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  }
$_POST['username']
Definition: cron.php:12
+ Here is the caller graph for this function:

The documentation for this class was generated from the following file: