ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5
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)
 
 writePostData ($always=false)
 Evaluates a posted edit form and writes the form data in the question object. More...
 
 editQuestion ($checkonly=FALSE)
 Creates an output of the edit form for the question. More...
 
 checkRange ()
 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)
 
 getOutputMode ()
 
 setOutputMode ($outputMode)
 
 isPdfOutputMode ()
 
 isContentEditingOutputMode ()
 
 getNavigationGUI ()
 
 setNavigationGUI ($navigationGUI)
 
 setTaxonomyIds ($taxonomyIds)
 
 getTaxonomyIds ()
 
 setTargetGui ($linkTargetGui)
 
 setTargetGuiClass ($targetGuiClass)
 
 getTargetGuiClass ()
 
 setQuestionHeaderBlockBuilder ($questionHeaderBlockBuilder)
 
 setQuestionActionCmd ($questionActionCmd)
 
 getQuestionActionCmd ()
 
_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...
 
 _getGUIClassNameForId ($a_q_id)
 
 _getClassNameForQType ($q_type)
 
createQuestionGUI ($question_type, $question_id=-1)
 Creates a question gui representation. More...
 
 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...
 
- Public Member Functions inherited from ilGuiAnswerScoringAdjustable
 populateAnswerSpecificFormPart (ilPropertyFormGUI $form)
 Adds the answer specific form parts to a question property form gui. More...
 

Additional Inherited Members

- Static Public Member Functions inherited from assQuestionGUI
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 OUTPUT_MODE_SCREEN = 'outModeScreen'
 
const OUTPUT_MODE_PDF = 'outModePdf'
 
const OUTPUT_MODE_CONTENT_EDITING = 'outModeUsrSol'
 
- Protected Member Functions inherited from assQuestionGUI
 writePostData ()
 Evaluates a posted edit form and writes the form data in the question object. More...
 
 getPreviousSolutionProvidedMessage ()
 
 saveTaxonomyAssignments ()
 
 populateTaxonomyFormSection (ilPropertyFormGUI $form)
 
 isLastSolutionSubmitAuthorized ($active_id, $pass)
 fetches solutions from database and prefers intermediate solutions, but falls back to authorized solutions. More...
 
 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)
 
 getTestOutputSolutions ($activeId, $pass)
 
 addBackTab (ilTabsGUI $ilTabs)
 
 buildBasicEditFormObject ()
 

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$

Definition at line 24 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 35 of file class.assNumericGUI.php.

36  {
37  parent::__construct();
38  require_once './Modules/TestQuestionPool/classes/class.assNumeric.php';
39  $this->object = new assNumeric();
40  if ($id >= 0)
41  {
42  $this->object->loadFromDb($id);
43  }
44  }
Class for numeric questions.

Member Function Documentation

◆ aggregateAnswers()

assNumericGUI::aggregateAnswers (   $relevant_answers_chosen)

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

Referenced by getAggregatedAnswersView().

522  {
523  $aggregate = array();
524 
525  foreach ($relevant_answers_chosen as $relevant_answer)
526  {
527  if ( array_key_exists($relevant_answer['value1'], $aggregate) )
528  {
529  $aggregate[$relevant_answer['value1']]++;
530  }
531  else
532  {
533  $aggregate[$relevant_answer['value1']] = 1;
534  }
535  }
536  return $aggregate;
537  }
+ Here is the caller graph for this function:

◆ checkRange()

assNumericGUI::checkRange ( )

Checks the range limits.

Checks the Range limits Upper and Lower for their correctness

Returns
boolean

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

References $_POST.

125  {
126  include_once "./Services/Math/classes/class.EvalMath.php";
127  $eval = new EvalMath();
128  $eval->suppress_errors = TRUE;
129  if (($eval->e($_POST["rang_lower_limit"]) !== FALSE) AND ($eval->e($_POST ["range_upper_limit"]) !== FALSE))
130  {
131  if ($eval->e($_POST["rang_lower_limit"]) < $eval->e($_POST["range_upper_limit"]))
132  {
133  return TRUE;
134  }
135  else
136  {
137  return FALSE;
138  }
139  }
140  return FALSE;
141  }
$_POST['username']
Definition: cron.php:12

◆ editQuestion()

assNumericGUI::editQuestion (   $checkonly = FALSE)

Creates an output of the edit form for the question.

Parameters
bool$checkonly
Returns
bool

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

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

Referenced by writePostData().

85  {
86  $save = $this->isSaveCommand();
87  $this->getQuestionTemplate();
88 
89  include_once("./Services/Form/classes/class.ilPropertyFormGUI.php");
90  $form = new ilPropertyFormGUI();
91  $form->setFormAction($this->ctrl->getFormAction($this));
92  $form->setTitle($this->outQuestionType());
93  $form->setMultipart(TRUE);
94  $form->setTableWidth("100%");
95  $form->setId("assnumeric");
96 
97  $this->addBasicQuestionFormProperties( $form );
98  $this->populateQuestionSpecificFormPart( $form );
99  $this->populateAnswerSpecificFormPart( $form );
100  $this->populateTaxonomyFormSection($form);
101  $this->addQuestionFormCommandButtons($form);
102 
103  $errors = false;
104 
105  if ($save)
106  {
107  $form->setValuesByPost();
108  $errors = !$form->checkInput();
109  $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
110  if ($errors) $checkonly = false;
111  }
112 
113  if (!$checkonly) $this->tpl->setVariable("QUESTION_DATA", $form->getHTML());
114  return $errors;
115  }
addBasicQuestionFormProperties($form)
Add basic question form properties: assessment: title, author, description, question, working time.
This class represents a property form user interface.
getQuestionTemplate()
get question template
populateTaxonomyFormSection(ilPropertyFormGUI $form)
populateQuestionSpecificFormPart(\ilPropertyFormGUI $form)
$errors
populateAnswerSpecificFormPart(\ilPropertyFormGUI $form)
addQuestionFormCommandButtons($form)
Add the command buttons of a question properties form.
+ 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 488 of file class.assNumericGUI.php.

489  {
490  return array();
491  }

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

503  {
504  return array();
505  }

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

References aggregateAnswers(), and renderAggregateView().

516  {
517  return $this->renderAggregateView(
518  $this->aggregateAnswers( $relevant_answers ) )->get();
519  }
aggregateAnswers($relevant_answers_chosen)
renderAggregateView($aggregate)
+ Here is the call graph for this function:

◆ getCommand()

assNumericGUI::getCommand (   $cmd)

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

References $cmd.

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

◆ getPreview()

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

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

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

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  {
267  $template->setVariable("NUMERIC_VALUE", " value=\"".$this->getPreviewSession()->getParticipantsSolution()."\"");
268  }
269  $template->setVariable("NUMERIC_SIZE", $this->object->getMaxChars());
270  $questiontext = $this->object->getQuestion();
271  $template->setVariable("QUESTIONTEXT", $this->object->prepareTextareaOutput($questiontext, TRUE));
272  $questionoutput = $template->get();
273  if (!$show_question_only)
274  {
275  // get page object output
276  $questionoutput = $this->getILIASPage($questionoutput);
277  }
278  return $questionoutput;
279  }
getILIASPage($html="")
Returns the ILIAS Page around a question.
special template class to simplify handling of ITX/PEAR
+ 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

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

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

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

◆ getSpecificFeedbackOutput()

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

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

404  {
405  $output = "";
406  return $this->object->prepareTextareaOutput($output, TRUE);
407  }

◆ 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

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

References $_GET, $pass, $url, assQuestionGUI\addBackTab(), assQuestionGUI\addTab_QuestionFeedback(), assQuestionGUI\addTab_QuestionHints(), assQuestionGUI\addTab_QuestionPreview(), assQuestionGUI\addTab_SuggestedSolution(), assQuestionGUI\getTestOutputSolutions(), assQuestionGUI\outQuestionPage(), and assQuestionGUI\setQuestionTabs().

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

◆ populateAnswerSpecificFormPart()

assNumericGUI::populateAnswerSpecificFormPart ( \ilPropertyFormGUI  $form)

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

References $header, ilPropertyFormGUI\addItem(), ilNumberInputGUI\allowDecimals(), and ilTextInputGUI\setSize().

Referenced by editQuestion().

