ILIAS  release_8 Revision v8.24
assTextQuestionGUI Class Reference

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V. 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...
 
 magicAfterTestOutput ()
 
 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...
 
 getAutoSavedSolutionOutput ( $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, $show_autosave_title=false)
 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 ()
 
 getSpecificFeedbackOutput (array $userSolution)
 Returns the answer specific feedback for the question. More...
 
 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 (array $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
 hasInlineFeedback ()
 
 addHeaderAction ()
 
 redrawHeaderAction ()
 
 getHeaderAction ()
 
 getNotesHTML ()
 
 executeCommand ()
 
 getType ()
 needed for page editor compliance More...
 
 getPresentationContext ()
 
 setPresentationContext (string $presentationContext)
 
 isTestPresentationContext ()
 
 isPreviousSolutionPrefilled ()
 
 setPreviousSolutionPrefilled (bool $previousSolutionPrefilled)
 
 getRenderPurpose ()
 
 setRenderPurpose (string $renderPurpose)
 
 isRenderPurposePrintPdf ()
 
 isRenderPurposePreview ()
 
 isRenderPurposeInputValue ()
 
 isRenderPurposePlayback ()
 
 isRenderPurposeDemoplay ()
 
 renderPurposeSupportsFormHtml ()
 
 getEditContext ()
 
 setEditContext (string $editContext)
 
 isAuthoringEditContext ()
 
 isAdjustmentEditContext ()
 
 setAdjustmentEditContext ()
 
 getNavigationGUI ()
 
 setNavigationGUI (?ilTestQuestionNavigationGUI $navigationGUI)
 
 setTaxonomyIds (array $taxonomyIds)
 
 getTaxonomyIds ()
 
 setTargetGui ($linkTargetGui)
 
 setTargetGuiClass ($targetGuiClass)
 
 getTargetGuiClass ()
 
 setQuestionHeaderBlockBuilder (\ilQuestionHeaderBlockBuilder $questionHeaderBlockBuilder)
 
 getQuestionHeaderBlockBuilder ()
 
 setQuestionActionCmd (string $questionActionCmd)
 
 getQuestionActionCmd ()
 
 assessment ()
 
 populateJavascriptFilesRequiredForWorkForm (ilGlobalTemplateInterface $tpl)
 
 getPresentationJavascripts ()
 
 getQuestionTemplate ()
 
 getILIASPage (string $html="")
 Returns the ILIAS Page around a question. More...
 
 outQuestionPage ($a_temp_var, $a_postponed=false, $active_id="", $html="", $inlineFeedbackEnabled=false)
 
 cancel ()
 
 originalSyncForm (string $return_to="", string $return_to_feedback='')
 
 sync ()
 
 cancelSync ()
 
 saveEdit ()
 
 save ()
 
 saveReturn ()
 
 apply ()
 
 getContextPath ($cont_obj, int $a_endnode_id, int $a_startnode_id=1)
 get context path in content object tree More...
 
 setSequenceNumber (int $nr)
 
 getSequenceNumber ()
 
 setQuestionCount (int $a_question_count)
 
 getQuestionCount ()
 
 getErrorMessage ()
 
 setErrorMessage (string $errormessage)
 
 addErrorMessage (string $errormessage)
 
 outAdditionalOutput ()
 Why are you here? Some magic for plugins? More...
 
 getQuestionType ()
 
 getAsValueAttribute (string $a_value)
 
 addNewIdListener ($a_object, string $a_method, string $a_parameters="")
 Add a listener that is notified with the new question ID, when a new question is saved. More...
 
 callNewIdListeners (int $a_new_id)
 
 addQuestionFormCommandButtons (ilPropertyFormGUI $form)
 
 addBasicQuestionFormProperties (ilPropertyFormGUI $form)
 
 getGenericFeedbackOutput (int $active_id, ?int $pass)
 
 getGenericFeedbackOutputForCorrectSolution ()
 
 getGenericFeedbackOutputForIncorrectSolution ()
 
 getSpecificFeedbackOutput (array $userSolution)
 Returns the answer specific feedback for the question. More...
 
 outQuestionType ()
 
 suggestedsolution ()
 
 outSolutionExplorer ()
 
 saveSuggestedSolutionType ()
 
 cancelExplorer ()
 
 outPageSelector ()
 
 outChapterSelector ()
 
 outGlossarySelector ()
 
 linkChilds ()
 
 addPG ()
 
 addST ()
 
 addGIT ()
 
 isSaveCommand ()
 
 setQuestionTabs ()
 
 addTab_SuggestedSolution (ilTabsGUI $tabs, string $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 (string $formaction, int $active_id, ?int $pass, bool $is_question_postponed=false, $user_post_solutions=false, bool $show_specific_inline_feedback=false)
 
 magicAfterTestOutput ()
 
 getTestOutput ( $active_id, $pass, $is_question_postponed, $user_post_solutions, $show_specific_inline_feedback)
 
 getFormEncodingType ()
 
 setPreviewSession (ilAssQuestionPreviewSession $previewSession)
 
 getPreviewSession ()
 
 showHints ()
 
 buildFocusAnchorHtml ()
 
 isAnswerFrequencyStatisticSupported ()
 
 getSubQuestionsIndex ()
 
 getAnswersFrequency ($relevantAnswers, $questionIndex)
 
 getAnswerFrequencyTableGUI ($parentGui, $parentCmd, $relevantAnswers, $questionIndex)
 
 prepareReprintableCorrectionsForm (ilPropertyFormGUI $form)
 
 populateCorrectionsFormProperties (ilPropertyFormGUI $form)
 
 saveCorrectionsFormProperties (ilPropertyFormGUI $form)
 
- Public Member Functions inherited from ilGuiQuestionScoringAdjustable
 populateQuestionSpecificFormPart (ilPropertyFormGUI $form)
 Adds the question specific forms parts to a question property form gui. More...
 
 writeQuestionSpecificPostData (ilPropertyFormGUI $form)
 Extracts the question specific values from $_POST and applies them to the data object. More...
 
 getAfterParticipationSuppressionQuestionPostVars ()
 Returns a list of postvars which will be suppressed in the form output when used in scoring adjustment. More...
 
 getAggregatedAnswersView (array $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 ilGuiAnswerScoringAdjustable
 populateAnswerSpecificFormPart (ilPropertyFormGUI $form)
 Adds the answer specific form parts to a question property form gui. More...
 
 writeAnswerSpecificPostData (ilPropertyFormGUI $form)
 Extracts the answer specific values from $_POST and applies them to the data object. More...
 
 getAfterParticipationSuppressionAnswerPostVars ()
 Returns a list of postvars which will be suppressed in the form output when used in scoring adjustment. More...
 

Protected Member Functions

 writePostData (bool $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...
 
 getJsCode ()
 
- Protected Member Functions inherited from assQuestionGUI
 hasSpecialQuestionCommands ()
 
 writePostData (bool $always=false)
 Evaluates a posted edit form and writes the form data in the question object. More...
 
 renderEditForm (ilPropertyFormGUI $form)
 
 getUseUnchangedAnswerCheckboxHtml ()
 
 getPreviousSolutionProvidedMessage ()
 
 getPreviousSolutionConfirmationCheckboxHtml ()
 
 addNumberOfTriesToFormIfNecessary (ilPropertyFormGUI $form)
 
 saveTaxonomyAssignments ()
 
 populateTaxonomyFormSection (ilPropertyFormGUI $form)
 
 genericFeedbackOutputBuilder (string $feedback_correct, string $feedback_incorrect, int $active_id, ?int $pass)
 
 setDefaultTabs (ilTabsGUI $ilTabs)
 
 setQuestionSpecificTabs (ilTabsGUI $ilTabs)
 
 getBasicEditQuestionTabCommands ()
 
 getAdditionalEditQuestionCommands ()
 
 addTab_QuestionFeedback (ilTabsGUI $tabs)
 
 addTab_QuestionHints (ilTabsGUI $tabs)
 
 addTab_Question (ilTabsGUI $tabsGUI)
 
 hasCorrectSolution ($activeId, $passIndex)
 
 writeQuestionGenericPostData ()
 
 completeTestOutputFormAction ($formAction, $active_id, $pass)
 
 addBackTab (ilTabsGUI $ilTabs)
 
 buildBasicEditFormObject ()
 
 escapeTemplatePlaceholders (string $text)
 
 buildEditForm ()
 
 generateCorrectnessIconsForCorrectness (int $correctness)
 
 cleanupAnswerText (array $answer_text, bool $is_rte)
 sk - 12.05.2023: This is one more of those that we need, but don't want. More...
 
 addSaveOnEnterOnLoadCode ()
 

Protected Attributes

bool $tiny_mce_enabled
 
- Protected Attributes inherited from assQuestionGUI
const SUGGESTED_SOLUTION_COMMANDS
 
const HAS_SPECIAL_QUESTION_COMMANDS = false
 
ILIAS Notes GUIService $notes_gui
 
ilCtrl $ctrl
 
ilPropertyFormGUI $editForm
 
ILIAS TestQuestionPool InternalRequestService $request
 

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 (string $question_type='', int $question_id=-1)
 Creates a question gui representation and returns the alias to the question gui. More...
 
static _getGUIClassNameForId ($a_q_id)
 
static _getClassNameForQType ($q_type)
 
static getCommandsFromClassConstants (string $guiClassName, string $cmdConstantNameBegin='CMD_')
 
static prepareTextareaOutput ($txt_output, $prepare_for_latex_output=false, $omitNl2BrWhenTextArea=false)
 Prepares a string for a text area output where latex code may be in it If the text is HTML-free, CHR(13) will be converted to a line break. 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 CORRECTNESS_NOT_OK = 0
 
const CORRECTNESS_MOSTLY_OK = 1
 
const CORRECTNESS_OK = 2
 
const ALLOWED_PLAIN_TEXT_TAGS = "<em>, <strong>"
 sk - 12.05.2023: This const is also used in ilKprimChoiceWizardInputGUI. More...
 
const SESSION_PREVIEW_DATA_BASE_INDEX = 'ilAssQuestionPreviewAnswers'
 
assQuestion $object
 
ilGlobalPageTemplate $tpl
 
ilLanguage $lng
 
 $error
 
string $errormessage
 
int $sequence_no
 sequence number in test More...
 
int $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'
 

Detailed Description

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V.

ILIAS is licensed with the GPL-3.0, see https://www.gnu.org/licenses/gpl-3.0.en.html You should have received a copy of said license along with the source code, too.

If this is not the case or you just want to try ILIAS, you'll find us at: https://www.ilias.de https://github.com/ILIAS-eLearning 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$

@ilCtrl_Calls assTextQuestionGUI: ilFormPropertyDispatchGUI

Definition at line 33 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 43 of file class.assTextQuestionGUI.php.

44 {
45 $this->tiny_mce_enabled = (new ilSetting('advanced_editing'))->get('advanced_editing_javascript_editor')
46 === 'tinymce' ? true : false;
48 include_once "./Modules/TestQuestionPool/classes/class.assTextQuestion.php";
49 $this->object = new assTextQuestion();
50 if ($id >= 0) {
51 $this->object->loadFromDb($id);
52 }
53 }
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
return true
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc

References $id, ILIAS\GlobalScreen\Provider\__construct(), and true.

+ Here is the call graph for this function:

Member Function Documentation

◆ addSuggestedSolution()

assTextQuestionGUI::addSuggestedSolution ( )

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

564 : void
565 {
566 ilSession::set("subquestion_index", 0);
567 if ($_POST["cmd"]["addSuggestedSolution"]) {
568 if ($this->writePostData()) {
569 $this->tpl->setOnScreenMessage('info', $this->getErrorMessage());
570 $this->editQuestion();
571 return;
572 }
573 // @MBECKER: Check this in running test
574 if (!$this->checkInput()) {
575 $this->tpl->setOnScreenMessage('info', $this->lng->txt("fill_out_all_required_fields_add_answer"));
576 $this->editQuestion();
577 return;
578 }
579 }
580 $this->object->saveToDb();
581 $this->ctrl->setParameter($this, "q_id", $this->object->getId());
582 $this->tpl->setVariable("HEADER", $this->object->getTitleForHTMLOutput());
583 $this->getQuestionTemplate();
584 }
editQuestion($checkonly=false)
Creates an output of the edit form for the question.
writePostData(bool $always=false)
{Evaluates a posted edit form and writes the form data in the question object.integer A positive valu...
static set(string $a_var, $a_val)
Set a value.

References ILIAS\Repository\ctrl(), ILIAS\Refinery\getErrorMessage(), ILIAS\Repository\lng(), ILIAS\Repository\object(), and ilSession\set().

+ Here is the call graph for this function:

◆ buildAnswerTextOnlyArray()

static assTextQuestionGUI::buildAnswerTextOnlyArray (   $answers)
staticprivate

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

118 : array
119 {
120 $answerTexts = array();
121
122 foreach ($answers as $answer) {
123 $answerTexts[] = $answer->getAnswertext();
124 }
125
126 return $answerTexts;
127 }

◆ editQuestion()

assTextQuestionGUI::editQuestion (   $checkonly = false)

Creates an output of the edit form for the question.

@access public

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

77 : bool
78 {
79 $save = $this->isSaveCommand();
80 $this->getQuestionTemplate();
81
82 include_once("./Services/Form/classes/class.ilPropertyFormGUI.php");
83 $form = new ilPropertyFormGUI();
84 $this->editForm = $form;
85
86 $form->setFormAction($this->ctrl->getFormAction($this));
87 $form->setTitle($this->outQuestionType());
88 $form->setMultipart(true);
89 $form->setTableWidth("100%");
90 $form->setId("asstextquestion");
91
95
96
97 $this->populateTaxonomyFormSection($form);
98
100
101 $errors = false;
102
103 if ($save) {
104 $form->setValuesByPost();
105 $errors = !$form->checkInput();
106 $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
107 if ($errors) {
108 $checkonly = false;
109 }
110 }
111
112 if (!$checkonly) {
113 $this->tpl->setVariable("QUESTION_DATA", $form->getHTML());
114 }
115 return $errors;
116 }
populateTaxonomyFormSection(ilPropertyFormGUI $form)
addBasicQuestionFormProperties(ilPropertyFormGUI $form)
addQuestionFormCommandButtons(ilPropertyFormGUI $form)
populateQuestionSpecificFormPart(\ilPropertyFormGUI $form)
populateAnswerSpecificFormPart(\ilPropertyFormGUI $form)
This class represents a property form user interface.
$errors
Definition: imgupload.php:65

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

Referenced by writePostData().

+ 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 775 of file class.assTextQuestionGUI.php.

775 : array
776 {
777 return array();
778 }

◆ 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 789 of file class.assTextQuestionGUI.php.

789 : array
790 {
791 return array();
792 }

◆ getAggregatedAnswersView()

assTextQuestionGUI::getAggregatedAnswersView ( array  $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 800 of file class.assTextQuestionGUI.php.

800 : string
801 {
802 return ''; //print_r($relevant_answers,true);
803 }

◆ getAnswersFrequency()

assTextQuestionGUI::getAnswersFrequency (   $relevantAnswers,
  $questionIndex 
)

Reimplemented from assQuestionGUI.

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

810 : array
811 {
812 return array();
813 }

◆ getAutoSavedSolutionOutput()

assTextQuestionGUI::getAutoSavedSolutionOutput (   $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,
  $show_autosave_title = false 
)

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
string The solution output of the question as HTML code

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

282 : string {
283 // get the solution of the user for the active pass or from the last pass if allowed
284
285 $user_solution = $this->getUserAnswer($active_id, $pass);
286
287 if (($active_id > 0) && (!$show_correct_solution)) {
288 $solution = $user_solution;
289 } else {
290 $solution = $this->getBestAnswer($this->renderPurposeSupportsFormHtml());
291 }
292
293 // generate the question output
294 include_once "./Services/UICore/classes/class.ilTemplate.php";
295 $template = new ilTemplate("tpl.il_as_qpl_text_question_output_solution.html", true, true, "Modules/TestQuestionPool");
296 $solutiontemplate = new ilTemplate("tpl.il_as_tst_solution_output.html", true, true, "Modules/TestQuestionPool");
297
298 $solution = '';
299 $autosaved_solution = $this->object->getLatestAutosaveContent($active_id, $pass);
300 if (!is_null($autosaved_solution)) {
301 if ($show_autosave_title) {
302 $template->setCurrentBlock('autosave_title');
303 $template->setVariable('AUTOSAVE_TITLE', $this->lng->txt('autosavecontent'));
304 $template->parseCurrentBlock();
305 }
306 $solution = $this->object->getHtmlUserSolutionPurifier()->purify($autosaved_solution);
307 if ($this->renderPurposeSupportsFormHtml()) {
308 $template->setCurrentBlock('essay_div');
309 $template->setVariable("DIV_ESSAY", ilLegacyFormElementsUtil::prepareTextareaOutput($solution, true));
310 } else {
311 $template->setCurrentBlock('essay_textarea');
312 $template->setVariable("TA_ESSAY", ilLegacyFormElementsUtil::prepareTextareaOutput($solution, true, true));
313 }
314 $template->parseCurrentBlock();
315 }
316
317 if (!$show_correct_solution) {
318 $max_no_of_chars = $this->object->getMaxNumOfChars();
319
320 if ($max_no_of_chars == 0) {
321 $max_no_of_chars = ucfirst($this->lng->txt('unlimited'));
322 }
323
324 $act_no_of_chars = $this->object->countLetters($solution);
325 $template->setVariable("CHARACTER_INFO", '<b>' . $max_no_of_chars . '</b>' .
326 $this->lng->txt('answer_characters') . ' <b>' . $act_no_of_chars . '</b>');
327
328 if ($this->object->isWordCounterEnabled()) {
329 $template->setCurrentBlock('word_count');
330 $template->setVariable(
331 'WORD_COUNT',
332 $this->lng->txt('qst_essay_written_words') .
333 ' <b>' . $this->object->countWords($solution) . '</b>'
334 );
335 $template->parseCurrentBlock();
336 }
337 }
338 if ($show_question_text == true) {
339 $template->setVariable("QUESTIONTEXT", $this->object->getQuestionForHTMLOutput());
340 }
341 $questionoutput = $template->get();
342
343 $feedback = '';
344 if ($show_feedback) {
345 if (!$this->isTestPresentationContext()) {
346 $fb = $this->getGenericFeedbackOutput((int) $active_id, $pass);
347 $feedback .= strlen($fb) ? $fb : '';
348 }
349 }
350 if (strlen($feedback)) {
351 $cssClass = (
352 $this->hasCorrectSolution($active_id, $pass) ?
354 );
355
356 $solutiontemplate->setVariable("ILC_FB_CSS_CLASS", $cssClass);
357 $solutiontemplate->setVariable("FEEDBACK", $this->object->prepareTextareaOutput($feedback, true));
358 }
359
360 $solutiontemplate->setVariable("SOLUTION_OUTPUT", $questionoutput);
361
362 $solutionoutput = $solutiontemplate->get();
363 if (!$show_question_only) {
364 // get page object output
365 $solutionoutput = $this->getILIASPage($solutionoutput);
366 }
367 return $solutionoutput;
368 }
getILIASPage(string $html="")
Returns the ILIAS Page around a question.
getGenericFeedbackOutput(int $active_id, ?int $pass)
hasCorrectSolution($activeId, $passIndex)
getUserAnswer($active_id, $pass)
static prepareTextareaOutput(string $txt_output, bool $prepare_for_latex_output=false, bool $omitNl2BrWhenTextArea=false)
Prepares a string for a text area output where latex code may be in it If the text is HTML-free,...
special template class to simplify handling of ITX/PEAR

◆ getBestAnswer()

assTextQuestionGUI::getBestAnswer (   $asHtml)
private

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

370 : string
371 {
372 $answers = $this->object->getAnswers();
373 if (!count($answers)) {
374 return '';
375 }
376
377 if ($asHtml) {
378 $tplFile = 'tpl.il_as_qpl_text_question_best_solution_html.html';
379 } else {
380 $tplFile = 'tpl.il_as_qpl_text_question_best_solution_ta.html';
381 }
382
383 $tpl = new ilTemplate($tplFile, true, true, 'Modules/TestQuestionPool');
384
385 foreach ($answers as $answer) {
386 $keywordString = '';
387 if (in_array($this->object->getKeywordRelation(), assTextQuestion::getScoringModesWithPointsByKeyword())) {
388 $keywordString .= (string) $answer->getPoints() . ' ';
389 if ($answer->getPoints() === 1.0 || $answer->getPoints() === -1.0) {
390 $keywordString .= $this->lng->txt('point');
391 } else {
392 $keywordString .= $this->lng->txt('points');
393 }
394 $keywordString .= ' ' . $this->lng->txt('for') . ' ';
395 }
396 $keywordString .= $answer->getAnswertext();
397
398 $tpl->setCurrentBlock('keyword');
399 $tpl->setVariable('KEYWORD', $keywordString);
401 }
402
403 $tpl->setVariable('KEYWORD_HEADER', $this->lng->txt('solution_contain_keywords'));
404 $tpl->setVariable('SCORING_LABEL', $this->lng->txt('essay_scoring_mode') . ': ');
405
406 switch ($this->object->getKeywordRelation()) {
407 case 'any':
408 $tpl->setVariable('SCORING_MODE', $this->lng->txt('essay_scoring_mode_keyword_relation_any'));
409 break;
410 case 'all':
411 $tpl->setVariable('SCORING_MODE', $this->lng->txt('essay_scoring_mode_keyword_relation_all'));
412 break;
413 case 'one':
414 $tpl->setVariable('SCORING_MODE', $this->lng->txt('essay_scoring_mode_keyword_relation_one'));
415 break;
416 }
417
418 return $tpl->get();
419 }
ilGlobalPageTemplate $tpl
static getScoringModesWithPointsByKeyword()
setCurrentBlock(string $blockname=self::DEFAULT_BLOCK)
Sets the template to the given block.
get(string $part=self::DEFAULT_BLOCK)
Renders the given block and returns the html string.
setVariable(string $variable, $value='')
Sets the given variable to the given value.
parseCurrentBlock(string $blockname=self::DEFAULT_BLOCK)
Parses the given block.

References $tpl, assTextQuestion\getScoringModesWithPointsByKeyword(), ILIAS\Repository\lng(), and ILIAS\Repository\object().

+ Here is the call graph for this function:

◆ getJsCode()

assTextQuestionGUI::getJsCode ( )
protected

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

536 : string
537 {
538 $tpl = new ilTemplate('tpl.charcounter.html', true, true, 'Modules/TestQuestionPool');
539
540 $tpl->setCurrentBlock('tinymce_handler');
541 $tpl->touchBlock('tinymce_handler');
543
544 if ($this->object->getMaxNumOfChars() > 0) {
545 $tpl->setCurrentBlock('letter_counter_js');
546 $tpl->setVariable("MAXCHARS", $this->object->getMaxNumOfChars());
548 }
549
550 if ($this->object->isWordCounterEnabled()) {
551 $tpl->setCurrentBlock('word_counter_js');
552 $tpl->touchBlock('word_counter_js');
554 }
555
556 $tpl->setCurrentBlock('counter_js');
557 $tpl->setVariable("QID", $this->object->getId());
559
560 $this->tpl->addOnLoadCode('mcQuestionCharCounterInit();');
561 return $tpl->get();
562 }
touchBlock(string $blockname)
overwrites ITX::touchBlock.

References $tpl, and ILIAS\Repository\object().

+ Here is the call graph for this function:

◆ getPreview()

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

Reimplemented from assQuestionGUI.

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

431 : string
432 {
433 // generate the question output
434 include_once "./Services/UICore/classes/class.ilTemplate.php";
435 $template = new ilTemplate("tpl.il_as_qpl_text_question_output.html", true, true, "Modules/TestQuestionPool");
436 if ($this->object->getMaxNumOfChars()) {
437 $template->setCurrentBlock("maximum_char_hint");
438 $template->setVariable("MAXIMUM_CHAR_HINT", sprintf($this->lng->txt("text_maximum_chars_allowed"), $this->object->getMaxNumOfChars()));
439 $template->parseCurrentBlock();
440 #mbecker: No such block. $template->setCurrentBlock("has_maxchars");
441 $template->setVariable("MAXCHARS", $this->object->getMaxNumOfChars());
442 $template->parseCurrentBlock();
443 $template->setCurrentBlock("maxchars_counter");
444 $template->setVariable("QID", $this->object->getId());
445 $template->setVariable("MAXCHARS", $this->object->getMaxNumOfChars());
446 $template->setVariable("TEXTBOXSIZE", strlen($this->object->getMaxNumOfChars()));
447 $template->setVariable("CHARACTERS", $this->lng->txt("qst_essay_chars_remaining"));
448 $template->parseCurrentBlock();
449 }
450
451 if ($this->object->isWordCounterEnabled()) {
452 $template->setCurrentBlock("word_counter");
453 $template->setVariable("QID", $this->object->getId());
454 $template->setVariable("WORDCOUNTER", $this->lng->txt("qst_essay_allready_written_words"));
455 $template->parseCurrentBlock();
456 }
457
458 if (is_object($this->getPreviewSession())) {
459 $template->setVariable(
460 "ESSAY",
462 (string) $this->getPreviewSession()->getParticipantsSolution()
463 )
464 );
465 }
466
467 $template->setVariable("QUESTIONTEXT", $this->object->getQuestionForHTMLOutput());
468 $template->setVariable("QID", $this->object->getId());
469
470 $questionoutput = $template->get();
471
472 $questionoutput .= $this->getJsCode();
473
474 if (!$show_question_only) {
475 // get page object output
476 $questionoutput = $this->getILIASPage($questionoutput);
477 }
478 return $questionoutput;
479 }
static prepareFormOutput($a_str, bool $a_strip=false)

References ILIAS\Repository\lng(), ILIAS\Repository\object(), and ilLegacyFormElementsUtil\prepareFormOutput().

+ 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
string The solution output of the question as HTML code

Reimplemented from assQuestionGUI.

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

165 : string {
166 // get the solution of the user for the active pass or from the last pass if allowed
167
168
169 if (($active_id > 0) && (!$show_correct_solution)) {
170 $user_solution = $this->getUserAnswer($active_id, $pass);
171 $solution = $user_solution;
172 } else {
173 $solution = $this->getBestAnswer($this->renderPurposeSupportsFormHtml());
174 }
175
176 // generate the question output
177 include_once "./Services/UICore/classes/class.ilTemplate.php";
178 $template = new ilTemplate("tpl.il_as_qpl_text_question_output_solution.html", true, true, "Modules/TestQuestionPool");
179 $solutiontemplate = new ilTemplate("tpl.il_as_tst_solution_output.html", true, true, "Modules/TestQuestionPool");
180
181 $solution = $this->object->getHtmlUserSolutionPurifier()->purify($solution);
182 if ($this->renderPurposeSupportsFormHtml()) {
183 $template->setCurrentBlock('essay_div');
184 $template->setVariable("DIV_ESSAY", $this->object->prepareTextareaOutput($solution, true));
185 } else {
186 $template->setCurrentBlock('essay_textarea');
187 $template->setVariable("TA_ESSAY", $this->object->prepareTextareaOutput($solution, true, true));
188 }
189 $template->parseCurrentBlock();
190
191 if (!$show_correct_solution) {
192 $max_no_of_chars = $this->object->getMaxNumOfChars();
193
194 if ($max_no_of_chars == 0) {
195 $max_no_of_chars = ucfirst($this->lng->txt('unlimited'));
196 }
197
198 $act_no_of_chars = $this->object->countLetters($solution);
199 $template->setVariable("CHARACTER_INFO", '<b>' . $max_no_of_chars . '</b>' .
200 $this->lng->txt('answer_characters') . ' <b>' . $act_no_of_chars . '</b>');
201
202 if ($this->object->isWordCounterEnabled()) {
203 $template->setCurrentBlock('word_count');
204 $template->setVariable(
205 'WORD_COUNT',
206 $this->lng->txt('qst_essay_written_words') .
207 ' <b>' . $this->object->countWords($solution) . '</b>'
208 );
209 $template->parseCurrentBlock();
210 }
211 }
212 if (($active_id > 0) && (!$show_correct_solution)) {
213 if ($graphicalOutput) {
214 $correctness_icon = $this->generateCorrectnessIconsForCorrectness(self::CORRECTNESS_NOT_OK);
215 $reached_points = $this->object->getReachedPoints($active_id, $pass);
216 if ($reached_points == $this->object->getMaximumPoints()) {
217 $correctness_icon = $this->generateCorrectnessIconsForCorrectness(self::CORRECTNESS_OK);
218 } elseif ($reached_points > 0) {
219 $correctness_icon = $this->generateCorrectnessIconsForCorrectness(self::CORRECTNESS_MOSTLY_OK);
220 }
221 $template->setCurrentBlock("icon_ok");
222 $template->setVariable("ICON_OK", $correctness_icon);
223 $template->parseCurrentBlock();
224 }
225 }
226 if ($show_question_text == true) {
227 $template->setVariable("QUESTIONTEXT", $this->object->getQuestionForHTMLOutput());
228 }
229 $questionoutput = $template->get();
230
231 $feedback = '';
232 if ($show_feedback) {
233 if (!$this->isTestPresentationContext()) {
234 $fb = $this->getGenericFeedbackOutput((int) $active_id, $pass);
235 $feedback .= strlen($fb) ? $fb : '';
236 }
237 }
238 if (strlen($feedback)) {
239 $cssClass = (
240 $this->hasCorrectSolution($active_id, $pass) ?
242 );
243
244 $solutiontemplate->setVariable("ILC_FB_CSS_CLASS", $cssClass);
245 $solutiontemplate->setVariable("FEEDBACK", $this->object->prepareTextareaOutput($feedback, true));
246 }
247
248 $solutiontemplate->setVariable("SOLUTION_OUTPUT", $questionoutput);
249
250 $solutionoutput = $solutiontemplate->get();
251 if (!$show_question_only) {
252 // get page object output
253 $solutionoutput = $this->getILIASPage($solutionoutput);
254 }
255 return $solutionoutput;
256 }
generateCorrectnessIconsForCorrectness(int $correctness)

References getUserAnswer().

+ Here is the call graph for this function:

◆ getSpecificFeedbackOutput()

assTextQuestionGUI::getSpecificFeedbackOutput ( array  $userSolution)

Returns the answer specific feedback for the question.

Parameters
array$userSolution($userSolution[<value1>] = <value2>)

Reimplemented from assQuestionGUI.

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

586 : string
587 {
588 return '';
589 }

◆ getTestOutput()

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

Reimplemented from assQuestionGUI.

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

481 : string
482 {
483 // get the solution of the user for the active pass or from the last pass if allowed
484 $user_solution = "";
485 if ($active_id) {
486 $solutions = $this->object->getUserSolutionPreferingIntermediate($active_id, $pass);
487 foreach ($solutions as $idx => $solution_value) {
488 $user_solution = $solution_value["value1"];
489 }
490
491 if ($this->tiny_mce_enabled) {
492 $user_solution = htmlentities($user_solution);
493 }
494
495 $user_solution = str_replace(['{', '}', '\\'], ['&#123;', '&#125;', '&#92;'], $user_solution);
496 }
497
498 // generate the question output
499 include_once "./Services/UICore/classes/class.ilTemplate.php";
500 $template = new ilTemplate("tpl.il_as_qpl_text_question_output.html", true, true, "Modules/TestQuestionPool");
501 if ($this->object->getMaxNumOfChars()) {
502 $template->setCurrentBlock("maximum_char_hint");
503 $template->setVariable("MAXIMUM_CHAR_HINT", sprintf($this->lng->txt("text_maximum_chars_allowed"), $this->object->getMaxNumOfChars()));
504 $template->parseCurrentBlock();
505 #mbecker: No such block. $template->setCurrentBlock("has_maxchars");
506 $template->setVariable("MAXCHARS", $this->object->getMaxNumOfChars());
507 $template->parseCurrentBlock();
508 $template->setCurrentBlock("maxchars_counter");
509 $template->setVariable("MAXCHARS", $this->object->getMaxNumOfChars());
510 $template->setVariable("QID", $this->object->getId());
511 $template->setVariable("TEXTBOXSIZE", strlen($this->object->getMaxNumOfChars()));
512 $template->setVariable("CHARACTERS", $this->lng->txt("qst_essay_chars_remaining"));
513 $template->parseCurrentBlock();
514 }
515
516 if ($this->object->isWordCounterEnabled()) {
517 $template->setCurrentBlock("word_counter");
518 $template->setVariable("QID", $this->object->getId());
519 $template->setVariable("WORDCOUNTER", $this->lng->txt("qst_essay_allready_written_words"));
520 $template->parseCurrentBlock();
521 }
522
523 $template->setVariable("QID", $this->object->getId());
524 $template->setVariable("ESSAY", $user_solution);
525 $template->setVariable("QUESTIONTEXT", $this->object->getQuestionForHTMLOutput());
526 $questionoutput = $template->get();
527
528 $questionoutput .= $this->getJsCode();
529
530 $pageoutput = $this->outQuestionPage("", $is_postponed, $active_id, $questionoutput);
531 include_once "./Services/YUI/classes/class.ilYuiUtil.php";
533 return $pageoutput;
534 }
outQuestionPage($a_temp_var, $a_postponed=false, $active_id="", $html="", $inlineFeedbackEnabled=false)
static initDomEvent(?ilGlobalTemplateInterface $a_main_tpl=null)
Init YUI DomEvent used in Services/Calendar, Modules/Session, Modules/Test (Jan 2022)

References ilYuiUtil\initDomEvent(), ILIAS\Repository\lng(), and ILIAS\Repository\object().

+ Here is the call graph for this function:

◆ getUserAnswer()

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

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

422 {
423 $user_solution = "";
424 $solutions = $this->object->getSolutionValues($active_id, $pass);
425 foreach ($solutions as $idx => $solution_value) {
426 $user_solution = $solution_value["value1"];
427 }
428 return $user_solution;
429 }

Referenced by getSolutionOutput().

+ Here is the caller graph for this function:

◆ isAnswerFreuqencyStatisticSupported()

assTextQuestionGUI::isAnswerFreuqencyStatisticSupported ( )

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

805 : bool
806 {
807 return false;
808 }

◆ magicAfterTestOutput()

assTextQuestionGUI::magicAfterTestOutput ( )

Reimplemented from assQuestionGUI.

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

129 : void
130 {
131 // TODO - BEGIN: what exactly is done here? cant we use the parent method?
132
133 include_once "./Services/RTE/classes/class.ilRTE.php";
134 $rtestring = ilRTE::_getRTEClassname();
135 include_once "./Services/RTE/classes/class.$rtestring.php";
136 $rte = new $rtestring();
137 $rte->addUserTextEditor("textinput");
138 $this->outAdditionalOutput();
139
140 // TODO - END: what exactly is done here? cant we use the parent method?
141 }
outAdditionalOutput()
Why are you here? Some magic for plugins?
static _getRTEClassname()

References ilRTE\_getRTEClassname(), and assQuestionGUI\outAdditionalOutput().

+ Here is the call graph for this function:

◆ populateAnswerSpecificFormPart()

assTextQuestionGUI::populateAnswerSpecificFormPart ( \ilPropertyFormGUI  $form)

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

660 {
661 $scoringMode = new ilRadioGroupInputGUI(
662 $this->lng->txt('essay_scoring_mode'),
663 'scoring_mode'
664 );
665
666 $scoringOptionNone = new ilRadioOption(
667 $this->lng->txt('essay_scoring_mode_without_keywords'),
668 'non',
669 $this->lng->txt(
670 'essay_scoring_mode_without_keywords_desc'
671 )
672 );
673 $scoringOptionAnyKeyword = new ilRadioOption(
674 $this->lng->txt('essay_scoring_mode_keyword_relation_any'),
675 'any',
676 $this->lng->txt(
677 'essay_scoring_mode_keyword_relation_any_desc'
678 )
679 );
680 $scoringOptionAllKeyword = new ilRadioOption(
681 $this->lng->txt('essay_scoring_mode_keyword_relation_all'),
682 'all',
683 $this->lng->txt(
684 'essay_scoring_mode_keyword_relation_all_desc'
685 )
686 );
687 $scoringOptionOneKeyword = new ilRadioOption(
688 $this->lng->txt('essay_scoring_mode_keyword_relation_one'),
689 'one',
690 $this->lng->txt(
691 'essay_scoring_mode_keyword_relation_one_desc'
692 )
693 );
694
695 $scoringMode->addOption($scoringOptionNone);
696 $scoringMode->addOption($scoringOptionAnyKeyword);
697 $scoringMode->addOption($scoringOptionAllKeyword);
698 $scoringMode->addOption($scoringOptionOneKeyword);
699 $scoringMode->setRequired(true);
700 $scoringMode->setValue(
701 strlen($this->object->getKeywordRelation()) ? $this->object->getKeywordRelation(
702 ) : 'non'
703 );
704
705 if ($this->object->getAnswerCount() == 0) {
706 $this->object->addAnswer("", 1, 0, 0);
707 }
708 require_once "./Modules/TestQuestionPool/classes/class.ilEssayKeywordWizardInputGUI.php";
709
710 // Without Keywords
711 $nonKeywordPoints = new ilNumberInputGUI($this->lng->txt("points"), "non_keyword_points");
712 $nonKeywordPoints->allowDecimals(true);
713 $nonKeywordPoints->setValue($this->object->getPoints());
714 $nonKeywordPoints->setRequired(true);
715 $nonKeywordPoints->setSize(3);
716 $nonKeywordPoints->setMinValue(0.0);
717 $nonKeywordPoints->setMinvalueShouldBeGreater(true);
718 $scoringOptionNone->addSubItem($nonKeywordPoints);
719
720 // Any Keyword
721 $anyKeyword = new ilEssayKeywordWizardInputGUI($this->lng->txt("answers"), "any_keyword");
722 $anyKeyword->setRequired(true);
723 $anyKeyword->setQuestionObject($this->object);
724 $anyKeyword->setSingleline(true);
725 $anyKeyword->setValues($this->object->getAnswers());
726 $scoringOptionAnyKeyword->addSubItem($anyKeyword);
727
728 // All Keywords
729 $allKeyword = new ilTextWizardInputGUI($this->lng->txt("answers"), "all_keyword");
730 $allKeyword->setRequired(true);
731 //$allKeyword->setQuestionObject($this->object);
732 //$allKeyword->setSingleline(TRUE);
733 $allKeyword->setValues(self::buildAnswerTextOnlyArray($this->object->getAnswers()));
734 $allKeyword->setMaxLength($anyKeyword->getMaxLength());
735 $scoringOptionAllKeyword->addSubItem($allKeyword);
736 $allKeywordPoints = new ilNumberInputGUI($this->lng->txt("points"), "all_keyword_points");
737 $allKeywordPoints->allowDecimals(true);
738 $allKeywordPoints->setValue($this->object->getPoints());
739 $allKeywordPoints->setRequired(true);
740 $allKeywordPoints->setSize(3);
741 $allKeywordPoints->setMinValue(0.0);
742 $allKeywordPoints->setMinvalueShouldBeGreater(true);
743 $scoringOptionAllKeyword->addSubItem($allKeywordPoints);
744
745 // One Keywords
746 $oneKeyword = new ilTextWizardInputGUI($this->lng->txt("answers"), "one_keyword");
747 $oneKeyword->setRequired(true);
748 //$oneKeyword->setQuestionObject($this->object);
749 //$oneKeyword->setSingleline(TRUE);
750 $oneKeyword->setValues(self::buildAnswerTextOnlyArray($this->object->getAnswers()));
751 $oneKeyword->setMaxLength($anyKeyword->getMaxLength());
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 return $form;
764 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This class represents a number property in a property form.
This class represents a property in a property form.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...

References ilPropertyFormGUI\addItem(), ILIAS\Repository\lng(), and ILIAS\Repository\object().

Referenced by editQuestion().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ populateCorrectionsFormProperties()

assTextQuestionGUI::populateCorrectionsFormProperties ( ilPropertyFormGUI  $form)

Reimplemented from assQuestionGUI.

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

815 : void
816 {
818 $this->populateAnswerSpecificFormPart($form);
819
820 $form->removeItemByPostVar('maxchars');
821 }
removeItemByPostVar(string $a_post_var, bool $a_remove_unused_headers=false)

References ilPropertyFormGUI\removeItemByPostVar().

+ Here is the call graph for this function:

◆ populateQuestionSpecificFormPart()

assTextQuestionGUI::populateQuestionSpecificFormPart ( \ilPropertyFormGUI  $form)

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

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

References ilPropertyFormGUI\addItem(), ILIAS\Repository\lng(), and ILIAS\Repository\object().

Referenced by editQuestion().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ saveCorrectionsFormProperties()

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

Reimplemented from assQuestionGUI.

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

826 : void
827 {
828 $this->writeQuestionSpecificPostData($form);
829 $this->writeAnswerSpecificPostData($form);
830 }
writeQuestionSpecificPostData(ilPropertyFormGUI $form)
Extracts the question specific values from $_POST and applies them to the data object.
writeAnswerSpecificPostData(ilPropertyFormGUI $form)
Extracts the answer specific values from $_POST and applies them to the data object.

◆ writeAnswerSpecificPostData()

assTextQuestionGUI::writeAnswerSpecificPostData ( ilPropertyFormGUI  $form)

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

Implements ilGuiAnswerScoringAdjustable.

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

599 : void
600 {
601 $points = 0;
602 switch ($this->object->getKeywordRelation()) {
603 case 'non':
604 $this->object->setAnswers(array());
605 $points = str_replace(',', '.', $_POST['non_keyword_points'] ?? '');
606 break;
607 case 'any':
608 $this->object->setAnswers($_POST['any_keyword']);
609 $points = $this->object->getMaximumPoints();
610 break;
611 case 'all':
612 $this->object->setAnswers($_POST['all_keyword']);
613 $points = str_replace(',', '.', $_POST['all_keyword_points'] ?? '');
614 break;
615 case 'one':
616 $this->object->setAnswers($_POST['one_keyword']);
617 $points = (float) str_replace(',', '.', $_POST['one_keyword_points'] ?? '');
618 break;
619 }
620 $this->object->setPoints((float) $points);
621 }

References ILIAS\Repository\object().

Referenced by writePostData().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ writePostData()

assTextQuestionGUI::writePostData ( bool  $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 58 of file class.assTextQuestionGUI.php.

58 : int
59 {
60 $hasErrors = (!$always) ? $this->editQuestion(true) : false;
61 if (!$hasErrors) {
62 require_once 'Services/Form/classes/class.ilPropertyFormGUI.php';
67 return 0;
68 }
69 return 1;
70 }

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

+ Here is the call graph for this function:

◆ writeQuestionSpecificPostData()

assTextQuestionGUI::writeQuestionSpecificPostData ( ilPropertyFormGUI  $form)

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

Implements ilGuiQuestionScoringAdjustable.

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

591 : void
592 {
593 $this->object->setWordCounterEnabled(isset($_POST['wordcounter']) && $_POST['wordcounter']);
594 $this->object->setMaxNumOfChars($_POST["maxchars"] ?? 0);
595 $this->object->setTextRating($_POST["text_rating"]);
596 $this->object->setKeywordRelation($_POST['scoring_mode']);
597 }

Referenced by writePostData().

+ Here is the caller graph for this function:

Field Documentation

◆ $tiny_mce_enabled

bool assTextQuestionGUI::$tiny_mce_enabled
protected

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


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