ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
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, $is_postponed=FALSE, $use_post_solutions=FALSE, $show_feedback=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...
 
 getPresentationContext ()
 
 setPresentationContext ($presentationContext)
 
 isTestPresentationContext ()
 
 isPreviousSolutionPrefilled ()
 
 setPreviousSolutionPrefilled ($previousSolutionPrefilled)
 
 getOutputMode ()
 
 setOutputMode ($outputMode)
 
 isPdfOutputMode ()
 
 isContentEditingOutputMode ()
 
 getNavigationGUI ()
 
 setNavigationGUI ($navigationGUI)
 
 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...
 
 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, $is_question_postponed=FALSE, $user_post_solutions=FALSE, $show_specific_inline_feedback=FALSE)
 
 magicAfterTestOutput ()
 
 getTestOutput ( $active_id, $pass, $is_question_postponed, $user_post_solutions, $show_specific_inline_feedback)
 
 getFormEncodingType ()
 
 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...
 
const PRESENTATION_CONTEXT_TEST = 'pContextTest'
 
const PRESENTATION_CONTEXT_RESULTS = 'pContextResults'
 
const OUTPUT_MODE_SCREEN = 'outModeScreen'
 
const OUTPUT_MODE_PDF = 'outModePdf'
 
const OUTPUT_MODE_CONTENT_EDITING = 'outModeUsrSol'
 
- Protected Member Functions inherited from assQuestionGUI
 writePostData ()
 Evaluates a posted edit form and writes the form data in the question object. More...
 
 getPreviousSolutionProvidedMessage ()
 
 saveTaxonomyAssignments ()
 
 populateTaxonomyFormSection (ilPropertyFormGUI $form)
 
 isLastSolutionSubmitAuthorized ($active_id, $pass)
 fetches solutions from database and prefers intermediate solutions, but falls back to authorized solutions. More...
 
 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)
 
 hasCorrectSolution ($activeId, $passIndex)
 
 writeQuestionGenericPostData ()
 
 completeTestOutputFormAction ($formAction, $active_id, $pass)
 
 getTestOutputSolutions ($activeId, $pass)
 
 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  }
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)
$errors
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 764 of file class.assJavaAppletGUI.php.

765  {
766  return array();
767  }

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

778  {
779  // Empty implementation here since a feasible way to aggregate answer is not known.
780  return ''; //print_r($relevant_answers,true);
781  }

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

References $_COOKIE, and assQuestionGUI\getILIASPage().

