ILIAS  release_4-4 Revision
All Data Structures Namespaces Files Functions Variables Modules Pages
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...
 
 outQuestionForTest ($formaction, $active_id, $pass=NULL, $is_postponed=FALSE, $use_post_solutions=FALSE)
 
 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)
 
 getTestOutput ($active_id, $pass=NULL, $is_postponed=FALSE, $use_post_solutions=FALSE)
 
 getSpecificFeedbackOutput ($active_id, $pass)
 
 writeQuestionSpecificPostData ($always=false)
 Extracts the question specific values from $_POST and applies them to the data object. More...
 
 writeAnswerSpecificPostData ($always=false)
 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...
 
 resetFormValuesForSuppressedPostvars ($form)
 
 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...
 
 setTaxonomyIds ($taxonomyIds)
 
 getTaxonomyIds ()
 
 setTargetGui (ilTestPlayerAbstractGUI $linkTargetGui)
 
 setTargetGuiClass ($targetGuiClass)
 
 getTargetGuiClass ()
 
 writePostData ()
 Evaluates a posted edit form and writes the form data in the question object. More...
 
 assessment ()
 output assessment More...
 
_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...
 
 getSelfAssessmentTags ()
 Get tags allowed in question tags in self assessment mode. 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...
 
 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 ()
 
 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 ()
 
 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'
 
 $object
 
 $tpl
 
 $lng
 
 $error
 
 $errormessage
 
 $sequence_no
 sequence number in test More...
 
 $question_count
 question count in test More...
 
- Protected Member Functions inherited from assQuestionGUI
 saveTaxonomyAssignments ()
 
 populateTaxonomyFormSection (ilPropertyFormGUI $form)
 
 addTab_QuestionFeedback (ilTabsGUI $tabs)
 adds the feedback tab to ilTabsGUI More...
 
 addTab_QuestionHints (ilTabsGUI $tabs)
 adds the hints tab to ilTabsGUI More...
 
 writeQuestionGenericPostData ()
 

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

Referenced by getAggregatedAnswersView().

561  {
562  $aggregate = array();
563 
564  foreach ($relevant_answers_chosen as $relevant_answer)
565  {
566  if ( array_key_exists($relevant_answer['value1'], $aggregate) )
567  {
568  $aggregate[$relevant_answer['value1']]++;
569  }
570  else
571  {
572  $aggregate[$relevant_answer['value1']] = 1;
573  }
574  }
575  return $aggregate;
576  }
+ 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 123 of file class.assNumericGUI.php.

References $_POST.

124  {
125  include_once "./Services/Math/classes/class.EvalMath.php";
126  $eval = new EvalMath();
127  $eval->suppress_errors = TRUE;
128  if (($eval->e($_POST["rang_lower_limit"]) !== FALSE) AND ($eval->e($_POST ["range_upper_limit"]) !== FALSE))
129  {
130  if ($eval->e($_POST["rang_lower_limit"]) < $eval->e($_POST["range_upper_limit"]))
131  {
132  return TRUE;
133  }
134  else
135  {
136  return FALSE;
137  }
138  }
139  return FALSE;
140  }
$_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 83 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().

84  {
85  $save = $this->isSaveCommand();
86  $this->getQuestionTemplate();
87 
88  include_once("./Services/Form/classes/class.ilPropertyFormGUI.php");
89  $form = new ilPropertyFormGUI();
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 );
97  $this->populateQuestionSpecificFormPart( $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  if ($errors) $checkonly = false;
110  }
111 
112  if (!$checkonly) $this->tpl->setVariable("QUESTION_DATA", $form->getHTML());
113  return $errors;
114  }
addBasicQuestionFormProperties($form)
Add basic question form properties: assessment: title, author, description, question, working time.
This class represents a property form user interface.
$errors
getQuestionTemplate()
get question template
populateTaxonomyFormSection(ilPropertyFormGUI $form)
populateQuestionSpecificFormPart(\ilPropertyFormGUI $form)
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 508 of file class.assNumericGUI.php.