438  {
439  // points
440  $points = new ilNumberInputGUI($this->lng->txt( "points" ), "points");
441  $points->allowDecimals(true);
442  $points->setValue( $this->object->getPoints() > 0 ? $this->object->getPoints() : '' );
443  $points->setRequired( TRUE );
444  $points->setSize( 3 );
445  $points->setMinValue( 0.0 );
446  $points->setMinvalueShouldBeGreater( true );
447  $form->addItem( $points );
448 
450  $header->setTitle( $this->lng->txt( "range" ) );
451  $form->addItem( $header );
452 
453  // lower bound
454  $lower_limit = new ilFormulaInputGUI($this->lng->txt( "range_lower_limit" ), "lowerlimit");
455  $lower_limit->setSize( 25 );
456  $lower_limit->setMaxLength( 20 );
457  $lower_limit->setRequired( true );
458  $lower_limit->setValue( $this->object->getLowerLimit() );
459  $form->addItem( $lower_limit );
460 
461  // upper bound
462  $upper_limit = new ilFormulaInputGUI($this->lng->txt( "range_upper_limit" ), "upperlimit");
463  $upper_limit->setSize( 25 );
464  $upper_limit->setMaxLength( 20 );
465  $upper_limit->setRequired( true );
466  $upper_limit->setValue( $this->object->getUpperLimit() );
467  $form->addItem( $upper_limit );
468 
469  // reset input length, if max chars are set
470  if( $this->object->getMaxChars() > 0 )
471  {
472  $lower_limit->setSize( $this->object->getMaxChars() );
473  $lower_limit->setMaxLength( $this->object->getMaxChars() );
474  $upper_limit->setSize( $this->object->getMaxChars() );
475  $upper_limit->setMaxLength( $this->object->getMaxChars() );
476  }
477  }
This class represents a formula text property in a property form.
This class represents a section header in a property form.
allowDecimals($a_value)
Toggle Decimals.
$header
This class represents a number property in a property form.
setSize($a_size)
Set Size.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ populateQuestionSpecificFormPart()

assNumericGUI::populateQuestionSpecificFormPart ( \ilPropertyFormGUI  $form)

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

References ilPropertyFormGUI\addItem(), and ilFormPropertyGUI\setInfo().

Referenced by editQuestion().

422  {
423  // maxchars
424  $maxchars = new ilNumberInputGUI($this->lng->txt( "maxchars" ), "maxchars");
425  $maxchars->setInfo($this->lng->txt('qpl_maxchars_info_numeric_question'));
426  $maxchars->setSize( 10 );
427  $maxchars->setDecimals( 0 );
428  $maxchars->setMinValue( 1 );
429  $maxchars->setRequired( true );
430  if ($this->object->getMaxChars() > 0)
431  {
432  $maxchars->setValue($this->object->getMaxChars());
433  }
434  $form->addItem( $maxchars );
435  }
setInfo($a_info)
Set Information Text.
This class represents a number property in a property form.
+ 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 544 of file class.assNumericGUI.php.

References assQuestionGUI\$tpl.

Referenced by getAggregatedAnswersView().

545  {
546  $tpl = new ilTemplate('tpl.il_as_aggregated_answers_table.html', true, true, "Modules/TestQuestionPool");
547 
548  $tpl->setCurrentBlock('headercell');
549  $tpl->setVariable('HEADER', $this->lng->txt('tst_answer_aggr_answer_header'));
550  $tpl->parseCurrentBlock();
551 
552  $tpl->setCurrentBlock('headercell');
553  $tpl->setVariable('HEADER', $this->lng->txt('tst_answer_aggr_frequency_header'));
554  $tpl->parseCurrentBlock();
555 
556  foreach ($aggregate as $key => $value)
557  {
558  $tpl->setCurrentBlock( 'aggregaterow' );
559  $tpl->setVariable( 'OPTION', $key );
560  $tpl->setVariable( 'COUNT', $value );
561  $tpl->parseCurrentBlock();
562  }
563  return $tpl;
564  }
special template class to simplify handling of ITX/PEAR
+ 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 414 of file class.assNumericGUI.php.

References $_POST.

Referenced by writePostData().

415  {
416  $this->object->setLowerLimit( $_POST['lowerlimit'] );
417  $this->object->setUpperLimit( $_POST['upperlimit'] );
418  $this->object->setPoints( $_POST['points'] );
419  }
$_POST['username']
Definition: cron.php:12
+ Here is the caller graph for this function:

◆ writePostData()

assNumericGUI::writePostData (   $always = false)

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

Parameters
bool$always
Returns
integer A positive value, if one of the required fields wasn't set, else 0

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

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

63  {
64  $hasErrors = (!$always) ? $this->editQuestion(true) : false;
65  if (!$hasErrors)
66  {
67  require_once 'Services/Form/classes/class.ilPropertyFormGUI.php';
71  $this->saveTaxonomyAssignments();
72  return 0;
73  }
74  return 1;
75  }
This class represents a property form user interface.
writeQuestionSpecificPostData(ilPropertyFormGUI $form)
Extracts the question specific values from $_POST and applies them to the data object.
writeAnswerSpecificPostData(ilPropertyFormGUI $form)
Extracts the answer specific values from $_POST and applies them to the data object.
editQuestion($checkonly=FALSE)
Creates an output of the edit form for the question.
+ 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 409 of file class.assNumericGUI.php.

References $_POST.

Referenced by writePostData().

410  {
411  $this->object->setMaxChars( $_POST["maxchars"] );
412  }
$_POST['username']
Definition: cron.php:12
+ Here is the caller graph for this function:

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