ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
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)
 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 ($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 (ilTemplate $tpl)
 
 getQuestionTemplate ()
 get question template More...
 
 getILIASPage ($html="")
 Returns the ILIAS Page around a question. More...
 
 outQuestionPage ($a_temp_var, $a_postponed=false, $active_id="", $html="", $inlineFeedbackEnabled=false)
 output question page More...
 
 cancel ()
 cancel action More...
 
 originalSyncForm ($return_to="", $return_to_feedback='')
 
 sync ()
 
 cancelSync ()
 
 saveEdit ()
 save question More...
 
 save ()
 save question More...
 
 saveReturn ()
 save question More...
 
 apply ()
 apply changes More...
 
 getContextPath ($cont_obj, $a_endnode_id, $a_startnode_id=1)
 get context path in content object tree More...
 
 setSequenceNumber ($nr)
 
 getSequenceNumber ()
 
 setQuestionCount ($a_question_count)
 
 getQuestionCount ()
 
 getErrorMessage ()
 
 setErrorMessage ($errormessage)
 
 addErrorMessage ($errormessage)
 
 outAdditionalOutput ()
 
 getQuestionType ()
 Returns the question type string. More...
 
 getAsValueAttribute ($a_value)
 Returns a HTML value attribute. More...
 
 addNewIdListener (&$a_object, $a_method, $a_parameters="")
 Add a listener that is notified with the new question ID, when a new question is saved. More...
 
 callNewIdListeners ($a_new_id)
 Call the new id listeners. More...
 
 addQuestionFormCommandButtons ($form)
 Add the command buttons of a question properties form. More...
 
 addBasicQuestionFormProperties ($form)
 Add basic question form properties: assessment: title, author, description, question, working time. More...
 
 getAnswerFeedbackOutput ($active_id, $pass)
 Returns the answer generic feedback depending on the results of the question. More...
 
 getGenericFeedbackOutput ($active_id, $pass)
 Returns the answer specific feedback for the question. More...
 
 getGenericFeedbackOutputForCorrectSolution ()
 
 getGenericFeedbackOutputForIncorrectSolution ()
 
 getSpecificFeedbackOutput ($userSolution)
 Returns the answer specific feedback for the question. More...
 
 outQuestionType ()
 
 showSuggestedSolution ()
 
 suggestedsolution ()
 Allows to add suggested solutions for questions. More...
 
 outSolutionExplorer ()
 
 saveSuggestedSolution ()
 
 cancelExplorer ()
 
 outPageSelector ()
 
 outChapterSelector ()
 
 outGlossarySelector ()
 
 linkChilds ()
 
 addPG ()
 
 addST ()
 
 addGIT ()
 
 isSaveCommand ()
 
 setQuestionTabs ()
 
 addTab_SuggestedSolution (ilTabsGUI $tabs, $classname)
 
 getEditQuestionTabCommands ()
 
 getSolutionOutput ( $active_id, $pass=null, $graphicalOutput=false, $result_output=false, $show_question_only=true, $show_feedback=false, $show_correct_solution=false, $show_manual_scoring=false, $show_question_text=true)
 
 supportsIntermediateSolutionOutput ()
 Question type specific support of intermediate solution output The function getSolutionOutput respects getUseIntermediateSolution() More...
 
 hasIntermediateSolution ($activeId, $passIndex)
 Check if the question has an intermediate solution. More...
 
 setUseIntermediateSolution ($use)
 
 getUseIntermediateSolution ()
 Get if intermediate solution should be used for solution output. More...
 
 isAutosaveable ()
 
 getPreview ($show_question_only=false, $showInlineFeedback=false)
 
 outQuestionForTest ( $formaction, $active_id, $pass, $is_question_postponed=false, $user_post_solutions=false, $show_specific_inline_feedback=false)
 
 magicAfterTestOutput ()
 
 getTestOutput ( $active_id, $pass, $is_question_postponed, $user_post_solutions, $show_specific_inline_feedback)
 
 getFormEncodingType ()
 
 setPreviewSession ($previewSession)
 
 getPreviewSession ()
 
 showHints ()
 
 buildFocusAnchorHtml ()
 
 isAnswerFreuqencyStatisticSupported ()
 
 getSubQuestionsIndex ()
 
 getAnswersFrequency ($relevantAnswers, $questionIndex)
 
 getAnswerFrequencyTableGUI ($parentGui, $parentCmd, $relevantAnswers, $questionIndex)
 
 prepareReprintableCorrectionsForm (ilPropertyFormGUI $form)
 
 populateCorrectionsFormProperties (ilPropertyFormGUI $form)
 
 saveCorrectionsFormProperties (ilPropertyFormGUI $form)
 
- Public Member Functions inherited from ilGuiQuestionScoringAdjustable
 populateQuestionSpecificFormPart (ilPropertyFormGUI $form)
 Adds the question specific forms parts to a question property form gui. More...
 
 writeQuestionSpecificPostData (ilPropertyFormGUI $form)
 Extracts the question specific values from $_POST and applies them to the data object. More...
 
 getAfterParticipationSuppressionQuestionPostVars ()
 Returns a list of postvars which will be suppressed in the form output when used in scoring adjustment. More...
 
 getAggregatedAnswersView ($relevant_answers)
 Returns an html string containing a question specific representation of the answers so far given in the test for use in the right column in the scoring adjustment user interface. More...
 
- 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 ($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
 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$

@ilCtrl_Calls 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.

33 {
34 parent::__construct();
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.
if(!array_key_exists('StateId', $_REQUEST)) $id

References $id.

Member Function Documentation

◆ addSuggestedSolution()

assTextQuestionGUI::addSuggestedSolution ( )

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

437 {
438 $_SESSION["subquestion_index"] = 0;
439 if ($_POST["cmd"]["addSuggestedSolution"]) {
440 if ($this->writePostData()) {
442 $this->editQuestion();
443 return;
444 }
445 if (!$this->checkInput()) {
446 ilUtil::sendInfo($this->lng->txt("fill_out_all_required_fields_add_answer"));
447 $this->editQuestion();
448 return;
449 }
450 }
451 $this->object->saveToDb();
452 $this->ctrl->setParameter($this, "q_id", $this->object->getId());
453 $this->tpl->setVariable("HEADER", $this->object->getTitle());
454 $this->getQuestionTemplate();
455 parent::addSuggestedSolution();
456 }
$_POST["username"]
$_SESSION["AccountId"]
getQuestionTemplate()
get question template
writePostData($always=false)
{Evaluates a posted edit form and writes the form data in the question object.integer A positive valu...
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.

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

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

@access public

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

65 {
66 $save = $this->isSaveCommand();
67 $this->getQuestionTemplate();
68
69 include_once("./Services/Form/classes/class.ilPropertyFormGUI.php");
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
82
83
85
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 }
populateTaxonomyFormSection(ilPropertyFormGUI $form)
addQuestionFormCommandButtons($form)
Add the command buttons of a question properties form.
addBasicQuestionFormProperties($form)
Add basic question form properties: assessment: title, author, description, question,...
populateQuestionSpecificFormPart(\ilPropertyFormGUI $form)
populateAnswerSpecificFormPart(\ilPropertyFormGUI $form)
This class represents a property form user interface.
$errors
Definition: index.php:6
if(isset($_POST['submit'])) $form

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

Referenced by addSuggestedSolution(), and 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 733 of file class.assTextQuestionGUI.php.

734 {
735 return array();
736 }

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

748 {
749 return array();
750 }

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

761 {
762 return ''; //print_r($relevant_answers,true);
763 }

◆ getAnswersFrequency()

assTextQuestionGUI::getAnswersFrequency (   $relevantAnswers,
  $questionIndex 
)

Reimplemented from assQuestionGUI.

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

771 {
772 }

◆ getBestAnswer()

assTextQuestionGUI::getBestAnswer (   $asHtml)
private

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

271 {
272 $answers = $this->object->getAnswers();
273 if (!count($answers)) {
274 return '';
275 }
276
277 if ($asHtml) {
278 $tplFile = 'tpl.il_as_qpl_text_question_best_solution_html.html';
279 } else {
280 $tplFile = 'tpl.il_as_qpl_text_question_best_solution_ta.html';
281 }
282
283 $tpl = new ilTemplate($tplFile, true, true, 'Modules/TestQuestionPool');
284
285 foreach ($answers as $answer) {
286 $keywordString = $answer->getAnswertext();
287
288 if (in_array($this->object->getKeywordRelation(), assTextQuestion::getScoringModesWithPointsByKeyword())) {
289 $keywordString .= ' ' . $this->lng->txt('for') . ' ';
290 $keywordString .= $answer->getPoints() . ' ' . $this->lng->txt('points');
291 }
292
293 $tpl->setCurrentBlock('keyword');
294 $tpl->setVariable('KEYWORD', $keywordString);
295 $tpl->parseCurrentBlock();
296 }
297
298 $tpl->setVariable('KEYWORD_HEADER', $this->lng->txt('solution_contain_keywords'));
299 $tpl->setVariable('SCORING_LABEL', $this->lng->txt('essay_scoring_mode') . ': ');
300
301 switch ($this->object->getKeywordRelation()) {
302 case 'any':
303 $tpl->setVariable('SCORING_MODE', $this->lng->txt('essay_scoring_mode_keyword_relation_any'));
304 break;
305 case 'all':
306 $tpl->setVariable('SCORING_MODE', $this->lng->txt('essay_scoring_mode_keyword_relation_all'));
307 break;
308 case 'one':
309 $tpl->setVariable('SCORING_MODE', $this->lng->txt('essay_scoring_mode_keyword_relation_one'));
310 break;
311 }
312
313 return $tpl->get();
314 }
static getScoringModesWithPointsByKeyword()
special template class to simplify handling of ITX/PEAR

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

Referenced by getSolutionOutput().

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

◆ getJsCode()

assTextQuestionGUI::getJsCode ( )
protected

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

419 {
420 $tpl = new ilTemplate('tpl.charcounter.html', true, true, 'Modules/TestQuestionPool');
421
422 $tpl->setCurrentBlock('tinymce_handler');
423 $tpl->touchBlock('tinymce_handler');
424 $tpl->parseCurrentBlock();
425
426 if ($this->object->getMaxNumOfChars() > 0) {
427 $tpl->setCurrentBlock('letter_counter_js');
428 $tpl->setVariable("QID", $this->object->getId());
429 $tpl->setVariable("MAXCHARS", $this->object->getMaxNumOfChars());
430 $tpl->parseCurrentBlock();
431 }
432
433 return $tpl->get();
434 }

References assQuestionGUI\$tpl.

Referenced by getPreview(), and getTestOutput().

+ Here is the caller graph for this function:

◆ getPreview()

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

Reimplemented from assQuestionGUI.

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

327 {
328 // generate the question output
329 include_once "./Services/UICore/classes/class.ilTemplate.php";
330 $template = new ilTemplate("tpl.il_as_qpl_text_question_output.html", true, true, "Modules/TestQuestionPool");
331 if ($this->object->getMaxNumOfChars()) {
332 $template->setCurrentBlock("maximum_char_hint");
333 $template->setVariable("MAXIMUM_CHAR_HINT", sprintf($this->lng->txt("text_maximum_chars_allowed"), $this->object->getMaxNumOfChars()));
334 $template->parseCurrentBlock();
335 #mbecker: No such block. $template->setCurrentBlock("has_maxchars");
336 $template->setVariable("MAXCHARS", $this->object->getMaxNumOfChars());
337 $template->parseCurrentBlock();
338 $template->setCurrentBlock("maxchars_counter");
339 $template->setVariable("QID", $this->object->getId());
340 $template->setVariable("MAXCHARS", $this->object->getMaxNumOfChars());
341 $template->setVariable("TEXTBOXSIZE", strlen($this->object->getMaxNumOfChars()));
342 $template->setVariable("CHARACTERS", $this->lng->txt("characters"));
343 $template->parseCurrentBlock();
344 }
345
346 if (is_object($this->getPreviewSession())) {
347 $template->setVariable("ESSAY", ilUtil::prepareFormOutput(
348 $this->getPreviewSession()->getParticipantsSolution()
349 ));
350 }
351
352 $questiontext = $this->object->getQuestion();
353 $template->setVariable("QUESTIONTEXT", $this->object->prepareTextareaOutput($questiontext, true));
354 $template->setVariable("QID", $this->object->getId());
355
356 $questionoutput = $template->get();
357
358 $questionoutput .= $this->getJsCode();
359
360 if (!$show_question_only) {
361 // get page object output
362 $questionoutput = $this->getILIASPage($questionoutput);
363 }
364 return $questionoutput;
365 }
getILIASPage($html="")
Returns the ILIAS Page around a question.
static prepareFormOutput($a_str, $a_strip=false)
prepares string output for html forms @access public
$template

References $template, assQuestionGUI\getILIASPage(), getJsCode(), assQuestionGUI\getPreviewSession(), and ilUtil\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
The solution output of the question as HTML code

Reimplemented from assQuestionGUI.

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

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($user_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 if (($active_id > 0) && (!$show_correct_solution)) {
210 if ($graphicalOutput) {
211 // output of ok/not ok icons for user entered solutions
212 $reached_points = $this->object->getReachedPoints($active_id, $pass);
213 if ($reached_points == $this->object->getMaximumPoints()) {
214 $template->setCurrentBlock("icon_ok");
215 $template->setVariable("ICON_OK", ilUtil::getImagePath("icon_ok.svg"));
216 $template->setVariable("TEXT_OK", $this->lng->txt("answer_is_right"));
217 $template->parseCurrentBlock();
218 } else {
219 $template->setCurrentBlock("icon_ok");
220 if ($reached_points > 0) {
221 $template->setVariable("ICON_NOT_OK", ilUtil::getImagePath("icon_mostly_ok.svg"));
222 $template->setVariable("TEXT_NOT_OK", $this->lng->txt("answer_is_not_correct_but_positive"));
223 } else {
224 $template->setVariable("ICON_NOT_OK", ilUtil::getImagePath("icon_not_ok.svg"));
225 $template->setVariable("TEXT_NOT_OK", $this->lng->txt("answer_is_wrong"));
226 }
227 $template->parseCurrentBlock();
228 }
229 }
230 }
231 if ($show_question_text == true) {
232 $template->setVariable("QUESTIONTEXT", $this->object->prepareTextareaOutput($questiontext, true));
233 }
234 $questionoutput = $template->get();
235
236 $feedback = '';
237 if ($show_feedback) {
238 if (!$this->isTestPresentationContext()) {
239 $fb = $this->getGenericFeedbackOutput($active_id, $pass);
240 $feedback .= strlen($fb) ? $fb : '';
241 }
242
243 $fb = $this->getSpecificFeedbackOutput(
244 array($user_solution => '')
245 );
246
247 $feedback .= strlen($fb) ? $fb : '';
248 }
249 if (strlen($feedback)) {
250 $cssClass = (
251 $this->hasCorrectSolution($active_id, $pass) ?
253 );
254
255 $solutiontemplate->setVariable("ILC_FB_CSS_CLASS", $cssClass);
256 $solutiontemplate->setVariable("FEEDBACK", $this->object->prepareTextareaOutput($feedback, true));
257 }
258
259 $solutiontemplate->setVariable("SOLUTION_OUTPUT", $questionoutput);
260
261 $solutionoutput = $solutiontemplate->get();
262 if (!$show_question_only) {
263 // get page object output
264 $solutionoutput = $this->getILIASPage($solutionoutput);
265 }
266 return $solutionoutput;
267 }
hasCorrectSolution($activeId, $passIndex)
getGenericFeedbackOutput($active_id, $pass)
Returns the answer specific feedback for the question.
getSpecificFeedbackOutput($userSolution)
Returns the answer specific feedback for the question.
getUserAnswer($active_id, $pass)
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)

References $pass, $template, 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().

+ Here is the call graph for this function:

◆ getSpecificFeedbackOutput()

assTextQuestionGUI::getSpecificFeedbackOutput (   $userSolution)

Returns the answer specific feedback for the question.

This method should be overwritten by the actual question.

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

Reimplemented from assQuestionGUI.

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

540 {
541 $firstValue1 = current($userSolution);
542
543 $feedback = '<table><tbody>';
544 $user_answer = ' ' . $firstValue1;
545
546 foreach ($this->object->getAnswers() as $idx => $ans) {
547 if ($this->object->isKeywordMatching($user_answer, $ans->getAnswertext())) {
548 $fb = $this->object->feedbackOBJ->getSpecificAnswerFeedbackTestPresentation(
549 $this->object->getId(),
550 0,
551 $idx
552 );
553 $feedback .= '<tr><td><b><i>' . $ans->getAnswertext() . '</i></b></td><td>';
554 $feedback .= $fb . '</td> </tr>';
555 }
556 }
557
558 $feedback .= '</tbody></table>';
559 return $this->object->prepareTextareaOutput($feedback, true);
560 }

Referenced by getSolutionOutput().

+ Here is the caller graph for this function:

◆ getTestOutput()

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

Reimplemented from assQuestionGUI.

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

368 {
369 // get the solution of the user for the active pass or from the last pass if allowed
370 $user_solution = "";
371 if ($active_id) {
372 $solutions = null;
373 // hey: prevPassSolutions - obsolete due to central check
374 #include_once "./Modules/Test/classes/class.ilObjTest.php";
375 #if (!ilObjTest::_getUsePreviousAnswers($active_id, true))
376 #{
377 # if (is_null($pass)) $pass = ilObjTest::_getPass($active_id);
378 #}
379 // hey.
380 $solutions = $this->object->getUserSolutionPreferingIntermediate($active_id, $pass);
381 foreach ($solutions as $idx => $solution_value) {
382 $user_solution = $solution_value["value1"];
383 }
384 }
385
386 // generate the question output
387 include_once "./Services/UICore/classes/class.ilTemplate.php";
388 $template = new ilTemplate("tpl.il_as_qpl_text_question_output.html", true, true, "Modules/TestQuestionPool");
389 if ($this->object->getMaxNumOfChars()) {
390 $template->setCurrentBlock("maximum_char_hint");
391 $template->setVariable("MAXIMUM_CHAR_HINT", sprintf($this->lng->txt("text_maximum_chars_allowed"), $this->object->getMaxNumOfChars()));
392 $template->parseCurrentBlock();
393 #mbecker: No such block. $template->setCurrentBlock("has_maxchars");
394 $template->setVariable("MAXCHARS", $this->object->getMaxNumOfChars());
395 $template->parseCurrentBlock();
396 $template->setCurrentBlock("maxchars_counter");
397 $template->setVariable("MAXCHARS", $this->object->getMaxNumOfChars());
398 $template->setVariable("QID", $this->object->getId());
399 $template->setVariable("TEXTBOXSIZE", strlen($this->object->getMaxNumOfChars()));
400 $template->setVariable("CHARACTERS", $this->lng->txt("characters"));
401 $template->parseCurrentBlock();
402 }
403
404 $template->setVariable("QID", $this->object->getId());
405 $template->setVariable("ESSAY", ilUtil::prepareFormOutput($user_solution));
406 $questiontext = $this->object->getQuestion();
407 $template->setVariable("QUESTIONTEXT", $this->object->prepareTextareaOutput($questiontext, true));
408 $questionoutput = $template->get();
409
410 $questionoutput .= $this->getJsCode();
411
412 $pageoutput = $this->outQuestionPage("", $is_postponed, $active_id, $questionoutput);
413 include_once "./Services/YUI/classes/class.ilYuiUtil.php";
415 return $pageoutput;
416 }
outQuestionPage($a_temp_var, $a_postponed=false, $active_id="", $html="", $inlineFeedbackEnabled=false)
output question page
static initDomEvent()
Init YUI DomEvent.

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

+ Here is the call graph for this function:

◆ getUserAnswer()

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

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

317 {
318 $user_solution = "";
319 $solutions = $this->object->getSolutionValues($active_id, $pass, !$this->getUseIntermediateSolution());
320 foreach ($solutions as $idx => $solution_value) {
321 $user_solution = $solution_value["value1"];
322 }
323 return $user_solution;
324 }
getUseIntermediateSolution()
Get if intermediate solution should be used for solution output.

References $pass, and assQuestionGUI\getUseIntermediateSolution().

Referenced by getSolutionOutput().

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

◆ isAnswerFreuqencyStatisticSupported()

assTextQuestionGUI::isAnswerFreuqencyStatisticSupported ( )

Reimplemented from assQuestionGUI.

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

766 {
767 return false;
768 }

◆ magicAfterTestOutput()

assTextQuestionGUI::magicAfterTestOutput ( )

Reimplemented from assQuestionGUI.

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

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 }
$_GET["client_id"]
static _lookupObjectId($a_ref_id)
lookup object id
static _lookupType($a_id, $a_reference=false)
lookup object type
static _getRTEClassname()

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

+ Here is the call graph for this function:

◆ outAdditionalOutput()

assTextQuestionGUI::outAdditionalOutput ( )

Reimplemented from assQuestionGUI.

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

117 {
118 }

Referenced by magicAfterTestOutput().

+ Here is the caller graph for this function:

◆ populateAnswerSpecificFormPart()

assTextQuestionGUI::populateAnswerSpecificFormPart ( \ilPropertyFormGUI  $form)

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

621 {
622 $scoringMode = new ilRadioGroupInputGUI(
623 $this->lng->txt('essay_scoring_mode'),
624 'scoring_mode'
625 );
626
627 $scoringOptionNone = new ilRadioOption(
628 $this->lng->txt('essay_scoring_mode_without_keywords'),
629 'non',
630 $this->lng->txt(
631 'essay_scoring_mode_without_keywords_desc'
632 )
633 );
634 $scoringOptionAnyKeyword = new ilRadioOption(
635 $this->lng->txt('essay_scoring_mode_keyword_relation_any'),
636 'any',
637 $this->lng->txt(
638 'essay_scoring_mode_keyword_relation_any_desc'
639 )
640 );
641 $scoringOptionAllKeyword = new ilRadioOption(
642 $this->lng->txt('essay_scoring_mode_keyword_relation_all'),
643 'all',
644 $this->lng->txt(
645 'essay_scoring_mode_keyword_relation_all_desc'
646 )
647 );
648 $scoringOptionOneKeyword = new ilRadioOption(
649 $this->lng->txt('essay_scoring_mode_keyword_relation_one'),
650 'one',
651 $this->lng->txt(
652 'essay_scoring_mode_keyword_relation_one_desc'
653 )
654 );
655
656 $scoringMode->addOption($scoringOptionNone);
657 $scoringMode->addOption($scoringOptionAnyKeyword);
658 $scoringMode->addOption($scoringOptionAllKeyword);
659 $scoringMode->addOption($scoringOptionOneKeyword);
660 $scoringMode->setRequired(true);
661 $scoringMode->setValue(
662 strlen($this->object->getKeywordRelation()) ? $this->object->getKeywordRelation(
663 ) : 'non'
664 );
665
666 if ($this->object->getAnswerCount() == 0) {
667 $this->object->addAnswer("", 1, 0, 0);
668 }
669 require_once "./Modules/TestQuestionPool/classes/class.ilEssayKeywordWizardInputGUI.php";
670
671 // Without Keywords
672 $nonKeywordPoints = new ilNumberInputGUI($this->lng->txt("points"), "non_keyword_points");
673 $nonKeywordPoints->allowDecimals(true);
674 $nonKeywordPoints->setValue($this->object->getPoints());
675 $nonKeywordPoints->setRequired(true);
676 $nonKeywordPoints->setSize(3);
677 $nonKeywordPoints->setMinValue(0.0);
678 $nonKeywordPoints->setMinvalueShouldBeGreater(true);
679 $scoringOptionNone->addSubItem($nonKeywordPoints);
680
681 // Any Keyword
682 $anyKeyword = new ilEssayKeywordWizardInputGUI($this->lng->txt("answers"), "any_keyword");
683 $anyKeyword->setRequired(true);
684 $anyKeyword->setQuestionObject($this->object);
685 $anyKeyword->setSingleline(true);
686 $anyKeyword->setValues($this->object->getAnswers());
687 $scoringOptionAnyKeyword->addSubItem($anyKeyword);
688
689 // All Keywords
690 $allKeyword = new ilTextWizardInputGUI($this->lng->txt("answers"), "all_keyword");
691 $allKeyword->setRequired(true);
692 //$allKeyword->setQuestionObject($this->object);
693 //$allKeyword->setSingleline(TRUE);
694 $allKeyword->setValues(self::buildAnswerTextOnlyArray($this->object->getAnswers()));
695 $scoringOptionAllKeyword->addSubItem($allKeyword);
696 $allKeywordPoints = new ilNumberInputGUI($this->lng->txt("points"), "all_keyword_points");
697 $allKeywordPoints->allowDecimals(true);
698 $allKeywordPoints->setValue($this->object->getPoints());
699 $allKeywordPoints->setRequired(true);
700 $allKeywordPoints->setSize(3);
701 $allKeywordPoints->setMinValue(0.0);
702 $allKeywordPoints->setMinvalueShouldBeGreater(true);
703 $scoringOptionAllKeyword->addSubItem($allKeywordPoints);
704
705 // One Keywords
706 $oneKeyword = new ilTextWizardInputGUI($this->lng->txt("answers"), "one_keyword");
707 $oneKeyword->setRequired(true);
708 //$oneKeyword->setQuestionObject($this->object);
709 //$oneKeyword->setSingleline(TRUE);
710 $oneKeyword->setValues(self::buildAnswerTextOnlyArray($this->object->getAnswers()));
711 $scoringOptionOneKeyword->addSubItem($oneKeyword);
712 $oneKeywordPoints = new ilNumberInputGUI($this->lng->txt("points"), "one_keyword_points");
713 $oneKeywordPoints->allowDecimals(true);
714 $oneKeywordPoints->setValue($this->object->getPoints());
715 $oneKeywordPoints->setRequired(true);
716 $oneKeywordPoints->setSize(3);
717 $oneKeywordPoints->setMinValue(0.0);
718 $oneKeywordPoints->setMinvalueShouldBeGreater(true);
719 $scoringOptionOneKeyword->addSubItem($oneKeywordPoints);
720
721 $form->addItem($scoringMode);
722 }
This class represents a number property in a property form.
This class represents a property in a property form.
This class represents an option in a radio group.
This class represents a text wizard property in a property form.

References $form.

Referenced by editQuestion(), and populateCorrectionsFormProperties().

+ Here is the caller graph for this function:

◆ populateCorrectionsFormProperties()

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

Reimplemented from assQuestionGUI.

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

775 {
777 $this->populateAnswerSpecificFormPart($form);
778
779 $form->removeItemByPostVar('maxchars');
780 }

References $form, populateAnswerSpecificFormPart(), and populateQuestionSpecificFormPart().

+ Here is the call graph for this function:

◆ populateQuestionSpecificFormPart()

assTextQuestionGUI::populateQuestionSpecificFormPart ( \ilPropertyFormGUI  $form)

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

592 {
593 // maxchars
594 $maxchars = new ilNumberInputGUI($this->lng->txt("maxchars"), "maxchars");
595 $maxchars->setSize(5);
596 if ($this->object->getMaxNumOfChars() > 0) {
597 $maxchars->setValue($this->object->getMaxNumOfChars());
598 }
599 $maxchars->setInfo($this->lng->txt("description_maxchars"));
600 $form->addItem($maxchars);
601
602 // text rating
603 $textrating = new ilSelectInputGUI($this->lng->txt("text_rating"), "text_rating");
604 $text_options = array(
605 "ci" => $this->lng->txt("cloze_textgap_case_insensitive"),
606 "cs" => $this->lng->txt("cloze_textgap_case_sensitive"),
607 "l1" => sprintf($this->lng->txt("cloze_textgap_levenshtein_of"), "1"),
608 "l2" => sprintf($this->lng->txt("cloze_textgap_levenshtein_of"), "2"),
609 "l3" => sprintf($this->lng->txt("cloze_textgap_levenshtein_of"), "3"),
610 "l4" => sprintf($this->lng->txt("cloze_textgap_levenshtein_of"), "4"),
611 "l5" => sprintf($this->lng->txt("cloze_textgap_levenshtein_of"), "5")
612 );
613 $textrating->setOptions($text_options);
614 $textrating->setValue($this->object->getTextRating());
615 $form->addItem($textrating);
616
617 return $form;
618 }
This class represents a selection list property in a property form.

References $form.

Referenced by editQuestion(), and populateCorrectionsFormProperties().

+ Here is the caller graph for this function:

◆ saveCorrectionsFormProperties()

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

Reimplemented from assQuestionGUI.

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

786 {
787 $this->writeQuestionSpecificPostData($form);
788 $this->writeAnswerSpecificPostData($form);
789 }
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.

References writeAnswerSpecificPostData(), and writeQuestionSpecificPostData().

+ Here is the call graph for this function:

◆ setQuestionTabs()

assTextQuestionGUI::setQuestionTabs ( )

Sets the ILIAS tabs for this question type.

@access public

Todo:
: MOVE THIS STEPS TO COMMON QUESTION CLASS assQuestionGUI

Reimplemented from assQuestionGUI.

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

466 {
467 global $DIC;
468 $rbacsystem = $DIC['rbacsystem'];
469 $ilTabs = $DIC['ilTabs'];
470
471 $ilTabs->clearTargets();
472
473 $this->ctrl->setParameterByClass("ilAssQuestionPageGUI", "q_id", $_GET["q_id"]);
474 include_once "./Modules/TestQuestionPool/classes/class.assQuestion.php";
475 $q_type = $this->object->getQuestionType();
476
477 if (strlen($q_type)) {
478 $classname = $q_type . "GUI";
479 $this->ctrl->setParameterByClass(strtolower($classname), "sel_question_types", $q_type);
480 $this->ctrl->setParameterByClass(strtolower($classname), "q_id", $_GET["q_id"]);
481 }
482
483 if ($_GET["q_id"]) {
484 if ($rbacsystem->checkAccess('write', $_GET["ref_id"])) {
485 // edit page
486 $ilTabs->addTarget(
487 "edit_page",
488 $this->ctrl->getLinkTargetByClass("ilAssQuestionPageGUI", "edit"),
489 array("edit", "insert", "exec_pg"),
490 "",
491 "",
492 $force_active
493 );
494 }
495
496 $this->addTab_QuestionPreview($ilTabs);
497 }
498
499 $force_active = false;
500 if ($rbacsystem->checkAccess('write', $_GET["ref_id"])) {
501 $url = "";
502 if ($classname) {
503 $url = $this->ctrl->getLinkTargetByClass($classname, "editQuestion");
504 }
505 // edit question properties
506 $ilTabs->addTarget(
507 "edit_question",
508 $url,
509 array("editQuestion", "save", "saveEdit", "originalSyncForm"),
510 $classname,
511 "",
512 $force_active
513 );
514 }
515
516 // add tab for question feedback within common class assQuestionGUI
517 $this->addTab_QuestionFeedback($ilTabs);
518
519 // add tab for question hint within common class assQuestionGUI
520 $this->addTab_QuestionHints($ilTabs);
521
522 // add tab for question's suggested solution within common class assQuestionGUI
523 $this->addTab_SuggestedSolution($ilTabs, $classname);
524
525 // Assessment of questions sub menu entry
526 if ($_GET["q_id"]) {
527 $ilTabs->addTarget(
528 "statistics",
529 $this->ctrl->getLinkTargetByClass($classname, "assessment"),
530 array("assessment"),
531 $classname,
532 ""
533 );
534 }
535
536 $this->addBackTab($ilTabs);
537 }
addTab_QuestionHints(ilTabsGUI $tabs)
adds the hints tab to ilTabsGUI
addTab_SuggestedSolution(ilTabsGUI $tabs, $classname)
addBackTab(ilTabsGUI $ilTabs)
addTab_QuestionFeedback(ilTabsGUI $tabs)
adds the feedback tab to ilTabsGUI
addTab_QuestionPreview(ilTabsGUI $tabsGUI)
$url
global $DIC
Definition: saml.php:7

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

+ 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

Reimplemented from assQuestionGUI.

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

570 {
571 switch ($this->object->getKeywordRelation()) {
572 case 'non':
573 $this->object->setAnswers(array());
574 $this->object->setPoints($_POST['non_keyword_points']);
575 break;
576 case 'any':
577 $this->object->setAnswers($_POST['any_keyword']);
578 $this->object->setPoints($this->object->getMaximumPoints());
579 break;
580 case 'all':
581 $this->object->setAnswers($_POST['all_keyword']);
582 $this->object->setPoints($_POST['all_keyword_points']);
583 break;
584 case 'one':
585 $this->object->setAnswers($_POST['one_keyword']);
586 $this->object->setPoints($_POST['one_keyword_points']);
587 break;
588 }
589 }

References $_POST.

Referenced by saveCorrectionsFormProperties(), and writePostData().

+ Here is the caller graph for this function:

◆ writePostData()

assTextQuestionGUI::writePostData (   $always = false)
protected

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

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

Reimplemented from assQuestionGUI.

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

46 {
47 $hasErrors = (!$always) ? $this->editQuestion(true) : false;
48 if (!$hasErrors) {
49 require_once 'Services/Form/classes/class.ilPropertyFormGUI.php';
54 return 0;
55 }
56 return 1;
57 }

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

Referenced by addSuggestedSolution().

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

563 {
564 $this->object->setMaxNumOfChars($_POST["maxchars"]);
565 $this->object->setTextRating($_POST["text_rating"]);
566 $this->object->setKeywordRelation($_POST['scoring_mode']);
567 }

References $_POST.

Referenced by saveCorrectionsFormProperties(), and writePostData().

+ Here is the caller graph for this function:

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