509  {
510  return array();
511  }

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

523  {
524  return array('maxchars');
525  }

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

References $pass, assQuestionGUI\$tpl, aggregateAnswers(), and renderAggregateView().

542  {
543  $passcount = count($relevant_answers);
544  foreach($relevant_answers as $pass)
545  {
546  $actives[$pass['active_fi']] = $pass['active_fi'];
547  }
548  $usercount = count($actives);
549  $tpl = new ilTemplate('tpl.il_as_aggregated_answers_header.html', true, true, "Modules/TestQuestionPool");
550  $tpl->setVariable('HEADERTEXT', $this->lng->txt('overview'));
551  $tpl->setVariable('NUMBER_OF_USERS_INFO', $this->lng->txt('number_of_users'));
552  $tpl->setVariable('NUMBER_OF_USERS', $usercount);
553  $tpl->setVariable('NUMBER_OF_PASSES_INFO', $this->lng->txt('number_of_passes'));
554  $tpl->setVariable('NUMBER_OF_PASSES', $passcount);
555 
556  return $tpl->get() . $this->renderAggregateView(
557  $this->aggregateAnswers( $relevant_answers ) )->get();
558  }
aggregateAnswers($relevant_answers_chosen)
special template class to simplify handling of ITX/PEAR
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)
Parameters
bool$show_question_only
Returns
string

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

References assQuestionGUI\getILIASPage().

258  {
259  // generate the question output
260  require_once './Services/UICore/classes/class.ilTemplate.php';
261  $template = new ilTemplate("tpl.il_as_qpl_numeric_output.html", TRUE, TRUE, "Modules/TestQuestionPool");
262  $template->setVariable("NUMERIC_SIZE", $this->object->getMaxChars());
263  $questiontext = $this->object->getQuestion();
264  $template->setVariable("QUESTIONTEXT", $this->object->prepareTextareaOutput($questiontext, TRUE));
265  $questionoutput = $template->get();
266  if (!$show_question_only)
267  {
268  // get page object output
269  $questionoutput = $this->getILIASPage($questionoutput);
270  }
271  return $questionoutput;
272  }
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 171 of file class.assNumericGUI.php.

References $pass, assQuestionGUI\getGenericFeedbackOutput(), and ilUtil\getImagePath().

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

424  {
425  $output = "";
426  return $this->object->prepareTextareaOutput($output, TRUE);
427  }

◆ getTestOutput()

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

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

References $_GET, $pass, $ref_id, ilObjTest\_getPass(), ilObjTest\_getUsePreviousAnswers(), assQuestionGUI\addTab_QuestionFeedback(), assQuestionGUI\addTab_QuestionHints(), ilTestExpressPage\getReturnToPageLink(), assQuestionGUI\outQuestionPage(), and assQuestionGUI\setQuestionTabs().

Referenced by outQuestionForTest().

