ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
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...
 
 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 ($active_id, $pass)
 
 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)
 
- Public Member Functions inherited from assQuestionGUI
 __construct ()
 assQuestionGUI constructor More...
 
 executeCommand ()
 execute command More...
 
 getCommand ($cmd)
 
 getType ()
 needed for page editor compliance More...
 
 getPresentationContext ()
 
 setPresentationContext ($presentationContext)
 
 isTestPresentationContext ()
 
 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="")
 output question page More...
 
 cancel ()
 cancel action More...
 
 originalSyncForm ($return_to="", $return_to_feedback='')
 
 sync ()
 
 cancelSync ()
 
 saveEdit ()
 save question More...
 
 save ()
 save question More...
 
 saveReturn ()
 save question More...
 
 apply ()
 apply changes More...
 
 getContextPath ($cont_obj, $a_endnode_id, $a_startnode_id=1)
 get context path in content object tree More...
 
 setSequenceNumber ($nr)
 
 getSequenceNumber ()
 
 setQuestionCount ($a_question_count)
 
 getQuestionCount ()
 
 getErrorMessage ()
 
 setErrorMessage ($errormessage)
 
 addErrorMessage ($errormessage)
 
 outAdditionalOutput ()
 
 getQuestionType ()
 Returns the question type string. More...
 
 getAsValueAttribute ($a_value)
 Returns a HTML value attribute. More...
 
 addNewIdListener (&$a_object, $a_method, $a_parameters="")
 Add a listener that is notified with the new question ID, when a new question is saved. More...
 
 callNewIdListeners ($a_new_id)
 Call the new id listeners. More...
 
 addQuestionFormCommandButtons ($form)
 Add the command buttons of a question properties form. More...
 
 addBasicQuestionFormProperties ($form)
 Add basic question form properties: assessment: title, author, description, question, working time. More...
 
 getAnswerFeedbackOutput ($active_id, $pass)
 Returns the answer generic feedback depending on the results of the question. More...
 
 getGenericFeedbackOutput ($active_id, $pass)
 Returns the answer specific feedback for the question. More...
 
 getGenericFeedbackOutputForCorrectSolution ()
 
 getGenericFeedbackOutputForIncorrectSolution ()
 
 getSpecificFeedbackOutput ($active_id, $pass)
 Returns the answer specific feedback for the question. More...
 
 outQuestionType ()
 
 showSuggestedSolution ()
 
 suggestedsolution ()
 Allows to add suggested solutions for questions. More...
 
 outSolutionExplorer ()
 
 saveSuggestedSolution ()
 
 cancelExplorer ()
 
 outPageSelector ()
 
 outChapterSelector ()
 
 outGlossarySelector ()
 
 linkChilds ()
 
 addPG ()
 
 addST ()
 
 addGIT ()
 
 isSaveCommand ()
 
 setQuestionTabs ()
 
 addTab_SuggestedSolution (ilTabsGUI $tabs, $classname)
 
 getEditQuestionTabCommands ()
 
 getSolutionOutput ( $active_id, $pass=null, $graphicalOutput=false, $result_output=false, $show_question_only=true, $show_feedback=false, $show_correct_solution=false, $show_manual_scoring=false, $show_question_text=true)
 
 isAutosaveable ()
 
 getPreview ($show_question_only=false, $showInlineFeedback=false)
 
 outQuestionForTest ( $formaction, $active_id, $pass, $is_question_postponed=false, $user_post_solutions=false, $show_specific_inline_feedback=false)
 
 magicAfterTestOutput ()
 
 getTestOutput ( $active_id, $pass, $is_question_postponed, $user_post_solutions, $show_specific_inline_feedback)
 
 getFormEncodingType ()
 
 setPreviewSession ($previewSession)
 
 getPreviewSession ()
 
 showHints ()
 
