ILIAS  release_7 Revision v7.30-3-g800a261c036
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)
 
 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)
 
 getSpecificFeedbackOutput ($userSolution)
 Returns the answer specific feedback for the question. More...
 
 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...
 
 hasInlineFeedback ()
 this method can be overwritten per question type More...
 
 addHeaderAction ()
 
 redrawHeaderAction ()
 
 getHeaderAction ()
 
 getNotesHTML ()
 
 executeCommand ()
 execute command More...
 
 getType ()
 needed for page editor compliance More...
 
 getPresentationContext ()
 
 setPresentationContext ($presentationContext)
 
 isTestPresentationContext ()
 
 isPreviousSolutionPrefilled ()
 
 setPreviousSolutionPrefilled ($previousSolutionPrefilled)
 
 getRenderPurpose ()
 
 setRenderPurpose ($renderPurpose)
 
 isRenderPurposePrintPdf ()
 
 isRenderPurposePreview ()
 
 isRenderPurposeInputValue ()
 
 isRenderPurposePlayback ()
 
 isRenderPurposeDemoplay ()
 
 renderPurposeSupportsFormHtml ()
 
 getEditContext ()
 
 setEditContext ($editContext)
 
 isAuthoringEditContext ()
 
 isAdjustmentEditContext ()
 
 setAdjustmentEditContext ()
 
 getNavigationGUI ()
 
 setNavigationGUI ($navigationGUI)
 
 setTaxonomyIds ($taxonomyIds)
 
 getTaxonomyIds ()
 
 setTargetGui ($linkTargetGui)
 
 setTargetGuiClass ($targetGuiClass)
 
 getTargetGuiClass ()
 
 setQuestionHeaderBlockBuilder ($questionHeaderBlockBuilder)
 
 getQuestionHeaderBlockBuilder ()
 
 setQuestionActionCmd ($questionActionCmd)
 
 getQuestionActionCmd ()
 
createQuestionGUI ($question_type, $question_id=-1)
 Creates a question gui representation. More...
 
 populateJavascriptFilesRequiredForWorkForm (ilGlobalTemplateInterface $tpl)
 
 getPresentationJavascripts ()
 
 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="", $inlineFeedbackEnabled=false)
 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 ($userSolution)
 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)
 
 supportsIntermediateSolutionOutput ()
 Question type specific support of intermediate solution output The function getSolutionOutput respects getUseIntermediateSolution() More...
 
 hasIntermediateSolution ($activeId, $passIndex)
 Check if the question has an intermediate solution. More...
 
 setUseIntermediateSolution ($use)
 
 getUseIntermediateSolution ()
 Get if intermediate solution should be used for solution output. More...
 
 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 ()
 
 buildFocusAnchorHtml ()
 
 isAnswerFreuqencyStatisticSupported ()
 
 getSubQuestionsIndex ()
 
 getAnswersFrequency ($relevantAnswers, $questionIndex)
 
 getAnswerFrequencyTableGUI ($parentGui, $parentCmd, $relevantAnswers, $questionIndex)
 
 prepareReprintableCorrectionsForm (ilPropertyFormGUI $form)
 
 populateCorrectionsFormProperties (ilPropertyFormGUI $form)
 
 saveCorrectionsFormProperties (ilPropertyFormGUI $form)
 
- Public Member Functions inherited from ilGuiQuestionScoringAdjustable
 populateQuestionSpecificFormPart (ilPropertyFormGUI $form)
 Adds the question specific forms parts to a question property form gui. More...
 
 writeQuestionSpecificPostData (ilPropertyFormGUI $form)
 Extracts the question specific values from $_POST and applies them to the data object. More...
 
 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...
 

Protected Member Functions

 writePostData ($always=false)
 {Evaluates a posted edit form and writes the form data in the question object.
Returns
integer A positive value, if one of the required fields wasn't set, else 0
} More...
 
- Protected Member Functions inherited from assQuestionGUI
 hasSpecialQuestionCommands ()
 
 writePostData ($always=false)
 Evaluates a posted edit form and writes the form data in the question object. More...
 
 renderEditForm ($form)
 
 getUseUnchangedAnswerCheckboxHtml ()
 
 getPreviousSolutionProvidedMessage ()
 
 getPreviousSolutionConfirmationCheckboxHtml ()
 
 saveTaxonomyAssignments ()
 
 populateTaxonomyFormSection (ilPropertyFormGUI $form)
 
 setDefaultTabs (ilTabsGUI $ilTabs)
 
 setQuestionSpecificTabs (ilTabsGUI $ilTabs)
 
 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_Question (ilTabsGUI $tabsGUI)
 
 hasCorrectSolution ($activeId, $passIndex)
 
 writeQuestionGenericPostData ()
 
 completeTestOutputFormAction ($formAction, $active_id, $pass)
 
 addBackTab (ilTabsGUI $ilTabs)
 
 buildBasicEditFormObject ()
 
 escapeTemplatePlaceholders (string $text)
 
 buildEditForm ()
 
 addSaveOnEnterOnLoadCode ()
 

Additional Inherited Members

- Static Public Member Functions inherited from assQuestionGUI
static _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...
 
static _getGUIClassNameForId ($a_q_id)
 
static _getClassNameForQType ($q_type)
 
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
 
 $request
 
 $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 RENDER_PURPOSE_PLAYBACK = 'renderPurposePlayback'
 
const RENDER_PURPOSE_DEMOPLAY = 'renderPurposeDemoplay'
 
const RENDER_PURPOSE_PREVIEW = 'renderPurposePreview'
 
const RENDER_PURPOSE_PRINT_PDF = 'renderPurposePrintPdf'
 
const RENDER_PURPOSE_INPUT_VALUE = 'renderPurposeInputValue'
 
const EDIT_CONTEXT_AUTHORING = 'authoring'
 
const EDIT_CONTEXT_ADJUSTMENT = 'adjustment'
 
- Protected Attributes inherited from assQuestionGUI
const HAS_SPECIAL_QUESTION_COMMANDS = false
 
 $ctrl
 
 $editForm
 
 $use_intermediate_solution = false
 

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$

@ilCtrl_Calls assJavaAppletGUI: ilFormPropertyDispatchGUI

Definition at line 23 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
\assJavaAppletGUI

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

35 {
37 include_once './Modules/TestQuestionPool/classes/class.assJavaApplet.php';
38 $this->object = new assJavaApplet();
39 if ($id >= 0) {
40 $this->object->loadFromDb($id);
41 }
42 }
Class for Java Applet Questions.
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc

References ILIAS\GlobalScreen\Provider\__construct().

+ Here is the call graph for this function:

Member Function Documentation

◆ addkvp()

assJavaAppletGUI::addkvp ( )

Add a new answer.

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

244 {
245 $this->writePostData(true);
246 $position = key($_POST['cmd']['addkvp']);
247 $this->object->addParameterAtIndex($position + 1, "", "");
248 $this->editQuestion();
249 }
$_POST["username"]
editQuestion($checkonly=false)
Creates an output of the edit form for the question.
writePostData($always=false)
{Evaluates a posted edit form and writes the form data in the question object.integer A positive valu...

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

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

110 {
111 $save = $this->isSaveCommand();
112 $this->getQuestionTemplate();
113
114 include_once("./Services/Form/classes/class.ilPropertyFormGUI.php");
115 $form = new ilPropertyFormGUI();
116 $this->editForm = $form;
117
118 $form->setFormAction($this->ctrl->getFormAction($this));
119 $form->setTitle($this->outQuestionType());
120 $form->setMultipart(true);
121 $form->setTableWidth("100%");
122 $form->setId("assjavaapplet");
123
124 $this->addBasicQuestionFormProperties($form);
126
127 $this->populateTaxonomyFormSection($form);
128
129 $this->addQuestionFormCommandButtons($form);
130
131 $errors = false;
132
133 if ($save) {
134 $form->setValuesByPost();
135 $errors = !$form->checkInput();
136 $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
137 if ($errors) {
138 $checkonly = false;
139 }
140 }
141
142 if (!$checkonly) {
143 $this->tpl->setVariable("QUESTION_DATA", $form->getHTML());
144 }
145 return $errors;
146 }
populateQuestionSpecificFormPart(\ilPropertyFormGUI $form)
populateTaxonomyFormSection(ilPropertyFormGUI $form)
addQuestionFormCommandButtons($form)
Add the command buttons of a question properties form.
getQuestionTemplate()
get question template
addBasicQuestionFormProperties($form)
Add basic question form properties: assessment: title, author, description, question,...
This class represents a property form user interface.
$errors
Definition: imgupload.php:49

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

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

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

618 {
619 return array();
620 }

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

631 {
632 // Empty implementation here since a feasible way to aggregate answer is not known.
633 return ''; //print_r($relevant_answers,true);
634 }

◆ getCommand()

assJavaAppletGUI::getCommand (   $cmd)

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

45 {
46 if (substr($cmd, 0, 6) == "delete") {
47 $cmd = "delete";
48 }
49 return $cmd;
50 }

◆ getPreview()

assJavaAppletGUI::getPreview (   $show_question_only = false,
  $showInlineFeedback = false 
)

Reimplemented from assQuestionGUI.

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

430 {
431 // generate the question output
432 include_once "./Services/UICore/classes/class.ilTemplate.php";
433 $template = new ilTemplate("tpl.il_as_qpl_javaapplet_question_output.html", true, true, "Modules/TestQuestionPool");
434 $template->setCurrentBlock("appletparam");
435 $template->setVariable("PARAM_NAME", "question_id");
436 $template->setVariable("PARAM_VALUE", $this->object->getId());
437 $template->parseCurrentBlock();
438 $template->setCurrentBlock("appletparam");
439 $template->setVariable("PARAM_NAME", "points_max");
440 $template->setVariable("PARAM_VALUE", $this->object->getPoints());
441 $template->parseCurrentBlock();
442 $template->setCurrentBlock("appletparam");
443 $template->setVariable("PARAM_NAME", "session_id");
444 $template->setVariable("PARAM_VALUE", $_COOKIE[session_name()]);
445 $template->parseCurrentBlock();
446 $template->setCurrentBlock("appletparam");
447 $template->setVariable("PARAM_NAME", "client");
448 $template->setVariable("PARAM_VALUE", CLIENT_ID);
449 $template->parseCurrentBlock();
450 // additional parameters
451 for ($i = 0; $i < $this->object->getParameterCount(); $i++) {
452 $parameter = $this->object->getParameter($i);
453 $template->setCurrentBlock("appletparam");
454 $template->setVariable("PARAM_NAME", $parameter["name"]);
455 $template->setVariable("PARAM_VALUE", $parameter["value"]);
456 $template->parseCurrentBlock();
457 }
458
459 $questiontext = $this->object->getQuestion();
460 $template->setVariable("QUESTIONTEXT", $this->object->prepareTextareaOutput($questiontext, true));
461 $template->setVariable("APPLET_WIDTH", $this->object->getJavaWidth());
462 $template->setVariable("APPLET_HEIGHT", $this->object->getJavaHeight());
463 $template->setVariable("APPLET_CODE", $this->object->getJavaCode());
464 if (strlen($this->object->getJavaArchive()) > 0) {
465 $template->setVariable("APPLET_ARCHIVE", " archive=\"" . $this->object->getJavaArchive() . "\"");
466 } else {
467 if (strpos($this->object->getJavaAppletFilename(), ".jar") !== false) {
468 $template->setVariable("APPLET_ARCHIVE", " archive=\"" . $this->object->getJavaPathWeb() . $this->object->getJavaAppletFilename() . "\"");
469 }
470 }
471 if (strlen($this->object->getJavaCodebase()) > 0) {
472 $template->setVariable("APPLET_CODEBASE", " codebase=\"" . $this->object->getJavaCodebase() . "\"");
473 } else {
474 if (strpos($this->object->getJavaAppletFilename(), ".class") !== false) {
475 $template->setVariable("APPLET_CODEBASE", " codebase=\"" . $this->object->getJavaPathWeb() . "\"");
476 }
477 }
478 $questionoutput = $template->get();
479 if (!$show_question_only) {
480 // get page object output
481 $questionoutput = $this->getILIASPage($questionoutput);
482 }
483 return $questionoutput;
484 }
getILIASPage($html="")
Returns the ILIAS Page around a question.
special template class to simplify handling of ITX/PEAR
const CLIENT_ID
Definition: constants.php:39
$i
Definition: metadata.php:24
$_COOKIE[session_name()]
Definition: xapitoken.php:37

References $_COOKIE, $i, CLIENT_ID, and assQuestionGUI\getILIASPage().

+ 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

Reimplemented from assQuestionGUI.

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

285 {
286 $userdata = $this->object->getActiveUserData($active_id);
287
288 // generate the question output
289 include_once "./Services/UICore/classes/class.ilTemplate.php";
290 include_once "./Modules/Test/classes/class.ilObjTest.php";
291 $template = new ilTemplate("tpl.il_as_qpl_javaapplet_question_output_solution.html", true, true, "Modules/TestQuestionPool");
292 $solutiontemplate = new ilTemplate("tpl.il_as_tst_solution_output.html", true, true, "Modules/TestQuestionPool");
293 if (strlen($userdata["test_id"])) {
294 $template->setCurrentBlock("appletparam");
295 $template->setVariable("PARAM_NAME", "test_type");
297 $template->setVariable("PARAM_VALUE", "0");
298 } else {
299 $template->setVariable("PARAM_VALUE", "1");
300 }
301 $template->parseCurrentBlock();
302 }
303 if (strlen($userdata["test_id"])) {
304 $template->setCurrentBlock("appletparam");
305 $template->setVariable("PARAM_NAME", "test_id");
306 $template->setVariable("PARAM_VALUE", $userdata["test_id"]);
307 $template->parseCurrentBlock();
308 }
309 $template->setCurrentBlock("appletparam");
310 $template->setVariable("PARAM_NAME", "active_id");
311 $template->setVariable("PARAM_VALUE", $active_id);
312 $template->parseCurrentBlock();
313 $template->setCurrentBlock("appletparam");
314 $template->setVariable("PARAM_NAME", "question_id");
315 $template->setVariable("PARAM_VALUE", $this->object->getId());
316 $template->parseCurrentBlock();
317 if (strlen($userdata["user_id"])) {
318 $template->setCurrentBlock("appletparam");
319 $template->setVariable("PARAM_NAME", "user_id");
320 $template->setVariable("PARAM_VALUE", $userdata["user_id"]);
321 $template->parseCurrentBlock();
322 }
323 $template->setCurrentBlock("appletparam");
324 $template->setVariable("PARAM_NAME", "points_max");
325 $template->setVariable("PARAM_VALUE", $this->object->getPoints());
326 $template->parseCurrentBlock();
327 $template->setCurrentBlock("appletparam");
328 $template->setVariable("PARAM_NAME", "session_id");
329 $template->setVariable("PARAM_VALUE", $_COOKIE[session_name()]);
330 $template->parseCurrentBlock();
331 $template->setCurrentBlock("appletparam");
332 $template->setVariable("PARAM_NAME", "client");
333 $template->setVariable("PARAM_VALUE", CLIENT_ID);
334 $template->parseCurrentBlock();
335 $template->setCurrentBlock("appletparam");
336 $template->setVariable("PARAM_NAME", "pass");
337 $actualpass = ilObjTest::_getPass($active_id);
338 $template->setVariable("PARAM_VALUE", $actualpass);
339 $template->parseCurrentBlock();
340 // additional parameters
341 for ($i = 0; $i < $this->object->getParameterCount(); $i++) {
342 $parameter = $this->object->getParameter($i);
343 $template->setCurrentBlock("appletparam");
344 $template->setVariable("PARAM_NAME", $parameter["name"]);
345 $template->setVariable("PARAM_VALUE", $parameter["value"]);
346 $template->parseCurrentBlock();
347 }
348
349 if (($active_id > 0) && (!$show_correct_solution)) {
350 $solutions = null;
351 include_once "./Modules/Test/classes/class.ilObjTest.php";
352 $info = $this->object->getSolutionValues($active_id, $pass);
353 foreach ($info as $kk => $infodata) {
354 $template->setCurrentBlock("appletparam");
355 $template->setVariable("PARAM_NAME", "value_" . $infodata["order"] . "_1");
356 $template->setVariable("PARAM_VALUE", $infodata["value1"]);
357 $template->parseCurrentBlock();
358 $template->setCurrentBlock("appletparam");
359 $template->setVariable("PARAM_NAME", "value_" . $infodata["order"] . "_2");
360 $template->setVariable("PARAM_VALUE", $infodata["value2"]);
361 $template->parseCurrentBlock();
362 }
363 }
364
365 $questiontext = $this->object->getQuestion();
366 if ($show_question_text == true) {
367 $template->setVariable("QUESTIONTEXT", $this->object->prepareTextareaOutput($questiontext, true));
368 }
369 $template->setVariable("APPLET_WIDTH", $this->object->getJavaWidth());
370 $template->setVariable("APPLET_HEIGHT", $this->object->getJavaHeight());
371 $template->setVariable("APPLET_CODE", $this->object->getJavaCode());
372 if (strlen($this->object->getJavaArchive()) > 0) {
373 $template->setVariable("APPLET_ARCHIVE", " archive=\"" . $this->object->getJavaArchive() . "\"");
374 } else {
375 if (strpos($this->object->getJavaAppletFilename(), ".jar") !== false) {
376 $template->setVariable("APPLET_ARCHIVE", " archive=\"" . $this->object->getJavaPathWeb() . $this->object->getJavaAppletFilename() . "\"");
377 }
378 }
379 if (strlen($this->object->getJavaCodebase()) > 0) {
380 $template->setVariable("APPLET_CODEBASE", " codebase=\"" . $this->object->getJavaCodebase() . "\"");
381 } else {
382 if (strpos($this->object->getJavaAppletFilename(), ".class") !== false) {
383 $template->setVariable("APPLET_CODEBASE", " codebase=\"" . $this->object->getJavaPathWeb() . "\"");
384 }
385 }
386 if (($active_id > 0) && (!$show_correct_solution)) {
387 if ($graphicalOutput) {
388 // output of ok/not ok icons for user entered solutions
389 $reached_points = $this->object->getReachedPoints($active_id, $pass);
390 if ($reached_points == $this->object->getPoints()) {
391 $template->setCurrentBlock("icon_ok");
392 $template->setVariable("ICON_OK", ilUtil::getImagePath("icon_ok.svg"));
393 $template->setVariable("TEXT_OK", $this->lng->txt("answer_is_right"));
394 $template->parseCurrentBlock();
395 } else {
396 $template->setCurrentBlock("icon_ok");
397 if ($reached_points > 0) {
398 $template->setVariable("ICON_NOT_OK", ilUtil::getImagePath("icon_mostly_ok.svg"));
399 $template->setVariable("TEXT_NOT_OK", $this->lng->txt("answer_is_not_correct_but_positive"));
400 } else {
401 $template->setVariable("ICON_NOT_OK", ilUtil::getImagePath("icon_not_ok.svg"));
402 $template->setVariable("TEXT_NOT_OK", $this->lng->txt("answer_is_wrong"));
403 }
404 $template->parseCurrentBlock();
405 }
406 }
407 }
408 $questionoutput = $template->get();
409 $feedback = ($show_feedback && !$this->isTestPresentationContext()) ? $this->getAnswerFeedbackOutput($active_id, $pass) : "";
410 if (strlen($feedback)) {
411 $cssClass = (
412 $this->hasCorrectSolution($active_id, $pass) ?
414 );
415
416 $solutiontemplate->setVariable("ILC_FB_CSS_CLASS", $cssClass);
417 $solutiontemplate->setVariable("FEEDBACK", $this->object->prepareTextareaOutput($feedback, true));
418 }
419 $solutiontemplate->setVariable("SOLUTION_OUTPUT", $questionoutput);
420
421 $solutionoutput = $solutiontemplate->get();
422 if (!$show_question_only) {
423 // get page object output
424 $solutionoutput = $this->getILIASPage($solutionoutput);
425 }
426 return $solutionoutput;
427 }
hasCorrectSolution($activeId, $passIndex)
getAnswerFeedbackOutput($active_id, $pass)
Returns the answer generic feedback depending on the results of the question.
static _getPass($active_id)
Retrieves the actual pass of a given user for a given test.
static _getObjectIDFromTestID($test_id)
Returns the ILIAS test object id for a given test id.
static _lookupAnonymity($a_obj_id)
Returns the anonymity status of a test with a given object id.
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)

References $_COOKIE, $i, $pass, ilObjTest\_getObjectIDFromTestID(), ilObjTest\_getPass(), ilObjTest\_lookupAnonymity(), CLIENT_ID, ilAssQuestionFeedback\CSS_CLASS_FEEDBACK_CORRECT, ilAssQuestionFeedback\CSS_CLASS_FEEDBACK_WRONG, assQuestionGUI\getAnswerFeedbackOutput(), assQuestionGUI\getILIASPage(), ilUtil\getImagePath(), assQuestionGUI\hasCorrectSolution(), and assQuestionGUI\isTestPresentationContext().

+ Here is the call graph for this function:

◆ getSpecificFeedbackOutput()

assJavaAppletGUI::getSpecificFeedbackOutput (   $userSolution)

Returns the answer specific feedback for the question.

This method should be overwritten by the actual question.

Todo:
Mark this method abstract!
Parameters
array$userSolution($userSolution[<value1>] = <value2>)
Returns
string HTML Code with the answer specific feedback @access public

Reimplemented from assQuestionGUI.

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

603 {
604 $output = "";
605 return $this->object->prepareTextareaOutput($output, true);
606 }

◆ getTestOutput()

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

Reimplemented from assQuestionGUI.

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

489 {
490 $userdata = $this->object->getActiveUserData($active_id);
491 // generate the question output
492 include_once "./Services/UICore/classes/class.ilTemplate.php";
493 $template = new ilTemplate("tpl.il_as_qpl_javaapplet_question_output.html", true, true, "Modules/TestQuestionPool");
494 $template->setCurrentBlock("appletparam");
495 $template->setVariable("PARAM_NAME", "test_type");
496 include_once "./Modules/Test/classes/class.ilObjTest.php";
498 $template->setVariable("PARAM_VALUE", "0");
499 } else {
500 $template->setVariable("PARAM_VALUE", "1");
501 }
502 $template->parseCurrentBlock();
503 $template->setCurrentBlock("appletparam");
504 $template->setVariable("PARAM_NAME", "active_id");
505 $template->setVariable("PARAM_VALUE", $active_id);
506 $template->parseCurrentBlock();
507 $template->setCurrentBlock("appletparam");
508 $template->setVariable("PARAM_NAME", "test_id");
509 $template->setVariable("PARAM_VALUE", $userdata["test_id"]);
510 $template->parseCurrentBlock();
511 $template->setCurrentBlock("appletparam");
512 $template->setVariable("PARAM_NAME", "question_id");
513 $template->setVariable("PARAM_VALUE", $this->object->getId());
514 $template->parseCurrentBlock();
515 $template->setCurrentBlock("appletparam");
516 $template->setVariable("PARAM_NAME", "user_id");
517 $template->setVariable("PARAM_VALUE", $userdata["user_id"]);
518 $template->parseCurrentBlock();
519 $template->setCurrentBlock("appletparam");
520 $template->setVariable("PARAM_NAME", "points_max");
521 $template->setVariable("PARAM_VALUE", $this->object->getPoints());
522 $template->parseCurrentBlock();
523 $template->setCurrentBlock("appletparam");
524 $template->setVariable("PARAM_NAME", "session_id");
525 $template->setVariable("PARAM_VALUE", $_COOKIE[session_name()]);
526 $template->parseCurrentBlock();
527 $template->setCurrentBlock("appletparam");
528 $template->setVariable("PARAM_NAME", "client");
529 $template->setVariable("PARAM_VALUE", CLIENT_ID);
530 $template->parseCurrentBlock();
531 $template->setCurrentBlock("appletparam");
532 $template->setVariable("PARAM_NAME", "pass");
533 $actualpass = ilObjTest::_getPass($active_id);
534 $template->setVariable("PARAM_VALUE", $actualpass);
535 $template->parseCurrentBlock();
536 $template->setCurrentBlock("appletparam");
537 $template->setVariable("PARAM_NAME", "post_url");
538 $template->setVariable("PARAM_VALUE", ilUtil::removeTrailingPathSeparators(ILIAS_HTTP_PATH) . "/Modules/TestQuestionPool/save_question_post_data.php");
539 $template->parseCurrentBlock();
540 // additional parameters
541 for ($i = 0; $i < $this->object->getParameterCount(); $i++) {
542 $parameter = $this->object->getParameter($i);
543 $template->setCurrentBlock("appletparam");
544 $template->setVariable("PARAM_NAME", $parameter["name"]);
545 $template->setVariable("PARAM_VALUE", $parameter["value"]);
546 $template->parseCurrentBlock();
547 }
548
549 if ($active_id) {
550 // hey: prevPassSolutions - obsolete due to central check
551 #$solutions = NULL;
552 #include_once "./Modules/Test/classes/class.ilObjTest.php";
553 #if (!ilObjTest::_getUsePreviousAnswers($active_id, true))
554 #{
555 # if (is_null($pass)) $pass = ilObjTest::_getPass($active_id);
556 #}
557 $info = $this->object->getTestOutputSolutions($active_id, $pass);
558 // hey.
559 foreach ($info as $kk => $infodata) {
560 $template->setCurrentBlock("appletparam");
561 $template->setVariable("PARAM_NAME", "value_" . $infodata["order"] . "_1");
562 $template->setVariable("PARAM_VALUE", $infodata["value1"]);
563 $template->parseCurrentBlock();
564 $template->setCurrentBlock("appletparam");
565 $template->setVariable("PARAM_NAME", "value_" . $infodata["order"] . "_2");
566 $template->setVariable("PARAM_VALUE", $infodata["value2"]);
567 $template->parseCurrentBlock();
568 }
569 include_once './Services/Administration/classes/class.ilSetting.php';
570 $soapSetting = new ilSetting();
571 if ($soapSetting->get("soap_user_administration") == 1) {
572 $template->setCurrentBlock("appletparam");
573 $template->setVariable("PARAM_NAME", "server");
574 $template->setVariable("PARAM_VALUE", ilUtil::removeTrailingPathSeparators(ILIAS_HTTP_PATH) . "/webservice/soap/server.php");
575 }
576 }
577
578 $questiontext = $this->object->getQuestion();
579 $template->setVariable("QUESTIONTEXT", $this->object->prepareTextareaOutput($questiontext, true));
580 $template->setVariable("APPLET_WIDTH", $this->object->getJavaWidth());
581 $template->setVariable("APPLET_HEIGHT", $this->object->getJavaHeight());
582 $template->setVariable("APPLET_CODE", $this->object->getJavaCode());
583 if (strlen($this->object->getJavaArchive()) > 0) {
584 $template->setVariable("APPLET_ARCHIVE", " archive=\"" . $this->object->getJavaArchive() . "\"");
585 } else {
586 if (strpos($this->object->getJavaAppletFilename(), ".jar") !== false) {
587 $template->setVariable("APPLET_ARCHIVE", " archive=\"" . $this->object->getJavaPathWeb() . $this->object->getJavaAppletFilename() . "\"");
588 }
589 }
590 if (strlen($this->object->getJavaCodebase()) > 0) {
591 $template->setVariable("APPLET_CODEBASE", " codebase=\"" . $this->object->getJavaCodebase() . "\"");
592 } else {
593 if (strpos($this->object->getJavaAppletFilename(), ".class") !== false) {
594 $template->setVariable("APPLET_CODEBASE", " codebase=\"" . $this->object->getJavaPathWeb() . "\"");
595 }
596 }
597 $questionoutput = $template->get();
598 $pageoutput = $this->outQuestionPage("", $is_postponed, $active_id, $questionoutput);
599 return $pageoutput;
600 }
outQuestionPage($a_temp_var, $a_postponed=false, $active_id="", $html="", $inlineFeedbackEnabled=false)
output question page
ILIAS Setting Class.
static removeTrailingPathSeparators($path)

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

+ Here is the call graph for this function:

◆ populateQuestionSpecificFormPart()

assJavaAppletGUI::populateQuestionSpecificFormPart ( \ilPropertyFormGUI  $form)

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

149 {
150 // points
151 $points = new ilNumberInputGUI($this->lng->txt("points"), "points");
152 $points->setValue($this->object->getPoints());
153 $points->setRequired(true);
154 $points->setSize(3);
155 $points->setMinValue(0.0);
156 $form->addItem($points);
157
158 $header = new ilFormSectionHeaderGUI();
159 $header->setTitle($this->lng->txt("applet_attributes"));
160 $form->addItem($header);
161
162 // java applet
163 $javaapplet = $this->object->getJavaAppletFilename();
164 $applet = new ilFileInputGUI($this->lng->txt('javaapplet'), 'javaappletName');
165 $applet->setSuffixes(array( 'jar', 'class' ));
166 $applet->setRequired(false);
167
168 if (strlen($javaapplet)) {
169 $filename = new ilNonEditableValueGUI($this->lng->txt('filename'), 'uploaded_javaapplet');
170 $filename->setValue($javaapplet);
171 $applet->addSubItem($filename);
172
173 $delete = new ilCheckboxInputGUI('', 'delete_applet');
174 $delete->setOptionTitle($this->lng->txt('delete'));
175 $delete->setValue(1);
176 $applet->addSubItem($delete);
177 }
178 $form->addItem($applet);
179
180 // Code
181 $code = new ilTextInputGUI($this->lng->txt("code"), "java_code");
182 $code->setValue($this->object->getJavaCode());
183 $code->setRequired(true);
184 $form->addItem($code);
185
186 if (!strlen($javaapplet)) {
187 // Archive
188 $archive = new ilTextInputGUI($this->lng->txt("archive"), "java_archive");
189 $archive->setValue($this->object->getJavaArchive());
190 $archive->setRequired(false);
191 $form->addItem($archive);
192
193 // Codebase
194 $codebase = new ilTextInputGUI($this->lng->txt("codebase"), "java_codebase");
195 $codebase->setValue($this->object->getJavaCodebase());
196 $codebase->setRequired(false);
197 $form->addItem($codebase);
198 }
199
200 // Width
201 $width = new ilNumberInputGUI($this->lng->txt("width"), "java_width");
202 $width->setDecimals(0);
203 $width->setSize(6);
204 $width->setMinValue(50);
205 $width->setMaxLength(6);
206 $width->setValue($this->object->getJavaWidth());
207 $width->setRequired(true);
208 $form->addItem($width);
209
210 // Height
211 $height = new ilNumberInputGUI($this->lng->txt("height"), "java_height");
212 $height->setDecimals(0);
213 $height->setSize(6);
214 $height->setMinValue(50);
215 $height->setMaxLength(6);
216 $height->setValue($this->object->getJavaHeight());
217 $height->setRequired(true);
218 $form->addItem($height);
219
220 $header = new ilFormSectionHeaderGUI();
221 $header->setTitle($this->lng->txt("applet_parameters"));
222 $form->addItem($header);
223
224 include_once "./Modules/TestQuestionPool/classes/class.ilKVPWizardInputGUI.php";
225 $kvp = new ilKVPWizardInputGUI($this->lng->txt("applet_parameters"), "kvp");
226 $values = array();
227 for ($i = 0; $i < $this->object->getParameterCount(); $i++) {
228 $param = $this->object->getParameter($i);
229 array_push($values, array( $param['name'], $param['value'] ));
230 }
231 if (count($values) == 0) {
232 array_push($values, array( "", "" ));
233 }
234 $kvp->setKeyName($this->lng->txt('name'));
235 $kvp->setValueName($this->lng->txt('value'));
236 $kvp->setValues($values);
237 $form->addItem($kvp);
238 }
$filename
Definition: buildRTE.php:89
This class represents a checkbox property in a property form.
This class represents a file property in a property form.
This class represents a section header in a property form.
This class represents a key value pair wizard property in a property form.
This class represents a non editable value in a property form.
This class represents a number property in a property form.
This class represents a text property in a property form.
$param
Definition: xapitoken.php:29

References $filename, $i, $param, and ilPropertyFormGUI\addItem().

Referenced by editQuestion().

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

255 {
256 $this->writePostData(true);
257 $position = key($_POST['cmd']['removekvp']);
258 $this->object->removeParameter($position);
259 $this->editQuestion();
260 }

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

+ Here is the call graph for this function:

◆ writePostData()

assJavaAppletGUI::writePostData (   $always = false)
protected

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

Returns
integer A positive value, if one of the required fields wasn't set, else 0
}

Reimplemented from assQuestionGUI.

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

56 {
57 $hasErrors = (!$always) ? $this->editQuestion(true) : false;
58 if (!$hasErrors) {
59 require_once 'Services/Form/classes/class.ilPropertyFormGUI.php';
60
62
63 $this->object->setPoints($_POST["points"]);
65
67
68 return 0;
69 }
70 return 1;
71 }
writeQuestionSpecificPostData(ilPropertyFormGUI $form)
Extracts the question specific values from $_POST and applies them to the data object.

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

Referenced by addkvp(), and removekvp().

+ Here is the call graph for this function:
+ Here is the caller 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 73 of file class.assJavaAppletGUI.php.

74 {
75 if ($_POST['delete_applet']) {
76 // delete the applet file
77 $this->object->deleteJavaAppletFilename();
78 } else {
79 $this->object->setJavaAppletFilename($_POST['uploaded_javaapplet']);
80 }
81
82 //setting java applet
83 if (!empty($_FILES['javaappletName']['tmp_name'])) {
84 $this->object->setJavaAppletFilename(
85 $_FILES['javaappletName']['name'],
86 $_FILES['javaappletName']['tmp_name']
87 );
88 }
89 $this->object->setJavaCode($_POST["java_code"]);
90 $this->object->setJavaCodebase($_POST["java_codebase"]);
91 $this->object->setJavaArchive($_POST["java_archive"]);
92 $this->object->setJavaWidth($_POST["java_width"]);
93 $this->object->setJavaHeight($_POST["java_height"]);
94
95 $this->object->flushParams();
96 if (is_array($_POST['kvp']['key'])) {
97 foreach ($_POST['kvp']['key'] as $idx => $val) {
98 if (strlen($val) && strlen($_POST['kvp']['value'][$idx])) {
99 $this->object->addParameter($val, $_POST['kvp']['value'][$idx]);
100 }
101 }
102 }
103 }

References $_POST.

Referenced by writePostData().

+ Here is the caller graph for this function:

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