283  {
284  $solutions = NULL;
285  // get the solution of the user for the active pass or from the last pass if allowed
286  if ($active_id)
287  {
288 
289  require_once './Modules/Test/classes/class.ilObjTest.php';
290  if (!ilObjTest::_getUsePreviousAnswers($active_id, true))
291  {
292  if (is_null($pass)) $pass = ilObjTest::_getPass($active_id);
293  }
294  $solutions =& $this->object->getSolutionValues($active_id, $pass);
295  }
296 
297  // generate the question output
298  require_once './Services/UICore/classes/class.ilTemplate.php';
299  $template = new ilTemplate("tpl.il_as_qpl_numeric_output.html", TRUE, TRUE, "Modules/TestQuestionPool");
300  if (is_array($solutions))
301  {
302  foreach ($solutions as $solution)
303  {
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  }
_getPass($active_id)
Retrieves the actual pass of a given user for a given test.
special template class to simplify handling of ITX/PEAR
_getUsePreviousAnswers($active_id, $user_active_user_setting=false)
Returns if the previous results should be hidden for a learner.
outQuestionPage($a_temp_var, $a_postponed=false, $active_id="", $html="")
output question page
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ outQuestionForTest()

assNumericGUI::outQuestionForTest (   $formaction,
  $active_id,
  $pass = NULL,
  $is_postponed = FALSE,
  $use_post_solutions = FALSE 
)
Parameters
string$formaction
integer$active_id
null | integer$pass
bool$is_postponed
bool$use_post_solutions

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

References $pass, and getTestOutput().

150  {
151  $test_output = $this->getTestOutput($active_id, $pass, $is_postponed, $use_post_solutions);
152  $this->tpl->setVariable("QUESTION_OUTPUT", $test_output);
153  $this->tpl->setVariable("FORMACTION", $formaction);
154  }
getTestOutput($active_id, $pass=NULL, $is_postponed=FALSE, $use_post_solutions=FALSE)
+ Here is the call graph for this function:

◆ populateAnswerSpecificFormPart()

assNumericGUI::populateAnswerSpecificFormPart ( \ilPropertyFormGUI  $form)

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

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

Referenced by editQuestion().

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

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

Referenced by editQuestion().

442  {
443  // maxchars
444  $maxchars = new ilNumberInputGUI($this->lng->txt( "maxchars" ), "maxchars");
445  $maxchars->setInfo($this->lng->txt('qpl_maxchars_info_numeric_question'));
446  $maxchars->setSize( 10 );
447  $maxchars->setDecimals( 0 );
448  $maxchars->setMinValue( 1 );
449  $maxchars->setRequired( true );
450  if ($this->object->getMaxChars() > 0)
451  {
452  $maxchars->setValue($this->object->getMaxChars());
453  }
454  $form->addItem( $maxchars );
455  }
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 583 of file class.assNumericGUI.php.

References assQuestionGUI\$tpl.

Referenced by getAggregatedAnswersView().

584  {
585  $tpl = new ilTemplate('tpl.il_as_aggregated_answers_table.html', true, true, "Modules/TestQuestionPool");
586  $tpl->setVariable( 'OPTION_HEADER', $this->lng->txt('answer') );
587  $tpl->setVariable( 'COUNT_HEADER', $this->lng->txt('count') );
588  $tpl->setVariable( 'AGGREGATION_HEADER', $this->lng->txt('aggregated_answers_header') );
589  asort($aggregate);
590  foreach ($aggregate as $answer => $count)
591  {
592  $tpl->setCurrentBlock( 'aggregaterow' );
593  $tpl->setVariable( 'OPTION', $answer );
594  $tpl->setVariable( 'COUNT', $count );
595  $tpl->parseCurrentBlock();
596  }
597  return $tpl;
598  }
special template class to simplify handling of ITX/PEAR
+ Here is the caller graph for this function:

◆ resetFormValuesForSuppressedPostvars()

assNumericGUI::resetFormValuesForSuppressedPostvars (   $form)

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

References $_POST.

528  {
529  $element = $form->getItemByPostvar('maxchars');
530  $_POST['maxchars'] = $this->object->getMaxChars();
531  $element->setValue( $this->object->getMaxChars() );
532  }
$_POST['username']
Definition: cron.php:12

◆ writeAnswerSpecificPostData()

assNumericGUI::writeAnswerSpecificPostData (   $always = false)

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

References $_POST.

Referenced by writePostData().

435  {
436  $this->object->setLowerLimit( $_POST['lowerlimit'] );
437  $this->object->setUpperLimit( $_POST['upperlimit'] );
438  $this->object->setPoints( $_POST['points'] );
439  }
$_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  {
70  $this->saveTaxonomyAssignments();
71  return 0;
72  }
73  return 1;
74  }
writeQuestionSpecificPostData($always=false)
Extracts the question specific values from $_POST and applies them to the data object.
writeAnswerSpecificPostData($always=false)
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 (   $always = false)

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

References $_POST.

Referenced by writePostData().

430  {
431  $this->object->setMaxChars( $_POST["maxchars"] );
432  }
$_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: