ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
ilNumberInputGUI Class Reference

This class represents a number property in a property form. More...

+ Inheritance diagram for ilNumberInputGUI:
+ Collaboration diagram for ilNumberInputGUI:

Public Member Functions

 __construct ($a_title="", $a_postvar="")
 Constructor. More...
 
 setSuffix ($a_value)
 Set suffix. More...
 
 getSuffix ()
 Get suffix. More...
 
 setValue ($a_value)
 Set Value. More...
 
 getValue ()
 Get Value. More...
 
 setMaxLength ($a_maxlength)
 Set Max Length. More...
 
 getMaxLength ()
 Get Max Length. More...
 
 setMinvalueShouldBeGreater ($a_bool)
 Set minvalueShouldBeGreater. More...
 
 minvalueShouldBeGreater ()
 Get minvalueShouldBeGreater. More...
 
 setMaxvalueShouldBeLess ($a_bool)
 Set maxvalueShouldBeLess. More...
 
 maxvalueShouldBeLess ()
 Get maxvalueShouldBeLess. More...
 
 setSize ($a_size)
 Set Size. More...
 
 setValueByArray ($a_values)
 Set value by array. More...
 
 getSize ()
 Get Size. More...
 
 setMinValue ($a_minvalue, $a_display_always=false)
 Set Minimum Value. More...
 
 getMinValue ()
 Get Minimum Value. More...
 
 setMaxValue ($a_maxvalue, $a_display_always=false)
 Set Maximum Value. More...
 
 getMaxValue ()
 Get Maximum Value. More...
 
 setDecimals ($a_decimals)
 Set Decimal Places. More...
 
 getDecimals ()
 Get Decimal Places. More...
 
 allowDecimals ($a_value)
 Toggle Decimals. More...
 
 areDecimalsAllowed ()
 
 checkInput ()
 Check input, strip slashes etc. More...
 
 insert ($a_tpl)
 Insert property html. More...
 
 render ()
 Insert property html. More...
 
 getPostValueForComparison ()
 parse post value to make it comparable More...
 
- Public Member Functions inherited from ilSubEnabledFormPropertyGUI
 addSubItem ($a_item)
 Add Subitem. More...
 
 getSubItems ()
 Get Subitems. More...
 
 getSubInputItemsRecursive ()
 returns a flat array of possibly existing subitems recursively More...
 
 checkSubItemsInput ()
 Check SubItems. More...
 
 getSubForm ()
 Get sub form html. More...
 
 getItemByPostVar ($a_post_var)
 Get item by post var. More...
 
- Public Member Functions inherited from ilFormPropertyGUI
 __construct ($a_title="", $a_postvar="")
 Constructor. More...
 
 executeCommand ()
 Execute command. More...
 
 getType ()
 Get Type. More...
 
 setTitle ($a_title)
 Set Title. More...
 
 getTitle ()
 Get Title. More...
 
 setPostVar ($a_postvar)
 Set Post Variable. More...
 
 getPostVar ()
 Get Post Variable. More...
 
 getFieldId ()
 Get Post Variable. More...
 
 setInfo ($a_info)
 Set Information Text. More...
 
 getInfo ()
 Get Information Text. More...
 
 setAlert ($a_alert)
 Set Alert Text. More...
 
 getAlert ()
 Get Alert Text. More...
 
 setRequired ($a_required)
 Set Required. More...
 
 getRequired ()
 Get Required. More...
 
 setDisabled ($a_disabled)
 Set Disabled. More...
 
 getDisabled ()
 Get Disabled. More...
 
 checkInput ()
 Check input, strip slashes etc. More...
 
 setParentForm ($a_parentform)
 Set Parent Form. More...
 
 getParentForm ()
 Get Parent Form. More...
 
 setParent ($a_val)
 Set Parent GUI object. More...
 
 getParent ()
 Get Parent GUI object. More...
 
 getSubForm ()
 Get sub form html. More...
 
 hideSubForm ()
 Sub form hidden on init? More...
 
 setHiddenTitle ($a_val)
 Set hidden title (for screenreaders) More...
 
 getHiddenTitle ()
 Get hidden title. More...
 
 getItemByPostVar ($a_post_var)
 Get item by post var. More...
 
 serializeData ()
 serialize data More...
 
 unserializeData ($a_data)
 unserialize data More...
 
 writeToSession ()
 Write to session. More...
 
 clearFromSession ()
 Clear session value. More...
 
 readFromSession ()
 Read from session. More...
 
 getHiddenTag ($a_post_var, $a_value)
 Get hidden tag (used for disabled properties) More...
 
 setMulti ($a_multi, $a_sortable=false, $a_addremove=true)
 Set Multi. More...
 
 getMulti ()
 Get Multi. More...
 
 setMultiValues (array $a_values)
 Set multi values. More...
 
 getMultiValues ()
 Get multi values. More...
 
 getContentOutsideFormTag ()
 Get content that has to reside outside of the parent form tag, e.g. More...
 
 stripSlashesAddSpaceFallback ($a_str)
 Strip slashes with add space fallback, see https://www.ilias.de/mantis/view.php?id=19727. More...
 
 getTableFilterLabelFor ()
 Get label "for" attribute value for filter. More...
 
 getFormLabelFor ()
 Get label "for" attribute value for form. More...
 

Protected Attributes

 $value
 
 $maxlength = 200
 
 $size = 40
 
 $suffix
 
 $minvalue = false
 
 $minvalueShouldBeGreater = false
 
 $minvalue_visible = false
 
 $maxvalue = false
 
 $maxvalueShouldBeLess = false
 
 $maxvalue_visible = false
 
 $decimals
 
 $allow_decimals = false
 
- Protected Attributes inherited from ilSubEnabledFormPropertyGUI
 $sub_items = array()
 
- Protected Attributes inherited from ilFormPropertyGUI
 $ctrl
 
 $lng
 
 $type
 
 $title
 
 $postvar
 
 $info
 
 $alert
 
 $required = false
 
 $parentgui
 
 $parentform
 
 $hidden_title = ""
 
 $multi = false
 
 $multi_sortable = false
 
 $multi_addremove = true
 
 $multi_values
 

Additional Inherited Members

- Static Public Member Functions inherited from ilFormPropertyGUI
static removeProhibitedCharacters ($a_text)
 Remove prohibited characters see #19159. More...
 
- Protected Member Functions inherited from ilFormPropertyGUI
 setType ($a_type)
 Set Type. More...
 
 getMultiIconsHTML ()
 Get HTML for multiple value icons. More...
 

Detailed Description

This class represents a number property in a property form.

Author
Alex Killing alex..nosp@m.kill.nosp@m.ing@g.nosp@m.mx.d.nosp@m.e
Version
$Id$

Definition at line 14 of file class.ilNumberInputGUI.php.

Constructor & Destructor Documentation

◆ __construct()

ilNumberInputGUI::__construct (   $a_title = "",
  $a_postvar = "" 
)

Constructor.

Parameters
string$a_titleTitle
string$a_postvarPost Variable

Definition at line 35 of file class.ilNumberInputGUI.php.

References $DIC.

36  {
37  global $DIC;
38 
39  $this->lng = $DIC->language();
40  parent::__construct($a_title, $a_postvar);
41  }
global $DIC
Definition: saml.php:7

Member Function Documentation

◆ allowDecimals()

ilNumberInputGUI::allowDecimals (   $a_value)

Toggle Decimals.

Parameters
bool$a_value

Definition at line 261 of file class.ilNumberInputGUI.php.

Referenced by ilCronDeleteInactivatedUserAccounts\addCustomSettingsToForm(), ilLoggerCronCleanErrorFiles\addCustomSettingsToForm(), ilExAssTypeTextGUI\addEditFormCustomProperties(), ilObjTestSettingsGeneralGUI\addTestRunProperties(), ilAssQuestionHintGUI\buildForm(), ilChatroomFormFactory\getGeneralSettingsForm(), ilObjForumAdministrationGUI\getSettingsForm(), ilCronManagerGUI\initEditForm(), ilObjUserFolderGUI\initFormGeneralSettings(), ilObjUserFolderGUI\initLoginSettingsForm(), assFormulaQuestionGUI\isSaveCommand(), assErrorTextGUI\populateAnswerSpecificFormPart(), assNumericGUI\populateAnswerSpecificFormPart(), assTextQuestionGUI\populateAnswerSpecificFormPart(), assNumericGUI\populateCorrectionsFormProperties(), assOrderingHorizontalGUI\populateCorrectionsFormProperties(), assFileUploadGUI\populateCorrectionsFormProperties(), assErrorTextGUI\populateCorrectionsFormProperties(), assOrderingQuestionGUI\populateCorrectionsFormProperties(), assClozeTestGUI\populateGapSizeFormPart(), assClozeTestGUI\populateNumericGapCorrectionFormProperty(), assClozeTestGUI\populateNumericGapFormPart(), assFileUploadGUI\populateQuestionSpecificFormPart(), assOrderingQuestionGUI\populateQuestionSpecificFormPart(), assOrderingHorizontalGUI\populateQuestionSpecificFormPart(), and setDecimals().

262  {
263  $this->allow_decimals = (bool) $a_value;
264  }
+ Here is the caller graph for this function:

◆ areDecimalsAllowed()

ilNumberInputGUI::areDecimalsAllowed ( )
Returns
bool

Definition at line 271 of file class.ilNumberInputGUI.php.

References $allow_decimals.

Referenced by render(), and setValue().

272  {
273  return $this->allow_decimals;
274  }
+ Here is the caller graph for this function:

◆ checkInput()

ilNumberInputGUI::checkInput ( )

Check input, strip slashes etc.

set alert, if input is not ok.

Returns
boolean Input ok, true/false

Definition at line 281 of file class.ilNumberInputGUI.php.

References $_POST, ilFormPropertyGUI\$lng, ilSubEnabledFormPropertyGUI\checkSubItemsInput(), getMaxValue(), getMinValue(), ilFormPropertyGUI\getPostVar(), ilFormPropertyGUI\getRequired(), maxvalueShouldBeLess(), minvalueShouldBeGreater(), ilFormPropertyGUI\setAlert(), and ilUtil\stripSlashes().

282  {
283  $lng = $this->lng;
284 
285  $_POST[$this->getPostVar()] = ilUtil::stripSlashes($_POST[$this->getPostVar()]);
286  if ($this->getRequired() && trim($_POST[$this->getPostVar()]) == "") {
287  $this->setAlert($lng->txt("msg_input_is_required"));
288  return false;
289  }
290 
291  if (trim($_POST[$this->getPostVar()]) != "" &&
292  !is_numeric(str_replace(',', '.', $_POST[$this->getPostVar()]))) {
293  $this->minvalue_visible = true;
294  $this->maxvalue_visible = true;
295  $this->setAlert($lng->txt("form_msg_numeric_value_required"));
296  return false;
297  }
298 
299  if ($this->minvalueShouldBeGreater()) {
300  if (trim($_POST[$this->getPostVar()]) != "" &&
301  $this->getMinValue() !== false &&
302  $_POST[$this->getPostVar()] <= $this->getMinValue()) {
303  $this->minvalue_visible = true;
304  $this->setAlert($lng->txt("form_msg_value_too_low"));
305  return false;
306  }
307  } else {
308  if (trim($_POST[$this->getPostVar()]) != "" &&
309  $this->getMinValue() !== false &&
310  $_POST[$this->getPostVar()] < $this->getMinValue()) {
311  $this->minvalue_visible = true;
312  $this->setAlert($lng->txt("form_msg_value_too_low"));
313  return false;
314  }
315  }
316 
317  if ($this->maxvalueShouldBeLess()) {
318  if (trim($_POST[$this->getPostVar()]) != "" &&
319  $this->getMaxValue() !== false &&
320  $_POST[$this->getPostVar()] >= $this->getMaxValue()) {
321  $this->maxvalue_visible = true;
322  $this->setAlert($lng->txt("form_msg_value_too_high"));
323  return false;
324  }
325  } else {
326  if (trim($_POST[$this->getPostVar()]) != "" &&
327  $this->getMaxValue() !== false &&
328  $_POST[$this->getPostVar()] > $this->getMaxValue()) {
329  $this->maxvalue_visible = true;
330  $this->setAlert($lng->txt("form_msg_value_too_high"));
331  return false;
332  }
333  }
334 
335  return $this->checkSubItemsInput();
336  }
getMinValue()
Get Minimum Value.
getPostVar()
Get Post Variable.
setAlert($a_alert)
Set Alert Text.
minvalueShouldBeGreater()
Get minvalueShouldBeGreater.
getMaxValue()
Get Maximum Value.
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
$_POST["username"]
maxvalueShouldBeLess()
Get maxvalueShouldBeLess.
+ Here is the call graph for this function:

◆ getDecimals()

ilNumberInputGUI::getDecimals ( )

Get Decimal Places.

Returns
int Decimal Places

Definition at line 251 of file class.ilNumberInputGUI.php.

References $decimals.

Referenced by render(), and setValue().

252  {
253  return $this->decimals;
254  }
+ Here is the caller graph for this function:

◆ getMaxLength()

ilNumberInputGUI::getMaxLength ( )

Get Max Length.

Returns
int Max Length

Definition at line 114 of file class.ilNumberInputGUI.php.

References $maxlength.

Referenced by render().

115  {
116  return $this->maxlength;
117  }
+ Here is the caller graph for this function:

◆ getMaxValue()

ilNumberInputGUI::getMaxValue ( )

Get Maximum Value.

Returns
float Maximum Value

Definition at line 228 of file class.ilNumberInputGUI.php.

References $maxvalue.

Referenced by checkInput(), and render().

229  {
230  return $this->maxvalue;
231  }
+ Here is the caller graph for this function:

◆ getMinValue()

ilNumberInputGUI::getMinValue ( )

Get Minimum Value.

Returns
float Minimum Value

Definition at line 206 of file class.ilNumberInputGUI.php.

References $minvalue.

Referenced by checkInput(), and render().

207  {
208  return $this->minvalue;
209  }
+ Here is the caller graph for this function:

◆ getPostValueForComparison()

ilNumberInputGUI::getPostValueForComparison ( )

parse post value to make it comparable

used by combination input gui

Definition at line 417 of file class.ilNumberInputGUI.php.

References $_POST, $value, ilFormPropertyGUI\getPostVar(), and ilUtil\stripSlashes().

418  {
420  if ($value != "") {
421  return (int) $value;
422  }
423  }
getPostVar()
Get Post Variable.
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
$_POST["username"]
+ Here is the call graph for this function:

◆ getSize()

ilNumberInputGUI::getSize ( )

Get Size.

Returns
int Size

Definition at line 184 of file class.ilNumberInputGUI.php.

References $size.

Referenced by render().

185  {
186  return $this->size;
187  }
+ Here is the caller graph for this function:

◆ getSuffix()

ilNumberInputGUI::getSuffix ( )

Get suffix.

Returns
string suffix

Definition at line 58 of file class.ilNumberInputGUI.php.

References $suffix.

Referenced by render().

59  {
60  return $this->suffix;
61  }
+ Here is the caller graph for this function:

◆ getValue()

ilNumberInputGUI::getValue ( )

Get Value.

Returns
string Value

Definition at line 94 of file class.ilNumberInputGUI.php.

References $value.

Referenced by ilChatroomMessageDeletionThresholdInputGUI\checkInput(), and render().

95  {
96  return $this->value;
97  }
+ Here is the caller graph for this function:

◆ insert()

ilNumberInputGUI::insert (   $a_tpl)

Insert property html.

Returns
int Size

Definition at line 343 of file class.ilNumberInputGUI.php.

References $html, and render().

344  {
345  $html = $this->render();
346 
347  $a_tpl->setCurrentBlock("prop_generic");
348  $a_tpl->setVariable("PROP_GENERIC", $html);
349  $a_tpl->parseCurrentBlock();
350  }
render()
Insert property html.
$html
Definition: example_001.php:87
+ Here is the call graph for this function:

◆ maxvalueShouldBeLess()

ilNumberInputGUI::maxvalueShouldBeLess ( )

Get maxvalueShouldBeLess.

Returns
boolean true if the maximum value should be less than maxvalue

Definition at line 154 of file class.ilNumberInputGUI.php.

References $maxvalueShouldBeLess.

Referenced by checkInput(), render(), and setMaxvalueShouldBeLess().

155  {
157  }
+ Here is the caller graph for this function:

◆ minvalueShouldBeGreater()

ilNumberInputGUI::minvalueShouldBeGreater ( )

Get minvalueShouldBeGreater.

Returns
boolean true if the minimum value should be greater than minvalue

Definition at line 134 of file class.ilNumberInputGUI.php.

References $minvalueShouldBeGreater.

Referenced by checkInput(), render(), and setMinvalueShouldBeGreater().

135  {
137  }
+ Here is the caller graph for this function:

◆ render()

ilNumberInputGUI::render ( )

Insert property html.

Definition at line 355 of file class.ilNumberInputGUI.php.

References ilFormPropertyGUI\$lng, $tpl, areDecimalsAllowed(), getDecimals(), ilFormPropertyGUI\getDisabled(), ilFormPropertyGUI\getFieldId(), getMaxLength(), getMaxValue(), getMinValue(), ilFormPropertyGUI\getPostVar(), ilFormPropertyGUI\getRequired(), getSize(), getSuffix(), getValue(), maxvalueShouldBeLess(), minvalueShouldBeGreater(), and ilUtil\prepareFormOutput().

Referenced by insert().

356  {
357  $lng = $this->lng;
358 
359  $tpl = new ilTemplate("tpl.prop_number.html", true, true, "Services/Form");
360 
361  if (strlen($this->getValue())) {
362  $tpl->setCurrentBlock("prop_number_propval");
363  $tpl->setVariable("PROPERTY_VALUE", ilUtil::prepareFormOutput($this->getValue()));
364  $tpl->parseCurrentBlock();
365  }
366  $tpl->setCurrentBlock("prop_number");
367 
368  $tpl->setVariable("POST_VAR", $this->getPostVar());
369  $tpl->setVariable("ID", $this->getFieldId());
370  $tpl->setVariable("SIZE", $this->getSize());
371  $tpl->setVariable("MAXLENGTH", $this->getMaxLength());
372  if (strlen($this->getSuffix())) {
373  $tpl->setVariable("INPUT_SUFFIX", $this->getSuffix());
374  }
375  if ($this->getDisabled()) {
376  $tpl->setVariable(
377  "DISABLED",
378  " disabled=\"disabled\""
379  );
380  }
381 
382  /*
383  $tpl->setVariable("JS_DECIMALS_ALLOWED", (int)$this->areDecimalsAllowed());
384  */
385 
386  // constraints
387  if ($this->areDecimalsAllowed() && $this->getDecimals() > 0) {
388  $constraints = $lng->txt("form_format") . ": ###." . str_repeat("#", $this->getDecimals());
389  $delim = ", ";
390  }
391  if ($this->getMinValue() !== false && $this->minvalue_visible) {
392  $constraints .= $delim . $lng->txt("form_min_value") . ": " . (($this->minvalueShouldBeGreater()) ? "&gt; " : "") . $this->getMinValue();
393  $delim = ", ";
394  }
395  if ($this->getMaxValue() !== false && $this->maxvalue_visible) {
396  $constraints .= $delim . $lng->txt("form_max_value") . ": " . (($this->maxvalueShouldBeLess()) ? "&lt; " : "") . $this->getMaxValue();
397  $delim = ", ";
398  }
399  if ($constraints != "") {
400  $tpl->setVariable("TXT_NUMBER_CONSTRAINTS", $constraints);
401  }
402 
403  if ($this->getRequired()) {
404  $tpl->setVariable("REQUIRED", "required=\"required\"");
405  }
406 
407  $tpl->parseCurrentBlock();
408 
409  return $tpl->get();
410  }
static prepareFormOutput($a_str, $a_strip=false)
prepares string output for html forms public
getMinValue()
Get Minimum Value.
$tpl
Definition: ilias.php:10
getPostVar()
Get Post Variable.
getMaxLength()
Get Max Length.
minvalueShouldBeGreater()
Get minvalueShouldBeGreater.
getMaxValue()
Get Maximum Value.
getFieldId()
Get Post Variable.
special template class to simplify handling of ITX/PEAR
getDecimals()
Get Decimal Places.
maxvalueShouldBeLess()
Get maxvalueShouldBeLess.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setDecimals()

ilNumberInputGUI::setDecimals (   $a_decimals)

Set Decimal Places.

Parameters
int$a_decimalsDecimal Places

Definition at line 238 of file class.ilNumberInputGUI.php.

References allowDecimals().

Referenced by SurveyMetricQuestionGUI\addFieldsToEditForm(), ilObjFileAccessSettingsGUI\initPreviewSettingsForm(), ilObjFileAccessSettingsGUI\initUploadSettingsForm(), and assJavaAppletGUI\populateQuestionSpecificFormPart().

239  {
240  $this->decimals = (int) $a_decimals;
241  if ($this->decimals) {
242  $this->allowDecimals(true);
243  }
244  }
allowDecimals($a_value)
Toggle Decimals.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setMaxLength()

ilNumberInputGUI::setMaxLength (   $a_maxlength)

◆ setMaxValue()

ilNumberInputGUI::setMaxValue (   $a_maxvalue,
  $a_display_always = false 
)

Set Maximum Value.

Parameters
float$a_maxvalueMaximum Value
bool$a_display_always

Definition at line 217 of file class.ilNumberInputGUI.php.

Referenced by ilObjMediaCastGUI\initSettingsForm(), and ilObjStyleSheetGUI\initTemplateGenerationForm().

218  {
219  $this->maxvalue = $a_maxvalue;
220  $this->maxvalue_visible = (bool) $a_display_always;
221  }
+ Here is the caller graph for this function:

◆ setMaxvalueShouldBeLess()

ilNumberInputGUI::setMaxvalueShouldBeLess (   $a_bool)

Set maxvalueShouldBeLess.

Parameters
boolean$a_booltrue if the maximum value should be less than maxvalue

Definition at line 144 of file class.ilNumberInputGUI.php.

References maxvalueShouldBeLess().

145  {
146  $this->maxvalueShouldBeLess = $a_bool;
147  }
maxvalueShouldBeLess()
Get maxvalueShouldBeLess.
+ Here is the call graph for this function:

◆ setMinValue()

ilNumberInputGUI::setMinValue (   $a_minvalue,
  $a_display_always = false 
)

Set Minimum Value.

Parameters
float$a_minvalueMinimum Value
bool$a_display_always

Definition at line 195 of file class.ilNumberInputGUI.php.

Referenced by ilConsultationHourCron\addCustomSettingsToForm(), ilChatroomFormFactory\getClientSettingsForm(), ilChatroomFormFactory\getGeneralSettingsForm(), ilObjMediaPoolGUI\initEditCustomForm(), ilObjCourseGUI\initEditForm(), ilObjRoleGUI\initFormRoleProperties(), ilObjAdvancedEditingGUI\initGeneralPageSettingsForm(), ilObjStyleSheetGUI\initTagStyleForm(), ilObjSystemFolderGUI\initWebServicesForm(), and assTextSubsetGUI\populateQuestionSpecificFormPart().

196  {
197  $this->minvalue = $a_minvalue;
198  $this->minvalue_visible = (bool) $a_display_always;
199  }
+ Here is the caller graph for this function:

◆ setMinvalueShouldBeGreater()

ilNumberInputGUI::setMinvalueShouldBeGreater (   $a_bool)

Set minvalueShouldBeGreater.

Parameters
boolean$a_booltrue if the minimum value should be greater than minvalue

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

References minvalueShouldBeGreater().

125  {
126  $this->minvalueShouldBeGreater = $a_bool;
127  }
minvalueShouldBeGreater()
Get minvalueShouldBeGreater.
+ Here is the call graph for this function:

◆ setSize()

◆ setSuffix()

ilNumberInputGUI::setSuffix (   $a_value)

◆ setValue()

ilNumberInputGUI::setValue (   $a_value)

Set Value.

Parameters
string$a_valueValue

Definition at line 68 of file class.ilNumberInputGUI.php.

References areDecimalsAllowed(), and getDecimals().

Referenced by assClozeTestGUI\addBasicQuestionFormProperties(), assQuestionGUI\addBasicQuestionFormProperties(), ilAdvancedMDFieldDefinitionText\addCustomFieldToDefinitionForm(), ilECSMappingSettingsGUI\dInitFormTreeSettings(), ilCourseObjectivesGUI\initFormRandom(), ilCASSettingsGUI\initFormSettings(), ilObjSystemFolderGUI\initJavaServerIniForm(), ilObjRepositorySettingsGUI\initSettingsForm(), assFileUploadGUI\populateQuestionSpecificFormPart(), assJavaAppletGUI\populateQuestionSpecificFormPart(), assFlashQuestionGUI\populateQuestionSpecificFormPart(), assErrorTextGUI\populateQuestionSpecificFormPart(), assOrderingQuestionGUI\populateQuestionSpecificFormPart(), assMatchingQuestionGUI\populateQuestionSpecificFormPart(), assClozeTestGUI\populateQuestionSpecificFormPart(), assOrderingHorizontalGUI\populateQuestionSpecificFormPart(), and setValueByArray().

69  {
70  $this->value = str_replace(',', '.', $a_value);
71 
72  // empty strings are allowed
73  if ($this->value != "") {
74  // integer
75  if (!$this->areDecimalsAllowed()) {
76  $this->value = round($this->value);
77  }
78  // float
79  elseif ($this->getDecimals() > 0) {
80  // get rid of unwanted decimals
81  $this->value = round($this->value, $this->getDecimals());
82 
83  // pad value to specified format
84  $this->value = number_format($this->value, $this->getDecimals(), ".", "");
85  }
86  }
87  }
getDecimals()
Get Decimal Places.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setValueByArray()

ilNumberInputGUI::setValueByArray (   $a_values)

Set value by array.

Parameters
array$a_valuesvalue array

Definition at line 174 of file class.ilNumberInputGUI.php.

References ilFormPropertyGUI\getPostVar(), and setValue().

Referenced by ilChatroomMessageDeletionThresholdInputGUI\checkInput().

175  {
176  $this->setValue($a_values[$this->getPostVar()]);
177  }
setValue($a_value)
Set Value.
getPostVar()
Get Post Variable.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ $allow_decimals

ilNumberInputGUI::$allow_decimals = false
protected

Definition at line 27 of file class.ilNumberInputGUI.php.

Referenced by areDecimalsAllowed().

◆ $decimals

ilNumberInputGUI::$decimals
protected

Definition at line 26 of file class.ilNumberInputGUI.php.

Referenced by getDecimals().

◆ $maxlength

ilNumberInputGUI::$maxlength = 200
protected

Definition at line 17 of file class.ilNumberInputGUI.php.

Referenced by getMaxLength().

◆ $maxvalue

ilNumberInputGUI::$maxvalue = false
protected

Definition at line 23 of file class.ilNumberInputGUI.php.

Referenced by getMaxValue().

◆ $maxvalue_visible

ilNumberInputGUI::$maxvalue_visible = false
protected

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

◆ $maxvalueShouldBeLess

ilNumberInputGUI::$maxvalueShouldBeLess = false
protected

Definition at line 24 of file class.ilNumberInputGUI.php.

Referenced by maxvalueShouldBeLess().

◆ $minvalue

ilNumberInputGUI::$minvalue = false
protected

Definition at line 20 of file class.ilNumberInputGUI.php.

Referenced by getMinValue().

◆ $minvalue_visible

ilNumberInputGUI::$minvalue_visible = false
protected

Definition at line 22 of file class.ilNumberInputGUI.php.

◆ $minvalueShouldBeGreater

ilNumberInputGUI::$minvalueShouldBeGreater = false
protected

Definition at line 21 of file class.ilNumberInputGUI.php.

Referenced by minvalueShouldBeGreater().

◆ $size

ilNumberInputGUI::$size = 40
protected

Definition at line 18 of file class.ilNumberInputGUI.php.

Referenced by getSize().

◆ $suffix

ilNumberInputGUI::$suffix
protected

Definition at line 19 of file class.ilNumberInputGUI.php.

Referenced by getSuffix().

◆ $value

ilNumberInputGUI::$value
protected

Definition at line 16 of file class.ilNumberInputGUI.php.

Referenced by getPostValueForComparison(), and getValue().


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