470  {
471  // generate the question output
472  include_once "./Services/UICore/classes/class.ilTemplate.php";
473  $template = new ilTemplate("tpl.il_as_qpl_javaapplet_question_output.html", TRUE, TRUE, "Modules/TestQuestionPool");
474  $template->setCurrentBlock("appletparam");
475  $template->setVariable("PARAM_NAME", "question_id");
476  $template->setVariable("PARAM_VALUE", $this->object->getId());
477  $template->parseCurrentBlock();
478  $template->setCurrentBlock("appletparam");
479  $template->setVariable("PARAM_NAME", "points_max");
480  $template->setVariable("PARAM_VALUE", $this->object->getPoints());
481  $template->parseCurrentBlock();
482  $template->setCurrentBlock("appletparam");
483  $template->setVariable("PARAM_NAME", "session_id");
484  $template->setVariable("PARAM_VALUE", $_COOKIE["PHPSESSID"]);
485  $template->parseCurrentBlock();
486  $template->setCurrentBlock("appletparam");
487  $template->setVariable("PARAM_NAME", "client");
488  $template->setVariable("PARAM_VALUE", CLIENT_ID);
489  $template->parseCurrentBlock();
490  // additional parameters
491  for ($i = 0; $i < $this->object->getParameterCount(); $i++)
492  {
493  $parameter = $this->object->getParameter($i);
494  $template->setCurrentBlock("appletparam");
495  $template->setVariable("PARAM_NAME", $parameter["name"]);
496  $template->setVariable("PARAM_VALUE", $parameter["value"]);
497  $template->parseCurrentBlock();
498  }
499 
500  $questiontext = $this->object->getQuestion();
501  $template->setVariable("QUESTIONTEXT", $this->object->prepareTextareaOutput($questiontext, TRUE));
502  $template->setVariable("APPLET_WIDTH", $this->object->getJavaWidth());
503  $template->setVariable("APPLET_HEIGHT", $this->object->getJavaHeight());
504  $template->setVariable("APPLET_CODE", $this->object->getJavaCode());
505  if (strlen($this->object->getJavaArchive()) > 0)
506  {
507  $template->setVariable("APPLET_ARCHIVE", " archive=\"".$this->object->getJavaArchive()."\"");
508  }
509  else
510  {
511  if (strpos($this->object->getJavaAppletFilename(), ".jar") !== FALSE)
512  {
513  $template->setVariable("APPLET_ARCHIVE", " archive=\"".$this->object->getJavaPathWeb().$this->object->getJavaAppletFilename()."\"");
514  }
515  }
516  if (strlen($this->object->getJavaCodebase()) > 0)
517  {
518  $template->setVariable("APPLET_CODEBASE", " codebase=\"".$this->object->getJavaCodebase()."\"");
519  }
520  else
521  {
522  if (strpos($this->object->getJavaAppletFilename(), ".class") !== FALSE)
523  {
524  $template->setVariable("APPLET_CODEBASE", " codebase=\"".$this->object->getJavaPathWeb()."\"");
525  }
526  }
527  $questionoutput = $template->get();
528  if (!$show_question_only)
529  {
530  // get page object output
531  $questionoutput = $this->getILIASPage($questionoutput);
532  }
533  return $questionoutput;
534  }
$_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, $info, $pass, ilObjTest\_getObjectIDFromTestID(), ilObjTest\_getPass(), ilObjTest\_lookupAnonymity(), ilAssQuestionFeedback\CSS_CLASS_FEEDBACK_CORRECT, ilAssQuestionFeedback\CSS_CLASS_FEEDBACK_WRONG, assQuestionGUI\getAnswerFeedbackOutput(), assQuestionGUI\getILIASPage(), ilUtil\getImagePath(), assQuestionGUI\hasCorrectSolution(), and assQuestionGUI\isTestPresentationContext().

