ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
All Data Structures Namespaces Files Functions Variables Modules Pages
assTextQuestionGUI Class Reference

Text question GUI representation. More...

+ Inheritance diagram for assTextQuestionGUI:
+ Collaboration diagram for assTextQuestionGUI:

Public Member Functions

 __construct ($id=-1)
 assTextQuestionGUI constructor More...
 
 editQuestion ($checkonly=false)
 Creates an output of the edit form for the question. More...
 
 outAdditionalOutput ()
 
 magicAfterTestOutput ()
 
 supportsIntermediateSolutionOutput ()
 Question type specific support of intermediate solution output The function getSolutionOutput respects getUseIntermediateSolution() More...
 
 getSolutionOutput ( $active_id, $pass=null, $graphicalOutput=false, $result_output=false, $show_question_only=true, $show_feedback=false, $show_correct_solution=false, $show_manual_scoring=false, $show_question_text=true)
 Get the question solution output. More...
 
 getPreview ($show_question_only=false, $showInlineFeedback=false)
 
 getTestOutput ($active_id, $pass=null, $is_postponed=false, $use_post_solutions=false, $inlineFeedback=false)
 
 addSuggestedSolution ()
 
 setQuestionTabs ()
 Sets the ILIAS tabs for this question type. More...
 
 getSpecificFeedbackOutput ($userSolution)
 
 writeQuestionSpecificPostData (ilPropertyFormGUI $form)
 Extracts the question specific values from $_POST and applies them to the data object. More...
 
 writeAnswerSpecificPostData (ilPropertyFormGUI $form)
 Extracts the answer specific values from $_POST and applies them to the data object. More...
 
 populateQuestionSpecificFormPart (\ilPropertyFormGUI $form)
 
 populateAnswerSpecificFormPart (\ilPropertyFormGUI $form)
 
 getAfterParticipationSuppressionAnswerPostVars ()
 Returns a list of postvars which will be suppressed in the form output when used in scoring adjustment. 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...
 
 isAnswerFreuqencyStatisticSupported ()
 
 getAnswersFrequency ($relevantAnswers, $questionIndex)
 
 populateCorrectionsFormProperties (ilPropertyFormGUI $form)
 
 saveCorrectionsFormProperties (ilPropertyFormGUI $form)
 
- 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...
 
 getCommand ($cmd)
 
 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...
 
- Public Member Functions inherited from ilGuiAnswerScoringAdjustable
 populateAnswerSpecificFormPart (ilPropertyFormGUI $form)
 Adds the answer specific form parts to a question property form gui. More...
 

Protected Member Functions

 writePostData ($always=false)
 {} More...
 
 getJsCode ()
 
- 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)
 
 getUseUnchangedAnswerCheckboxHtml ()
 
 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 ()
 

Private Member Functions

 getBestAnswer ($asHtml)
 
 getUserAnswer ($active_id, $pass)
 

Static Private Member Functions

static buildAnswerTextOnlyArray ($answers)
 

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
 
 $use_intermediate_solution = false
 

Detailed Description

Text question GUI representation.

The assTextQuestionGUI class encapsulates the GUI representation for text 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$

assTextQuestionGUI: ilFormPropertyDispatchGUI

Definition at line 23 of file class.assTextQuestionGUI.php.

Constructor & Destructor Documentation

◆ __construct()

assTextQuestionGUI::__construct (   $id = -1)

assTextQuestionGUI constructor

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

Parameters
integer$idThe database id of a text question object

Definition at line 32 of file class.assTextQuestionGUI.php.

References ILIAS\GlobalScreen\Provider\__construct().

33  {
35  include_once "./Modules/TestQuestionPool/classes/class.assTextQuestion.php";
36  $this->object = new assTextQuestion();
37  if ($id >= 0) {
38  $this->object->loadFromDb($id);
39  }
40  }
Class for text questions.
__construct(Container $dic, ilPlugin $plugin)
+ Here is the call graph for this function:

Member Function Documentation

◆ addSuggestedSolution()

assTextQuestionGUI::addSuggestedSolution ( )

Definition at line 470 of file class.assTextQuestionGUI.php.

References $_POST, $_SESSION, editQuestion(), assQuestionGUI\getErrorMessage(), assQuestionGUI\getQuestionTemplate(), ilUtil\sendInfo(), and writePostData().

471  {
472  $_SESSION["subquestion_index"] = 0;
473  if ($_POST["cmd"]["addSuggestedSolution"]) {
474  if ($this->writePostData()) {
476  $this->editQuestion();
477  return;
478  }
479  if (!$this->checkInput()) {
480  ilUtil::sendInfo($this->lng->txt("fill_out_all_required_fields_add_answer"));
481  $this->editQuestion();
482  return;
483  }
484  }
485  $this->object->saveToDb();
486  $this->ctrl->setParameter($this, "q_id", $this->object->getId());
487  $this->tpl->setVariable("HEADER", $this->object->getTitle());
488  $this->getQuestionTemplate();
489  parent::addSuggestedSolution();
490  }
$_SESSION["AccountId"]
getQuestionTemplate()
get question template
editQuestion($checkonly=false)
Creates an output of the edit form for the question.
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
writePostData($always=false)
{}
$_POST["username"]
+ Here is the call graph for this function:

◆ buildAnswerTextOnlyArray()

static assTextQuestionGUI::buildAnswerTextOnlyArray (   $answers)
staticprivate

Definition at line 105 of file class.assTextQuestionGUI.php.

106  {
107  $answerTexts = array();
108 
109  foreach ($answers as $answer) {
110  $answerTexts[] = $answer->getAnswertext();
111  }
112 
113  return $answerTexts;
114  }

◆ editQuestion()

assTextQuestionGUI::editQuestion (   $checkonly = false)

Creates an output of the edit form for the question.

public

Definition at line 64 of file class.assTextQuestionGUI.php.

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

Referenced by addSuggestedSolution(), and writePostData().

65  {
66  $save = $this->isSaveCommand();
67  $this->getQuestionTemplate();
68 
69  include_once("./Services/Form/classes/class.ilPropertyFormGUI.php");
70  $form = new ilPropertyFormGUI();
71  $this->editForm = $form;
72 
73  $form->setFormAction($this->ctrl->getFormAction($this));
74  $form->setTitle($this->outQuestionType());
75  $form->setMultipart(true);
76  $form->setTableWidth("100%");
77  $form->setId("asstextquestion");
78 
79  $this->addBasicQuestionFormProperties($form);
81  $this->populateAnswerSpecificFormPart($form);
82 
83 
84  $this->populateTaxonomyFormSection($form);
85 
86  $this->addQuestionFormCommandButtons($form);
87 
88  $errors = false;
89 
90  if ($save) {
91  $form->setValuesByPost();
92  $errors = !$form->checkInput();
93  $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
94  if ($errors) {
95  $checkonly = false;
96  }
97  }
98 
99  if (!$checkonly) {
100  $this->tpl->setVariable("QUESTION_DATA", $form->getHTML());
101  }
102  return $errors;
103  }
$errors
addBasicQuestionFormProperties($form)
Add basic question form properties: assessment: title, author, description, question, working time.
This class represents a property form user interface.
getQuestionTemplate()
get question template
populateTaxonomyFormSection(ilPropertyFormGUI $form)
populateQuestionSpecificFormPart(\ilPropertyFormGUI $form)
populateAnswerSpecificFormPart(\ilPropertyFormGUI $form)
addQuestionFormCommandButtons($form)
Add the command buttons of a question properties form.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getAfterParticipationSuppressionAnswerPostVars()

assTextQuestionGUI::getAfterParticipationSuppressionAnswerPostVars ( )

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 ilGuiAnswerScoringAdjustable.

Definition at line 774 of file class.assTextQuestionGUI.php.

775  {
776  return array();
777  }

◆ getAfterParticipationSuppressionQuestionPostVars()

assTextQuestionGUI::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 788 of file class.assTextQuestionGUI.php.

789  {
790  return array();
791  }

◆ getAggregatedAnswersView()

assTextQuestionGUI::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 801 of file class.assTextQuestionGUI.php.

802  {
803  return ''; //print_r($relevant_answers,true);
804  }

◆ getAnswersFrequency()

assTextQuestionGUI::getAnswersFrequency (   $relevantAnswers,
  $questionIndex 
)

Definition at line 811 of file class.assTextQuestionGUI.php.

812  {
813  }

◆ getBestAnswer()

assTextQuestionGUI::getBestAnswer (   $asHtml)
private

Definition at line 281 of file class.assTextQuestionGUI.php.

References assQuestionGUI\$tpl, and assTextQuestion\getScoringModesWithPointsByKeyword().

Referenced by getSolutionOutput().

282  {
283  $answers = $this->object->getAnswers();
284  if (!count($answers)) {
285  return '';
286  }
287 
288  if ($asHtml) {
289  $tplFile = 'tpl.il_as_qpl_text_question_best_solution_html.html';
290  } else {
291  $tplFile = 'tpl.il_as_qpl_text_question_best_solution_ta.html';
292  }
293 
294  $tpl = new ilTemplate($tplFile, true, true, 'Modules/TestQuestionPool');
295 
296  foreach ($answers as $answer) {
297  $keywordString = $answer->getAnswertext();
298 
299  if (in_array($this->object->getKeywordRelation(), assTextQuestion::getScoringModesWithPointsByKeyword())) {
300  $keywordString .= ' ' . $this->lng->txt('for') . ' ';
301  $keywordString .= $answer->getPoints() . ' ' . $this->lng->txt('points');
302  }
303 
304  $tpl->setCurrentBlock('keyword');
305  $tpl->setVariable('KEYWORD', $keywordString);
306  $tpl->parseCurrentBlock();
307  }
308 
309  $tpl->setVariable('KEYWORD_HEADER', $this->lng->txt('solution_contain_keywords'));
310  $tpl->setVariable('SCORING_LABEL', $this->lng->txt('essay_scoring_mode') . ': ');
311 
312  switch ($this->object->getKeywordRelation()) {
313  case 'any':
314  $tpl->setVariable('SCORING_MODE', $this->lng->txt('essay_scoring_mode_keyword_relation_any'));
315  break;
316  case 'all':
317  $tpl->setVariable('SCORING_MODE', $this->lng->txt('essay_scoring_mode_keyword_relation_all'));
318  break;
319  case 'one':
320  $tpl->setVariable('SCORING_MODE', $this->lng->txt('essay_scoring_mode_keyword_relation_one'));
321  break;
322  }
323 
324  return $tpl->get();
325  }
static getScoringModesWithPointsByKeyword()
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getJsCode()

assTextQuestionGUI::getJsCode ( )
protected

Definition at line 443 of file class.assTextQuestionGUI.php.

References assQuestionGUI\$tpl.

Referenced by getPreview(), and getTestOutput().

444  {
445  $tpl = new ilTemplate('tpl.charcounter.html', true, true, 'Modules/TestQuestionPool');
446 
447  $tpl->setCurrentBlock('tinymce_handler');
448  $tpl->touchBlock('tinymce_handler');
449  $tpl->parseCurrentBlock();
450 
451  if ($this->object->getMaxNumOfChars() > 0) {
452  $tpl->setCurrentBlock('letter_counter_js');
453  $tpl->setVariable("MAXCHARS", $this->object->getMaxNumOfChars());
454  $tpl->parseCurrentBlock();
455  }
456 
457  if ($this->object->isWordCounterEnabled()) {
458  $tpl->setCurrentBlock('word_counter_js');
459  $tpl->touchBlock('word_counter_js');
460  $tpl->parseCurrentBlock();
461  }
462 
463  $tpl->setCurrentBlock('counter_js');
464  $tpl->setVariable("QID", $this->object->getId());
465  $tpl->parseCurrentBlock();
466 
467  return $tpl->get();
468  }
+ Here is the caller graph for this function:

◆ getPreview()

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

Definition at line 337 of file class.assTextQuestionGUI.php.

References assQuestionGUI\getILIASPage(), getJsCode(), assQuestionGUI\getPreviewSession(), and ilUtil\prepareFormOutput().

338  {
339  // generate the question output
340  include_once "./Services/UICore/classes/class.ilTemplate.php";
341  $template = new ilTemplate("tpl.il_as_qpl_text_question_output.html", true, true, "Modules/TestQuestionPool");
342  if ($this->object->getMaxNumOfChars()) {
343  $template->setCurrentBlock("maximum_char_hint");
344  $template->setVariable("MAXIMUM_CHAR_HINT", sprintf($this->lng->txt("text_maximum_chars_allowed"), $this->object->getMaxNumOfChars()));
345  $template->parseCurrentBlock();
346  #mbecker: No such block. $template->setCurrentBlock("has_maxchars");
347  $template->setVariable("MAXCHARS", $this->object->getMaxNumOfChars());
348  $template->parseCurrentBlock();
349  $template->setCurrentBlock("maxchars_counter");
350  $template->setVariable("QID", $this->object->getId());
351  $template->setVariable("MAXCHARS", $this->object->getMaxNumOfChars());
352  $template->setVariable("TEXTBOXSIZE", strlen($this->object->getMaxNumOfChars()));
353  $template->setVariable("CHARACTERS", $this->lng->txt("qst_essay_chars_remaining"));
354  $template->parseCurrentBlock();
355  }
356 
357  if ($this->object->isWordCounterEnabled()) {
358  $template->setCurrentBlock("word_counter");
359  $template->setVariable("QID", $this->object->getId());
360  $template->setVariable("WORDCOUNTER", $this->lng->txt("qst_essay_allready_written_words"));
361  $template->parseCurrentBlock();
362  }
363 
364  if (is_object($this->getPreviewSession())) {
365  $template->setVariable("ESSAY", ilUtil::prepareFormOutput(
366  $this->getPreviewSession()->getParticipantsSolution()
367  ));
368  }
369 
370  $questiontext = $this->object->getQuestion();
371  $template->setVariable("QUESTIONTEXT", $this->object->prepareTextareaOutput($questiontext, true));
372  $template->setVariable("QID", $this->object->getId());
373 
374  $questionoutput = $template->get();
375 
376  $questionoutput .= $this->getJsCode();
377 
378  if (!$show_question_only) {
379  // get page object output
380  $questionoutput = $this->getILIASPage($questionoutput);
381  }
382  return $questionoutput;
383  }
static prepareFormOutput($a_str, $a_strip=false)
prepares string output for html forms public
getILIASPage($html="")
Returns the ILIAS Page around a question.
+ Here is the call graph for this function:

◆ getSolutionOutput()

assTextQuestionGUI::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 160 of file class.assTextQuestionGUI.php.

References $pass, ilAssQuestionFeedback\CSS_CLASS_FEEDBACK_CORRECT, ilAssQuestionFeedback\CSS_CLASS_FEEDBACK_WRONG, getBestAnswer(), assQuestionGUI\getGenericFeedbackOutput(), assQuestionGUI\getILIASPage(), ilUtil\getImagePath(), getSpecificFeedbackOutput(), getUserAnswer(), assQuestionGUI\hasCorrectSolution(), assQuestionGUI\isTestPresentationContext(), and assQuestionGUI\renderPurposeSupportsFormHtml().

170  {
171  // get the solution of the user for the active pass or from the last pass if allowed
172 
173  $user_solution = $this->getUserAnswer($active_id, $pass);
174 
175  if (($active_id > 0) && (!$show_correct_solution)) {
176  $solution = $user_solution;
177  } else {
178  $solution = $this->getBestAnswer($this->renderPurposeSupportsFormHtml());
179  }
180 
181  // generate the question output
182  include_once "./Services/UICore/classes/class.ilTemplate.php";
183  $template = new ilTemplate("tpl.il_as_qpl_text_question_output_solution.html", true, true, "Modules/TestQuestionPool");
184  $solutiontemplate = new ilTemplate("tpl.il_as_tst_solution_output.html", true, true, "Modules/TestQuestionPool");
185 
186  $solution = $this->object->getHtmlUserSolutionPurifier()->purify($solution);
187  if ($this->renderPurposeSupportsFormHtml()) {
188  $template->setCurrentBlock('essay_div');
189  $template->setVariable("DIV_ESSAY", $this->object->prepareTextareaOutput($solution, true));
190  } else {
191  $template->setCurrentBlock('essay_textarea');
192  $template->setVariable("TA_ESSAY", $this->object->prepareTextareaOutput($solution, true, true));
193  }
194  $template->parseCurrentBlock();
195 
196  $questiontext = $this->object->getQuestion();
197 
198  if (!$show_correct_solution) {
199  $max_no_of_chars = $this->object->getMaxNumOfChars();
200 
201  if ($max_no_of_chars == 0) {
202  $max_no_of_chars = ucfirst($this->lng->txt('unlimited'));
203  }
204 
205  $act_no_of_chars = $this->object->countLetters($solution);
206  $template->setVariable("CHARACTER_INFO", '<b>' . $max_no_of_chars . '</b>' .
207  $this->lng->txt('answer_characters') . ' <b>' . $act_no_of_chars . '</b>');
208  }
209 
210  if ($this->object->isWordCounterEnabled()) {
211  $template->setCurrentBlock('word_count');
212  $template->setVariable(
213  'WORD_COUNT',
214  $this->lng->txt('qst_essay_written_words') .
215  ' <b>' . $this->object->countWords($solution) . '</b>'
216  );
217  $template->parseCurrentBlock();
218  }
219 
220  if (($active_id > 0) && (!$show_correct_solution)) {
221  if ($graphicalOutput) {
222  // output of ok/not ok icons for user entered solutions
223  $reached_points = $this->object->getReachedPoints($active_id, $pass);
224  if ($reached_points == $this->object->getMaximumPoints()) {
225  $template->setCurrentBlock("icon_ok");
226  $template->setVariable("ICON_OK", ilUtil::getImagePath("icon_ok.svg"));
227  $template->setVariable("TEXT_OK", $this->lng->txt("answer_is_right"));
228  $template->parseCurrentBlock();
229  } else {
230  $template->setCurrentBlock("icon_ok");
231  if ($reached_points > 0) {
232  $template->setVariable("ICON_NOT_OK", ilUtil::getImagePath("icon_mostly_ok.svg"));
233  $template->setVariable("TEXT_NOT_OK", $this->lng->txt("answer_is_not_correct_but_positive"));
234  } else {
235  $template->setVariable("ICON_NOT_OK", ilUtil::getImagePath("icon_not_ok.svg"));
236  $template->setVariable("TEXT_NOT_OK", $this->lng->txt("answer_is_wrong"));
237  }
238  $template->parseCurrentBlock();
239  }
240  }
241  }
242  if ($show_question_text == true) {
243  $template->setVariable("QUESTIONTEXT", $this->object->prepareTextareaOutput($questiontext, true));
244  }
245  $questionoutput = $template->get();
246 
247  $feedback = '';
248  if ($show_feedback) {
249  if (!$this->isTestPresentationContext()) {
250  $fb = $this->getGenericFeedbackOutput($active_id, $pass);
251  $feedback .= strlen($fb) ? $fb : '';
252  }
253 
254  $fb = $this->getSpecificFeedbackOutput(
255  array($user_solution => '')
256  );
257 
258  $feedback .= strlen($fb) ? $fb : '';
259  }
260  if (strlen($feedback)) {
261  $cssClass = (
262  $this->hasCorrectSolution($active_id, $pass) ?
264  );
265 
266  $solutiontemplate->setVariable("ILC_FB_CSS_CLASS", $cssClass);
267  $solutiontemplate->setVariable("FEEDBACK", $this->object->prepareTextareaOutput($feedback, true));
268  }
269 
270  $solutiontemplate->setVariable("SOLUTION_OUTPUT", $questionoutput);
271 
272  $solutionoutput = $solutiontemplate->get();
273  if (!$show_question_only) {
274  // get page object output
275  $solutionoutput = $this->getILIASPage($solutionoutput);
276  }
277  return $solutionoutput;
278  }
hasCorrectSolution($activeId, $passIndex)
getSpecificFeedbackOutput($userSolution)
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)
getUserAnswer($active_id, $pass)
getGenericFeedbackOutput($active_id, $pass)
Returns the answer specific feedback for the question.
+ Here is the call graph for this function:

◆ getSpecificFeedbackOutput()

assTextQuestionGUI::getSpecificFeedbackOutput (   $userSolution)

Definition at line 573 of file class.assTextQuestionGUI.php.

Referenced by getSolutionOutput().

574  {
575  $firstValue1 = current($userSolution);
576 
577  $feedback = '<table><tbody>';
578  $user_answer = ' ' . $firstValue1;
579 
580  foreach ($this->object->getAnswers() as $idx => $ans) {
581  if ($this->object->isKeywordMatching($user_answer, $ans->getAnswertext())) {
582  $fb = $this->object->feedbackOBJ->getSpecificAnswerFeedbackTestPresentation(
583  $this->object->getId(),
584  0,
585  $idx
586  );
587  $feedback .= '<tr><td><b><i>' . $ans->getAnswertext() . '</i></b></td><td>';
588  $feedback .= $fb . '</td> </tr>';
589  }
590  }
591 
592  $feedback .= '</tbody></table>';
593  return $this->object->prepareTextareaOutput($feedback, true);
594  }
+ Here is the caller graph for this function:

◆ getTestOutput()

assTextQuestionGUI::getTestOutput (   $active_id,
  $pass = null,
  $is_postponed = false,
  $use_post_solutions = false,
  $inlineFeedback = false 
)

Definition at line 385 of file class.assTextQuestionGUI.php.

References $pass, getJsCode(), ilYuiUtil\initDomEvent(), assQuestionGUI\outQuestionPage(), and ilUtil\prepareFormOutput().

386  {
387  // get the solution of the user for the active pass or from the last pass if allowed
388  $user_solution = "";
389  if ($active_id) {
390  $solutions = null;
391  // hey: prevPassSolutions - obsolete due to central check
392  #include_once "./Modules/Test/classes/class.ilObjTest.php";
393  #if (!ilObjTest::_getUsePreviousAnswers($active_id, true))
394  #{
395  # if (is_null($pass)) $pass = ilObjTest::_getPass($active_id);
396  #}
397  // hey.
398  $solutions = $this->object->getUserSolutionPreferingIntermediate($active_id, $pass);
399  foreach ($solutions as $idx => $solution_value) {
400  $user_solution = $solution_value["value1"];
401  }
402  }
403 
404  // generate the question output
405  include_once "./Services/UICore/classes/class.ilTemplate.php";
406  $template = new ilTemplate("tpl.il_as_qpl_text_question_output.html", true, true, "Modules/TestQuestionPool");
407  if ($this->object->getMaxNumOfChars()) {
408  $template->setCurrentBlock("maximum_char_hint");
409  $template->setVariable("MAXIMUM_CHAR_HINT", sprintf($this->lng->txt("text_maximum_chars_allowed"), $this->object->getMaxNumOfChars()));
410  $template->parseCurrentBlock();
411  #mbecker: No such block. $template->setCurrentBlock("has_maxchars");
412  $template->setVariable("MAXCHARS", $this->object->getMaxNumOfChars());
413  $template->parseCurrentBlock();
414  $template->setCurrentBlock("maxchars_counter");
415  $template->setVariable("MAXCHARS", $this->object->getMaxNumOfChars());
416  $template->setVariable("QID", $this->object->getId());
417  $template->setVariable("TEXTBOXSIZE", strlen($this->object->getMaxNumOfChars()));
418  $template->setVariable("CHARACTERS", $this->lng->txt("qst_essay_chars_remaining"));
419  $template->parseCurrentBlock();
420  }
421 
422  if ($this->object->isWordCounterEnabled()) {
423  $template->setCurrentBlock("word_counter");
424  $template->setVariable("QID", $this->object->getId());
425  $template->setVariable("WORDCOUNTER", $this->lng->txt("qst_essay_allready_written_words"));
426  $template->parseCurrentBlock();
427  }
428 
429  $template->setVariable("QID", $this->object->getId());
430  $template->setVariable("ESSAY", ilUtil::prepareFormOutput($user_solution));
431  $questiontext = $this->object->getQuestion();
432  $template->setVariable("QUESTIONTEXT", $this->object->prepareTextareaOutput($questiontext, true));
433  $questionoutput = $template->get();
434 
435  $questionoutput .= $this->getJsCode();
436 
437  $pageoutput = $this->outQuestionPage("", $is_postponed, $active_id, $questionoutput);
438  include_once "./Services/YUI/classes/class.ilYuiUtil.php";
440  return $pageoutput;
441  }
static prepareFormOutput($a_str, $a_strip=false)
prepares string output for html forms public
static initDomEvent(ilGlobalTemplateInterface $a_main_tpl=null)
Init YUI DomEvent.
outQuestionPage($a_temp_var, $a_postponed=false, $active_id="", $html="", $inlineFeedbackEnabled=false)
output question page
+ Here is the call graph for this function:

◆ getUserAnswer()

assTextQuestionGUI::getUserAnswer (   $active_id,
  $pass 
)
private

Definition at line 327 of file class.assTextQuestionGUI.php.

References $pass, and assQuestionGUI\getUseIntermediateSolution().

Referenced by getSolutionOutput().

328  {
329  $user_solution = "";
330  $solutions = $this->object->getSolutionValues($active_id, $pass, !$this->getUseIntermediateSolution());
331  foreach ($solutions as $idx => $solution_value) {
332  $user_solution = $solution_value["value1"];
333  }
334  return $user_solution;
335  }
getUseIntermediateSolution()
Get if intermediate solution should be used for solution output.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ isAnswerFreuqencyStatisticSupported()

assTextQuestionGUI::isAnswerFreuqencyStatisticSupported ( )

Definition at line 806 of file class.assTextQuestionGUI.php.

807  {
808  return false;
809  }

◆ magicAfterTestOutput()

assTextQuestionGUI::magicAfterTestOutput ( )

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

References $_GET, ilRTE\_getRTEClassname(), ilObject\_lookupObjectId(), ilObject\_lookupType(), and outAdditionalOutput().

121  {
122  // TODO - BEGIN: what exactly is done here? cant we use the parent method?
123 
124  include_once "./Services/RTE/classes/class.ilRTE.php";
125  $rtestring = ilRTE::_getRTEClassname();
126  include_once "./Services/RTE/classes/class.$rtestring.php";
127  $rte = new $rtestring();
128  include_once "./Services/Object/classes/class.ilObject.php";
129  $obj_id = ilObject::_lookupObjectId($_GET["ref_id"]);
130  $obj_type = ilObject::_lookupType($_GET["ref_id"], true);
131  $rte->addUserTextEditor("textinput");
132  $this->outAdditionalOutput();
133 
134  // TODO - END: what exactly is done here? cant we use the parent method?
135  }
static _getRTEClassname()
$_GET["client_id"]
static _lookupObjectId($a_ref_id)
lookup object id
static _lookupType($a_id, $a_reference=false)
lookup object type
+ Here is the call graph for this function:

◆ outAdditionalOutput()

assTextQuestionGUI::outAdditionalOutput ( )

Definition at line 116 of file class.assTextQuestionGUI.php.

Referenced by magicAfterTestOutput().

117  {
118  }
+ Here is the caller graph for this function:

◆ populateAnswerSpecificFormPart()

assTextQuestionGUI::populateAnswerSpecificFormPart ( \ilPropertyFormGUI  $form)

Definition at line 661 of file class.assTextQuestionGUI.php.

References ilPropertyFormGUI\addItem(), ilSubEnabledFormPropertyGUI\addSubItem(), ilRadioOption\addSubItem(), ilNumberInputGUI\allowDecimals(), ilFormPropertyGUI\setRequired(), and ilRadioOption\setValue().

Referenced by editQuestion(), and populateCorrectionsFormProperties().

662  {
663  $scoringMode = new ilRadioGroupInputGUI(
664  $this->lng->txt('essay_scoring_mode'),
665  'scoring_mode'
666  );
667 
668  $scoringOptionNone = new ilRadioOption(
669  $this->lng->txt('essay_scoring_mode_without_keywords'),
670  'non',
671  $this->lng->txt(
672  'essay_scoring_mode_without_keywords_desc'
673  )
674  );
675  $scoringOptionAnyKeyword = new ilRadioOption(
676  $this->lng->txt('essay_scoring_mode_keyword_relation_any'),
677  'any',
678  $this->lng->txt(
679  'essay_scoring_mode_keyword_relation_any_desc'
680  )
681  );
682  $scoringOptionAllKeyword = new ilRadioOption(
683  $this->lng->txt('essay_scoring_mode_keyword_relation_all'),
684  'all',
685  $this->lng->txt(
686  'essay_scoring_mode_keyword_relation_all_desc'
687  )
688  );
689  $scoringOptionOneKeyword = new ilRadioOption(
690  $this->lng->txt('essay_scoring_mode_keyword_relation_one'),
691  'one',
692  $this->lng->txt(
693  'essay_scoring_mode_keyword_relation_one_desc'
694  )
695  );
696 
697  $scoringMode->addOption($scoringOptionNone);
698  $scoringMode->addOption($scoringOptionAnyKeyword);
699  $scoringMode->addOption($scoringOptionAllKeyword);
700  $scoringMode->addOption($scoringOptionOneKeyword);
701  $scoringMode->setRequired(true);
702  $scoringMode->setValue(
703  strlen($this->object->getKeywordRelation()) ? $this->object->getKeywordRelation(
704  ) : 'non'
705  );
706 
707  if ($this->object->getAnswerCount() == 0) {
708  $this->object->addAnswer("", 1, 0, 0);
709  }
710  require_once "./Modules/TestQuestionPool/classes/class.ilEssayKeywordWizardInputGUI.php";
711 
712  // Without Keywords
713  $nonKeywordPoints = new ilNumberInputGUI($this->lng->txt("points"), "non_keyword_points");
714  $nonKeywordPoints->allowDecimals(true);
715  $nonKeywordPoints->setValue($this->object->getPoints());
716  $nonKeywordPoints->setRequired(true);
717  $nonKeywordPoints->setSize(3);
718  $nonKeywordPoints->setMinValue(0.0);
719  $nonKeywordPoints->setMinvalueShouldBeGreater(true);
720  $scoringOptionNone->addSubItem($nonKeywordPoints);
721 
722  // Any Keyword
723  $anyKeyword = new ilEssayKeywordWizardInputGUI($this->lng->txt("answers"), "any_keyword");
724  $anyKeyword->setRequired(true);
725  $anyKeyword->setQuestionObject($this->object);
726  $anyKeyword->setSingleline(true);
727  $anyKeyword->setValues($this->object->getAnswers());
728  $scoringOptionAnyKeyword->addSubItem($anyKeyword);
729 
730  // All Keywords
731  $allKeyword = new ilTextWizardInputGUI($this->lng->txt("answers"), "all_keyword");
732  $allKeyword->setRequired(true);
733  //$allKeyword->setQuestionObject($this->object);
734  //$allKeyword->setSingleline(TRUE);
735  $allKeyword->setValues(self::buildAnswerTextOnlyArray($this->object->getAnswers()));
736  $scoringOptionAllKeyword->addSubItem($allKeyword);
737  $allKeywordPoints = new ilNumberInputGUI($this->lng->txt("points"), "all_keyword_points");
738  $allKeywordPoints->allowDecimals(true);
739  $allKeywordPoints->setValue($this->object->getPoints());
740  $allKeywordPoints->setRequired(true);
741  $allKeywordPoints->setSize(3);
742  $allKeywordPoints->setMinValue(0.0);
743  $allKeywordPoints->setMinvalueShouldBeGreater(true);
744  $scoringOptionAllKeyword->addSubItem($allKeywordPoints);
745 
746  // One Keywords
747  $oneKeyword = new ilTextWizardInputGUI($this->lng->txt("answers"), "one_keyword");
748  $oneKeyword->setRequired(true);
749  //$oneKeyword->setQuestionObject($this->object);
750  //$oneKeyword->setSingleline(TRUE);
751  $oneKeyword->setValues(self::buildAnswerTextOnlyArray($this->object->getAnswers()));
752  $scoringOptionOneKeyword->addSubItem($oneKeyword);
753  $oneKeywordPoints = new ilNumberInputGUI($this->lng->txt("points"), "one_keyword_points");
754  $oneKeywordPoints->allowDecimals(true);
755  $oneKeywordPoints->setValue($this->object->getPoints());
756  $oneKeywordPoints->setRequired(true);
757  $oneKeywordPoints->setSize(3);
758  $oneKeywordPoints->setMinValue(0.0);
759  $oneKeywordPoints->setMinvalueShouldBeGreater(true);
760  $scoringOptionOneKeyword->addSubItem($oneKeywordPoints);
761 
762  $form->addItem($scoringMode);
763  }
This class represents an option in a radio group.
allowDecimals($a_value)
Toggle Decimals.
This class represents a property in a property form.
setValue($a_value)
Set Value.
addSubItem($a_item)
Add Subitem.
This class represents a number property in a property form.
This class represents a text wizard property in a property form.
setRequired($a_required)
Set Required.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ populateCorrectionsFormProperties()

assTextQuestionGUI::populateCorrectionsFormProperties ( ilPropertyFormGUI  $form)

Definition at line 815 of file class.assTextQuestionGUI.php.

References populateAnswerSpecificFormPart(), populateQuestionSpecificFormPart(), and ilPropertyFormGUI\removeItemByPostVar().

816  {
817  $this->populateQuestionSpecificFormPart($form);
818  $this->populateAnswerSpecificFormPart($form);
819 
820  $form->removeItemByPostVar('maxchars');
821  }
removeItemByPostVar($a_post_var, $a_remove_unused_headers=false)
Remove Item.
populateQuestionSpecificFormPart(\ilPropertyFormGUI $form)
populateAnswerSpecificFormPart(\ilPropertyFormGUI $form)
+ Here is the call graph for this function:

◆ populateQuestionSpecificFormPart()

assTextQuestionGUI::populateQuestionSpecificFormPart ( \ilPropertyFormGUI  $form)

Definition at line 626 of file class.assTextQuestionGUI.php.

References ilPropertyFormGUI\addItem(), ilFormPropertyGUI\setInfo(), and ilNumberInputGUI\setSize().

Referenced by editQuestion(), and populateCorrectionsFormProperties().

627  {
628  // wordcounter
629  $wordcounter = new ilCheckboxInputGUI($this->lng->txt('qst_essay_wordcounter_enabled'), 'wordcounter');
630  $wordcounter->setInfo($this->lng->txt('qst_essay_wordcounter_enabled_info'));
631  $wordcounter->setChecked($this->object->isWordCounterEnabled());
632  $form->addItem($wordcounter);
633 
634  // maxchars
635  $maxchars = new ilNumberInputGUI($this->lng->txt("maxchars"), "maxchars");
636  $maxchars->setSize(5);
637  if ($this->object->getMaxNumOfChars() > 0) {
638  $maxchars->setValue($this->object->getMaxNumOfChars());
639  }
640  $maxchars->setInfo($this->lng->txt("description_maxchars"));
641  $form->addItem($maxchars);
642 
643  // text rating
644  $textrating = new ilSelectInputGUI($this->lng->txt("text_rating"), "text_rating");
645  $text_options = array(
646  "ci" => $this->lng->txt("cloze_textgap_case_insensitive"),
647  "cs" => $this->lng->txt("cloze_textgap_case_sensitive"),
648  "l1" => sprintf($this->lng->txt("cloze_textgap_levenshtein_of"), "1"),
649  "l2" => sprintf($this->lng->txt("cloze_textgap_levenshtein_of"), "2"),
650  "l3" => sprintf($this->lng->txt("cloze_textgap_levenshtein_of"), "3"),
651  "l4" => sprintf($this->lng->txt("cloze_textgap_levenshtein_of"), "4"),
652  "l5" => sprintf($this->lng->txt("cloze_textgap_levenshtein_of"), "5")
653  );
654  $textrating->setOptions($text_options);
655  $textrating->setValue($this->object->getTextRating());
656  $form->addItem($textrating);
657 
658  return $form;
659  }
This class represents a checkbox property in a property form.
setInfo($a_info)
Set Information Text.
This class represents a number property in a property form.
setSize($a_size)
Set Size.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ saveCorrectionsFormProperties()

assTextQuestionGUI::saveCorrectionsFormProperties ( ilPropertyFormGUI  $form)
Parameters
ilPropertyFormGUI$form

Definition at line 826 of file class.assTextQuestionGUI.php.

References writeAnswerSpecificPostData(), and writeQuestionSpecificPostData().

827  {
828  $this->writeQuestionSpecificPostData($form);
829  $this->writeAnswerSpecificPostData($form);
830  }
writeAnswerSpecificPostData(ilPropertyFormGUI $form)
Extracts the answer specific values from $_POST and applies them to the data object.
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:

◆ setQuestionTabs()

assTextQuestionGUI::setQuestionTabs ( )

Sets the ILIAS tabs for this question type.

public

Todo:
: MOVE THIS STEPS TO COMMON QUESTION CLASS assQuestionGUI

Definition at line 499 of file class.assTextQuestionGUI.php.

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

500  {
501  global $DIC;
502  $rbacsystem = $DIC['rbacsystem'];
503  $ilTabs = $DIC['ilTabs'];
504 
505  $ilTabs->clearTargets();
506 
507  $this->ctrl->setParameterByClass("ilAssQuestionPageGUI", "q_id", $_GET["q_id"]);
508  include_once "./Modules/TestQuestionPool/classes/class.assQuestion.php";
509  $q_type = $this->object->getQuestionType();
510 
511  if (strlen($q_type)) {
512  $classname = $q_type . "GUI";
513  $this->ctrl->setParameterByClass(strtolower($classname), "sel_question_types", $q_type);
514  $this->ctrl->setParameterByClass(strtolower($classname), "q_id", $_GET["q_id"]);
515  }
516 
517  if ($_GET["q_id"]) {
518  if ($rbacsystem->checkAccess('write', $_GET["ref_id"])) {
519  // edit page
520  $ilTabs->addTarget(
521  "edit_page",
522  $this->ctrl->getLinkTargetByClass("ilAssQuestionPageGUI", "edit"),
523  array("edit", "insert", "exec_pg"),
524  "",
525  "",
526  $force_active
527  );
528  }
529 
530  $this->addTab_QuestionPreview($ilTabs);
531  }
532 
533  $force_active = false;
534  if ($rbacsystem->checkAccess('write', $_GET["ref_id"])) {
535  $url = "";
536  if ($classname) {
537  $url = $this->ctrl->getLinkTargetByClass($classname, "editQuestion");
538  }
539  // edit question properties
540  $ilTabs->addTarget(
541  "edit_question",
542  $url,
543  array("editQuestion", "save", "saveEdit", "originalSyncForm"),
544  $classname,
545  "",
546  $force_active
547  );
548  }
549 
550  // add tab for question feedback within common class assQuestionGUI
551  $this->addTab_QuestionFeedback($ilTabs);
552 
553  // add tab for question hint within common class assQuestionGUI
554  $this->addTab_QuestionHints($ilTabs);
555 
556  // add tab for question's suggested solution within common class assQuestionGUI
557  $this->addTab_SuggestedSolution($ilTabs, $classname);
558 
559  // Assessment of questions sub menu entry
560  if ($_GET["q_id"]) {
561  $ilTabs->addTarget(
562  "statistics",
563  $this->ctrl->getLinkTargetByClass($classname, "assessment"),
564  array("assessment"),
565  $classname,
566  ""
567  );
568  }
569 
570  $this->addBackTab($ilTabs);
571  }
addTab_QuestionPreview(ilTabsGUI $tabsGUI)
addTab_QuestionHints(ilTabsGUI $tabs)
adds the hints tab to ilTabsGUI
$_GET["client_id"]
addTab_QuestionFeedback(ilTabsGUI $tabs)
adds the feedback tab to ilTabsGUI
addBackTab(ilTabsGUI $ilTabs)
$DIC
Definition: xapitoken.php:46
$url
addTab_SuggestedSolution(ilTabsGUI $tabs, $classname)
+ Here is the call graph for this function:

◆ supportsIntermediateSolutionOutput()

assTextQuestionGUI::supportsIntermediateSolutionOutput ( )

Question type specific support of intermediate solution output The function getSolutionOutput respects getUseIntermediateSolution()

Returns
bool

Definition at line 142 of file class.assTextQuestionGUI.php.

143  {
144  return true;
145  }

◆ writeAnswerSpecificPostData()

assTextQuestionGUI::writeAnswerSpecificPostData ( ilPropertyFormGUI  $form)

Extracts the answer 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 ilGuiAnswerScoringAdjustable.

Definition at line 604 of file class.assTextQuestionGUI.php.

References $_POST.

Referenced by saveCorrectionsFormProperties(), and writePostData().

605  {
606  switch ($this->object->getKeywordRelation()) {
607  case 'non':
608  $this->object->setAnswers(array());
609  $this->object->setPoints($_POST['non_keyword_points']);
610  break;
611  case 'any':
612  $this->object->setAnswers($_POST['any_keyword']);
613  $this->object->setPoints($this->object->getMaximumPoints());
614  break;
615  case 'all':
616  $this->object->setAnswers($_POST['all_keyword']);
617  $this->object->setPoints($_POST['all_keyword_points']);
618  break;
619  case 'one':
620  $this->object->setAnswers($_POST['one_keyword']);
621  $this->object->setPoints($_POST['one_keyword_points']);
622  break;
623  }
624  }
$_POST["username"]
+ Here is the caller graph for this function:

◆ writePostData()

assTextQuestionGUI::writePostData (   $always = false)
protected

{}

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

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

Referenced by addSuggestedSolution().

46  {
47  $hasErrors = (!$always) ? $this->editQuestion(true) : false;
48  if (!$hasErrors) {
49  require_once 'Services/Form/classes/class.ilPropertyFormGUI.php';
53  $this->saveTaxonomyAssignments();
54  return 0;
55  }
56  return 1;
57  }
This class represents a property form user interface.
writeAnswerSpecificPostData(ilPropertyFormGUI $form)
Extracts the answer specific values from $_POST and applies them to the data object.
editQuestion($checkonly=false)
Creates an output of the edit form for the question.
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:
+ Here is the caller graph for this function:

◆ writeQuestionSpecificPostData()

assTextQuestionGUI::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 596 of file class.assTextQuestionGUI.php.

References $_POST.

Referenced by saveCorrectionsFormProperties(), and writePostData().

597  {
598  $this->object->setWordCounterEnabled(isset($_POST['wordcounter']) && $_POST['wordcounter']);
599  $this->object->setMaxNumOfChars($_POST["maxchars"]);
600  $this->object->setTextRating($_POST["text_rating"]);
601  $this->object->setKeywordRelation($_POST['scoring_mode']);
602  }
$_POST["username"]
+ Here is the caller graph for this function:

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