- Public Member Functions inherited from ilGuiQuestionScoringAdjustable
 populateQuestionSpecificFormPart (ilPropertyFormGUI $form)
 Adds the question specific forms parts to a question property form gui. More...
 
 writeQuestionSpecificPostData (ilPropertyFormGUI $form)
 Extracts the question specific values from $_POST and applies them to the data object. More...
 
 getAfterParticipationSuppressionQuestionPostVars ()
 Returns a list of postvars which will be suppressed in the form output when used in scoring adjustment. More...
 
 getAggregatedAnswersView ($relevant_answers)
 Returns an html string containing a question specific representation of the answers so far given in the test for use in the right column in the scoring adjustment user interface. More...
 
- 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
 

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

References $id.

Member Function Documentation

◆ aggregateAnswers()

assNumericGUI::aggregateAnswers (   $relevant_answers_chosen)

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

518 {
519 $aggregate = array();
520
521 foreach ($relevant_answers_chosen as $relevant_answer) {
522 if (array_key_exists($relevant_answer['value1'], $aggregate)) {
523 $aggregate[$relevant_answer['value1']]++;
524 } else {
525 $aggregate[$relevant_answer['value1']] = 1;
526 }
527 }
528 return $aggregate;
529 }

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");
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
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
Definition: index.php:6
if(isset($_POST['submit'])) $form
global $DIC
Definition: saml.php:7

References $DIC, $errors, $form, 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 483 of file class.assNumericGUI.php.

484 {
485 return array();
486 }

◆ 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 497 of file class.assNumericGUI.php.

498 {
499 return array();
500 }

◆ 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 510 of file class.assNumericGUI.php.

511 {
512 return $this->renderAggregateView(
513 $this->aggregateAnswers($relevant_answers)
514 )->get();
515 }
aggregateAnswers($relevant_answers_chosen)
renderAggregateView($aggregate)

References aggregateAnswers(), and renderAggregateView().

+ Here is the call graph for this function:

◆ 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 250 of file class.assNumericGUI.php.

251 {
252 // generate the question output
253 require_once './Services/UICore/classes/class.ilTemplate.php';
254 $template = new ilTemplate("tpl.il_as_qpl_numeric_output.html", true, true, "Modules/TestQuestionPool");
255 if (is_object($this->getPreviewSession())) {
256 $template->setVariable("NUMERIC_VALUE", " value=\"" . $this->getPreviewSession()->getParticipantsSolution() . "\"");
257 }
258 $template->setVariable("NUMERIC_SIZE", $this->object->getMaxChars());
259 $questiontext = $this->object->getQuestion();
260 $template->setVariable("QUESTIONTEXT", $this->object->prepareTextareaOutput($questiontext, true));
261 $questionoutput = $template->get();
262 if (!$show_question_only) {
263 // get page object output
264 $questionoutput = $this->getILIASPage($questionoutput);
265 }
266 return $questionoutput;
267 }
getILIASPage($html="")
Returns the ILIAS Page around a question.
special template class to simplify handling of ITX/PEAR
$template

References $template, 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 165 of file class.assNumericGUI.php.

175 {
176 // get the solution of the user for the active pass or from the last pass if allowed
177 $solutions = array();
178 if (($active_id > 0) && (!$show_correct_solution)) {
179 $solutions =&$this->object->getSolutionValues($active_id, $pass);
180 } else {
181 array_push($solutions, array("value1" => sprintf($this->lng->txt("value_between_x_and_y"), $this->object->getLowerLimit(), $this->object->getUpperLimit())));
182 }
183
184 // generate the question output
185 require_once './Services/UICore/classes/class.ilTemplate.php';
186 $template = new ilTemplate("tpl.il_as_qpl_numeric_output_solution.html", true, true, "Modules/TestQuestionPool");
187 $solutiontemplate = new ilTemplate("tpl.il_as_tst_solution_output.html", true, true, "Modules/TestQuestionPool");
188 if (is_array($solutions)) {
189 if (($active_id > 0) && (!$show_correct_solution)) {
190 if ($graphicalOutput) {
191 if ($this->object->getStep() === null) {
192 $reached_points = $this->object->getReachedPoints($active_id, $pass);
193 } else {
194 $reached_points = $this->object->calculateReachedPoints($active_id, $pass);
195 }
196 // output of ok/not ok icons for user entered solutions
197 if ($reached_points == $this->object->getMaximumPoints()) {
198 $template->setCurrentBlock("icon_ok");
199 $template->setVariable("ICON_OK", ilUtil::getImagePath("icon_ok.svg"));
200 $template->setVariable("TEXT_OK", $this->lng->txt("answer_is_right"));
201 $template->parseCurrentBlock();
202 } else {
203 $template->setCurrentBlock("icon_ok");
204 $template->setVariable("ICON_NOT_OK", ilUtil::getImagePath("icon_not_ok.svg"));
205 $template->setVariable("TEXT_NOT_OK", $this->lng->txt("answer_is_wrong"));
206 $template->parseCurrentBlock();
207 }
208 }
209 }
210 foreach ($solutions as $solution) {
211 $template->setVariable("NUMERIC_VALUE", $solution["value1"]);
212 }
213 if (count($solutions) == 0) {
214 $template->setVariable("NUMERIC_VALUE", "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;");
215 }
216 }
217 $template->setVariable("NUMERIC_SIZE", $this->object->getMaxChars());
218 $questiontext = $this->object->getQuestion();
219 if ($show_question_text==true) {
220 $template->setVariable("QUESTIONTEXT", $this->object->prepareTextareaOutput($questiontext, true));
221 }
222 $questionoutput = $template->get();
223 //$feedback = ($show_feedback) ? $this->getAnswerFeedbackOutput($active_id, $pass) : ""; // Moving new method
224 // due to deprecation.
225 $feedback = ($show_feedback && !$this->isTestPresentationContext()) ? $this->getGenericFeedbackOutput($active_id, $pass) : "";
226 if (strlen($feedback)) {
227 $cssClass = (
228 $this->hasCorrectSolution($active_id, $pass) ?
230 );
231
232 $solutiontemplate->setVariable("ILC_FB_CSS_CLASS", $cssClass);
233 $solutiontemplate->setVariable("FEEDBACK", $this->object->prepareTextareaOutput($feedback, true));
234 }
235 $solutiontemplate->setVariable("SOLUTION_OUTPUT", $questionoutput);
236
237 $solutionoutput = $solutiontemplate->get();
238 if (!$show_question_only) {
239 // get page object output
240 $solutionoutput = $this->getILIASPage($solutionoutput);
241 }
242 return $solutionoutput;
243 }
sprintf('%.4f', $callTime)
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, $template, ilAssQuestionFeedback\CSS_CLASS_FEEDBACK_CORRECT, ilAssQuestionFeedback\CSS_CLASS_FEEDBACK_WRONG, assQuestionGUI\getGenericFeedbackOutput(), assQuestionGUI\getILIASPage(), ilUtil\getImagePath(), assQuestionGUI\hasCorrectSolution(), assQuestionGUI\isTestPresentationContext(), and sprintf.

+ Here is the call graph for this function:

◆ getSpecificFeedbackOutput()

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

Reimplemented from assQuestionGUI.

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

401 {
402 $output = "";
403 return $this->object->prepareTextareaOutput($output, true);
404 }
if(!is_dir( $entity_dir)) exit("Fatal Error ([A-Za-z0-9]+)\s+" &#(? foreach( $entity_files as $file) $output

References $output.

◆ 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 278 of file class.assNumericGUI.php.

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

References $pass, $template, and assQuestionGUI\outQuestionPage().

+ Here is the call graph for this function:

◆ populateAnswerSpecificFormPart()

assNumericGUI::populateAnswerSpecificFormPart ( \ilPropertyFormGUI  $form)

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

434 {
435 // points
436 $points = new ilNumberInputGUI($this->lng->txt("points"), "points");
437 $points->allowDecimals(true);
438 $points->setValue($this->object->getPoints() > 0 ? $this->object->getPoints() : '');
439 $points->setRequired(true);
440 $points->setSize(3);
441 $points->setMinValue(0.0);
442 $points->setMinvalueShouldBeGreater(true);
443 $form->addItem($points);
444
446 $header->setTitle($this->lng->txt("range"));
447 $form->addItem($header);
448
449 // lower bound
450 $lower_limit = new ilFormulaInputGUI($this->lng->txt("range_lower_limit"), "lowerlimit");
451 $lower_limit->setSize(25);
452 $lower_limit->setMaxLength(20);
453 $lower_limit->setRequired(true);
454 $lower_limit->setValue($this->object->getLowerLimit());
455 $form->addItem($lower_limit);
456
457 // upper bound
458 $upper_limit = new ilFormulaInputGUI($this->lng->txt("range_upper_limit"), "upperlimit");
459 $upper_limit->setSize(25);
460 $upper_limit->setMaxLength(20);
461 $upper_limit->setRequired(true);
462 $upper_limit->setValue($this->object->getUpperLimit());
463 $form->addItem($upper_limit);
464
465 // reset input length, if max chars are set
466 if ($this->object->getMaxChars() > 0) {
467 $lower_limit->setSize($this->object->getMaxChars());
468 $lower_limit->setMaxLength($this->object->getMaxChars());
469 $upper_limit->setSize($this->object->getMaxChars());
470 $upper_limit->setMaxLength($this->object->getMaxChars());
471 }
472 }
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 $form, and $header.

Referenced by editQuestion().

+ Here is the caller graph for this function:

◆ populateQuestionSpecificFormPart()

assNumericGUI::populateQuestionSpecificFormPart ( \ilPropertyFormGUI  $form)

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

419 {
420 // maxchars
421 $maxchars = new ilNumberInputGUI($this->lng->txt("maxchars"), "maxchars");
422 $maxchars->setInfo($this->lng->txt('qpl_maxchars_info_numeric_question'));
423 $maxchars->setSize(10);
424 $maxchars->setDecimals(0);
425 $maxchars->setMinValue(1);
426 $maxchars->setRequired(true);
427 if ($this->object->getMaxChars() > 0) {
428 $maxchars->setValue($this->object->getMaxChars());
429 }
430 $form->addItem($maxchars);
431 }

References $form.

Referenced by editQuestion().

+ Here is the caller graph for this function:

◆ renderAggregateView()

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

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

537 {
538 $tpl = new ilTemplate('tpl.il_as_aggregated_answers_table.html', true, true, "Modules/TestQuestionPool");
539
540 $tpl->setCurrentBlock('headercell');
541 $tpl->setVariable('HEADER', $this->lng->txt('tst_answer_aggr_answer_header'));
542 $tpl->parseCurrentBlock();
543
544 $tpl->setCurrentBlock('headercell');
545 $tpl->setVariable('HEADER', $this->lng->txt('tst_answer_aggr_frequency_header'));
546 $tpl->parseCurrentBlock();
547
548 foreach ($aggregate as $key => $value) {
549 $tpl->setCurrentBlock('aggregaterow');
550 $tpl->setVariable('OPTION', $key);
551 $tpl->setVariable('COUNT', $value);
552 $tpl->parseCurrentBlock();
553 }
554 return $tpl;
555 }
$key
Definition: croninfo.php:18

References $key, and assQuestionGUI\$tpl.

Referenced by getAggregatedAnswersView().

+ Here is the caller graph for this function:

◆ 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 411 of file class.assNumericGUI.php.

412 {
413 $this->object->setLowerLimit($_POST['lowerlimit']);
414 $this->object->setUpperLimit($_POST['upperlimit']);
415 $this->object->setPoints($_POST['points']);
416 }
$_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 406 of file class.assNumericGUI.php.

407 {
408 $this->object->setMaxChars($_POST["maxchars"]);
409 }

References $_POST.

Referenced by writePostData().

+ Here is the caller graph for this function:

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