298  {
299  $userdata = $this->object->getActiveUserData($active_id);
300 
301  // generate the question output
302  include_once "./Services/UICore/classes/class.ilTemplate.php";
303  include_once "./Modules/Test/classes/class.ilObjTest.php";
304  $template = new ilTemplate("tpl.il_as_qpl_javaapplet_question_output_solution.html", TRUE, TRUE, "Modules/TestQuestionPool");
305  $solutiontemplate = new ilTemplate("tpl.il_as_tst_solution_output.html",TRUE, TRUE, "Modules/TestQuestionPool");
306  if (strlen($userdata["test_id"]))
307  {
308  $template->setCurrentBlock("appletparam");
309  $template->setVariable("PARAM_NAME", "test_type");
311  {
312  $template->setVariable("PARAM_VALUE", "0");
313  }
314  else
315  {
316  $template->setVariable("PARAM_VALUE", "1");
317  }
318  $template->parseCurrentBlock();
319  }
320  if (strlen($userdata["test_id"]))
321  {
322  $template->setCurrentBlock("appletparam");
323  $template->setVariable("PARAM_NAME", "test_id");
324  $template->setVariable("PARAM_VALUE", $userdata["test_id"]);
325  $template->parseCurrentBlock();
326  }
327  $template->setCurrentBlock("appletparam");
328  $template->setVariable("PARAM_NAME", "active_id");
329  $template->setVariable("PARAM_VALUE", $active_id);
330  $template->parseCurrentBlock();
331  $template->setCurrentBlock("appletparam");
332  $template->setVariable("PARAM_NAME", "question_id");
333  $template->setVariable("PARAM_VALUE", $this->object->getId());
334  $template->parseCurrentBlock();
335  if (strlen($userdata["user_id"]))
336  {
337  $template->setCurrentBlock("appletparam");
338  $template->setVariable("PARAM_NAME", "user_id");
339  $template->setVariable("PARAM_VALUE", $userdata["user_id"]);
340  $template->parseCurrentBlock();
341  }
342  $template->setCurrentBlock("appletparam");
343  $template->setVariable("PARAM_NAME", "points_max");
344  $template->setVariable("PARAM_VALUE", $this->object->getPoints());
345  $template->parseCurrentBlock();
346  $template->setCurrentBlock("appletparam");
347  $template->setVariable("PARAM_NAME", "session_id");
348  $template->setVariable("PARAM_VALUE", $_COOKIE["PHPSESSID"]);
349  $template->parseCurrentBlock();
350  $template->setCurrentBlock("appletparam");
351  $template->setVariable("PARAM_NAME", "client");
352  $template->setVariable("PARAM_VALUE", CLIENT_ID);
353  $template->parseCurrentBlock();
354  $template->setCurrentBlock("appletparam");
355  $template->setVariable("PARAM_NAME", "pass");
356  $actualpass = ilObjTest::_getPass($active_id);
357  $template->setVariable("PARAM_VALUE", $actualpass);
358  $template->parseCurrentBlock();
359  // additional parameters
360  for ($i = 0; $i < $this->object->getParameterCount(); $i++)
361  {
362  $parameter = $this->object->getParameter($i);
363  $template->setCurrentBlock("appletparam");
364  $template->setVariable("PARAM_NAME", $parameter["name"]);
365  $template->setVariable("PARAM_VALUE", $parameter["value"]);
366  $template->parseCurrentBlock();
367  }
368 
369  if (($active_id > 0) && (!$show_correct_solution))
370  {
371  $solutions = NULL;
372  include_once "./Modules/Test/classes/class.ilObjTest.php";
373  $info = $this->object->getSolutionValues($active_id, $pass);
374  foreach ($info as $kk => $infodata)
375  {
376  $template->setCurrentBlock("appletparam");
377  $template->setVariable("PARAM_NAME", "value_" . $infodata["order"] . "_1");
378  $template->setVariable("PARAM_VALUE", $infodata["value1"]);
379  $template->parseCurrentBlock();
380  $template->setCurrentBlock("appletparam");
381  $template->setVariable("PARAM_NAME", "value_" . $infodata["order"] . "_2");
382  $template->setVariable("PARAM_VALUE", $infodata["value2"]);
383  $template->parseCurrentBlock();
384  }
385  }
386 
387  $questiontext = $this->object->getQuestion();
388  if ($show_question_text==true)
389  {
390  $template->setVariable("QUESTIONTEXT", $this->object->prepareTextareaOutput($questiontext, TRUE));
391  }
392  $template->setVariable("APPLET_WIDTH", $this->object->getJavaWidth());
393  $template->setVariable("APPLET_HEIGHT", $this->object->getJavaHeight());
394  $template->setVariable("APPLET_CODE", $this->object->getJavaCode());
395  if (strlen($this->object->getJavaArchive()) > 0)
396  {
397  $template->setVariable("APPLET_ARCHIVE", " archive=\"".$this->object->getJavaArchive()."\"");
398  }
399  else
400  {
401  if (strpos($this->object->getJavaAppletFilename(), ".jar") !== FALSE)
402  {
403  $template->setVariable("APPLET_ARCHIVE", " archive=\"".$this->object->getJavaPathWeb().$this->object->getJavaAppletFilename()."\"");
404  }
405  }
406  if (strlen($this->object->getJavaCodebase()) > 0)
407  {
408  $template->setVariable("APPLET_CODEBASE", " codebase=\"".$this->object->getJavaCodebase()."\"");
409  }
410  else
411  {
412  if (strpos($this->object->getJavaAppletFilename(), ".class") !== FALSE)
413  {
414  $template->setVariable("APPLET_CODEBASE", " codebase=\"".$this->object->getJavaPathWeb()."\"");
415  }
416  }
417  if (($active_id > 0) && (!$show_correct_solution))
418  {
419  if ($graphicalOutput)
420  {
421  // output of ok/not ok icons for user entered solutions
422  $reached_points = $this->object->getReachedPoints($active_id, $pass);
423  if ($reached_points == $this->object->getPoints())
424  {
425  $template->setCurrentBlock("icon_ok");
426  $template->setVariable("ICON_OK", ilUtil::getImagePath("icon_ok.svg"));
427  $template->setVariable("TEXT_OK", $this->lng->txt("answer_is_right"));
428  $template->parseCurrentBlock();
429  }
430  else
431  {
432  $template->setCurrentBlock("icon_ok");
433  if ($reached_points > 0)
434  {
435  $template->setVariable("ICON_NOT_OK", ilUtil::getImagePath("icon_mostly_ok.svg"));
436  $template->setVariable("TEXT_NOT_OK", $this->lng->txt("answer_is_not_correct_but_positive"));
437  }
438  else
439  {
440  $template->setVariable("ICON_NOT_OK", ilUtil::getImagePath("icon_not_ok.svg"));
441  $template->setVariable("TEXT_NOT_OK", $this->lng->txt("answer_is_wrong"));
442  }
443  $template->parseCurrentBlock();
444  }
445  }
446  }
447  $questionoutput = $template->get();
448  $feedback = ($show_feedback && !$this->isTestPresentationContext()) ? $this->getAnswerFeedbackOutput($active_id, $pass) : "";
449  if (strlen($feedback))
450  {
451  $cssClass = ( $this->hasCorrectSolution($active_id, $pass) ?
453  );
454 
455  $solutiontemplate->setVariable("ILC_FB_CSS_CLASS", $cssClass);
456  $solutiontemplate->setVariable("FEEDBACK", $this->object->prepareTextareaOutput( $feedback, true ));
457  }
458  $solutiontemplate->setVariable("SOLUTION_OUTPUT", $questionoutput);
459 
460  $solutionoutput = $solutiontemplate->get();
461  if (!$show_question_only)
462  {
463  // get page object output
464  $solutionoutput = $this->getILIASPage($solutionoutput);
465  }
466  return $solutionoutput;
467  }
hasCorrectSolution($activeId, $passIndex)
_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
$info
Definition: example_052.php:80
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 749 of file class.assJavaAppletGUI.php.

750  {
751  $output = "";
752  return $this->object->prepareTextareaOutput($output, TRUE);
753  }

◆ getTestOutput()

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

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

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

539  {
540  $userdata = $this->object->getActiveUserData($active_id);
541  // generate the question output
542  include_once "./Services/UICore/classes/class.ilTemplate.php";
543  $template = new ilTemplate("tpl.il_as_qpl_javaapplet_question_output.html", TRUE, TRUE, "Modules/TestQuestionPool");
544  $template->setCurrentBlock("appletparam");
545  $template->setVariable("PARAM_NAME", "test_type");
546  include_once "./Modules/Test/classes/class.ilObjTest.php";
548  {
549  $template->setVariable("PARAM_VALUE", "0");
550  }
551  else
552  {
553  $template->setVariable("PARAM_VALUE", "1");
554  }
555  $template->parseCurrentBlock();
556  $template->setCurrentBlock("appletparam");
557  $template->setVariable("PARAM_NAME", "active_id");
558  $template->setVariable("PARAM_VALUE", $active_id);
559  $template->parseCurrentBlock();
560  $template->setCurrentBlock("appletparam");
561  $template->setVariable("PARAM_NAME", "test_id");
562  $template->setVariable("PARAM_VALUE", $userdata["test_id"]);
563  $template->parseCurrentBlock();
564  $template->setCurrentBlock("appletparam");
565  $template->setVariable("PARAM_NAME", "question_id");
566  $template->setVariable("PARAM_VALUE", $this->object->getId());
567  $template->parseCurrentBlock();
568  $template->setCurrentBlock("appletparam");
569  $template->setVariable("PARAM_NAME", "user_id");
570  $template->setVariable("PARAM_VALUE", $userdata["user_id"]);
571  $template->parseCurrentBlock();
572  $template->setCurrentBlock("appletparam");
573  $template->setVariable("PARAM_NAME", "points_max");
574  $template->setVariable("PARAM_VALUE", $this->object->getPoints());
575  $template->parseCurrentBlock();
576  $template->setCurrentBlock("appletparam");
577  $template->setVariable("PARAM_NAME", "session_id");
578  $template->setVariable("PARAM_VALUE", $_COOKIE["PHPSESSID"]);
579  $template->parseCurrentBlock();
580  $template->setCurrentBlock("appletparam");
581  $template->setVariable("PARAM_NAME", "client");
582  $template->setVariable("PARAM_VALUE", CLIENT_ID);
583  $template->parseCurrentBlock();
584  $template->setCurrentBlock("appletparam");
585  $template->setVariable("PARAM_NAME", "pass");
586  $actualpass = ilObjTest::_getPass($active_id);
587  $template->setVariable("PARAM_VALUE", $actualpass);
588  $template->parseCurrentBlock();
589  $template->setCurrentBlock("appletparam");
590  $template->setVariable("PARAM_NAME", "post_url");
591  $template->setVariable("PARAM_VALUE", ilUtil::removeTrailingPathSeparators(ILIAS_HTTP_PATH) . "/Modules/TestQuestionPool/save_question_post_data.php");
592  $template->parseCurrentBlock();
593  // additional parameters
594  for ($i = 0; $i < $this->object->getParameterCount(); $i++)
595  {
596  $parameter = $this->object->getParameter($i);
597  $template->setCurrentBlock("appletparam");
598  $template->setVariable("PARAM_NAME", $parameter["name"]);
599  $template->setVariable("PARAM_VALUE", $parameter["value"]);
600  $template->parseCurrentBlock();
601  }
602 
603  if ($active_id)
604  {
605  // hey: prevPassSolutions - obsolete due to central check
606  #$solutions = NULL;
607  #include_once "./Modules/Test/classes/class.ilObjTest.php";
608  #if (!ilObjTest::_getUsePreviousAnswers($active_id, true))
609  #{
610  # if (is_null($pass)) $pass = ilObjTest::_getPass($active_id);
611  #}
612  $info = $this->getTestOutputSolutions($active_id, $pass);
613  // hey.
614  foreach ($info as $kk => $infodata)
615  {
616  $template->setCurrentBlock("appletparam");
617  $template->setVariable("PARAM_NAME", "value_" . $infodata["order"] . "_1");
618  $template->setVariable("PARAM_VALUE", $infodata["value1"]);
619  $template->parseCurrentBlock();
620  $template->setCurrentBlock("appletparam");
621  $template->setVariable("PARAM_NAME", "value_" . $infodata["order"] . "_2");
622  $template->setVariable("PARAM_VALUE", $infodata["value2"]);
623  $template->parseCurrentBlock();
624  }
625  include_once './Services/Administration/classes/class.ilSetting.php';
626  $soapSetting = new ilSetting();
627  if ($soapSetting->get("soap_user_administration") == 1)
628  {
629  $template->setCurrentBlock("appletparam");
630  $template->setVariable("PARAM_NAME", "server");
631  $template->setVariable("PARAM_VALUE", ilUtil::removeTrailingPathSeparators(ILIAS_HTTP_PATH) . "/webservice/soap/server.php");
632  }
633  }
634 
635  $questiontext = $this->object->getQuestion();
636  $template->setVariable("QUESTIONTEXT", $this->object->prepareTextareaOutput($questiontext, TRUE));
637  $template->setVariable("APPLET_WIDTH", $this->object->getJavaWidth());
638  $template->setVariable("APPLET_HEIGHT", $this->object->getJavaHeight());
639  $template->setVariable("APPLET_CODE", $this->object->getJavaCode());
640  if (strlen($this->object->getJavaArchive()) > 0)
641  {
642  $template->setVariable("APPLET_ARCHIVE", " archive=\"".$this->object->getJavaArchive()."\"");
643  }
644  else
645  {
646  if (strpos($this->object->getJavaAppletFilename(), ".jar") !== FALSE)
647  {
648  $template->setVariable("APPLET_ARCHIVE", " archive=\"".$this->object->getJavaPathWeb().$this->object->getJavaAppletFilename()."\"");
649  }
650  }
651  if (strlen($this->object->getJavaCodebase()) > 0)
652  {
653  $template->setVariable("APPLET_CODEBASE", " codebase=\"".$this->object->getJavaCodebase()."\"");
654  }
655  else
656  {
657  if (strpos($this->object->getJavaAppletFilename(), ".class") !== FALSE)
658  {
659  $template->setVariable("APPLET_CODEBASE", " codebase=\"".$this->object->getJavaPathWeb()."\"");
660  }
661  }
662  $questionoutput = $template->get();
663  $pageoutput = $this->outQuestionPage("", $is_postponed, $active_id, $questionoutput);
664  return $pageoutput;
665  }
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
getTestOutputSolutions($activeId, $pass)
$info
Definition: example_052.php:80
special template class to simplify handling of ITX/PEAR
static removeTrailingPathSeparators($path)
_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 $code, $filename, $header, 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 
167  $header->setTitle( $this->lng->txt( "applet_attributes" ) );
168  $form->addItem( $header );
169 
170  // java applet
171  $javaapplet = $this->object->getJavaAppletFilename();
172  $applet = new ilFileInputGUI($this->lng->txt( 'javaapplet' ), 'javaappletName');
173  $applet->setSuffixes( array( 'jar', 'class' ) );
174  $applet->setRequired( false );
175 
176  if (strlen( $javaapplet ))
177  {
178  $filename = new ilNonEditableValueGUI($this->lng->txt( 'filename' ), 'uploaded_javaapplet');
179  $filename->setValue( $javaapplet );
180  $applet->addSubItem( $filename );
181 
182  $delete = new ilCheckboxInputGUI('', 'delete_applet');
183  $delete->setOptionTitle( $this->lng->txt( 'delete' ) );
184  $delete->setValue( 1 );
185  $applet->addSubItem( $delete );
186  }
187  $form->addItem( $applet );
188 
189  // Code
190  $code = new ilTextInputGUI($this->lng->txt( "code" ), "java_code");
191  $code->setValue( $this->object->getJavaCode() );
192  $code->setRequired( TRUE );
193  $form->addItem( $code );
194 
195  if (!strlen( $javaapplet ))
196  {
197  // Archive
198  $archive = new ilTextInputGUI($this->lng->txt( "archive" ), "java_archive");
199  $archive->setValue( $this->object->getJavaArchive() );
200  $archive->setRequired( false );
201  $form->addItem( $archive );
202 
203  // Codebase
204  $codebase = new ilTextInputGUI($this->lng->txt( "codebase" ), "java_codebase");
205  $codebase->setValue( $this->object->getJavaCodebase() );
206  $codebase->setRequired( false );
207  $form->addItem( $codebase );
208  }
209 
210  // Width
211  $width = new ilNumberInputGUI($this->lng->txt( "width" ), "java_width");
212  $width->setDecimals( 0 );
213  $width->setSize( 6 );
214  $width->setMinValue( 50 );
215  $width->setMaxLength( 6 );
216  $width->setValue( $this->object->getJavaWidth() );
217  $width->setRequired( TRUE );
218  $form->addItem( $width );
219 
220  // Height
221  $height = new ilNumberInputGUI($this->lng->txt( "height" ), "java_height");
222  $height->setDecimals( 0 );
223  $height->setSize( 6 );
224  $height->setMinValue( 50 );
225  $height->setMaxLength( 6 );
226  $height->setValue( $this->object->getJavaHeight() );
227  $height->setRequired( TRUE );
228  $form->addItem( $height );
229 
231  $header->setTitle( $this->lng->txt( "applet_parameters" ) );
232  $form->addItem( $header );
233 
234  include_once "./Modules/TestQuestionPool/classes/class.ilKVPWizardInputGUI.php";
235  $kvp = new ilKVPWizardInputGUI($this->lng->txt( "applet_parameters" ), "kvp");
236  $values = array();
237  for ($i = 0; $i < $this->object->getParameterCount(); $i++)
238  {
239  $param = $this->object->getParameter( $i );
240  array_push( $values, array( $param['name'], $param['value'] ) );
241  }
242  if (count( $values ) == 0)
243  {
244  array_push( $values, array( "", "" ) );
245  }
246  $kvp->setKeyName( $this->lng->txt( 'name' ) );
247  $kvp->setValueName( $this->lng->txt( 'value' ) );
248  $kvp->setValues( $values );
249  $form->addItem( $kvp );
250  }
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.
$code
Definition: example_050.php:99
This class represents a checkbox property in a property form.
setDecimals($a_decimals)
Set Decimal Places.
$header
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 674 of file class.assJavaAppletGUI.php.

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

675  {
676  global $rbacsystem, $ilTabs;
677 
678  $ilTabs->clearTargets();
679 
680  $this->ctrl->setParameterByClass("ilAssQuestionPageGUI", "q_id", $_GET["q_id"]);
681  include_once "./Modules/TestQuestionPool/classes/class.assQuestion.php";
682  $q_type = $this->object->getQuestionType();
683 
684  if (strlen($q_type))
685  {
686  $classname = $q_type . "GUI";
687  $this->ctrl->setParameterByClass(strtolower($classname), "sel_question_types", $q_type);
688  $this->ctrl->setParameterByClass(strtolower($classname), "q_id", $_GET["q_id"]);
689  }
690 
691  if ($_GET["q_id"])
692  {
693  if ($rbacsystem->checkAccess('write', $_GET["ref_id"]))
694  {
695  // edit page
696  $ilTabs->addTarget("edit_page",
697  $this->ctrl->getLinkTargetByClass("ilAssQuestionPageGUI", "edit"),
698  array("edit", "insert", "exec_pg"),
699  "", "", $force_active);
700  }
701 
702  $this->addTab_QuestionPreview($ilTabs);
703  }
704 
705  $force_active = false;
706  if ($rbacsystem->checkAccess('write', $_GET["ref_id"]))
707  {
708  $url = "";
709  if ($classname) $url = $this->ctrl->getLinkTargetByClass($classname, "editQuestion");
710  $commands = $_POST["cmd"];
711  if (is_array($commands))
712  {
713  foreach ($commands as $key => $value)
714  {
715  if (preg_match("/^delete_.*/", $key, $matches))
716  {
717  $force_active = true;
718  }
719  }
720  }
721  // edit question properties
722  $ilTabs->addTarget("edit_question",
723  $url,
724  array("editQuestion", "save", "saveEdit", "addkvp", "removekvp", "originalSyncForm"),
725  $classname, "", $force_active);
726  }
727 
728  // add tab for question feedback within common class assQuestionGUI
729  $this->addTab_QuestionFeedback($ilTabs);
730 
731  // add tab for question hint within common class assQuestionGUI
732  $this->addTab_QuestionHints($ilTabs);
733 
734  // add tab for question's suggested solution within common class assQuestionGUI
735  $this->addTab_SuggestedSolution($ilTabs, $classname);
736 
737  // Assessment of questions sub menu entry
738  if ($_GET["q_id"])
739  {
740  $ilTabs->addTarget("statistics",
741  $this->ctrl->getLinkTargetByClass($classname, "assessment"),
742  array("assessment"),
743  $classname, "");
744  }
745 
746  $this->addBackTab($ilTabs);
747  }
addTab_QuestionPreview(ilTabsGUI $tabsGUI)
$_POST['username']
Definition: cron.php:12
addTab_QuestionHints(ilTabsGUI $tabs)
adds the hints tab to ilTabsGUI
$_GET["client_id"]
$url
Definition: shib_logout.php:72
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: