ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
assNumericGUI Class Reference

Numeric question GUI representation. More...

+ Inheritance diagram for assNumericGUI:
+ Collaboration diagram for assNumericGUI:

Public Member Functions

 __construct ($id=-1)
 assNumericGUI constructor More...
 
 getCommand ($cmd)
 
 editQuestion ($checkonly=false)
 Creates an output of the edit form for the question. More...
 
 checkRange ($lower, $upper)
 Checks the range limits. More...
 
 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, $is_postponed=false, $use_post_solutions=false, $inlineFeedback)
 
 getSpecificFeedbackOutput ($userSolution)
 
 writeQuestionSpecificPostData (ilPropertyFormGUI $form)
 Extracts the question specific values from $_POST and applies them to the data object. More...
 
 writeAnswerSpecificPostData (ilPropertyFormGUI $form)
 Extracts the answer specific values from $_POST and applies them to the data object. More...
 
 populateQuestionSpecificFormPart (\ilPropertyFormGUI $form)
 
 populateAnswerSpecificFormPart (\ilPropertyFormGUI $form)
 
 getAfterParticipationSuppressionAnswerPostVars ()
 Returns a list of postvars which will be suppressed in the form output when used in scoring adjustment. More...
 
 getAfterParticipationSuppressionQuestionPostVars ()
 Returns a list of postvars which will be suppressed in the form output when used in scoring adjustment. More...
 
 getAggregatedAnswersView ($relevant_answers)
 Returns an html string containing a question specific representation of the answers so far given in the test for use in the right column in the scoring adjustment user interface. More...
 
 aggregateAnswers ($relevant_answers_chosen)
 
 renderAggregateView ($aggregate)
 
 getAnswersFrequency ($relevantAnswers, $questionIndex)
 
 populateCorrectionsFormProperties (ilPropertyFormGUI $form)
 
 saveCorrectionsFormProperties (ilPropertyFormGUI $form)
 
- Public Member Functions inherited from assQuestionGUI
 __construct ()
 assQuestionGUI constructor More...
 
 hasInlineFeedback ()
 this method can be overwritten per question type More...
 
 addHeaderAction ()
 
 redrawHeaderAction ()
 
 getHeaderAction ()
 
 getNotesHTML ()
 
 executeCommand ()
 execute command More...
 
 getCommand ($cmd)
 
 getType ()
 needed for page editor compliance More...
 
 getPresentationContext ()
 
 setPresentationContext ($presentationContext)
 
 isTestPresentationContext ()
 
 isPreviousSolutionPrefilled ()
 
 setPreviousSolutionPrefilled ($previousSolutionPrefilled)
 
 getRenderPurpose ()
 
 setRenderPurpose ($renderPurpose)
 
 isRenderPurposePrintPdf ()
 
 isRenderPurposePreview ()
 
 isRenderPurposeInputValue ()
 
 isRenderPurposePlayback ()
 
 isRenderPurposeDemoplay ()
 
 renderPurposeSupportsFormHtml ()
 
 getEditContext ()
 
 setEditContext ($editContext)
 
 isAuthoringEditContext ()
 
 isAdjustmentEditContext ()
 
 setAdjustmentEditContext ()
 
 getNavigationGUI ()
 
 setNavigationGUI ($navigationGUI)
 
 setTaxonomyIds ($taxonomyIds)
 
 getTaxonomyIds ()
 
 setTargetGui ($linkTargetGui)
 
 setTargetGuiClass ($targetGuiClass)
 
 getTargetGuiClass ()
 
 setQuestionHeaderBlockBuilder ($questionHeaderBlockBuilder)
 
 getQuestionHeaderBlockBuilder ()
 
 setQuestionActionCmd ($questionActionCmd)
 
 getQuestionActionCmd ()
 
createQuestionGUI ($question_type, $question_id=-1)
 Creates a question gui representation. More...
 
 populateJavascriptFilesRequiredForWorkForm (ilGlobalTemplateInterface $tpl)
 
 getPresentationJavascripts ()
 
 getQuestionTemplate ()
 get question template More...
 
 getILIASPage ($html="")
 Returns the ILIAS Page around a question. More...
 
 outQuestionPage ($a_temp_var, $a_postponed=false, $active_id="", $html="", $inlineFeedbackEnabled=false)
 output question page More...
 
 cancel ()
 cancel action More...
 
 originalSyncForm ($return_to="", $return_to_feedback='')
 
 sync ()
 
 cancelSync ()
 
 saveEdit ()
 save question More...
 
 save ()
 save question More...
 
 saveReturn ()
 save question More...
 
 apply ()
 apply changes More...
 
 getContextPath ($cont_obj, $a_endnode_id, $a_startnode_id=1)
 get context path in content object tree More...
 
 setSequenceNumber ($nr)
 
 getSequenceNumber ()
 
 setQuestionCount ($a_question_count)
 
 getQuestionCount ()
 
 getErrorMessage ()
 
 setErrorMessage ($errormessage)
 
 addErrorMessage ($errormessage)
 
 outAdditionalOutput ()
 
 getQuestionType ()
 Returns the question type string. More...
 
 getAsValueAttribute ($a_value)
 Returns a HTML value attribute. More...
 
 addNewIdListener (&$a_object, $a_method, $a_parameters="")
 Add a listener that is notified with the new question ID, when a new question is saved. More...
 
 callNewIdListeners ($a_new_id)
 Call the new id listeners. More...
 
 addQuestionFormCommandButtons ($form)
 Add the command buttons of a question properties form. More...
 
 addBasicQuestionFormProperties ($form)
 Add basic question form properties: assessment: title, author, description, question, working time. More...
 
 getAnswerFeedbackOutput ($active_id, $pass)
 Returns the answer generic feedback depending on the results of the question. More...
 
 getGenericFeedbackOutput ($active_id, $pass)
 Returns the answer specific feedback for the question. More...
 
 getGenericFeedbackOutputForCorrectSolution ()
 
 getGenericFeedbackOutputForIncorrectSolution ()
 
 getSpecificFeedbackOutput ($userSolution)
 Returns the answer specific feedback for the question. More...
 
 outQuestionType ()
 
 showSuggestedSolution ()
 
 suggestedsolution ()
 Allows to add suggested solutions for questions. More...
 
 outSolutionExplorer ()
 
 saveSuggestedSolution ()
 
 cancelExplorer ()
 
 outPageSelector ()
 
 outChapterSelector ()
 
 outGlossarySelector ()
 
 linkChilds ()
 
 addPG ()
 
 addST ()
 
 addGIT ()
 
 isSaveCommand ()
 
 setQuestionTabs ()
 
 addTab_SuggestedSolution (ilTabsGUI $tabs, $classname)
 
 getEditQuestionTabCommands ()
 
 getSolutionOutput ( $active_id, $pass=null, $graphicalOutput=false, $result_output=false, $show_question_only=true, $show_feedback=false, $show_correct_solution=false, $show_manual_scoring=false, $show_question_text=true)
 
 supportsIntermediateSolutionOutput ()
 Question type specific support of intermediate solution output The function getSolutionOutput respects getUseIntermediateSolution() More...
 
 hasIntermediateSolution ($activeId, $passIndex)
 Check if the question has an intermediate solution. More...
 
 setUseIntermediateSolution ($use)
 
 getUseIntermediateSolution ()
 Get if intermediate solution should be used for solution output. More...
 
 isAutosaveable ()
 
 getPreview ($show_question_only=false, $showInlineFeedback=false)
 
 outQuestionForTest ( $formaction, $active_id, $pass, $is_question_postponed=false, $user_post_solutions=false, $show_specific_inline_feedback=false)
 
 magicAfterTestOutput ()
 
 getTestOutput ( $active_id, $pass, $is_question_postponed, $user_post_solutions, $show_specific_inline_feedback)
 
 getFormEncodingType ()
 
 setPreviewSession ($previewSession)
 
 getPreviewSession ()
 
 showHints ()
 
 buildFocusAnchorHtml ()
 
 isAnswerFreuqencyStatisticSupported ()
 
 getSubQuestionsIndex ()
 
 getAnswersFrequency ($relevantAnswers, $questionIndex)
 
 getAnswerFrequencyTableGUI ($parentGui, $parentCmd, $relevantAnswers, $questionIndex)
 
 prepareReprintableCorrectionsForm (ilPropertyFormGUI $form)
 
 populateCorrectionsFormProperties (ilPropertyFormGUI $form)
 
 saveCorrectionsFormProperties (ilPropertyFormGUI $form)
 
- Public Member Functions inherited from ilGuiQuestionScoringAdjustable
 populateQuestionSpecificFormPart (ilPropertyFormGUI $form)
 Adds the question specific forms parts to a question property form gui. More...
 
 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...
 
- 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 ()
 

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

Numeric question GUI representation.

The assNumericGUI class encapsulates the GUI representation for numeric 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
Nina Gharib nina@.nosp@m.wgse.nosp@m.rve.d.nosp@m.e
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 assNumericGUI: ilFormPropertyDispatchGUI

Definition at line 25 of file class.assNumericGUI.php.

Constructor & Destructor Documentation

◆ __construct()

assNumericGUI::__construct (   $id = -1)

assNumericGUI constructor

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

Parameters
integer$idThe database id of a Numeric question object
Returns
assNumericGUI

Definition at line 36 of file class.assNumericGUI.php.

37 {
39 require_once './Modules/TestQuestionPool/classes/class.assNumeric.php';
40 $this->object = new assNumeric();
41 if ($id >= 0) {
42 $this->object->loadFromDb($id);
43 }
44 }
Class for numeric questions.
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc

References ILIAS\GlobalScreen\Provider\__construct().

+ Here is the call graph for this function:

Member Function Documentation

◆ aggregateAnswers()

assNumericGUI::aggregateAnswers (   $relevant_answers_chosen)

Definition at line 529 of file class.assNumericGUI.php.

530 {
531 $aggregate = array();
532
533 foreach ($relevant_answers_chosen as $relevant_answer) {
534 if (array_key_exists($relevant_answer['value1'], $aggregate)) {
535 $aggregate[$relevant_answer['value1']]++;
536 } else {
537 $aggregate[$relevant_answer['value1']] = 1;
538 }
539 }
540 return $aggregate;
541 }

Referenced by getAggregatedAnswersView().

+ Here is the caller graph for this function:

◆ checkRange()

assNumericGUI::checkRange (   $lower,
  $upper 
)

Checks the range limits.

Checks the Range limits Upper and Lower for their correctness

Returns
boolean

Definition at line 135 of file class.assNumericGUI.php.

136 {
137 include_once "./Services/Math/classes/class.EvalMath.php";
138 $eval = new EvalMath();
139 $eval->suppress_errors = true;
140 if (($eval->e($lower) !== false) and ($eval->e($upper) !== false)) {
141 if ($eval->e($lower) <= $eval->e($upper)) {
142 return true;
143 } else {
144 return false;
145 }
146 }
147 return false;
148 }

Referenced by editQuestion().

+ Here is the caller graph for this function:

◆ editQuestion()

assNumericGUI::editQuestion (   $checkonly = false)

Creates an output of the edit form for the question.

Parameters
bool$checkonly
Returns
bool

Definition at line 78 of file class.assNumericGUI.php.

79 {
80 $save = $this->isSaveCommand();
81 $this->getQuestionTemplate();
82
83 include_once("./Services/Form/classes/class.ilPropertyFormGUI.php");
84 $form = new ilPropertyFormGUI();
85 $this->editForm = $form;
86
87 $form->setFormAction($this->ctrl->getFormAction($this));
88 $form->setTitle($this->outQuestionType());
89 $form->setMultipart(true);
90 $form->setTableWidth("100%");
91 $form->setId("assnumeric");
92
96 $this->populateTaxonomyFormSection($form);
98
99 $errors = false;
100
101 if ($save) {
102 $form->setValuesByPost();
103 $errors = !$form->checkInput();
104 $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
105
106 $lower = $form->getItemByPostVar('lowerlimit');
107 $upper = $form->getItemByPostVar('upperlimit');
108
109 if (!$this->checkRange($lower->getValue(), $upper->getValue())) {
110 global $DIC;
111 $lower->setAlert($DIC->language()->txt('qpl_numeric_lower_needs_valid_lower_alert'));
112 $upper->setAlert($DIC->language()->txt('qpl_numeric_upper_needs_valid_upper_alert'));
113 ilUtil::sendFailure($DIC->language()->txt("form_input_not_valid"));
114 $errors = true;
115 }
116
117 if ($errors) {
118 $checkonly = false;
119 }
120 }
121
122 if (!$checkonly) {
123 $this->tpl->setVariable("QUESTION_DATA", $form->getHTML());
124 }
125 return $errors;
126 }
checkRange($lower, $upper)
Checks the range limits.
populateQuestionSpecificFormPart(\ilPropertyFormGUI $form)
populateAnswerSpecificFormPart(\ilPropertyFormGUI $form)
populateTaxonomyFormSection(ilPropertyFormGUI $form)
addQuestionFormCommandButtons($form)
Add the command buttons of a question properties form.
getQuestionTemplate()
get question template
addBasicQuestionFormProperties($form)
Add basic question form properties: assessment: title, author, description, question,...
This class represents a property form user interface.
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
$errors
$DIC
Definition: xapitoken.php:46

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

Referenced by writePostData().

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

◆ getAfterParticipationSuppressionAnswerPostVars()

assNumericGUI::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 495 of file class.assNumericGUI.php.

496 {
497 return array();
498 }

◆ getAfterParticipationSuppressionQuestionPostVars()

assNumericGUI::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 509 of file class.assNumericGUI.php.

510 {
511 return array();
512 }

◆ getAggregatedAnswersView()

assNumericGUI::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 522 of file class.assNumericGUI.php.

523 {
524 return $this->renderAggregateView(
525 $this->aggregateAnswers($relevant_answers)
526 )->get();
527 }
aggregateAnswers($relevant_answers_chosen)
renderAggregateView($aggregate)

References aggregateAnswers(), and renderAggregateView().

+ Here is the call graph for this function:

◆ getAnswersFrequency()

assNumericGUI::getAnswersFrequency (   $relevantAnswers,
  $questionIndex 
)

Reimplemented from assQuestionGUI.

Definition at line 569 of file class.assNumericGUI.php.

570 {
571 $answers = array();
572
573 foreach ($relevantAnswers as $ans) {
574 if (!isset($answers[$ans['value1']])) {
575 $answers[$ans['value1']] = array(
576 'answer' => $ans['value1'], 'frequency' => 0
577 );
578 }
579
580 $answers[$ans['value1']]['frequency']++;
581 }
582
583 return $answers;
584 }

◆ getCommand()

assNumericGUI::getCommand (   $cmd)

Reimplemented from assQuestionGUI.

Definition at line 46 of file class.assNumericGUI.php.

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

◆ getPreview()

assNumericGUI::getPreview (   $show_question_only = false,
  $showInlineFeedback = false 
)
Parameters
bool$show_question_only
Returns
string

Reimplemented from assQuestionGUI.

Definition at line 260 of file class.assNumericGUI.php.

261 {
262 // generate the question output
263 require_once './Services/UICore/classes/class.ilTemplate.php';
264 $template = new ilTemplate("tpl.il_as_qpl_numeric_output.html", true, true, "Modules/TestQuestionPool");
265 if (is_object($this->getPreviewSession())) {
266 $template->setVariable("NUMERIC_VALUE", " value=\"" . $this->getPreviewSession()->getParticipantsSolution() . "\"");
267 }
268 $template->setVariable("NUMERIC_SIZE", $this->object->getMaxChars());
269 $questiontext = $this->object->getQuestion();
270 $template->setVariable("QUESTIONTEXT", $this->object->prepareTextareaOutput($questiontext, true));
271 $questionoutput = $template->get();
272 if (!$show_question_only) {
273 // get page object output
274 $questionoutput = $this->getILIASPage($questionoutput);
275 }
276 return $questionoutput;
277 }
getILIASPage($html="")
Returns the ILIAS Page around a question.
special template class to simplify handling of ITX/PEAR

References assQuestionGUI\getILIASPage(), and assQuestionGUI\getPreviewSession().

+ Here is the call graph for this function:

◆ getSolutionOutput()

assNumericGUI::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
bool$show_question_text
Returns
string The solution output of the question as HTML code

Reimplemented from assQuestionGUI.

Definition at line 175 of file class.assNumericGUI.php.

185 {
186 // get the solution of the user for the active pass or from the last pass if allowed
187 $solutions = array();
188 if (($active_id > 0) && (!$show_correct_solution)) {
189 $solutions = $this->object->getSolutionValues($active_id, $pass, !$this->getUseIntermediateSolution());
190 } else {
191 array_push($solutions, array("value1" => sprintf($this->lng->txt("value_between_x_and_y"), $this->object->getLowerLimit(), $this->object->getUpperLimit())));
192 }
193
194 // generate the question output
195 require_once './Services/UICore/classes/class.ilTemplate.php';
196 $template = new ilTemplate("tpl.il_as_qpl_numeric_output_solution.html", true, true, "Modules/TestQuestionPool");
197 $solutiontemplate = new ilTemplate("tpl.il_as_tst_solution_output.html", true, true, "Modules/TestQuestionPool");
198 if (is_array($solutions)) {
199 if (($active_id > 0) && (!$show_correct_solution)) {
200 if ($graphicalOutput) {
201 if ($this->object->getStep() === null) {
202 $reached_points = $this->object->getReachedPoints($active_id, $pass);
203 } else {
204 $reached_points = $this->object->calculateReachedPoints($active_id, $pass);
205 }
206 // output of ok/not ok icons for user entered solutions
207 if ($reached_points == $this->object->getMaximumPoints()) {
208 $template->setCurrentBlock("icon_ok");
209 $template->setVariable("ICON_OK", ilUtil::getImagePath("icon_ok.svg"));
210 $template->setVariable("TEXT_OK", $this->lng->txt("answer_is_right"));
211 $template->parseCurrentBlock();
212 } else {
213 $template->setCurrentBlock("icon_ok");
214 $template->setVariable("ICON_NOT_OK", ilUtil::getImagePath("icon_not_ok.svg"));
215 $template->setVariable("TEXT_NOT_OK", $this->lng->txt("answer_is_wrong"));
216 $template->parseCurrentBlock();
217 }
218 }
219 }
220 foreach ($solutions as $solution) {
221 $template->setVariable("NUMERIC_VALUE", $solution["value1"]);
222 }
223 if (count($solutions) == 0) {
224 $template->setVariable("NUMERIC_VALUE", "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;");
225 }
226 }
227 $template->setVariable("NUMERIC_SIZE", $this->object->getMaxChars());
228 $questiontext = $this->object->getQuestion();
229 if ($show_question_text == true) {
230 $template->setVariable("QUESTIONTEXT", $this->object->prepareTextareaOutput($questiontext, true));
231 }
232 $questionoutput = $template->get();
233 //$feedback = ($show_feedback) ? $this->getAnswerFeedbackOutput($active_id, $pass) : ""; // Moving new method
234 // due to deprecation.
235 $feedback = ($show_feedback && !$this->isTestPresentationContext()) ? $this->getGenericFeedbackOutput($active_id, $pass) : "";
236 if (strlen($feedback)) {
237 $cssClass = (
238 $this->hasCorrectSolution($active_id, $pass) ?
240 );
241
242 $solutiontemplate->setVariable("ILC_FB_CSS_CLASS", $cssClass);
243 $solutiontemplate->setVariable("FEEDBACK", $this->object->prepareTextareaOutput($feedback, true));
244 }
245 $solutiontemplate->setVariable("SOLUTION_OUTPUT", $questionoutput);
246
247 $solutionoutput = $solutiontemplate->get();
248 if (!$show_question_only) {
249 // get page object output
250 $solutionoutput = $this->getILIASPage($solutionoutput);
251 }
252 return $solutionoutput;
253 }
getUseIntermediateSolution()
Get if intermediate solution should be used for solution output.
hasCorrectSolution($activeId, $passIndex)
getGenericFeedbackOutput($active_id, $pass)
Returns the answer specific feedback for the question.
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)

References $pass, ilAssQuestionFeedback\CSS_CLASS_FEEDBACK_CORRECT, ilAssQuestionFeedback\CSS_CLASS_FEEDBACK_WRONG, assQuestionGUI\getGenericFeedbackOutput(), assQuestionGUI\getILIASPage(), ilUtil\getImagePath(), assQuestionGUI\getUseIntermediateSolution(), assQuestionGUI\hasCorrectSolution(), and assQuestionGUI\isTestPresentationContext().

+ Here is the call graph for this function:

◆ getSpecificFeedbackOutput()

assNumericGUI::getSpecificFeedbackOutput (   $userSolution)
Parameters
int$active_id
int$pass
Returns
mixed|string

Reimplemented from assQuestionGUI.

Definition at line 412 of file class.assNumericGUI.php.

413 {
414 $output = "";
415 return $this->object->prepareTextareaOutput($output, true);
416 }

◆ getTestOutput()

assNumericGUI::getTestOutput (   $active_id,
  $pass,
  $is_postponed = false,
  $use_post_solutions = false,
  $inlineFeedback 
)
Parameters
integer$active_id
integer | null$pass
bool$is_postponed
bool$use_post_solutions
Returns
string

Reimplemented from assQuestionGUI.

Definition at line 288 of file class.assNumericGUI.php.

290 {
291 $solutions = null;
292 // get the solution of the user for the active pass or from the last pass if allowed
293 if ($use_post_solutions !== false) {
294 $solutions = array(
295 array('value1' => $use_post_solutions['numeric_result'])
296 );
297 } elseif ($active_id) {
298
299 // hey: prevPassSolutions - obsolete due to central check
300 #include_once "./Modules/Test/classes/class.ilObjTest.php";
301 #if (!ilObjTest::_getUsePreviousAnswers($active_id, true))
302 #{
303 # if (is_null($pass)) $pass = ilObjTest::_getPass($active_id);
304 #}
305 $solutions = $this->object->getTestOutputSolutions($active_id, $pass);
306 // hey.
307 }
308
309 // generate the question output
310 require_once './Services/UICore/classes/class.ilTemplate.php';
311 $template = new ilTemplate("tpl.il_as_qpl_numeric_output.html", true, true, "Modules/TestQuestionPool");
312 if (is_array($solutions)) {
313 foreach ($solutions as $solution) {
314 $template->setVariable("NUMERIC_VALUE", " value=\"" . $solution["value1"] . "\"");
315 }
316 }
317 $template->setVariable("NUMERIC_SIZE", $this->object->getMaxChars());
318 $questiontext = $this->object->getQuestion();
319 $template->setVariable("QUESTIONTEXT", $this->object->prepareTextareaOutput($questiontext, true));
320 $questionoutput = $template->get();
321 $pageoutput = $this->outQuestionPage("", $is_postponed, $active_id, $questionoutput);
322 return $pageoutput;
323 }
outQuestionPage($a_temp_var, $a_postponed=false, $active_id="", $html="", $inlineFeedbackEnabled=false)
output question page

References $pass, and assQuestionGUI\outQuestionPage().

+ Here is the call graph for this function:

◆ populateAnswerSpecificFormPart()

assNumericGUI::populateAnswerSpecificFormPart ( \ilPropertyFormGUI  $form)

Definition at line 445 of file class.assNumericGUI.php.

446 {
447 // points
448 $points = new ilNumberInputGUI($this->lng->txt("points"), "points");
449 $points->allowDecimals(true);
450 $points->setValue($this->object->getPoints() > 0 ? $this->object->getPoints() : '');
451 $points->setRequired(true);
452 $points->setSize(3);
453 $points->setMinValue(0.0);
454 $points->setMinvalueShouldBeGreater(true);
455 $form->addItem($points);
456
457 $header = new ilFormSectionHeaderGUI();
458 $header->setTitle($this->lng->txt("range"));
459 $form->addItem($header);
460
461 // lower bound
462 $lower_limit = new ilFormulaInputGUI($this->lng->txt("range_lower_limit"), "lowerlimit");
463 $lower_limit->setSize(25);
464 $lower_limit->setMaxLength(20);
465 $lower_limit->setRequired(true);
466 $lower_limit->setValue($this->object->getLowerLimit());
467 $form->addItem($lower_limit);
468
469 // upper bound
470 $upper_limit = new ilFormulaInputGUI($this->lng->txt("range_upper_limit"), "upperlimit");
471 $upper_limit->setSize(25);
472 $upper_limit->setMaxLength(20);
473 $upper_limit->setRequired(true);
474 $upper_limit->setValue($this->object->getUpperLimit());
475 $form->addItem($upper_limit);
476
477 // reset input length, if max chars are set
478 if ($this->object->getMaxChars() > 0) {
479 $lower_limit->setSize($this->object->getMaxChars());
480 $lower_limit->setMaxLength($this->object->getMaxChars());
481 $upper_limit->setSize($this->object->getMaxChars());
482 $upper_limit->setMaxLength($this->object->getMaxChars());
483 }
484 }
This class represents a section header in a property form.
This class represents a formula text property in a property form.
This class represents a number property in a property form.

References ilPropertyFormGUI\addItem().

Referenced by editQuestion().

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

◆ populateCorrectionsFormProperties()

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

Reimplemented from assQuestionGUI.

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

587 {
588 // points
589 $points = new ilNumberInputGUI($this->lng->txt("points"), "points");
590 $points->allowDecimals(true);
591 $points->setValue($this->object->getPoints() > 0 ? $this->object->getPoints() : '');
592 $points->setRequired(true);
593 $points->setSize(3);
594 $points->setMinValue(0.0);
595 $points->setMinvalueShouldBeGreater(true);
596 $form->addItem($points);
597
598 $header = new ilFormSectionHeaderGUI();
599 $header->setTitle($this->lng->txt("range"));
600 $form->addItem($header);
601
602 // lower bound
603 $lower_limit = new ilFormulaInputGUI($this->lng->txt("range_lower_limit"), "lowerlimit");
604 $lower_limit->setSize(25);
605 $lower_limit->setMaxLength(20);
606 $lower_limit->setRequired(true);
607 $lower_limit->setValue($this->object->getLowerLimit());
608 $form->addItem($lower_limit);
609
610 // upper bound
611 $upper_limit = new ilFormulaInputGUI($this->lng->txt("range_upper_limit"), "upperlimit");
612 $upper_limit->setSize(25);
613 $upper_limit->setMaxLength(20);
614 $upper_limit->setRequired(true);
615 $upper_limit->setValue($this->object->getUpperLimit());
616 $form->addItem($upper_limit);
617
618 // reset input length, if max chars are set
619 if ($this->object->getMaxChars() > 0) {
620 $lower_limit->setSize($this->object->getMaxChars());
621 $lower_limit->setMaxLength($this->object->getMaxChars());
622 $upper_limit->setSize($this->object->getMaxChars());
623 $upper_limit->setMaxLength($this->object->getMaxChars());
624 }
625 }
addItem($a_item)
Add Item (Property, SectionHeader).

References ilPropertyFormGUI\addItem().

+ Here is the call graph for this function:

◆ populateQuestionSpecificFormPart()

assNumericGUI::populateQuestionSpecificFormPart ( \ilPropertyFormGUI  $form)

Definition at line 430 of file class.assNumericGUI.php.

431 {
432 // maxchars
433 $maxchars = new ilNumberInputGUI($this->lng->txt("maxchars"), "maxchars");
434 $maxchars->setInfo($this->lng->txt('qpl_maxchars_info_numeric_question'));
435 $maxchars->setSize(10);
436 $maxchars->setDecimals(0);
437 $maxchars->setMinValue(1);
438 $maxchars->setRequired(true);
439 if ($this->object->getMaxChars() > 0) {
440 $maxchars->setValue($this->object->getMaxChars());
441 }
442 $form->addItem($maxchars);
443 }

References ilPropertyFormGUI\addItem().

Referenced by editQuestion().

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

◆ renderAggregateView()

assNumericGUI::renderAggregateView (   $aggregate)
Parameters
$aggregate
Returns
ilTemplate

Definition at line 548 of file class.assNumericGUI.php.

549 {
550 $tpl = new ilTemplate('tpl.il_as_aggregated_answers_table.html', true, true, "Modules/TestQuestionPool");
551
552 $tpl->setCurrentBlock('headercell');
553 $tpl->setVariable('HEADER', $this->lng->txt('tst_answer_aggr_answer_header'));
554 $tpl->parseCurrentBlock();
555
556 $tpl->setCurrentBlock('headercell');
557 $tpl->setVariable('HEADER', $this->lng->txt('tst_answer_aggr_frequency_header'));
558 $tpl->parseCurrentBlock();
559
560 foreach ($aggregate as $key => $value) {
561 $tpl->setCurrentBlock('aggregaterow');
562 $tpl->setVariable('OPTION', $key);
563 $tpl->setVariable('COUNT', $value);
564 $tpl->parseCurrentBlock();
565 }
566 return $tpl;
567 }

References assQuestionGUI\$tpl.

Referenced by getAggregatedAnswersView().

+ Here is the caller graph for this function:

◆ saveCorrectionsFormProperties()

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

Reimplemented from assQuestionGUI.

Definition at line 630 of file class.assNumericGUI.php.

631 {
632 $this->object->setPoints((float) $form->getInput('points'));
633 $this->object->setLowerLimit((float) $form->getInput('lowerlimit'));
634 $this->object->setUpperLimit((float) $form->getInput('upperlimit'));
635 }
getInput($a_post_var, $ensureValidation=true)
Returns the value of a HTTP-POST variable, identified by the passed id.

References ilPropertyFormGUI\getInput().

+ Here is the call graph for this function:

◆ supportsIntermediateSolutionOutput()

assNumericGUI::supportsIntermediateSolutionOutput ( )

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

Returns
bool

Reimplemented from assQuestionGUI.

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

156 {
157 return true;
158 }

◆ writeAnswerSpecificPostData()

assNumericGUI::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 423 of file class.assNumericGUI.php.

424 {
425 $this->object->setLowerLimit($_POST['lowerlimit']);
426 $this->object->setUpperLimit($_POST['upperlimit']);
427 $this->object->setPoints($_POST['points']);
428 }
$_POST["username"]

References $_POST.

Referenced by writePostData().

+ Here is the caller graph for this function:

◆ writePostData()

assNumericGUI::writePostData (   $always = false)
protected

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

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

Reimplemented from assQuestionGUI.

Definition at line 57 of file class.assNumericGUI.php.

58 {
59 $hasErrors = (!$always) ? $this->editQuestion(true) : false;
60 if (!$hasErrors) {
61 require_once 'Services/Form/classes/class.ilPropertyFormGUI.php';
66 return 0;
67 }
68 return 1;
69 }
writeAnswerSpecificPostData(ilPropertyFormGUI $form)
Extracts the answer specific values from $_POST and applies them to the data object.
writeQuestionSpecificPostData(ilPropertyFormGUI $form)
Extracts the question specific values from $_POST and applies them to the data object.
editQuestion($checkonly=false)
Creates an output of the edit form for the question.

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

+ Here is the call graph for this function:

◆ writeQuestionSpecificPostData()

assNumericGUI::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 418 of file class.assNumericGUI.php.

419 {
420 $this->object->setMaxChars($_POST["maxchars"]);
421 }

References $_POST.

Referenced by writePostData().

+ Here is the caller graph for this function:

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