ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
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 ()
 
 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)
 
 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 {
43 $this->object->loadFromDb($id);
44 }
45 }
Class for numeric questions.

Member Function Documentation

◆ aggregateAnswers()

assNumericGUI::aggregateAnswers (   $relevant_answers_chosen)

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

540 {
541 $aggregate = array();
542
543 foreach ($relevant_answers_chosen as $relevant_answer)
544 {
545 if ( array_key_exists($relevant_answer['value1'], $aggregate) )
546 {
547 $aggregate[$relevant_answer['value1']]++;
548 }
549 else
550 {
551 $aggregate[$relevant_answer['value1']] = 1;
552 }
553 }
554 return $aggregate;
555 }

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

137 {
138 include_once "./Services/Math/classes/class.EvalMath.php";
139 $eval = new EvalMath();
140 $eval->suppress_errors = TRUE;
141 if (($eval->e($lower) !== FALSE) AND ($eval->e($upper) !== FALSE))
142 {
143 if ($eval->e($lower) <= $eval->e($upper))
144 {
145 return TRUE;
146 }
147 else
148 {
149 return FALSE;
150 }
151 }
152 return FALSE;
153 }

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

82 {
83 $save = $this->isSaveCommand();
84 $this->getQuestionTemplate();
85
86 include_once("./Services/Form/classes/class.ilPropertyFormGUI.php");
87 $form = new ilPropertyFormGUI();
88 $this->editForm = $form;
89
90 $form->setFormAction($this->ctrl->getFormAction($this));
91 $form->setTitle($this->outQuestionType());
92 $form->setMultipart(TRUE);
93 $form->setTableWidth("100%");
94 $form->setId("assnumeric");
95
96 $this->addBasicQuestionFormProperties( $form );
98 $this->populateAnswerSpecificFormPart( $form );
99 $this->populateTaxonomyFormSection($form);
100 $this->addQuestionFormCommandButtons($form);
101
102 $errors = false;
103
104 if ($save)
105 {
106 $form->setValuesByPost();
107 $errors = !$form->checkInput();
108 $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
109
110 $lower = $form->getItemByPostVar('lowerlimit');
111 $upper = $form->getItemByPostVar('upperlimit');
112
113 if( !$this->checkRange($lower->getValue(), $upper->getValue()) )
114 {
115 global $DIC;
116 $lower->setAlert($DIC->language()->txt('qpl_numeric_lower_needs_valid_lower_alert'));
117 $upper->setAlert($DIC->language()->txt('qpl_numeric_upper_needs_valid_upper_alert'));
118 ilUtil::sendFailure($DIC->language()->txt("form_input_not_valid"));
119 $errors = true;
120 }
121
122 if ($errors) $checkonly = false;
123 }
124
125 if (!$checkonly) $this->tpl->setVariable("QUESTION_DATA", $form->getHTML());
126 return $errors;
127 }
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
global $DIC

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

507 {
508 return array();
509 }

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

521 {
522 return array();
523 }

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

534 {
535 return $this->renderAggregateView(
536 $this->aggregateAnswers( $relevant_answers ) )->get();
537 }
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 47 of file class.assNumericGUI.php.

48 {
49 if (substr($cmd, 0, 6) == "delete")
50 {
51 $cmd = "delete";
52 }
53 return $cmd;
54 }
$cmd
Definition: sahs_server.php:35

References $cmd.

◆ getPreview()

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

Reimplemented from assQuestionGUI.

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

273 {
274 // generate the question output
275 require_once './Services/UICore/classes/class.ilTemplate.php';
276 $template = new ilTemplate("tpl.il_as_qpl_numeric_output.html", TRUE, TRUE, "Modules/TestQuestionPool");
277 if( is_object($this->getPreviewSession()) )
278 {
279 $template->setVariable("NUMERIC_VALUE", " value=\"".$this->getPreviewSession()->getParticipantsSolution()."\"");
280 }
281 $template->setVariable("NUMERIC_SIZE", $this->object->getMaxChars());
282 $questiontext = $this->object->getQuestion();
283 $template->setVariable("QUESTIONTEXT", $this->object->prepareTextareaOutput($questiontext, TRUE));
284 $questionoutput = $template->get();
285 if (!$show_question_only)
286 {
287 // get page object output
288 $questionoutput = $this->getILIASPage($questionoutput);
289 }
290 return $questionoutput;
291 }
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 170 of file class.assNumericGUI.php.

181 {
182 // get the solution of the user for the active pass or from the last pass if allowed
183 $solutions = array();
184 if (($active_id > 0) && (!$show_correct_solution))
185 {
186 $solutions =& $this->object->getSolutionValues($active_id, $pass);
187 }
188 else
189 {
190 array_push($solutions, array("value1" => sprintf($this->lng->txt("value_between_x_and_y"), $this->object->getLowerLimit(), $this->object->getUpperLimit())));
191 }
192
193 // generate the question output
194 require_once './Services/UICore/classes/class.ilTemplate.php';
195 $template = new ilTemplate("tpl.il_as_qpl_numeric_output_solution.html", TRUE, TRUE, "Modules/TestQuestionPool");
196 $solutiontemplate = new ilTemplate("tpl.il_as_tst_solution_output.html",TRUE, TRUE, "Modules/TestQuestionPool");
197 if (is_array($solutions))
198 {
199 if (($active_id > 0) && (!$show_correct_solution))
200 {
201 if ($graphicalOutput)
202 {
203 if($this->object->getStep() === NULL)
204 {
205 $reached_points = $this->object->getReachedPoints($active_id, $pass);
206 }
207 else
208 {
209 $reached_points = $this->object->calculateReachedPoints($active_id, $pass);
210 }
211 // output of ok/not ok icons for user entered solutions
212 if ($reached_points == $this->object->getMaximumPoints())
213 {
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 }
219 else
220 {
221 $template->setCurrentBlock("icon_ok");
222 $template->setVariable("ICON_NOT_OK", ilUtil::getImagePath("icon_not_ok.svg"));
223 $template->setVariable("TEXT_NOT_OK", $this->lng->txt("answer_is_wrong"));
224 $template->parseCurrentBlock();
225 }
226 }
227 }
228 foreach ($solutions as $solution)
229 {
230 $template->setVariable("NUMERIC_VALUE", $solution["value1"]);
231 }
232 if (count($solutions) == 0)
233 {
234 $template->setVariable("NUMERIC_VALUE", "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;");
235 }
236 }
237 $template->setVariable("NUMERIC_SIZE", $this->object->getMaxChars());
238 $questiontext = $this->object->getQuestion();
239 if ($show_question_text==true)
240 {
241 $template->setVariable("QUESTIONTEXT", $this->object->prepareTextareaOutput($questiontext, TRUE));
242 }
243 $questionoutput = $template->get();
244 //$feedback = ($show_feedback) ? $this->getAnswerFeedbackOutput($active_id, $pass) : ""; // Moving new method
245 // due to deprecation.
246 $feedback = ($show_feedback && !$this->isTestPresentationContext()) ? $this->getGenericFeedbackOutput($active_id, $pass) : "";
247 if (strlen($feedback))
248 {
249 $cssClass = ( $this->hasCorrectSolution($active_id, $pass) ?
251 );
252
253 $solutiontemplate->setVariable("ILC_FB_CSS_CLASS", $cssClass);
254 $solutiontemplate->setVariable("FEEDBACK", $this->object->prepareTextareaOutput( $feedback, true ));
255 }
256 $solutiontemplate->setVariable("SOLUTION_OUTPUT", $questionoutput);
257
258 $solutionoutput = $solutiontemplate->get();
259 if (!$show_question_only)
260 {
261 // get page object output
262 $solutionoutput = $this->getILIASPage($solutionoutput);
263 }
264 return $solutionoutput;
265 }
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, 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 421 of file class.assNumericGUI.php.

422 {
423 $output = "";
424 return $this->object->prepareTextareaOutput($output, TRUE);
425 }
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 302 of file class.assNumericGUI.php.

304 {
305 $solutions = NULL;
306 // get the solution of the user for the active pass or from the last pass if allowed
307 if($use_post_solutions !== false)
308 {
309 $solutions = array(
310 array('value1' => $use_post_solutions['numeric_result'])
311 );
312 }
313 elseif ($active_id)
314 {
315
316 // hey: prevPassSolutions - obsolete due to central check
317 #include_once "./Modules/Test/classes/class.ilObjTest.php";
318 #if (!ilObjTest::_getUsePreviousAnswers($active_id, true))
319 #{
320 # if (is_null($pass)) $pass = ilObjTest::_getPass($active_id);
321 #}
322 $solutions = $this->object->getTestOutputSolutions($active_id, $pass);
323 // hey.
324 }
325
326 // generate the question output
327 require_once './Services/UICore/classes/class.ilTemplate.php';
328 $template = new ilTemplate("tpl.il_as_qpl_numeric_output.html", TRUE, TRUE, "Modules/TestQuestionPool");
329 if (is_array($solutions))
330 {
331 foreach ($solutions as $solution)
332 {
333 $template->setVariable("NUMERIC_VALUE", " value=\"".$solution["value1"]."\"");
334 }
335 }
336 $template->setVariable("NUMERIC_SIZE", $this->object->getMaxChars());
337 $questiontext = $this->object->getQuestion();
338 $template->setVariable("QUESTIONTEXT", $this->object->prepareTextareaOutput($questiontext, TRUE));
339 $questionoutput = $template->get();
340 $pageoutput = $this->outQuestionPage("", $is_postponed, $active_id, $questionoutput);
341 return $pageoutput;
342 }
outQuestionPage($a_temp_var, $a_postponed=false, $active_id="", $html="")
output question page

References $pass, and assQuestionGUI\outQuestionPage().

+ Here is the call graph for this function:

◆ populateAnswerSpecificFormPart()

assNumericGUI::populateAnswerSpecificFormPart ( \ilPropertyFormGUI  $form)

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

456 {
457 // points
458 $points = new ilNumberInputGUI($this->lng->txt( "points" ), "points");
459 $points->allowDecimals(true);
460 $points->setValue( $this->object->getPoints() > 0 ? $this->object->getPoints() : '' );
461 $points->setRequired( TRUE );
462 $points->setSize( 3 );
463 $points->setMinValue( 0.0 );
464 $points->setMinvalueShouldBeGreater( true );
465 $form->addItem( $points );
466
468 $header->setTitle( $this->lng->txt( "range" ) );
469 $form->addItem( $header );
470
471 // lower bound
472 $lower_limit = new ilFormulaInputGUI($this->lng->txt( "range_lower_limit" ), "lowerlimit");
473 $lower_limit->setSize( 25 );
474 $lower_limit->setMaxLength( 20 );
475 $lower_limit->setRequired( true );
476 $lower_limit->setValue( $this->object->getLowerLimit() );
477 $form->addItem( $lower_limit );
478
479 // upper bound
480 $upper_limit = new ilFormulaInputGUI($this->lng->txt( "range_upper_limit" ), "upperlimit");
481 $upper_limit->setSize( 25 );
482 $upper_limit->setMaxLength( 20 );
483 $upper_limit->setRequired( true );
484 $upper_limit->setValue( $this->object->getUpperLimit() );
485 $form->addItem( $upper_limit );
486
487 // reset input length, if max chars are set
488 if( $this->object->getMaxChars() > 0 )
489 {
490 $lower_limit->setSize( $this->object->getMaxChars() );
491 $lower_limit->setMaxLength( $this->object->getMaxChars() );
492 $upper_limit->setSize( $this->object->getMaxChars() );
493 $upper_limit->setMaxLength( $this->object->getMaxChars() );
494 }
495 }
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.
$header

References $header, and ilPropertyFormGUI\addItem().

Referenced by editQuestion().

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

◆ populateQuestionSpecificFormPart()

assNumericGUI::populateQuestionSpecificFormPart ( \ilPropertyFormGUI  $form)

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

440 {
441 // maxchars
442 $maxchars = new ilNumberInputGUI($this->lng->txt( "maxchars" ), "maxchars");
443 $maxchars->setInfo($this->lng->txt('qpl_maxchars_info_numeric_question'));
444 $maxchars->setSize( 10 );
445 $maxchars->setDecimals( 0 );
446 $maxchars->setMinValue( 1 );
447 $maxchars->setRequired( true );
448 if ($this->object->getMaxChars() > 0)
449 {
450 $maxchars->setValue($this->object->getMaxChars());
451 }
452 $form->addItem( $maxchars );
453 }

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

563 {
564 $tpl = new ilTemplate('tpl.il_as_aggregated_answers_table.html', true, true, "Modules/TestQuestionPool");
565
566 $tpl->setCurrentBlock('headercell');
567 $tpl->setVariable('HEADER', $this->lng->txt('tst_answer_aggr_answer_header'));
568 $tpl->parseCurrentBlock();
569
570 $tpl->setCurrentBlock('headercell');
571 $tpl->setVariable('HEADER', $this->lng->txt('tst_answer_aggr_frequency_header'));
572 $tpl->parseCurrentBlock();
573
574 foreach ($aggregate as $key => $value)
575 {
576 $tpl->setCurrentBlock( 'aggregaterow' );
577 $tpl->setVariable( 'OPTION', $key );
578 $tpl->setVariable( 'COUNT', $value );
579 $tpl->parseCurrentBlock();
580 }
581 return $tpl;
582 }

References 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 432 of file class.assNumericGUI.php.

433 {
434 $this->object->setLowerLimit( $_POST['lowerlimit'] );
435 $this->object->setUpperLimit( $_POST['upperlimit'] );
436 $this->object->setPoints( $_POST['points'] );
437 }
$_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 59 of file class.assNumericGUI.php.

60 {
61 $hasErrors = (!$always) ? $this->editQuestion(true) : false;
62 if (!$hasErrors)
63 {
64 require_once 'Services/Form/classes/class.ilPropertyFormGUI.php';
69 return 0;
70 }
71 return 1;
72 }
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 427 of file class.assNumericGUI.php.

428 {
429 $this->object->setMaxChars( $_POST["maxchars"] );
430 }

References $_POST.

Referenced by writePostData().

+ Here is the caller graph for this function:

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