ILIAS  release_5-0 Revision 5.0.0-1144-gc4397b1f870
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 (ilPropertyFormGUI $form)
 Extracts the question specific values from $_POST and applies them to the data object. More...
 
 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...
 
 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, $showInlineFeedback=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 ($linkTargetGui)
 
 setTargetGuiClass ($targetGuiClass)
 
 getTargetGuiClass ()
 
 setQuestionHeaderBlockBuilder ($questionHeaderBlockBuilder)
 
 setQuestionActionCmd ($questionActionCmd)
 
 getQuestionActionCmd ()
 
_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...
 
 getGenericFeedbackOutputForCorrectSolution ()
 
 getGenericFeedbackOutputForIncorrectSolution ()
 
 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 ()
 
 addTab_SuggestedSolution (ilTabsGUI $tabs, $classname)
 
 getEditQuestionTabCommands ()
 
 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 ()
 
 getPreview ($show_question_only=FALSE, $showInlineFeedback=false)
 
 outQuestionForTest ( $formaction, $active_id, $pass=NULL, $is_question_postponed=FALSE, $user_post_solutions=FALSE, $show_specific_inline_feedback=FALSE)
 
 setPreviewSession ($previewSession)
 
 getPreviewSession ()
 
 showHints ()
 
- Public Member Functions inherited from ilGuiQuestionScoringAdjustable
 populateQuestionSpecificFormPart (ilPropertyFormGUI $form)
 Adds the question specific forms parts to a question property form gui. More...
 

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'
 
const FORM_ENCODING_URLENCODE = 'application/x-www-form-urlencoded'
 
const FORM_ENCODING_MULTIPART = 'multipart/form-data'
 
const SESSION_PREVIEW_DATA_BASE_INDEX = 'ilAssQuestionPreviewAnswers'
 
 $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
 writePostData ()
 Evaluates a posted edit form and writes the form data in the question object. More...
 
 saveTaxonomyAssignments ()
 
 populateTaxonomyFormSection (ilPropertyFormGUI $form)
 
 getBasicEditQuestionTabCommands ()
 
 getAdditionalEditQuestionCommands ()
 
 addTab_QuestionFeedback (ilTabsGUI $tabs)
 adds the feedback tab to ilTabsGUI More...
 
 addTab_QuestionHints (ilTabsGUI $tabs)
 adds the hints tab to ilTabsGUI More...
 
 addTab_QuestionPreview (ilTabsGUI $tabsGUI)
 
 writeQuestionGenericPostData ()
 
 getFormEncodingType ()
 
 addBackTab (ilTabsGUI $ilTabs)
 
 buildBasicEditFormObject ()
 

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 255 of file class.assJavaAppletGUI.php.

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

256  {
257  $this->writePostData(true);
258  $position = key($_POST['cmd']['addkvp']);
259  $this->object->addParameterAtIndex($position+1, "", "");
260  $this->editQuestion();
261  }
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 122 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().

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  }
$errors
addBasicQuestionFormProperties($form)
Add basic question form properties: assessment: title, author, description, question, working time.
This class represents a property form user interface.
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[]

Implements ilGuiQuestionScoringAdjustable.

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

753  {
754  return array();
755  }

◆ 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

Implements ilGuiQuestionScoringAdjustable.

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

766  {
767  // Empty implementation here since a feasible way to aggregate answer is not known.
768  return ''; //print_r($relevant_answers,true);
769  }

◆ 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,
  $showInlineFeedback = false 
)

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

References $_COOKIE, and assQuestionGUI\getILIASPage().

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  }
$_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 287 of file class.assJavaAppletGUI.php.

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

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  }
_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
getILIASPage($html="")
Returns the ILIAS Page around a question.
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 737 of file class.assJavaAppletGUI.php.

738  {
739  $output = "";
740  return $this->object->prepareTextareaOutput($output, TRUE);
741  }

◆ getTestOutput()

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

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

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

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  }
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:

◆ populateQuestionSpecificFormPart()

assJavaAppletGUI::populateQuestionSpecificFormPart ( \ilPropertyFormGUI  $form)

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

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

Referenced by editQuestion().

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  }
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 266 of file class.assJavaAppletGUI.php.

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

267  {
268  $this->writePostData(true);
269  $position = key($_POST['cmd']['removekvp']);
270  $this->object->removeParameter($position);
271  $this->editQuestion();
272  }
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 662 of file class.assJavaAppletGUI.php.

References $_GET, $_POST, assQuestionGUI\addBackTab(), assQuestionGUI\addTab_QuestionFeedback(), assQuestionGUI\addTab_QuestionHints(), assQuestionGUI\addTab_QuestionPreview(), and assQuestionGUI\addTab_SuggestedSolution().

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  }
addTab_QuestionPreview(ilTabsGUI $tabsGUI)
$_POST['username']
Definition: cron.php:12
addTab_QuestionHints(ilTabsGUI $tabs)
adds the hints tab to ilTabsGUI
$_GET["client_id"]
addTab_QuestionFeedback(ilTabsGUI $tabs)
adds the feedback tab to ilTabsGUI
addBackTab(ilTabsGUI $ilTabs)
addTab_SuggestedSolution(ilTabsGUI $tabs, $classname)
+ 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  {
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  }
editQuestion($checkonly=FALSE)
Creates an output of the edit form for the question.
$_POST['username']
Definition: cron.php:12
This class represents a property form user interface.
writeQuestionSpecificPostData(ilPropertyFormGUI $form)
Extracts the question specific values from $_POST and applies them to the data object.
+ Here is the call graph for this function:

◆ writeQuestionSpecificPostData()

assJavaAppletGUI::writeQuestionSpecificPostData ( ilPropertyFormGUI  $form)

Extracts the question specific values from $_POST and applies them to the data object.

Parameters
bool$alwaysIf true, a check for form validity is omitted.
Returns
void

Implements ilGuiQuestionScoringAdjustable.

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

References $_POST.

Referenced by writePostData().

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  }
$_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: