ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
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)
 
 setQuestionTabs ()
 Sets the ILIAS tabs for this question type. More...
 
 getSpecificFeedbackOutput ($active_id, $pass)
 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...
 
 executeCommand ()
 execute command More...
 
 getCommand ($cmd)
 
 getType ()
 needed for page editor compliance More...
 
 getPresentationContext ()
 
 setPresentationContext ($presentationContext)
 
 isTestPresentationContext ()
 
 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 (ilTemplate $tpl)
 
 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...
 
 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
 writePostData ($always=false)
 Evaluates a posted edit form and writes the form data in the question object. More...
 
 renderEditForm ($form)
 
 getPreviousSolutionProvidedMessage ()
 
 getPreviousSolutionConfirmationCheckboxHtml ()
 
 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)
 
 hasCorrectSolution ($activeId, $passIndex)
 
 writeQuestionGenericPostData ()
 
 completeTestOutputFormAction ($formAction, $active_id, $pass)
 
 addBackTab (ilTabsGUI $ilTabs)
 
 buildBasicEditFormObject ()
 
 buildEditForm ()
 

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
 
 $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
 $editForm
 

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 {
36 parent::__construct();
37 include_once './Modules/TestQuestionPool/classes/class.assJavaApplet.php';
38 $this->object = new assJavaApplet();
39 if ($id >= 0)
40 {
41 $this->object->loadFromDb($id);
42 }
43 }
Class for Java Applet Questions.

Member Function Documentation

◆ addkvp()

assJavaAppletGUI::addkvp ( )

Add a new answer.

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

254 {
255 $this->writePostData(true);
256 $position = key($_POST['cmd']['addkvp']);
257 $this->object->addParameterAtIndex($position+1, "", "");
258 $this->editQuestion();
259 }
$_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 118 of file class.assJavaAppletGUI.php.

119 {
120 $save = $this->isSaveCommand();
121 $this->getQuestionTemplate();
122
123 include_once("./Services/Form/classes/class.ilPropertyFormGUI.php");
124 $form = new ilPropertyFormGUI();
125 $this->editForm = $form;
126
127 $form->setFormAction($this->ctrl->getFormAction($this));
128 $form->setTitle($this->outQuestionType());
129 $form->setMultipart(true);
130 $form->setTableWidth("100%");
131 $form->setId("assjavaapplet");
132
133 $this->addBasicQuestionFormProperties($form);
134 $this->populateQuestionSpecificFormPart( $form );
135
136 $this->populateTaxonomyFormSection($form);
137
138 $this->addQuestionFormCommandButtons($form);
139
140 $errors = false;
141
142 if ($save)
143 {
144 $form->setValuesByPost();
145 $errors = !$form->checkInput();
146 $form->setValuesByPost(); // again, because checkInput now performs the whole stripSlashes handling and we need this if we don't want to have duplication of backslashes
147 if ($errors) $checkonly = false;
148 }
149
150 if (!$checkonly) $this->tpl->setVariable("QUESTION_DATA", $form->getHTML());
151 return $errors;
152 }
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

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

763 {
764 return array();
765 }

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

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

◆ getCommand()

assJavaAppletGUI::getCommand (   $cmd)

Reimplemented from assQuestionGUI.

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

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

References $cmd.

◆ getPreview()

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

Reimplemented from assQuestionGUI.

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

468 {
469 // generate the question output
470 include_once "./Services/UICore/classes/class.ilTemplate.php";
471 $template = new ilTemplate("tpl.il_as_qpl_javaapplet_question_output.html", TRUE, TRUE, "Modules/TestQuestionPool");
472 $template->setCurrentBlock("appletparam");
473 $template->setVariable("PARAM_NAME", "question_id");
474 $template->setVariable("PARAM_VALUE", $this->object->getId());
475 $template->parseCurrentBlock();
476 $template->setCurrentBlock("appletparam");
477 $template->setVariable("PARAM_NAME", "points_max");
478 $template->setVariable("PARAM_VALUE", $this->object->getPoints());
479 $template->parseCurrentBlock();
480 $template->setCurrentBlock("appletparam");
481 $template->setVariable("PARAM_NAME", "session_id");
482 $template->setVariable("PARAM_VALUE", $_COOKIE["PHPSESSID"]);
483 $template->parseCurrentBlock();
484 $template->setCurrentBlock("appletparam");
485 $template->setVariable("PARAM_NAME", "client");
486 $template->setVariable("PARAM_VALUE", CLIENT_ID);
487 $template->parseCurrentBlock();
488 // additional parameters
489 for ($i = 0; $i < $this->object->getParameterCount(); $i++)
490 {
491 $parameter = $this->object->getParameter($i);
492 $template->setCurrentBlock("appletparam");
493 $template->setVariable("PARAM_NAME", $parameter["name"]);
494 $template->setVariable("PARAM_VALUE", $parameter["value"]);
495 $template->parseCurrentBlock();
496 }
497
498 $questiontext = $this->object->getQuestion();
499 $template->setVariable("QUESTIONTEXT", $this->object->prepareTextareaOutput($questiontext, TRUE));
500 $template->setVariable("APPLET_WIDTH", $this->object->getJavaWidth());
501 $template->setVariable("APPLET_HEIGHT", $this->object->getJavaHeight());
502 $template->setVariable("APPLET_CODE", $this->object->getJavaCode());
503 if (strlen($this->object->getJavaArchive()) > 0)
504 {
505 $template->setVariable("APPLET_ARCHIVE", " archive=\"".$this->object->getJavaArchive()."\"");
506 }
507 else
508 {
509 if (strpos($this->object->getJavaAppletFilename(), ".jar") !== FALSE)
510 {
511 $template->setVariable("APPLET_ARCHIVE", " archive=\"".$this->object->getJavaPathWeb().$this->object->getJavaAppletFilename()."\"");
512 }
513 }
514 if (strlen($this->object->getJavaCodebase()) > 0)
515 {
516 $template->setVariable("APPLET_CODEBASE", " codebase=\"".$this->object->getJavaCodebase()."\"");
517 }
518 else
519 {
520 if (strpos($this->object->getJavaAppletFilename(), ".class") !== FALSE)
521 {
522 $template->setVariable("APPLET_CODEBASE", " codebase=\"".$this->object->getJavaPathWeb()."\"");
523 }
524 }
525 $questionoutput = $template->get();
526 if (!$show_question_only)
527 {
528 // get page object output
529 $questionoutput = $this->getILIASPage($questionoutput);
530 }
531 return $questionoutput;
532 }
$_COOKIE['ilClientId']
Definition: BPMN2Parser.php:15
getILIASPage($html="")
Returns the ILIAS Page around a question.
special template class to simplify handling of ITX/PEAR

References $_COOKIE, 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 285 of file class.assJavaAppletGUI.php.

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

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().

+ Here is the call graph for this function:

◆ getSpecificFeedbackOutput()

assJavaAppletGUI::getSpecificFeedbackOutput (   $active_id,
  $pass 
)

Returns the answer specific feedback for the question.

This method should be overwritten by the actual question.

Todo:
Mark this method abstract!
Parameters
integer$active_idActive ID of the user
integer$passActive pass
Returns
string HTML Code with the answer specific feedback @access public

Reimplemented from assQuestionGUI.

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

748 {
749 $output = "";
750 return $this->object->prepareTextareaOutput($output, TRUE);
751 }
if(!is_dir( $entity_dir)) exit("Fatal Error ([A-Za-z0-9]+)\s+" &#(? foreach( $entity_files as $file) $output

References $output.

◆ getTestOutput()

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

Reimplemented from assQuestionGUI.

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

537 {
538 $userdata = $this->object->getActiveUserData($active_id);
539 // generate the question output
540 include_once "./Services/UICore/classes/class.ilTemplate.php";
541 $template = new ilTemplate("tpl.il_as_qpl_javaapplet_question_output.html", TRUE, TRUE, "Modules/TestQuestionPool");
542 $template->setCurrentBlock("appletparam");
543 $template->setVariable("PARAM_NAME", "test_type");
544 include_once "./Modules/Test/classes/class.ilObjTest.php";
546 {
547 $template->setVariable("PARAM_VALUE", "0");
548 }
549 else
550 {
551 $template->setVariable("PARAM_VALUE", "1");
552 }
553 $template->parseCurrentBlock();
554 $template->setCurrentBlock("appletparam");
555 $template->setVariable("PARAM_NAME", "active_id");
556 $template->setVariable("PARAM_VALUE", $active_id);
557 $template->parseCurrentBlock();
558 $template->setCurrentBlock("appletparam");
559 $template->setVariable("PARAM_NAME", "test_id");
560 $template->setVariable("PARAM_VALUE", $userdata["test_id"]);
561 $template->parseCurrentBlock();
562 $template->setCurrentBlock("appletparam");
563 $template->setVariable("PARAM_NAME", "question_id");
564 $template->setVariable("PARAM_VALUE", $this->object->getId());
565 $template->parseCurrentBlock();
566 $template->setCurrentBlock("appletparam");
567 $template->setVariable("PARAM_NAME", "user_id");
568 $template->setVariable("PARAM_VALUE", $userdata["user_id"]);
569 $template->parseCurrentBlock();
570 $template->setCurrentBlock("appletparam");
571 $template->setVariable("PARAM_NAME", "points_max");
572 $template->setVariable("PARAM_VALUE", $this->object->getPoints());
573 $template->parseCurrentBlock();
574 $template->setCurrentBlock("appletparam");
575 $template->setVariable("PARAM_NAME", "session_id");
576 $template->setVariable("PARAM_VALUE", $_COOKIE["PHPSESSID"]);
577 $template->parseCurrentBlock();
578 $template->setCurrentBlock("appletparam");
579 $template->setVariable("PARAM_NAME", "client");
580 $template->setVariable("PARAM_VALUE", CLIENT_ID);
581 $template->parseCurrentBlock();
582 $template->setCurrentBlock("appletparam");
583 $template->setVariable("PARAM_NAME", "pass");
584 $actualpass = ilObjTest::_getPass($active_id);
585 $template->setVariable("PARAM_VALUE", $actualpass);
586 $template->parseCurrentBlock();
587 $template->setCurrentBlock("appletparam");
588 $template->setVariable("PARAM_NAME", "post_url");
589 $template->setVariable("PARAM_VALUE", ilUtil::removeTrailingPathSeparators(ILIAS_HTTP_PATH) . "/Modules/TestQuestionPool/save_question_post_data.php");
590 $template->parseCurrentBlock();
591 // additional parameters
592 for ($i = 0; $i < $this->object->getParameterCount(); $i++)
593 {
594 $parameter = $this->object->getParameter($i);
595 $template->setCurrentBlock("appletparam");
596 $template->setVariable("PARAM_NAME", $parameter["name"]);
597 $template->setVariable("PARAM_VALUE", $parameter["value"]);
598 $template->parseCurrentBlock();
599 }
600
601 if ($active_id)
602 {
603 // hey: prevPassSolutions - obsolete due to central check
604 #$solutions = NULL;
605 #include_once "./Modules/Test/classes/class.ilObjTest.php";
606 #if (!ilObjTest::_getUsePreviousAnswers($active_id, true))
607 #{
608 # if (is_null($pass)) $pass = ilObjTest::_getPass($active_id);
609 #}
610 $info = $this->object->getTestOutputSolutions($active_id, $pass);
611 // hey.
612 foreach ($info as $kk => $infodata)
613 {
614 $template->setCurrentBlock("appletparam");
615 $template->setVariable("PARAM_NAME", "value_" . $infodata["order"] . "_1");
616 $template->setVariable("PARAM_VALUE", $infodata["value1"]);
617 $template->parseCurrentBlock();
618 $template->setCurrentBlock("appletparam");
619 $template->setVariable("PARAM_NAME", "value_" . $infodata["order"] . "_2");
620 $template->setVariable("PARAM_VALUE", $infodata["value2"]);
621 $template->parseCurrentBlock();
622 }
623 include_once './Services/Administration/classes/class.ilSetting.php';
624 $soapSetting = new ilSetting();
625 if ($soapSetting->get("soap_user_administration") == 1)
626 {
627 $template->setCurrentBlock("appletparam");
628 $template->setVariable("PARAM_NAME", "server");
629 $template->setVariable("PARAM_VALUE", ilUtil::removeTrailingPathSeparators(ILIAS_HTTP_PATH) . "/webservice/soap/server.php");
630 }
631 }
632
633 $questiontext = $this->object->getQuestion();
634 $template->setVariable("QUESTIONTEXT", $this->object->prepareTextareaOutput($questiontext, TRUE));
635 $template->setVariable("APPLET_WIDTH", $this->object->getJavaWidth());
636 $template->setVariable("APPLET_HEIGHT", $this->object->getJavaHeight());
637 $template->setVariable("APPLET_CODE", $this->object->getJavaCode());
638 if (strlen($this->object->getJavaArchive()) > 0)
639 {
640 $template->setVariable("APPLET_ARCHIVE", " archive=\"".$this->object->getJavaArchive()."\"");
641 }
642 else
643 {
644 if (strpos($this->object->getJavaAppletFilename(), ".jar") !== FALSE)
645 {
646 $template->setVariable("APPLET_ARCHIVE", " archive=\"".$this->object->getJavaPathWeb().$this->object->getJavaAppletFilename()."\"");
647 }
648 }
649 if (strlen($this->object->getJavaCodebase()) > 0)
650 {
651 $template->setVariable("APPLET_CODEBASE", " codebase=\"".$this->object->getJavaCodebase()."\"");
652 }
653 else
654 {
655 if (strpos($this->object->getJavaAppletFilename(), ".class") !== FALSE)
656 {
657 $template->setVariable("APPLET_CODEBASE", " codebase=\"".$this->object->getJavaPathWeb()."\"");
658 }
659 }
660 $questionoutput = $template->get();
661 $pageoutput = $this->outQuestionPage("", $is_postponed, $active_id, $questionoutput);
662 return $pageoutput;
663 }
outQuestionPage($a_temp_var, $a_postponed=false, $active_id="", $html="")
output question page
ILIAS Setting Class.
static removeTrailingPathSeparators($path)

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

+ Here is the call graph for this function:

◆ populateQuestionSpecificFormPart()

assJavaAppletGUI::populateQuestionSpecificFormPart ( \ilPropertyFormGUI  $form)

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

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

References $code, $filename, $header, 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 264 of file class.assJavaAppletGUI.php.

265 {
266 $this->writePostData(true);
267 $position = key($_POST['cmd']['removekvp']);
268 $this->object->removeParameter($position);
269 $this->editQuestion();
270 }

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

+ Here is the call graph for this function:

◆ setQuestionTabs()

assJavaAppletGUI::setQuestionTabs ( )

Sets the ILIAS tabs for this question type.

@access public

Todo:
: MOVE THIS STEPS TO COMMON QUESTION CLASS assQuestionGUI

Reimplemented from assQuestionGUI.

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

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

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

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

58 {
59 $hasErrors = (!$always) ? $this->editQuestion(true) : false;
60 if (!$hasErrors)
61 {
62 require_once 'Services/Form/classes/class.ilPropertyFormGUI.php';
63
65
66 $this->object->setPoints($_POST["points"]);
68
70
71 return 0;
72 }
73 return 1;
74 }
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 76 of file class.assJavaAppletGUI.php.

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

References $_POST.

Referenced by writePostData().

+ Here is the caller graph for this function:

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